From ca6ee0e9ef85e744bf55ea24aa31091f42efc4dd Mon Sep 17 00:00:00 2001 From: Evgeny Kryshen Date: Mon, 9 Jun 2025 14:07:23 +0300 Subject: [PATCH 001/116] [Common] Setting processRun2 to true by default (#11514) --- Common/TableProducer/eventSelection.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index b06e98b84c5..3c989f1848a 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -1223,7 +1223,7 @@ struct LumiTask { LOGP(debug, "Dummy process function for Run 2"); } - PROCESS_SWITCH(LumiTask, processRun2, "Process Run2 lumi task", false); + PROCESS_SWITCH(LumiTask, processRun2, "Process Run2 lumi task", true); void processRun3(BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) { From 77cdd75a1a3376b8b94aeeeb017f8bc52128f34f Mon Sep 17 00:00:00 2001 From: basiach <74355517+basiach@users.noreply.github.com> Date: Mon, 9 Jun 2025 14:33:33 +0200 Subject: [PATCH 002/116] [PWGCF] FemtoUniverse - Adding centrality for MC cascades and a PDG histogram (#11517) Co-authored-by: Barbara Chytla --- .../femtoUniverseProducerTask.cxx | 41 +++++++++++++++++++ .../Tasks/femtoUniverseEfficiencyBase.cxx | 6 +++ ...toUniversePairTaskTrackCascadeExtended.cxx | 7 +++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 00ed3161ce7..e9a07329468 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -2336,6 +2336,47 @@ struct FemtoUniverseProducerTask { } PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCasc, "Provide both MC truth and reco for tracks and Cascades", false); + void processTruthAndFullMCCentRun3Casc( + aod::McCollisions const& mccols, + aod::McParticles const& mcParticles, + aod::FemtoFullCollisionCentRun3MCs const& collisions, + soa::Filtered> const& tracks, + soa::Join const& fullCascades, + aod::BCsWithTimestamps const&) + { + + // recos + std::set recoMcIds; + for (const auto& col : collisions) { + auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); + auto groupedCascParts = fullCascades.sliceBy(perCollisionCascs, col.globalIndex()); + getMagneticFieldTesla(col.bc_as()); + const auto colcheck = fillCollisionsCentRun3(col); + if (colcheck) { + fillTracks(groupedTracks); + fillCascade(col, groupedCascParts, groupedTracks); + } + for (const auto& track : groupedTracks) { + if (trackCuts.isSelectedMinimal(track)) + recoMcIds.insert(track.mcParticleId()); + } + } + + // truth + for (const auto& mccol : mccols) { + auto groupedCollisions = collisions.sliceBy(recoCollsPerMCCollCentPbPb, mccol.globalIndex()); + for (const auto& col : groupedCollisions) { + const auto colcheck = fillMCTruthCollisionsCentRun3(col); // fills the reco collisions for mc collision + if (colcheck) { + auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); + outputCollExtra(1.0, 1.0); + fillParticles(groupedMCParticles, recoMcIds); // fills mc particles + } + } + } + } + PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3Casc, "Provide both MC truth and reco for tracks and cascades with centrality", false); + Preslice> perCollisionD0s = aod::track::collisionId; void processTrackD0MC(aod::McCollisions const& mccols, aod::TracksWMc const&, diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx index 92e42134f0a..5397acf05dc 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx @@ -160,6 +160,7 @@ struct FemtoUniverseEfficiencyBase { trackHistoPartOneRec.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarDCABins, 0, confPDGCodePartOne, confIsDebug); registryMCOrigin.add("part1/hPt", " ;#it{p}_{T} (GeV/c); Entries", {HistType::kTH1F, {{240, 0, 6}}}); registryPDG.add("part1/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}}); + registryPDG.add("part1/PDGvspTall", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}}); if (confParticleTypePartOne == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) { trackHistoV0OneRec.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarCPABins, 0, confPDGCodePartOne, confIsDebug); trackHistoV0OneChildPosRec.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarDCABins, 0, 0, confIsDebug, "posChildV0_1"); @@ -169,6 +170,7 @@ struct FemtoUniverseEfficiencyBase { } registryPDG.add("part2/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}}); + registryPDG.add("part2/PDGvspTall", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}}); if (!confIsSame) { trackHistoPartTwoGen.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarPDGBins, 0, confPDGCodePartTwo, false); trackHistoPartTwoRec.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarDCABins, 0, confPDGCodePartTwo, confIsDebug); @@ -373,6 +375,8 @@ struct FemtoUniverseEfficiencyBase { continue; } + registryPDG.fill(HIST("part1/PDGvspTall"), part.pt(), mcParticle.pdgMCTruth()); + if (!(std::abs(mcParticle.pdgMCTruth()) == std::abs(confPDGCodePartOne))) { continue; } @@ -397,6 +401,8 @@ struct FemtoUniverseEfficiencyBase { continue; } + registryPDG.fill(HIST("part2/PDGvspTall"), part.pt(), mcParticle.pdgMCTruth()); + if (!(std::abs(mcParticle.pdgMCTruth()) == std::abs(confPDGCodePartTwo))) { continue; } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index e4ebe2db60a..026cabb1367 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -631,6 +631,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { // MC truth void processSameEventMCgen(const FilteredFDCollision& col, [[maybe_unused]] const FemtoFullParticles& 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); @@ -665,7 +667,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { int pdgCodeCasc = static_cast(p2.pidCut()); if ((confCascType1 == 0 && pdgCodeCasc != 3334) || (confCascType1 == 2 && pdgCodeCasc != -3334) || (confCascType1 == 1 && pdgCodeCasc != 3312) || (confCascType1 == 3 && pdgCodeCasc != -3312)) continue; - sameEventCont.setPair(p1, p2, col.multNtr(), confUse3D, 1.0f); + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } } @@ -676,6 +678,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { 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); @@ -692,7 +695,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { int pdgCodeCasc = static_cast(p2.pidCut()); if ((confCascType1 == 0 && pdgCodeCasc != 3334) || (confCascType1 == 2 && pdgCodeCasc != -3334) || (confCascType1 == 1 && pdgCodeCasc != 3312) || (confCascType1 == 3 && pdgCodeCasc != -3312)) continue; - mixedEventCont.setPair(p1, p2, collision1.multNtr(), confUse3D, 1.0f); + mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } } From 251b2ea844753c81487fe0dbc5cd9363f61627e8 Mon Sep 17 00:00:00 2001 From: Rahul Verma <110929992+rahulverma012@users.noreply.github.com> Date: Mon, 9 Jun 2025 20:26:52 +0530 Subject: [PATCH 003/116] [Common] modified aod::TracksQA_002 to aod::TracksQAVersion (#11485) Co-authored-by: Anton Alkin --- Common/TableProducer/occupancyTableProducer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/occupancyTableProducer.cxx b/Common/TableProducer/occupancyTableProducer.cxx index 2e4a01ddbb1..95d1ca72dea 100644 --- a/Common/TableProducer/occupancyTableProducer.cxx +++ b/Common/TableProducer/occupancyTableProducer.cxx @@ -1692,7 +1692,7 @@ struct TrackMeanOccTableProducer { } } - using MyTracksQA = aod::TracksQA_002; + using MyTracksQA = aod::TracksQAVersion; // using MyTracksQA = aod::TracksQA_002; // Process the Data int dfCount = 0; From 18fa5fc45d2adf1a98befd9b97889c87732b4c4c Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Mon, 9 Jun 2025 21:23:33 +0200 Subject: [PATCH 004/116] [PWGCF] FemtoUniverse: Fine binning the helicity angle distribution (#11521) --- PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx index d35aa3fa779..fe1bf2e7983 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx @@ -85,7 +85,7 @@ struct FemtoUniverseDebugV0 { negativeChildHistos.init(&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, confPDGCodeNegativeChild, true); V0Histos.init(&V0Registry, confV0TempFitVarpTBins, confV0TempFitVarBins, false, confPDGCodeV0.value, true); - thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {50, -5, 5}}); + thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); } /// Produce QA plots for V0 selection in FemtoUniverse framework From 87a0260995873329b1f3ccc030dea8924586f1c6 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Mon, 9 Jun 2025 22:09:34 +0200 Subject: [PATCH 005/116] [PWGLF] Improve variable selection in mixed event (#11522) --- .../Tasks/Strangeness/taskLambdaSpinCorr.cxx | 135 +++++++++++------- 1 file changed, 87 insertions(+), 48 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 9badfb4b4ba..0472e380aed 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -61,8 +61,8 @@ struct LfTaskLambdaSpinCorr { Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } rctCut; // mixing - Configurable cosCalculation{"cosCalculation", 1, "cos calculation"}; - Configurable mixingCombination{"mixingCombination", 1, "mixing Combination"}; + Configurable cosCalculation{"cosCalculation", 0, "cos calculation"}; + Configurable mixingCombination{"mixingCombination", 0, "mixing Combination"}; Configurable mixingEvSel{"mixingEvSel", false, "mixingEvSel"}; Configurable cfgCutOccupancy{"cfgCutOccupancy", 2000, "Occupancy cut"}; ConfigurableAxis axisVertex{"axisVertex", {5, -10, 10}, "vertex axis for bin"}; @@ -128,7 +128,8 @@ struct LfTaskLambdaSpinCorr { AxisSpec thnAxisInvMasspair{iMNbinspair, lbinIMpair, hbinIMpair, "#it{M} (GeV/#it{c}^{2})"}; histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); histos.add("hPtDiff", "hPtDiff", kTH1F, {{1000, 0, 100.0}}); - histos.add("hRDiff", "hRDiff", kTH1F, {{640, 0, 16.0}}); + histos.add("hPhiDiff", "hPhiDiff", kTH1F, {{800, -8.0, 8.0}}); + histos.add("hRDiff", "hRDiff", kTH1F, {{640, -16.0, 16.0}}); histos.add("hv0Mult", "hv0Mult", kTH1F, {{10001, -0.5, 10000.5}}); histos.add("hCentrality", "Centrality distribution", kTH1F, {{configcentAxis}}); histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisInvMass, configthnAxisPol, configcentAxis, thnAxisInvMasspair}, true); @@ -244,8 +245,8 @@ struct LfTaskLambdaSpinCorr { const ROOT::Math::PxPyPzMVector& Lambdadummy, const ROOT::Math::PxPyPzMVector& AntiLambdadummy) { - const double minMass = 1.0; - const double maxMass = 2.0; + const double minMass = 1.09; + const double maxMass = 1.14; return (lambdaTag && aLambdaTag && (Lambdadummy.M() > minMass && Lambdadummy.M() < maxMass) && (AntiLambdadummy.M() > minMass && AntiLambdadummy.M() < maxMass)); @@ -293,8 +294,8 @@ struct LfTaskLambdaSpinCorr { double cosTheta2 = proton2LambdaRF.Vect().Unit().Dot(quantizationAxis); cosThetaDiff = cosTheta1 * cosTheta2; } - - double deltaR = TMath::Sqrt(TMath::Power(particle1.Eta() - particle2.Eta(), 2.0) + TMath::Power(particle1.Phi() - particle2.Phi(), 2.0)); + double deltaPhi = RecoDecay::constrainAngle(particle1.Phi() - particle2.Phi(), 0.0); + double deltaR = TMath::Sqrt(TMath::Power(particle1.Eta() - particle2.Eta(), 2.0) + TMath::Power(deltaPhi, 2.0)); if (datatype == 0) { if (tag1 && tag3) { histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); @@ -411,7 +412,7 @@ struct LfTaskLambdaSpinCorr { return {lambdaTag, aLambdaTag, true}; // Valid candidate } - + ROOT::Math::PxPyPzMVector lambda0, antiLambda0, proton0, pion0, antiProton0, antiPion0; ROOT::Math::PxPyPzMVector lambda, antiLambda, proton, pion, antiProton, antiPion; ROOT::Math::PxPyPzMVector lambda2, antiLambda2, proton2, pion2, antiProton2, antiPion2; ROOT::Math::PxPyPzMVector lambdamc, antiLambdamc, protonmc, pionmc, antiProtonmc, antiPionmc; @@ -478,7 +479,12 @@ struct LfTaskLambdaSpinCorr { pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassPionCharged); antiLambda = antiProton + pion; } - + if (lambdaTag && (lambda.M() < lbinIM || lambda.M() > hbinIM)) { + continue; + } + if (aLambdaTag && (antiLambda.M() < lbinIM || antiLambda.M() > hbinIM)) { + continue; + } auto postrack1 = v0.template posTrack_as(); auto negtrack1 = v0.template negTrack_as(); @@ -504,6 +510,12 @@ struct LfTaskLambdaSpinCorr { pion2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), o2::constants::physics::MassPionCharged); antiLambda2 = antiProton2 + pion2; } + if (lambdaTag2 && (lambda2.M() < lbinIM || lambda2.M() > hbinIM)) { + continue; + } + if (aLambdaTag2 && (antiLambda2.M() < lbinIM || antiLambda2.M() > hbinIM)) { + continue; + } auto postrack2 = v02.template posTrack_as(); auto negtrack2 = v02.template negTrack_as(); if (postrack1.globalIndex() == postrack2.globalIndex() || negtrack1.globalIndex() == negtrack2.globalIndex()) { @@ -630,8 +642,42 @@ struct LfTaskLambdaSpinCorr { if (postrack1.globalIndex() == postrack2.globalIndex() || negtrack1.globalIndex() == negtrack2.globalIndex()) { continue; } - auto samePairSumPt = t1.pt() + t2.pt(); - auto samePairR = TMath::Sqrt(TMath::Power(t1.phi() - t2.phi(), 2.0) + TMath::Power(t1.eta() - t2.eta(), 2.0)); + // auto samePairSumPt = t1.pt() + t2.pt(); + double deltaPhiSame = RecoDecay::constrainAngle(t1.phi() - t2.phi(), 0.0); + auto samePairR = TMath::Sqrt(TMath::Power(deltaPhiSame, 2.0) + TMath::Power(t1.eta() - t2.eta(), 2.0)); + + if (lambdaTag1) { + proton0 = ROOT::Math::PxPyPzMVector(t1.pxpos(), t1.pypos(), t1.pzpos(), o2::constants::physics::MassProton); + antiPion0 = ROOT::Math::PxPyPzMVector(t1.pxneg(), t1.pyneg(), t1.pzneg(), o2::constants::physics::MassPionCharged); + lambda0 = proton0 + antiPion0; + } + if (aLambdaTag1) { + antiProton0 = ROOT::Math::PxPyPzMVector(t1.pxneg(), t1.pyneg(), t1.pzneg(), o2::constants::physics::MassProton); + pion0 = ROOT::Math::PxPyPzMVector(t1.pxpos(), t1.pypos(), t1.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda0 = antiProton0 + pion0; + } + if (lambdaTag1 && (lambda0.M() < lbinIM || lambda0.M() > hbinIM)) { + continue; + } + if (aLambdaTag1 && (antiLambda0.M() < lbinIM || antiLambda0.M() > hbinIM)) { + continue; + } + if (lambdaTag2) { + proton = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassProton); + antiPion = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassPionCharged); + lambda = proton + antiPion; + } + if (aLambdaTag2) { + antiProton = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassProton); + pion = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda = antiProton + pion; + } + if (lambdaTag2 && (lambda.M() < lbinIM || lambda.M() > hbinIM)) { + continue; + } + if (aLambdaTag2 && (antiLambda.M() < lbinIM || antiLambda.M() > hbinIM)) { + continue; + } for (const auto& t3 : groupV03) { // if (pairStatus[t3.index()][t2.index()]) { // LOGF(info, "repeat match found v0 id: (%d, %d)", t3.index(), t2.index()); @@ -653,55 +699,49 @@ struct LfTaskLambdaSpinCorr { if (lambdaTag1 != lambdaTag3 || aLambdaTag1 != aLambdaTag3) { continue; } - // if (std::abs(t1.pt() - t3.pt()) > ptMix) { - // continue; - // } - // if (std::abs(t1.eta() - t3.eta()) > etaMix) { - // continue; - // } - // if (std::abs(t1.phi() - t3.phi()) > phiMix) { - // continue; - // } - auto mixPairSumPt = t3.pt() + t2.pt(); - auto mixPairR = TMath::Sqrt(TMath::Power(t3.phi() - t2.phi(), 2.0) + TMath::Power(t3.eta() - t2.eta(), 2.0)); - histos.fill(HIST("hPtDiff"), TMath::Abs(mixPairSumPt - samePairSumPt)); - histos.fill(HIST("hRDiff"), TMath::Abs(mixPairR - samePairR)); - if (mixingCombination == 0 && std::abs(t1.pt() - t3.pt()) > ptMix) { - continue; + + if (lambdaTag3) { + proton2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassProton); + antiPion2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassPionCharged); + lambda2 = proton2 + antiPion2; + } + if (aLambdaTag3) { + antiProton2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassProton); + pion2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda2 = antiProton2 + pion2; } - if (mixingCombination == 0 && std::abs(t1.eta() - t3.eta()) > etaMix) { + if (lambdaTag3 && (lambda2.M() < lbinIM || lambda2.M() > hbinIM)) { continue; } - if (mixingCombination == 0 && std::abs(t1.phi() - t3.phi()) > phiMix) { + if (aLambdaTag3 && (antiLambda2.M() < lbinIM || antiLambda2.M() > hbinIM)) { continue; } + double deltaPhiMix = RecoDecay::constrainAngle(t3.phi() - t2.phi(), 0.0); + auto mixPairR = TMath::Sqrt(TMath::Power(deltaPhiMix, 2.0) + TMath::Power(t3.eta() - t2.eta(), 2.0)); + auto etaDiff = t1.eta() - t3.eta(); + auto phiDiff = RecoDecay::constrainAngle(t1.phi() - t3.phi(), 0.0); - if (mixingCombination == 1 && std::abs(mixPairSumPt - samePairSumPt) > ptMix) { + histos.fill(HIST("hPtDiff"), t1.pt() - t3.pt()); + histos.fill(HIST("hPhiDiff"), phiDiff); + histos.fill(HIST("hRDiff"), etaDiff); + + if (mixingCombination == 0 && std::abs(t1.pt() - t3.pt()) > ptMix) { continue; } - if (mixingCombination == 1 && std::abs(mixPairR - samePairR) > etaMix) { + if (mixingCombination == 0 && t1.eta() * t3.eta() > 0 && std::abs(etaDiff) > etaMix) { continue; } - if (lambdaTag2) { - proton = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassProton); - antiPion = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassPionCharged); - lambda = proton + antiPion; - } - if (aLambdaTag2) { - antiProton = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassProton); - pion = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassPionCharged); - antiLambda = antiProton + pion; + if (mixingCombination == 0 && phiDiff > phiMix) { + continue; } - if (lambdaTag3) { - proton2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassProton); - antiPion2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassPionCharged); - lambda2 = proton2 + antiPion2; + + if (mixingCombination == 1 && std::abs(t1.pt() - t3.pt()) > ptMix) { + continue; } - if (aLambdaTag3) { - antiProton2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassProton); - pion2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassPionCharged); - antiLambda2 = antiProton2 + pion2; + if (mixingCombination == 1 && std::abs(mixPairR - samePairR) > etaMix) { + continue; } + if (lambdaTag2 && lambdaTag3) { fillHistograms(1, 0, 1, 0, lambda, lambda2, proton, proton2, centrality, 2); } else if (aLambdaTag2 && aLambdaTag3) { @@ -714,7 +754,6 @@ struct LfTaskLambdaSpinCorr { continue; } pairfound = true; - // pairStatus[t3.index()][t2.index()] = true; pairStatus[t3.index()][t2.index()] = true; // LOGF(info, "v0 id: (%d, %d)", t3.index(), t2.index()); if (pairfound) { From 391cc72f9107f774b04ced9fe22e043bf51dce71 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Tue, 10 Jun 2025 02:24:16 +0530 Subject: [PATCH 006/116] [PWGLF] fix event selection hist (#11524) Co-authored-by: sarjeeta gami --- PWGLF/Tasks/Resonances/kstarpbpb.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/kstarpbpb.cxx b/PWGLF/Tasks/Resonances/kstarpbpb.cxx index 0093b921c80..a8ad0497647 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.cxx @@ -184,9 +184,9 @@ struct kstarpbpb { AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; if (!fillSA) { + histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); if (same) { histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisPt, configThnAxisV2, configThnAxisCentrality}); - histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); } if (like) { histos.add("hSparseV2SAlikeEventNN_V2", "hSparseV2SAlikeEventNN_V2", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisPt, configThnAxisV2, configThnAxisCentrality}); From 5224c360dc6521fb39050a8dbb4ef762b4876b7c Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Mon, 9 Jun 2025 23:23:01 +0200 Subject: [PATCH 007/116] [PWGLF] use material LUT in fit and propagation (#11513) --- .../Strangeness/LFStrangeTreeCreator.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/LFStrangeTreeCreator.cxx b/PWGLF/TableProducer/Strangeness/LFStrangeTreeCreator.cxx index 955b4ebc142..4ab2f0cc745 100644 --- a/PWGLF/TableProducer/Strangeness/LFStrangeTreeCreator.cxx +++ b/PWGLF/TableProducer/Strangeness/LFStrangeTreeCreator.cxx @@ -157,8 +157,8 @@ struct LFStrangeTreeCreator { int mRunNumber; float d_bz; - // o2::base::MatLayerCylSet* lut = nullptr; - Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; + o2::base::MatLayerCylSet* lut = nullptr; + Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; @@ -248,7 +248,11 @@ struct LFStrangeTreeCreator { mRunNumber = bc.runNumber(); fitter.setBz(d_bz); - // o2::base::Propagator::Instance()->setMatLUT(lut); + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); + o2::base::Propagator::Instance()->setMatLUT(lut); + + int mat{static_cast(cfgMaterialCorrection)}; + fitter.setMatCorrType(static_cast(mat)); } void init(o2::framework::InitContext&) @@ -261,7 +265,6 @@ struct LFStrangeTreeCreator { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - // lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); fitter.setPropagateToPCA(true); fitter.setMaxR(200.); @@ -272,8 +275,6 @@ struct LFStrangeTreeCreator { fitter.setMaxChi2(1e9); fitter.setUseAbsDCA(true); fitter.setWeightedFinalPCA(false); - int mat{static_cast(cfgMaterialCorrection)}; - fitter.setMatCorrType(static_cast(mat)); // event QA histos.add("QA/zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); From cb9ff1bc2854dc917e8ea5c1b38b4aea72e66aef Mon Sep 17 00:00:00 2001 From: mherzer <96999709+mherzer28@users.noreply.github.com> Date: Mon, 9 Jun 2025 23:50:29 +0200 Subject: [PATCH 008/116] [PWGLF] added second option for mass calculation (#11459) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx | 47 ++++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx index a33295b6021..f00fc314870 100644 --- a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx @@ -35,6 +35,7 @@ #include "PWGLF/DataModel/LFParticleIdentification.h" #include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/pidTOFGeneric.h" #include namespace o2::aod @@ -113,7 +114,7 @@ static const std::vector particleCharge{1, 2}; static const std::vector particleChargeFactor{2.3, 2.55}; static const std::vector betheBlochParNames{ "p0", "p1", "p2", "p3", "p4", "resolution"}; -constexpr float betheBlochDefault[nParticles][nBetheParams]{ +constexpr float BetheBlochDefault[nParticles][nBetheParams]{ {0.248753, 3.58634, 0.0167065, 2.29194, 0.774344, 0.07}, // triton {0.0274556, 18.3054, 3.99987e-05, 3.17219, 11.1775, @@ -126,7 +127,8 @@ using TracksFull = soa::Join; + aod::TOFSignal, aod::TrackSelectionExtension, + o2::aod::EvTimeTOFFT0ForTrack>; class Particle { @@ -186,7 +188,7 @@ struct TrHeAnalysis { } evselOptions; 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"}; // 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"}; @@ -226,7 +228,7 @@ struct TrHeAnalysis { Configurable nsigmaTPCTr{"nsigmaTPCTr", 5.f, "Value of the Nsigma TPC cut for tritons"}; Configurable nsigmaTPCHe{"nsigmaTPCHe", 5.f, "Value of the Nsigma TPC cut for helium-3"}; } nsigmaTPCvar; - Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {BetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; void init(o2::framework::InitContext&) { @@ -663,12 +665,14 @@ struct TrHeAnalysis { constexpr int NNumLayers = 8; constexpr int NBitsPerLayer = 4; constexpr int NBitMask = (1 << NBitsPerLayer) - 1; + int sum = 0, n = 0; for (int i = 0; i < NNumLayers; i++) { int clsSize = (track.itsClusterSizes() >> (NBitsPerLayer * i)) & NBitMask; sum += clsSize; - if (clsSize) + if (clsSize) { n++; + } } return n > 0 ? static_cast(sum) / n : 0.f; } @@ -681,13 +685,34 @@ struct TrHeAnalysis { return hePID ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); } template - float getMass(T const& track) + float getMass(const T& track) { - 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)); - return mass; + if (cfgMassMethod == 0) { + return track.mass(); + } + 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; + } + if (cfgMassMethod == 2) { + const float rigidity = getRigidity(track); + float tofStartTime = track.evTimeForTrack(); + float tofTime = track.tofSignal(); + constexpr float CInCmPs = 2.99792458e-2f; + float length = track.length(); + 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 mass = rigidity / std::sqrt(gamma * gamma - 1.f); + return mass; + } + return -1.f; + } + return -1.f; } }; From 8970fedaaefef8f5c4e36d7381e21cc22861b2c9 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 10 Jun 2025 00:27:03 +0200 Subject: [PATCH 009/116] [PWGEM/Dilepton] update dimuon analyses (#11526) --- PWGEM/Dilepton/Core/DielectronCut.h | 16 +- PWGEM/Dilepton/Core/Dilepton.h | 6 + PWGEM/Dilepton/Core/DileptonMC.h | 6 + PWGEM/Dilepton/Core/DimuonCut.cxx | 16 ++ PWGEM/Dilepton/Core/DimuonCut.h | 25 +++ PWGEM/Dilepton/Core/SingleTrackQC.h | 14 ++ PWGEM/Dilepton/Core/SingleTrackQCMC.h | 12 ++ .../treeCreatorElectronMLDDA.cxx | 177 ++++++++++-------- PWGEM/Dilepton/Tasks/createResolutionMap.cxx | 27 ++- PWGEM/Dilepton/Utils/EMTrackUtilities.h | 26 ++- 10 files changed, 226 insertions(+), 99 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 9ad54af870c..eec8c0928b9 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -359,13 +359,13 @@ class DielectronCut : public TNamed { switch (cut) { case DielectronCuts::kTrackPtRange: - return track.pt() >= mMinTrackPt && track.pt() <= mMaxTrackPt; + return track.pt() > mMinTrackPt && track.pt() < mMaxTrackPt; case DielectronCuts::kTrackEtaRange: - return track.eta() >= mMinTrackEta && track.eta() <= mMaxTrackEta; + return track.eta() > mMinTrackEta && track.eta() < mMaxTrackEta; case DielectronCuts::kTrackPhiRange: - return track.phi() >= mMinTrackPhi && track.phi() <= mMaxTrackPhi; + return track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi; case DielectronCuts::kTPCNCls: return track.tpcNClsFound() >= mMinNClustersTPC; @@ -374,10 +374,10 @@ class DielectronCut : public TNamed return track.tpcNClsCrossedRows() >= mMinNCrossedRowsTPC; case DielectronCuts::kTPCCrossedRowsOverNCls: - return track.tpcCrossedRowsOverFindableCls() >= mMinNCrossedRowsOverFindableClustersTPC; + return track.tpcCrossedRowsOverFindableCls() > mMinNCrossedRowsOverFindableClustersTPC; case DielectronCuts::kTPCFracSharedClusters: - return track.tpcFractionSharedCls() <= mMaxFracSharedClustersTPC; + return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; case DielectronCuts::kRelDiffPin: return mMinRelDiffPin < (track.tpcInnerParam() - track.p()) / track.p() && (track.tpcInnerParam() - track.p()) / track.p() < mMaxRelDiffPin; @@ -386,13 +386,13 @@ class DielectronCut : public TNamed return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; case DielectronCuts::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 DielectronCuts::kDCAxy: - return std::fabs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); + return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); case DielectronCuts::kDCAz: - return std::fabs(track.dcaZ()) <= mMaxDcaZ; + return std::fabs(track.dcaZ()) < mMaxDcaZ; case DielectronCuts::kITSNCls: return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 95bd4a0b6f8..46cecc81c87 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -281,6 +281,10 @@ struct Dilepton { Configurable cfg_min_rabs{"cfg_min_rabs", 17.6, "min Radius at the absorber end"}; Configurable cfg_max_rabs{"cfg_max_rabs", 89.5, "max Radius at the absorber end"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; + Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -749,6 +753,8 @@ struct Dilepton { fDimuonCut.SetDCAxy(0.f, dimuoncuts.cfg_max_dcaxy); fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); + fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons + fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); } template diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 769c6b72ec3..00cec907de5 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -273,6 +273,10 @@ struct DileptonMC { Configurable cfg_min_rabs{"cfg_min_rabs", 17.6, "min Radius at the absorber end"}; Configurable cfg_max_rabs{"cfg_max_rabs", 89.5, "max Radius at the absorber end"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; + Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -715,6 +719,8 @@ struct DileptonMC { fDimuonCut.SetDCAxy(0.f, dimuoncuts.cfg_max_dcaxy); fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); + fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons + fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); } template diff --git a/PWGEM/Dilepton/Core/DimuonCut.cxx b/PWGEM/Dilepton/Core/DimuonCut.cxx index ee18a8e4232..5ee3bf3d3bd 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.cxx +++ b/PWGEM/Dilepton/Core/DimuonCut.cxx @@ -119,3 +119,19 @@ void DimuonCut::SetMaxPDCARabsDep(std::function RabsDepCut) mMaxPDCARabsDep = RabsDepCut; LOG(info) << "Dimuon Cut, set max pDCA as a function of Rabs: " << mMaxPDCARabsDep(10.0); } +void DimuonCut::SetMFTHitMap(std::vector hitMap) +{ + mRequiredMFTDisks = hitMap; + for (const auto& iDisk : mRequiredMFTDisks) { + LOG(info) << "Dimuon Cut, require MFT hit on Disk: " << iDisk; + } +} +void DimuonCut::SetMaxdPtdEtadPhiwrtMCHMID(float reldPtMax, float dEtaMax, float dPhiMax) +{ + mMaxReldPtwrtMCHMID = reldPtMax; + mMaxdEtawrtMCHMID = dEtaMax; + mMaxdPhiwrtMCHMID = dPhiMax; + LOG(info) << "Dimuon Cut, set max rel. dpt between MFT-MCH-MID and associated MCH-MID: " << mMaxReldPtwrtMCHMID; + LOG(info) << "Dimuon Cut, set max deta between MFT-MCH-MID and associated MCH-MID: " << mMaxdEtawrtMCHMID; + LOG(info) << "Dimuon Cut, set max dphi between MFT-MCH-MID and associated MCH-MID: " << mMaxdPhiwrtMCHMID; +} diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 4bb854c6b73..34d8364f65b 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -59,6 +59,8 @@ class DimuonCut : public TNamed kMatchingChi2MCHMID, kRabs, kPDCA, + kMFTHitMap, + kDPtDEtaDPhiwrtMCHMID, kNCuts }; @@ -154,6 +156,12 @@ class DimuonCut : public TNamed if (!IsSelectedTrack(track, DimuonCuts::kRabs)) { return false; } + if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kMFTHitMap)) { + return false; + } + if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kDPtDEtaDPhiwrtMCHMID)) { + return false; + } return true; } @@ -198,6 +206,19 @@ class DimuonCut : public TNamed case DimuonCuts::kRabs: return mMinRabs < track.rAtAbsorberEnd() && track.rAtAbsorberEnd() < mMaxRabs; + case DimuonCuts::kMFTHitMap: { + std::vector mftHitMap{checkMFTHitMap<0, 1>(track), checkMFTHitMap<2, 3>(track), checkMFTHitMap<4, 5>(track), checkMFTHitMap<6, 7>(track), checkMFTHitMap<8, 9>(track)}; + for (const auto& iDisk : mRequiredMFTDisks) { + if (!mftHitMap[iDisk]) { + return false; + } + } + return true; + } + + case DimuonCuts::kDPtDEtaDPhiwrtMCHMID: + return std::fabs(track.ptMatchedMCHMID() - track.pt()) / track.pt() < mMaxReldPtwrtMCHMID && std::sqrt(std::pow((track.etaMatchedMCHMID() - track.eta()) / mMaxdEtawrtMCHMID, 2) + std::pow((track.phiMatchedMCHMID() - track.phi()) / mMaxdPhiwrtMCHMID, 2)) < 1.f; + default: return false; } @@ -222,6 +243,8 @@ class DimuonCut : public TNamed void SetDCAxy(float min, float max); // in cm void SetRabs(float min, float max); // in cm void SetMaxPDCARabsDep(std::function RabsDepCut); + void SetMFTHitMap(std::vector hitMap); + void SetMaxdPtdEtadPhiwrtMCHMID(float reldPtMax, float dEtaMax, float dPhiMax); // this is relevant for global muons private: // pair cuts @@ -249,6 +272,8 @@ class DimuonCut : public TNamed float mMinRabs{17.6}, mMaxRabs{89.5}; float mMinDcaXY{0.0f}, mMaxDcaXY{1e10f}; + float mMaxReldPtwrtMCHMID{1e10f}, mMaxdEtawrtMCHMID{1e10f}, mMaxdPhiwrtMCHMID{1e10f}; + std::vector mRequiredMFTDisks{}; ClassDef(DimuonCut, 1); }; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index f5f8be20518..2fc94a8a91c 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -201,6 +201,10 @@ struct SingleTrackQC { Configurable cfg_min_rabs{"cfg_min_rabs", 17.6, "min Radius at the absorber end"}; Configurable cfg_max_rabs{"cfg_max_rabs", 89.5, "max Radius at the absorber end"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; + Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -282,6 +286,7 @@ struct SingleTrackQC { // track info fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); fRegistry.add("Track/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); + fRegistry.add("Track/positive/hdEtadPhi", "#Delta#eta vs. #Delta#varphi between MFT-MCH-MID and MCH-MID;#varphi_{sa} - #varphi_{gl} (rad.);#eta_{sa} - #eta_{gl}", kTH2F, {{90, -M_PI / 4, M_PI / 4}, {100, -0.5, +0.5}}, false); fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); fRegistry.add("Track/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); @@ -452,6 +457,8 @@ struct SingleTrackQC { fDimuonCut.SetDCAxy(0.f, dimuoncuts.cfg_max_dcaxy); fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); + fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons + fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); } template @@ -560,9 +567,15 @@ struct SingleTrackQC { weight = map_weight[track.globalIndex()]; } float dca_xy = fwdDcaXYinSigma(track); + + float deta = track.etaMatchedMCHMID() - track.eta(); + float dphi = track.phiMatchedMCHMID() - track.phi(); + o2::math_utils::bringToPMPi(dphi); + if (track.sign() > 0) { fRegistry.fill(HIST("Track/positive/hs"), track.pt(), track.eta(), track.phi(), dca_xy, weight); fRegistry.fill(HIST("Track/positive/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); + fRegistry.fill(HIST("Track/positive/hdEtadPhi"), dphi, deta, weight); fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/positive/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/positive/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); @@ -580,6 +593,7 @@ struct SingleTrackQC { } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca_xy, weight); fRegistry.fill(HIST("Track/negative/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); + fRegistry.fill(HIST("Track/negative/hdEtadPhi"), dphi, deta, weight); fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/negative/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/negative/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index f400b617f1f..481bb2e9e5e 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -207,6 +207,10 @@ struct SingleTrackQCMC { Configurable cfg_min_rabs{"cfg_min_rabs", 17.6, "min Radius at the absorber end"}; Configurable cfg_max_rabs{"cfg_max_rabs", 89.5, "max Radius at the absorber end"}; Configurable enableTTCA{"enableTTCA", true, "Flag to enable or disable TTCA"}; + Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; + Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; + Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -339,6 +343,7 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca, axis_charge_gen}, true); if (cfgFillQA) { fRegistry.add("Track/lf/positive/hEtaPhi_MatchMCHMID", "#eta vs. #varphi of matched MCHMID", kTH2F, {{180, 0, 2.f * M_PI}, {100, -6, -1}}, false); + fRegistry.add("Track/lf/positive/hdEtadPhi", "#Delta#eta vs. #Delta#varphi between MFT-MCH-MID and MCH-MID;#varphi_{sa} - #varphi_{gl} (rad.);#eta_{sa} - #eta_{gl}", kTH2F, {{90, -M_PI / 4, M_PI / 4}, {100, -0.5, +0.5}}, false); fRegistry.add("Track/lf/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); fRegistry.add("Track/lf/positive/hTrackType", "track type", kTH1F, {{6, -0.5f, 5.5}}, false); fRegistry.add("Track/lf/positive/hDCAxy", "DCA x vs. y;DCA_{x} (cm);DCA_{y} (cm)", kTH2F, {{200, -0.5f, 0.5f}, {200, -0.5f, 0.5f}}, false); @@ -511,6 +516,8 @@ struct SingleTrackQCMC { fDimuonCut.SetDCAxy(0.f, dimuoncuts.cfg_max_dcaxy); fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); + fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons + fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); } template @@ -670,6 +677,9 @@ struct SingleTrackQCMC { { auto mctrack = track.template emmcparticle_as(); float dca_xy = fwdDcaXYinSigma(track); + float deta = track.etaMatchedMCHMID() - track.eta(); + float dphi = track.phiMatchedMCHMID() - track.phi(); + o2::math_utils::bringToPMPi(dphi); float weight = 1.f; if (cfgApplyWeightTTCA) { @@ -681,6 +691,7 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hs"), track.pt(), track.eta(), track.phi(), dca_xy, -mctrack.pdgCode() / pdg_lepton, weight); if (cfgFillQA) { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hdEtadPhi"), dphi, deta, weight); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); @@ -703,6 +714,7 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hs"), track.pt(), track.eta(), track.phi(), dca_xy, -mctrack.pdgCode() / pdg_lepton, weight); if (cfgFillQA) { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hEtaPhi_MatchMCHMID"), track.phiMatchedMCHMID(), track.etaMatchedMCHMID(), weight); + fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hdEtadPhi"), dphi, deta, weight); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hTrackType"), track.trackType()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hDCAxy"), track.fwdDcaX(), track.fwdDcaY()); diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index a24b62374f8..a0c7b6362f7 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -54,7 +54,7 @@ using namespace o2::constants::physics; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; @@ -77,19 +77,18 @@ 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", "mee vs. phiv", {HistType::kTH2F, {{72, 0, M_PI}, {100, 0, 0.1}}}}, - - {"V0/hTPCdEdx_P_El", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, - {"V0/hTPCdEdx_P_Mu", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, - {"V0/hTPCdEdx_P_Pi", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, - {"V0/hTPCdEdx_P_Ka", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, - {"V0/hTPCdEdx_P_Pr", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, - - {"V0/hTOFbeta_P_El", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, - {"V0/hTOFbeta_P_Mu", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, - {"V0/hTOFbeta_P_Pi", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, - {"V0/hTOFbeta_P_Ka", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, - {"V0/hTOFbeta_P_Pr", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, + {"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_Mu", "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}}}}, + {"V0/hTPCdEdx_P_Ka", "TPC dEdx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, + {"V0/hTPCdEdx_P_Pr", "TPC dEdx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, + {"V0/hTOFbeta_P_El", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, + {"V0/hTOFbeta_P_Mu", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, + {"V0/hTOFbeta_P_Pi", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, + {"V0/hTOFbeta_P_Ka", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, + {"V0/hTOFbeta_P_Pr", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}}, {"Cascade/hRxy_Xi", "R_{xy} of cascade vs. mass;m_{#Lambda#pi};R_{xy} (cm)", {HistType::kTH2F, {{200, 1.2, 1.4}, {200, 0, 20.f}}}}, {"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}}}}, @@ -103,9 +102,7 @@ struct TreeCreatorElectronMLDDA { {"Cascade/hMassXi", "cascade mass #Xi", {HistType::kTH1F, {{200, 1.2, 1.4}}}}, {"Cascade/hMassOmega", "cascade mass #Omega", {HistType::kTH1F, {{200, 1.6, 1.8}}}}, {"Cascade/hMassPt_Xi", "cascade mass #Xi^{#pm};m_{#Lambda#pi} (GeV/c^{2});p_{T,#Lambda#pi} (GeV/c)", {HistType::kTH2F, {{200, 1.2, 1.4}, {100, 0, 10}}}}, - {"Cascade/hMassPt_Xi_bachelor", "cascade mass #Xi^{#pm};m_{#Lambda#pi} (GeV/c^{2});p_{T,#pi} (GeV/c)", {HistType::kTH2F, {{200, 1.2, 1.4}, {100, 0, 10}}}}, {"Cascade/hMassPt_Omega", "cascade mass #Omega^{#pm};m_{#LambdaK} (GeV/c^{2});p_{T,#LambdaK} (GeV/c)", {HistType::kTH2F, {{200, 1.6, 1.8}, {100, 0, 10}}}}, - {"Cascade/hMassPt_Omega_bachelor", "cascade mass #Omega^{#pm};m_{#LambdaK} (GeV/c^{2});p_{T,K} (GeV/c)", {HistType::kTH2F, {{200, 1.6, 1.8}, {100, 0, 10}}}}, }, }; @@ -386,15 +383,15 @@ struct TreeCreatorElectronMLDDA { } mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(track.pidForTracking()); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(track.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, track_par_cov_recalc, 2.f, matCorr, &mDcaInfoCov); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); - if (std::fabs(track_par_cov_recalc.getEta()) > trackcuts.cfg_max_eta || track_par_cov_recalc.getPt() < trackcuts.cfg_min_pt) { + if (std::fabs(trackParCov.getEta()) > trackcuts.cfg_max_eta || trackParCov.getPt() < trackcuts.cfg_min_pt) { return false; } @@ -442,15 +439,15 @@ struct TreeCreatorElectronMLDDA { } mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(track.pidForTracking()); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(track.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, track_par_cov_recalc, 2.f, matCorr, &mDcaInfoCov); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); // float dcaZ = mDcaInfoCov.getZ(); - if (std::fabs(track_par_cov_recalc.getEta()) > v0cuts.cfg_max_eta || track_par_cov_recalc.getPt() < v0cuts.cfg_min_pt) { + if (std::fabs(trackParCov.getEta()) > v0cuts.cfg_max_eta || trackParCov.getPt() < v0cuts.cfg_min_pt) { return false; } @@ -526,17 +523,17 @@ struct TreeCreatorElectronMLDDA { if (std::find(stored_trackIds.begin(), stored_trackIds.end(), track.globalIndex()) == stored_trackIds.end()) { mDcaInfoCov.set(999, 999, 999, 999, 999); - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(track.pidForTracking()); + auto trackParCov = getTrackParCov(track); + trackParCov.setPID(track.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, track_par_cov_recalc, 2.f, matCorr, &mDcaInfoCov); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov); float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); emprimarytracks(collision.globalIndex(), collision.posZ(), collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(), - track.pt(), track.eta(), track.phi(), track.tgl(), track.signed1Pt(), - dcaXY, dcaZ, track_par_cov_recalc.getSigmaY2(), track_par_cov_recalc.getSigmaZ2(), track_par_cov_recalc.getSigmaZY(), + trackParCov.getPt(), trackParCov.getEta(), trackParCov.getPhi() > 0.f ? trackParCov.getPhi() : trackParCov.getPhi() + 2 * M_PI, trackParCov.getTgl(), trackParCov.getQ2Pt(), + dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY(), track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), @@ -582,33 +579,32 @@ struct TreeCreatorElectronMLDDA { for (const auto& v0 : v0s_coll) { auto pos = v0.template posTrack_as(); auto neg = v0.template negTrack_as(); - if (!isSelectedV0Leg(collision, pos) || !isSelectedV0Leg(collision, neg)) { + // LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId()); + + if (v0.dcaV0daughters() > v0cuts.cfg_max_dcadau) { + continue; + } + if (v0.v0cosPA() < v0cuts.cfg_min_cospa) { continue; } if (pos.sign() * neg.sign() > 0) { continue; } - - // LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId()); + if (!isSelectedV0Leg(collision, pos) || !isSelectedV0Leg(collision, neg)) { + continue; + } registry.fill(HIST("V0/hPCA"), v0.dcaV0daughters()); registry.fill(HIST("V0/hCosPA"), v0.v0cosPA()); registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm()); - if (v0.dcaV0daughters() > v0cuts.cfg_max_dcadau) { - continue; - } - if (v0.v0cosPA() < v0cuts.cfg_min_cospa) { - continue; - } - if (isPion(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.p(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.p(), neg.beta()); - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.p(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.p(), pos.beta()); + 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()); if (dist01(engine) < downscaling_pion || pos.tpcInnerParam() > max_pin_for_downscaling_pion) { fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false); } @@ -623,8 +619,8 @@ struct TreeCreatorElectronMLDDA { if (dist01(engine) < downscaling_proton || pos.tpcInnerParam() > max_pin_for_downscaling_proton) { fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false); } - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.p(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.p(), pos.beta()); + 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)) { @@ -633,14 +629,14 @@ struct TreeCreatorElectronMLDDA { if (dist01(engine) < downscaling_proton || neg.tpcInnerParam() > max_pin_for_downscaling_proton) { fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false); } - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.p(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.p(), neg.beta()); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); } } - 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 (isElectron(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)) { if (dist01(engine) < downscaling_electron || pos.tpcInnerParam() > max_pin_for_downscaling_electron) { fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false); @@ -648,10 +644,10 @@ struct TreeCreatorElectronMLDDA { if (dist01(engine) < downscaling_electron || neg.tpcInnerParam() > max_pin_for_downscaling_electron) { fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false); } - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.p(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.p(), neg.beta()); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.p(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.p(), pos.beta()); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + 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 @@ -662,10 +658,6 @@ struct TreeCreatorElectronMLDDA { auto bachelor = cascade.template bachelor_as(); auto pos = cascade.template posTrack_as(); auto neg = cascade.template negTrack_as(); - if (!isSelectedV0Leg(collision, pos) || !isSelectedV0Leg(collision, neg) || !isSelectedV0Leg(collision, bachelor)) { - continue; - } - if (pos.sign() * neg.sign() > 0) { continue; } @@ -680,7 +672,6 @@ struct TreeCreatorElectronMLDDA { } } - registry.fill(HIST("Cascade/hMassLambda"), cascade.mLambda()); if (!(v0cuts.cfg_min_mass_lambda < cascade.mLambda() && cascade.mLambda() < v0cuts.cfg_max_mass_lambda)) { continue; } @@ -689,11 +680,6 @@ struct TreeCreatorElectronMLDDA { continue; } - registry.fill(HIST("Cascade/hV0PCA"), cascade.dcaV0daughters()); - registry.fill(HIST("Cascade/hV0CosPA"), cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("Cascade/hPCA"), cascade.dcacascdaughters()); // distance between bachelor and V0. - registry.fill(HIST("Cascade/hCosPA"), cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - if (cascade.dcaV0daughters() > cascadecuts.cfg_max_dcadau_v0) { continue; } @@ -715,6 +701,16 @@ struct TreeCreatorElectronMLDDA { continue; } + if (!isSelectedV0Leg(collision, pos) || !isSelectedV0Leg(collision, neg) || !isSelectedV0Leg(collision, bachelor)) { + continue; + } + + registry.fill(HIST("Cascade/hMassLambda"), cascade.mLambda()); + registry.fill(HIST("Cascade/hV0PCA"), cascade.dcaV0daughters()); + registry.fill(HIST("Cascade/hV0CosPA"), cascade.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("Cascade/hPCA"), cascade.dcacascdaughters()); // distance between bachelor and V0. + registry.fill(HIST("Cascade/hCosPA"), cascade.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + float length = std::sqrt(std::pow(cascade.x() - collision.posX(), 2) + std::pow(cascade.y() - collision.posY(), 2) + std::pow(cascade.z() - collision.posZ(), 2)); float mom = cascade.p(); float ctauXi = length / mom * o2::constants::physics::MassXiMinus; // 4.91 cm in PDG @@ -723,19 +719,17 @@ struct TreeCreatorElectronMLDDA { if (isPion(bachelor)) { registry.fill(HIST("Cascade/hMassXi"), cascade.mXi()); registry.fill(HIST("Cascade/hMassPt_Xi"), cascade.mXi(), cascade.pt()); - registry.fill(HIST("Cascade/hMassPt_Xi_bachelor"), cascade.mXi(), bachelor.p()); 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 registry.fill(HIST("Cascade/hMassOmega"), cascade.mOmega()); registry.fill(HIST("Cascade/hMassPt_Omega"), cascade.mOmega(), cascade.pt()); - registry.fill(HIST("Cascade/hMassPt_Omega_bachelor"), cascade.mOmega(), bachelor.p()); registry.fill(HIST("Cascade/hRxy_Omega"), cascade.mOmega(), cascade.cascradius()); registry.fill(HIST("Cascade/hCTau_Omega"), cascade.mOmega(), ctauOmega); 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.p(), bachelor.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.p(), bachelor.beta()); + registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.tpcInnerParam(), bachelor.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.tpcInnerParam(), bachelor.beta()); if (dist01(engine) < downscaling_kaon || bachelor.tpcInnerParam() > max_pin_for_downscaling_kaon) { fillTrackTable(collision, bachelor, static_cast(o2::aod::pwgem::dilepton::PID_Label::kKaon), static_cast(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false); } @@ -743,21 +737,38 @@ struct TreeCreatorElectronMLDDA { } } // end of cascade loop + 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 (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) { + if (!isElectron(pos) || !isElectron(neg)) { continue; } - if (!isElectron(pos) || !isElectron(neg)) { + if (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) { continue; } - ROOT::Math::PtEtaPhiMVector v1(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); + 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(pos.px(), pos.py(), pos.pz(), neg.px(), neg.py(), neg.pz(), pos.sign(), neg.sign(), d_bz); + 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. @@ -793,19 +804,19 @@ struct MLTrackQC { { {"hTPCdEdx_P_All", "TPC dE/dx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, {"hTOFbeta_P_All", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSClusterSize_P_All", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {64, 0.0, 16}}}}, + {"hITSobClusterSize_P_All", "mean ITSob cluster size vs. p;p^{ITS-TPC} (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^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, {"hTOFbeta_P_Electron", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSClusterSize_P_Electron", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {64, 0.0, 16}}}}, + {"hITSobClusterSize_P_Electron", "mean ITSob cluster size vs. p;p^{ITS-TPC} (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^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, {"hTOFbeta_P_Pion", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSClusterSize_P_Pion", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {64, 0.0, 16}}}}, + {"hITSobClusterSize_P_Pion", "mean ITSob cluster size vs. p;p^{ITS-TPC} (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^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, {"hTOFbeta_P_Kaon", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSClusterSize_P_Kaon", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {64, 0.0, 16}}}}, + {"hITSobClusterSize_P_Kaon", "mean ITSob cluster size vs. p;p^{ITS-TPC} (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^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, {"hTOFbeta_P_Proton", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSClusterSize_P_Proton", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {64, 0.0, 16}}}}, + {"hITSobClusterSize_P_Proton", "mean ITSob cluster size vs. p;p^{ITS-TPC} (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^{ITS-TPC} (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^{ITS-TPC} (GeV/c);n #sigma_{#pi}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, @@ -823,29 +834,29 @@ struct MLTrackQC { 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("hITSClusterSize_P_All"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hITSobClusterSize_P_All"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::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("hITSClusterSize_P_Electron"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + 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()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::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("hITSClusterSize_P_Pion"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + 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()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::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("hITSClusterSize_P_Kaon"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + 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()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::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("hITSClusterSize_P_Proton"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); + 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()); } diff --git a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx index c6c056b5dcb..8ae6b3e563f 100644 --- a/PWGEM/Dilepton/Tasks/createResolutionMap.cxx +++ b/PWGEM/Dilepton/Tasks/createResolutionMap.cxx @@ -157,12 +157,12 @@ struct CreateResolutionMap { Configurable cfg_mid_rabs{"cfg_mid_rabs", 26.5, "middle R at absorber end for pDCA cut"}; Configurable cfg_max_pdca_forLargeR{"cfg_max_pdca_forLargeR", 324.f, "max. pDCA for large R at absorber end"}; Configurable cfg_max_pdca_forSmallR{"cfg_max_pdca_forSmallR", 594.f, "max. pDCA for small R at absorber end"}; - Configurable cfg_min_nclusters_MFT{"cfg_min_nclusters_MFT", 5, "min nclusters MFT"}; - Configurable cfg_min_nclusters_MCH{"min_min_nclusters_MCH", 5, "min nclusters MCH"}; Configurable cfg_max_reldpt{"cfg_max_reldpt", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_deta{"cfg_max_deta", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_dphi{"cfg_max_dphi", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; Configurable refitGlobalMuon{"refitGlobalMuon", true, "flag to refit global muon"}; + Configurable requireMFTHitMap{"requireMFTHitMap", false, "flag to require MFT hit map"}; + Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{4}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; } muoncuts; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -583,6 +583,15 @@ struct CreateResolutionMap { return; } + if (muoncuts.requireMFTHitMap) { + std::vector hasMFTs{hasMFT<0, 1>(mfttrack), hasMFT<2, 3>(mfttrack), hasMFT<4, 5>(mfttrack), hasMFT<6, 7>(mfttrack), hasMFT<8, 9>(mfttrack)}; + for (int i = 0; i < static_cast(muoncuts.requiredMFTDisks->size()); i++) { + if (!hasMFTs[muoncuts.requiredMFTDisks->at(i)]) { + return; + } + } + } + } else if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { o2::dataformats::GlobalFwdTrack propmuonAtRabs = propagateMuon(muon, collision, propagationPoint::kToRabs); // this is necessary only for MuonStandaloneTrack float xAbs = propmuonAtRabs.getX(); @@ -680,6 +689,20 @@ struct CreateResolutionMap { return true; } + template + bool hasMFT(T const& track) + { + // logical-OR + uint64_t mftClusterSizesAndTrackFlags = track.mftClusterSizesAndTrackFlags(); + uint16_t clmap = 0; + for (unsigned int layer = begin; layer <= end; layer++) { + if ((mftClusterSizesAndTrackFlags >> (layer * 6)) & 0x3f) { + clmap |= (1 << layer); + } + } + return (clmap > 0); + } + SliceCache cache; Preslice perCollision_mid = o2::aod::track::collisionId; Preslice perCollision_fwd = o2::aod::fwdtrack::collisionId; diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index 6ac2275aee1..eb73226cd1e 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -65,12 +65,12 @@ float dcaZinSigma(T const& track) template float fwdDcaXYinSigma(T const& track) { - float cXX = track.cXXatDCA(); // in cm^2 - float cYY = track.cYYatDCA(); // in cm^2 - float cXY = track.cXYatDCA(); // in cm^2 - float dcaX = track.fwdDcaX(); // in cm - float dcaY = track.fwdDcaY(); // in cm - float det = cXX * cYY - cXY * cXY; // determinant + float cXX = track.cXXatDCA(); // in cm^2 + float cYY = track.cYYatDCA(); // in cm^2 + float cXY = track.cXYatDCA(); // in cm^2 + float dcaX = track.fwdDcaX(); // in cm + float dcaY = track.fwdDcaY(); // in cm + float det = cXX * cYY - cXY * cXY; // determinant if (det < 0) { return 999.f; @@ -88,6 +88,20 @@ float sigmaFwdDcaXY(T const& track) return dcaXY / fwdDcaXYinSigma(track); } //_______________________________________________________________________ +template +bool checkMFTHitMap(T const& track) +{ + // logical-OR + uint64_t mftClusterSizesAndTrackFlags = track.mftClusterSizesAndTrackFlags(); + uint16_t clmap = 0; + for (unsigned int layer = begin; layer <= end; layer++) { + if ((mftClusterSizesAndTrackFlags >> (layer * 6)) & 0x3f) { + clmap |= (1 << layer); + } + } + return (clmap > 0); +} +//_______________________________________________________________________ template bool isBestMatch(TTrack const& track, TCut const& cut, TTracks const& tracks) { From b51dfb4847aee36f5ff1523cde640249a702b4d4 Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Mon, 9 Jun 2025 19:53:30 -0600 Subject: [PATCH 010/116] [PWGLF] Phi cut was added (#11527) --- PWGMM/UE/Tasks/dedxAnalysis.cxx | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/PWGMM/UE/Tasks/dedxAnalysis.cxx b/PWGMM/UE/Tasks/dedxAnalysis.cxx index 0336638dade..34999be4f7e 100644 --- a/PWGMM/UE/Tasks/dedxAnalysis.cxx +++ b/PWGMM/UE/Tasks/dedxAnalysis.cxx @@ -28,6 +28,7 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "ReconstructionDataFormats/Track.h" #include "Common/Core/TrackSelectionDefaults.h" +#include "TF1.h" using namespace o2; using namespace o2::framework; @@ -58,6 +59,8 @@ struct DedxAnalysis { float pionTofCut = 1.0; float invMassCut = 0.01; float invMassCutGamma = 0.0015; + float magField = 1.0; + float pTcut = 2.0; // Configurable Parameters // Tracks cuts @@ -103,6 +106,10 @@ struct DedxAnalysis { 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; @@ -130,6 +137,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); if (calibrationMode) { // MIP for pions registryDeDx.add( @@ -202,6 +211,11 @@ struct DedxAnalysis { "hdEdx_vs_phi", "dE/dx", HistType::kTH2F, {{100, 0.0, 6.4, "#phi"}, {dedxAxis}}); + // phi cut + registryDeDx.add( + "hpt_vs_phi", "phi cut", HistType::kTH2F, + {{ptAxis}, {100, 0.0, 6.4, "#phi"}}); + registryDeDx.add( "hbeta_vs_p_Neg", "beta", HistType::kTH2F, {{pAxis}, {100, 0.0, 1.1, "#beta"}}); @@ -375,6 +389,33 @@ struct DedxAnalysis { 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(); + + 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); + + if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) + return false; // reject track + + registryDeDx.fill(HIST("hpt_vs_phi"), pt, phi); + return true; + } + // Process Data void process(SelectedCollisions::iterator const& collision, aod::V0Datas const& fullV0s, PIDTracks const& tracks) @@ -410,6 +451,10 @@ struct DedxAnalysis { if (!mySelectionPrim.IsSelected(trk)) continue; + // phi cut + if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) + continue; + float signedP = trk.sign() * trk.tpcInnerParam(); // MIP calibration for pions From a5ae97a62567392cfeaaeccd3b6dc74eac1dbc5c Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Tue, 10 Jun 2025 11:52:07 +0530 Subject: [PATCH 011/116] [PWGUD] Added the bc selection cuts for the new pass5 and renamed histograms (#11520) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 394 ++++++++++++++++-------------- 1 file changed, 205 insertions(+), 189 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 14ffcc415a4..ac0a9459569 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -519,8 +519,11 @@ struct ExclusiveRhoTo4Pi { Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; Configurable ft0aCut{"ft0aCut", 150., "FT0A threshold"}; Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; - Configurable zdcCut{"zdcCut", 1., "ZDC threshold"}; - // Configurable occupancyCut{"occupancyCut", 1000, "Occupancy Cut"}; + Configurable zdcCut{"zdcCut", 0., "ZDC threshold"}; + 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 numPVContrib{"numPVContrib", 4, "Number of PV Contributors"}; @@ -563,66 +566,66 @@ struct ExclusiveRhoTo4Pi { histosData.add("tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); // TPC nSigma - histosData.add("tpcNSigmaPi_WTS", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tpcNSigmaPi_WTS_PID_Pi", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaPi_all", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaPi_pions", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TPC nSigma of other particles with selected pion tracks - histosData.add("tpcNSigmaKa_WTS_PID_Pi", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tpcNSigmaPr_WTS_PID_Pi", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tpcNSigmaEl_WTS_PID_Pi", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tpcNSigmaMu_WTS_PID_Pi", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaKa_pions", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaPr_pions", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaEl_pions", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tpcNSigmaMu_pions", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TOF nSigma - histosData.add("tofNSigmaPi_WTS", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tofNSigmaPi_WTS_PID_Pi", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaPi_all", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaPi_pions", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TOF nSigma of other particles with selected pion tracks - histosData.add("tofNSigmaKa_WTS_PID_Pi", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tofNSigmaPr_WTS_PID_Pi", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tofNSigmaEl_WTS_PID_Pi", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosData.add("tofNSigmaMu_WTS_PID_Pi", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaKa_pions", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaPr_pions", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaEl_pions", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosData.add("tofNSigmaMu_pions", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // Track Transverse Momentum - histosData.add("pT_track_WTS", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); - histosData.add("pT_track_WTS_PID_Pi", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); - histosData.add("pT_track_WTS_PID_Pi_contributed", "pT with track selection and PID selection of Pi which are contributed to selected event; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosData.add("pT_track_all", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); + histosData.add("pT_track_pions", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosData.add("pT_track_pions_contributed", "pT with track selection and PID selection of Pi which are contributed to selected event; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Track Rapidity - histosData.add("rapidity_track_WTS", "Rapidity with track selection; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosData.add("rapidity_track_WTS_PID_Pi", "Rapidity with track selection and PID selection of Pi; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosData.add("rapidity_track_WTS_PID_Pi_contributed", "Rapidity with track selection and PID selection of Pi which are contributed to selected event; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("rapidity_track_all", "Rapidity with track selection; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("rapidity_track_pions", "Rapidity with track selection and PID selection of Pi; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("rapidity_track_pions_contributed", "Rapidity with track selection and PID selection of Pi which are contributed to selected event; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); // Zero charge Event Transverse Momentum - histosData.add("pT_event_0charge_WTS_PID_Pi", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosData.add("fourpion_pT_0_charge", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Non Zero charge Event Transverse Momentum - histosData.add("pT_event_non0charge_WTS_PID_Pi", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosData.add("fourpion_pT_non_0_charge", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Rapidity of 0 charge Events - histosData.add("rapidity_event_0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosData.add("rapidity_event_0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosData.add("rapidity_event_0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosData.add("fourpion_rap_0_charge_domA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosData.add("fourpion_rap_0_charge_domB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosData.add("fourpion_rap_0_charge_domC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); // Rapidity of non 0 charge Events - histosData.add("rapidity_event_non0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosData.add("rapidity_event_non0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosData.add("rapidity_event_non0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("fourpion_rap_non_0_charge_domA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("fourpion_rap_non_0_charge_domB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosData.add("fourpion_rap_non_0_charge_domC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); // Pair Invariant Mass - histosData.add("invMass_pair_1", "Invariant Mass Distribution of 2 pions 1 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("invMass_pair_2", "Invariant Mass Distribution of 2 pions 2 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("invMass_pair_3", "Invariant Mass Distribution of 2 pions 3 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosData.add("invMass_pair_4", "Invariant Mass Distribution of 2 pions 4 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosData.add("twopion_mass_1", "Invariant Mass Distribution of 2 pions 1 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosData.add("twopion_mass_2", "Invariant Mass Distribution of 2 pions 2 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosData.add("twopion_mass_3", "Invariant Mass Distribution of 2 pions 3 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosData.add("twopion_mass_4", "Invariant Mass Distribution of 2 pions 4 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); // Invariant Mass of 0 charge events - histosData.add("invMass_event_0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV - histosData.add("invMass_event_0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV - histosData.add("invMass_event_0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT + histosData.add("fourpion_mass_0_charge_domA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV + histosData.add("fourpion_mass_0_charge_domB", "Invariant Mass Distribution of 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV + histosData.add("fourpion_mass_0_charge_domC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT // Invariant mass of non 0 charge events - histosData.add("invMass_event_non0charge_WTS_PID_Pi_domainA", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV - histosData.add("invMass_event_non0charge_WTS_PID_Pi_domainB", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV - histosData.add("invMass_event_non0charge_WTS_PID_Pi_domainC", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT + 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT // tpc signal histosData.add("tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); @@ -640,12 +643,12 @@ struct ExclusiveRhoTo4Pi { histosData.add("V0A", "V0A amplitude", kTH1F, {{1000, 0.0, 100}}); // Collin Soper Theta and Phi - histosData.add("CS_phi_pair_1", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); - histosData.add("CS_phi_pair_2", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); - histosData.add("CS_costheta_pair_1", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); - histosData.add("CS_costheta_pair_2", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); - histosData.add("phi_cosTheta_pair_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); - histosData.add("phi_cosTheta_pair_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosData.add("collin_soper_phi_1", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histosData.add("collin_soper_phi_2", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histosData.add("collin_soper_costheta_1", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); + histosData.add("collin_soper_costheta_2", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); + histosData.add("phi_vs_costheta_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosData.add("phi_vs_costheta_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); // MC Gen Stuff @@ -679,8 +682,8 @@ struct ExclusiveRhoTo4Pi { histosMCgen.add("fourPion_phi_pair_2", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); histosMCgen.add("fourPion_costheta_pair_1", "#theta Distribution;cos(#theta); Events", kTH1F, {{nBinsCosTheta, -1, 1}}); histosMCgen.add("fourPion_costheta_pair_2", "#theta Distribution;cos(#theta); Events", kTH1F, {{nBinsCosTheta, -1, 1}}); - histosMCgen.add("phi_cosTheta_pair_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); - histosMCgen.add("phi_cosTheta_pair_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosMCgen.add("phi_vs_costheta_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosMCgen.add("phi_vs_costheta_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); // MC Reco Stuff @@ -697,66 +700,66 @@ struct ExclusiveRhoTo4Pi { histosMCreco.add("EventCounts", "Total Events; Events", kTH1F, {{10, 0, 10}}); // TPC nSigma - histosMCreco.add("tpcNSigmaPi_WTS", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tpcNSigmaPi_WTS_PID_Pi", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaPi_all", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaPi_pions", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TPC nSigma of other particles with selected pion tracks - histosMCreco.add("tpcNSigmaKa_WTS_PID_Pi", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tpcNSigmaPr_WTS_PID_Pi", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tpcNSigmaEl_WTS_PID_Pi", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tpcNSigmaMu_WTS_PID_Pi", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaKa_pions", "TPC nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaPr_pions", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaEl_pions", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tpcNSigmaMu_pions", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TOF nSigma - histosMCreco.add("tofNSigmaPi_WTS", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tofNSigmaPi_WTS_PID_Pi", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaPi_all", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaPi_pions", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // TOF nSigma of other particles with selected pion tracks - histosMCreco.add("tofNSigmaKa_WTS_PID_Pi", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tofNSigmaPr_WTS_PID_Pi", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tofNSigmaEl_WTS_PID_Pi", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); - histosMCreco.add("tofNSigmaMu_WTS_PID_Pi", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaKa_pions", "TOF nSigma Kaon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaPr_pions", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaEl_pions", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); + histosMCreco.add("tofNSigmaMu_pions", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {nBinsPt, 0, 10}}); // Track Transverse Momentum - histosMCreco.add("pT_track_WTS", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); - histosMCreco.add("pT_track_WTS_PID_Pi", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); - histosMCreco.add("pT_track_WTS_PID_Pi_contributed", "pT with track selection and PID selection of Pi which are contributed to selected event; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosMCreco.add("pT_track_all", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {{nBinsPt, 0, 2}}); + histosMCreco.add("pT_track_pions", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosMCreco.add("pT_track_pions_contributed", "pT with track selection and PID selection of Pi which are contributed to selected event; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Track Rapidity - histosMCreco.add("rapidity_track_WTS", "Rapidity with track selection; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosMCreco.add("rapidity_track_WTS_PID_Pi", "Rapidity with track selection and PID selection of Pi; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosMCreco.add("rapidity_track_WTS_PID_Pi_contributed", "Rapidity with track selection and PID selection of Pi which are contributed to selected event; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("rapidity_track_all", "Rapidity with track selection; y; Counts", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("rapidity_track_pions", "Rapidity with track selection and PID selection of Pi; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("rapidity_track_pions_contributed", "Rapidity with track selection and PID selection of Pi which are contributed to selected event; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); // Zero charge Event Transverse Momentum - histosMCreco.add("pT_event_0charge_WTS_PID_Pi", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosMCreco.add("fourpion_pT_0_charge", "Event pT in 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Non Zero charge Event Transverse Momentum - histosMCreco.add("pT_event_non0charge_WTS_PID_Pi", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); + histosMCreco.add("fourpion_pT_non_0_charge", "Event pT in Non 0 Charge Events With Track Selection and PID Selection of Pi; pT [GeV/c]; Events", kTH1F, {{nBinsPt, 0, 2}}); // Rapidity of 0 charge Events - histosMCreco.add("rapidity_event_0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosMCreco.add("rapidity_event_0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); - histosMCreco.add("rapidity_event_0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_0_charge_domA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_0_charge_domB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_0_charge_domC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{1000, -2.5, 2.5}}); // Rapidity of non 0 charge Events - histosMCreco.add("rapidity_event_non0charge_WTS_PID_Pi_domainA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosMCreco.add("rapidity_event_non0charge_WTS_PID_Pi_domainB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); - histosMCreco.add("rapidity_event_non0charge_WTS_PID_Pi_domainC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_non_0_charge_domA", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} < 0.15 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_non_0_charge_domB", "Rapidity of Events With Track Selection and PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c$; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); + histosMCreco.add("fourpion_rap_non_0_charge_domC", "Rapidity of Events With Track Selection and PID Selection of Pi for p_{T} > 0.80 GeV/c; y; Events", kTH1F, {{nBinsRapidity, -2.5, 2.5}}); // Pair Invariant Mass - histosMCreco.add("invMass_pair_1", "Invariant Mass Distribution of 2 pions 1 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosMCreco.add("invMass_pair_2", "Invariant Mass Distribution of 2 pions 2 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosMCreco.add("invMass_pair_3", "Invariant Mass Distribution of 2 pions 3 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); - histosMCreco.add("invMass_pair_4", "Invariant Mass Distribution of 2 pions 4 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosMCreco.add("twopion_mass_1", "Invariant Mass Distribution of 2 pions 1 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosMCreco.add("twopion_mass_2", "Invariant Mass Distribution of 2 pions 2 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosMCreco.add("twopion_mass_3", "Invariant Mass Distribution of 2 pions 3 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); + histosMCreco.add("twopion_mass_4", "Invariant Mass Distribution of 2 pions 4 ; m(#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{5000, 0, 5}}); // Invariant Mass of 0 charge events - histosMCreco.add("invMass_event_0charge_WTS_PID_Pi_domainA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV - histosMCreco.add("invMass_event_0charge_WTS_PID_Pi_domainB", "Invariant Mass Distribution of 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV - histosMCreco.add("invMass_event_0charge_WTS_PID_Pi_domainC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT + histosMCreco.add("fourpion_mass_0_charge_domA", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV + histosMCreco.add("fourpion_mass_0_charge_domB", "Invariant Mass Distribution of 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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV + histosMCreco.add("fourpion_mass_0_charge_domC", "Invariant Mass Distribution of 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT // Invariant mass of non 0 charge events - histosMCreco.add("invMass_event_non0charge_WTS_PID_Pi_domainA", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV - histosMCreco.add("invMass_event_non0charge_WTS_PID_Pi_domainB", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV - histosMCreco.add("invMass_event_non0charge_WTS_PID_Pi_domainC", "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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT + histosMCreco.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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // pT < 0.15GeV + histosMCreco.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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.15GeV < pT < 0.8GeV + histosMCreco.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, {{nBinsInvariantMass, invariantMassMin, invariantMassMax}}); // 0.8GeV < pT // tpc signal histosMCreco.add("tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); @@ -774,12 +777,12 @@ struct ExclusiveRhoTo4Pi { histosMCreco.add("V0A", "V0A amplitude", kTH1F, {{1000, 0.0, 100}}); // Collin Soper Theta and Phi - histosMCreco.add("CS_phi_pair_1", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); - histosMCreco.add("CS_phi_pair_2", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); - histosMCreco.add("CS_costheta_pair_1", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); - histosMCreco.add("CS_costheta_pair_2", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); - histosMCreco.add("phi_cosTheta_pair_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); - histosMCreco.add("phi_cosTheta_pair_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosMCreco.add("collin_soper_phi_1", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histosMCreco.add("collin_soper_phi_2", "#phi Distribution; #phi; Events", kTH1F, {{nBinsPhi, -3.2, 3.2}}); + histosMCreco.add("collin_soper_costheta_1", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); + histosMCreco.add("collin_soper_costheta_2", "#theta Distribution;cos(#theta); Counts", kTH1F, {{nBinsCosTheta, -1, 1}}); + histosMCreco.add("phi_vs_costheta_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); + histosMCreco.add("phi_vs_costheta_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {{nBinsPhi, -3.2, 3.2}, {nBinsCosTheta, -1, 1}}); } // End of init function //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -845,7 +848,9 @@ struct ExclusiveRhoTo4Pi { 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); - using UDtracks = soa::Join; + Filter bcSelectionCut = (o2::aod::udcollision::sbp == sbpCut) && (o2::aod::udcollision::itsROFb == itsROFbCut) && (o2::aod::udcollision::vtxITSTPC == vtxITSTPCcut) && (o2::aod::udcollision::tfb == tfbCut); + Filter onlyPVtracks = o2::aod::udtrack::isPVContributor == true; + using UDtracks = soa::Filtered>; using UDCollisions = soa::Filtered>; // using UDCollision = UDCollisions::iterator; //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -897,10 +902,10 @@ struct ExclusiveRhoTo4Pi { 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_WTS"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaPi_WTS"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); - histosData.fill(HIST("pT_track_WTS"), selectedTrackVector.Pt()); - histosData.fill(HIST("rapidity_track_WTS"), selectedTrackVector.Rapidity()); + 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("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()); @@ -912,24 +917,26 @@ struct ExclusiveRhoTo4Pi { ROOT::Math::PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); histosData.fill(HIST("tpcSignal_Pi"), selectedPionTrackVector.P(), selectedPionTracks[i].tpcSignal()); histosData.fill(HIST("tofBeta_Pi"), selectedPionTrackVector.P(), selectedPionTracks[i].beta()); - histosData.fill(HIST("tpcNSigmaPi_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaPi(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaKa_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaKa(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaPr_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaPr(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaEl_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaEl(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tpcNSigmaMu_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaMu(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaPi_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaPi(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaKa_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaKa(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaPr_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaPr(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaEl_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaEl(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaMu_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaMu(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("pT_track_WTS_PID_Pi"), selectedPionTrackVector.Pt()); - histosData.fill(HIST("rapidity_track_WTS_PID_Pi"), selectedPionTrackVector.Rapidity()); + 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("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("rapidity_track_pions"), selectedPionTrackVector.Rapidity()); } // End of loop over tracks with selection and PID selection of Pions if (numSelectedPionTracks != numFourPionTracks) { return; } + histosData.fill(HIST("EventCounts"), 2); + // Check if there is at least one track with TOF in the selected events, otherwise return bool hasAtleastOneTOF = false; for (int i = 0; i < numPiPlusTracks; i++) { @@ -941,10 +948,13 @@ struct ExclusiveRhoTo4Pi { if (!hasAtleastOneTOF) { return; } + histosData.fill(HIST("EventCounts"), 3); // Selecting Events with net charge = 0 if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { + histosData.fill(HIST("EventCounts"), 4); + 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); @@ -952,15 +962,15 @@ struct ExclusiveRhoTo4Pi { 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); - histosData.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p1.Pt()); - histosData.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p2.Pt()); - histosData.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p3.Pt()); - histosData.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p4.Pt()); + histosData.fill(HIST("pT_track_pions_contributed"), p1.Pt()); + histosData.fill(HIST("pT_track_pions_contributed"), p2.Pt()); + histosData.fill(HIST("pT_track_pions_contributed"), p3.Pt()); + histosData.fill(HIST("pT_track_pions_contributed"), p4.Pt()); - histosData.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p1.Rapidity()); - histosData.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p2.Rapidity()); - histosData.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p3.Rapidity()); - histosData.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p4.Rapidity()); + histosData.fill(HIST("rapidity_track_pions_contributed"), p1.Rapidity()); + histosData.fill(HIST("rapidity_track_pions_contributed"), p2.Rapidity()); + histosData.fill(HIST("rapidity_track_pions_contributed"), p3.Rapidity()); + histosData.fill(HIST("rapidity_track_pions_contributed"), p4.Rapidity()); k1.SetCoordinates(p1.Pt(), p1.Eta(), p1.Phi(), o2::constants::physics::MassPionCharged); k2.SetCoordinates(p2.Pt(), p2.Eta(), p2.Phi(), o2::constants::physics::MassPionCharged); @@ -1012,31 +1022,34 @@ struct ExclusiveRhoTo4Pi { fourPiPhiPair1, fourPiPhiPair2, fourPiCosThetaPair1, fourPiCosThetaPair2); if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosData.fill(HIST("pT_event_0charge_WTS_PID_Pi"), p1234.Pt()); + histosData.fill(HIST("fourpion_pT_0_charge"), p1234.Pt()); if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainA"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainA"), p1234.M()); - histosData.fill(HIST("invMass_pair_1"), (p1 + p3).M()); - histosData.fill(HIST("invMass_pair_2"), (p1 + p4).M()); - histosData.fill(HIST("invMass_pair_3"), (p2 + p3).M()); - histosData.fill(HIST("invMass_pair_4"), (p2 + p4).M()); + histosData.fill(HIST("EventCounts"), 5); + + histosData.fill(HIST("fourpion_rap_0_charge_domA"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); - histosData.fill(HIST("CS_phi_pair_1"), fourPiPhiPair1); - histosData.fill(HIST("CS_phi_pair_2"), fourPiPhiPair2); - histosData.fill(HIST("CS_costheta_pair_1"), fourPiCosThetaPair1); - histosData.fill(HIST("CS_costheta_pair_2"), fourPiCosThetaPair2); + 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()); - histosData.fill(HIST("phi_cosTheta_pair_1"), fourPiPhiPair1, fourPiCosThetaPair1); - histosData.fill(HIST("phi_cosTheta_pair_2"), fourPiPhiPair2, fourPiCosThetaPair2); + 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); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosData.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainB"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainB"), p1234.M()); + histosData.fill(HIST("fourpion_rap_0_charge_domB"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_0_charge_domB"), p1234.M()); } if (p1234.Pt() > zeroPointEight) { - histosData.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainC"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainC"), p1234.M()); + histosData.fill(HIST("fourpion_rap_0_charge_domC"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_0_charge_domC"), p1234.M()); } } // End of Rapidity range selection @@ -1045,6 +1058,8 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge != 0 for estimation of background if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { + histosData.fill(HIST("EventCounts"), 6); + 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); @@ -1074,19 +1089,20 @@ struct ExclusiveRhoTo4Pi { p1234.Pt(), p1234.Eta(), p1234.Phi(), p1234.Rapidity(), p1234.M()); if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosData.fill(HIST("pT_event_non0charge_WTS_PID_Pi"), p1234.Pt()); + histosData.fill(HIST("fourpion_pT_non_0_charge"), p1234.Pt()); if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainA"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainA"), p1234.M()); + histosData.fill(HIST("EventCounts"), 7); + histosData.fill(HIST("fourpion_rap_non_0_charge_domA"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_non_0_charge_domA"), p1234.M()); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosData.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainB"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainB"), p1234.M()); + histosData.fill(HIST("fourpion_rap_non_0_charge_domB"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_non_0_charge_domB"), p1234.M()); } if (p1234.Pt() > zeroPointEight) { - histosData.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainC"), p1234.Rapidity()); - histosData.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainC"), p1234.M()); + histosData.fill(HIST("fourpion_rap_non_0_charge_domC"), p1234.Rapidity()); + histosData.fill(HIST("fourpion_mass_non_0_charge_domC"), p1234.M()); } } // End of Rapidity range selection } // End of Analysis for non 0 charge events @@ -1186,8 +1202,8 @@ struct ExclusiveRhoTo4Pi { histosMCgen.fill(HIST("fourPion_phi_pair_2"), phiPair2); histosMCgen.fill(HIST("fourPion_costheta_pair_1"), cosThetaPair1); histosMCgen.fill(HIST("fourPion_costheta_pair_2"), cosThetaPair2); - histosMCgen.fill(HIST("phi_cosTheta_pair_1"), phiPair1, cosThetaPair1); - histosMCgen.fill(HIST("phi_cosTheta_pair_2"), phiPair2, cosThetaPair2); + histosMCgen.fill(HIST("phi_vs_costheta_1"), phiPair1, cosThetaPair1); + histosMCgen.fill(HIST("phi_vs_costheta_2"), phiPair2, cosThetaPair2); } // End of 4 Pion MC Generation Process function PROCESS_SWITCH(ExclusiveRhoTo4Pi, processMCgen, "The Process for 4 Pion Analysis from MC Generation", false); @@ -1247,10 +1263,10 @@ struct ExclusiveRhoTo4Pi { ROOT::Math::PxPyPzMVector selectedTrackVector(selectedTracks[i].px(), selectedTracks[i].py(), selectedTracks[i].pz(), o2::constants::physics::MassPionCharged); histosMCreco.fill(HIST("tpcSignal"), selectedTrackVector.P(), selectedTracks[i].tpcSignal()); histosMCreco.fill(HIST("tofBeta"), selectedTrackVector.P(), selectedTracks[i].beta()); - histosMCreco.fill(HIST("tpcNSigmaPi_WTS"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaPi_WTS"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); - histosMCreco.fill(HIST("pT_track_WTS"), selectedTrackVector.Pt()); - histosMCreco.fill(HIST("rapidity_track_WTS"), selectedTrackVector.Rapidity()); + histosMCreco.fill(HIST("tpcNSigmaPi_all"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaPi_all"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); + histosMCreco.fill(HIST("pT_track_all"), selectedTrackVector.Pt()); + histosMCreco.fill(HIST("rapidity_track_all"), selectedTrackVector.Rapidity()); histosMCreco.fill(HIST("itsChi2NCl"), selectedTracks[i].itsChi2NCl()); histosMCreco.fill(HIST("tpcChi2NCl"), selectedTracks[i].tpcChi2NCl()); histosMCreco.fill(HIST("tpcNClsFindable"), selectedTracks[i].tpcNClsFindable()); @@ -1262,18 +1278,18 @@ struct ExclusiveRhoTo4Pi { ROOT::Math::PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); histosMCreco.fill(HIST("tpcSignal_Pi"), selectedPionTrackVector.P(), selectedPionTracks[i].tpcSignal()); histosMCreco.fill(HIST("tofBeta_Pi"), selectedPionTrackVector.P(), selectedPionTracks[i].beta()); - histosMCreco.fill(HIST("tpcNSigmaPi_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaPi(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tpcNSigmaKa_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaKa(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tpcNSigmaPr_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaPr(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tpcNSigmaEl_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaEl(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tpcNSigmaMu_WTS_PID_Pi"), selectedPionTracks[i].tpcNSigmaMu(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaPi_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaPi(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaKa_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaKa(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaPr_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaPr(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaEl_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaEl(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("tofNSigmaMu_WTS_PID_Pi"), selectedPionTracks[i].tofNSigmaMu(), selectedPionTrackVector.Pt()); - histosMCreco.fill(HIST("pT_track_WTS_PID_Pi"), std::sqrt(selectedPionTracks[i].px() * selectedPionTracks[i].px() + selectedPionTracks[i].py() * selectedPionTracks[i].py())); - histosMCreco.fill(HIST("rapidity_track_WTS_PID_Pi"), selectedPionTrackVector.Rapidity()); + histosMCreco.fill(HIST("tpcNSigmaPi_pions"), selectedPionTracks[i].tpcNSigmaPi(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tpcNSigmaKa_pions"), selectedPionTracks[i].tpcNSigmaKa(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tpcNSigmaPr_pions"), selectedPionTracks[i].tpcNSigmaPr(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tpcNSigmaEl_pions"), selectedPionTracks[i].tpcNSigmaEl(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tpcNSigmaMu_pions"), selectedPionTracks[i].tpcNSigmaMu(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaPi_pions"), selectedPionTracks[i].tofNSigmaPi(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaKa_pions"), selectedPionTracks[i].tofNSigmaKa(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaPr_pions"), selectedPionTracks[i].tofNSigmaPr(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaEl_pions"), selectedPionTracks[i].tofNSigmaEl(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("tofNSigmaMu_pions"), selectedPionTracks[i].tofNSigmaMu(), selectedPionTrackVector.Pt()); + histosMCreco.fill(HIST("pT_track_pions"), std::sqrt(selectedPionTracks[i].px() * selectedPionTracks[i].px() + selectedPionTracks[i].py() * selectedPionTracks[i].py())); + histosMCreco.fill(HIST("rapidity_track_pions"), selectedPionTrackVector.Rapidity()); } // End of loop over tracks with selection and PID selection of Pions if (numSelectedPionTracks != numFourPionTracks) { @@ -1290,15 +1306,15 @@ struct ExclusiveRhoTo4Pi { 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); - histosMCreco.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p1.Pt()); - histosMCreco.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p2.Pt()); - histosMCreco.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p3.Pt()); - histosMCreco.fill(HIST("pT_track_WTS_PID_Pi_contributed"), p4.Pt()); + histosMCreco.fill(HIST("pT_track_pions_contributed"), p1.Pt()); + histosMCreco.fill(HIST("pT_track_pions_contributed"), p2.Pt()); + histosMCreco.fill(HIST("pT_track_pions_contributed"), p3.Pt()); + histosMCreco.fill(HIST("pT_track_pions_contributed"), p4.Pt()); - histosMCreco.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p1.Rapidity()); - histosMCreco.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p2.Rapidity()); - histosMCreco.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p3.Rapidity()); - histosMCreco.fill(HIST("rapidity_track_WTS_PID_Pi_contributed"), p4.Rapidity()); + histosMCreco.fill(HIST("rapidity_track_pions_contributed"), p1.Rapidity()); + histosMCreco.fill(HIST("rapidity_track_pions_contributed"), p2.Rapidity()); + histosMCreco.fill(HIST("rapidity_track_pions_contributed"), p3.Rapidity()); + histosMCreco.fill(HIST("rapidity_track_pions_contributed"), p4.Rapidity()); k1.SetCoordinates(p1.Pt(), p1.Eta(), p1.Phi(), o2::constants::physics::MassPionCharged); k2.SetCoordinates(p2.Pt(), p2.Eta(), p2.Phi(), o2::constants::physics::MassPionCharged); @@ -1341,30 +1357,30 @@ struct ExclusiveRhoTo4Pi { phiPair1, phiPair2, cosThetaPair1, cosThetaPair2); if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosMCreco.fill(HIST("pT_event_0charge_WTS_PID_Pi"), p1234.Pt()); + histosMCreco.fill(HIST("fourpion_pT_0_charge"), p1234.Pt()); if (p1234.Pt() < rhoPtCut) { - histosMCreco.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainA"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainA"), p1234.M()); - - histosMCreco.fill(HIST("invMass_pair_1"), (p1 + p3).M()); - histosMCreco.fill(HIST("invMass_pair_2"), (p1 + p4).M()); - histosMCreco.fill(HIST("invMass_pair_3"), (p2 + p3).M()); - histosMCreco.fill(HIST("invMass_pair_4"), (p2 + p4).M()); - - histosMCreco.fill(HIST("CS_phi_pair_1"), phiPair1); - histosMCreco.fill(HIST("CS_phi_pair_2"), phiPair2); - histosMCreco.fill(HIST("CS_costheta_pair_1"), cosThetaPair1); - histosMCreco.fill(HIST("CS_costheta_pair_2"), cosThetaPair2); - histosMCreco.fill(HIST("phi_cosTheta_pair_1"), phiPair1, cosThetaPair1); - histosMCreco.fill(HIST("phi_cosTheta_pair_2"), phiPair2, cosThetaPair2); + histosMCreco.fill(HIST("fourpion_rap_0_charge_domA"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); + + histosMCreco.fill(HIST("twopion_mass_1"), (p1 + p3).M()); + histosMCreco.fill(HIST("twopion_mass_2"), (p1 + p4).M()); + histosMCreco.fill(HIST("twopion_mass_3"), (p2 + p3).M()); + histosMCreco.fill(HIST("twopion_mass_4"), (p2 + p4).M()); + + histosMCreco.fill(HIST("collin_soper_phi_1"), phiPair1); + histosMCreco.fill(HIST("collin_soper_phi_2"), phiPair2); + histosMCreco.fill(HIST("collin_soper_costheta_1"), cosThetaPair1); + histosMCreco.fill(HIST("collin_soper_costheta_2"), cosThetaPair2); + histosMCreco.fill(HIST("phi_vs_costheta_1"), phiPair1, cosThetaPair1); + histosMCreco.fill(HIST("phi_vs_costheta_2"), phiPair2, cosThetaPair2); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosMCreco.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainB"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainB"), p1234.M()); + histosMCreco.fill(HIST("fourpion_rap_0_charge_domB"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_0_charge_domB"), p1234.M()); } if (p1234.Pt() > zeroPointEight) { - histosMCreco.fill(HIST("rapidity_event_0charge_WTS_PID_Pi_domainC"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_0charge_WTS_PID_Pi_domainC"), p1234.M()); + histosMCreco.fill(HIST("fourpion_rap_0_charge_domC"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_0_charge_domC"), p1234.M()); } } // End of Rapidity range selection @@ -1380,19 +1396,19 @@ struct ExclusiveRhoTo4Pi { ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; if (std::fabs(p1234.Rapidity()) < rhoRapCut) { - histosMCreco.fill(HIST("pT_event_non0charge_WTS_PID_Pi"), p1234.Pt()); + histosMCreco.fill(HIST("fourpion_pT_non_0_charge"), p1234.Pt()); if (p1234.Pt() < rhoPtCut) { - histosMCreco.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainA"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainA"), p1234.M()); + histosMCreco.fill(HIST("fourpion_rap_non_0_charge_domA"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_non_0_charge_domA"), p1234.M()); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { - histosMCreco.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainB"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainB"), p1234.M()); + histosMCreco.fill(HIST("fourpion_rap_non_0_charge_domB"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_non_0_charge_domB"), p1234.M()); } if (p1234.Pt() > zeroPointEight) { - histosMCreco.fill(HIST("rapidity_event_non0charge_WTS_PID_Pi_domainC"), p1234.Rapidity()); - histosMCreco.fill(HIST("invMass_event_non0charge_WTS_PID_Pi_domainC"), p1234.M()); + histosMCreco.fill(HIST("fourpion_rap_non_0_charge_domC"), p1234.Rapidity()); + histosMCreco.fill(HIST("fourpion_mass_non_0_charge_domC"), p1234.M()); } } // End of Rapidity range selection From daa111fd67b2c8ae53b9d9aee5a52ebabe149a52 Mon Sep 17 00:00:00 2001 From: Shyam Kumar Date: Tue, 10 Jun 2025 09:14:46 +0200 Subject: [PATCH 012/116] [PWGHF] Selection of prompt and non-prompt scores within a defined range (#11510) --- PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx index 339ab91a27c..834bf4d217c 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDplusHadrons.cxx @@ -80,7 +80,8 @@ struct HfTaskCorrelationDplusHadrons { Configurable selectionFlagDplus{"selectionFlagDplus", 7, "Selection Flag for D+"}; // 7 corresponds to topo+PID cuts Configurable selNoSameBunchPileUpColl{"selNoSameBunchPileUpColl", true, "Flag for rejecting the collisions associated with the same bunch crossing"}; Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; - Configurable> mlScorePromptOrNonPrompt{"mlScorePromptOrNonPrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt or Feed-down"}; + Configurable> mlScorePromptOrNonPromptMin{"mlScorePromptOrNonPromptMin", {0.5, 0.5, 0.5, 0.5}, "Minimum Machine learning scores for prompt or Feed-down"}; + Configurable> mlScorePromptOrNonPromptMax{"mlScorePromptOrNonPromptMax", {1.0, 1.0, 1.0, 1.0}, "Maximum Machine learning scores for prompt or Feed-down"}; Configurable> mlScoreBkg{"mlScoreBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; // pT ranges for correlation plots: the default values are those embedded in hf_cuts_dplus_to_pi_k_pi (i.e. the mass pT bins), but can be redefined via json files Configurable> binsPtCorrelations{"binsPtCorrelations", std::vector{ptBinsCorrelationsVec}, "pT bin limits for correlation plots"}; @@ -315,7 +316,7 @@ struct HfTaskCorrelationDplusHadrons { continue; } - if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPrompt->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { + if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; } double efficiencyWeightD = 1.; @@ -354,7 +355,7 @@ struct HfTaskCorrelationDplusHadrons { continue; } - if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPrompt->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { + if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; } if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) { @@ -417,7 +418,7 @@ struct HfTaskCorrelationDplusHadrons { if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) continue; - if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPrompt->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { + if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; } double efficiencyWeightD = 1.; @@ -471,7 +472,7 @@ struct HfTaskCorrelationDplusHadrons { if (ptD < binsPtEfficiencyD->front() || ptD > binsPtEfficiencyD->back()) continue; - if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPrompt->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { + if (bdtScorePromptOrNonPrompt < mlScorePromptOrNonPromptMin->at(effBinD) || bdtScorePromptOrNonPrompt > mlScorePromptOrNonPromptMax->at(effBinD) || bdtScoreBkg > mlScoreBkg->at(effBinD)) { continue; } if (trackDcaXY > dcaXYTrackMax || trackDcaZ > dcaZTrackMax || trackTpcCrossedRows < nTpcCrossedRaws) { @@ -628,7 +629,7 @@ struct HfTaskCorrelationDplusHadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } - if (outputMl[0] > mlScoreBkg->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())) || outputMl[idxBdtScore] < mlScorePromptOrNonPrompt->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()))) { + if (outputMl[0] > mlScoreBkg->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())) || outputMl[idxBdtScore] < mlScorePromptOrNonPromptMin->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt())) || outputMl[idxBdtScore] > mlScorePromptOrNonPromptMax->at(o2::analysis::findBin(binsPtEfficiencyD, candidate.pt()))) { continue; } auto collision = candidate.template collision_as>(); From e1e19500f1702a77a246ae63fd447ff4a5ca4b78 Mon Sep 17 00:00:00 2001 From: suyoupeng <109774812+15071832337@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:31:15 +0800 Subject: [PATCH 013/116] [PWGLF] Lambda local polarization induced by jet in pp collision 13.6 TeV (#11529) --- .../Strangeness/lambdaJetpolarization.cxx | 61 ++++++++----------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx index 3acfbad4d10..cca1bdf193e 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetpolarization.cxx @@ -29,6 +29,9 @@ #include #include "TProfile2D.h" #include "PWGLF/DataModel/lambdaJetpolarization.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" #include #include @@ -351,6 +354,8 @@ struct LfMyV0s { } double massPr = o2::constants::physics::MassProton; double massLambda = o2::constants::physics::MassLambda; + double massPi = o2::constants::physics::MassPionCharged; + ROOT::Math::PxPyPzMVector ProtonVec, PionVec, LambdaVec, ProtonBoostedVec, LambdaBoostedVec; TMatrixD LorentzTransInV0frame(double ELambda, double Lambdapx, double Lambdapy, double Lambdapz) { @@ -1233,32 +1238,20 @@ struct LfMyV0s { if (passedLambdaSelection(v0, pos, neg) && ctauLambda < CtauLambda && ifpasslambda) { V0NumbersPerEventsel++; registryLongitudinalPolarization.fill(HIST("hMassVsPtLambda"), v0.pt(), v0.mLambda()); - double PLambda = sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); - double ELambda = sqrt(v0.mLambda() * v0.mLambda() + PLambda * PLambda); - double protonE = sqrt(massPr * massPr + pos.px() * pos.px() + pos.py() * pos.py() + pos.pz() * pos.pz()); - TMatrixD pLabV0(4, 1); - pLabV0(0, 0) = ELambda; - pLabV0(1, 0) = v0.px(); - pLabV0(2, 0) = v0.py(); - pLabV0(3, 0) = v0.pz(); - TMatrixD pLabproton(4, 1); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = pos.px(); - pLabproton(2, 0) = pos.py(); - pLabproton(3, 0) = pos.pz(); + ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr); + PionVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi); + LambdaVec = ProtonVec + PionVec; + LambdaVec.SetM(massLambda); + ROOT::Math::Boost boost{LambdaVec.BoostToCM()}; + ProtonBoostedVec = boost(ProtonVec); + LambdaBoostedVec = boost(LambdaVec); - TMatrixD V0InV0(4, 1); - V0InV0 = LorentzTransInV0frame(ELambda, v0.px(), v0.py(), v0.pz()) * pLabV0; - registryLongitudinalPolarization.fill(HIST("V0pxInRest_frame"), V0InV0(1, 0)); - registryLongitudinalPolarization.fill(HIST("V0pyInRest_frame"), V0InV0(2, 0)); - registryLongitudinalPolarization.fill(HIST("V0pzInRest_frame"), V0InV0(3, 0)); + registryLongitudinalPolarization.fill(HIST("V0pxInRest_frame"), LambdaBoostedVec.Px()); + registryLongitudinalPolarization.fill(HIST("V0pyInRest_frame"), LambdaBoostedVec.Py()); + registryLongitudinalPolarization.fill(HIST("V0pzInRest_frame"), LambdaBoostedVec.Pz()); - TMatrixD protonInV0(4, 1); - protonInV0 = LorentzTransInV0frame(ELambda, v0.px(), v0.py(), v0.pz()) * pLabproton; - double protonPInV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); - - double protonCosThetainV0 = protonInV0(3, 0) / protonPInV0; + double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); registryLongitudinalPolarization.fill(HIST("hprotoncosthetainV0"), protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("hprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); @@ -1272,21 +1265,15 @@ struct LfMyV0s { if (passedAntiLambdaSelection(v0, pos, neg) && ctauAntiLambda < CtauLambda && ifpasslambda) { registryLongitudinalPolarization.fill(HIST("hMassVsPtAntiLambda"), v0.pt(), v0.mAntiLambda()); - double PLambda = sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz()); - double ELambda = sqrt(v0.mAntiLambda() * v0.mAntiLambda() + PLambda * PLambda); - double protonE = sqrt(massPr * massPr + neg.px() * neg.px() + neg.py() * neg.py() + neg.pz() * neg.pz()); - - TMatrixD pLabproton(4, 1); - pLabproton(0, 0) = protonE; - pLabproton(1, 0) = neg.px(); - pLabproton(2, 0) = neg.py(); - pLabproton(3, 0) = neg.pz(); - - TMatrixD protonInV0(4, 1); - protonInV0 = LorentzTransInV0frame(ELambda, v0.px(), v0.py(), v0.pz()) * pLabproton; - double protonPInV0 = sqrt(protonInV0(1, 0) * protonInV0(1, 0) + protonInV0(2, 0) * protonInV0(2, 0) + protonInV0(3, 0) * protonInV0(3, 0)); + ProtonVec = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr); + PionVec = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi); + LambdaVec = ProtonVec + PionVec; + LambdaVec.SetM(massLambda); + ROOT::Math::Boost boost{LambdaVec.BoostToCM()}; + ProtonBoostedVec = boost(ProtonVec); + LambdaBoostedVec = boost(LambdaVec); - double protonCosThetainV0 = protonInV0(3, 0) / protonPInV0; + double protonCosThetainV0 = ProtonBoostedVec.Pz() / ProtonBoostedVec.P(); registryLongitudinalPolarization.fill(HIST("hantiprotoncosthetainV0"), protonCosThetainV0); registryLongitudinalPolarization.fill(HIST("hantiprotoncosSquarethetainV0"), protonCosThetainV0 * protonCosThetainV0); From a1ea21ee8264dad92ff2e30e4d31ba31d621d075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 10 Jun 2025 12:04:27 +0200 Subject: [PATCH 014/116] [Infrastructure] Configure clang-format to sort and group includes (#11448) --- .clang-format | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++- CPPLINT.cfg | 2 +- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index c5979d77ba1..33e5d4f9d0c 100644 --- a/.clang-format +++ b/.clang-format @@ -39,7 +39,60 @@ PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 200 -SortIncludes: false +SortIncludes: CaseSensitive +IncludeBlocks: Regroup +IncludeCategories: + # O2Physics, PWG + - Regex: ^(<|")PWG[A-Z]{2}/.*\.h + Priority: 2 + CaseSensitive: true + # O2Physics, non-PWG + - Regex: ^(<|")(Common|ALICE3|DPG|EventFiltering|Tools|Tutorials)/.*\.h + Priority: 3 + CaseSensitive: true + # O2 + - Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h + Priority: 4 + CaseSensitive: true + # ROOT + - Regex: ^(<|")(T[A-Z]|Math/|Roo[A-Z])[[:alnum:]/]+\.h + Priority: 5 + CaseSensitive: true + # known third-party: KFParticle + - Regex: ^(<|")KF[A-Z][[:alnum:]]+\.h + Priority: 6 + CaseSensitive: true + # known third-party: FastJet + - Regex: ^(<|")fastjet/ + Priority: 6 + CaseSensitive: true + # known third-party: ONNX runtime + - Regex: ^(<|")onnxruntime + Priority: 6 + CaseSensitive: true + # incomplete path to DataModel + - Regex: ^(<|").*DataModel/ + Priority: 1 + CaseSensitive: true + # other third-party + - Regex: ^(<|")([[:alnum:]_]+/)+[[:alnum:]_]+\.h + Priority: 6 + CaseSensitive: true + # other local-looking file + - Regex: ^".*\. + Priority: 1 + CaseSensitive: true + # C system + - Regex: ^(<|")[[:lower:]_]+\.h(>|") + Priority: 102 + CaseSensitive: true + # C++ system + - Regex: ^(<|")[[:lower:]_/]+(>|") + Priority: 101 + CaseSensitive: true + # rest + - Regex: .* + Priority: 100 SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false diff --git a/CPPLINT.cfg b/CPPLINT.cfg index 7f7d3c357c3..96a8077f685 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -1 +1 @@ -filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo +filter=-build/c++11,-build/include_order,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo From 6368dce561df5bd95908d2d39590969487532662 Mon Sep 17 00:00:00 2001 From: Oleksii Lubynets Date: Tue, 10 Jun 2025 13:20:52 +0200 Subject: [PATCH 015/116] [PWGHF] Enable ML selection in KF-based LcToPKPi reconstruction (#11489) --- PWGHF/Core/HfMlResponseLcToPKPi.h | 63 +++++++++-- PWGHF/TableProducer/candidateSelectorLc.cxx | 59 +++++++--- PWGHF/TableProducer/treeCreatorLcToPKPi.cxx | 116 +++++++++++++++++--- 3 files changed, 194 insertions(+), 44 deletions(-) diff --git a/PWGHF/Core/HfMlResponseLcToPKPi.h b/PWGHF/Core/HfMlResponseLcToPKPi.h index 405e16cfc42..ae797f32acd 100644 --- a/PWGHF/Core/HfMlResponseLcToPKPi.h +++ b/PWGHF/Core/HfMlResponseLcToPKPi.h @@ -16,8 +16,12 @@ #ifndef PWGHF_CORE_HFMLRESPONSELCTOPKPI_H_ #define PWGHF_CORE_HFMLRESPONSELCTOPKPI_H_ +#include +#include #include +#include "PWGHF/DataModel/CandidateReconstructionTables.h" + #include "PWGHF/Core/HfMlResponse.h" // Fill the map of available input features @@ -129,10 +133,22 @@ enum class InputFeaturesLcToPKPi : uint8_t { tofNSigmaPrExpPr0, tofNSigmaPiExpPi2, tpcTofNSigmaPrExpPr0, - tpcTofNSigmaPiExpPi2 + tpcTofNSigmaPiExpPi2, + kfChi2PrimProton, + kfChi2PrimKaon, + kfChi2PrimPion, + kfChi2GeoKaonPion, + kfChi2GeoProtonPion, + kfChi2GeoProtonKaon, + kfDcaKaonPion, + kfDcaProtonPion, + kfDcaProtonKaon, + kfChi2Geo, + kfChi2Topo, + kfDecayLengthNormalised }; -template +template class HfMlResponseLcToPKPi : public HfMlResponse { public: @@ -179,8 +195,6 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcNSigmaPr2, nSigTpcPr2); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcNSigmaKa2, nSigTpcKa2); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcNSigmaPi2, nSigTpcPi2); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tpcNSigmaPrExpPr0, tpcNSigmaPr); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tpcNSigmaPiExpPi2, tpcNSigmaPi); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tpcNSigmaPrExpPr0, nSigTpcPr0, nSigTpcPr2); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tpcNSigmaPiExpPi2, nSigTpcPi2, nSigTpcPi0); // TOF PID variables @@ -193,8 +207,6 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tofNSigmaPr2, nSigTofPr2); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tofNSigmaKa2, nSigTofKa2); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tofNSigmaPi2, nSigTofPi2); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tofNSigmaPrExpPr0, tofNSigmaPr); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tofNSigmaPiExpPi2, tofNSigmaPi); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tofNSigmaPrExpPr0, nSigTofPr0, nSigTofPr2); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tofNSigmaPiExpPi2, nSigTofPi2, nSigTofPi0); // Combined PID variables @@ -207,13 +219,29 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcTofNSigmaPr0, tpcTofNSigmaPr0); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcTofNSigmaPr1, tpcTofNSigmaPr1); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, tpcTofNSigmaPr2, tpcTofNSigmaPr2); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tpcTofNSigmaPrExpPr0, tpcTofNSigmaPr); - // CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tpcTofNSigmaPiExpPi2, tpcTofNSigmaPi); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tpcTofNSigmaPrExpPr0, tpcTofNSigmaPr0, tpcTofNSigmaPr2); CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, tpcTofNSigmaPiExpPi2, tpcTofNSigmaPi2, tpcTofNSigmaPi0); } + if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + switch (idx) { + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfChi2PrimProton, kfChi2PrimProng0, kfChi2PrimProng2); + CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, kfChi2PrimKaon, kfChi2PrimProng1); + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfChi2PrimPion, kfChi2PrimProng2, kfChi2PrimProng0); + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfChi2GeoKaonPion, kfChi2GeoProng1Prong2, kfChi2GeoProng0Prong1); + CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, kfChi2GeoProtonPion, kfChi2GeoProng0Prong2); + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfChi2GeoProtonKaon, kfChi2GeoProng0Prong1, kfChi2GeoProng1Prong2); + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfDcaKaonPion, kfDcaProng1Prong2, kfDcaProng0Prong1); + CHECK_AND_FILL_VEC_LCTOPKPI_FULL(candidate, kfDcaProtonPion, kfDcaProng0Prong2); + CHECK_AND_FILL_VEC_LCTOPKPI_SIGNED(candidate, kfDcaProtonKaon, kfDcaProng0Prong1, kfDcaProng1Prong2); + CHECK_AND_FILL_VEC_LCTOPKPI(kfChi2Geo); + CHECK_AND_FILL_VEC_LCTOPKPI(kfChi2Topo); + case static_cast(InputFeaturesLcToPKPi::kfDecayLengthNormalised): { + inputFeatures.emplace_back(candidate.kfDecayLength() / candidate.kfDecayLengthError()); + break; + } + } + } } - return inputFeatures; } @@ -273,6 +301,23 @@ class HfMlResponseLcToPKPi : public HfMlResponse FILL_MAP_LCTOPKPI(tpcTofNSigmaPr2), FILL_MAP_LCTOPKPI(tpcTofNSigmaPrExpPr0), FILL_MAP_LCTOPKPI(tpcTofNSigmaPiExpPi2)}; + if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { + std::map mapKfFeatures{ + // KFParticle variables + FILL_MAP_LCTOPKPI(kfChi2PrimProton), + FILL_MAP_LCTOPKPI(kfChi2PrimKaon), + FILL_MAP_LCTOPKPI(kfChi2PrimPion), + FILL_MAP_LCTOPKPI(kfChi2GeoKaonPion), + FILL_MAP_LCTOPKPI(kfChi2GeoProtonPion), + FILL_MAP_LCTOPKPI(kfChi2GeoProtonKaon), + FILL_MAP_LCTOPKPI(kfDcaKaonPion), + FILL_MAP_LCTOPKPI(kfDcaProtonPion), + FILL_MAP_LCTOPKPI(kfDcaProtonKaon), + FILL_MAP_LCTOPKPI(kfChi2Geo), + FILL_MAP_LCTOPKPI(kfChi2Topo), + FILL_MAP_LCTOPKPI(kfDecayLengthNormalised)}; + MlResponse::mAvailableInputFeatures.insert(mapKfFeatures.begin(), mapKfFeatures.end()); + } } }; diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index 93b84c79522..d48cb5f3daa 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -93,7 +93,8 @@ struct HfCandidateSelectorLc { Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; HfHelper hfHelper; - o2::analysis::HfMlResponseLcToPKPi hfMlResponse; + o2::analysis::HfMlResponseLcToPKPi hfMlResponseDCA; + o2::analysis::HfMlResponseLcToPKPi hfMlResponseKF; std::vector outputMlLcToPKPi = {}; std::vector outputMlLcToPiKP = {}; o2::ccdb::CcdbApi ccdbApi; @@ -142,15 +143,28 @@ struct HfCandidateSelectorLc { } if (applyMl) { - hfMlResponse.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); - if (loadModelsFromCCDB) { - ccdbApi.init(ccdbUrl); - hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); - } else { - hfMlResponse.setModelPathsLocal(onnxFileNames); + if (doprocessNoBayesPidWithDCAFitterN || doprocessBayesPidWithDCAFitterN) { + hfMlResponseDCA.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponseDCA.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponseDCA.setModelPathsLocal(onnxFileNames); + } + hfMlResponseDCA.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponseDCA.init(); + } + if (doprocessNoBayesPidWithKFParticle || doprocessBayesPidWithKFParticle) { + hfMlResponseKF.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponseKF.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponseKF.setModelPathsLocal(onnxFileNames); + } + hfMlResponseKF.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponseKF.init(); } - hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); - hfMlResponse.init(); } massK0Star892 = o2::constants::physics::MassK0Star892; @@ -273,7 +287,7 @@ struct HfCandidateSelectorLc { return false; } - float massLc, massKPi; + float massLc{0.f}, massKPi{0.f}; if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { if (trackProton.globalIndex() == candidate.prong0Id()) { massLc = hfHelper.invMassLcToPKPi(candidate); @@ -553,13 +567,24 @@ struct HfCandidateSelectorLc { isSelectedMlLcToPKPi = false; isSelectedMlLcToPiKP = false; - if (pidLcToPKPi == 1 && pidBayesLcToPKPi == 1 && topolLcToPKPi) { - std::vector inputFeaturesLcToPKPi = hfMlResponse.getInputFeatures(candidate, true); - isSelectedMlLcToPKPi = hfMlResponse.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlLcToPKPi); - } - if (pidLcToPiKP == 1 && pidBayesLcToPiKP == 1 && topolLcToPiKP) { - std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, false); - isSelectedMlLcToPiKP = hfMlResponse.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlLcToPiKP); + if constexpr (reconstructionType == aod::hf_cand::VertexerType::DCAFitter) { + if (pidLcToPKPi == 1 && pidBayesLcToPKPi == 1 && topolLcToPKPi) { + std::vector inputFeaturesLcToPKPi = hfMlResponseDCA.getInputFeatures(candidate, true); + isSelectedMlLcToPKPi = hfMlResponseDCA.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlLcToPKPi); + } + if (pidLcToPiKP == 1 && pidBayesLcToPiKP == 1 && topolLcToPiKP) { + std::vector inputFeaturesLcToPiKP = hfMlResponseDCA.getInputFeatures(candidate, false); + isSelectedMlLcToPiKP = hfMlResponseDCA.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlLcToPiKP); + } + } else { + if (pidLcToPKPi == 1 && pidBayesLcToPKPi == 1 && topolLcToPKPi) { + std::vector inputFeaturesLcToPKPi = hfMlResponseKF.getInputFeatures(candidate, true); + isSelectedMlLcToPKPi = hfMlResponseKF.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlLcToPKPi); + } + if (pidLcToPiKP == 1 && pidBayesLcToPiKP == 1 && topolLcToPiKP) { + std::vector inputFeaturesLcToPiKP = hfMlResponseKF.getInputFeatures(candidate, false); + isSelectedMlLcToPiKP = hfMlResponseKF.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlLcToPiKP); + } } hfMlLcToPKPiCandidate(outputMlLcToPKPi, outputMlLcToPiKP); diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index 5ad144e472e..3f53966a973 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -17,7 +17,9 @@ /// \author Nicolo' Jacazio , CERN /// \author Luigi Dello Stritto , CERN +#include #include +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" @@ -87,6 +89,9 @@ DECLARE_SOA_COLUMN(IsCandidateSwapped, isCandidateSwapped, int8_t); DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfCand3ProngWPidPiKaPr, "_0"); DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); DECLARE_SOA_COLUMN(Channel, channel, int8_t); // direct or resonant +DECLARE_SOA_COLUMN(MlScoreFirstClass, mlScoreFirstClass, float); +DECLARE_SOA_COLUMN(MlScoreSecondClass, mlScoreSecondClass, float); +DECLARE_SOA_COLUMN(MlScoreThirdClass, mlScoreThirdClass, float); // Events DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); @@ -238,7 +243,10 @@ DECLARE_SOA_TABLE(HfCandLcLites, "AOD", "HFCANDLCLITE", full::OriginMcRec, full::IsCandidateSwapped, full::Channel, - full::MassKPi); + full::MassKPi, + full::MlScoreFirstClass, + full::MlScoreSecondClass, + full::MlScoreThirdClass); DECLARE_SOA_TABLE(HfCollIdLCLite, "AOD", "HFCOLLIDLCLITE", full::CollisionId); @@ -316,7 +324,10 @@ DECLARE_SOA_TABLE(HfCandLcFulls, "AOD", "HFCANDLCFULL", full::IsCandidateSwapped, full::CandidateId, full::Channel, - full::MassKPi); + full::MassKPi, + full::MlScoreFirstClass, + full::MlScoreSecondClass, + full::MlScoreThirdClass); DECLARE_SOA_TABLE(HfCandLcFullEvs, "AOD", "HFCANDLCFULLEV", full::CollisionId, @@ -374,6 +385,7 @@ struct HfTreeCreatorLcToPKPi { Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; Configurable fillCollIdTable{"fillCollIdTable", false, "Fill a single-column table with collision index"}; Configurable fillCandidateMcTable{"fillCandidateMcTable", false, "Switch to fill a table with MC particles matched to candidates"}; + Configurable applyMl{"applyMl", false, "Whether ML was used in candidateSelectorLc"}; Configurable keepOnlySignalMc{"keepOnlySignalMc", false, "Fill MC tree only with signal candidates"}; Configurable keepOnlyBkg{"keepOnlyBkg", false, "Fill MC tree only with background candidates"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; @@ -553,11 +565,40 @@ struct HfTreeCreatorLcToPKPi { return std::make_pair(invMass, invMassKPi); } + /// \brief function to get ML score values for the current candidate and assign them to input parameters + /// \param candidate candidate instance + /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate + /// \param mlScoreFirstClass ML score for belonging to the first class + /// \param mlScoreSecondClass ML score for belonging to the second class + /// \param mlScoreThirdClass ML score for belonging to the third class + /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used + void assignMlScores(aod::HfMlLcToPKPi::iterator const& candidateMlScore, float& mlScoreFirstClass, float& mlScoreSecondClass, float& mlScoreThirdClass, int candFlag) + { + std::vector mlScores; + if (candFlag == 0) { + std::copy(candidateMlScore.mlProbLcToPKPi().begin(), candidateMlScore.mlProbLcToPKPi().end(), std::back_inserter(mlScores)); + } else { + std::copy(candidateMlScore.mlProbLcToPiKP().begin(), candidateMlScore.mlProbLcToPiKP().end(), std::back_inserter(mlScores)); + } + constexpr int IndexFirstClass{0}; + constexpr int IndexSecondClass{1}; + constexpr int IndexThirdClass{2}; + if (mlScores.size() == 0) { + return; // when candidateSelectorLc rejects a candidate by "usual", non-ML cut, the ml score vector remains empty + } + mlScoreFirstClass = mlScores.at(IndexFirstClass); + mlScoreSecondClass = mlScores.at(IndexSecondClass); + if (mlScores.size() > IndexThirdClass) { + mlScoreThirdClass = mlScores.at(IndexThirdClass); + } + } + /// \brief function to fill lite table /// \param candidate candidate instance + /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used template - void fillLiteTable(CandType const& candidate, int candFlag) + void fillLiteTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMasses(candidate, candFlag); const float functionCt = hfHelper.ctLc(candidate); @@ -575,6 +616,14 @@ struct HfTreeCreatorLcToPKPi { functionFlagMcDecayChanRec = candidate.flagMcDecayChanRec(); } + float mlScoreFirstClass{UndefValueFloat}; + float mlScoreSecondClass{UndefValueFloat}; + float mlScoreThirdClass{UndefValueFloat}; + + if (applyMl) { + assignMlScores(candidateMlScore, mlScoreFirstClass, mlScoreSecondClass, mlScoreThirdClass, candFlag); + } + rowCandidateLite( candidate.posX(), candidate.posY(), @@ -618,7 +667,10 @@ struct HfTreeCreatorLcToPKPi { functionOriginMcRec, functionIsCandidateSwapped, functionFlagMcDecayChanRec, - functionInvMassKPi); + functionInvMassKPi, + mlScoreFirstClass, + mlScoreSecondClass, + mlScoreThirdClass); if (fillCollIdTable) { /// save also candidate collision indices @@ -628,9 +680,10 @@ struct HfTreeCreatorLcToPKPi { /// \brief function to fill lite table /// \param candidate candidate instance + /// \param candidateMlScore instance of handler of vectors with ML scores associated with the current candidate /// \param candFlag flag indicating if PKPi (0) or PiKP (1) hypothesis is used template - void fillFullTable(CandType const& candidate, int candFlag) + void fillFullTable(CandType const& candidate, aod::HfMlLcToPKPi::iterator const& candidateMlScore, int candFlag) { auto [functionInvMass, functionInvMassKPi] = evaluateInvariantMasses(candidate, candFlag); const float functionCt = hfHelper.ctLc(candidate); @@ -649,6 +702,14 @@ struct HfTreeCreatorLcToPKPi { functionFlagMcDecayChanRec = candidate.flagMcDecayChanRec(); } + float mlScoreFirstClass{UndefValueFloat}; + float mlScoreSecondClass{UndefValueFloat}; + float mlScoreThirdClass{UndefValueFloat}; + + if (applyMl) { + assignMlScores(candidateMlScore, mlScoreFirstClass, mlScoreSecondClass, mlScoreThirdClass, candFlag); + } + rowCandidateFull( candidate.collisionId(), candidate.posX(), @@ -722,7 +783,10 @@ struct HfTreeCreatorLcToPKPi { functionIsCandidateSwapped, candidate.globalIndex(), functionFlagMcDecayChanRec, - functionInvMassKPi); + functionInvMassKPi, + mlScoreFirstClass, + mlScoreSecondClass, + mlScoreThirdClass); } /// \brief function to fill lite table @@ -839,6 +903,7 @@ struct HfTreeCreatorLcToPKPi { void fillTablesMc(Colls const& collisions, aod::McCollisions const&, CandType const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, soa::Join const& particles, soa::Join const&, aod::BCs const&) { @@ -850,7 +915,10 @@ struct HfTreeCreatorLcToPKPi { const size_t candidatesSize = candidates.size(); reserveTables(candidatesSize, IsMc); + int iCand{0}; for (const auto& candidate : candidates) { + auto candidateMlScore = candidateMlScores.rawIteratorAt(iCand); + ++iCand; float ptProng0 = candidate.ptProng0(); auto collision = candidate.template collision_as(); auto fillTable = [&](int candFlag) { @@ -863,9 +931,9 @@ struct HfTreeCreatorLcToPKPi { const bool notSkippedBkg = isMcCandidateSignal || candidate.pt() > downSampleBkgPtMax || pseudoRndm < downSampleBkgFactor; if (passSelection && notSkippedBkg && (keepAll || (keepOnlySignalMc && isMcCandidateSignal) || (keepOnlyBkg && !isMcCandidateSignal))) { if (fillCandidateLiteTable) { - fillLiteTable(candidate, candFlag); + fillLiteTable(candidate, candidateMlScore, candFlag); } else { - fillFullTable(candidate, candFlag); + fillFullTable(candidate, candidateMlScore, candFlag); } if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -955,10 +1023,11 @@ struct HfTreeCreatorLcToPKPi { void processMcNoCentralityWithDCAFitterN(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, soa::Join const& particles, soa::Join const& tracks, aod::BCs const& bcs) { - fillTablesMc(collisions, mcCollisions, candidates, particles, tracks, bcs); + fillTablesMc(collisions, mcCollisions, candidates, candidateMlScores, particles, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processMcNoCentralityWithDCAFitterN, "Process MC tree writer w/o centrality with DCAFitterN", false); @@ -971,10 +1040,11 @@ struct HfTreeCreatorLcToPKPi { void processMcWithCentralityWithDCAFitterN(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, soa::Join const& particles, soa::Join const& tracks, aod::BCs const& bcs) { - fillTablesMc(collisions, mcCollisions, candidates, particles, tracks, bcs); + fillTablesMc(collisions, mcCollisions, candidates, candidateMlScores, particles, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processMcWithCentralityWithDCAFitterN, "Process MC tree writer with centrality with DCAFitterN", false); @@ -988,10 +1058,11 @@ struct HfTreeCreatorLcToPKPi { void processMcNoCentralityWithKFParticle(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, soa::Join const& particles, soa::Join const& tracks, aod::BCs const& bcs) { - fillTablesMc(collisions, mcCollisions, candidates, particles, tracks, bcs); + fillTablesMc(collisions, mcCollisions, candidates, candidateMlScores, particles, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processMcNoCentralityWithKFParticle, "Process MC tree writer w/o centrality with KFParticle", false); @@ -1004,10 +1075,11 @@ struct HfTreeCreatorLcToPKPi { void processMcWithCentralityWithKFParticle(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, soa::Join const& particles, soa::Join const& tracks, aod::BCs const& bcs) { - fillTablesMc(collisions, mcCollisions, candidates, particles, tracks, bcs); + fillTablesMc(collisions, mcCollisions, candidates, candidateMlScores, particles, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processMcWithCentralityWithKFParticle, "Process MC tree writer with centrality with KFParticle", false); @@ -1017,6 +1089,7 @@ struct HfTreeCreatorLcToPKPi { template void fillTablesData(Colls const& collisions, CandType const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, TracksWPid const&, aod::BCs const&) { @@ -1029,7 +1102,10 @@ struct HfTreeCreatorLcToPKPi { // Filling candidate properties + int iCand{0}; for (const auto& candidate : candidates) { + auto candidateMlScore = candidateMlScores.rawIteratorAt(iCand); + ++iCand; float ptProng0 = candidate.ptProng0(); auto collision = candidate.template collision_as(); auto fillTable = [&](int candFlag) { @@ -1037,9 +1113,9 @@ struct HfTreeCreatorLcToPKPi { const int functionSelection = candFlag == 0 ? candidate.isSelLcToPKPi() : candidate.isSelLcToPiKP(); if (functionSelection >= selectionFlagLc && (candidate.pt() > downSampleBkgPtMax || (pseudoRndm < downSampleBkgFactor && candidate.pt() < downSampleBkgPtMax))) { if (fillCandidateLiteTable) { - fillLiteTable(candidate, candFlag); + fillLiteTable(candidate, candidateMlScore, candFlag); } else { - fillFullTable(candidate, candFlag); + fillFullTable(candidate, candidateMlScore, candFlag); } if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { @@ -1060,9 +1136,10 @@ struct HfTreeCreatorLcToPKPi { /// \param bcs Bunch-crossing table void processDataNoCentralityWithDCAFitterN(soa::Join const& collisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, TracksWPid const& tracks, aod::BCs const& bcs) { - fillTablesData(collisions, candidates, tracks, bcs); + fillTablesData(collisions, candidates, candidateMlScores, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processDataNoCentralityWithDCAFitterN, "Process data tree writer w/o centrality with DCAFitterN", false); @@ -1073,9 +1150,10 @@ struct HfTreeCreatorLcToPKPi { /// \param bcs Bunch-crossing table void processDataWithCentralityWithDCAFitterN(soa::Join const& collisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, TracksWPid const& tracks, aod::BCs const& bcs) { - fillTablesData(collisions, candidates, tracks, bcs); + fillTablesData(collisions, candidates, candidateMlScores, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processDataWithCentralityWithDCAFitterN, "Process data tree writer with centrality with DCAFitterN", true); @@ -1086,9 +1164,10 @@ struct HfTreeCreatorLcToPKPi { /// \param bcs Bunch-crossing table void processDataNoCentralityWithKFParticle(soa::Join const& collisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, TracksWPid const& tracks, aod::BCs const& bcs) { - fillTablesData(collisions, candidates, tracks, bcs); + fillTablesData(collisions, candidates, candidateMlScores, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processDataNoCentralityWithKFParticle, "Process data tree writer w/o centrality with KFParticle", false); @@ -1099,9 +1178,10 @@ struct HfTreeCreatorLcToPKPi { /// \param bcs Bunch-crossing table void processDataWithCentralityWithKFParticle(soa::Join const& collisions, soa::Join const& candidates, + aod::HfMlLcToPKPi const& candidateMlScores, TracksWPid const& tracks, aod::BCs const& bcs) { - fillTablesData(collisions, candidates, tracks, bcs); + fillTablesData(collisions, candidates, candidateMlScores, tracks, bcs); } PROCESS_SWITCH(HfTreeCreatorLcToPKPi, processDataWithCentralityWithKFParticle, "Process data tree writer with centrality with KFParticle", false); }; From 03dcf2600487af09f6bb519e1ff661bdc8f0423b Mon Sep 17 00:00:00 2001 From: Zhengqing Wang Date: Tue, 10 Jun 2025 20:29:01 +0800 Subject: [PATCH 016/116] [PWGCF] update on ese (#11530) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowEsePHe3.cxx | 1564 ++++++++++++++++-------------- 1 file changed, 820 insertions(+), 744 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowEsePHe3.cxx b/PWGCF/Flow/Tasks/flowEsePHe3.cxx index 61582f233b3..624043a2d31 100644 --- a/PWGCF/Flow/Tasks/flowEsePHe3.cxx +++ b/PWGCF/Flow/Tasks/flowEsePHe3.cxx @@ -36,6 +36,8 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/StaticFor.h" +#include "DataFormatsTPC/BetheBlochAleph.h" + #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -51,42 +53,213 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; namespace o2::aod { -namespace flow_ese_p_he3 +namespace ese_var_table { -DECLARE_SOA_COLUMN(NPidFlag, nPidFlag, int8_t); // unqualified -1, hadron 0, proton 1, he3 2, proton+he3 3 -} // namespace flow_ese_p_he3 -DECLARE_SOA_TABLE(PHe3ESEFlags, "AOD", "PHe3ESEFlags", flow_ese_p_he3::NPidFlag); +DECLARE_SOA_COLUMN(EseVtz, eseVtz, float); +DECLARE_SOA_COLUMN(EseCentFT0C, eseCentFT0C, float); +DECLARE_SOA_COLUMN(EsePsi2FT0C, esePsi2FT0C, float); +DECLARE_SOA_COLUMN(Eseq2Tar, eseq2Tar, float); +DECLARE_SOA_COLUMN(Eseq2Ref, eseq2Ref, float); +DECLARE_SOA_COLUMN(EseTarSign, eseTarSign, int8_t); +DECLARE_SOA_COLUMN(EseTarTPCInnerParam, eseTarTPCInnerParam, float); +DECLARE_SOA_COLUMN(EseTarTPCSignal, eseTarTPCSignal, float); +DECLARE_SOA_COLUMN(EseTarPt, eseTarPt, float); +DECLARE_SOA_COLUMN(EseTarEta, eseTarEta, float); +DECLARE_SOA_COLUMN(EseTarPhi, eseTarPhi, float); +DECLARE_SOA_COLUMN(EseTarDCAxy, eseTarDCAxy, float); +DECLARE_SOA_COLUMN(EseTarDCAz, eseTarDCAz, float); +DECLARE_SOA_COLUMN(EseTarTPCNcls, eseTarTPCNcls, uint8_t); +DECLARE_SOA_COLUMN(EseTarITSNcls, eseTarITSNcls, uint8_t); +DECLARE_SOA_COLUMN(EseTarTPCChi2NDF, eseTarTPCChi2NDF, float); +DECLARE_SOA_COLUMN(EseTarITSChi2NDF, eseTarITSChi2NDF, float); +DECLARE_SOA_COLUMN(EseTarTPCNSigma, eseTarTPCNSigma, float); +DECLARE_SOA_COLUMN(EseTarTOFNSigma, eseTarTOFNSigma, float); +DECLARE_SOA_COLUMN(EseTarITSNSigma, eseTarITSNSigma, float); +DECLARE_SOA_COLUMN(EseTarITSClusSize, eseTarITSClusSize, uint32_t); +} // namespace ese_var_table + +DECLARE_SOA_TABLE(ESETable, "AOD", "ESETable", + ese_var_table::EseVtz, + ese_var_table::EseCentFT0C, + ese_var_table::EsePsi2FT0C, + ese_var_table::Eseq2Tar, + ese_var_table::Eseq2Ref, + ese_var_table::EseTarSign, + ese_var_table::EseTarTPCInnerParam, + ese_var_table::EseTarTPCSignal, + ese_var_table::EseTarPt, + ese_var_table::EseTarEta, + ese_var_table::EseTarPhi, + ese_var_table::EseTarDCAxy, + ese_var_table::EseTarDCAz, + ese_var_table::EseTarTPCNcls, + ese_var_table::EseTarITSNcls, + ese_var_table::EseTarTPCChi2NDF, + ese_var_table::EseTarITSChi2NDF, + ese_var_table::EseTarTPCNSigma, + ese_var_table::EseTarTOFNSigma, + ese_var_table::EseTarITSNSigma, + ese_var_table::EseTarITSClusSize); } // namespace o2::aod -namespace pid_flags -{ -// constexpr int8_t kUnqualified = -1; -// constexpr int8_t kUnPOIHadron = 0; -constexpr int8_t kProton = 1; -constexpr int8_t kHe3 = 2; -constexpr int8_t kProtonHe3 = 3; -} // namespace pid_flags - -namespace event_selection -{ -constexpr int kFT0AV0ASigma = 5; -} +struct ESECandidate { + float vtz; + float centFT0C; + float psi2FT0C; + float q2Tar; + float q2Ref; + int8_t signTar; + float tpcInnerParamTar; + float tpcSignalTar; + float ptTar; + float etaTar; + float phiTar; + float dcaXYTar; + float dcaZTar; + uint8_t tpcNclsTar; + uint8_t itsNclsTar; + float tpcChi2NDFTar; + float itsChi2NDFTar; + float tpcNSigmaTar; + float tofNSigmaTar; + float itsNSigmaTar; + uint32_t itsClusSizeTar; +}; -namespace fourier_mode +namespace ese_parameters { -// constexpr int kMode1 = 1; -constexpr int kMode2 = 2; -// constexpr int kMode3 = 3; -} // namespace fourier_mode +constexpr uint8_t kProton = 0; +constexpr uint8_t kDeuteron = 1; +constexpr uint8_t kTriton = 2; +constexpr uint8_t kHe3 = 3; +constexpr uint8_t kAlpha = 4; +constexpr int kFT0AV0ASigma = 5; +constexpr int kRMSMode = 0; +constexpr int kTPCMode = 1; +constexpr int kTOFOnlyMode = 2; +constexpr float Amplitudelow = 1e-8; +constexpr float Charges[5]{1.f, 1.f, 1.f, 2.f, 2.f}; +constexpr float Masses[5]{MassProton, MassDeuteron, MassTriton, MassHelium3, MassAlpha}; +constexpr double BetheBlochDefault[5][6]{ + {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, + {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, + {-239.99, 1.155, 1.099, 1.137, 1.006, 0.09}, + {-321.34, 0.6539, 1.591, 0.8225, 2.363, 0.09}, + {-586.66, 1.859, 4.435, 0.282, 3.201, 0.09}}; +constexpr double BbMomScalingDefault[5][2]{// 0:poscharged 1:negcharged + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}, + {1., 1.}}; +constexpr int Open3DPIDPlots[3][1]{ + {0}, + {0}, + {0}}; +constexpr int OpenEvSel[10][1]{ + {1}, + {1}, + {1}, + {1}, + {1}, + {1}, + {1}, + {1}, + {0}, + {1}}; +constexpr int OpenTrackSel[7][1]{ + {1}, + {1}, + {1}, + {1}, + {1}, + {1}, + {1}}; +constexpr double TPCnSigmaCutDefault[5][2]{ + {-3., 3.}, + {-3., 3.}, + {-3., 3.}, + {-3., 3.}, + {-3., 3.}}; +constexpr double ITSnSigmaCutDefault[5][2]{ + {-3., 3.}, + {-3., 3.}, + {-3., 3.}, + {-3., 3.}, + {-3., 3.}}; +constexpr double PtPreselection[5][2]{ + {0.15, 99.}, + {0.15, 99.}, + {0.15, 99.}, + {0.15, 99.}, + {0.15, 99.}}; +static const std::vector names{"proton", "deuteron", "triton", "He3", "alpha"}; +static const std::vector chargeLabelNames{"Positive", "Negative"}; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +static const std::vector plot3DPIDNames{"TOF vs ITS", "ITS vs TPC", "TOF vs TPC"}; +static const std::vector openEventSelNames{"EvSelkIsGoodZvtxFT0vsPV", "EvSelkNoSameBunchPileup", "EvSelkNoCollInTimeRangeStandard", "EvSelkIsGoodITSLayersAll", "EvSelkNoCollInRofStandard", "EvSelkNoHighMultCollInPrevRof", "EvSelOccupancy", "EvSelMultCorrelationPVTracks", "EvSelMultCorrelationGlobalTracks", "EvSelV0AT0ACut"}; +static const std::vector openTrackSelNames{"passedITSNCls", "passedITSChi2NDF", "passedITSHits", "passedTPCChi2NDF", "passedTPCCrossedRowsOverNCls", "passedDCAxy", "passedDCAz"}; +static const std::vector plot3DConfigNames{"Open related 3D nSigma plots"}; +static const std::vector openEventSelConfigNames{"Open related event selection options"}; +static const std::vector openTrackSelConfigNames{"Open track selection from TrackSelection table"}; +static const std::vector pidTPCnSigmaNames{"n#sigma_{TPC} Low", "n#sigma_{TPC} High"}; +static const std::vector pidITSnSigmaNames{"n#sigma_{ITS} Low", "n#sigma_{ITS} High"}; +static const std::vector pidPtNames{"p_{T} Low", "p_{T} High"}; +std::vector eseCandidates; +// Tar ptr +std::shared_ptr hPIDQATar1D[12]; +std::shared_ptr hPIDQATar2D[4]; +std::shared_ptr hPIDQATar3D[3]; +std::shared_ptr hv2Tar[2]; +std::shared_ptr hESEQATar1D[2]; +std::shared_ptr hESEQATar2D; +std::shared_ptr hESETar; +// Ref ptr +std::shared_ptr hPIDQARef1D[12]; +std::shared_ptr hPIDQARef2D[4]; +std::shared_ptr hPIDQARef3D[3]; +std::shared_ptr hv2Ref[2]; +std::shared_ptr hESEQARef1D[2]; +std::shared_ptr hESEQARef2D; +} // namespace ese_parameters -using TracksPID = soa::Join; -struct FillPIDcolums { +using TracksPIDFull = soa::Join; - HistogramRegistry histosQA{"histosQAPID", {}, OutputObjHandlingPolicy::AnalysisObject}; +struct FlowEsePHe3 { + EventPlaneHelper helperEP; + o2::aod::ITSResponse itsResponse; + HistogramRegistry histsESE{"histsESE", {}, OutputObjHandlingPolicy::AnalysisObject}; + // process POI control + Configurable cfgTarName{"cfgTarName", "kHe3", "Name of the v2 particle: kProton, kDeuteron, kTriton, kHe3, kAlpha"}; + Configurable cfgRefName{"cfgRefName", "kProton", "Name of the q2 reference particle: kProton, kDeuteron, kTriton, kHe3, kAlpha"}; + // total control config + Configurable cfgOpenAllowCrossTrack{"cfgOpenAllowCrossTrack", false, "Allow one track to be identified as different kind of PID particles"}; + Configurable cfgOpenFullEventQA{"cfgOpenFullEventQA", true, "Open full QA plots for event QA"}; + Configurable cfgOpenPIDQA{"cfgOpenPIDQA", true, "Open PID QA plots"}; + Configurable cfgOpenv2{"cfgOpenv2", true, "Open v2(EP)and q calculation for Proton and He3"}; + Configurable cfgOpenESE{"cfgOpenESE", true, "Open ESE plots"}; + Configurable cfgOpenESEQA{"cfgOpenESEQA", true, "Open ESE QA plots"}; + Configurable> cfgOpen3DPIDPlots{"cfgOpen3DPIDPlots", {ese_parameters::Open3DPIDPlots[0], 3, 1, ese_parameters::plot3DPIDNames, ese_parameters::plot3DConfigNames}, "3D PID QA Plots switch configuration"}; + // Qvec configs + Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; + Configurable cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"}; + Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; + Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "total qvector number"}; + // pre event selection(filter) + Configurable cfgVtzCut{"cfgVtzCut", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCentMin{"cfgCentMin", 0.0f, "Centrality min"}; + Configurable cfgCentMax{"cfgCentMax", 100.0f, "Centrality max"}; + // event selection configs + Configurable cfgCutOccupancyLow{"cfgCutOccupancyLow", 0, "Low boundary cut on TPC occupancy"}; + Configurable cfgCutOccupancyHigh{"cfgCutOccupancyHigh", 3000, "High boundary cut on TPC occupancy"}; + Configurable> cfgOpenEvSel{"cfgOpenEvSel", {ese_parameters::OpenEvSel[0], 10, 1, ese_parameters::openEventSelNames, ese_parameters::openEventSelConfigNames}, "Event selection switch configuration"}; + // track selection configs + Configurable> cfgOpenTrackSel{"cfgOpenTrackSel", {ese_parameters::OpenTrackSel[0], 7, 1, ese_parameters::openTrackSelNames, ese_parameters::openTrackSelConfigNames}, "Track selection switch configuration"}; Configurable cfgMinPtPID{"cfgMinPtPID", 0.15, "Minimum track #P_{t} for PID"}; Configurable cfgMaxPtPID{"cfgMaxPtPID", 99.9, "Maximum track #P_{t} for PID"}; Configurable cfgMaxEtaPID{"cfgMaxEtaPID", 0.8, "Maximum track #eta for PID"}; @@ -101,516 +274,152 @@ struct FillPIDcolums { Configurable cfgMaxDCAxy{"cfgMaxDCAxy", 99, "Maxium DCAxy for standard PID tracking"}; Configurable cfgMaxDCAz{"cfgMaxDCAz", 2, "Maxium DCAz for standard PID tracking"}; Configurable cfgPtMaxforTPCOnlyPIDPrton{"cfgPtMaxforTPCOnlyPIDPrton", 0.4, "Maxmium track pt for TPC only PID, at RMS PID mode for proton"}; - Configurable cfgPtMaxforTPCOnlyPIDHe3{"cfgPtMaxforTPCOnlyPIDHe3", 0.5, "Maxmium track pt for TPC only PID, at RMS PID mode for he3"}; - - Configurable cfgProtonPIDMode{"cfgProtonPIDMode", 2, "Proton PID mode: 0 for TPC + RMS(TPC,TOF), 1 for TPC only, 2 for TOF only"}; - Configurable cfgHe3PIDMode{"cfgHe3PIDMode", 1, "He3 PID mode: 0 for TPC + RMS(TPC,TOF), 1 for TPC only, 2 for TOF only"}; - - Configurable cfgOpenpassedITSNCls{"cfgOpenpassedITSNCls", false, "useTrackSelectionTables passedITSNCls for basic track selection"}; - Configurable cfgOpenpassedITSChi2NDF{"cfgOpenpassedITSChi2NDF", false, "useTrackSelectionTables passedITSChi2NDF for basic track selection"}; - Configurable cfgOpenpassedITSHits{"cfgOpenpassedITSHits", false, "useTrackSelectionTables passedITSHits for basic track selection"}; - Configurable cfgOpenpassedTPCChi2NDF{"cfgOpenpassedTPCChi2NDF", false, "useTrackSelectionTables passedTPCChi2NDF for basic track selection"}; - Configurable cfgOpenpassedTPCCrossedRowsOverNCls{"cfgOpenpassedTPCCrossedRowsOverNCls", false, "useTrackSelectionTables passedTPCCrossedRowsOverNCls for basic track selection"}; - Configurable cfgOpenpassedDCAxy{"cfgOpenpassedDCAxy", false, "useTrackSelectionTables passedDCAxy for basic track selection"}; - Configurable cfgOpenpassedDCAz{"cfgOpenpassedDCAz", false, "useTrackSelectionTables passedDCAz for basic track selection"}; - - Configurable cfgQuietMode{"cfgQuietMode", false, "open quiet mode for saving cpu cost and only do some basic QA plots"}; - Configurable cfgOpenPIDITSProton{"cfgOpenPIDITSProton", true, "open ITS assistance cut for proton PID"}; - Configurable cfgOpenPIDITSHe3{"cfgOpenPIDITSHe3", false, "open ITS assistance cut for He3 PID"}; - Configurable cfgOpenPIDByPtProtonMain{"cfgOpenPIDByPtProtonMain", false, "Selection Proton by pt its pt binnings for main selection"}; - Configurable cfgOpenPIDByPtHe3Main{"cfgOpenPIDByPtHe3Main", false, "Selection He3 by pt its pt binnings for main selection"}; - Configurable cfgOpenPIDByPtProtonITS{"cfgOpenPIDByPtProtonITS", false, "Selection Proton by pt its pt binnings for ITS selection"}; - Configurable cfgOpenPIDByPtHe3ITS{"cfgOpenPIDByPtHe3ITS", false, "Selection He3 by pt its pt binnings for ITS selection"}; - Configurable cfgOpenHe3ITSPtCut{"cfgOpenHe3ITSPtCut", true, "Do He3 ITS contamination cut"}; - Configurable cfgOpenAllowCrossTrack{"cfgOpenAllowCrossTrack", false, "Allow one track to be identified as different kind of PID particles"}; - - Configurable cfgOpenPlotnSigmaTOFITSPt{"cfgOpenPlotnSigmaTOFITSPt", true, "plot nSigmaTOF vs nSigmaITS vs Pt"}; - Configurable cfgOpenPlotnSigmaITSTPCPt{"cfgOpenPlotnSigmaITSTPCPt", true, "plot nSigmaITS vs nSigmaTOF vs Pt"}; - Configurable cfgOpenPlotnSigmaTOFTPCPt{"cfgOpenPlotnSigmaTOFTPCPt", true, "plot nSigmaTOF vs nSigmaTPC vs Pt"}; - - Configurable> cfgPtCutProton{"cfgPtCutProton", {0.15, 99.}, "Pt limit for Proton"}; - Configurable> cfgPtCutHe3{"cfgPtCutHe3", {0.15, 99.}, "Pt limit for He3"}; - Configurable> cfgnSigmaCutTPCProton{"cfgnSigmaCutTPCProton", {-3, 3}, "TPC nsigma cut limit for Proton"}; - Configurable> cfgnSigmaCutTPCHe3{"cfgnSigmaCutTPCHe3", {-2, 2}, "TPC nsigma cut limit for He3"}; + // PID configs + Configurable> cfgPtPreselection{"cfgPtPreselection", {ese_parameters::PtPreselection[0], 5, 2, ese_parameters::names, ese_parameters::pidPtNames}, "Pt preselection for light nuclei"}; Configurable> cfgnSigmaCutTOFProton{"cfgnSigmaCutTOFProton", {-1.5, 1.5}, "TOF nsigma cut limit for Proton"}; - Configurable> cfgnSigmaCutTOFHe3{"cfgnSigmaCutTOFHe3", {-1.5, 1.5}, "TOF nsigma cut limit for He3"}; - Configurable> cfgnSigmaCutITSProton{"cfgnSigmaCutITSProton", {-3, 3}, "ITS nsigma cut limit for Proton"}; - Configurable> cfgnSigmaCutITSHe3{"cfgnSigmaCutITSHe3", {-3, 3}, "ITS nsigma cut limit for He3"}; Configurable> cfgnSigmaCutRMSProton{"cfgnSigmaCutRMSProton", {-3, 3}, "RMS nsigma cut limit for Proton"}; - Configurable> cfgnSigmaCutRMSHe3{"cfgnSigmaCutRMSHe3", {-3, 3}, "RMS nsigma cut limit for He3"}; - - Configurable> cfgPtBinProtonPID{"cfgPtBinProtonPID", {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0}, "pt bin for pion PIDnsigma"}; - Configurable> cfgPtBinHe3PID{"cfgPtBinHe3PID", {2, 2.2, 2.4, 2.6, 2.8, 3, 3.2, 3.6, 4, 4.4, 4.8, 5.2, 5.6, 6, 6.4, 7.2, 8, 10}, "pt bin for pion PIDnsigma"}; - - Configurable> cfgnSigmaTPCProtonPtUpper{"cfgnSigmaTPCProtonPtUpper", {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, "nSigmaTPC cut upper limit anchored to proton pt bins"}; - Configurable> cfgnSigmaTOFProtonPtUpper{"cfgnSigmaTOFProtonPtUpper", {1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5}, "nSigmaTOF cut upper limit anchored to proton pt bins"}; - Configurable> cfgnSigmaITSProtonPtUpper{"cfgnSigmaITSProtonPtUpper", {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, "nSigmaITS cut upper limit anchored to proton pt bins"}; - Configurable> cfgnSigmaRMSProtonPtUpper{"cfgnSigmaRMSProtonPtUpper", {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, "nSigmaRMS cut upper limit anchored to proton pt bins"}; - Configurable> cfgnSigmaTPCProtonPtLower{"cfgnSigmaTPCProtonPtLower", {-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3}, "nSigmaTPC cut lower limit anchored to proton pt bins"}; - Configurable> cfgnSigmaTOFProtonPtLower{"cfgnSigmaTOFProtonPtLower", {-1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5}, "nSigmaTOF cut lower limit anchored to proton pt bins"}; - Configurable> cfgnSigmaITSProtonPtLower{"cfgnSigmaITSProtonPtLower", {-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, "nSigmaITS cut lower limit anchored to proton pt bins"}; - Configurable> cfgnSigmaRMSProtonPtLower{"cfgnSigmaRMSProtonPtLower", {-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3}, "nSigmaRMS cut lower limit anchored to proton pt bins"}; - Configurable> cfgnSigmaTPCHe3PtUpper{"cfgnSigmaTPCHe3PtUpper", {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, "nSigmaTPC cut upper limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaTOFHe3PtUpper{"cfgnSigmaTOFHe3PtUpper", {1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5}, "nSigmaTOF cut upper limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaITSHe3PtUpper{"cfgnSigmaITSHe3PtUpper", {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, "nSigmaITS cut upper limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaRMSHe3PtUpper{"cfgnSigmaRMSHe3PtUpper", {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, "nSigmaRMS cut upper limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaTPCHe3PtLower{"cfgnSigmaTPCHe3PtLower", {-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3}, "nSigmaTPC cut lower limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaTOFHe3PtLower{"cfgnSigmaTOFHe3PtLower", {-1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5, -1.5}, "nSigmaTOF cut lower limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaITSHe3PtLower{"cfgnSigmaITSHe3PtLower", {-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}, "nSigmaITS cut lower limit anchored to He3 pt bins"}; - Configurable> cfgnSigmaRMSHe3PtLower{"cfgnSigmaRMSHe3PtLower", {-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3}, "nSigmaRMS cut lower limit anchored to He3 pt bins"}; - + Configurable cfgUseSelfnSigmaTPCProton{"cfgUseSelfnSigmaTPCProton", false, "Use self nSigma TPC for Proton PID"}; + Configurable cfgProtonPIDMode{"cfgProtonPIDMode", 2, "Proton PID mode: 0 for TPC + RMS(TPC,TOF), 1 for TPC only, 2 for TOF only"}; + Configurable> cfgnSigmaTPC{"cfgnSigmaTPC", {ese_parameters::TPCnSigmaCutDefault[0], 5, 2, ese_parameters::names, ese_parameters::pidTPCnSigmaNames}, "TPC nSigma selection for light nuclei"}; + Configurable> cfgnSigmaITS{"cfgnSigmaITS", {ese_parameters::ITSnSigmaCutDefault[0], 5, 2, ese_parameters::names, ese_parameters::pidITSnSigmaNames}, "ITS nSigma selection for light nuclei"}; + // PID BBself paras config + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {ese_parameters::BetheBlochDefault[0], 5, 6, ese_parameters::names, ese_parameters::betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"}; + Configurable> cfgMomentumScalingBetheBloch{"cfgMomentumScalingBetheBloch", {ese_parameters::BbMomScalingDefault[0], 5, 2, ese_parameters::names, ese_parameters::chargeLabelNames}, "TPC Bethe-Bloch momentum scaling for light nuclei"}; + Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", true, "If true, divide tpcInnerParam by the electric charge"}; + // Axias configs ConfigurableAxis cfgrigidityBins{"cfgrigidityBins", {200, -10.f, 10.f}, "Binning for rigidity #it{p}^{TPC}/#it{z}"}; ConfigurableAxis cfgdedxBins{"cfgdedxBins", {1000, 0.f, 1000.f}, "Binning for dE/dx"}; ConfigurableAxis cfgnSigmaBinsTPC{"cfgnSigmaBinsTPC", {200, -5.f, 5.f}, "Binning for n sigma TPC"}; ConfigurableAxis cfgnSigmaBinsTOF{"cfgnSigmaBinsTOF", {200, -5.f, 5.f}, "Binning for n sigma TOF"}; ConfigurableAxis cfgnSigmaBinsITS{"cfgnSigmaBinsITS", {200, -5.f, 5.f}, "Binning for n sigma ITS"}; - ConfigurableAxis cfgnSigmaBinsRMS{"cfgnSigmaBinsRMS", {100, 0.f, 10.f}, "Combination Binning for TPC&TOF nsigma"}; - ConfigurableAxis cfgaxisptPID{"cfgaxisptPID", {120, 0, 12}, "Binning for P_{t} PID"}; - ConfigurableAxis cfgaxispPID{"cfgaxispPID", {50, 0, 5}, "Binning for P PID"}; + ConfigurableAxis cfgaxispt{"cfgaxispt", {100, 0, 10}, "Binning for P_{t}"}; ConfigurableAxis cfgaxisetaPID{"cfgaxisetaPID", {90, -0.9, 0.9}, "Binning for Pt QA"}; ConfigurableAxis cfgaxisDCAz{"cfgaxisDCAz", {200, -1, 1}, "Binning for DCAz"}; ConfigurableAxis cfgaxisDCAxy{"cfgaxisDCAxy", {100, -0.5, 0.5}, "Binning for DCAxy"}; - ConfigurableAxis cfgaxisChi2Ncls{"cfgaxisChi2Ncls", {100, 0, 100}, "Binning for Chi2Ncls TPC/ITS"}; + ConfigurableAxis cfgaxisChi2Ncls{"cfgaxisChi2Ncls", {100, 0, 30}, "Binning for Chi2Ncls TPC/ITS"}; + ConfigurableAxis cfgaxisQvecF{"cfgaxisQvecF", {300, -1, 1}, ""}; + ConfigurableAxis cfgaxisCent{"cfgaxisCent", {90, 0, 90}, ""}; + ConfigurableAxis cfgaxisNch{"cfgaxisNch", {4000, 0, 4000}, "N_{ch}"}; + ConfigurableAxis cfgaxisT0C{"cfgaxisT0C", {70, 0, 70000}, "N_{ch} (T0C)"}; + ConfigurableAxis cfgaxisT0A{"cfgaxisT0A", {200, 0, 200000}, "N_{ch} (T0A)"}; + ConfigurableAxis cfgaxisNchPV{"cfgaxisNchPV", {4000, 0, 4000}, "N_{ch} (PV)"}; + ConfigurableAxis cfgaxisq2{"cfgaxisq2", {120, 0, 12}, "Binning for P_{t} PID"}; + ConfigurableAxis cfgaxiscos{"cfgaxiscos", {102, -1.02, 1.02}, ""}; - // Function for He3 TPC-ITS mismatching cuts referd to by chiara's slides - TF1* fNSigmaITSPt = nullptr; + uint8_t poiTar; + uint8_t poiRef; + int detId; + int refAId; + int refBId; + int detInd; + int refAInd; + int refBInd; + // Function for He3 purity cut refered from luca's slides + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; - template - bool trackSelBasic(const TrackType track) - { - if ((track.pt() < cfgMinPtPID) || (track.pt() > cfgMaxPtPID)) - return false; - if (std::abs(track.eta()) > cfgMaxEtaPID) - return false; - if (cfgOpenpassedITSNCls) { - if (!track.passedITSNCls()) - return false; - } else { - if (track.itsNCls() < cfgMinITSCls || track.itsNCls() > cfgMaxITSCls) - return false; - } - if (cfgOpenpassedITSChi2NDF) { - if (!track.passedITSChi2NDF()) - return false; - } else { - if (track.itsChi2NCl() < cfgMinChi2NClITS || track.itsChi2NCl() > cfgMaxChi2NClITS) - return false; - } - if (cfgOpenpassedITSHits) { - if (!track.passedITSHits()) - return false; - } - if (cfgOpenpassedTPCChi2NDF) { - if (!track.passedTPCChi2NDF()) - return false; - } else { - if (track.tpcChi2NCl() < cfgMinTPCChi2NCl || track.tpcChi2NCl() > cfgMaxTPCChi2NCl) - return false; - } - if (cfgOpenpassedTPCCrossedRowsOverNCls) { - if (!track.passedTPCCrossedRowsOverNCls()) - return false; - } - if (cfgOpenpassedDCAxy) { - if (!track.passedDCAxy()) - return false; - } else { - if (std::abs(track.dcaXY()) > cfgMaxDCAxy) - return false; - } - if (cfgOpenpassedDCAz) { - if (!track.passedDCAz()) - return false; - } else { - if (std::abs(track.dcaZ()) > cfgMaxDCAz) - return false; - } - if (track.tpcNClsFound() < cfgMinTPCCls || track.tpcNClsFound() > cfgMaxTPCCls) - return false; - return true; - } + Filter collisionFilter = (nabs(aod::collision::posZ) < cfgVtzCut) && (aod::cent::centFT0C > cfgCentMin) && (aod::cent::centFT0C < cfgCentMax); - template - bool pidProtonSel(const TrackType track, float nSigmaLower, float nSigmaUpper) - { // proton == 1 , He3 == 2 - if (track.pt() < cfgPtCutProton.value[0] || track.pt() > cfgPtCutProton.value[1]) - return false; - float nSigmaUse = -999; - switch (cfgProtonPIDMode) { - case 0: // RMS - nSigmaUse = (track.pt() > cfgPtMaxforTPCOnlyPIDPrton) ? std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr()) : track.tpcNSigmaPr(); - break; - case 1: // TPC only - nSigmaUse = track.tpcNSigmaPr(); - break; - case 2: // TOF only - nSigmaUse = track.tofNSigmaPr(); - break; - } - if (nSigmaUse < nSigmaLower || nSigmaUse > nSigmaUpper) { - return false; - } else { - return true; - } - } + Produces eseTable; template - bool pidHe3Sel(const TrackType track, float nSigmaLower, float nSigmaUpper) - { // proton == 1 , He3 == 2 - if (track.pt() < cfgPtCutHe3.value[0] || track.pt() > cfgPtCutHe3.value[1]) - return false; - float nSigmaUse = -999; - switch (cfgHe3PIDMode) { - case 0: // RMS - nSigmaUse = (track.pt() > cfgPtMaxforTPCOnlyPIDHe3) ? std::hypot(track.tpcNSigmaHe(), track.tofNSigmaHe()) : track.tpcNSigmaHe(); - break; - case 1: // TPC only - nSigmaUse = track.tpcNSigmaHe(); - break; - case 2: // TOF only - nSigmaUse = track.tofNSigmaHe(); - break; - } - if (nSigmaUse < nSigmaLower || nSigmaUse > nSigmaUpper) { - return false; - } else { - return true; + float getNSigmaTPCSelfBB(const TrackType track, uint8_t POI) + { + bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; + float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + const int iC{track.sign() < 0}; + switch (POI) { + case ese_parameters::kProton: { + const double bgScaling[2]{ese_parameters::Charges[0] * cfgMomentumScalingBetheBloch->get(0u, 0u) / ese_parameters::Masses[0], ese_parameters::Charges[0] * cfgMomentumScalingBetheBloch->get(0u, 1u) / ese_parameters::Masses[0]}; + double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScaling[iC]), cfgBetheBlochParams->get(0u, 0u), cfgBetheBlochParams->get(0u, 1u), cfgBetheBlochParams->get(0u, 2u), cfgBetheBlochParams->get(0u, 3u), cfgBetheBlochParams->get(0u, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(0u, 5u)}; + double nSigmaTPC{static_cast((track.tpcSignal() - expBethe) / expSigma)}; + return nSigmaTPC; + } + case ese_parameters::kDeuteron: { + const double bgScaling[2]{ese_parameters::Charges[1] * cfgMomentumScalingBetheBloch->get(1u, 0u) / ese_parameters::Masses[1], ese_parameters::Charges[1] * cfgMomentumScalingBetheBloch->get(1u, 1u) / ese_parameters::Masses[1]}; + double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScaling[iC]), cfgBetheBlochParams->get(1u, 0u), cfgBetheBlochParams->get(1u, 1u), cfgBetheBlochParams->get(1u, 2u), cfgBetheBlochParams->get(1u, 3u), cfgBetheBlochParams->get(1u, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(1u, 5u)}; + double nSigmaTPC{static_cast((track.tpcSignal() - expBethe) / expSigma)}; + return nSigmaTPC; + } + case ese_parameters::kTriton: { + const double bgScaling[2]{ese_parameters::Charges[2] * cfgMomentumScalingBetheBloch->get(2u, 0u) / ese_parameters::Masses[2], ese_parameters::Charges[2] * cfgMomentumScalingBetheBloch->get(2u, 1u) / ese_parameters::Masses[2]}; + double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScaling[iC]), cfgBetheBlochParams->get(2u, 0u), cfgBetheBlochParams->get(2u, 1u), cfgBetheBlochParams->get(2u, 2u), cfgBetheBlochParams->get(2u, 3u), cfgBetheBlochParams->get(2u, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(2u, 5u)}; + double nSigmaTPC{static_cast((track.tpcSignal() - expBethe) / expSigma)}; + return nSigmaTPC; + } + case ese_parameters::kHe3: { + const double bgScaling[2]{ese_parameters::Charges[3] * cfgMomentumScalingBetheBloch->get(3u, 0u) / ese_parameters::Masses[3], ese_parameters::Charges[3] * cfgMomentumScalingBetheBloch->get(3u, 1u) / ese_parameters::Masses[3]}; + double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScaling[iC]), cfgBetheBlochParams->get(3u, 0u), cfgBetheBlochParams->get(3u, 1u), cfgBetheBlochParams->get(3u, 2u), cfgBetheBlochParams->get(3u, 3u), cfgBetheBlochParams->get(3u, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(3u, 5u)}; + double nSigmaTPC{static_cast((track.tpcSignal() - expBethe) / expSigma)}; + return nSigmaTPC; + } + case ese_parameters::kAlpha: { + const double bgScaling[2]{ese_parameters::Charges[4] * cfgMomentumScalingBetheBloch->get(4u, 0u) / ese_parameters::Masses[4], ese_parameters::Charges[4] * cfgMomentumScalingBetheBloch->get(4u, 1u) / ese_parameters::Masses[4]}; + double expBethe{tpc::BetheBlochAleph(static_cast(correctedTpcInnerParam * bgScaling[iC]), cfgBetheBlochParams->get(4u, 0u), cfgBetheBlochParams->get(4u, 1u), cfgBetheBlochParams->get(4u, 2u), cfgBetheBlochParams->get(4u, 3u), cfgBetheBlochParams->get(4u, 4u))}; + double expSigma{expBethe * cfgBetheBlochParams->get(4u, 5u)}; + double nSigmaTPC{static_cast((track.tpcSignal() - expBethe) / expSigma)}; + return nSigmaTPC; + } + default: + return -99.f; } } template - int crossTrackID(const TrackType track) + float getNSigmaTOF(const TrackType track, uint8_t POI) { - if (track.tpcNSigmaPr() < track.tpcNSigmaHe()) { - return 0; - } else { - return 1; + switch (POI) { + case ese_parameters::kProton: { + return track.tofNSigmaPr(); + } + case ese_parameters::kDeuteron: { + return track.tofNSigmaDe(); + } + case ese_parameters::kTriton: { + return track.tofNSigmaTr(); + } + case ese_parameters::kHe3: { + return track.tofNSigmaHe(); + } + case ese_parameters::kAlpha: { + return track.tofNSigmaAl(); + } + default: + return -99.f; } } - void init(InitContext const&) + template + float getNSigmaITS(const TrackType track, uint8_t POI) { - if (cfgOpenHe3ITSPtCut) { - fNSigmaITSPt = new TF1("fNSigmaITSPt", "[0]/pow(x,0.5) - [2]", 0.02, 1000); - fNSigmaITSPt->SetParameters(4.6, 0.5, 4.5); - } - AxisSpec axisITSNcls = {10, -1.5, 8.5, "ITSNcls"}; - AxisSpec axisTPCNcls = {160, 0, 160, "TPCNcls"}; - if (!cfgQuietMode) { - histosQA.add("QA/hist_dEdxTPC_All", ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", {HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}}); - histosQA.add("QA/Proton/hist_dEdxTPC_Pr", ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", {HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}}); - histosQA.add("QA/He3/hist_dEdxTPC_He3", ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", {HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}}); - histosQA.add("QA/hist_pt_All", ";#it{p}_{T};counts", {HistType::kTH1F, {cfgaxisptPID}}); - histosQA.add("QA/Proton/hist_pt_Pr", ";#it{p}_{T};counts", {HistType::kTH1F, {cfgaxisptPID}}); - histosQA.add("QA/He3/hist_pt_He3", ";#it{p}_{T};counts", {HistType::kTH1F, {cfgaxisptPID}}); - histosQA.add("QA/hist_eta_All", ";#it{#eta};counts", {HistType::kTH1F, {cfgaxisetaPID}}); - histosQA.add("QA/Proton/hist_eta_Pr", ";#it{#eta};counts", {HistType::kTH1F, {cfgaxisetaPID}}); - histosQA.add("QA/He3/hist_eta_He3", ";#it{#eta};counts", {HistType::kTH1F, {cfgaxisetaPID}}); - histosQA.add("QA/hist_ITSNcls_All", ";ITSNcls;counts", {HistType::kTH1F, {axisITSNcls}}); - histosQA.add("QA/Proton/hist_ITSNcls_Pr", ";ITSNcls;counts", {HistType::kTH1F, {axisITSNcls}}); - histosQA.add("QA/He3/hist_ITSNcls_He3", ";ITSNcls;counts", {HistType::kTH1F, {axisITSNcls}}); - histosQA.add("QA/hist_TPCNcls_All", ";TPCNcls;counts", {HistType::kTH1F, {axisTPCNcls}}); - histosQA.add("QA/Proton/hist_TPCNcls_Pr", ";TPCNcls;counts", {HistType::kTH1F, {axisTPCNcls}}); - histosQA.add("QA/He3/hist_TPCNcls_He3", ";TPCNcls;counts", {HistType::kTH1F, {axisTPCNcls}}); - histosQA.add("QA/hist_ITSChi2NDF_All", ";ITS#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/Proton/hist_ITSChi2NDF_Pr", ";ITS#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/He3/hist_ITSChi2NDF_He3", ";ITS#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/hist_TPCChi2NDF_All", ";TPC#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/Proton/hist_TPCChi2NDF_Pr", ";TPC#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/He3/hist_TPCChi2NDF_He3", ";TPC#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); - histosQA.add("QA/hist_DCAxy_All", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAxy}}); - histosQA.add("QA/Proton/hist_DCAxy_Pr", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAxy}}); - histosQA.add("QA/He3/hist_DCAxy_He3", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAxy}}); - histosQA.add("QA/hist_DCAz_All", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAz}}); - histosQA.add("QA/Proton/hist_DCAz_Pr", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAz}}); - histosQA.add("QA/He3/hist_DCAz_He3", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAz}}); - histosQA.add("QA/Proton/hist_nSigmaTPC_Pr", ";n_{#sigma}TPC", {HistType::kTH1F, {cfgnSigmaBinsTPC}}); - histosQA.add("QA/Proton/hist_nSigmaTPCPt_Pr", ";#it{p}_{T};n_{#sigma}TPC", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsTPC}}); - histosQA.add("QA/Proton/hist_nSigmaTOF_Pr", ";n_{#sigma}TOF", {HistType::kTH1F, {cfgnSigmaBinsTOF}}); - histosQA.add("QA/Proton/hist_nSigmaTOFPt_Pr", ";#it{p}_{T};n_{#sigma}TOF", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsTOF}}); - histosQA.add("QA/Proton/hist_nSigmaITS_Pr", ";n_{#sigma}ITS", {HistType::kTH1F, {cfgnSigmaBinsITS}}); - histosQA.add("QA/Proton/hist_nSigmaITSPt_Pr", ";#it{p}_{T};n_{#sigma}ITS", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsITS}}); - histosQA.add("QA/Proton/hist_nSigmaRMS_Pr", ";n_{#sigma}RMS", {HistType::kTH1F, {cfgnSigmaBinsRMS}}); - histosQA.add("QA/Proton/hist_nSigmaRMSPt_Pr", ";#it{p}_{T};n_{#sigma}RMS", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsRMS}}); - histosQA.add("QA/He3/hist_nSigmaTPC_He3", ";n_{#sigma}TPC", {HistType::kTH1F, {cfgnSigmaBinsTPC}}); - histosQA.add("QA/He3/hist_nSigmaTPCPt_He3", ";#it{p}_{T};n_{#sigma}TPC", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsTPC}}); - histosQA.add("QA/He3/hist_nSigmaTOF_He3", ";n_{#sigma}TOF", {HistType::kTH1F, {cfgnSigmaBinsTOF}}); - histosQA.add("QA/He3/hist_nSigmaTOFPt_He3", ";#it{p}_{T};n_{#sigma}TOF", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsTOF}}); - histosQA.add("QA/He3/hist_nSigmaITS_He3", ";n_{#sigma}ITS", {HistType::kTH1F, {cfgnSigmaBinsITS}}); - histosQA.add("QA/He3/hist_nSigmaITSPt_He3", ";#it{p}_{T};n_{#sigma}ITS", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsITS}}); - histosQA.add("QA/He3/hist_nSigmaRMS_He3", ";n_{#sigma}RMS", {HistType::kTH1F, {cfgnSigmaBinsRMS}}); - histosQA.add("QA/He3/hist_nSigmaRMSPt_He3", ";#it{p}_{T};n_{#sigma}RMS", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsRMS}}); - if (cfgOpenHe3ITSPtCut) { - histosQA.add("QA/He3/hist_nSigmaITSPt_He3_unCuted", ";#it{p}_{T};n_{#sigma}ITS", {HistType::kTH2F, {cfgaxisptPID, cfgnSigmaBinsITS}}); + switch (POI) { + case ese_parameters::kProton: { + return itsResponse.nSigmaITS(track); } - if (cfgOpenPlotnSigmaTOFITSPt) { - histosQA.add("QA/Proton/hist_nSigmaTOFITSPt_Pr", ";n_{#sigma}TOF;n_{#sigma}ITS;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsITS, cfgaxisptPID}}); - histosQA.add("QA/He3/hist_nSigmaTOFITSPt_He3", ";n_{#sigma}TOF;n_{#sigma}ITS;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsITS, cfgaxisptPID}}); + case ese_parameters::kDeuteron: { + return itsResponse.nSigmaITS(track); } - if (cfgOpenPlotnSigmaITSTPCPt) { - histosQA.add("QA/Proton/hist_nSigmaITSTPCPt_Pr", ";n_{#sigma}ITS;n_{#sigma}TPC;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsITS, cfgnSigmaBinsTPC, cfgaxisptPID}}); - histosQA.add("QA/He3/hist_nSigmaITSTPCPt_He3", ";n_{#sigma}ITS;n_{#sigma}TPC;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsITS, cfgnSigmaBinsTPC, cfgaxisptPID}}); + case ese_parameters::kTriton: { + return itsResponse.nSigmaITS(track); } - if (cfgOpenPlotnSigmaTOFTPCPt) { - histosQA.add("QA/Proton/hist_nSigmaTOFTPCPt_Pr", ";n_{#sigma}TOF;n_{#sigma}TPC;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsTPC, cfgaxisptPID}}); - histosQA.add("QA/He3/hist_nSigmaTOFTPCPt_He3", ";n_{#sigma}TOF;n_{#sigma}TPC;#it{p}_{T}", {HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsTPC, cfgaxisptPID}}); + case ese_parameters::kHe3: { + return itsResponse.nSigmaITS(track); } - } - } - Produces pidEsePHe3Table; - void process(TracksPID const& tracks) - { - auto tracksWithITSPid = soa::Attach(tracks); - int8_t pidFlag; - for (const auto& track : tracksWithITSPid) { - histosQA.fill(HIST("QA/hist_dEdxTPC_All"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); - histosQA.fill(HIST("QA/hist_pt_All"), track.pt()); - histosQA.fill(HIST("QA/hist_eta_All"), track.eta()); - histosQA.fill(HIST("QA/hist_ITSNcls_All"), track.itsNCls()); - histosQA.fill(HIST("QA/hist_TPCNcls_All"), track.tpcNClsFound()); - histosQA.fill(HIST("QA/hist_ITSChi2NDF_All"), track.itsChi2NCl()); - histosQA.fill(HIST("QA/hist_TPCChi2NDF_All"), track.tpcChi2NCl()); - histosQA.fill(HIST("QA/hist_DCAxy_All"), track.dcaXY()); - histosQA.fill(HIST("QA/hist_DCAz_All"), track.dcaZ()); - if (!trackSelBasic(track)) { - pidFlag = -1; - } else { - int currentPtBinPr = -1, currentPtBinHe3 = -1; - if (cfgOpenPIDByPtProtonMain || (cfgOpenPIDByPtProtonITS && cfgOpenPIDITSProton)) { - for (int i = 0; i < static_cast(cfgPtBinProtonPID.value.size()) - 1; ++i) { - if (track.pt() >= cfgPtBinProtonPID.value[i] && track.pt() < cfgPtBinProtonPID.value[i + 1]) { - currentPtBinPr = i; - break; - } - } - } - if (cfgOpenPIDByPtHe3Main || (cfgOpenPIDByPtHe3ITS && cfgOpenPIDITSHe3)) { - for (int i = 0; i < static_cast(cfgPtBinHe3PID.value.size()) - 1; ++i) { - if (track.pt() >= cfgPtBinHe3PID.value[i] && track.pt() < cfgPtBinHe3PID.value[i + 1]) { - currentPtBinHe3 = i; - break; - } - } - } - float nSigmaTPCCutPrPtLower = (currentPtBinPr == -1) ? cfgnSigmaCutTPCProton.value[0] : cfgnSigmaTPCProtonPtLower.value[currentPtBinPr]; - float nSigmaTPCCutPrPtUpper = (currentPtBinPr == -1) ? cfgnSigmaCutTPCProton.value[1] : cfgnSigmaTPCProtonPtUpper.value[currentPtBinPr]; - float nSigmaTOFCutPrPtLower = (currentPtBinPr == -1) ? cfgnSigmaCutTOFProton.value[0] : cfgnSigmaTOFProtonPtLower.value[currentPtBinPr]; - float nSigmaTOFCutPrPtUpper = (currentPtBinPr == -1) ? cfgnSigmaCutTOFProton.value[1] : cfgnSigmaTOFProtonPtUpper.value[currentPtBinPr]; - float nSigmaRMSCutPrPtLower = (currentPtBinPr == -1) ? cfgnSigmaCutRMSProton.value[0] : cfgnSigmaRMSProtonPtLower.value[currentPtBinPr]; - float nSigmaRMSCutPrPtUpper = (currentPtBinPr == -1) ? cfgnSigmaCutRMSProton.value[1] : cfgnSigmaRMSProtonPtUpper.value[currentPtBinPr]; - float nSigmaITSCutPrPtLower = (currentPtBinPr == -1) ? cfgnSigmaCutITSProton.value[0] : cfgnSigmaITSProtonPtLower.value[currentPtBinPr]; - float nSigmaITSCutPrPtUpper = (currentPtBinPr == -1) ? cfgnSigmaCutITSProton.value[1] : cfgnSigmaITSProtonPtUpper.value[currentPtBinPr]; - float nSigmaTPCCutHe3PtLower = (currentPtBinHe3 == -1) ? cfgnSigmaCutTPCHe3.value[0] : cfgnSigmaTPCHe3PtLower.value[currentPtBinHe3]; - float nSigmaTPCCutHe3PtUpper = (currentPtBinHe3 == -1) ? cfgnSigmaCutTPCHe3.value[1] : cfgnSigmaTPCHe3PtUpper.value[currentPtBinHe3]; - float nSigmaTOFCutHe3PtLower = (currentPtBinHe3 == -1) ? cfgnSigmaCutTOFHe3.value[0] : cfgnSigmaTOFHe3PtLower.value[currentPtBinHe3]; - float nSigmaTOFCutHe3PtUpper = (currentPtBinHe3 == -1) ? cfgnSigmaCutTOFHe3.value[1] : cfgnSigmaTOFHe3PtUpper.value[currentPtBinHe3]; - float nSigmaRMSCutHe3PtLower = (currentPtBinHe3 == -1) ? cfgnSigmaCutRMSHe3.value[0] : cfgnSigmaRMSHe3PtLower.value[currentPtBinHe3]; - float nSigmaRMSCutHe3PtUpper = (currentPtBinHe3 == -1) ? cfgnSigmaCutRMSHe3.value[1] : cfgnSigmaRMSHe3PtUpper.value[currentPtBinHe3]; - float nSigmaITSCutHe3PtLower = (currentPtBinHe3 == -1) ? cfgnSigmaCutITSHe3.value[0] : cfgnSigmaITSHe3PtLower.value[currentPtBinHe3]; - float nSigmaITSCutHe3PtUpper = (currentPtBinHe3 == -1) ? cfgnSigmaCutITSHe3.value[1] : cfgnSigmaITSHe3PtUpper.value[currentPtBinHe3]; - float nSigmaMainLowerPr = -999, nSigmaMainUpperPr = -999; - float nSigmaMainLowerHe3 = -999, nSigmaMainUpperHe3 = -999; - switch (cfgProtonPIDMode) { - case 0: - nSigmaMainLowerPr = nSigmaRMSCutPrPtLower; - nSigmaMainUpperPr = nSigmaRMSCutPrPtUpper; - break; - case 1: - nSigmaMainLowerPr = nSigmaTPCCutPrPtLower; - nSigmaMainUpperPr = nSigmaTPCCutPrPtUpper; - break; - case 2: - nSigmaMainLowerPr = nSigmaTOFCutPrPtLower; - nSigmaMainUpperPr = nSigmaTOFCutPrPtUpper; - break; - } - switch (cfgHe3PIDMode) { - case 0: - nSigmaMainLowerHe3 = nSigmaRMSCutHe3PtLower; - nSigmaMainUpperHe3 = nSigmaRMSCutHe3PtUpper; - break; - case 1: - nSigmaMainLowerHe3 = nSigmaTPCCutHe3PtLower; - nSigmaMainUpperHe3 = nSigmaTPCCutHe3PtUpper; - break; - case 2: - nSigmaMainLowerHe3 = nSigmaTOFCutHe3PtLower; - nSigmaMainUpperHe3 = nSigmaTOFCutHe3PtUpper; - break; - } - bool kIsPr = false, kIsHe3 = false; - // Identify Proton - if (pidProtonSel(track, nSigmaMainLowerPr, nSigmaMainUpperPr)) { - kIsPr = true; - if (cfgOpenPIDITSProton) { - if (track.itsNSigmaPr() < nSigmaITSCutPrPtLower || track.itsNSigmaPr() > nSigmaITSCutPrPtUpper) { - kIsPr = false; - } - } - } - // Identify He3 - if (pidHe3Sel(track, nSigmaMainLowerHe3, nSigmaMainUpperHe3)) { - kIsHe3 = true; - if (cfgOpenPIDITSHe3) { - if (track.itsNSigmaHe() < nSigmaITSCutHe3PtLower || track.itsNSigmaHe() > nSigmaITSCutHe3PtUpper) { - kIsHe3 = false; - } - } - } - // Cross track rejection - if (!cfgOpenAllowCrossTrack) { - if (kIsPr && kIsHe3) { - switch (crossTrackID(track)) { - case 0: - kIsPr = true; - kIsHe3 = false; - break; - case 1: - kIsPr = false; - kIsHe3 = true; - break; - } - } - } - // Filter He3 contaimination - if (cfgOpenHe3ITSPtCut && kIsHe3) { - if (!cfgQuietMode) { - histosQA.fill(HIST("QA/He3/hist_nSigmaITSPt_He3_unCuted"), track.pt(), track.itsNSigmaHe()); - } - if (track.itsNSigmaHe() < fNSigmaITSPt->Eval(track.pt())) { - kIsHe3 = false; - } - } - pidFlag = (kIsHe3 << 1) | kIsPr; - // Fill QA histograms - if (!cfgQuietMode) { - if (kIsPr) { - histosQA.fill(HIST("QA/Proton/hist_dEdxTPC_Pr"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); - histosQA.fill(HIST("QA/Proton/hist_pt_Pr"), track.pt()); - histosQA.fill(HIST("QA/Proton/hist_eta_Pr"), track.eta()); - histosQA.fill(HIST("QA/Proton/hist_ITSNcls_Pr"), track.itsNCls()); - histosQA.fill(HIST("QA/Proton/hist_TPCNcls_Pr"), track.tpcNClsFound()); - histosQA.fill(HIST("QA/Proton/hist_ITSChi2NDF_Pr"), track.itsChi2NCl()); - histosQA.fill(HIST("QA/Proton/hist_TPCChi2NDF_Pr"), track.tpcChi2NCl()); - histosQA.fill(HIST("QA/Proton/hist_DCAxy_Pr"), track.dcaXY()); - histosQA.fill(HIST("QA/Proton/hist_DCAz_Pr"), track.dcaZ()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaTPC_Pr"), track.tpcNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaTPCPt_Pr"), track.pt(), track.tpcNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaTOF_Pr"), track.tofNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaTOFPt_Pr"), track.pt(), track.tofNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaITS_Pr"), track.itsNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaITSPt_Pr"), track.pt(), track.itsNSigmaPr()); - histosQA.fill(HIST("QA/Proton/hist_nSigmaRMS_Pr"), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())); - histosQA.fill(HIST("QA/Proton/hist_nSigmaRMSPt_Pr"), track.pt(), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())); - if (cfgOpenPlotnSigmaTOFITSPt) { - histosQA.fill(HIST("QA/Proton/hist_nSigmaTOFITSPt_Pr"), track.tofNSigmaPr(), track.itsNSigmaPr(), track.pt()); - } - if (cfgOpenPlotnSigmaITSTPCPt) { - histosQA.fill(HIST("QA/Proton/hist_nSigmaITSTPCPt_Pr"), track.itsNSigmaPr(), track.tpcNSigmaPr(), track.pt()); - } - if (cfgOpenPlotnSigmaTOFTPCPt) { - histosQA.fill(HIST("QA/Proton/hist_nSigmaTOFTPCPt_Pr"), track.tofNSigmaPr(), track.tpcNSigmaPr(), track.pt()); - } - } - if (kIsHe3) { - histosQA.fill(HIST("QA/He3/hist_dEdxTPC_He3"), track.sign() * track.tpcInnerParam(), track.tpcSignal()); - histosQA.fill(HIST("QA/He3/hist_pt_He3"), track.pt()); - histosQA.fill(HIST("QA/He3/hist_eta_He3"), track.eta()); - histosQA.fill(HIST("QA/He3/hist_ITSNcls_He3"), track.itsNCls()); - histosQA.fill(HIST("QA/He3/hist_TPCNcls_He3"), track.tpcNClsFound()); - histosQA.fill(HIST("QA/He3/hist_ITSChi2NDF_He3"), track.itsChi2NCl()); - histosQA.fill(HIST("QA/He3/hist_TPCChi2NDF_He3"), track.tpcChi2NCl()); - histosQA.fill(HIST("QA/He3/hist_DCAxy_He3"), track.dcaXY()); - histosQA.fill(HIST("QA/He3/hist_DCAz_He3"), track.dcaZ()); - histosQA.fill(HIST("QA/He3/hist_nSigmaTPC_He3"), track.tpcNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaTPCPt_He3"), track.pt(), track.tpcNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaTOF_He3"), track.tofNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaTOFPt_He3"), track.pt(), track.tofNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaITS_He3"), track.itsNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaITSPt_He3"), track.pt(), track.itsNSigmaHe()); - histosQA.fill(HIST("QA/He3/hist_nSigmaRMS_He3"), std::hypot(track.tpcNSigmaHe(), track.tofNSigmaHe())); - histosQA.fill(HIST("QA/He3/hist_nSigmaRMSPt_He3"), track.pt(), std::hypot(track.tpcNSigmaHe(), track.tofNSigmaHe())); - if (cfgOpenPlotnSigmaTOFITSPt) { - histosQA.fill(HIST("QA/He3/hist_nSigmaTOFITSPt_He3"), track.tofNSigmaHe(), track.itsNSigmaHe(), track.pt()); - } - if (cfgOpenPlotnSigmaITSTPCPt) { - histosQA.fill(HIST("QA/He3/hist_nSigmaITSTPCPt_He3"), track.itsNSigmaHe(), track.tpcNSigmaHe(), track.pt()); - } - if (cfgOpenPlotnSigmaTOFTPCPt) { - histosQA.fill(HIST("QA/He3/hist_nSigmaTOFTPCPt_He3"), track.tofNSigmaHe(), track.tpcNSigmaHe(), track.pt()); - } - } - } + case ese_parameters::kAlpha: { + return itsResponse.nSigmaITS(track); } - pidEsePHe3Table(pidFlag); + default: + return -99.f; } } -}; - -struct FlowEsePHe3 { - HistogramRegistry histos{"histosmain", {}, OutputObjHandlingPolicy::AnalysisObject}; - - Configurable> cfgnMods{"cfgnMods", {2}, "Modulation of interest"}; - Configurable cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"}; - Configurable cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"}; - Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; - Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "total qvector number"}; - - Configurable cfgVtzCut{"cfgVtzCut", 10.0f, "Accepted z-vertex range"}; - Configurable cfgCentMin{"cfgCentMin", 0.0f, "Centrality min"}; - Configurable cfgCentMax{"cfgCentMax", 100.0f, "Centrality max"}; - - Configurable cfgCutOccupancyLow{"cfgCutOccupancyLow", 0, "Low boundary cut on TPC occupancy"}; - Configurable cfgCutOccupancyHigh{"cfgCutOccupancyHigh", 3000, "High boundary cut on TPC occupancy"}; - Configurable cfgUseAdditionalEventCut{"cfgUseAdditionalEventCut", true, "Use additional event cut beyond sel8"}; - Configurable cfgOpenEvSelkIsGoodZvtxFT0vsPV{"cfgOpenEvSelkIsGoodZvtxFT0vsPV", true, "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"}; - Configurable cfgOpenEvSelkNoSameBunchPileup{"cfgOpenEvSelkNoSameBunchPileup", true, "rejects collisions which are associated with the same found-by-T0 bunch crossing"}; - Configurable cfgOpenEvSelkNoCollInTimeRangeStandard{"cfgOpenEvSelkNoCollInTimeRangeStandard", true, "no collisions in specified time range"}; - Configurable cfgOpenEvSelkIsGoodITSLayersAll{"cfgOpenEvSelkIsGoodITSLayersAll", true, "cut time intervals with dead ITS staves"}; - Configurable cfgOpenEvSelkNoCollInRofStandard{"cfgOpenEvSelkNoCollInRofStandard", true, "no other collisions in this Readout Frame with per-collision multiplicity above threshold"}; - Configurable cfgOpenEvSelkNoHighMultCollInPrevRof{"cfgOpenEvSelkNoHighMultCollInPrevRof", true, "veto an event if FT0C amplitude in previous ITS ROF is above threshold"}; - Configurable cfgOpenEvSelOccupancy{"cfgOpenEvSelOccupancy", true, "Occupancy cut"}; - Configurable cfgOpenEvSelMultCorrelationPVTracks{"cfgOpenEvSelMultCorrelationPVTracks", true, "Multiplicity correlation cut for PVtracks vs centrality(FT0C)"}; - Configurable cfgOpenEvSelMultCorrelationGlobalTracks{"cfgOpenEvSelMultCorrelationGlobalTracks", false, "Multiplicity correlation cut for Globaltracks vs centrality(FT0C)"}; - Configurable cfgOpenEvSelV0AT0ACut{"cfgOpenEvSelV0AT0ACut", true, "V0A T0A 5 sigma cut"}; - Configurable cfgOpenFullEventQA{"cfgOpenFullEventQA", true, "Open full QA plots for event QA"}; - Configurable cfgOpenv2q{"cfgOpenv2q", true, "Open v2(EP)and q calculation for Proton and He3"}; - Configurable cfgOpenESE{"cfgOpenESE", true, "Open ESE process"}; - Configurable cfgOpenESEChargeSeperation{"cfgOpenESEChargeSeperation", true, "Open ESE for postive and negative charge repectivily"}; - Configurable cfgOpenESEProton{"cfgOpenESEProton", true, "Open ESE Proton process"}; - Configurable cfgOpenESEHe3{"cfgOpenESEHe3", true, "Open ESE He3 process"}; - - ConfigurableAxis cfgaxisQvecF{"cfgaxisQvecF", {300, -1, 1}, ""}; - ConfigurableAxis cfgaxisCent{"cfgaxisCent", {90, 0, 90}, ""}; - ConfigurableAxis cfgaxispt{"cfgaxispt", {100, 0, 10}, ""}; - ConfigurableAxis cfgaxisCentForQA{"cfgaxisCentForQA", {100, 0, 100}, "centrality for event QA"}; - ConfigurableAxis cfgaxisNch{"cfgaxisNch", {4000, 0, 4000}, "N_{ch}"}; - ConfigurableAxis cfgaxisT0C{"cfgaxisT0C", {70, 0, 70000}, "N_{ch} (T0C)"}; - ConfigurableAxis cfgaxisT0A{"cfgaxisT0A", {200, 0, 200000}, "N_{ch} (T0A)"}; - ConfigurableAxis cfgaxisNchPV{"cfgaxisNchPV", {4000, 0, 4000}, "N_{ch} (PV)"}; - ConfigurableAxis cfgaxisq2{"cfgaxisq2", {120, 0, 12}, "Binning for P_{t} PID"}; - - EventPlaneHelper helperEP; - SliceCache cache; - - int detId; - int refAId; - int refBId; - // Additional Event selection cuts - Copy from flowGenericFramework.cxx - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; - TF1* fT0AV0AMean = nullptr; - TF1* fT0AV0ASigma = nullptr; - - Filter collisionFilter = (nabs(aod::collision::posZ) < cfgVtzCut) && (aod::cent::centFT0C > cfgCentMin) && (aod::cent::centFT0C < cfgCentMax); - Filter properPIDfilter = aod::flow_ese_p_he3::nPidFlag >= (int8_t)0; // Only POI - - Partition>> protonTrackSet = ((aod::flow_ese_p_he3::nPidFlag == pid_flags::kProton) || (aod::flow_ese_p_he3::nPidFlag == pid_flags::kProtonHe3)); - Partition>> he3TrackSet = ((aod::flow_ese_p_he3::nPidFlag == pid_flags::kHe3) || (aod::flow_ese_p_he3::nPidFlag == pid_flags::kProtonHe3)); template int getDetId(const T& name) @@ -637,160 +446,409 @@ struct FlowEsePHe3 { } } + template + uint8_t getPOI(const T& POI) + { + if (POI.value == "kProton") { + return ese_parameters::kProton; + } else if (POI.value == "kDeuteron") { + return ese_parameters::kDeuteron; + } else if (POI.value == "kTriton") { + return ese_parameters::kTriton; + } else if (POI.value == "kHe3") { + return ese_parameters::kHe3; + } else if (POI.value == "kAlpha") { + return ese_parameters::kAlpha; + } else { + LOGF(warning, "Unknown POI: %s", POI.value.c_str()); + return 0; + } + } + + float calculateq2(const float qx, const float qy, const int multi) + { + if (multi <= 0) { + return 0.f; + } else { + return std::hypot(qx, qy) / std::sqrt(static_cast(multi)); + } + } + template - bool selEvent(const CollType& collision, const int multTrk, const float centrality) + bool eventSelBasic(const CollType& collision, const int64_t multTrk, const float centrality, bool fillQA) { - histos.fill(HIST("QA/histEventCountDetail"), 0.5); - if (cfgOpenEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (!collision.sel8()) + return false; + if (fillQA) { + histsESE.fill(HIST("EventQA/histEventCount"), 0.5); + } + if (cfgOpenEvSel->get(0u) && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } - if (cfgOpenEvSelkIsGoodZvtxFT0vsPV) { - histos.fill(HIST("QA/histEventCountDetail"), 1.5); + if (fillQA && cfgOpenEvSel->get(0u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 1.5); } - if (cfgOpenEvSelkNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (cfgOpenEvSel->get(1u) && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } - if (cfgOpenEvSelkNoSameBunchPileup) { - histos.fill(HIST("QA/histEventCountDetail"), 2.5); + if (fillQA && cfgOpenEvSel->get(1u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 2.5); } - if (cfgOpenEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (cfgOpenEvSel->get(2u) && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } - if (cfgOpenEvSelkNoCollInTimeRangeStandard) { - histos.fill(HIST("QA/histEventCountDetail"), 3.5); + if (fillQA && cfgOpenEvSel->get(2u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 3.5); } - if (cfgOpenEvSelkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (cfgOpenEvSel->get(3u) && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { return false; } - if (cfgOpenEvSelkIsGoodITSLayersAll) { - histos.fill(HIST("QA/histEventCountDetail"), 4.5); + if (fillQA && cfgOpenEvSel->get(3u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 4.5); } - if (cfgOpenEvSelkNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (cfgOpenEvSel->get(4u) && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } - if (cfgOpenEvSelkNoCollInRofStandard) { - histos.fill(HIST("QA/histEventCountDetail"), 5.5); + if (fillQA && cfgOpenEvSel->get(4u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 5.5); } - if (cfgOpenEvSelkNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + if (cfgOpenEvSel->get(5u) && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { return false; } - if (cfgOpenEvSelkNoHighMultCollInPrevRof) { - histos.fill(HIST("QA/histEventCountDetail"), 6.5); + if (fillQA && cfgOpenEvSel->get(5u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 6.5); } auto multNTracksPV = collision.multNTracksPV(); auto occupancy = collision.trackOccupancyInTimeRange(); - if (cfgOpenEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) { + if (cfgOpenEvSel->get(6u) && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) { return false; } - if (cfgOpenEvSelOccupancy) { - histos.fill(HIST("QA/histEventCountDetail"), 7.5); + if (fillQA && cfgOpenEvSel->get(6u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 7.5); } - if (cfgOpenEvSelMultCorrelationPVTracks) { + if (cfgOpenEvSel->get(7u)) { if (multNTracksPV < fMultPVCutLow->Eval(centrality)) return false; if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) return false; } - if (cfgOpenEvSelMultCorrelationPVTracks) { - histos.fill(HIST("QA/histEventCountDetail"), 8.5); + if (fillQA && cfgOpenEvSel->get(7u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 8.5); } - if (cfgOpenEvSelMultCorrelationGlobalTracks) { + if (cfgOpenEvSel->get(8u)) { if (multTrk < fMultCutLow->Eval(centrality)) return false; if (multTrk > fMultCutHigh->Eval(centrality)) return false; } - if (cfgOpenEvSelMultCorrelationGlobalTracks) { - histos.fill(HIST("QA/histEventCountDetail"), 9.5); + if (fillQA && cfgOpenEvSel->get(8u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 9.5); } - if (cfgOpenEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > event_selection::kFT0AV0ASigma * fT0AV0ASigma->Eval(collision.multFT0A()))) { + if (cfgOpenEvSel->get(9u) && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > ese_parameters::kFT0AV0ASigma * fT0AV0ASigma->Eval(collision.multFT0A()))) { return false; } - if (cfgOpenEvSelV0AT0ACut) { - histos.fill(HIST("QA/histEventCountDetail"), 10.5); + if (fillQA && cfgOpenEvSel->get(9u)) { + histsESE.fill(HIST("EventQA/histEventCount"), 10.5); + } + if (fillQA) { + histsESE.fill(HIST("EventQA/histVtz"), collision.posZ()); + histsESE.fill(HIST("EventQA/histCent"), centrality); } return true; } + template + bool trackSelBasic(const TrackType track) + { + if ((track.pt() < cfgMinPtPID) || (track.pt() > cfgMaxPtPID)) + return false; + if (std::abs(track.eta()) > cfgMaxEtaPID) + return false; + if (cfgOpenTrackSel->get(0u)) { + if (!track.passedITSNCls()) + return false; + } else { + if (track.itsNCls() < cfgMinITSCls || track.itsNCls() > cfgMaxITSCls) + return false; + } + if (cfgOpenTrackSel->get(1u)) { + if (!track.passedITSChi2NDF()) + return false; + } else { + if (track.itsChi2NCl() < cfgMinChi2NClITS || track.itsChi2NCl() > cfgMaxChi2NClITS) + return false; + } + if (cfgOpenTrackSel->get(2u)) { + if (!track.passedITSHits()) + return false; + } + if (cfgOpenTrackSel->get(3u)) { + if (!track.passedTPCChi2NDF()) + return false; + } else { + if (track.tpcChi2NCl() < cfgMinTPCChi2NCl || track.tpcChi2NCl() > cfgMaxTPCChi2NCl) + return false; + } + if (cfgOpenTrackSel->get(4u)) { + if (!track.passedTPCCrossedRowsOverNCls()) + return false; + } + if (cfgOpenTrackSel->get(5u)) { + if (!track.passedDCAxy()) + return false; + } else { + if (std::abs(track.dcaXY()) > cfgMaxDCAxy) + return false; + } + if (cfgOpenTrackSel->get(6u)) { + if (!track.passedDCAz()) + return false; + } else { + if (std::abs(track.dcaZ()) > cfgMaxDCAz) + return false; + } + if (track.tpcNClsFound() < cfgMinTPCCls || track.tpcNClsFound() > cfgMaxTPCCls) + return false; + return true; + } + template - void fillHistosQvec(const CollType& collision, int nmode) + void fillEventQAhistBe(const CollType collision, const int multTrk, const float centrality) { - int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); - int refAInd = refAId * 4 + cfgnTotalSystem * 4 * (nmode - 2); - int refBInd = refBId * 4 + cfgnTotalSystem * 4 * (nmode - 2); - if (nmode == fourier_mode::kMode2) { - if (collision.qvecAmp()[detId] > 1e-8) { - histos.fill(HIST("QA/histQvec_CorrL0_V2"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.centFT0C()); - histos.fill(HIST("QA/histQvec_CorrL1_V2"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.centFT0C()); - histos.fill(HIST("QA/histQvec_CorrL2_V2"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.centFT0C()); - histos.fill(HIST("QA/histQvec_CorrL3_V2"), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], collision.centFT0C()); - histos.fill(HIST("QA/histEvtPl_CorrL0_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode), collision.centFT0C()); - histos.fill(HIST("QA/histEvtPl_CorrL1_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], nmode), collision.centFT0C()); - histos.fill(HIST("QA/histEvtPl_CorrL2_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], nmode), collision.centFT0C()); - histos.fill(HIST("QA/histEvtPl_CorrL3_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), collision.centFT0C()); - } - if (collision.qvecAmp()[detId] > 1e-8 && collision.qvecAmp()[refAId] > 1e-8 && collision.qvecAmp()[refBId] > 1e-8) { - histos.fill(HIST("QA/histQvecRes_SigRefAV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), nmode)); - histos.fill(HIST("QA/histQvecRes_SigRefBV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode)); - histos.fill(HIST("QA/histQvecRes_RefARefBV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode)); - } + histsESE.fill(HIST("EventQA/hist_globalTracks_centT0C_before"), centrality, multTrk); + histsESE.fill(HIST("EventQA/hist_PVTracks_centT0C_before"), centrality, collision.multNTracksPV()); + histsESE.fill(HIST("EventQA/hist_globalTracks_PVTracks_before"), collision.multNTracksPV(), multTrk); + histsESE.fill(HIST("EventQA/hist_globalTracks_multT0A_before"), collision.multFT0A(), multTrk); + histsESE.fill(HIST("EventQA/hist_globalTracks_multV0A_before"), collision.multFV0A(), multTrk); + histsESE.fill(HIST("EventQA/hist_multV0A_multT0A_before"), collision.multFT0A(), collision.multFV0A()); + histsESE.fill(HIST("EventQA/hist_multT0C_centT0C_before"), centrality, collision.multFT0C()); + } + + template + void fillEventQAhistAf(const CollType collision, const int multTrk, const float centrality) + { + histsESE.fill(HIST("EventQA/hist_globalTracks_centT0C_after"), centrality, multTrk); + histsESE.fill(HIST("EventQA/hist_PVTracks_centT0C_after"), centrality, collision.multNTracksPV()); + histsESE.fill(HIST("EventQA/hist_globalTracks_PVTracks_after"), collision.multNTracksPV(), multTrk); + histsESE.fill(HIST("EventQA/hist_globalTracks_multT0A_after"), collision.multFT0A(), multTrk); + histsESE.fill(HIST("EventQA/hist_globalTracks_multV0A_after"), collision.multFV0A(), multTrk); + histsESE.fill(HIST("EventQA/hist_multV0A_multT0A_after"), collision.multFT0A(), collision.multFV0A()); + histsESE.fill(HIST("EventQA/hist_multT0C_centT0C_after"), centrality, collision.multFT0C()); + } + + template + void fillTrackQAhist(const TrackType track) + { + bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; + float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + histsESE.fill(HIST("TrackQA/hist_dEdxTPC_All"), track.sign() * correctedTpcInnerParam, track.tpcSignal()); + histsESE.fill(HIST("TrackQA/hist_pt_All"), track.pt()); + histsESE.fill(HIST("TrackQA/hist_eta_All"), track.eta()); + histsESE.fill(HIST("TrackQA/hist_phi_All"), track.phi()); + histsESE.fill(HIST("TrackQA/hist_DCAxy_All"), track.dcaXY()); + histsESE.fill(HIST("TrackQA/hist_DCAz_All"), track.dcaZ()); + histsESE.fill(HIST("TrackQA/hist_ITSNcls_All"), track.itsNCls()); + histsESE.fill(HIST("TrackQA/hist_TPCNcls_All"), track.tpcNClsFound()); + histsESE.fill(HIST("TrackQA/hist_ITSChi2NDF_All"), track.itsChi2NCl()); + histsESE.fill(HIST("TrackQA/hist_TPCChi2NDF_All"), track.tpcChi2NCl()); + } + + template + void fillHistosQvec(const CollType& collision) + { + int detInd = detId * 4 + cfgnTotalSystem * 4 * (2 - 2); + int refAInd = refAId * 4 + cfgnTotalSystem * 4 * (2 - 2); + int refBInd = refBId * 4 + cfgnTotalSystem * 4 * (2 - 2); + if (collision.qvecAmp()[detId] > ese_parameters::Amplitudelow) { + histsESE.fill(HIST("PlanQA/histQvec_CorrL0_V2"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histQvec_CorrL1_V2"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histQvec_CorrL2_V2"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histQvec_CorrL3_V2"), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histEvtPl_CorrL0_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], 2), collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histEvtPl_CorrL1_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], 2), collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histEvtPl_CorrL2_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], 2), collision.centFT0C()); + histsESE.fill(HIST("PlanQA/histEvtPl_CorrL3_V2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], 2), collision.centFT0C()); + } + if (collision.qvecAmp()[detId] > ese_parameters::Amplitudelow && collision.qvecAmp()[refAId] > ese_parameters::Amplitudelow && collision.qvecAmp()[refBId] > ese_parameters::Amplitudelow) { + histsESE.fill(HIST("PlanQA/histQvecRes_SigRefAV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], 2), helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], 2), 2)); + histsESE.fill(HIST("PlanQA/histQvecRes_SigRefBV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], 2), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], 2), 2)); + histsESE.fill(HIST("PlanQA/histQvecRes_RefARefBV2"), collision.centFT0C(), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], 2), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], 2), 2)); } } template - float calculateq2(const TrackType tracks, float psi2, float cent, int pidmode) // pidmode 1 for proton , 2 for he3 + bool pidSel(const TrackType& track, uint8_t POI) { - int multi = tracks.size(); - if (multi > 0) { - float q2x = 0, q2y = 0; - for (const auto& track : tracks) { - q2x += std::cos(2 * track.phi()); - q2y += std::sin(2 * track.phi()); - if (pidmode == pid_flags::kProton) { - if (track.sign() > 0) { - histos.fill(HIST("V2/histCosV2EP_Pr_Pos"), track.pt(), cent, std::cos(2 * (track.phi() - psi2))); - } else { - histos.fill(HIST("V2/histCosV2EP_Pr_Neg"), track.pt(), cent, std::cos(2 * (track.phi() - psi2))); + if (track.pt() < cfgPtPreselection->get(POI, 0u) || track.pt() > cfgPtPreselection->get(POI, 1u)) { + return false; + } + float nSigmaTPC = 0.f; + float nSigmaITS = 0.f; + switch (POI) { + case ese_parameters::kProton: + if (cfgProtonPIDMode == ese_parameters::kRMSMode) { // RMS mode + float nSigmaUse = (track.pt() > cfgPtMaxforTPCOnlyPIDPrton) ? std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr()) : track.tpcNSigmaPr(); + if (nSigmaUse < cfgnSigmaCutRMSProton.value[0] || nSigmaUse > cfgnSigmaCutRMSProton.value[1]) { + return false; } - } - if (pidmode == pid_flags::kHe3) { - if (track.sign() > 0) { - histos.fill(HIST("V2/histCosV2EP_He3_Pos"), track.pt(), cent, std::cos(2 * (track.phi() - psi2))); - } else { - histos.fill(HIST("V2/histCosV2EP_He3_Neg"), track.pt(), cent, std::cos(2 * (track.phi() - psi2))); + } else if (cfgProtonPIDMode == ese_parameters::kTPCMode) { // TPC mode + nSigmaTPC = (cfgUseSelfnSigmaTPCProton ? getNSigmaTPCSelfBB(track, ese_parameters::kProton) : track.tpcNSigmaPr()); + } else if (cfgProtonPIDMode == ese_parameters::kTOFOnlyMode) { // TOF only mode + if (!track.hasTOF()) + return false; + if (track.tofNSigmaPr() < cfgnSigmaCutTOFProton.value[0] || track.tofNSigmaPr() > cfgnSigmaCutTOFProton.value[1]) { + return false; } } - } - return std::hypot(q2x, q2y) / std::sqrt(multi); - } else { - return 0; + nSigmaITS = itsResponse.nSigmaITS(track); + break; + + case ese_parameters::kDeuteron: + nSigmaTPC = getNSigmaTPCSelfBB(track, ese_parameters::kDeuteron); + nSigmaITS = itsResponse.nSigmaITS(track); + break; + + case ese_parameters::kTriton: + nSigmaTPC = getNSigmaTPCSelfBB(track, ese_parameters::kTriton); + nSigmaITS = itsResponse.nSigmaITS(track); + break; + + case ese_parameters::kHe3: + nSigmaTPC = getNSigmaTPCSelfBB(track, ese_parameters::kHe3); + nSigmaITS = itsResponse.nSigmaITS(track); + break; + + case ese_parameters::kAlpha: + nSigmaTPC = getNSigmaTPCSelfBB(track, ese_parameters::kAlpha); + nSigmaITS = itsResponse.nSigmaITS(track); + break; + + default: + LOGF(error, "Unknown POI: %d", POI); + return false; + } + if (nSigmaTPC < cfgnSigmaTPC->get(POI, 0u) || nSigmaTPC > cfgnSigmaTPC->get(POI, 1u)) { + return false; + } + if (nSigmaITS < cfgnSigmaITS->get(POI, 0u) || nSigmaITS > cfgnSigmaITS->get(POI, 1u)) { + return false; } + return true; } - template - void processESE(const TrackType tracks, float psi2, float q2, float cent, int pidmode, bool spcharge) // pidmode 1 for proton , 2 for he3 + template + void fillESECandidates(Tcoll const& collision, Ttrks const& tracks, float& q2Tarx, float& q2Tary, int& multiTar, float& q2Refx, float& q2Refy, int& multiRef) { - for (const auto& track : tracks) { - if (pidmode == pid_flags::kProton) { - if (spcharge) { + float psi2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], 2); + float q2Tarinit{0.f}; + float q2Refinit{0.f}; + for (const auto& track : tracks) { // loop on tracks + if (!trackSelBasic(track)) { + continue; + } + // we fill the track info QA in the main process + fillTrackQAhist(track); + bool kIsTar{false}; + bool kIsRef{false}; + kIsTar = pidSel(track, poiTar); + kIsRef = pidSel(track, poiRef); + if (!cfgOpenAllowCrossTrack && kIsTar && kIsRef) { + if (getNSigmaTPCSelfBB(track, poiTar) < getNSigmaTPCSelfBB(track, poiRef)) { + kIsRef = false; + } else { + kIsTar = false; + } + } + if (kIsTar) { + multiTar++; + q2Tarx += std::cos(2 * track.phi()); + q2Tary += std::sin(2 * track.phi()); + bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; + float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + float nSigmaTPCTar{(poiTar == ese_parameters::kProton && !cfgUseSelfnSigmaTPCProton) ? track.tpcNSigmaPr() : getNSigmaTPCSelfBB(track, poiTar)}; + float nSigmaTOFTar{getNSigmaTOF(track, poiTar)}; + float nSigmaITSTar{getNSigmaITS(track, poiTar)}; + if (cfgOpenPIDQA) { + ese_parameters::hPIDQATar1D[0]->Fill(track.pt()); + ese_parameters::hPIDQATar1D[1]->Fill(track.eta()); + ese_parameters::hPIDQATar1D[2]->Fill(track.phi()); + ese_parameters::hPIDQATar1D[3]->Fill(track.itsNCls()); + ese_parameters::hPIDQATar1D[4]->Fill(track.tpcNClsFound()); + ese_parameters::hPIDQATar1D[5]->Fill(track.itsChi2NCl()); + ese_parameters::hPIDQATar1D[6]->Fill(track.tpcChi2NCl()); + ese_parameters::hPIDQATar1D[7]->Fill(track.dcaXY()); + ese_parameters::hPIDQATar1D[8]->Fill(track.dcaZ()); + ese_parameters::hPIDQATar1D[9]->Fill(nSigmaTPCTar); + ese_parameters::hPIDQATar1D[10]->Fill(nSigmaTOFTar); + ese_parameters::hPIDQATar1D[11]->Fill(nSigmaITSTar); + ese_parameters::hPIDQATar2D[0]->Fill(track.sign() * correctedTpcInnerParam, track.tpcSignal()); + ese_parameters::hPIDQATar2D[1]->Fill(nSigmaTPCTar, track.pt()); + ese_parameters::hPIDQATar2D[2]->Fill(nSigmaTOFTar, track.pt()); + ese_parameters::hPIDQATar2D[3]->Fill(nSigmaITSTar, track.pt()); + if (cfgOpen3DPIDPlots->get(0u)) { + ese_parameters::hPIDQATar3D[0]->Fill(nSigmaTOFTar, nSigmaITSTar, track.pt()); + } + if (cfgOpen3DPIDPlots->get(1u)) { + ese_parameters::hPIDQATar3D[1]->Fill(nSigmaITSTar, nSigmaTPCTar, track.pt()); + } + if (cfgOpen3DPIDPlots->get(2u)) { + ese_parameters::hPIDQATar3D[2]->Fill(nSigmaTOFTar, nSigmaTPCTar, track.pt()); + } + } + if (cfgOpenv2) { if (track.sign() > 0) { - histos.fill(HIST("ESE/hist_v2PosPr_Cent_Pt_q2He3"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); + ese_parameters::hv2Tar[0]->Fill(track.pt(), collision.centFT0C(), std::cos(2 * (track.phi() - psi2))); } else { - histos.fill(HIST("ESE/hist_v2NegPr_Cent_Pt_q2He3"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); + ese_parameters::hv2Tar[1]->Fill(track.pt(), collision.centFT0C(), std::cos(2 * (track.phi() - psi2))); } - } else { - histos.fill(HIST("ESE/hist_v2Pr_Cent_Pt_q2He3"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); } + ese_parameters::eseCandidates.emplace_back(ESECandidate{ + collision.posZ(), collision.centFT0C(), psi2, q2Tarinit, q2Refinit, static_cast(track.sign()), correctedTpcInnerParam, track.tpcSignal(), track.pt(), track.eta(), track.phi(), + track.dcaXY(), track.dcaZ(), static_cast(track.tpcNClsFound()), track.itsNCls(), track.tpcChi2NCl(), track.itsChi2NCl(), + nSigmaTPCTar, nSigmaTOFTar, nSigmaITSTar, track.itsClusterSizes()}); } - if (pidmode == pid_flags::kHe3) { - if (spcharge) { + if (kIsRef) { + multiRef++; + q2Refx += std::cos(2 * track.phi()); + q2Refy += std::sin(2 * track.phi()); + bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; + float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam() / 2 : track.tpcInnerParam(); + float nSigmaTPCRef{(poiRef == ese_parameters::kProton && !cfgUseSelfnSigmaTPCProton) ? track.tpcNSigmaPr() : getNSigmaTPCSelfBB(track, poiRef)}; + float nSigmaTOFRef{getNSigmaTOF(track, poiRef)}; + float nSigmaITSRef{getNSigmaITS(track, poiRef)}; + if (cfgOpenPIDQA) { + ese_parameters::hPIDQARef1D[0]->Fill(track.pt()); + ese_parameters::hPIDQARef1D[1]->Fill(track.eta()); + ese_parameters::hPIDQARef1D[2]->Fill(track.phi()); + ese_parameters::hPIDQARef1D[3]->Fill(track.itsNCls()); + ese_parameters::hPIDQARef1D[4]->Fill(track.tpcNClsFound()); + ese_parameters::hPIDQARef1D[5]->Fill(track.itsChi2NCl()); + ese_parameters::hPIDQARef1D[6]->Fill(track.tpcChi2NCl()); + ese_parameters::hPIDQARef1D[7]->Fill(track.dcaXY()); + ese_parameters::hPIDQARef1D[8]->Fill(track.dcaZ()); + ese_parameters::hPIDQARef1D[9]->Fill(nSigmaTPCRef); + ese_parameters::hPIDQARef1D[10]->Fill(nSigmaTOFRef); + ese_parameters::hPIDQARef1D[11]->Fill(nSigmaITSRef); + ese_parameters::hPIDQARef2D[0]->Fill(track.sign() * correctedTpcInnerParam, track.tpcSignal()); + ese_parameters::hPIDQARef2D[1]->Fill(nSigmaTPCRef, track.pt()); + ese_parameters::hPIDQARef2D[2]->Fill(nSigmaTOFRef, track.pt()); + ese_parameters::hPIDQARef2D[3]->Fill(nSigmaITSRef, track.pt()); + if (cfgOpen3DPIDPlots->get(0u)) { + ese_parameters::hPIDQARef3D[0]->Fill(nSigmaTOFRef, nSigmaITSRef, track.pt()); + } + if (cfgOpen3DPIDPlots->get(1u)) { + ese_parameters::hPIDQARef3D[1]->Fill(nSigmaITSRef, nSigmaTPCRef, track.pt()); + } + if (cfgOpen3DPIDPlots->get(2u)) { + ese_parameters::hPIDQARef3D[2]->Fill(nSigmaTOFRef, nSigmaTPCRef, track.pt()); + } + } + if (cfgOpenv2) { if (track.sign() > 0) { - histos.fill(HIST("ESE/hist_v2PosHe3_Cent_Pt_q2Pr"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); + ese_parameters::hv2Ref[0]->Fill(track.pt(), collision.centFT0C(), std::cos(2 * (track.phi() - psi2))); } else { - histos.fill(HIST("ESE/hist_v2NegHe3_Cent_Pt_q2Pr"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); + ese_parameters::hv2Ref[1]->Fill(track.pt(), collision.centFT0C(), std::cos(2 * (track.phi() - psi2))); } - } else { - histos.fill(HIST("ESE/hist_v2He3_Cent_Pt_q2Pr"), track.pt(), cent, q2, std::cos(2 * (track.phi() - psi2))); } } } @@ -798,6 +856,8 @@ struct FlowEsePHe3 { void init(InitContext const&) { + poiTar = getPOI(cfgTarName); + poiRef = getPOI(cfgRefName); detId = getDetId(cfgDetName); refAId = getDetId(cfgRefAName); refBId = getDetId(cfgRefBName); @@ -807,169 +867,186 @@ struct FlowEsePHe3 { refAId = 4; refBId = 5; } - 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); + detInd = detId * 4 + cfgnTotalSystem * 4 * (2 - 2); + refAInd = refAId * 4 + cfgnTotalSystem * 4 * (2 - 2); + refBInd = refBId * 4 + cfgnTotalSystem * 4 * (2 - 2); - 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); + 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); - 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); - } + AxisSpec axisITSNcls = {10, -1.5, 8.5, "ITSNcls"}; + AxisSpec axisTPCNcls = {160, 0, 160, "TPCNcls"}; AxisSpec axisEvtPl = {100, -1.0 * constants::math::PI, constants::math::PI}; - AxisSpec axisvertexz = {100, -15., 15., "vrtx_{Z} [cm]"}; - histos.add("QA/histEventCount", "", {HistType::kTH1F, {{3, 0.0, 3.0}}}); - histos.get(HIST("QA/histEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); - histos.get(HIST("QA/histEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); - histos.get(HIST("QA/histEventCount"))->GetXaxis()->SetBinLabel(3, "after additional event cut"); - if (cfgUseAdditionalEventCut) { - histos.add("QA/histEventCountDetail", "Number of Event;; Count", {HistType::kTH1F, {{11, 0, 11}}}); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(1, "after sel8"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(2, "kIsGoodZvtxFT0vsPV"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(3, "kNoSameBunchPileup"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(4, "kNoCollInTimeRangeStandard"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(5, "kIsGoodITSLayersAll"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(6, "kNoCollInRofStandard"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(7, "kNoHighMultCollInPrevRof"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(8, "occupancy"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(9, "MultCorrelationPVTracks"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(10, "MultCorrelationGlobalTracks"); - histos.get(HIST("QA/histEventCountDetail"))->GetXaxis()->SetBinLabel(11, "cfgEvSelV0AT0ACut"); - } + AxisSpec axisPhi = {200, -2.1 * constants::math::PI, 2.1 * constants::math::PI}; + AxisSpec axisCentForQA = {100, 0, 100}; + AxisSpec axisCharge = {4, -2, 2, "Charge"}; + // hists for event level QA + histsESE.add("EventQA/histEventCount", ";Event Count;Counts", {HistType::kTH1F, {{100, 0, 100}}}); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(1, "after sel8"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(2, "kIsGoodZvtxFT0vsPV"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(3, "kNoSameBunchPileup"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(4, "kNoCollInTimeRangeStandard"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(5, "kIsGoodITSLayersAll"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(6, "kNoCollInRofStandard"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(7, "kNoHighMultCollInPrevRof"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(8, "occupancy"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(9, "MultCorrelationPVTracks"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(10, "MultCorrelationGlobalTracks"); + histsESE.get(HIST("EventQA/histEventCount"))->GetXaxis()->SetBinLabel(11, "cfgEvSelV0AT0ACut"); + histsESE.add("EventQA/histVtz", ";#it{Vtz} (cm);Counts", {HistType::kTH1F, {{200, -20., +20.}}}); + histsESE.add("EventQA/histCent", ";Centrality (%);Counts", {HistType::kTH1F, {{100, 0., 100.}}}); if (cfgOpenFullEventQA) { - histos.add("QA/hist_globalTracks_centT0C_before", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisNch}}); - histos.add("QA/hist_PVTracks_centT0C_before", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisNchPV}}); - histos.add("QA/hist_globalTracks_PVTracks_before", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {cfgaxisNchPV, cfgaxisNch}}); - histos.add("QA/hist_globalTracks_multT0A_before", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); - histos.add("QA/hist_globalTracks_multV0A_before", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); - histos.add("QA/hist_multV0A_multT0A_before", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {cfgaxisT0A, cfgaxisT0A}}); - histos.add("QA/hist_multT0C_centT0C_before", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisT0C}}); - histos.add("QA/hist_globalTracks_centT0C_after", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisNch}}); - histos.add("QA/hist_PVTracks_centT0C_after", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisNchPV}}); - histos.add("QA/hist_globalTracks_PVTracks_after", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {cfgaxisNchPV, cfgaxisNch}}); - histos.add("QA/hist_globalTracks_multT0A_after", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); - histos.add("QA/hist_globalTracks_multV0A_after", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); - histos.add("QA/hist_multV0A_multT0A_after", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {cfgaxisT0A, cfgaxisT0A}}); - histos.add("QA/hist_multT0C_centT0C_after", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {cfgaxisCentForQA, cfgaxisT0C}}); - } - histos.add("QA/histVertexZRec", ";vrtx_{Z} [cm];counts", {HistType::kTH1F, {axisvertexz}}); - histos.add("QA/histCentrality", ";Centrality;counts", {HistType::kTH1F, {cfgaxisCentForQA}}); - histos.add("QA/histProtonNum", "ProtonNum;counts", {HistType::kTH1F, {{100, 0, 100}}}); - histos.add("QA/histHe3Num", "He3Num;counts", {HistType::kTH1F, {{20, 0, 20}}}); - histos.add("QA/histQvec_CorrL0_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); - histos.add("QA/histQvec_CorrL1_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); - histos.add("QA/histQvec_CorrL2_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); - histos.add("QA/histQvec_CorrL3_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); - histos.add("QA/histEvtPl_CorrL0_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); - histos.add("QA/histEvtPl_CorrL1_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); - histos.add("QA/histEvtPl_CorrL2_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); - histos.add("QA/histEvtPl_CorrL3_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); - histos.add("QA/histQvecRes_SigRefAV2", ";Centrality;Cos(Sig-RefA)", {HistType::kTProfile, {cfgaxisCent}}); - histos.add("QA/histQvecRes_SigRefBV2", ";Centrality;Cos(Sig-RefB)", {HistType::kTProfile, {cfgaxisCent}}); - histos.add("QA/histQvecRes_RefARefBV2", ";Centrality;Cos(RefA-RefB)", {HistType::kTProfile, {cfgaxisCent}}); - if (cfgOpenv2q) { - histos.add("V2/histCosV2EP_Pr_Pos", ";#it{p}_{T};Centrality", {HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}}); - histos.add("V2/histCosV2EP_Pr_Neg", ";#it{p}_{T};Centrality", {HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}}); - histos.add("V2/histCosV2EP_He3_Pos", ";#it{p}_{T};Centrality", {HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}}); - histos.add("V2/histCosV2EP_He3_Neg", ";#it{p}_{T};Centrality", {HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}}); - histos.add("q2/hist_q2_Cen_Pr", ";q_{2} (TPC);Centrality", {HistType::kTH2F, {cfgaxisq2, cfgaxisCent}}); - histos.add("q2/hist_q2_Cen_He3", ";q_{2} (TPC);Centrality", {HistType::kTH2F, {cfgaxisq2, cfgaxisCent}}); - histos.add("q2/hist_q2_Pr", ";q_{2} (TPC);counts", {HistType::kTH1F, {cfgaxisq2}}); - histos.add("q2/hist_q2_He3", ";q_{2} (TPC);counts", {HistType::kTH1F, {cfgaxisq2}}); + histsESE.add("EventQA/hist_globalTracks_centT0C_before", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, cfgaxisNch}}); + histsESE.add("EventQA/hist_PVTracks_centT0C_before", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, cfgaxisNchPV}}); + histsESE.add("EventQA/hist_globalTracks_PVTracks_before", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {cfgaxisNchPV, cfgaxisNch}}); + histsESE.add("EventQA/hist_globalTracks_multT0A_before", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); + histsESE.add("EventQA/hist_globalTracks_multV0A_before", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); + histsESE.add("EventQA/hist_multV0A_multT0A_before", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {cfgaxisT0A, cfgaxisT0A}}); + histsESE.add("EventQA/hist_multT0C_centT0C_before", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, cfgaxisT0C}}); + histsESE.add("EventQA/hist_globalTracks_centT0C_after", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, cfgaxisNch}}); + histsESE.add("EventQA/hist_PVTracks_centT0C_after", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, cfgaxisNchPV}}); + histsESE.add("EventQA/hist_globalTracks_PVTracks_after", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {cfgaxisNchPV, cfgaxisNch}}); + histsESE.add("EventQA/hist_globalTracks_multT0A_after", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); + histsESE.add("EventQA/hist_globalTracks_multV0A_after", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {cfgaxisT0A, cfgaxisNch}}); + histsESE.add("EventQA/hist_multV0A_multT0A_after", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {cfgaxisT0A, cfgaxisT0A}}); + histsESE.add("EventQA/hist_multT0C_centT0C_after", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, cfgaxisT0C}}); } - if (cfgOpenESE) { - if (cfgOpenESEChargeSeperation) { - if (cfgOpenESEProton) { - histos.add("ESE/hist_v2PosPr_Cent_Pt_q2He3", ";#it{p}_{T};q_{2}(He3);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - histos.add("ESE/hist_v2NegPr_Cent_Pt_q2He3", ";#it{p}_{T};q_{2}(He3);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - } - if (cfgOpenESEHe3) { - histos.add("ESE/hist_v2PosHe3_Cent_Pt_q2Pr", ";#it{p}_{T};q_{2}(Proton);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - histos.add("ESE/hist_v2NegHe3_Cent_Pt_q2Pr", ";#it{p}_{T};q_{2}(Proton);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - } - } else { - if (cfgOpenESEProton) { - histos.add("ESE/hist_v2Pr_Cent_Pt_q2He3", ";#it{p}_{T};q_{2}(He3);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - } - if (cfgOpenESEHe3) { - histos.add("ESE/hist_v2He3_Cent_Pt_q2Pr", ";#it{p}_{T};q_{2}(Proton);Centrality", HistType::kTProfile3D, {cfgaxispt, cfgaxisq2, cfgaxisCent}); - } + histsESE.add("PlanQA/histQvec_CorrL0_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); + histsESE.add("PlanQA/histQvec_CorrL1_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); + histsESE.add("PlanQA/histQvec_CorrL2_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); + histsESE.add("PlanQA/histQvec_CorrL3_V2", ";#it{Q_{x}};#it{Q_{y}};Centrality", {HistType::kTH3F, {cfgaxisQvecF, cfgaxisQvecF, cfgaxisCent}}); + histsESE.add("PlanQA/histEvtPl_CorrL0_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); + histsESE.add("PlanQA/histEvtPl_CorrL1_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); + histsESE.add("PlanQA/histEvtPl_CorrL2_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); + histsESE.add("PlanQA/histEvtPl_CorrL3_V2", ";EventPlane angle;Centrality", {HistType::kTH2F, {axisEvtPl, cfgaxisCent}}); + histsESE.add("PlanQA/histQvecRes_SigRefAV2", ";Centrality;Cos(Sig-RefA)", {HistType::kTProfile, {cfgaxisCent}}); + histsESE.add("PlanQA/histQvecRes_SigRefBV2", ";Centrality;Cos(Sig-RefB)", {HistType::kTProfile, {cfgaxisCent}}); + histsESE.add("PlanQA/histQvecRes_RefARefBV2", ";Centrality;Cos(RefA-RefB)", {HistType::kTProfile, {cfgaxisCent}}); + // hists for track level QA + histsESE.add("TrackQA/hist_dEdxTPC_All", ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", {HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}}); + histsESE.add("TrackQA/hist_pt_All", ";#it{p}_{T};counts", {HistType::kTH1F, {cfgaxispt}}); + histsESE.add("TrackQA/hist_eta_All", ";#it{#eta};counts", {HistType::kTH1F, {cfgaxisetaPID}}); + histsESE.add("TrackQA/hist_phi_All", ";#it{#phi};counts", {HistType::kTH1F, {axisPhi}}); + histsESE.add("TrackQA/hist_ITSNcls_All", ";ITSNcls;counts", {HistType::kTH1F, {axisITSNcls}}); + histsESE.add("TrackQA/hist_TPCNcls_All", ";TPCNcls;counts", {HistType::kTH1F, {axisTPCNcls}}); + histsESE.add("TrackQA/hist_ITSChi2NDF_All", ";ITS#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); + histsESE.add("TrackQA/hist_TPCChi2NDF_All", ";TPC#it{#chi^{2}}/NDF;counts", {HistType::kTH1F, {cfgaxisChi2Ncls}}); + histsESE.add("TrackQA/hist_DCAxy_All", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAxy}}); + histsESE.add("TrackQA/hist_DCAz_All", ";#it{DCA_{xy}};counts", {HistType::kTH1F, {cfgaxisDCAz}}); + // v2 and ESEPlots + /// QA plots + if (cfgOpenPIDQA) { + ese_parameters::hPIDQATar2D[0] = histsESE.add(Form("ESE/TrackQA/hist_dEdxTPC_%s", cfgTarName.value.c_str()), ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}); + ese_parameters::hPIDQATar1D[0] = histsESE.add(Form("ESE/TrackQA/hist_pt_%s", cfgTarName.value.c_str()), ";#it{p}_{T};counts", HistType::kTH1F, {cfgaxispt}); + ese_parameters::hPIDQATar1D[1] = histsESE.add(Form("ESE/TrackQA/hist_eta_%s", cfgTarName.value.c_str()), ";#it{#eta};counts", HistType::kTH1F, {cfgaxisetaPID}); + ese_parameters::hPIDQATar1D[2] = histsESE.add(Form("ESE/TrackQA/hist_phi_%s", cfgTarName.value.c_str()), ";#it{#phi};counts", HistType::kTH1F, {axisPhi}); + ese_parameters::hPIDQATar1D[3] = histsESE.add(Form("ESE/TrackQA/hist_ITSNcls_%s", cfgTarName.value.c_str()), ";ITSNcls;counts", HistType::kTH1F, {axisITSNcls}); + ese_parameters::hPIDQATar1D[4] = histsESE.add(Form("ESE/TrackQA/hist_TPCNcls_%s", cfgTarName.value.c_str()), ";TPCNcls;counts", HistType::kTH1F, {axisTPCNcls}); + ese_parameters::hPIDQATar1D[5] = histsESE.add(Form("ESE/TrackQA/hist_ITSChi2NDF_%s", cfgTarName.value.c_str()), ";ITS#it{#chi^{2}}/NDF;counts", HistType::kTH1F, {cfgaxisChi2Ncls}); + ese_parameters::hPIDQATar1D[6] = histsESE.add(Form("ESE/TrackQA/hist_TPCChi2NDF_%s", cfgTarName.value.c_str()), ";TPC#it{#chi^{2}}/NDF;counts", HistType::kTH1F, {cfgaxisChi2Ncls}); + ese_parameters::hPIDQATar1D[7] = histsESE.add(Form("ESE/TrackQA/hist_DCAxy_%s", cfgTarName.value.c_str()), ";#it{DCA_{xy}};counts", HistType::kTH1F, {cfgaxisDCAxy}); + ese_parameters::hPIDQATar1D[8] = histsESE.add(Form("ESE/TrackQA/hist_DCAz_%s", cfgTarName.value.c_str()), ";#it{DCA_{xy}};counts", HistType::kTH1F, {cfgaxisDCAz}); + ese_parameters::hPIDQATar1D[9] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTPC_%s", cfgTarName.value.c_str()), ";n#sigmaTPC;counts", HistType::kTH1F, {cfgnSigmaBinsTPC}); + ese_parameters::hPIDQATar2D[1] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTPC_pt_%s", cfgTarName.value.c_str()), ";#it{p}_{T};n#sigmaTPC", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsTPC}); + ese_parameters::hPIDQATar1D[10] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOF_%s", cfgTarName.value.c_str()), ";n#sigmaTOF;counts", HistType::kTH1F, {cfgnSigmaBinsTOF}); + ese_parameters::hPIDQATar2D[2] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOF_pt_%s", cfgTarName.value.c_str()), ";#it{p}_{T};n#sigmaTOF", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsTOF}); + ese_parameters::hPIDQATar1D[11] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITS_%s", cfgTarName.value.c_str()), ";n#sigmaITS;counts", HistType::kTH1F, {cfgnSigmaBinsITS}); + ese_parameters::hPIDQATar2D[3] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITS_pt_%s", cfgTarName.value.c_str()), ";#it{p}_{T};n#sigmaITS", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsITS}); + ese_parameters::hPIDQARef2D[0] = histsESE.add(Form("ESE/TrackQA/hist_dEdxTPC_%s", cfgRefName.value.c_str()), ";#it{p}^{TPC}/#it{z} (GeV/c);d#it{E}/d#it{x}", HistType::kTH2F, {cfgrigidityBins, cfgdedxBins}); + ese_parameters::hPIDQARef1D[0] = histsESE.add(Form("ESE/TrackQA/hist_pt_%s", cfgRefName.value.c_str()), ";#it{p}_{T};counts", HistType::kTH1F, {cfgaxispt}); + ese_parameters::hPIDQARef1D[1] = histsESE.add(Form("ESE/TrackQA/hist_eta_%s", cfgRefName.value.c_str()), ";#it{#eta};counts", HistType::kTH1F, {cfgaxisetaPID}); + ese_parameters::hPIDQARef1D[2] = histsESE.add(Form("ESE/TrackQA/hist_phi_%s", cfgRefName.value.c_str()), ";#it{#phi};counts", HistType::kTH1F, {axisPhi}); + ese_parameters::hPIDQARef1D[3] = histsESE.add(Form("ESE/TrackQA/hist_ITSNcls_%s", cfgRefName.value.c_str()), ";ITSNcls;counts", HistType::kTH1F, {axisITSNcls}); + ese_parameters::hPIDQARef1D[4] = histsESE.add(Form("ESE/TrackQA/hist_TPCNcls_%s", cfgRefName.value.c_str()), ";TPCNcls;counts", HistType::kTH1F, {axisTPCNcls}); + ese_parameters::hPIDQARef1D[5] = histsESE.add(Form("ESE/TrackQA/hist_ITSChi2NDF_%s", cfgRefName.value.c_str()), ";ITS#it{#chi^{2}}/NDF;counts", HistType::kTH1F, {cfgaxisChi2Ncls}); + ese_parameters::hPIDQARef1D[6] = histsESE.add(Form("ESE/TrackQA/hist_TPCChi2NDF_%s", cfgRefName.value.c_str()), ";TPC#it{#chi^{2}}/NDF;counts", HistType::kTH1F, {cfgaxisChi2Ncls}); + ese_parameters::hPIDQARef1D[7] = histsESE.add(Form("ESE/TrackQA/hist_DCAxy_%s", cfgRefName.value.c_str()), ";#it{DCA_{xy}};counts", HistType::kTH1F, {cfgaxisDCAxy}); + ese_parameters::hPIDQARef1D[8] = histsESE.add(Form("ESE/TrackQA/hist_DCAz_%s", cfgRefName.value.c_str()), ";#it{DCA_{xy}};counts", HistType::kTH1F, {cfgaxisDCAz}); + ese_parameters::hPIDQARef1D[9] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTPC_%s", cfgRefName.value.c_str()), ";n#sigmaTPC;counts", HistType::kTH1F, {cfgnSigmaBinsTPC}); + ese_parameters::hPIDQARef2D[1] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTPC_pt_%s", cfgRefName.value.c_str()), ";#it{p}_{T};n#sigmaTPC", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsTPC}); + ese_parameters::hPIDQARef1D[10] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOF_%s", cfgRefName.value.c_str()), ";n#sigmaTOF;counts", HistType::kTH1F, {cfgnSigmaBinsTOF}); + ese_parameters::hPIDQARef2D[2] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOF_pt_%s", cfgRefName.value.c_str()), ";#it{p}_{T};n#sigmaTOF", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsTOF}); + ese_parameters::hPIDQARef1D[11] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITS_%s", cfgRefName.value.c_str()), ";n#sigmaITS;counts", HistType::kTH1F, {cfgnSigmaBinsITS}); + ese_parameters::hPIDQARef2D[3] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITS_pt_%s", cfgRefName.value.c_str()), ";#it{p}_{T};n#sigmaITS", HistType::kTH2F, {cfgaxispt, cfgnSigmaBinsITS}); + if (cfgOpen3DPIDPlots->get(0u)) { + ese_parameters::hPIDQATar3D[0] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOFITSPt_%s", cfgTarName.value.c_str()), ";n_{#sigma}TOF;n_{#sigma}ITS;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsITS, cfgaxispt}); + ese_parameters::hPIDQARef3D[0] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOFITSPt_%s", cfgRefName.value.c_str()), ";n_{#sigma}TOF;n_{#sigma}ITS;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsITS, cfgaxispt}); } + if (cfgOpen3DPIDPlots->get(1u)) { + ese_parameters::hPIDQATar3D[1] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITSTPCPt_%s", cfgTarName.value.c_str()), ";n_{#sigma}ITS;n_{#sigma}TPC;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsITS, cfgnSigmaBinsTPC, cfgaxispt}); + ese_parameters::hPIDQARef3D[1] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaITSTPCPt_%s", cfgRefName.value.c_str()), ";n_{#sigma}ITS;n_{#sigma}TPC;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsITS, cfgnSigmaBinsTPC, cfgaxispt}); + } + if (cfgOpen3DPIDPlots->get(2u)) { + ese_parameters::hPIDQATar3D[2] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOFTPCPt_%s", cfgTarName.value.c_str()), ";n_{#sigma}TOF;n_{#sigma}TPC;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsTPC, cfgaxispt}); + ese_parameters::hPIDQARef3D[2] = histsESE.add(Form("ESE/TrackQA/hist_nSigmaTOFTPCPt_%s", cfgRefName.value.c_str()), ";n_{#sigma}TOF;n_{#sigma}TPC;#it{p}_{T}", HistType::kTH3F, {cfgnSigmaBinsTOF, cfgnSigmaBinsTPC, cfgaxispt}); + } + } + // v2 plots + if (cfgOpenv2) { + ese_parameters::hv2Tar[0] = histsESE.add(Form("ESE/V2/hist_%sPosV2", cfgTarName.value.c_str()), ";#it{p}_{T};Centrality (%)", HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}); + ese_parameters::hv2Tar[1] = histsESE.add(Form("ESE/V2/hist_%sNegV2", cfgTarName.value.c_str()), ";#it{p}_{T};Centrality (%)", HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}); + ese_parameters::hv2Ref[0] = histsESE.add(Form("ESE/V2/hist_%sPosV2", cfgRefName.value.c_str()), ";#it{p}_{T};Centrality (%)", HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}); + ese_parameters::hv2Ref[1] = histsESE.add(Form("ESE/V2/hist_%sNegV2", cfgRefName.value.c_str()), ";#it{p}_{T};Centrality (%)", HistType::kTProfile2D, {cfgaxispt, cfgaxisCent}); + } + // ESE plots + if (cfgOpenESEQA) { + ese_parameters::hESEQATar1D[0] = histsESE.add(Form("ESE/ESEQA/hist_%sNum", cfgTarName.value.c_str()), ";Num_{Proton}/Event;counts", HistType::kTH1F, {{100, 0, 100}}); + ese_parameters::hESEQATar1D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2", cfgTarName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2}); + ese_parameters::hESEQATar2D = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgTarName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2, cfgaxisCent}); + ese_parameters::hESEQARef1D[0] = histsESE.add(Form("ESE/ESEQA/hist_%sNum", cfgRefName.value.c_str()), ";Num_{He3}/Event;counts", HistType::kTH1F, {{10, 0, 10}}); + ese_parameters::hESEQARef1D[1] = histsESE.add(Form("ESE/ESEQA/hist_%sq2", cfgRefName.value.c_str()), ";#it{q}_{2};counts", HistType::kTH1F, {cfgaxisq2}); + ese_parameters::hESEQARef2D = histsESE.add(Form("ESE/ESEQA/hist_%sq2_Cent", cfgRefName.value.c_str()), ";#it{q}_{2};Centrality (%)", HistType::kTH2F, {cfgaxisq2, cfgaxisCent}); + } + if (cfgOpenESE) { + ese_parameters::hESETar = histsESE.add(Form("ESE/ESE/histESE_%s", cfgTarName.value.c_str()), ";#it{p}_{T};Centrality (%);#it{q}_{2};cos(#phi-#Psi_{2});Charge", HistType::kTHnSparseF, {cfgaxispt, cfgaxisCent, cfgaxisq2, cfgaxiscos, axisCharge}); } } - void process(soa::Filtered>::iterator const& collision, soa::Filtered> const& tracks) + void process(soa::Filtered>::iterator const& collision, TracksPIDFull const& tracks) { - const auto cent = collision.centFT0C(); - histos.fill(HIST("QA/histEventCount"), 0.5); - if (!collision.sel8()) - return; - if (tracks.size() < 1) - return; - histos.fill(HIST("QA/histEventCount"), 1.5); - if (cfgOpenFullEventQA) { - histos.fill(HIST("QA/hist_globalTracks_centT0C_before"), cent, tracks.size()); - histos.fill(HIST("QA/hist_PVTracks_centT0C_before"), cent, collision.multNTracksPV()); - histos.fill(HIST("QA/hist_globalTracks_PVTracks_before"), collision.multNTracksPV(), tracks.size()); - histos.fill(HIST("QA/hist_globalTracks_multT0A_before"), collision.multFT0A(), tracks.size()); - histos.fill(HIST("QA/hist_globalTracks_multV0A_before"), collision.multFV0A(), tracks.size()); - histos.fill(HIST("QA/hist_multV0A_multT0A_before"), collision.multFT0A(), collision.multFV0A()); - histos.fill(HIST("QA/hist_multT0C_centT0C_before"), cent, collision.multFT0C()); - } - if (cfgUseAdditionalEventCut && !selEvent(collision, tracks.size(), cent)) { + ese_parameters::eseCandidates.clear(); + const float centrality{collision.centFT0C()}; + const int64_t multTrk{tracks.size()}; + if (cfgOpenFullEventQA) + fillEventQAhistBe(collision, multTrk, centrality); + if (!eventSelBasic(collision, multTrk, centrality, true)) return; + if (cfgOpenFullEventQA) + fillEventQAhistAf(collision, multTrk, centrality); + float q2Tarx{0.}; + float q2Tary{0.}; + float q2Refx{0.}; + float q2Refy{0.}; + int multiTar{0}; + int multiRef{0}; + fillESECandidates(collision, tracks, q2Tarx, q2Tary, multiTar, q2Refx, q2Refy, multiRef); + float q2Tar{calculateq2(q2Tarx, q2Tary, multiTar)}; + float q2Ref{calculateq2(q2Refx, q2Refy, multiRef)}; + if (cfgOpenESEQA) { + ese_parameters::hESEQATar1D[0]->Fill(multiTar); + ese_parameters::hESEQATar1D[1]->Fill(q2Tar); + ese_parameters::hESEQATar2D->Fill(q2Tar, centrality); + ese_parameters::hESEQARef1D[0]->Fill(multiRef); + ese_parameters::hESEQARef1D[1]->Fill(q2Ref); + ese_parameters::hESEQARef2D->Fill(q2Ref, centrality); } - histos.fill(HIST("QA/histEventCount"), 2.5); - histos.fill(HIST("QA/histCentrality"), cent); - histos.fill(HIST("QA/histVertexZRec"), collision.posZ()); - if (cfgOpenFullEventQA) { - histos.fill(HIST("QA/hist_globalTracks_centT0C_after"), cent, tracks.size()); - histos.fill(HIST("QA/hist_PVTracks_centT0C_after"), cent, collision.multNTracksPV()); - histos.fill(HIST("QA/hist_globalTracks_PVTracks_after"), collision.multNTracksPV(), tracks.size()); - histos.fill(HIST("QA/hist_globalTracks_multT0A_after"), collision.multFT0A(), tracks.size()); - histos.fill(HIST("QA/hist_globalTracks_multV0A_after"), collision.multFV0A(), tracks.size()); - histos.fill(HIST("QA/hist_multV0A_multT0A_after"), collision.multFT0A(), collision.multFV0A()); - histos.fill(HIST("QA/hist_multT0C_centT0C_after"), cent, collision.multFT0C()); - } - auto tracksPr = protonTrackSet->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto tracksHe3 = he3TrackSet->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - int multiPr = tracksPr.size(); - int multiHe3 = tracksHe3.size(); - // LOGF(info, Form("Collison ID + 1; Proton Num:%d; He3 Num:%d;\n", multiPr, multiHe3)); - histos.fill(HIST("QA/histProtonNum"), multiPr); - histos.fill(HIST("QA/histHe3Num"), multiHe3); - if (multiPr < 1 && multiHe3 < 1) - return; // Reject Collisions without enough POI - for (auto i = 0; i < static_cast(cfgnMods->size()); i++) { - int detIndGlobal = detId * 4 + cfgnTotalSystem * 4 * (cfgnMods->at(i) - 2); - float psiNGlobal = helperEP.GetEventPlane(collision.qvecRe()[detIndGlobal + 3], collision.qvecIm()[detIndGlobal + 3], cfgnMods->at(i)); - if (cfgnMods->at(i) == fourier_mode::kMode2) { - // LOGF(info, "Process q2\n"); - float q2Proton = calculateq2(tracksPr, psiNGlobal, cent, 1); - float q2He3 = calculateq2(tracksHe3, psiNGlobal, cent, 2); - histos.fill(HIST("q2/hist_q2_Pr"), q2Proton); - histos.fill(HIST("q2/hist_q2_He3"), q2He3); - histos.fill(HIST("q2/hist_q2_Cen_Pr"), q2Proton, cent); - histos.fill(HIST("q2/hist_q2_Cen_He3"), q2He3, cent); - if (cfgOpenESE && multiPr > 0 && multiHe3 > 0) { - // LOGF(info, "Process ESE\n"); - if (cfgOpenESEProton) { - processESE(tracksPr, psiNGlobal, q2Proton, cent, 1, cfgOpenESEChargeSeperation); - } - if (cfgOpenESEHe3) { - processESE(tracksHe3, psiNGlobal, q2He3, cent, 2, cfgOpenESEChargeSeperation); - } - } - // LOGF(info, "Process for this event over\n"); + if (multiTar == 0) + return; + for (const auto& c : ese_parameters::eseCandidates) { + eseTable(c.vtz, c.centFT0C, c.psi2FT0C, q2Tar, q2Ref, c.signTar, c.tpcInnerParamTar, c.tpcSignalTar, c.ptTar, c.etaTar, c.phiTar, c.dcaXYTar, c.dcaZTar, c.tpcNclsTar, c.itsNclsTar, c.tpcChi2NDFTar, c.itsChi2NDFTar, c.tpcNSigmaTar, c.tofNSigmaTar, c.itsNSigmaTar, c.itsClusSizeTar); + if (cfgOpenESE) { + ese_parameters::hESETar->Fill(c.ptTar, c.centFT0C, q2Ref, std::cos(2 * (c.phiTar - c.psi2FT0C)), c.signTar); } - fillHistosQvec(collision, cfgnMods->at(i)); } } }; @@ -977,7 +1054,6 @@ struct FlowEsePHe3 { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), }; } From 3174ec6a33b274c00def9231243c286d689c5846 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Tue, 10 Jun 2025 15:00:25 +0200 Subject: [PATCH 017/116] [PWGLF] Add new process function to run over strangeness dervide data (#11531) --- .../Tasks/Strangeness/taskLambdaSpinCorr.cxx | 363 ++++++++++++++++++ 1 file changed, 363 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 0472e380aed..00a2d9707f5 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -50,6 +50,9 @@ using namespace o2::framework::expressions; using std::array; using namespace o2::aod::rctsel; +using dauTracks = soa::Join; +using v0Candidates = soa::Join; + struct LfTaskLambdaSpinCorr { Service ccdb; @@ -375,6 +378,32 @@ struct LfTaskLambdaSpinCorr { return {lambdaTag, aLambdaTag, true}; // Valid candidate } + std::tuple getLambdaTagsDD(const auto& v0, const auto& collision) + { + auto postrack = v0.template posTrackExtra_as(); + auto negtrack = v0.template negTrackExtra_as(); + + int lambdaTag = 0; + int aLambdaTag = 0; + + if (isSelectedV0Daughter(v0, postrack, 0) && isSelectedV0Daughter(v0, negtrack, 1)) { + lambdaTag = 1; + } + if (isSelectedV0Daughter(v0, negtrack, 0) && isSelectedV0Daughter(v0, postrack, 1)) { + aLambdaTag = 1; + } + + if (!lambdaTag && !aLambdaTag) { + return {0, 0, false}; // No valid tags + } + + if (!selectionV0(collision, v0)) { + return {0, 0, false}; // Fails selection + } + + return {lambdaTag, aLambdaTag, true}; // Valid candidate + } + std::tuple getLambdaTagsMC(const auto& v0, const auto& collision) { auto postrack = v0.template posTrack_as(); @@ -766,6 +795,340 @@ struct LfTaskLambdaSpinCorr { } PROCESS_SWITCH(LfTaskLambdaSpinCorr, processME, "Process data ME", true); + void processDerivedData(soa::Join::iterator const& collision, v0Candidates const& V0s, dauTracks const&) + { + histos.fill(HIST("hEvtSelInfo"), 0.5); + if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 1.5); + if (!collision.sel8()) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 2.5); + auto centrality = collision.centFT0C(); + int occupancy = collision.trackOccupancyInTimeRange(); + if (additionalEvSel && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 3.5); + if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 4.5); + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 5.5); + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 6.5); + if (occupancy > cfgCutOccupancy) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 7.5); + histos.fill(HIST("hCentrality"), centrality); + + for (const auto& v0 : V0s) { + auto [lambdaTag, aLambdaTag, isValid] = getLambdaTagsDD(v0, collision); + if (!isValid) { + continue; + } + + if (lambdaTag && aLambdaTag) { + continue; + } + + if (lambdaTag) { + proton = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassProton); + antiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassPionCharged); + lambda = proton + antiPion; + } + if (aLambdaTag) { + antiProton = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassProton); + pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda = antiProton + pion; + } + + if (lambdaTag && (lambda.M() < lbinIM || lambda.M() > hbinIM)) { + continue; + } + if (aLambdaTag && (antiLambda.M() < lbinIM || antiLambda.M() > hbinIM)) { + 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()) { + continue; + } + auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTagsDD(v02, collision); + if (!isValid2) { + continue; + } + if (lambdaTag2 && aLambdaTag2) { + continue; + } + if (lambdaTag2) { + proton2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), o2::constants::physics::MassProton); + antiPion2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), o2::constants::physics::MassPionCharged); + lambda2 = proton2 + antiPion2; + } + if (aLambdaTag2) { + antiProton2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), o2::constants::physics::MassProton); + pion2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda2 = antiProton2 + pion2; + } + + if (lambdaTag2 && (lambda2.M() < lbinIM || lambda2.M() > hbinIM)) { + continue; + } + if (aLambdaTag2 && (antiLambda2.M() < lbinIM || antiLambda2.M() > hbinIM)) { + continue; + } + + // auto postrack2 = v02.template posTrackExtra_as(); + // auto negtrack2 = v02.template negTrackExtra_as(); + if (v0.posTrackExtraId() == v02.posTrackExtraId() || v0.negTrackExtraId() == v02.negTrackExtraId()) { + continue; + } + + if (lambdaTag && lambdaTag2) { + fillHistograms(1, 0, 1, 0, lambda, lambda2, proton, proton2, centrality, 0); + } + if (aLambdaTag && aLambdaTag2) { + fillHistograms(0, 1, 0, 1, antiLambda, antiLambda2, antiProton, antiProton2, centrality, 0); + } + if (lambdaTag && aLambdaTag2) { + fillHistograms(1, 0, 0, 1, lambda, antiLambda2, proton, antiProton2, centrality, 0); + } + if (aLambdaTag && lambdaTag2) { + fillHistograms(0, 1, 1, 0, antiLambda, lambda2, antiProton, proton2, centrality, 0); + } + } + } + } + PROCESS_SWITCH(LfTaskLambdaSpinCorr, processDerivedData, "Process derived data", true); + + Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only + void processDerivedDataMixed(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) + + { + + for (auto& [collision1, collision2] : selfCombinations(colBinning, nMix, -1, collisions, collisions)) { + // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index()); + if (rctCut.requireRCTFlagChecker && !rctChecker(collision1)) { + continue; + } + if (rctCut.requireRCTFlagChecker && !rctChecker(collision2)) { + continue; + } + int occupancy1 = collision1.trackOccupancyInTimeRange(); + int occupancy2 = collision2.trackOccupancyInTimeRange(); + + if (collision1.index() == collision2.index()) { + continue; + } + if (!collision1.sel8() || !collision2.sel8()) { + continue; + } + if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (occupancy1 > cfgCutOccupancy) { + continue; + } + if (additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (occupancy2 > cfgCutOccupancy) { + continue; + } + if (additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + continue; + } + if (mixingEvSel && additionalEvSel5 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + + if (additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + continue; + } + if (mixingEvSel && additionalEvSel5 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + auto centrality = collision1.centFT0C(); + auto groupV01 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); + auto groupV02 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); + auto groupV03 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.globalIndex()); + + size_t rows = groupV03.size() + 20; + size_t cols = groupV01.size() + 20; + std::vector> pairStatus(rows, std::vector(cols, false)); + histos.fill(HIST("hv0Mult"), groupV01.size()); + for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02))) { + bool pairfound = false; + if (t2.index() <= t1.index()) { + continue; + } + if (t1.straCollisionId() != t2.straCollisionId()) { + continue; + } + + auto [lambdaTag1, aLambdaTag1, isValid1] = getLambdaTagsDD(t1, collision1); + auto [lambdaTag2, aLambdaTag2, isValid2] = getLambdaTagsDD(t2, collision1); + if (!isValid1) { + continue; + } + if (!isValid2) { + continue; + } + if (lambdaTag1 && aLambdaTag1) { + continue; + } + if (lambdaTag2 && aLambdaTag2) { + 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 (t1.posTrackExtraId() == t2.posTrackExtraId() || t1.negTrackExtraId() == t2.negTrackExtraId()) { + continue; + } + // auto samePairSumPt = t1.pt() + t2.pt(); + // auto samePairR = TMath::Sqrt(TMath::Power(t1.phi() - t2.phi(), 2.0) + TMath::Power(t1.eta() - t2.eta(), 2.0)); + + double deltaPhiSame = RecoDecay::constrainAngle(t1.phi() - t2.phi(), 0.0); + auto samePairR = TMath::Sqrt(TMath::Power(deltaPhiSame, 2.0) + TMath::Power(t1.eta() - t2.eta(), 2.0)); + + if (lambdaTag1) { + proton0 = ROOT::Math::PxPyPzMVector(t1.pxpos(), t1.pypos(), t1.pzpos(), o2::constants::physics::MassProton); + antiPion0 = ROOT::Math::PxPyPzMVector(t1.pxneg(), t1.pyneg(), t1.pzneg(), o2::constants::physics::MassPionCharged); + lambda0 = proton0 + antiPion0; + } + if (aLambdaTag1) { + antiProton0 = ROOT::Math::PxPyPzMVector(t1.pxneg(), t1.pyneg(), t1.pzneg(), o2::constants::physics::MassProton); + pion0 = ROOT::Math::PxPyPzMVector(t1.pxpos(), t1.pypos(), t1.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda0 = antiProton0 + pion0; + } + if (lambdaTag1 && (lambda0.M() < lbinIM || lambda0.M() > hbinIM)) { + continue; + } + if (aLambdaTag1 && (antiLambda0.M() < lbinIM || antiLambda0.M() > hbinIM)) { + continue; + } + if (lambdaTag2) { + proton = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassProton); + antiPion = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassPionCharged); + lambda = proton + antiPion; + } + if (aLambdaTag2) { + antiProton = ROOT::Math::PxPyPzMVector(t2.pxneg(), t2.pyneg(), t2.pzneg(), o2::constants::physics::MassProton); + pion = ROOT::Math::PxPyPzMVector(t2.pxpos(), t2.pypos(), t2.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda = antiProton + pion; + } + if (lambdaTag2 && (lambda.M() < lbinIM || lambda.M() > hbinIM)) { + continue; + } + if (aLambdaTag2 && (antiLambda.M() < lbinIM || antiLambda.M() > hbinIM)) { + continue; + } + + for (const auto& t3 : groupV03) { + if (pairStatus[t3.index()][t2.index()]) { + continue; + } + if (t1.straCollisionId() == t3.straCollisionId()) { + continue; + } + auto [lambdaTag3, aLambdaTag3, isValid3] = getLambdaTagsDD(t3, collision2); + if (!isValid3) { + continue; + } + if (lambdaTag3 && aLambdaTag3) { + continue; + } + if (lambdaTag1 != lambdaTag3 || aLambdaTag1 != aLambdaTag3) { + continue; + } + + if (lambdaTag3) { + proton2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassProton); + antiPion2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassPionCharged); + lambda2 = proton2 + antiPion2; + } + if (aLambdaTag3) { + antiProton2 = ROOT::Math::PxPyPzMVector(t3.pxneg(), t3.pyneg(), t3.pzneg(), o2::constants::physics::MassProton); + pion2 = ROOT::Math::PxPyPzMVector(t3.pxpos(), t3.pypos(), t3.pzpos(), o2::constants::physics::MassPionCharged); + antiLambda2 = antiProton2 + pion2; + } + if (lambdaTag3 && (lambda2.M() < lbinIM || lambda2.M() > hbinIM)) { + continue; + } + + if (aLambdaTag3 && (antiLambda2.M() < lbinIM || antiLambda2.M() > hbinIM)) { + continue; + } + + double deltaPhiMix = RecoDecay::constrainAngle(t3.phi() - t2.phi(), 0.0); + auto mixPairR = TMath::Sqrt(TMath::Power(deltaPhiMix, 2.0) + TMath::Power(t3.eta() - t2.eta(), 2.0)); + + auto etaDiff = t1.eta() - t3.eta(); + auto phiDiff = RecoDecay::constrainAngle(t1.phi() - t3.phi(), 0.0); + + histos.fill(HIST("hPtDiff"), t1.pt() - t3.pt()); + histos.fill(HIST("hPhiDiff"), phiDiff); + histos.fill(HIST("hRDiff"), etaDiff); + + if (mixingCombination == 0 && std::abs(t1.pt() - t3.pt()) > ptMix) { + continue; + } + if (mixingCombination == 0 && t1.eta() * t3.eta() > 0 && std::abs(etaDiff) > etaMix) { + continue; + } + if (mixingCombination == 0 && phiDiff > phiMix) { + continue; + } + if (mixingCombination == 1 && std::abs(t1.pt() - t3.pt()) > ptMix) { + continue; + } + if (mixingCombination == 1 && std::abs(mixPairR - samePairR) > etaMix) { + continue; + } + if (lambdaTag2 && lambdaTag3) { + fillHistograms(1, 0, 1, 0, lambda, lambda2, proton, proton2, centrality, 2); + } else if (aLambdaTag2 && aLambdaTag3) { + fillHistograms(0, 1, 0, 1, antiLambda, antiLambda2, antiProton, antiProton2, centrality, 2); + } else if (lambdaTag2 && aLambdaTag3) { + fillHistograms(1, 0, 0, 1, lambda, antiLambda2, proton, antiProton2, centrality, 2); + } else if (aLambdaTag2 && lambdaTag3) { + fillHistograms(0, 1, 1, 0, antiLambda, lambda2, antiProton, proton2, centrality, 2); + } else { + continue; + } + pairfound = true; + pairStatus[t3.index()][t2.index()] = true; + if (pairfound) { + break; + } + } + } + } + } + + PROCESS_SWITCH(LfTaskLambdaSpinCorr, processDerivedDataMixed, "Process mixed derived data", true); + using CollisionMCRecTableCentFT0C = soa::Join; using TrackMCRecTable = soa::Join; using V0TrackCandidatesMC = soa::Join; From b7c799e477dfe573b3e86eac40e0374c26a1598e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 10 Jun 2025 16:03:15 +0200 Subject: [PATCH 018/116] [PWGEM/Dilepton] update in DimuonCut (#11536) --- PWGEM/Dilepton/Core/Dilepton.h | 3 ++- PWGEM/Dilepton/Core/DileptonMC.h | 3 ++- PWGEM/Dilepton/Core/DimuonCut.cxx | 9 ++++++--- PWGEM/Dilepton/Core/DimuonCut.h | 5 +++-- PWGEM/Dilepton/Core/SingleTrackQC.h | 3 ++- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 3 ++- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 46cecc81c87..33f0ba99718 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -284,6 +284,7 @@ struct Dilepton { Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; 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"}; } dimuoncuts; @@ -754,7 +755,7 @@ struct Dilepton { fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons - fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); + fDimuonCut.SetMFTHitMap(dimuoncuts.requireMFTHitMap, dimuoncuts.requiredMFTDisks); } template diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 00cec907de5..25ebe949553 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -276,6 +276,7 @@ struct DileptonMC { Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; 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"}; } dimuoncuts; @@ -720,7 +721,7 @@ struct DileptonMC { fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons - fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); + fDimuonCut.SetMFTHitMap(dimuoncuts.requireMFTHitMap, dimuoncuts.requiredMFTDisks); } template diff --git a/PWGEM/Dilepton/Core/DimuonCut.cxx b/PWGEM/Dilepton/Core/DimuonCut.cxx index 5ee3bf3d3bd..96f00f8b7a5 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.cxx +++ b/PWGEM/Dilepton/Core/DimuonCut.cxx @@ -119,11 +119,14 @@ void DimuonCut::SetMaxPDCARabsDep(std::function RabsDepCut) mMaxPDCARabsDep = RabsDepCut; LOG(info) << "Dimuon Cut, set max pDCA as a function of Rabs: " << mMaxPDCARabsDep(10.0); } -void DimuonCut::SetMFTHitMap(std::vector hitMap) +void DimuonCut::SetMFTHitMap(bool flag, std::vector hitMap) { + mApplyMFTHitMap = flag; mRequiredMFTDisks = hitMap; - for (const auto& iDisk : mRequiredMFTDisks) { - LOG(info) << "Dimuon Cut, require MFT hit on Disk: " << iDisk; + if (mApplyMFTHitMap) { + for (const auto& iDisk : mRequiredMFTDisks) { + LOG(info) << "Dimuon Cut, require MFT hit on Disk: " << iDisk; + } } } void DimuonCut::SetMaxdPtdEtadPhiwrtMCHMID(float reldPtMax, float dEtaMax, float dPhiMax) diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 34d8364f65b..b96afcd7c28 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -156,7 +156,7 @@ class DimuonCut : public TNamed if (!IsSelectedTrack(track, DimuonCuts::kRabs)) { return false; } - if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kMFTHitMap)) { + if (mApplyMFTHitMap && track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kMFTHitMap)) { return false; } if (track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && !IsSelectedTrack(track, DimuonCuts::kDPtDEtaDPhiwrtMCHMID)) { @@ -243,7 +243,7 @@ class DimuonCut : public TNamed void SetDCAxy(float min, float max); // in cm void SetRabs(float min, float max); // in cm void SetMaxPDCARabsDep(std::function RabsDepCut); - void SetMFTHitMap(std::vector hitMap); + void SetMFTHitMap(bool flag, std::vector hitMap); void SetMaxdPtdEtadPhiwrtMCHMID(float reldPtMax, float dEtaMax, float dPhiMax); // this is relevant for global muons private: @@ -273,6 +273,7 @@ class DimuonCut : public TNamed float mMinRabs{17.6}, mMaxRabs{89.5}; float mMinDcaXY{0.0f}, mMaxDcaXY{1e10f}; float mMaxReldPtwrtMCHMID{1e10f}, mMaxdEtawrtMCHMID{1e10f}, mMaxdPhiwrtMCHMID{1e10f}; + bool mApplyMFTHitMap{false}; std::vector mRequiredMFTDisks{}; ClassDef(DimuonCut, 1); diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 2fc94a8a91c..561e8a2adee 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -204,6 +204,7 @@ struct SingleTrackQC { Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; 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"}; } dimuoncuts; @@ -458,7 +459,7 @@ struct SingleTrackQC { fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons - fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); + fDimuonCut.SetMFTHitMap(dimuoncuts.requireMFTHitMap, dimuoncuts.requiredMFTDisks); } template diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 481bb2e9e5e..5fb15b4ec26 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -210,6 +210,7 @@ struct SingleTrackQCMC { Configurable cfg_max_relDPt_wrt_matchedMCHMID{"cfg_max_relDPt_wrt_matchedMCHMID", 1e+10f, "max. relative dpt between MFT-MCH-MID and MCH-MID"}; Configurable cfg_max_DEta_wrt_matchedMCHMID{"cfg_max_DEta_wrt_matchedMCHMID", 1e+10f, "max. deta between MFT-MCH-MID and MCH-MID"}; 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"}; } dimuoncuts; @@ -517,7 +518,7 @@ struct SingleTrackQCMC { fDimuonCut.SetRabs(dimuoncuts.cfg_min_rabs, dimuoncuts.cfg_max_rabs); fDimuonCut.SetMaxPDCARabsDep([&](float rabs) { return (rabs < 26.5 ? 594.f : 324.f); }); fDimuonCut.SetMaxdPtdEtadPhiwrtMCHMID(dimuoncuts.cfg_max_relDPt_wrt_matchedMCHMID, dimuoncuts.cfg_max_DEta_wrt_matchedMCHMID, dimuoncuts.cfg_max_DPhi_wrt_matchedMCHMID); // this is relevant for global muons - fDimuonCut.SetMFTHitMap(dimuoncuts.requiredMFTDisks); + fDimuonCut.SetMFTHitMap(dimuoncuts.requireMFTHitMap, dimuoncuts.requiredMFTDisks); } template From 4cc3902a125b35262780f73cfaeabe6ec3a47e5c Mon Sep 17 00:00:00 2001 From: Rrantu <156880782+Rrantu@users.noreply.github.com> Date: Wed, 11 Jun 2025 07:48:54 +0800 Subject: [PATCH 019/116] [PWGHF] Add Xic0 flow task and fix previous O2 linter issues (#11533) --- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 158 +++++++++++++++++------ 1 file changed, 117 insertions(+), 41 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 862b4910c72..03e475bc7ed 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -14,6 +14,7 @@ /// /// \author S. Politanò, INFN Torino, Italy /// \author Wu Chuntai, CUG, China +/// \author Ran Tu, Fudan University, China #include #include @@ -48,7 +49,8 @@ enum DecayChannel { DplusToPiKPi = 0, LcToPKPi, LcToPiKP, XicToPKPi, - XicToPiKP + XicToPiKP, + Xic0ToXiPi }; enum QvecEstimator { FV0A = 0, @@ -75,25 +77,11 @@ struct HfTaskFlowCharmHadrons { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; - ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""}; - ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisPsi{"thnConfigAxisPsi", {6000, 2. * TMath::Pi(), 2. * TMath::Pi()}, ""}; - ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisOccupancyITS{"thnConfigAxisOccupancyITS", {14, 0, 14000}, ""}; - ConfigurableAxis thnConfigAxisOccupancyFT0C{"thnConfigAxisOccupancyFT0C", {14, 0, 140000}, ""}; - ConfigurableAxis thnConfigAxisNoSameBunchPileup{"thnConfigAxisNoSameBunchPileup", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{"thnConfigAxisNoCollInTimeRangeNarrow", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{"thnConfigAxisNoCollInTimeRangeStandard", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInRofStandard{"thnConfigAxisNoCollInRofStandard", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisResoFT0cFV0a{"thnConfigAxisResoFT0cFV0a", {160, -8, 8}, ""}; - ConfigurableAxis thnConfigAxisResoFT0cTPCtot{"thnConfigAxisResoFT0cTPCtot", {160, -8, 8}, ""}; - ConfigurableAxis thnConfigAxisResoFV0aTPCtot{"thnConfigAxisResoFV0aTPCtot", {160, -8, 8}, ""}; + HfHelper hfHelper; + EventPlaneHelper epHelper; + HfEventSelection hfEvSel; // event selection and monitoring + o2::framework::Service ccdb; + SliceCache cache; using CandDsDataWMl = soa::Filtered>; using CandDsData = soa::Filtered>; @@ -103,6 +91,8 @@ struct HfTaskFlowCharmHadrons { using CandLcDataWMl = soa::Filtered>; using CandXicData = soa::Filtered>; using CandXicDataWMl = soa::Filtered>; + using CandXic0Data = soa::Filtered>; + using CandXic0DataWMl = soa::Filtered>; using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; @@ -112,6 +102,7 @@ struct HfTaskFlowCharmHadrons { Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; Filter filterSelectLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag; Filter filterSelectXicCandidates = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; + Filter filterSelectXic0Candidates = aod::hf_sel_toxipi::resultSelections >= selectionFlag; Partition selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; Partition selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; @@ -129,12 +120,28 @@ struct HfTaskFlowCharmHadrons { Partition selectedXicToPiKP = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; Partition selectedXicToPKPiWMl = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag; Partition selectedXicToPiKPWMl = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; + Partition selectedXic0 = aod::hf_sel_toxipi::resultSelections >= selectionFlag; + Partition selectedXic0WMl = aod::hf_sel_toxipi::resultSelections >= selectionFlag; - SliceCache cache; - HfHelper hfHelper; - EventPlaneHelper epHelper; - HfEventSelection hfEvSel; // event selection and monitoring - o2::framework::Service ccdb; + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""}; + ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisPsi{"thnConfigAxisPsi", {6000, 0, constants::math::TwoPI}, ""}; + ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisOccupancyITS{"thnConfigAxisOccupancyITS", {14, 0, 14000}, ""}; + ConfigurableAxis thnConfigAxisOccupancyFT0C{"thnConfigAxisOccupancyFT0C", {14, 0, 140000}, ""}; + ConfigurableAxis thnConfigAxisNoSameBunchPileup{"thnConfigAxisNoSameBunchPileup", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{"thnConfigAxisNoCollInTimeRangeNarrow", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{"thnConfigAxisNoCollInTimeRangeStandard", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInRofStandard{"thnConfigAxisNoCollInRofStandard", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisResoFT0cFV0a{"thnConfigAxisResoFT0cFV0a", {160, -8, 8}, ""}; + ConfigurableAxis thnConfigAxisResoFT0cTPCtot{"thnConfigAxisResoFT0cTPCtot", {160, -8, 8}, ""}; + ConfigurableAxis thnConfigAxisResoFV0aTPCtot{"thnConfigAxisResoFV0aTPCtot", {160, -8, 8}, ""}; HistogramRegistry registry{"registry", {}}; @@ -231,15 +238,15 @@ struct HfTaskFlowCharmHadrons { } if (storeResoOccu) { - std::vector axes_reso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot}; + std::vector axesReso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot}; if (occEstimator == 1) { - axes_reso.insert(axes_reso.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy, - thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + axesReso.insert(axesReso.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); } else { - axes_reso.insert(axes_reso.end(), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy, - thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + axesReso.insert(axesReso.end(), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); } - registry.add("spReso/hSparseReso", "THn for resolution with occupancy", HistType::kTHnSparseF, axes_reso); + registry.add("spReso/hSparseReso", "THn for resolution with occupancy", HistType::kTHnSparseF, axesReso); } hfEvSel.addHistograms(registry); // collision monitoring @@ -285,6 +292,44 @@ struct HfTaskFlowCharmHadrons { } } + /// Compute the Q vector for the candidate's tracks + /// \param cand is the candidate + /// \param tracksQx is the X component of the Q vector for the tracks + /// \param tracksQy is the Y component of the Q vector for the tracks + /// \param channel is the decay channel + template + void getQvecXic0Tracks(const T1& cand, + std::vector& tracksQx, + std::vector& tracksQy, + float ampl) + { + // add possibility to consider different weights for the tracks, at the moment only pT is considered; + float pXTrack0 = cand.pxPosV0Dau(); + float pYTrack0 = cand.pyPosV0Dau(); + float pTTrack0 = std::hypot(pXTrack0, pYTrack0); + float phiTrack0 = std::atan2(pXTrack0, pYTrack0); + float pXTrack1 = cand.pxNegV0Dau(); + float pYTrack1 = cand.pyNegV0Dau(); + float pTTrack1 = std::hypot(pXTrack1, pYTrack1); + float phiTrack1 = std::atan2(pXTrack1, pYTrack1); + float pYTrack2 = cand.pxBachFromCasc(); + float pXTrack2 = cand.pyBachFromCasc(); + float pTTrack2 = std::hypot(pXTrack2, pYTrack2); + float phiTrack2 = std::atan2(pXTrack2, pYTrack2); + float pXTrack3 = cand.pxBachFromCharmBaryon(); + float pYTrack3 = cand.pyBachFromCharmBaryon(); + float pTTrack3 = std::hypot(pXTrack3, pYTrack3); + float phiTrack3 = std::atan2(pXTrack3, pYTrack3); + + tracksQx.push_back(std::cos(harmonic * phiTrack0) * pTTrack0 / ampl); + tracksQy.push_back(std::sin(harmonic * phiTrack0) * pTTrack0 / ampl); + tracksQx.push_back(std::cos(harmonic * phiTrack1) * pTTrack1 / ampl); + tracksQy.push_back(std::sin(harmonic * phiTrack1) * pTTrack1 / ampl); + tracksQx.push_back(std::cos(harmonic * phiTrack2) * pTTrack2 / ampl); + tracksQy.push_back(std::sin(harmonic * phiTrack2) * pTTrack2 / ampl); + tracksQx.push_back(std::cos(harmonic * phiTrack3) * pTTrack3 / ampl); + tracksQy.push_back(std::sin(harmonic * phiTrack3) * pTTrack3 / ampl); + } /// Compute the delta psi in the range [0, pi/harmonic] /// \param psi1 is the first angle /// \param psi2 is the second angle @@ -292,12 +337,7 @@ struct HfTaskFlowCharmHadrons { float getDeltaPsiInRange(float psi1, float psi2) { float deltaPsi = psi1 - psi2; - if (std::abs(deltaPsi) > constants::math::PI / harmonic) { - if (deltaPsi > 0.) - deltaPsi -= constants::math::TwoPI / harmonic; - else - deltaPsi += constants::math::TwoPI / harmonic; - } + deltaPsi = RecoDecay::constrainAngle(deltaPsi, -o2::constants::math::PI / harmonic, harmonic); return deltaPsi; } @@ -552,18 +592,36 @@ struct HfTaskFlowCharmHadrons { default: break; } + } else if constexpr (std::is_same_v || std::is_same_v) { + massCand = candidate.invMassCharmBaryon(); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbToXiPi()[classMl->at(iclass)]; + } } - float ptCand = candidate.pt(); - float phiCand = candidate.phi(); + float ptCand = 0.; + float phiCand = 0.; + + if constexpr (std::is_same_v || std::is_same_v) { + ptCand = candidate.kfptXic(); + phiCand = std::atan2(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); + } else { + ptCand = candidate.pt(); + phiCand = candidate.phi(); + } // If TPC is used for the SP estimation, the tracks of the hadron candidate must be removed from the TPC Q vector to avoid double counting if (qvecDetector == QvecEstimator::TPCNeg || qvecDetector == QvecEstimator::TPCPos) { float ampl = amplQVec - static_cast(nProngs); std::vector tracksQx = {}; std::vector tracksQy = {}; - - getQvecDtracks(candidate, tracksQx, tracksQy, ampl); + if constexpr (std::is_same_v || std::is_same_v) { + // std::cout<(candidate, tracksQx, tracksQy, ampl); + } for (auto iTrack{0u}; iTrack < tracksQx.size(); ++iTrack) { xQVec -= tracksQx[iTrack]; yQVec -= tracksQy[iTrack]; @@ -683,6 +741,24 @@ struct HfTaskFlowCharmHadrons { } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic, "Process Xic candidates", false); + // Xic0 with ML + void processXic0Ml(CollsWithQvecs::iterator const& collision, + CandXic0DataWMl const&) + { + auto candsXic0WMl = selectedXic0WMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsXic0WMl); + } + PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic0Ml, "Process Xic0 candidates with ML", false); + + // Xic0 + void processXic0(CollsWithQvecs::iterator const& collision, + CandXic0Data const&) + { + auto candsXic0 = selectedXic0->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsXic0); + } + PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic0, "Process Xic0 candidates", false); + // Resolution void processResolution(CollsWithQvecs::iterator const& collision, aod::BCsWithTimestamps const& bcs) From 06e8c9eb4b632cb73ee21599f0d966c2578a9e52 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 11 Jun 2025 03:19:37 +0200 Subject: [PATCH 020/116] [ALICE3] do not include internal ITS code (#11539) Co-authored-by: ALICE Action Bot --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 62 +++++++++----------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index ff804b8485a..c858f5a753e 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -23,48 +23,42 @@ /// \author Roberto Preghenella preghenella@bo.infn.it /// -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include "ALICE3/Core/DelphesO2TrackSmearer.h" +#include "ALICE3/Core/DetLayer.h" +#include "ALICE3/Core/FastTracker.h" +#include "ALICE3/Core/TrackUtilities.h" +#include "ALICE3/DataModel/OTFStrangeness.h" +#include "ALICE3/DataModel/collisionAlice3.h" +#include "ALICE3/DataModel/tracksAlice3.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CommonConstants/MathConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsVertexing/PVertexer.h" +#include "DetectorsVertexing/PVertexerHelpers.h" +#include "Field/MagneticField.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" -#include -#include "DCAFitter/DCAFitterN.h" -#include "Common/Core/RecoDecay.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsVertexing/PVertexer.h" -#include "DetectorsVertexing/PVertexerHelpers.h" #include "SimulationDataFormat/InteractionSampler.h" -#include "Field/MagneticField.h" -#include "ITSMFTSimulation/Hit.h" -#include "ITStracking/Configuration.h" -#include "ITStracking/IOUtils.h" -#include "ITStracking/Tracker.h" -#include "ITStracking/Vertexer.h" -#include "ITStracking/VertexerTraits.h" +#include +#include +#include +#include +#include -#include "ALICE3/Core/DelphesO2TrackSmearer.h" -#include "ALICE3/Core/FastTracker.h" -#include "ALICE3/Core/DetLayer.h" -#include "ALICE3/Core/TrackUtilities.h" -#include "ALICE3/DataModel/collisionAlice3.h" -#include "ALICE3/DataModel/tracksAlice3.h" -#include "ALICE3/DataModel/OTFStrangeness.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -808,7 +802,7 @@ struct OnTheFlyTracker { std::array posClusterCandidate; trackParCov.getXYZGlo(posClusterCandidate); float r{std::hypot(posClusterCandidate[0], posClusterCandidate[1])}; - float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::its::constants::math::Pi}; + float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::constants::math::PI}; o2::fastsim::DetLayer currentTrackingLayer = fastTracker.GetLayer(i); if (currentTrackingLayer.getResolutionRPhi() > 1e-8 && currentTrackingLayer.getResolutionZ() > 1e-8) { // catch zero (though should not really happen...) From 862bdf2223badc9265b6874a6ea6d81f1a382bc5 Mon Sep 17 00:00:00 2001 From: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Date: Wed, 11 Jun 2025 11:13:34 +0200 Subject: [PATCH 021/116] [Common] Common - add trackdcacov table producer for Run2 converted data (#11434) --- Common/TableProducer/CMakeLists.txt | 5 + .../TableProducer/trackDcaCovFillerRun2.cxx | 179 ++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 Common/TableProducer/trackDcaCovFillerRun2.cxx diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 042bd643d3e..1d6918d6121 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -62,6 +62,11 @@ o2physics_add_dpl_workflow(track-propagation PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(track-dca-cov-filler-run2 + SOURCES trackDcaCovFillerRun2.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(track-propagation-tester SOURCES trackPropagationTester.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::trackSelectionRequest diff --git a/Common/TableProducer/trackDcaCovFillerRun2.cxx b/Common/TableProducer/trackDcaCovFillerRun2.cxx new file mode 100644 index 00000000000..d07833ae9e0 --- /dev/null +++ b/Common/TableProducer/trackDcaCovFillerRun2.cxx @@ -0,0 +1,179 @@ +// 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 trackDcaCovFillerRun2.cxx +/// \author Aimeric Landou , CERN +/// \brief Fills DCA and DCA Cov tables for Run 2 tracks +// Run 2 AO2Ds cannot have their dcacov filled by the current track-propagation workflow as the workflow isn't designed for them, given Run 2 tracks are already propagated to the PV. +// This task fills the DCA Cov (and DCA) tables for Run 2 tracks by "propagating" the tracks (though given they are already at the PV it doesn't actually do the propagation) and retrieving the DCA and DCA cov given by the propagateToDCABxByBz function + +#include + +#include "TableHelper.h" +#include "Common/Tools/TrackTuner.h" +#include "DataFormatsParameters/GRPObject.h" + +using namespace o2; +using namespace o2::framework; +// using namespace o2::framework::expressions; + +struct TrackDcaCovFillerRun2 { + Produces tracksDCA; + Produces tracksDCACov; + + // Produces tunertable; + + Service ccdb; + + bool fillTracksDCA = false; + bool fillTracksDCACov = false; + int runNumber = -1; + + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + + const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + o2::base::MatLayerCylSet* lut = nullptr; + + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "CCDB path of the grp file (run2)"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + + HistogramRegistry registry{"registry"}; + + void init(o2::framework::InitContext& initContext) + { + // Checking if the tables are requested in the workflow and enabling them + fillTracksDCA = isTableRequiredInWorkflow(initContext, "TracksDCA"); + fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov"); + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + } + + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (runNumber == bc.runNumber()) { + return; + } + + // Run 2 GRP object + o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(ccdbPathGrp, bc.timestamp()); + if (grpo == nullptr) { + LOGF(fatal, "Run 2 GRP object (type o2::parameters::GRPObject) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); + } + o2::base::Propagator::initFieldFromGRP(grpo); + LOGF(info, "Setting magnetic field to %d kG for run %d from its GRP CCDB object (type o2::parameters::GRPObject)", grpo->getNominalL3Field(), bc.runNumber()); + + mMeanVtx = ccdb->getForTimeStamp(mVtxPath, bc.timestamp()); + runNumber = bc.runNumber(); + } + + // Running variables + std::array mDcaInfo; + o2::dataformats::DCA mDcaInfoCov; + o2::dataformats::VertexBase mVtx; + o2::track::TrackParametrization mTrackPar; + o2::track::TrackParametrizationWithError mTrackParCov; + + template + void fillTrackTables(TTrack const& tracks, + TParticle const&, + aod::Collisions const&, + aod::BCsWithTimestamps const& bcs) + { + if (bcs.size() == 0) { + return; + } + initCCDB(bcs.begin()); + + if constexpr (fillCovMat) { + if (fillTracksDCACov) { + tracksDCACov.reserve(tracks.size()); + } + } else { + if (fillTracksDCA) { + tracksDCA.reserve(tracks.size()); + } + } + + for (auto const& track : tracks) { + if constexpr (fillCovMat) { + if (fillTracksDCA || fillTracksDCACov) { + mDcaInfoCov.set(999, 999, 999, 999, 999); + } + setTrackParCov(track, mTrackParCov); + } else { + if (fillTracksDCA) { + mDcaInfo[0] = 999; + mDcaInfo[1] = 999; + } + setTrackPar(track, mTrackPar); + } + + if (track.has_collision()) { + auto const& collision = track.collision(); + if constexpr (fillCovMat) { + 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, mTrackParCov, 2.f, matCorr, &mDcaInfoCov); + } else { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo); + } + } else { + if constexpr (fillCovMat) { + mVtx.setPos({mMeanVtx->getX(), mMeanVtx->getY(), mMeanVtx->getZ()}); + mVtx.setCov(mMeanVtx->getSigmaX() * mMeanVtx->getSigmaX(), 0.0f, mMeanVtx->getSigmaY() * mMeanVtx->getSigmaY(), 0.0f, 0.0f, mMeanVtx->getSigmaZ() * mMeanVtx->getSigmaZ()); + o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCov, 2.f, matCorr, &mDcaInfoCov); + } else { + o2::base::Propagator::Instance()->propagateToDCABxByBz({mMeanVtx->getX(), mMeanVtx->getY(), mMeanVtx->getZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo); + } + } + + if constexpr (fillCovMat) { + if (fillTracksDCA) { + tracksDCA(mDcaInfoCov.getY(), mDcaInfoCov.getZ()); + } + if (fillTracksDCACov) { + tracksDCACov(mDcaInfoCov.getSigmaY2(), mDcaInfoCov.getSigmaZ2()); + } + } else { + if (fillTracksDCA) { + tracksDCA(mDcaInfo[0], mDcaInfo[1]); + } + } + } + } + + void processCovariance(soa::Join const& tracks, aod::Collisions const& collisions, aod::BCsWithTimestamps const& bcs) + { + fillTrackTables, /*Particle*/ soa::Join, /*isMc = */ false, /*fillCovMat =*/true>(tracks, tracks, collisions, bcs); + } + PROCESS_SWITCH(TrackDcaCovFillerRun2, processCovariance, "Process with covariance", false); + + void processStandard(soa::Join const& tracks, aod::Collisions const& collisions, aod::BCsWithTimestamps const& bcs) + { + fillTrackTables, /*Particle*/ soa::Join, /*isMc = */ false, /*fillCovMat =*/false>(tracks, tracks, collisions, bcs); + } + PROCESS_SWITCH(TrackDcaCovFillerRun2, processStandard, "Process without covariance", true); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} From 64b985131da0d1eb99bc6c2a42fdaff5e86f2a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Wed, 11 Jun 2025 03:32:37 -0600 Subject: [PATCH 022/116] [PWGUD] : Fixing the runtime overhead (#11532) --- PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx | 49 ++++++++++++++-------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx index eb16b83f315..d20a78429dd 100644 --- a/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx +++ b/PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx @@ -100,7 +100,8 @@ struct upcPhotonuclearAnalysisJMG { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Declare configurables on events/collisions - Configurable nEvenstMixed{"nEvenstMixed", 3, {"Events to be Mixed"}}; + Configurable nEventsMixed{"nEventsMixed", 3, {"Events to be Mixed"}}; + Configurable factorEventsMixed{"factorEventsMixed", 100, {"factorEventsMixed to events mixed"}}; Configurable myZVtxCut{"myZVtxCut", 10., {"My collision cut"}}; Configurable myTimeZNACut{"myTimeZNACut", 2., {"My collision cut"}}; Configurable myTimeZNCCut{"myTimeZNCCut", 2., {"My collision cut"}}; @@ -275,23 +276,18 @@ struct upcPhotonuclearAnalysisJMG { mixedGapSideC.setObject(new CorrelationContainer("mixedEventGapSideC", "mixedEventGapSideC", corrAxis, effAxis, {})); } - std::vector vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -5.0f, 0.0f, 5.0f, 10.0f}; + std::vector vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -7.0f, -5.0f, -2.5f, 0.0f, 2.5f, 5.0f, 7.0f, 10.0f}; std::vector gapSideBinsEdges{VARIABLE_WIDTH, -0.5, 0.5, 1.5}; SliceCache cache; + int countGapA = 0; + int countGapC = 0; // Binning only on PosZ without multiplicity // using BinningType = ColumnBinningPolicy; using BinningType = ColumnBinningPolicy; - BinningType bindingOnVtx{{vtxBinsEdges, {gapSideBinsEdges}}, true}; - SameKindPair pairs{bindingOnVtx, nEvenstMixed, -1, &cache}; - - // ColumnBinningPolicy bindingOnVtx{{vtxBinsEdges, multBinsEdges}, true}; - - // SameKindPair, - // FullUDTracks, - // ColumnBinningPolicy> - // pair{bindingOnVtx, 5, -1, &cache}; + BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true}; + SameKindPair pairs{bindingOnVtx, nEventsMixed, -1, &cache}; template bool isCollisionCutSG(CSG const& collision, int SideGap) @@ -584,7 +580,8 @@ struct upcPhotonuclearAnalysisJMG { if (fillCollisionUD(sameGapSideC, multiplicity) == false) { return; } - // LOGF(debug, "Filling sameGapSideC events"); + histos.fill(HIST("eventcount"), -1); + // LOGF(info, "Filling sameGapSideC events"); fillCorrelationsUD(sameGapSideC, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ()); break; default: @@ -601,18 +598,34 @@ struct upcPhotonuclearAnalysisJMG { // int sgSide = reconstructedCollision.gapSide(); // int sgSide = 0; + int maxCountGapA = 0; + int maxCountGapC = 0; + + if (auto histEventCount = histos.get(HIST("eventcount"))) { + int binA = histEventCount->GetXaxis()->FindBin(-2); // Gap A + int binC = histEventCount->GetXaxis()->FindBin(-1); // Gap C + + maxCountGapA = histEventCount->GetBinContent(binA) * factorEventsMixed; + maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed; + } + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (collision1.size() == 0 || collision2.size() == 0) { - // LOGF(debug, "One or both collisions are empty."); + // LOGF(info, "One or both collisions are empty."); continue; } + if (countGapA >= maxCountGapA && countGapC >= maxCountGapC) { + break; + } float multiplicity = 0; if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { // gap on side A if (isCollisionCutSG(collision1, 0) == false && isCollisionCutSG(collision2, 0) == false) { continue; } - // LOGF(debug, "In the pairs loop, gap side A"); + // std::cout << "Counts for Gap A: " << countGapA << " Maximum Count for Gap A " << maxCountGapA << std::endl; + ++countGapA; + // LOGF(info, "In the pairs loop, gap side A"); multiplicity = tracks1.size(); if (fillCollisionUD(mixedGapSideA, multiplicity) == false) { return; @@ -620,20 +633,22 @@ struct upcPhotonuclearAnalysisJMG { // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()})); histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()})); fillCorrelationsUD(mixedGapSideA, tracks1, tracks2, multiplicity, collision1.posZ()); - // LOGF(debug, "Filling mixedGapSideA events, Gap for side A"); + // LOGF(info, "Filling mixedGapSideA events, Gap for side A"); } if (collision1.gapSide() == 1 && collision2.gapSide() == 1) { // gap on side C if (isCollisionCutSG(collision1, 1) == false && isCollisionCutSG(collision2, 1) == false) { continue; } - // LOGF(debug, "In the pairs loop, gap side C"); + // std::cout << "Counts for Gap C: " << countGapC << " Maximum Count for Gap C" << maxCountGapC << std::endl; + ++countGapC; + // LOGF(info, "In the pairs loop, gap side C"); multiplicity = tracks1.size(); if (fillCollisionUD(mixedGapSideC, multiplicity) == false) { return; } fillCorrelationsUD(mixedGapSideC, tracks1, tracks2, multiplicity, collision1.posZ()); - // LOGF(debug, "Filling mixedGapSideC events, Gap for side C"); + // LOGF(info, "Filling mixedGapSideC events, Gap for side C"); } else { continue; } From 9ff5d35e167f4e81115f3e4afcf02378e4fe80f9 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Wed, 11 Jun 2025 22:31:36 +0800 Subject: [PATCH 023/116] [Trigger] Add macro to inspect trigger menu per run (#11544) --- EventFiltering/macros/getMenu.C | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 EventFiltering/macros/getMenu.C diff --git a/EventFiltering/macros/getMenu.C b/EventFiltering/macros/getMenu.C new file mode 100644 index 00000000000..692ebe396f3 --- /dev/null +++ b/EventFiltering/macros/getMenu.C @@ -0,0 +1,31 @@ +// 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 "CCDB/BasicCCDBManager.h" + +#include +#include + +#include + +void getMenu(int runNumber, std::string baseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/") +{ + auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); + TH1* counters = ccdb.getForRun(baseCCDBPath + "FilterCounters", runNumber); + TAxis* axis = counters->GetXaxis(); + + std::vector binLabels(axis->GetNbins() - 2); // skip first and last bins + std::cout << "Menu for run " << runNumber << ":\n"; + for (int i = 2; i < axis->GetNbins(); ++i) { + binLabels[i - 1] = axis->GetBinLabel(i); + std::cout << "Id " << i - 2 << ": " << axis->GetBinLabel(i) << "\n"; + } +} From b2a827fad4f5897b7061b9756e9d2d5255a1b380 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:36:22 +0200 Subject: [PATCH 024/116] [PWGUD] Updated macro for JIT session error Cannot allocate memory issue (#11490) Co-authored-by: sandeep dudi --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 219 +++++++++++++++----------- 1 file changed, 124 insertions(+), 95 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 20d4f08d1d6..628818bd553 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -59,6 +59,15 @@ struct SginclusivePhiKstarSD { Configurable zdcCut{"zdcCut", 0., "ZDC threshold"}; Configurable vzCut{"vzCut", 10., "Vz position"}; Configurable occCut{"occCut", 1000., "Occupancy cut"}; + Configurable hadronicRate{"hadronicRate", 1000., "hadronicRate cut"}; + Configurable useTrs{"useTrs", -1, "kNoCollInTimeRangeStandard cut"}; + Configurable useTrofs{"useTrofs", -1, "kNoCollInRofStandard cut"}; + Configurable useHmpr{"useHmpr", -1, "kNoHighMultCollInPrevRof cut"}; + Configurable useTfb{"useTfb", -1, "kNoTimeFrameBorder cut"}; + Configurable useItsrofb{"useItsrofb", -1, "kNoITSROFrameBorder cut"}; + Configurable useSbp{"useSbp", -1, "kNoSameBunchPileup cut"}; + Configurable useZvtxftovpv{"useZvtxftovpv", -1, "kIsGoodZvtxFT0vsPV cut"}; + Configurable useVtxItsTpc{"useVtxItsTpc", -1, "kIsVertexITSTPC cut"}; // Track Selections Configurable pvCut{"pvCut", 1.0, "Use Only PV tracks"}; @@ -395,9 +404,9 @@ struct SginclusivePhiKstarSD { } //_____________________________________________________________________________ - double cosThetaCollinsSoperFrame(TLorentzVector pair1, - TLorentzVector pair2, - TLorentzVector fourpion) + double cosThetaCollinsSoperFrame(ROOT::Math::PxPyPzMVector pair1, + ROOT::Math::PxPyPzMVector pair2, + ROOT::Math::PxPyPzMVector fourpion) { double halfSqrtSnn = 2680.; double massOfLead208 = 193.6823; @@ -483,7 +492,7 @@ struct SginclusivePhiKstarSD { } //------------------------------------------------------------------------------------------------------ - double phiCollinsSoperFrame(TLorentzVector pair1, TLorentzVector pair2, TLorentzVector fourpion) + double phiCollinsSoperFrame(ROOT::Math::PxPyPzMVector pair1, ROOT::Math::PxPyPzMVector pair2, ROOT::Math::PxPyPzMVector fourpion) { // Half of the energy per pair of the colliding nucleons. double halfSqrtSnn = 2680.; @@ -518,24 +527,24 @@ struct SginclusivePhiKstarSD { void process(UDCollisionFull const& collision, UDtracksfull const& tracks) { - TLorentzVector v0; - TLorentzVector v1; - TLorentzVector v01; + ROOT::Math::PxPyPzMVector v0; + ROOT::Math::PxPyPzMVector v1; + ROOT::Math::PxPyPzMVector v01; int gapSide = collision.gapSide(); float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); - TLorentzVector phiv; - TLorentzVector phiv1; + ROOT::Math::PxPyPzMVector phiv; + ROOT::Math::PxPyPzMVector phiv1; - std::vector onlyPionTracksp; + std::vector onlyPionTracksp; std::vector rawPionTracksp; - std::vector onlyPionTrackspm; + std::vector onlyPionTrackspm; std::vector rawPionTrackspm; - std::vector onlyPionTracksn; + std::vector onlyPionTracksn; std::vector rawPionTracksn; registry.fill(HIST("GapSide"), gapSide); @@ -547,6 +556,25 @@ 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; int mult = collision.numContrib(); if (gapSide == 0) { @@ -569,18 +597,19 @@ struct SginclusivePhiKstarSD { int trackextra = 0; int trackextraDG = 0; - Partition pvContributors1 = aod::udtrack::isPVContributor == true; - pvContributors1.bindTable(tracks); - if (gapSide == 0) { - registry.get(HIST("nPVContributors_data"))->Fill(pvContributors1.size(), 1.); - } - if (gapSide == 1) { - registry.get(HIST("nPVContributors_data_1"))->Fill(pvContributors1.size(), 1.); - } + /* Partition pvContributors1 = aod::udtrack::isPVContributor == true; + pvContributors1.bindTable(tracks); + if (gapSide == 0) { + registry.get(HIST("nPVContributors_data"))->Fill(pvContributors1.size(), 1.); + } + if (gapSide == 1) { + registry.get(HIST("nPVContributors_data_1"))->Fill(pvContributors1.size(), 1.); + } + */ for (const auto& track1 : tracks) { if (!trackselector(track1, parameters)) continue; - v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); if (selectionPIDPion1(track1)) { onlyPionTrackspm.push_back(v0); rawPionTrackspm.push_back(track1); @@ -719,8 +748,8 @@ struct SginclusivePhiKstarSD { continue; if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -754,8 +783,8 @@ struct SginclusivePhiKstarSD { continue; if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -790,8 +819,8 @@ struct SginclusivePhiKstarSD { continue; if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -825,8 +854,8 @@ struct SginclusivePhiKstarSD { continue; if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -860,8 +889,8 @@ struct SginclusivePhiKstarSD { continue; if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -895,8 +924,8 @@ struct SginclusivePhiKstarSD { continue; if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -932,8 +961,8 @@ struct SginclusivePhiKstarSD { if (phi && selectionPIDKaon1(t0) && selectionPIDKaon1(t1)) { // Apply kaon hypothesis and create pairs - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -971,8 +1000,8 @@ struct SginclusivePhiKstarSD { auto rotkaonPx = t0.px() * std::cos(rotangle) - t0.py() * std::sin(rotangle); auto rotkaonPy = t0.px() * std::sin(rotangle) + t0.py() * std::cos(rotangle); - v0.SetXYZM(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; if (t0.sign() != t1.sign()) { if (gapSide == 0) { @@ -995,8 +1024,8 @@ struct SginclusivePhiKstarSD { if (t0.globalIndex() == t1.globalIndex()) continue; if (rho && selectionPIDProton(t0, useTof, nsigmaTpcCut, nsigmaTofCut) && selectionPIDPion1(t1)) { - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassProton); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassProton); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -1025,8 +1054,8 @@ struct SginclusivePhiKstarSD { if (kstar && selectionPIDKaon1(t0) && selectionPIDPion1(t1)) { if (kaoncut && t0.tpcNSigmaPi() < pionNsigmaCut) continue; - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -1062,8 +1091,8 @@ struct SginclusivePhiKstarSD { auto rotkaonPx = t0.px() * std::cos(rotangle) - t0.py() * std::sin(rotangle); auto rotkaonPy = t0.px() * std::sin(rotangle) + t0.py() * std::cos(rotangle); - v0.SetXYZM(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(rotkaonPx, rotkaonPy, t0.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; if (t0.sign() != t1.sign()) { if (gapSide == 0) { @@ -1082,12 +1111,12 @@ struct SginclusivePhiKstarSD { } if (fourpion) { if (gapSide == 2 && mult2 == 4) { - TLorentzVector pair1, pair2, pair3, pair4; + ROOT::Math::PxPyPzMVector pair1, pair2, pair3, pair4; if (onlyPionTracksp.size() == 2 && onlyPionTracksn.size() == 2) { - TLorentzVector k1 = onlyPionTracksp.at(0); - TLorentzVector k2 = onlyPionTracksp.at(1); - TLorentzVector k3 = onlyPionTracksn.at(0); - TLorentzVector k4 = onlyPionTracksn.at(1); + ROOT::Math::PxPyPzMVector k1 = onlyPionTracksp.at(0); + ROOT::Math::PxPyPzMVector k2 = onlyPionTracksp.at(1); + ROOT::Math::PxPyPzMVector k3 = onlyPionTracksn.at(0); + ROOT::Math::PxPyPzMVector k4 = onlyPionTracksn.at(1); phiv = k1 + k2 + k3 + k4; pair1 = k1 + k3; pair2 = k2 + k4; @@ -1112,10 +1141,10 @@ struct SginclusivePhiKstarSD { if (onlyPionTracksp.size() != 2 && onlyPionTracksn.size() != 2) { if (onlyPionTracksp.size() + onlyPionTracksn.size() != 4) return; - TLorentzVector l1 = onlyPionTrackspm.at(0); - TLorentzVector l2 = onlyPionTrackspm.at(1); - TLorentzVector l3 = onlyPionTrackspm.at(2); - TLorentzVector l4 = onlyPionTrackspm.at(3); + ROOT::Math::PxPyPzMVector l1 = onlyPionTrackspm.at(0); + ROOT::Math::PxPyPzMVector l2 = onlyPionTrackspm.at(1); + ROOT::Math::PxPyPzMVector l3 = onlyPionTrackspm.at(2); + ROOT::Math::PxPyPzMVector l4 = onlyPionTrackspm.at(3); phiv1 = l1 + l2 + l3 + l4; registry.fill(HIST("os_pppp_pT_2_ls"), phiv1.M(), phiv1.Pt(), phiv1.Rapidity()); } @@ -1134,9 +1163,9 @@ struct SginclusivePhiKstarSD { using BinningTypeVertexContributor = ColumnBinningPolicy; void mixprocess(UDCollisionsFull1 const& collisions, UDtracksfull const& /*track*/) { - TLorentzVector v0; - TLorentzVector v1; - TLorentzVector v01; + ROOT::Math::PxPyPzMVector v0; + ROOT::Math::PxPyPzMVector v1; + ROOT::Math::PxPyPzMVector v01; float fitCut[5] = {fv0Cut, ft0aCut, ft0cCut, fddaCut, fddcCut}; std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass}, true}; @@ -1158,8 +1187,8 @@ struct SginclusivePhiKstarSD { if (!trackselector(track1, parameters) || !trackselector(track2, parameters)) continue; if (phi && selectionPIDKaon1(track1) && selectionPIDKaon1(track2)) { - v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (track1.sign() != track2.sign()) { @@ -1181,8 +1210,8 @@ struct SginclusivePhiKstarSD { if (track1.globalIndex() == track2.globalIndex()) continue; if (kstar && selectionPIDKaon1(track1) && selectionPIDPion1(track2)) { - v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(track2.px(), track2.py(), track2.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (track1.sign() != track2.sign()) { @@ -1216,11 +1245,11 @@ struct SginclusivePhiKstarSD { void processMCTruth(aod::UDMcCollisions const& mccollisions, CCs const& collisions, aod::UDMcParticles const& McParts, TCs const& tracks) { // number of McCollisions in DF - TLorentzVector v0; - TLorentzVector v1; - TLorentzVector v01; - TLorentzVector vkstar; - TLorentzVector vphi; + ROOT::Math::PxPyPzMVector v0; + ROOT::Math::PxPyPzMVector v1; + ROOT::Math::PxPyPzMVector v01; + ROOT::Math::PxPyPzMVector vkstar; + ROOT::Math::PxPyPzMVector vphi; for (const auto& mccollision : mccollisions) { if (mccollision.generatorsID() != generatedId) continue; @@ -1236,11 +1265,11 @@ struct SginclusivePhiKstarSD { for (const auto& [tr1, tr2] : combinations(partSlice, partSlice)) { if ((tr1.pdgCode() == kKPlus && tr2.pdgCode() == kPiMinus) || (tr1.pdgCode() == kKMinus && tr2.pdgCode() == kPiPlus) || (tr1.pdgCode() == kPiPlus && tr2.pdgCode() == kKMinus) || (tr1.pdgCode() == kPiMinus && tr2.pdgCode() == kKPlus)) { if (std::abs(tr1.pdgCode()) == kKPlus) { - v0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassPionCharged); } else { - v0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); - v1.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); + v1.SetCoordinates(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); } if (!tr1.isPhysicalPrimary() || !tr2.isPhysicalPrimary()) continue; @@ -1255,7 +1284,7 @@ struct SginclusivePhiKstarSD { if (tr1.has_mothers() && tr2.has_mothers()) { for (const auto& mother : tr1.mothers_as()) { if (std::abs(mother.pdgCode()) == o2::constants::physics::Pdg::kK0Star892) { - vkstar.SetXYZM(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassK0Star892); + vkstar.SetCoordinates(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassK0Star892); registry.get(HIST("MC/accMPtRap_kstar_G"))->Fill(vkstar.M(), vkstar.Pt(), vkstar.Rapidity(), 1.); flag = true; } @@ -1279,8 +1308,8 @@ struct SginclusivePhiKstarSD { if (std::abs(tr1.pdgCode()) != kKPlus || std::abs(tr2.pdgCode()) != kKPlus) continue; - v0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); - v1.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); + v0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); + v1.SetCoordinates(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); if (tr1.pdgCode() == tr2.pdgCode()) continue; v01 = v0 + v1; @@ -1296,7 +1325,7 @@ struct SginclusivePhiKstarSD { if (tr1.has_mothers() && tr2.has_mothers()) { for (const auto& mother : tr1.mothers_as()) { if (std::abs(mother.pdgCode()) == o2::constants::physics::Pdg::kPhi) { - vphi.SetXYZM(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassPhi); + vphi.SetCoordinates(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassPhi); registry.get(HIST("MC/accMPtRap_phi_G"))->Fill(vphi.M(), vphi.Pt(), vphi.Rapidity(), 1.); flag = true; } @@ -1349,8 +1378,8 @@ struct SginclusivePhiKstarSD { std::vector parameters = {pvCut, dcazCut, dcaxyCut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, ptCut}; int truegapSide = sgSelector.trueGap(collision, fitCut[0], fitCut[1], fitCut[2], zdcCut); registry.get(HIST("Reco/Stat"))->Fill(4.0, 1.); - Partition pvContributors = aod::udtrack::isPVContributor == true; - pvContributors.bindTable(tracks); + // Partition pvContributors = aod::udtrack::isPVContributor == true; + // pvContributors.bindTable(tracks); if (std::abs(collision.posZ()) > vzCut) return; if (std::abs(collision.occupancyInTime()) > occCut) @@ -1358,16 +1387,16 @@ struct SginclusivePhiKstarSD { registry.get(HIST("Reco/Stat"))->Fill(truegapSide, 1.); if (truegapSide != gapsideMC) return; - registry.get(HIST("Reco/nPVContributors"))->Fill(pvContributors.size(), 1.); - TLorentzVector vphi; - TLorentzVector vkstar; - TLorentzVector v0; - TLorentzVector vr0; - TLorentzVector vr1; - TLorentzVector vr01; - TLorentzVector vr0g; - TLorentzVector vr1g; - TLorentzVector vr01g; + // registry.get(HIST("Reco/nPVContributors"))->Fill(pvContributors.size(), 1.); + ROOT::Math::PxPyPzMVector vphi; + ROOT::Math::PxPyPzMVector vkstar; + ROOT::Math::PxPyPzMVector v0; + ROOT::Math::PxPyPzMVector vr0; + ROOT::Math::PxPyPzMVector vr1; + ROOT::Math::PxPyPzMVector vr01; + ROOT::Math::PxPyPzMVector vr0g; + ROOT::Math::PxPyPzMVector vr1g; + ROOT::Math::PxPyPzMVector vr01g; int t1 = 0; if (truegapSide == 0) { registry.fill(HIST("V0A_0_mc"), collision.totalFV0AmplitudeA()); @@ -1401,7 +1430,7 @@ struct SginclusivePhiKstarSD { registry.get(HIST("Reco/tr_chi2ncl_2"))->Fill(tr1.tpcChi2NCl(), 1.); registry.get(HIST("Reco/tr_tpcnclfind_2"))->Fill(tr1.tpcNClsFindable(), 1.); registry.get(HIST("Reco/tr_itsChi2NCl_2"))->Fill(tr1.itsChi2NCl(), 1.); - v0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); + v0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); registry.fill(HIST("tpc_dedx_mc"), v0.P(), tr1.tpcSignal()); registry.fill(HIST("tof_beta_mc"), v0.P(), tr1.beta()); @@ -1421,7 +1450,7 @@ struct SginclusivePhiKstarSD { } t1++; - vr0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); + vr0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassKaonCharged); registry.get(HIST("Reco/trpt"))->Fill(vr0.Pt(), 1.); registry.get(HIST("Reco/treta_k"))->Fill(vr0.Eta(), 1.); if (!selectionPIDKaon1(tr1)) @@ -1437,7 +1466,7 @@ struct SginclusivePhiKstarSD { if (t2 > t1) { if (!selectionPIDKaon1(tr2)) continue; - vr1.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); + vr1.SetCoordinates(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); auto mcPart2 = tr2.udMcParticle(); if (std::abs(mcPart2.globalIndex() - mcPart1.globalIndex()) != 1) continue; @@ -1452,7 +1481,7 @@ struct SginclusivePhiKstarSD { if (mcPart1.has_mothers() && mcPart2.has_mothers()) { for (const auto& mother : mcPart1.mothers_as()) { if (std::abs(mother.pdgCode()) == o2::constants::physics::Pdg::kPhi) { - vphi.SetXYZM(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassPhi); + vphi.SetCoordinates(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassPhi); registry.get(HIST("MC/accMPtRap_phi_T"))->Fill(vphi.M(), vphi.Pt(), vphi.Rapidity(), 1.); flag = true; } @@ -1463,8 +1492,8 @@ struct SginclusivePhiKstarSD { } } } - vr0g.SetXYZM(mcPart1.px(), mcPart1.py(), mcPart1.pz(), o2::constants::physics::MassKaonCharged); - vr1g.SetXYZM(mcPart2.px(), mcPart2.py(), mcPart2.pz(), o2::constants::physics::MassKaonCharged); + vr0g.SetCoordinates(mcPart1.px(), mcPart1.py(), mcPart1.pz(), o2::constants::physics::MassKaonCharged); + vr1g.SetCoordinates(mcPart2.px(), mcPart2.py(), mcPart2.pz(), o2::constants::physics::MassKaonCharged); vr01g = vr0g + vr1g; vr01 = vr0 + vr1; @@ -1499,10 +1528,10 @@ struct SginclusivePhiKstarSD { if (tr1.sign() * tr2.sign() > 0) continue; - vr0.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); - vr1.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); - vr0g.SetXYZM(mcPart1.px(), mcPart1.py(), mcPart1.pz(), o2::constants::physics::MassPionCharged); - vr1g.SetXYZM(mcPart2.px(), mcPart2.py(), mcPart2.pz(), o2::constants::physics::MassKaonCharged); + vr0.SetCoordinates(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassPionCharged); + vr1.SetCoordinates(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassKaonCharged); + vr0g.SetCoordinates(mcPart1.px(), mcPart1.py(), mcPart1.pz(), o2::constants::physics::MassPionCharged); + vr1g.SetCoordinates(mcPart2.px(), mcPart2.py(), mcPart2.pz(), o2::constants::physics::MassKaonCharged); vr01g = vr0g + vr1g; vr01 = vr0 + vr1; if (!trackselector(tr1, parameters) || !trackselector(tr2, parameters)) { @@ -1514,7 +1543,7 @@ struct SginclusivePhiKstarSD { if (mcPart1.has_mothers() && mcPart2.has_mothers()) { for (const auto& mother : mcPart1.mothers_as()) { if (std::abs(mother.pdgCode()) == o2::constants::physics::Pdg::kK0Star892) { - vkstar.SetXYZM(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassK0Star892); + vkstar.SetCoordinates(mother.px(), mother.py(), mother.pz(), o2::constants::physics::MassK0Star892); registry.get(HIST("MC/accMPtRap_kstar_T"))->Fill(vkstar.M(), vkstar.Pt(), vkstar.Rapidity(), 1.); flag = true; } From 66a62b9e06ecb124eb7c0cc202fdd526111ecd21 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Wed, 11 Jun 2025 18:01:37 +0200 Subject: [PATCH 025/116] [Trigger,PWGCF] Fix order of enums (#11545) --- EventFiltering/PWGCF/CFFilterAll.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFiltering/PWGCF/CFFilterAll.cxx b/EventFiltering/PWGCF/CFFilterAll.cxx index 589228edc5f..efc7625b215 100644 --- a/EventFiltering/PWGCF/CFFilterAll.cxx +++ b/EventFiltering/PWGCF/CFFilterAll.cxx @@ -61,8 +61,8 @@ enum CFTriggers { kPPRho, kPD, kLD, - kRhoD, kPhiD, + kRhoD, kNTriggers }; From bb4736da716c5129e93958af6417f3a32cd95244 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 11 Jun 2025 20:09:12 +0200 Subject: [PATCH 026/116] [PWGLF] do not include ITS internal code (#11540) --- .../Strangeness/Converters/CMakeLists.txt | 10 +++++----- .../Strangeness/Converters/straevselsconverter2.cxx | 11 ++++++----- .../Strangeness/Converters/straevselsconverter3.cxx | 11 ++++++----- .../Strangeness/Converters/straevselsconverter4.cxx | 8 ++++---- .../Strangeness/Converters/straevselsconverter5.cxx | 10 +++++----- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index 131672fd384..842137dafe1 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -41,22 +41,22 @@ o2physics_add_dpl_workflow(straevselsconverter o2physics_add_dpl_workflow(straevselsconverter2 SOURCES straevselsconverter2.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ReconstructionDataFormats COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(straevselsconverter3 SOURCES straevselsconverter3.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ReconstructionDataFormats COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(straevselsconverter4 SOURCES straevselsconverter4.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(straevselsconverter5 SOURCES straevselsconverter5.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking O2Physics::AnalysisCCDB + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(straevselsconverter2rawcents @@ -117,4 +117,4 @@ o2physics_add_dpl_workflow(stramccollisionconverter2 o2physics_add_dpl_workflow(zdcneutronsconverter SOURCES zdcneutronsconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx index 401b04bbc83..fd3ccad4ee4 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx @@ -8,12 +8,13 @@ // 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 "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "ITStracking/Vertexer.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Vertex.h" + using namespace o2; using namespace o2::framework; @@ -52,7 +53,7 @@ struct straevselsconverter2 { values.totalFDDAmplitudeC(), values.energyCommonZNA(), values.energyCommonZNC(), - o2::its::Vertex::FlagsMask /*dummy flag value*/); + o2::dataformats::Vertex::FlagsMask /*dummy flag value*/); } } }; diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx index ecbd738f5fa..ac209c26fe7 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx @@ -8,12 +8,13 @@ // 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 "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "ITStracking/Vertexer.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Vertex.h" + using namespace o2; using namespace o2::framework; @@ -53,7 +54,7 @@ struct straevselsconverter3 { values.totalFDDAmplitudeC(), values.energyCommonZNA(), values.energyCommonZNC(), - o2::its::Vertex::FlagsMask /*dummy flag value*/); + o2::dataformats::Vertex::FlagsMask /*dummy flag value*/); } } }; diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx index ad988fd93aa..2dc55f365c9 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter4.cxx @@ -8,12 +8,12 @@ // 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 "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "ITStracking/Vertexer.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + using namespace o2; using namespace o2::framework; diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx index f9617c42a0b..0ba066f99b3 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter5.cxx @@ -8,13 +8,13 @@ // 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 "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/AggregatedRunInfo.h" -#include "ITStracking/Vertexer.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" using namespace o2; using namespace o2::framework; From 7d7062b05a6c68b42aac01cf92780fd90c996a7a Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Wed, 11 Jun 2025 21:43:09 +0200 Subject: [PATCH 027/116] [PWGLF] removed globalindex to index in addition to filters (#11565) Co-authored-by: Prottay Das --- .../Tasks/Strangeness/taskLambdaSpinCorr.cxx | 87 +++++++++++-------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 00a2d9707f5..33157c327bf 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -13,36 +13,41 @@ /// \brief Analysis task for Lambda spin spin correlation /// /// \author prottay.das@cern.ch +/// \author sourav.kundu@cern.ch -#include -#include -#include -#include -#include "Math/Vector2D.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/TrackSelection.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/BasicCCDBManager.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "Common/DataModel/FT0Corrected.h" -#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table + +#include "Math/GenVector/Boost.h" +#include "Math/Vector2D.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" + +#include + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -66,7 +71,6 @@ struct LfTaskLambdaSpinCorr { // mixing Configurable cosCalculation{"cosCalculation", 0, "cos calculation"}; Configurable mixingCombination{"mixingCombination", 0, "mixing Combination"}; - Configurable mixingEvSel{"mixingEvSel", false, "mixingEvSel"}; Configurable cfgCutOccupancy{"cfgCutOccupancy", 2000, "Occupancy cut"}; ConfigurableAxis axisVertex{"axisVertex", {5, -10, 10}, "vertex axis for bin"}; ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {8, 0, 80}, "multiplicity percentile for bin"}; @@ -94,13 +98,13 @@ struct LfTaskLambdaSpinCorr { Configurable confV0PtMin{"confV0PtMin", 0.f, "Minimum transverse momentum of V0"}; Configurable confV0PtMax{"confV0PtMax", 0.f, "Maximum transverse momentum of V0"}; Configurable confV0Rap{"confV0Rap", 0.8f, "Rapidity range of V0"}; - Configurable confV0DCADaughMax{"confV0DCADaughMax", 0.2f, "Maximum DCA between the V0 daughters"}; + Configurable confV0DCADaughMax{"confV0DCADaughMax", 0.2f, "Maximum DCA between the V0 daughters"}; Configurable confV0CPAMin{"confV0CPAMin", 0.9998f, "Minimum CPA of V0"}; Configurable confV0TranRadV0Min{"confV0TranRadV0Min", 1.5f, "Minimum transverse radius"}; Configurable confV0TranRadV0Max{"confV0TranRadV0Max", 100.f, "Maximum transverse radius"}; Configurable cMaxV0DCA{"cMaxV0DCA", 1.2, "Maximum V0 DCA to PV"}; - Configurable cMinV0DCAPr{"cMinV0DCAPr", 0.05, "Minimum V0 daughters DCA to PV for Pr"}; - Configurable cMinV0DCAPi{"cMinV0DCAPi", 0.05, "Minimum V0 daughters DCA to PV for Pi"}; + Configurable cMinV0DCAPr{"cMinV0DCAPr", 0.05, "Minimum V0 daughters DCA to PV for Pr"}; + Configurable cMinV0DCAPi{"cMinV0DCAPi", 0.05, "Minimum V0 daughters DCA to PV for Pi"}; Configurable cMaxV0LifeTime{"cMaxV0LifeTime", 20, "Maximum V0 life time"}; // config for V0 daughters @@ -610,7 +614,7 @@ struct LfTaskLambdaSpinCorr { if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (mixingEvSel && additionalEvSel5 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel5 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } @@ -620,7 +624,7 @@ struct LfTaskLambdaSpinCorr { if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (mixingEvSel && additionalEvSel5 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel5 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } @@ -795,7 +799,11 @@ struct LfTaskLambdaSpinCorr { } PROCESS_SWITCH(LfTaskLambdaSpinCorr, processME, "Process data ME", true); - void processDerivedData(soa::Join::iterator const& collision, v0Candidates const& V0s, dauTracks const&) + Filter v0der = (nabs(aod::v0data::dcapostopv) > cMinV0DCAPr && nabs(aod::v0data::dcanegtopv) > cMinV0DCAPi && nabs(aod::v0data::dcaV0daughters) < confV0DCADaughMax); + using v0Cand = soa::Filtered; + + // void processDerivedData(soa::Join::iterator const& collision, v0Candidates const& V0s, dauTracks const&) + void processDerivedData(soa::Join::iterator const& collision, v0Cand const& V0s, dauTracks const&) { histos.fill(HIST("hEvtSelInfo"), 0.5); if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) { @@ -914,8 +922,10 @@ struct LfTaskLambdaSpinCorr { } PROCESS_SWITCH(LfTaskLambdaSpinCorr, processDerivedData, "Process derived data", true); - Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only - void processDerivedDataMixed(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) + // Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only + Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only + // void processDerivedDataMixed(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) + void processDerivedDataMixed(soa::Join const& collisions, v0Cand const& V0s, dauTracks const&) { @@ -954,7 +964,7 @@ struct LfTaskLambdaSpinCorr { if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (mixingEvSel && additionalEvSel5 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel5 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } @@ -964,13 +974,16 @@ struct LfTaskLambdaSpinCorr { if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { continue; } - if (mixingEvSel && additionalEvSel5 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (additionalEvSel5 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { continue; } auto centrality = collision1.centFT0C(); - auto groupV01 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); - auto groupV02 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); - auto groupV03 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.globalIndex()); + // auto groupV01 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); + // auto groupV02 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.globalIndex()); + // auto groupV03 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.globalIndex()); + auto groupV01 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); + auto groupV02 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); + auto groupV03 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.index()); size_t rows = groupV03.size() + 20; size_t cols = groupV01.size() + 20; From 5bd224bba9ad74f5f86b3b024365c36c03d7eada Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 12 Jun 2025 07:21:44 +0800 Subject: [PATCH 028/116] [PWGCF] flowtask: ccdb set to now. diHadron: add event weight (#11569) --- PWGCF/Flow/Tasks/flowTask.cxx | 4 +- .../Tasks/diHadronCor.cxx | 155 ++++++++++-------- 2 files changed, 88 insertions(+), 71 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 5431a84bd47..4390131be3a 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -132,7 +132,6 @@ struct FlowTask { // 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 @@ -196,7 +195,8 @@ struct FlowTask { 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 some output objects to the histogram registry // Event QA diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index 4a944a4fff0..189e201ef68 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -78,7 +78,6 @@ struct DiHadronCor { 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(cfgUseTentativeEventCounter, bool, false, "After sel8(), count events regardless of real event selection") 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") @@ -93,6 +92,7 @@ struct DiHadronCor { 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") SliceCache cache; @@ -184,29 +184,18 @@ struct DiHadronCor { LOGF(info, "Starting init"); // Event Counter - registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{10, 0, 10}}}); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(4, "kNoCollInTimeRangeStandard"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(5, "kIsGoodITSLayersAll"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(6, "kNoCollInRofStandard"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(7, "kNoHighMultCollInPrevRof"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(8, "occupancy"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(9, "MultCorrelation"); - registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(10, "cfgEvSelV0AT0ACut"); - if (cfgUseTentativeEventCounter) { - registry.add("hEventCountTentative", "Number of Event;; Count", {HistType::kTH1D, {{10, 0, 10}}}); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(1, "after sel8"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(4, "kNoCollInTimeRangeStandard"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(5, "kIsGoodITSLayersAll"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(6, "kNoCollInRofStandard"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(7, "kNoHighMultCollInPrevRof"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(8, "occupancy"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(9, "MultCorrelation"); - registry.get(HIST("hEventCountTentative"))->GetXaxis()->SetBinLabel(10, "cfgEvSelV0AT0ACut"); + if (doprocessSame && cfgUseAdditionalEventCut) { + registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{10, 0, 10}}}); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(4, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(5, "kIsGoodITSLayersAll"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(6, "kNoCollInRofStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(7, "kNoHighMultCollInPrevRof"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(8, "occupancy"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(9, "MultCorrelation"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(10, "cfgEvSelV0AT0ACut"); } if (cfgUseAdditionalEventCut) { @@ -226,23 +215,24 @@ struct DiHadronCor { fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); } - // Make histograms to check the distributions after cuts - 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 std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); - 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}}}); + // 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 if (doprocessMCSame && doprocessOntheflySame) { @@ -263,6 +253,13 @@ struct DiHadronCor { registry.add("MCTrue/MCdeltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution registry.add("MCTrue/MCdeltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); } + if (doprocessMCEfficiency) { + registry.add("MCEffeventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(1, "MC"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(2, "Reco Primary"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(3, "Reco All"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(4, "Fake"); + } std::vector corrAxis = {{axisSample, "Sample"}, {axisVertex, "z-vtx (cm)"}, @@ -424,7 +421,7 @@ struct DiHadronCor { } template - void fillCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, int magneticField, float cent) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + 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) { @@ -455,7 +452,7 @@ struct DiHadronCor { if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) continue; if (system == SameEvent) { - registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), triggerWeight); + registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); } for (auto const& track2 : tracks2) { @@ -497,18 +494,18 @@ struct DiHadronCor { // fill the right sparse and histograms if (system == SameEvent) { - same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, triggerWeight * associatedWeight); - registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, triggerWeight * associatedWeight); + 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, triggerWeight * associatedWeight); - registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, triggerWeight * associatedWeight); + 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 - void fillMCCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillMCCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); @@ -522,7 +519,7 @@ struct DiHadronCor { continue; if (system == SameEvent && (doprocessMCSame || doprocessOntheflySame)) - registry.fill(HIST("MCTrue/MCTrig_hist"), fSampleIndex, posZ, track1.pt(), triggerWeight); + registry.fill(HIST("MCTrue/MCTrig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); for (auto const& track2 : tracks2) { @@ -539,13 +536,13 @@ struct DiHadronCor { // fill the right sparse and histograms if (system == SameEvent) { - same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, triggerWeight * associatedWeight); + same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); if (doprocessMCSame || doprocessOntheflySame) - registry.fill(HIST("MCTrue/MCdeltaEta_deltaPhi_same"), deltaPhi, deltaEta, triggerWeight * associatedWeight); + registry.fill(HIST("MCTrue/MCdeltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); } else if (system == MixedEvent) { - mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, triggerWeight * associatedWeight); + mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); if (doprocessMCMixed || doprocessOntheflyMixed) - registry.fill(HIST("MCTrue/MCdeltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, triggerWeight * associatedWeight); + registry.fill(HIST("MCTrue/MCdeltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); } } } @@ -652,7 +649,7 @@ struct DiHadronCor { fillYield(collision, tracks); same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); - fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent); + fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent, 1.0f); } PROCESS_SWITCH(DiHadronCor, processSame, "Process same event", true); @@ -671,8 +668,9 @@ struct DiHadronCor { MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; auto tracksTuple = std::make_tuple(tracks, tracks); - Pair pair{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip - for (auto const& [collision1, tracks1, collision2, tracks2] : pair) { + 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; @@ -702,8 +700,12 @@ struct DiHadronCor { 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); + fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, getMagneticField(bc.timestamp()), cent1, eventWeight); } } @@ -723,7 +725,7 @@ struct DiHadronCor { } } - void processMCEfficiency(FilteredMcCollisions::iterator const& mcCollision, aod::BCsWithTimestamps const&, soa::SmallGroups> const& collisions, FilteredMcParticles const& mcParticles, FilteredTracksWithMCLabels const& tracks) + void processMCEfficiency(FilteredMcCollisions::iterator const& mcCollision, soa::SmallGroups> const& collisions, FilteredMcParticles const& mcParticles, FilteredTracksWithMCLabels const& tracks) { if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { return; @@ -731,6 +733,7 @@ struct DiHadronCor { // Primaries for (const auto& mcParticle : mcParticles) { if (mcParticle.isPhysicalPrimary()) { + registry.fill(HIST("MCEffeventcount"), 0.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } } @@ -745,11 +748,14 @@ struct DiHadronCor { if (track.has_mcParticle()) { const auto& mcParticle = track.mcParticle(); if (mcParticle.isPhysicalPrimary()) { + registry.fill(HIST("MCEffeventcount"), 1.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } + registry.fill(HIST("MCEffeventcount"), 2.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } else { // fake track + registry.fill(HIST("MCEffeventcount"), 3.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, track.eta(), track.pt(), 0, 0., mcCollision.posZ()); } } @@ -791,14 +797,15 @@ struct DiHadronCor { } same->fillEvent(mcParticles.size(), CorrelationContainer::kCFStepAll); - fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent); + fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent, 1.0f); if (collisions.size() == 0) { return; } + registry.fill(HIST("MCTrue/MCeventcount"), 2.5); same->fillEvent(mcParticles.size(), CorrelationContainer::kCFStepTrackedOnlyPrim); - fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent); + fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent, 1.0f); } PROCESS_SWITCH(DiHadronCor, processMCSame, "Process MC same event", false); @@ -815,8 +822,9 @@ struct DiHadronCor { MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pair{binningOnVtxAndMult, cfgMixEventNumMin, -1, mcCollisions, tracksTuple, &cache}; // -1 is the number of the bin to skip - for (auto const& [collision1, tracks1, collision2, tracks2] : pair) { + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, mcCollisions, 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 (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) continue; @@ -839,14 +847,18 @@ struct DiHadronCor { continue; registry.fill(HIST("MCTrue/MCeventcount"), MixedEvent); // fill the mixed event in the 3 bin + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } - fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent); + fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, eventWeight); if (groupedCollisions.size() == 0) { continue; } - fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent); + fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, eventWeight); } } PROCESS_SWITCH(DiHadronCor, processMCMixed, "Process MC mixed events", false); @@ -873,10 +885,10 @@ struct DiHadronCor { } same->fillEvent(mcParticles.size(), CorrelationContainer::kCFStepAll); - fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent); + fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent, 1.0f); same->fillEvent(mcParticles.size(), CorrelationContainer::kCFStepTrackedOnlyPrim); - fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent); + fillMCCorrelations(mcParticles, mcParticles, mcCollision.posZ(), SameEvent, 1.0f); } PROCESS_SWITCH(DiHadronCor, processOntheflySame, "Process on-the-fly same event", false); @@ -893,8 +905,9 @@ struct DiHadronCor { MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pair{binningOnVtxAndMult, cfgMixEventNumMin, -1, mcCollisions, tracksTuple, &cache}; // -1 is the number of the bin to skip - for (auto const& [collision1, tracks1, collision2, tracks2] : pair) { + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, mcCollisions, 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 (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) continue; @@ -903,10 +916,14 @@ struct DiHadronCor { continue; registry.fill(HIST("MCTrue/MCeventcount"), MixedEvent); // fill the mixed event in the 3 bin + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } - fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent); + fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, eventWeight); - fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent); + fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, eventWeight); } } PROCESS_SWITCH(DiHadronCor, processOntheflyMixed, "Process on-the-fly mixed events", false); From fa73d9137b69f8947d93b0119e0a2c8b9ed8695b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Thu, 12 Jun 2025 07:23:03 +0200 Subject: [PATCH 029/116] [PWGHF,Tutorial] Include What You Use (#11553) --- Tutorials/PWGHF/DataModelMini.h | 7 ++++- Tutorials/PWGHF/skimCreatorMini.cxx | 31 +++++++++++++-------- Tutorials/PWGHF/taskMini.cxx | 42 ++++++++++++++++++----------- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/Tutorials/PWGHF/DataModelMini.h b/Tutorials/PWGHF/DataModelMini.h index 7a03f1462b7..720b7207676 100644 --- a/Tutorials/PWGHF/DataModelMini.h +++ b/Tutorials/PWGHF/DataModelMini.h @@ -17,7 +17,12 @@ #ifndef TUTORIALS_PWGHF_DATAMODELMINI_H_ #define TUTORIALS_PWGHF_DATAMODELMINI_H_ -#include "Framework/AnalysisDataModel.h" +#include "Common/Core/RecoDecay.h" + +#include +#include + +#include namespace o2::aod { diff --git a/Tutorials/PWGHF/skimCreatorMini.cxx b/Tutorials/PWGHF/skimCreatorMini.cxx index ac6b12e2004..6fba171cfbf 100644 --- a/Tutorials/PWGHF/skimCreatorMini.cxx +++ b/Tutorials/PWGHF/skimCreatorMini.cxx @@ -14,21 +14,30 @@ /// /// \author Vít Kučera , Inha University -// O2 -#include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/DCAFitterN.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - -// O2Physics +#include "Tutorials/PWGHF/DataModelMini.h" +// #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -// PWGHF -#include "Tutorials/PWGHF/DataModelMini.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include using namespace o2; using namespace o2::aod; diff --git a/Tutorials/PWGHF/taskMini.cxx b/Tutorials/PWGHF/taskMini.cxx index 871fe710581..1876d6230cc 100644 --- a/Tutorials/PWGHF/taskMini.cxx +++ b/Tutorials/PWGHF/taskMini.cxx @@ -14,23 +14,33 @@ /// /// \author Vít Kučera , Inha University -// O2 -#include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/DCAFitterN.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - -// O2Physics +#include "Tutorials/PWGHF/DataModelMini.h" +// +#include "PWGHF/Core/HfHelper.h" +// #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelectorPID.h" #include "Common/Core/trackUtilities.h" -#include "Common/DataModel/PIDResponse.h" - -// PWGHF -#include "PWGHF/Core/HfHelper.h" -#include "Tutorials/PWGHF/DataModelMini.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include using namespace o2; using namespace o2::aod; @@ -314,8 +324,8 @@ struct HfTaskMiniD0 { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong"}), // o2-linter: disable=name/o2-task - adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong-expressions"}), // o2-linter: disable=name/o2-task + adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong"}), // o2-linter: disable=name/o2-task (wrong hyphenation) + adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong-expressions"}), // o2-linter: disable=name/o2-task (wrong hyphenation) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } From af854a45d3d591260e8eefab7816d4a877dcd8dc Mon Sep 17 00:00:00 2001 From: Simone Ragoni <47641042+siragoni@users.noreply.github.com> Date: Thu, 12 Jun 2025 08:34:43 +0200 Subject: [PATCH 030/116] [PWGUD] new task for inclusive MC (#11498) --- PWGUD/Tasks/CMakeLists.txt | 7 +- PWGUD/Tasks/analysisMCDPMJetSGv3.cxx | 412 +++++++++++++++++++++++++++ 2 files changed, 418 insertions(+), 1 deletion(-) create mode 100644 PWGUD/Tasks/analysisMCDPMJetSGv3.cxx diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index a193e46587e..d828261167c 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -246,5 +246,10 @@ o2physics_add_dpl_workflow(flow-cumulants-upc o2physics_add_dpl_workflow(flow-correlations-upc SOURCES flowCorrelationsUpc.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGCFCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGCFCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(analysis-mc-dpm-jet-sg-v3 + SOURCES analysisMCDPMJetSGv3.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGUD/Tasks/analysisMCDPMJetSGv3.cxx b/PWGUD/Tasks/analysisMCDPMJetSGv3.cxx new file mode 100644 index 00000000000..4347871377a --- /dev/null +++ b/PWGUD/Tasks/analysisMCDPMJetSGv3.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 AnalysisMCDPMJetSGv3.cxx +/// \brief Process MC DPMJet events for inclusive studies. +/// +/// \author Simone Ragoni + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/ASoAHelpers.h" +// #include "TDatabasePDG.h" +#include "PWGUD/Core/UPCHelpers.h" +#include "PWGUD/DataModel/UDTables.h" +// #include "TLorentzVector.h" +// #include "TVector3.h" +#include "Math/LorentzVector.h" // ROOT::Math::LorentzVector +#include "Math/PxPyPzM4D.h" // ROOT::Math::PxPyPzM4D +#include "TMath.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct AnalysisMCDPMJetSGv3 { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // TDatabasePDG* fPDG = TDatabasePDG::Instance(); + + Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; + + // using myCompleteTracks = soa::Join; + // using myFilteredTracks = soa::Filtered; + using BCs = soa::Join; + + Preslice perCollision = aod::track::collisionId; + Preslice perMcCollision = o2::aod::mcparticle::mcCollisionId; + // using MCTCs = soa::Join; + // using MCTC = MCTCs::iterator; + // define abbreviations + using CCs = soa::Join; + using CC = CCs::iterator; + using MCparticles = aod::UDMcParticles::iterator; + using TCs = soa::Join; + // using TCs = soa::Join; + using TC = TCs::iterator; + using LorentzVectorM = ROOT::Math::LorentzVector>; + + double massPion = 0.; + double massKaon = 0.; + double massProton = 0.; + const int codePion = 211; + const int codeKaon = 321; + const int codeProton = 2212; + + void init(InitContext const&) + { + // TParticlePDG* pionPDG = fPDG->GetParticle(codePion); + // if (pionPDG != nullptr) { + // massPion = pionPDG->Mass(); + // } + // TParticlePDG* kaonPDG = fPDG->GetParticle(codeKaon); + // if (kaonPDG != nullptr) { + // massKaon = kaonPDG->Mass(); + // } + // TParticlePDG* protonPDG = fPDG->GetParticle(codeProton); + // if (protonPDG != nullptr) { + // massProton = protonPDG->Mass(); + // } + massPion = o2::constants::physics::MassPionCharged; + massKaon = o2::constants::physics::MassKaonCharged; + massProton = o2::constants::physics::MassProton; + + // define axes you want to use + const AxisSpec axisCounter{10, 0, 10, ""}; + const AxisSpec axisEta{100, -1.5, +1.5, "#eta"}; + const AxisSpec axisPt{5000, 0, 5, "p_{T}"}; + const AxisSpec axisPtSmall{1000, 0, 1, "p_{T}"}; + const AxisSpec axisMass{nBinsPt, 0, 5, "m_{#pi#pi}"}; + const AxisSpec axisMassSmall{nBinsPt, 0, 2, "m_{#pi#pi}"}; + const AxisSpec axisDeltaPt{100, -1.0, +1.0, "#Delta(p_{T})"}; + const AxisSpec axisBC{1000, -10000.0, +10000.0, "BCs"}; + const AxisSpec axisBCext{100000, -10000000.0, +10000000.0, "BCs"}; + const AxisSpec axisCosTheta{100, -1.0, +1.0, "cos#theta"}; + const AxisSpec axisPhi{600, -o2::constants::math::PI, -o2::constants::math::PI, "#varphi"}; + + // create histograms + histos.add("hdEdx", "p vs dE/dx Signal", kTH2F, {{100, 0.0, 3.0}, {1000, 0.0, 2000.0}}); + histos.add("hSigmaPion", "p vs dE/dx sigma pion TPC ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaPionTruth", "p vs dE/dx sigma pion TPC truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaPionTOF", "p vs dE/dx sigma pion TOF ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaPionTruthTOF", "p vs dE/dx sigma pion TOF truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaKaon", "p vs dE/dx sigma kaon TPC ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaKaonTruth", "p vs dE/dx sigma kaon TPC truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaKaonTOF", "p vs dE/dx sigma kaon TOF ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaKaonTruthTOF", "p vs dE/dx sigma kaon TOF truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaProton", "p vs dE/dx sigma proton TPC ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaProtonTruth", "p vs dE/dx sigma proton TPC truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaProtonTOF", "p vs dE/dx sigma proton TOF ", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + histos.add("hSigmaProtonTruthTOF", "p vs dE/dx sigma proton TOF truth", kTH2F, {{300, 0.0, 3.0}, {200, -10.0, 10.0}}); + + histos.add("hVisibleMultiVsGeneratedMulti", "Multiplicity correlation", kTH2F, {{10000, -0.5, 9999.5}, {1000, -0.5, 999.5}}); + + histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); + histos.add("ptResolution", "ptResolution", kTH2F, {axisPt, axisDeltaPt}); + + histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt}); + histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt}); + histos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {axisPt}); + histos.add("ptGeneratedPionAxE", "ptGeneratedPionAxE", kTH1F, {axisPt}); + histos.add("ptGeneratedKaonAxE", "ptGeneratedKaonAxE", kTH1F, {axisPt}); + histos.add("ptGeneratedProtonAxE", "ptGeneratedProtonAxE", kTH1F, {axisPt}); + histos.add("ptGeneratedProtonAxEPos", "ptGeneratedProtonAxEPos", kTH1F, {axisPt}); + histos.add("ptGeneratedProtonAxENeg", "ptGeneratedProtonAxENeg", kTH1F, {axisPt}); + histos.add("ptReconstructedPion", "ptReconstructedPion", kTH1F, {axisPt}); + histos.add("ptReconstructedKaon", "ptReconstructedKaon", kTH1F, {axisPt}); + histos.add("ptReconstructedProton", "ptReconstructedProton", kTH1F, {axisPt}); + histos.add("ptReconstructedProtonPos", "ptReconstructedProtonPos", kTH1F, {axisPt}); + histos.add("ptReconstructedProtonNeg", "ptReconstructedProtonNeg", kTH1F, {axisPt}); + histos.add("ptReconstructedPionTOF", "ptReconstructedPionTOF", kTH1F, {axisPt}); + histos.add("ptReconstructedKaonTOF", "ptReconstructedKaonTOF", kTH1F, {axisPt}); + histos.add("ptReconstructedProtonTOF", "ptReconstructedProtonTOF", kTH1F, {axisPt}); + + histos.add("allreconstructedPFPion", "allreconstructedPFPion", kTH1F, {axisPt}); + histos.add("allreconstructedPFKaon", "allreconstructedPFKaon", kTH1F, {axisPt}); + histos.add("allreconstructedPFProton", "allreconstructedPFProton", kTH1F, {axisPt}); + histos.add("allreconstructedPFProtonPos", "allreconstructedPFProtonPos", kTH1F, {axisPt}); + histos.add("allreconstructedPFProtonNeg", "allreconstructedPFProtonNeg", kTH1F, {axisPt}); + histos.add("allreconstructedPFPionTOF", "allreconstructedPFPionTOF", kTH1F, {axisPt}); + histos.add("allreconstructedPFKaonTOF", "allreconstructedPFKaonTOF", kTH1F, {axisPt}); + histos.add("allreconstructedPFProtonTOF", "allreconstructedPFProtonTOF", kTH1F, {axisPt}); + + histos.add("numberOfRecoCollisions", "numberOfRecoCollisions", kTH1F, {{100, -0.5f, 99.5f}}); + histos.add("numberOfRecoCollisions2", "numberOfRecoCollisions2", kTH1F, {{100, -0.5f, 99.5f}}); + histos.add("numberOfTracksMC", "numberOfTracksMC", kTH1F, {{100, -0.5f, 99.5f}}); + histos.add("numberOfTracksReco", "numberOfTracksReco", kTH1F, {{100, -0.5f, 99.5f}}); + + histos.add("bcResolution", "bcResolution", kTH1F, {axisBC}); + histos.add("mcbcHistogram", "mcbcHistogram", kTH1F, {axisBCext}); + histos.add("bcHistogram", "bcHistogram", kTH1F, {axisBCext}); + histos.add("mcbcModuloOrbitHistogram", "mcbcModuloOrbitHistogram", kTH1F, {axisBC}); + histos.add("bcModuloOrbitHistogram", "bcModuloOrbitHistogram", kTH1F, {axisBC}); + } + //----------------------------------------------------------------------------------------------------------------------- + void processSim(aod::UDMcCollision const& mcCollision, aod::UDMcParticles const& mcParticles) + { + // histos.fill(HIST("eventCounter"), 0.5); + + // auto massPion = 0.; + // TParticlePDG pionPDG = fPDG->GetParticle(codePion); + // massPion = pionPDG.Mass(); + // auto massKaon = 0.; + // TParticlePDG kaonPDG = fPDG->GetParticle(codeKaon); + // massKaon = kaonPDG.Mass(); + // auto massProton = 0.; + // TParticlePDG protonPDG = fPDG->GetParticle(codeProton); + // massProton = protonPDG.Mass(); + histos.fill(HIST("numberOfTracksMC"), mcParticles.size()); + histos.fill(HIST("eventCounter"), mcCollision.size()); + // LOGF(info, "New event! mcParticles.size() = %d", mcParticles.size()); + + int counterMC = 0; + int counter = 0; + for (const auto& mcParticle : mcParticles) { + if (!mcParticle.isPhysicalPrimary()) + continue; + counterMC += 1; + // if(mcParticle.isPhysicalPrimary()) counterMC += 1; + LorentzVectorM protoMC( + mcParticle.px(), + mcParticle.py(), + mcParticle.pz(), + massPion); + double etaMax = 0.8; + double ptMin = 0.1; + if (std::fabs(protoMC.Eta()) < etaMax && protoMC.Pt() > ptMin) { + counter += 1; + } + if (!mcParticle.isPhysicalPrimary()) + continue; + // if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.eta())<0.9){ // do this in the context of the MC loop ! (context matters!!!) + // LorentzVectorM pMC; + LorentzVectorM pMC(mcParticle.px(), mcParticle.py(), mcParticle.pz(), massPion); + if (std::abs(mcParticle.pdgCode()) == codePion) { + // histos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + // LorentzVectorM pMC(mcParticle.px(), mcParticle.py(), mcParticle.pz(), massPion); + histos.fill(HIST("ptGeneratedPion"), pMC.Pt()); + } + if (std::abs(mcParticle.pdgCode()) == codeKaon) { + // histos.fill(HIST("ptGenerateKaon"), mcParticle.pt()); + // LorentzVectorM pMC(mcParticle.px(), mcParticle.py(), mcParticle.pz(), massKaon); + pMC.SetM(massKaon); + histos.fill(HIST("ptGeneratedKaon"), pMC.Pt()); + } + if (std::abs(mcParticle.pdgCode()) == codeProton) { + // histos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); + // LorentzVectorM pMC(mcParticle.px(), mcParticle.py(), mcParticle.pz(), massProton); + pMC.SetM(massProton); + histos.fill(HIST("ptGeneratedProton"), pMC.Pt()); + } + double yMax = 0.8; + if (std::abs(pMC.Rapidity()) < yMax) { + if (std::abs(mcParticle.pdgCode()) == codePion) + histos.fill(HIST("ptGeneratedPionAxE"), pMC.Pt()); + if (std::abs(mcParticle.pdgCode()) == codeKaon) + histos.fill(HIST("ptGeneratedKaonAxE"), pMC.Pt()); + if (std::abs(mcParticle.pdgCode()) == codeProton) + histos.fill(HIST("ptGeneratedProtonAxE"), pMC.Pt()); + if (mcParticle.pdgCode() == codeProton) { + histos.fill(HIST("ptGeneratedProtonAxEPos"), pMC.Pt()); + } else { + histos.fill(HIST("ptGeneratedProtonAxENeg"), pMC.Pt()); + } + } + } + histos.fill(HIST("hVisibleMultiVsGeneratedMulti"), counterMC, counter); + } + PROCESS_SWITCH(AnalysisMCDPMJetSGv3, processSim, "processSim", true); + + void processReco(CC const& collision, + TCs const& tracks, + // aod::UDMcCollisions const& /*mccollisions*/, + aod::UDMcParticles const& mcParticles) + { + histos.fill(HIST("numberOfRecoCollisions"), 88.); // number of times coll was reco-ed + histos.fill(HIST("numberOfRecoCollisions"), collision.size()); // number of times coll was reco-ed + histos.fill(HIST("numberOfRecoCollisions2"), mcParticles.size()); + Partition pvContributors = aod::udtrack::isPVContributor == true; + pvContributors.bindTable(tracks); + + // auto massPion = 0.; + // TParticlePDG pionPDG = fPDG->GetParticle(codePion); + // massPion = pionPDG.Mass(); + // auto massKaon = 0.; + // TParticlePDG kaonPDG = fPDG->GetParticle(codeKaon); + // massKaon = kaonPDG.Mass(); + // auto massProton = 0.; + // TParticlePDG protonPDG = fPDG->GetParticle(codeProton); + // massProton = protonPDG.Mass(); + + histos.fill(HIST("numberOfTracksReco"), tracks.size()); + // double etaMax = 0.8; + double yMax = 0.8; + double sigmaMax = 3.; + double ptMin = 0.1; + int nFindableMin = 70; + double dcaZlimit = 2.; + + // int counter = 0; + for (const auto& track : tracks) { + if (track.isPVContributor()) { + int nFindable = track.tpcNClsFindable(); + if (nFindable < nFindableMin) { + continue; + } + // int NMinusFound = track.tpcNClsFindableMinusFound(); + // int NCluster = NFindable - NMinusFound; + // if (NCluster < 70) { + // continue; + // } + if (track.pt() < ptMin) { + continue; + } + if (!(std::abs(track.dcaZ()) < dcaZlimit)) { + continue; + } + double dcaLimit = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); + if (!(std::abs(track.dcaXY()) < dcaLimit)) { + continue; + } + + double momentum = std::sqrt(track.px() * track.px() + track.py() * track.py() + track.pz() * track.pz()); + double dEdx = track.tpcSignal(); + histos.fill(HIST("hdEdx"), momentum, dEdx); + + LorentzVectorM pion(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); + LorentzVectorM kaon(track.px(), track.py(), track.pz(), o2::constants::physics::MassKaonCharged); + LorentzVectorM proton(track.px(), track.py(), track.pz(), o2::constants::physics::MassProton); + auto nSigmaPi = -999.; + auto nSigmaKa = -999.; + auto nSigmaPr = -999.; + auto nSigmaPiTOF = -999.; + auto nSigmaKaTOF = -999.; + auto nSigmaPrTOF = -999.; + // This section makes templates + if (track.hasTPC()) { + nSigmaPi = track.tpcNSigmaPi(); + nSigmaKa = track.tpcNSigmaKa(); + nSigmaPr = track.tpcNSigmaPr(); + if (std::abs(nSigmaPi) < sigmaMax && std::abs(pion.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaPion"), track.pt(), nSigmaPi); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + // if(abs(mcParticle.pdgCode())==codePion && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1; + if (std::abs(mcParticle.pdgCode()) == codePion) { + histos.fill(HIST("hSigmaPionTruth"), track.pt(), nSigmaPi); + histos.fill(HIST("allreconstructedPFPion"), track.pt()); + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedPion"), track.pt()); + } + } + } + } + if (std::abs(nSigmaKa) < sigmaMax && std::abs(kaon.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaKaon"), track.pt(), nSigmaKa); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + if (std::abs(mcParticle.pdgCode()) == codeKaon) { + histos.fill(HIST("hSigmaKaonTruth"), track.pt(), nSigmaKa); + histos.fill(HIST("allreconstructedPFKaon"), track.pt()); + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedKaon"), track.pt()); + } + } + } + } + if (std::abs(nSigmaPr) < sigmaMax && std::abs(proton.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaProton"), track.pt(), nSigmaPr); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + if (std::abs(mcParticle.pdgCode()) == codeProton) { + histos.fill(HIST("hSigmaProtonTruth"), track.pt(), nSigmaPr); + histos.fill(HIST("allreconstructedPFProton"), track.pt()); + if (mcParticle.pdgCode() == codeProton) { + histos.fill(HIST("allreconstructedPFProtonPos"), track.pt()); + } else { + histos.fill(HIST("allreconstructedPFProtonNeg"), track.pt()); + } + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedProton"), track.pt()); + if (mcParticle.pdgCode() == codeProton) { + histos.fill(HIST("ptReconstructedProtonPos"), track.pt()); + } else { + histos.fill(HIST("ptReconstructedProtonNeg"), track.pt()); + } + } + } + } + } + } + if (track.hasTPC() && track.hasTOF()) { + // if (track.hasTOF()) { + nSigmaPiTOF = track.tofNSigmaPi(); + nSigmaKaTOF = track.tofNSigmaKa(); + nSigmaPrTOF = track.tofNSigmaPr(); + if (std::abs(nSigmaPiTOF) < sigmaMax && std::abs(pion.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaPionTOF"), track.pt(), nSigmaPiTOF); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + // if(abs(mcParticle.pdgCode())==codePion && mcParticle.isPhysicalPrimary()) howManyPionsHavePionMCandPrimaries += 1; + if (std::abs(mcParticle.pdgCode()) == codePion) { + histos.fill(HIST("hSigmaPionTruthTOF"), track.pt(), nSigmaPiTOF); + histos.fill(HIST("allreconstructedPFPionTOF"), track.pt()); + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedPionTOF"), track.pt()); + } + } + } + } + if (std::abs(nSigmaKaTOF) < sigmaMax && std::abs(kaon.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaKaonTOF"), track.pt(), nSigmaKaTOF); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + if (std::abs(mcParticle.pdgCode()) == codeKaon) { + histos.fill(HIST("hSigmaKaonTruthTOF"), track.pt(), nSigmaKaTOF); + histos.fill(HIST("allreconstructedPFKaonTOF"), track.pt()); + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedKaonTOF"), track.pt()); + } + } + } + } + if (std::abs(nSigmaPrTOF) < sigmaMax && std::abs(proton.Rapidity()) < yMax) { + histos.fill(HIST("hSigmaProtonTOF"), track.pt(), nSigmaPrTOF); + if (track.has_udMcParticle()) { + auto mcParticle = track.udMcParticle(); + if (std::abs(mcParticle.pdgCode()) == codeProton) { + histos.fill(HIST("hSigmaProtonTruthTOF"), track.pt(), nSigmaPrTOF); + histos.fill(HIST("allreconstructedPFProtonTOF"), track.pt()); + if (mcParticle.isPhysicalPrimary()) { + histos.fill(HIST("ptReconstructedProtonTOF"), track.pt()); + } + } + } + } + } + // counter++; + // histos.fill(HIST("hVisibleMultiVsGeneratedMulti"), counterMC, counter); + // histos.fill(HIST("hVisibleMultiVsGeneratedMulti"), mcParticles.size(), counter); + } + } // track loop + + // } // collision loop + } + PROCESS_SWITCH(AnalysisMCDPMJetSGv3, processReco, "processReco", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 844e127fec4262b979c9f8a5e5ff8661ae46353f Mon Sep 17 00:00:00 2001 From: Jesper Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Thu, 12 Jun 2025 08:55:36 +0200 Subject: [PATCH 031/116] [ALICE3] Remove subscription to MCharmIndices (#11557) --- ALICE3/Tasks/alice3-multicharm.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 34276a800b3..2b6ad804ddf 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -57,7 +57,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using multicharmtracks = soa::Join; +// using multicharmtracks = soa::Join; struct alice3multicharm { SliceCache cache; @@ -134,7 +134,7 @@ struct alice3multicharm { histos.add("h3dXicc", "h3dXicc; Xicc pT (GeV/#it(c)); Xicc #eta; Xicc mass (GeV/#it(c)^{2})", kTH3D, {axisPt, axisEta, axisXiccMass}); } - void processXicc(multicharmtracks const& multiCharmTracks) + void processXicc(aod::MCharmCores const& multiCharmTracks) { for (const auto& xiccCand : multiCharmTracks) { if (xiccCand.xicDauDCA() > xicMaxDauDCA || xiccCand.xiccDauDCA() > xiccMaxDauDCA) From e63bb0371138c30616d8e63f19ad803c25004988 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 12 Jun 2025 09:15:28 +0200 Subject: [PATCH 032/116] [PWGLF] Add option to disable SV radius cut for kink (#11541) --- PWGLF/TableProducer/Common/kinkBuilder.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Common/kinkBuilder.cxx b/PWGLF/TableProducer/Common/kinkBuilder.cxx index d2b25be26a0..51be861741a 100644 --- a/PWGLF/TableProducer/Common/kinkBuilder.cxx +++ b/PWGLF/TableProducer/Common/kinkBuilder.cxx @@ -106,6 +106,7 @@ struct kinkBuilder { Configurable etaMax{"etaMax", 1., "eta daughter"}; 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"}; o2::vertexing::DCAFitterN<2> fitter; o2::base::MatLayerCylSet* lut = nullptr; @@ -329,7 +330,7 @@ struct kinkBuilder { // cut on decay radius to 17 cm float decRad2 = kinkCand.decVtx[0] * kinkCand.decVtx[0] + kinkCand.decVtx[1] * kinkCand.decVtx[1]; - if (decRad2 < LayerRadii[3] * LayerRadii[3]) { + if (doSVRadiusCut && decRad2 < LayerRadii[3] * LayerRadii[3]) { continue; } @@ -348,11 +349,11 @@ struct kinkBuilder { } } - if (lastLayerMoth >= firstLayerDaug) { + if (doSVRadiusCut && lastLayerMoth >= firstLayerDaug) { continue; } - if (decRad2 < LayerRadii[lastLayerMoth] * LayerRadii[lastLayerMoth]) { + if (doSVRadiusCut && decRad2 < LayerRadii[lastLayerMoth] * LayerRadii[lastLayerMoth]) { continue; } From 2fd49aab769d64a7dac561cbf607b5f4639a751c Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Thu, 12 Jun 2025 09:15:44 +0200 Subject: [PATCH 033/116] [PWGLF] Update hypertriton 3body decay analysis (#11512) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/Reduced3BodyTables.h | 28 +- PWGLF/DataModel/Vtx3BodyTables.h | 783 ++-- PWGLF/TableProducer/Nuspex/CMakeLists.txt | 17 +- .../Nuspex/decay3bodybuilder.cxx | 3334 ++++++----------- .../Nuspex/hypertriton3bodyfinder.cxx | 1197 ------ .../Nuspex/reduced3bodyCreator.cxx | 61 +- .../TableProducer/Nuspex/threebodyKFTask.cxx | 488 --- .../Nuspex/threebodyRecoTask.cxx | 909 ----- PWGLF/Tasks/Nuspex/CMakeLists.txt | 10 - PWGLF/Tasks/Nuspex/hypertriton3bodyMcqa.cxx | 908 ----- .../Tasks/Nuspex/hypertriton3bodyanalysis.cxx | 797 ---- PWGLF/Utils/decay3bodyBuilderHelper.h | 838 +++++ 12 files changed, 2219 insertions(+), 7151 deletions(-) delete mode 100644 PWGLF/TableProducer/Nuspex/hypertriton3bodyfinder.cxx delete mode 100644 PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx delete mode 100644 PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx delete mode 100644 PWGLF/Tasks/Nuspex/hypertriton3bodyMcqa.cxx delete mode 100644 PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx create mode 100644 PWGLF/Utils/decay3bodyBuilderHelper.h diff --git a/PWGLF/DataModel/Reduced3BodyTables.h b/PWGLF/DataModel/Reduced3BodyTables.h index 51fff63c81d..aeabfb92c0b 100644 --- a/PWGLF/DataModel/Reduced3BodyTables.h +++ b/PWGLF/DataModel/Reduced3BodyTables.h @@ -83,6 +83,7 @@ DECLARE_SOA_TABLE_FULL(StoredRedIUTracks, "RedIUTracks", "AOD", "REDIUTRACK", // // tracks extra track::PIDForTracking, track::IsPVContributor, + track::HasITS, track::HasTPC, track::HasTOF, track::TPCNClsFound, @@ -120,29 +121,22 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Track0, track0, int, RedIUTracks, "_0"); //! DECLARE_SOA_INDEX_COLUMN_FULL(Track1, track1, int, RedIUTracks, "_1"); //! Track 1 index DECLARE_SOA_INDEX_COLUMN_FULL(Track2, track2, int, RedIUTracks, "_2"); //! Track 2 index DECLARE_SOA_INDEX_COLUMN_FULL(Collision, collision, int, RedCollisions, ""); //! Collision index -DECLARE_SOA_COLUMN(Phi, phi, float); //! decay3body radius -DECLARE_SOA_COLUMN(Radius, radius, float); //! decay3body phi -DECLARE_SOA_COLUMN(PosZ, posz, float); //! decay3body z position +DECLARE_SOA_COLUMN(RadiusKF, radiusKF, float); //! phi of momentum of mother particle calculated by KF +DECLARE_SOA_COLUMN(PhiKF, phiKF, float); //! SV radius in x-y plane calculated by KF +DECLARE_SOA_COLUMN(PosZKF, poszKF, float); //! z position of SV calculated by KF +DECLARE_SOA_COLUMN(RadiusDCA, radiusDCA, float); //! phi of momentum of mother particle calculated by dcaFitter +DECLARE_SOA_COLUMN(PhiDCA, phiDCA, float); //! SV radius in x-y plane calculated by dcaFitter +DECLARE_SOA_COLUMN(PosZDCA, poszDCA, float); //! z position of SV calculated by dcaFitter +DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, float); //! average ITS cluster size (if tracked) } // namespace reduceddecay3body DECLARE_SOA_TABLE(RedDecay3Bodys, "AOD", "REDDECAY3BODY", //! reduced 3-body decay table o2::soa::Index<>, reduceddecay3body::CollisionId, reduceddecay3body::Track0Id, reduceddecay3body::Track1Id, reduceddecay3body::Track2Id); -using ReducedDecay3BodysLinked = soa::Join; -using ReducedDecay3BodyLinked = ReducedDecay3BodysLinked::iterator; - DECLARE_SOA_TABLE(Red3BodyInfo, "AOD", "RED3BODYINFO", //! joinable with RedDecay3Bodys - reduceddecay3body::Radius, reduceddecay3body::Phi, reduceddecay3body::PosZ); - -namespace dcafittersvinfo -{ -DECLARE_SOA_COLUMN(SVRadius, svRadius, float); //! SV radius in x-y plane calculated by dcaFitter -DECLARE_SOA_COLUMN(MomPhi, momPhi, float); //! phi of momentum of mother particle calculated from dcaFitter -DECLARE_SOA_COLUMN(SVPosZ, svPosZ, float); //! z position of SV calculated by dcaFitter -} // namespace dcafittersvinfo - -DECLARE_SOA_TABLE_FULL(DCAFitterSVInfo, "FitSVInfo", "AOD", "FITSVINFO", //! joinable with RedDecay3Bodys - dcafittersvinfo::SVRadius, dcafittersvinfo::MomPhi, dcafittersvinfo::SVPosZ); + reduceddecay3body::RadiusKF, reduceddecay3body::PhiKF, reduceddecay3body::PosZKF, + reduceddecay3body::RadiusDCA, reduceddecay3body::PhiDCA, reduceddecay3body::PosZDCA, + reduceddecay3body::TrackedClSize); } // namespace o2::aod diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index 9ae43bb0255..f03dfa8254c 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file Vtx3BodyTables.h -/// \brief Definitions of reduced tables for 3body decayed hypertriton +/// \brief Definitions of analysis tables for 3body decayed hypertriton /// \author Yuanzhe Wang /// \author Carolina Reetz @@ -26,48 +26,117 @@ namespace o2::aod { namespace vtx3body { -DECLARE_SOA_INDEX_COLUMN_FULL(Track0, track0, int, Tracks, "_0"); //! -DECLARE_SOA_INDEX_COLUMN_FULL(Track1, track1, int, Tracks, "_1"); //! -DECLARE_SOA_INDEX_COLUMN_FULL(Track2, track2, int, Tracks, "_2"); //! +// indices +DECLARE_SOA_INDEX_COLUMN_FULL(TrackPr, trackPr, int, Tracks, "_pr"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(TrackPi, trackPi, int, Tracks, "_pi"); //! +DECLARE_SOA_INDEX_COLUMN_FULL(TrackDe, trackDe, int, Tracks, "_de"); //! DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! DECLARE_SOA_INDEX_COLUMN(Decay3Body, decay3body); //! -// General 3 body Vtx properties: position, momentum -DECLARE_SOA_COLUMN(PxTrack0, pxtrack0, float); //! track0 px at min -DECLARE_SOA_COLUMN(PyTrack0, pytrack0, float); //! track0 py at min -DECLARE_SOA_COLUMN(PzTrack0, pztrack0, float); //! track0 pz at min -DECLARE_SOA_COLUMN(PxTrack1, pxtrack1, float); //! track1 px at min -DECLARE_SOA_COLUMN(PyTrack1, pytrack1, float); //! track1 py at min -DECLARE_SOA_COLUMN(PzTrack1, pztrack1, float); //! track1 pz at min -DECLARE_SOA_COLUMN(PxTrack2, pxtrack2, float); //! track2 px at min -DECLARE_SOA_COLUMN(PyTrack2, pytrack2, float); //! track2 py at min -DECLARE_SOA_COLUMN(PzTrack2, pztrack2, float); //! track2 pz at min -DECLARE_SOA_COLUMN(X, x, float); //! decay position X -DECLARE_SOA_COLUMN(Y, y, float); //! decay position Y -DECLARE_SOA_COLUMN(Z, z, float); //! decay position Z - -// Saved from finding: DCAs -DECLARE_SOA_COLUMN(DCAVtxDaughters, dcaVtxdaughters, float); //! DCA among daughters -DECLARE_SOA_COLUMN(DCAXYTrack0ToPV, dcaXYtrack0topv, float); //! DCAXY of prong0 to PV -DECLARE_SOA_COLUMN(DCAXYTrack1ToPV, dcaXYtrack1topv, float); //! DCAXY of prong1 to PV -DECLARE_SOA_COLUMN(DCAXYTrack2ToPV, dcaXYtrack2topv, float); //! DCAXY of prong2 to PV -DECLARE_SOA_COLUMN(DCATrack0ToPV, dcatrack0topv, float); //! DCA of prong0 to PV -DECLARE_SOA_COLUMN(DCATrack1ToPV, dcatrack1topv, float); //! DCA of prong1 to PV -DECLARE_SOA_COLUMN(DCATrack2ToPV, dcatrack2topv, float); //! DCA of prong2 to PV - -// Recalculated TOF PID information of bachelor -DECLARE_SOA_COLUMN(TOFNSigmaBachDe, tofNSigmaBachDe, float); //! Recalculated Nsigma seperation with TOF for deuteron +// General 3 body Vtx properties +DECLARE_SOA_COLUMN(Mass, mass, float); //! candidate mass (with H3L or Anti-H3L mass hypothesis depending on deuteron charge) +DECLARE_SOA_COLUMN(Sign, sign, float); //! candidate sign +DECLARE_SOA_COLUMN(X, x, float); //! decay position X +DECLARE_SOA_COLUMN(Y, y, float); //! decay position Y +DECLARE_SOA_COLUMN(Z, z, float); //! decay position Z +DECLARE_SOA_COLUMN(Px, px, float); //! momentum X +DECLARE_SOA_COLUMN(Py, py, float); //! momentum Y +DECLARE_SOA_COLUMN(Pz, pz, float); //! momentum Z +DECLARE_SOA_COLUMN(Chi2, chi2, float); //! KFParticle: chi2geo/ndf or chi2topo/ndf of vertex fit, DCA fitter: Chi2AtPCACandidate value + +// daughter properties +DECLARE_SOA_COLUMN(MassV0, massV0, float); //! V0 mass (with H3L or Anti-H3L mass hypothesis depending on deuteron charge) +DECLARE_SOA_COLUMN(PxTrackPr, pxTrackPr, float); //! track0 px at min +DECLARE_SOA_COLUMN(PyTrackPr, pyTrackPr, float); //! track0 py at min +DECLARE_SOA_COLUMN(PzTrackPr, pzTrackPr, float); //! track0 pz at min +DECLARE_SOA_COLUMN(PxTrackPi, pxTrackPi, float); //! track1 px at min +DECLARE_SOA_COLUMN(PyTrackPi, pyTrackPi, float); //! track1 py at min +DECLARE_SOA_COLUMN(PzTrackPi, pzTrackPi, float); //! track1 pz at min +DECLARE_SOA_COLUMN(PxTrackDe, pxTrackDe, float); //! track2 px at min +DECLARE_SOA_COLUMN(PyTrackDe, pyTrackDe, float); //! track2 py at min +DECLARE_SOA_COLUMN(PzTrackDe, pzTrackDe, float); //! track2 pz at min + +// DCAs to PV +DECLARE_SOA_COLUMN(DCAXYTrackPrToPV, dcaXYtrackPrToPv, float); //! DCAXY of proton to PV +DECLARE_SOA_COLUMN(DCAXYTrackPiToPV, dcaXYtrackPiToPv, float); //! DCAXY of pion to PV +DECLARE_SOA_COLUMN(DCAXYTrackDeToPV, dcaXYtrackDeToPv, float); //! DCAXY of deuteron to PV +DECLARE_SOA_COLUMN(DCAZTrackPrToPV, dcaZtrackPrToPv, float); //! DCAZ of proton to PV +DECLARE_SOA_COLUMN(DCAZTrackPiToPV, dcaZtrackPiToPv, float); //! DCAZ of pion to PV +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 + +// Strangeness tracking +DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, float); //! Average ITS cluster size of strangeness tracked 3body + +// PID +DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, float); //! nsigma proton of TPC PID of the proton daughter +DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, float); //! nsigma pion of TPC PID of the pion daughter +DECLARE_SOA_COLUMN(TPCNSigmaDe, tpcNSigmaDe, float); //! nsigma deuteron of TPC PID of the bachelor daughter +DECLARE_SOA_COLUMN(TPCNSigmaPiBach, tpcNSigmaPiBach, float); //! nsigma pion of TPC PID of the bachelor daughter +DECLARE_SOA_COLUMN(TOFNSigmaDe, tofNSigmaDe, float); //! nsigma deuteron of TOF PID of the bachelor daughter +DECLARE_SOA_COLUMN(PIDTrackingDe, pidTrackingDe, uint32_t); //! PID during tracking of bachelor daughter + +// Daughter track quality +DECLARE_SOA_COLUMN(TPCNClTrackPr, tpcNClTrackPr, int); //! Number of TPC clusters of proton daughter +DECLARE_SOA_COLUMN(TPCNClTrackPi, tpcNClTrackPi, int); //! Number of TPC clusters of pion daughter +DECLARE_SOA_COLUMN(TPCNClTrackDe, tpcNClTrackDe, int); //! Number of TPC clusters of deuteron daughter +DECLARE_SOA_COLUMN(ITSClSizePr, itsClsizePr, double); //! average ITS cluster size of proton daughter +DECLARE_SOA_COLUMN(ITSClSizePi, itsClsizePi, double); //! average ITS cluster size of pion daughter +DECLARE_SOA_COLUMN(ITSClSizeDe, itsClsizeDe, double); //! average ITS cluster size of deuteron daughter + +// Covariance matrices +DECLARE_SOA_COLUMN(CovProton, covProton, float[21]); //! covariance matrix elements of proton daughter track +DECLARE_SOA_COLUMN(CovPion, covPion, float[21]); //! covariance matrix elements of pion daughter track +DECLARE_SOA_COLUMN(CovDeuteron, covDeuteron, float[21]); //! covariance matrix elements of deuteron daughter track +DECLARE_SOA_COLUMN(VtxCovMat, vtxCovMat, float[21]); //! covariance matrix elements of candidate + +// Monte Carlo info +DECLARE_SOA_COLUMN(GenPx, genPx, float); // generated Px of the hypertriton in GeV/c +DECLARE_SOA_COLUMN(GenPy, genPy, float); // generated Py of the hypertriton in GeV/c +DECLARE_SOA_COLUMN(GenPz, genPz, float); // generated Pz of the hypertriton in GeV/c +DECLARE_SOA_COLUMN(GenX, genX, float); // generated decay vtx position X of the hypertriton +DECLARE_SOA_COLUMN(GenY, genY, float); // generated decay vtx position Y of the hypertriton +DECLARE_SOA_COLUMN(GenZ, genZ, float); // generated decay vtx position Z of the hypertriton +DECLARE_SOA_COLUMN(GenCt, genCt, float); // generated Ct of the hypertriton +DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // generated Phi of the hypertriton +DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton +DECLARE_SOA_COLUMN(GenRap, genRap, float); // generated rapidity of the hypertriton +DECLARE_SOA_COLUMN(GenPPr, genPPr, float); //! generated momentum proton daughter particle +DECLARE_SOA_COLUMN(GenPPi, genPPi, float); //! generated momentum pion daughter particle +DECLARE_SOA_COLUMN(GenPDe, genPDe, float); //! generated momentum deuteron daughter particle +DECLARE_SOA_COLUMN(GenPtPr, genPtPr, float); //! generated transverse momentum proton daughter particle +DECLARE_SOA_COLUMN(GenPtPi, genPtPi, float); //! generated transverse momentum pion daughter particle +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(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 +DECLARE_SOA_COLUMN(IsDePrimary, isDePrimary, bool); //! flag for deuteron daughter primary +DECLARE_SOA_COLUMN(IsSurvEvSel, isSurvEvSel, int); //! flag if reco collision survived event selection +DECLARE_SOA_COLUMN(IsReco, isreco, int); //! flag if candidate was reconstructed // Derived expressions // Momenta -DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! 3 body p - [](float pxtrack0, float pytrack0, float pztrack0, float pxtrack1, float pytrack1, float pztrack1, float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::sqrtSumOfSquares(pxtrack0 + pxtrack1 + pxtrack2, pytrack0 + pytrack1 + pytrack2, pztrack0 + pztrack1 + pztrack2); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! 3 body pT - [](float pxtrack0, float pytrack0, float pxtrack1, float pytrack1, float pxtrack2, float pytrack2) -> float { return RecoDecay::sqrtSumOfSquares(pxtrack0 + pxtrack1 + pxtrack2, pytrack0 + pytrack1 + pytrack2); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! 3 body pT in GeV/c + [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! 3 body total momentum in GeV/c + [](float px, float py, float pz) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz); }); +DECLARE_SOA_DYNAMIC_COLUMN(GenPt, genPt, //! 3 body pT in GeV/c + [](float genPx, float genPy) -> float { return RecoDecay::sqrtSumOfSquares(genPx, genPy); }); +DECLARE_SOA_DYNAMIC_COLUMN(GenP, genP, //! 3 body total momentum in GeV/c + [](float genPx, float genPy, float genPz) -> float { return RecoDecay::sqrtSumOfSquares(genPx, genPy, genPz); }); // Length quantities DECLARE_SOA_DYNAMIC_COLUMN(VtxRadius, vtxradius, //! 3 body decay radius (2D, centered at zero) [](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); }); +DECLARE_SOA_DYNAMIC_COLUMN(GenRadius, genRadius, //! 3 body decay radius (2D, centered at zero) + [](float genX, float genY) -> float { return RecoDecay::sqrtSumOfSquares(genX, genY); }); // Distance Over To Mom DECLARE_SOA_DYNAMIC_COLUMN(DistOverTotMom, distovertotmom, //! PV to 3 body decay distance over total momentum @@ -79,6 +148,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(DistOverTotMom, distovertotmom, //! PV to 3 body deca // CosPA DECLARE_SOA_DYNAMIC_COLUMN(VtxCosPA, vtxcosPA, //! 3 body vtx CosPA [](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) -> float { return RecoDecay::cpa(std::array{pvX, pvY, pvZ}, std::array{X, Y, Z}, std::array{Px, Py, Pz}); }); + // Dca to PV DECLARE_SOA_DYNAMIC_COLUMN(DCAVtxToPV, dcavtxtopv, //! DCA of 3 body vtx to PV [](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) -> float { return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); }); @@ -89,532 +159,151 @@ DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, //! 3 body vtx eta DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! 3 body vtx phi [](float Px, float Py) -> float { return RecoDecay::phi(Px, Py); }); -// Calculated on the fly with mother particle hypothesis -DECLARE_SOA_DYNAMIC_COLUMN(MHypertriton, mHypertriton, //! mass under Hypertriton hypothesis - [](float pxtrack0, float pytrack0, float pztrack0, float pxtrack1, float pytrack1, float pztrack1, float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::m(std::array{std::array{pxtrack0, pytrack0, pztrack0}, std::array{pxtrack1, pytrack1, pztrack1}, std::array{pxtrack2, pytrack2, pztrack2}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); }); -DECLARE_SOA_DYNAMIC_COLUMN(MAntiHypertriton, mAntiHypertriton, //! mass under antiHypertriton hypothesis - [](float pxtrack0, float pytrack0, float pztrack0, float pxtrack1, float pytrack1, float pztrack1, float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::m(std::array{std::array{pxtrack0, pytrack0, pztrack0}, std::array{pxtrack1, pytrack1, pztrack1}, std::array{pxtrack2, pytrack2, pztrack2}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); }); - -DECLARE_SOA_DYNAMIC_COLUMN(MHyperHelium4, mHyperHelium4, //! mass under HyperHelium4 hypothesis - [](float pxtrack0, float pytrack0, float pztrack0, float pxtrack1, float pytrack1, float pztrack1, float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::m(std::array{std::array{pxtrack0, pytrack0, pztrack0}, std::array{pxtrack1, pytrack1, pztrack1}, std::array{pxtrack2, pytrack2, pztrack2}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); }); -DECLARE_SOA_DYNAMIC_COLUMN(MAntiHyperHelium4, mAntiHyperHelium4, //! mass under antiHyperHelium4 hypothesis - [](float pxtrack0, float pytrack0, float pztrack0, float pxtrack1, float pytrack1, float pztrack1, float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::m(std::array{std::array{pxtrack0, pytrack0, pztrack0}, std::array{pxtrack1, pytrack1, pztrack1}, std::array{pxtrack2, pytrack2, pztrack2}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassHelium3}); }); - -DECLARE_SOA_DYNAMIC_COLUMN(YHypertriton, yHypertriton, //! 3 body vtx y with hypertriton or antihypertriton hypothesis +// Rapidity +DECLARE_SOA_DYNAMIC_COLUMN(Rap, rap, //! 3 body vtx y with hypertriton or antihypertriton hypothesis [](float Px, float Py, float Pz) -> float { return RecoDecay::y(std::array{Px, Py, Pz}, o2::constants::physics::MassHyperTriton); }); -DECLARE_SOA_DYNAMIC_COLUMN(YHyperHelium4, yHyperHelium4, //! 3 body vtx y with hyperhelium4 or antihyperhelium4 hypothesis - [](float Px, float Py, float Pz) -> float { return RecoDecay::y(std::array{Px, Py, Pz}, o2::constants::physics::MassHyperHelium4); }); - -// kinematic information of daughter tracks -DECLARE_SOA_DYNAMIC_COLUMN(Track0Pt, track0pt, //! daughter0 pT - [](float pxtrack0, float pytrack0) -> float { return RecoDecay::sqrtSumOfSquares(pxtrack0, pytrack0); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track1Pt, track1pt, //! daughter1 pT - [](float pxtrack1, float pytrack1) -> float { return RecoDecay::sqrtSumOfSquares(pxtrack1, pytrack1); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track2Pt, track2pt, //! daughter2 pT - [](float pxtrack2, float pytrack2) -> float { return RecoDecay::sqrtSumOfSquares(pxtrack2, pytrack2); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track0Eta, track0eta, //! daughter0 eta - [](float pxtrack0, float pytrack0, float pztrack0) -> float { return RecoDecay::eta(std::array{pxtrack0, pytrack0, pztrack0}); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track0Phi, track0phi, //! daughter0 phi - [](float pxtrack0, float pytrack0) -> float { return RecoDecay::phi(pxtrack0, pytrack0); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track1Eta, track1eta, //! daughter1 eta - [](float pxtrack1, float pytrack1, float pztrack1) -> float { return RecoDecay::eta(std::array{pxtrack1, pytrack1, pztrack1}); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track1Phi, track1phi, //! daughter1 phi - [](float pxtrack1, float pytrack1) -> float { return RecoDecay::phi(pxtrack1, pytrack1); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track2Eta, track2eta, //! daughter2 eta - [](float pxtrack2, float pytrack2, float pztrack2) -> float { return RecoDecay::eta(std::array{pxtrack2, pytrack2, pztrack2}); }); -DECLARE_SOA_DYNAMIC_COLUMN(Track2Phi, track2phi, //! daughter2 phi - [](float pxtrack2, float pytrack2) -> float { return RecoDecay::phi(pxtrack2, pytrack2); }); - -DECLARE_SOA_EXPRESSION_COLUMN(Px, px, //! 3 body vtx px - float, 1.f * aod::vtx3body::pxtrack0 + 1.f * aod::vtx3body::pxtrack1 + 1.f * aod::vtx3body::pxtrack2); -DECLARE_SOA_EXPRESSION_COLUMN(Py, py, //! 3 body vtx py - float, 1.f * aod::vtx3body::pytrack0 + 1.f * aod::vtx3body::pytrack1 + 1.f * aod::vtx3body::pytrack2); -DECLARE_SOA_EXPRESSION_COLUMN(Pz, pz, //! 3 body vtx pz - float, 1.f * aod::vtx3body::pztrack0 + 1.f * aod::vtx3body::pztrack1 + 1.f * aod::vtx3body::pztrack2); -} // namespace vtx3body - -DECLARE_SOA_TABLE_FULL(StoredVtx3BodyDatas, "Vtx3BodyDatas", "AOD", "Vtx3BodyDATA", //! - o2::soa::Index<>, vtx3body::Track0Id, vtx3body::Track1Id, vtx3body::Track2Id, vtx3body::CollisionId, vtx3body::Decay3BodyId, - vtx3body::X, vtx3body::Y, vtx3body::Z, - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, - vtx3body::DCAVtxDaughters, - vtx3body::DCAXYTrack0ToPV, vtx3body::DCAXYTrack1ToPV, vtx3body::DCAXYTrack2ToPV, - vtx3body::DCATrack0ToPV, vtx3body::DCATrack1ToPV, vtx3body::DCATrack2ToPV, - vtx3body::TOFNSigmaBachDe, - - // Dynamic columns - vtx3body::P, - vtx3body::Pt, - vtx3body::VtxRadius, - vtx3body::DistOverTotMom, - vtx3body::VtxCosPA, - vtx3body::DCAVtxToPV, - - // Invariant masses - vtx3body::MHypertriton, - vtx3body::MAntiHypertriton, - vtx3body::MHyperHelium4, - vtx3body::MAntiHyperHelium4, - - // Longitudinal - vtx3body::YHypertriton, - vtx3body::YHyperHelium4, - vtx3body::Eta, - vtx3body::Phi, - vtx3body::Track0Pt, - vtx3body::Track0Eta, - vtx3body::Track0Phi, - vtx3body::Track1Pt, - vtx3body::Track1Eta, - vtx3body::Track1Phi, - vtx3body::Track2Pt, - vtx3body::Track2Eta, - vtx3body::Track2Phi); - -// extended table with expression columns that can be used as arguments of dynamic columns -DECLARE_SOA_EXTENDED_TABLE_USER(Vtx3BodyDatas, StoredVtx3BodyDatas, "Vtx3BodyDATAEXT", //! - vtx3body::Px, vtx3body::Py, vtx3body::Pz); - -using Vtx3BodyData = Vtx3BodyDatas::iterator; -namespace vtx3body -{ -DECLARE_SOA_INDEX_COLUMN(Vtx3BodyData, vtx3BodyData); //! Index to Vtx3BodyData entry -} - -DECLARE_SOA_TABLE(Decay3BodyDataLink, "AOD", "DECAY3BODYLINK", //! Joinable table with Decay3bodys which links to Vtx3BodyData which is not produced for all entries - vtx3body::Vtx3BodyDataId); - -using Decay3BodysLinked = soa::Join; -using Decay3BodyLinked = Decay3BodysLinked::iterator; - -// Definition of labels for Vtx3BodyDatas -namespace mcvtx3bodylabel -{ -DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Vtx3BodyDatas -} // namespace mcvtx3bodylabel - -DECLARE_SOA_TABLE(McVtx3BodyLabels, "AOD", "MCVTXLABEL", //! Table joinable with Vtx3BodyData containing the MC labels - mcvtx3bodylabel::McParticleId); -using McVtx3BodyLabel = McVtx3BodyLabels::iterator; -// Definition of labels for Decay3Bodys // Full table, joinable with Decay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA) -namespace mcfullvtx3bodylabel -{ -DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Decay3Bodys -} // namespace mcfullvtx3bodylabel - -DECLARE_SOA_TABLE(McFullVtx3BodyLabels, "AOD", "MCFULLVTXLABEL", //! Table joinable with Decay3Bodys - mcfullvtx3bodylabel::McParticleId); -using McFullVtx3BodyLabel = McFullVtx3BodyLabels::iterator; +// Kinematic information of daughter tracks +DECLARE_SOA_DYNAMIC_COLUMN(TrackPrPt, trackPrPt, //! daughter0 pT + [](float pxTrackPr, float pyTrackPr) -> float { return RecoDecay::sqrtSumOfSquares(pxTrackPr, pyTrackPr); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackPiPt, trackPiPt, //! daughter1 pT + [](float pxTrackPi, float pyTrackPi) -> float { return RecoDecay::sqrtSumOfSquares(pxTrackPi, pyTrackPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackDePt, trackDePt, //! daughter2 pT + [](float pxTrackDe, float pyTrackDe) -> float { return RecoDecay::sqrtSumOfSquares(pxTrackDe, pyTrackDe); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackPrEta, trackPrEta, //! daughter0 eta + [](float pxTrackPr, float pyTrackPr, float pzTrackPr) -> float { return RecoDecay::eta(std::array{pxTrackPr, pyTrackPr, pzTrackPr}); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackPrPhi, trackPrPhi, //! daughter0 phi + [](float pxTrackPr, float pyTrackPr) -> float { return RecoDecay::phi(pxTrackPr, pyTrackPr); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackPiEta, trackPiEta, //! daughter1 eta + [](float pxTrackPi, float pyTrackPi, float pzTrackPi) -> float { return RecoDecay::eta(std::array{pxTrackPi, pyTrackPi, pzTrackPi}); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackPiPhi, trackPiPhi, //! daughter1 phi + [](float pxTrackPi, float pyTrackPi) -> float { return RecoDecay::phi(pxTrackPi, pyTrackPi); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackDeEta, trackDeEta, //! daughter2 eta + [](float pxTrackDe, float pyTrackDe, float pzTrackDe) -> float { return RecoDecay::eta(std::array{pxTrackDe, pyTrackDe, pzTrackDe}); }); +DECLARE_SOA_DYNAMIC_COLUMN(TrackDePhi, trackDePhi, //! daughter2 phi + [](float pxTrackDe, float pyTrackDe) -> float { return RecoDecay::phi(pxTrackDe, pyTrackDe); }); +} // namespace vtx3body -// output table for ML studies -namespace hyp3body -{ -// collision -DECLARE_SOA_COLUMN(Centrality, centrality, float); //! centrality -// reconstruced candidate -DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); //! bool: true for matter -DECLARE_SOA_COLUMN(M, m, float); //! invariant mass -DECLARE_SOA_COLUMN(P, p, float); //! p -DECLARE_SOA_COLUMN(Pt, pt, float); //! pT -DECLARE_SOA_COLUMN(Ct, ct, float); //! ct -DECLARE_SOA_COLUMN(CosPA, cospa, float); -DECLARE_SOA_COLUMN(DCADaughters, dcaDaughters, float); //! DCA among daughters -DECLARE_SOA_COLUMN(DCACandToPV, dcaCandtopv, float); //! DCA of the reconstructed track to pv -DECLARE_SOA_COLUMN(VtxRadius, vtxRadius, float); //! Radius of SV -// kinematic infomation of daughter tracks -DECLARE_SOA_COLUMN(PtProton, ptProton, float); //! pT of the proton daughter -DECLARE_SOA_COLUMN(EtaProton, etaProton, float); //! eta of the proton daughter -DECLARE_SOA_COLUMN(PhiProton, phiProton, float); //! phi of the proton daughter -DECLARE_SOA_COLUMN(RadiusProton, radiusProton, float); //! radius of innermost hit of the proton daughter -DECLARE_SOA_COLUMN(PtPion, ptPion, float); //! pT of the pion daughter -DECLARE_SOA_COLUMN(EtaPion, etaPion, float); //! eta of the pion daughter -DECLARE_SOA_COLUMN(PhiPion, phiPion, float); //! phi of the pion daughter -DECLARE_SOA_COLUMN(RadiusPion, radiusPion, float); //! radius of innermost hit of the pion daughter -DECLARE_SOA_COLUMN(PtBachelor, ptBachelor, float); //! pT of the bachelor daughter -DECLARE_SOA_COLUMN(EtaBachelor, etaBachelor, float); //! eta of the bachelor daughter -DECLARE_SOA_COLUMN(PhiBachelor, phiBachelor, float); //! phi of the bachelor daughter -DECLARE_SOA_COLUMN(RadiusBachelor, radiusBachelor, float); //! radius of innermost hit of the bachelor daughter -// track quality -DECLARE_SOA_COLUMN(TPCNclusProton, tpcNclusProton, uint8_t); //! number of TPC clusters of the proton daughter -DECLARE_SOA_COLUMN(TPCNclusPion, tpcNclusPion, uint8_t); //! number of TPC clusters of the pion daughter -DECLARE_SOA_COLUMN(TPCNclusBachelor, tpcNclusBachelor, uint8_t); //! number of TPC clusters of the bachelor daughter -DECLARE_SOA_COLUMN(ITSNclusSizeProton, itsNclusSizeProton, uint8_t); //! average ITS cluster size of the proton daughter -DECLARE_SOA_COLUMN(ITSNclusSizePion, itsNclusSizePion, uint8_t); //! average ITS cluster size of the pion daughter -DECLARE_SOA_COLUMN(ITSNclusSizeBachelor, itsNclusSizeBachelor, uint8_t); //! average ITS cluster size of the bachelor daughter -// PID -DECLARE_SOA_COLUMN(TPCNSigmaProton, tpcNSigmaProton, float); //! nsigma of TPC PID of the proton daughter -DECLARE_SOA_COLUMN(TPCNSigmaPion, tpcNSigmaPion, float); //! nsigma of TPC PID of the pion daughter -DECLARE_SOA_COLUMN(TPCNSigmaBachelor, tpcNSigmaBachelor, float); //! nsigma of TPC PID of the bachelor daughter -DECLARE_SOA_COLUMN(TOFNSigmaBachelor, tofNSigmaBachelor, float); //! nsigma of TOF PID of the bachelor daughter -// DCA to PV -DECLARE_SOA_COLUMN(DCAXYProtonToPV, dcaxyProtontoPV, float); //! DCAXY of the proton daughter to pv -DECLARE_SOA_COLUMN(DCAXYPionToPV, dcaxyPiontoPV, float); //! DCAXY of the pion daughter to pv -DECLARE_SOA_COLUMN(DCAXYBachelorToPV, dcaxyBachelortoPV, float); //! DCAXY of the bachelor daughter to pv -DECLARE_SOA_COLUMN(DCAProtonToPV, dcaProtontoPV, float); //! DCA of the proton daughter to pv -DECLARE_SOA_COLUMN(DCAPionToPV, dcaPiontoPV, float); //! DCA of the pion daughter to pv -DECLARE_SOA_COLUMN(DCABachelorToPV, dcaBachelortoPV, float); //! DCA of the bachelor daughter to pv -DECLARE_SOA_COLUMN(IsBachPrimary, isbachprimary, bool); //! flag for bachelor daughter primary -// for MC -DECLARE_SOA_COLUMN(GenP, genP, float); // P of the hypertriton -DECLARE_SOA_COLUMN(GenPt, genPt, float); // pT of the hypertriton -DECLARE_SOA_COLUMN(GenCt, genCt, float); // ct of the hypertriton -DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Phi of the hypertriton -DECLARE_SOA_COLUMN(GenEta, genEta, float); // Eta of the hypertriton -DECLARE_SOA_COLUMN(GenRapidity, genRapidity, float); // Rapidity of the hypertriton -DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal -DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); // pdgCode of the mcparticle, -1 for fake pair -DECLARE_SOA_COLUMN(SurvivedEventSelection, survivedEventSelection, bool); // bool: true for survived event selection -} // namespace hyp3body - -// output table for data -DECLARE_SOA_TABLE(Hyp3BodyCands, "AOD", "HYP3BODYCANDS", - o2::soa::Index<>, - hyp3body::Centrality, - // secondary vertex and reconstruced candidate - hyp3body::IsMatter, - hyp3body::M, - hyp3body::P, - hyp3body::Pt, - hyp3body::Ct, - hyp3body::CosPA, - hyp3body::DCADaughters, - hyp3body::DCACandToPV, - hyp3body::VtxRadius, - // daughter tracks - hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, hyp3body::RadiusProton, - hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, hyp3body::RadiusPion, - hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, hyp3body::RadiusBachelor, - hyp3body::TPCNclusProton, hyp3body::TPCNclusPion, hyp3body::TPCNclusBachelor, - hyp3body::ITSNclusSizeProton, hyp3body::ITSNclusSizePion, hyp3body::ITSNclusSizeBachelor, - hyp3body::TPCNSigmaProton, hyp3body::TPCNSigmaPion, hyp3body::TPCNSigmaBachelor, - hyp3body::TOFNSigmaBachelor, - hyp3body::DCAXYProtonToPV, hyp3body::DCAXYPionToPV, hyp3body::DCAXYBachelorToPV, - hyp3body::DCAProtonToPV, hyp3body::DCAPionToPV, hyp3body::DCABachelorToPV); - -// output table for MC -DECLARE_SOA_TABLE(MCHyp3BodyCands, "AOD", "MCHYP3BODYCANDS", +// index table +DECLARE_SOA_TABLE(Decay3BodyIndices, "AOD", "3BodyINDEX", //! o2::soa::Index<>, - hyp3body::Centrality, - // secondary vertex and reconstruced candidate - hyp3body::IsMatter, - hyp3body::M, - hyp3body::P, - hyp3body::Pt, - hyp3body::Ct, - hyp3body::CosPA, - hyp3body::DCADaughters, - hyp3body::DCACandToPV, - hyp3body::VtxRadius, - // daughter tracks - hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, hyp3body::RadiusProton, - hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, hyp3body::RadiusPion, - hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, hyp3body::RadiusBachelor, - hyp3body::TPCNclusProton, hyp3body::TPCNclusPion, hyp3body::TPCNclusBachelor, - hyp3body::ITSNclusSizeProton, hyp3body::ITSNclusSizePion, hyp3body::ITSNclusSizeBachelor, - hyp3body::TPCNSigmaProton, hyp3body::TPCNSigmaPion, hyp3body::TPCNSigmaBachelor, - hyp3body::TOFNSigmaBachelor, - hyp3body::DCAXYProtonToPV, hyp3body::DCAXYPionToPV, hyp3body::DCAXYBachelorToPV, - hyp3body::DCAProtonToPV, hyp3body::DCAPionToPV, hyp3body::DCABachelorToPV, - hyp3body::IsBachPrimary, - // MC information - hyp3body::GenP, - hyp3body::GenPt, - hyp3body::GenCt, - hyp3body::GenPhi, - hyp3body::GenEta, - hyp3body::GenRapidity, - hyp3body::IsSignal, - hyp3body::IsReco, - hyp3body::PdgCode, - hyp3body::SurvivedEventSelection); - -//______________________________________________________ -// DATAMODEL FOR KFPARTICLE DECAY3BODYS - -namespace kfvtx3body -{ -// General 3 body Vtx properties: mass, momentum, charge -DECLARE_SOA_COLUMN(Mass, mass, float); //! candidate mass (PID hypothesis depending on bachelor charge) -DECLARE_SOA_COLUMN(XErr, xerr, float); //! candidate position x error at decay position -DECLARE_SOA_COLUMN(YErr, yerr, float); //! candidate position y error at decay position -DECLARE_SOA_COLUMN(ZErr, zerr, float); //! candidate position z error at decay position -DECLARE_SOA_COLUMN(Px, px, float); //! candidate px at decay position -DECLARE_SOA_COLUMN(Py, py, float); //! candidate py at decay position -DECLARE_SOA_COLUMN(Pz, pz, float); //! candidate pz at decay position -DECLARE_SOA_COLUMN(Pt, pt, float); //! candidate pt at decay position -DECLARE_SOA_COLUMN(PxErr, pxerr, float); //! candidate px error at decay position -DECLARE_SOA_COLUMN(PyErr, pyerr, float); //! candidate py error at decay position -DECLARE_SOA_COLUMN(PzErr, pzerr, float); //! candidate pz error at decay position -DECLARE_SOA_COLUMN(PtErr, pterr, float); //! candidate pt error at decay position -DECLARE_SOA_COLUMN(Sign, sign, float); //! candidate sign - -// topological properties -DECLARE_SOA_COLUMN(VtxCosPAKF, vtxcospakf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosXYPAKF, vtxcosxypakf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosPAKFtopo, vtxcospakftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosXYPAKFtopo, vtxcosxypakftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) -DECLARE_SOA_COLUMN(DCAVtxToPVKF, dcavtxtopvkf, float); //! 3 body vtx DCA to PV from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(DCAXYVtxToPVKF, dcaxyvtxtopvkf, float); //! 3 body vtx DCAxy to PV from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(DecayLKF, decaylkf, float); //! 3 body vtx decay length from KFParticle (using kfpPV after topological constraint) -DECLARE_SOA_COLUMN(DecayLXYKF, decaylxykf, float); //! 3 body vtx decay length XY from KFParticle (using kfpPV after topological constraint) -DECLARE_SOA_COLUMN(DecayLDeltaL, decayldeltal, float); //! 3 body vtx l/dl from KFParticle (using kfpPV after topological constraint) -DECLARE_SOA_COLUMN(Chi2geoNDF, chi2geondf, float); //! 3 body vtx chi2geo from geometrical KFParticle fit -DECLARE_SOA_COLUMN(Chi2topoNDF, chi2topondf, float); //! 3 body vtx chi2topo from KFParticle topological constraint to the PV (using kfpPV) -DECLARE_SOA_COLUMN(CTauKFtopo, ctaukftopo, float); //! 3 body vtx ctau from KFParticle after topological constraint - -// Strangeness tracking -DECLARE_SOA_COLUMN(TrackedClSize, trackedclsize, int); //! Cluster size of strangeness tracked 3body - -// daughters -DECLARE_SOA_COLUMN(DCATrack0ToPVKF, dcatrack0topvkf, float); //! DCA of proton prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCATrack1ToPVKF, dcatrack1topvkf, float); //! DCA of pion prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCATrack2ToPVKF, dcatrack2topvkf, float); //! DCA of deuteron prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack0ToPVKF, dcaxytrack0topvkf, float); //! DCAxy of proton prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack1ToPVKF, dcaxytrack1topvkf, float); //! DCAxy of pion prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack2ToPVKF, dcaxytrack2topvkf, float); //! DCAxy of deuteron prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCATrackPosToPV, dcatrackpostopv, float); //! DCA of positive track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCATrackNegToPV, dcatracknegtopv, float); //! DCA of negative track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCATrackBachToPV, dcatrackbachtopv, float); //! DCA of bachelor track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCAxyTrackPosToPV, dcaxytrackpostopv, float); //! DCAxy of positive track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCAxyTrackNegToPV, dcaxytracknegtopv, float); //! DCAxy of negative track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCAxyTrackBachToPV, dcaxytrackbachtopv, float); //! DCAxy of bachelor track to PV (propagated before vtx fit) -DECLARE_SOA_COLUMN(DCAxyTrack0ToSVKF, dcaxytrack0tosvkf, float); //! DCAxy of proton prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack1ToSVKF, dcaxytrack1tosvkf, float); //! DCAxy of pion prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack2ToSVKF, dcaxytrack2tosvkf, float); //! DCAxy of deuteron prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCATrack0ToTrack1KF, dcatrack0totrack1kf, float); //! DCAxy of proton prong to pion from KFParticle -DECLARE_SOA_COLUMN(DCATrack0ToTrack2KF, dcatrack0totrack2kf, float); //! DCAxy of proton prong to deuteron from KFParticle -DECLARE_SOA_COLUMN(DCATrack1ToTrack2KF, dcatrack1totrack2kf, float); //! DCAxy of pion prong to deuteron from KFParticle -DECLARE_SOA_COLUMN(DCAVtxDaughtersKF, dcavtxdaughterskf, float); //! sum of DCAs between daughters in 3D from KFParticle -DECLARE_SOA_COLUMN(Track0Sign, track0sign, float); //! sign of proton daughter track -DECLARE_SOA_COLUMN(Track1Sign, track1sign, float); //! sign of pion daughter track -DECLARE_SOA_COLUMN(Track2Sign, track2sign, float); //! sign of deuteron daughter track -DECLARE_SOA_COLUMN(TPCInnerParamTrack0, tpcinnerparamtrack0, float); //! momentum at inner wall of TPC of proton daughter -DECLARE_SOA_COLUMN(TPCInnerParamTrack1, tpcinnerparamtrack1, float); //! momentum at inner wall of TPC of pion daughter -DECLARE_SOA_COLUMN(TPCInnerParamTrack2, tpcinnerparamtrack2, float); //! momentum at inner wall of TPC of deuteron daughter -DECLARE_SOA_COLUMN(TPCNClTrack0, tpcncltrack0, int); //! Number of TPC clusters of proton daughter -DECLARE_SOA_COLUMN(TPCNClTrack1, tpcncltrack1, int); //! Number of TPC clusters of pion daughter -DECLARE_SOA_COLUMN(TPCNClTrack2, tpcncltrack2, int); //! Number of TPC clusters of deuteron daughter -DECLARE_SOA_COLUMN(TPCChi2NClDeuteron, tpcchi2ncldeuteron, float); //! TPC Chi2 / cluster of deuteron daughter -DECLARE_SOA_COLUMN(DeltaPhiDeuteron, deltaphideuteron, float); //! phi before track rotation - phi after track rotation for deuteron track -DECLARE_SOA_COLUMN(DeltaPhiProton, deltaphiproton, float); //! phi before track rotation - phi after track rotation for proton track -// PID -DECLARE_SOA_COLUMN(TPCNSigmaProton, tpcnsigmaproton, float); //! nsigma proton of TPC PID of the proton daughter -DECLARE_SOA_COLUMN(TPCNSigmaPion, tpcnsigmapion, float); //! nsigma pion of TPC PID of the pion daughter -DECLARE_SOA_COLUMN(TPCNSigmaDeuteron, tpcnsigmadeuteron, float); //! nsigma deuteron of TPC PID of the bachelor daughter -DECLARE_SOA_COLUMN(TPCNSigmaPionBach, tpcnsigmapionbach, float); //! nsigma pion of TPC PID of the bachelor daughter -DECLARE_SOA_COLUMN(TPCdEdxProton, tpcdedxproton, float); //! TPC dEdx of the proton daughter -DECLARE_SOA_COLUMN(TPCdEdxPion, tpcdedxpion, float); //! TPC dEdx of the pion daughter -DECLARE_SOA_COLUMN(TPCdEdxDeuteron, tpcdedxdeuteron, float); //! TPC dEdx of the bachelor daughter -DECLARE_SOA_COLUMN(TOFNSigmaDeuteron, tofnsigmadeuteron, float); //! nsigma of TOF PID of the bachelor daughter -DECLARE_SOA_COLUMN(ITSClusSizeDeuteron, itsclussizedeuteron, double); //! average ITS cluster size of bachelor daughter -DECLARE_SOA_COLUMN(PIDTrackingDeuteron, pidtrackingdeuteron, uint32_t); //! PID during tracking of bachelor daughter - -// Monte Carlo -DECLARE_SOA_COLUMN(GenP, genp, float); //! generated momentum -DECLARE_SOA_COLUMN(GenPt, genpt, float); //! generated transverse momentum -DECLARE_SOA_COLUMN(GenDecVtxX, gendecvtxx, double); //! generated decay vertex position x -DECLARE_SOA_COLUMN(GenDecVtxY, gendecvtxy, double); //! generated decay vertex position y -DECLARE_SOA_COLUMN(GenDecVtxZ, gendecvtxz, double); //! generated decay vertex position z -DECLARE_SOA_COLUMN(GenCtau, genctau, double); //! generated ctau -DECLARE_SOA_COLUMN(GenPhi, genphi, float); //! generated phi -DECLARE_SOA_COLUMN(GenEta, geneta, float); //! generated eta -DECLARE_SOA_COLUMN(GenRapidity, genrapidity, float); //! generated rapidity -DECLARE_SOA_COLUMN(GenPosP, genposp, float); //! generated momentum pos daughter particle -DECLARE_SOA_COLUMN(GenPosPt, genpospt, float); //! generated transverse momentum pos daughter particle -DECLARE_SOA_COLUMN(GenNegP, gennegp, float); //! generated momentum neg daughter particle -DECLARE_SOA_COLUMN(GenNegPt, gennegpt, float); //! generated transverse momentum neg daughter particle -DECLARE_SOA_COLUMN(GenBachP, genbachp, float); //! generated momentum bachelor daughter particle -DECLARE_SOA_COLUMN(GenBachPt, genbachpt, float); //! generated transverse momentum bachelor 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(PdgCodeDau0, pdgcodedau0, int); //! MC particle daughter 0 PDG code -DECLARE_SOA_COLUMN(PdgCodeDau1, pdgcodedau1, int); //! MC particle daughter 1 PDG code -DECLARE_SOA_COLUMN(PdgCodeDau2, pdgcodedau2, int); //! MC particle daughter 2 PDG code -DECLARE_SOA_COLUMN(IsBachPrimary, isbachprimary, bool); //! flag for bachelor daughter primary -DECLARE_SOA_COLUMN(SurvEvSel, survevsel, int); //! flag if reco collision survived event selection -DECLARE_SOA_COLUMN(IsReco, isreco, int); //! flag if candidate was reconstructed - -// V0 -DECLARE_SOA_COLUMN(MassV0, massv0, float); //! proton, pion vertex mass -DECLARE_SOA_COLUMN(Chi2MassV0, chi2massv0, float); //! chi2 of proton, pion mass constraint to Lambda mass -DECLARE_SOA_COLUMN(CosPAV0, cospav0, float); //! proton, pion vertex mass - -} // namespace kfvtx3body + vtx3body::Decay3BodyId, + vtx3body::TrackPrId, vtx3body::TrackPiId, vtx3body::TrackDeId, + vtx3body::CollisionId); -DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", - o2::soa::Index<>, vtx3body::CollisionId, vtx3body::Track0Id, vtx3body::Track1Id, vtx3body::Track2Id, vtx3body::Decay3BodyId, - - // hypertriton candidate - kfvtx3body::Mass, - vtx3body::X, vtx3body::Y, vtx3body::Z, - kfvtx3body::XErr, kfvtx3body::YErr, kfvtx3body::ZErr, - kfvtx3body::Px, kfvtx3body::Py, kfvtx3body::Pz, kfvtx3body::Pt, - kfvtx3body::PxErr, kfvtx3body::PyErr, kfvtx3body::PzErr, kfvtx3body::PtErr, - kfvtx3body::Sign, - kfvtx3body::DCAVtxToPVKF, kfvtx3body::DCAXYVtxToPVKF, - kfvtx3body::VtxCosPAKF, kfvtx3body::VtxCosXYPAKF, - kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo, - kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL, - kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF, - kfvtx3body::CTauKFtopo, kfvtx3body::TrackedClSize, - - // V0 - kfvtx3body::MassV0, kfvtx3body::Chi2MassV0, - kfvtx3body::CosPAV0, - - // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron - kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron - kfvtx3body::TPCNClTrack0, kfvtx3body::TPCNClTrack1, kfvtx3body::TPCNClTrack2, // proton, pion, deuteron - kfvtx3body::TPCChi2NClDeuteron, - kfvtx3body::DeltaPhiDeuteron, kfvtx3body::DeltaPhiProton, - kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, - kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, - kfvtx3body::DCATrack0ToTrack1KF, kfvtx3body::DCATrack0ToTrack2KF, kfvtx3body::DCATrack1ToTrack2KF, - kfvtx3body::DCAVtxDaughtersKF, - kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, - kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, - kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, - kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, - kfvtx3body::TOFNSigmaDeuteron, - kfvtx3body::ITSClusSizeDeuteron, - kfvtx3body::PIDTrackingDeuteron); - -using KFVtx3BodyData = KFVtx3BodyDatas::iterator; -namespace kfvtx3body -{ -DECLARE_SOA_INDEX_COLUMN(KFVtx3BodyData, kfvtx3BodyData); //! Index to KFVtx3BodyData entry -} - -DECLARE_SOA_TABLE(KFDecay3BodyDataLink, "AOD", "KF3BODYLINK", //! Joinable table with Decay3bodys which links to KFVtx3BodyData which is not produced for all entries - kfvtx3body::KFVtx3BodyDataId); - -using KFDecay3BodysLinked = soa::Join; -using KFDecay3BodyLinked = KFDecay3BodysLinked::iterator; - -// Lite data candidate table for analysis -DECLARE_SOA_TABLE(KFVtx3BodyDatasLite, "AOD", "KF3BODYLITE", +// reconstructed candidate table for analysis +DECLARE_SOA_TABLE(Vtx3BodyDatas, "AOD", "VTX3BODYDATA", //! o2::soa::Index<>, - // hypertriton candidate - kfvtx3body::Mass, + vtx3body::Sign, + vtx3body::Mass, vtx3body::MassV0, vtx3body::X, vtx3body::Y, vtx3body::Z, - kfvtx3body::Px, kfvtx3body::Py, kfvtx3body::Pz, kfvtx3body::Pt, - kfvtx3body::Sign, - kfvtx3body::DCAVtxToPVKF, kfvtx3body::DCAXYVtxToPVKF, - kfvtx3body::VtxCosPAKF, kfvtx3body::VtxCosXYPAKF, - kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL, - kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF, - kfvtx3body::CTauKFtopo, kfvtx3body::TrackedClSize, - - // V0 - kfvtx3body::MassV0, - kfvtx3body::CosPAV0, - - // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron - kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron - kfvtx3body::TPCNClTrack0, kfvtx3body::TPCNClTrack1, kfvtx3body::TPCNClTrack2, // proton, pion, deuteron - kfvtx3body::TPCChi2NClDeuteron, - kfvtx3body::DeltaPhiDeuteron, kfvtx3body::DeltaPhiProton, - kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, - kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, - kfvtx3body::DCATrack0ToTrack1KF, kfvtx3body::DCATrack0ToTrack2KF, kfvtx3body::DCATrack1ToTrack2KF, - kfvtx3body::DCAVtxDaughtersKF, - kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, - kfvtx3body::TOFNSigmaDeuteron, - kfvtx3body::ITSClusSizeDeuteron, - kfvtx3body::PIDTrackingDeuteron); - -using KFVtx3BodyDataLite = KFVtx3BodyDatasLite::iterator; + vtx3body::Px, vtx3body::Py, vtx3body::Pz, + vtx3body::Chi2, + vtx3body::TrackedClSize, + vtx3body::PxTrackPr, vtx3body::PyTrackPr, vtx3body::PzTrackPr, + vtx3body::PxTrackPi, vtx3body::PyTrackPi, vtx3body::PzTrackPi, + vtx3body::PxTrackDe, vtx3body::PyTrackDe, vtx3body::PzTrackDe, + vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, + vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, + vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, + vtx3body::DCAVtxDaughters, + vtx3body::TPCNSigmaPr, vtx3body::TPCNSigmaPi, vtx3body::TPCNSigmaDe, vtx3body::TPCNSigmaPiBach, + vtx3body::TOFNSigmaDe, + vtx3body::ITSClSizePr, vtx3body::ITSClSizePi, vtx3body::ITSClSizeDe, + vtx3body::TPCNClTrackPr, vtx3body::TPCNClTrackPi, vtx3body::TPCNClTrackDe, + vtx3body::PIDTrackingDe, + + // Dynamic columns + vtx3body::P, + vtx3body::Pt, + vtx3body::VtxRadius, + vtx3body::DistOverTotMom, + vtx3body::VtxCosPA, + vtx3body::DCAVtxToPV, + + // Longitudinal + vtx3body::Rap, + vtx3body::Eta, + vtx3body::Phi, + vtx3body::TrackPrPt, + vtx3body::TrackPrEta, + vtx3body::TrackPrPhi, + vtx3body::TrackPiPt, + vtx3body::TrackPiEta, + vtx3body::TrackPiPhi, + vtx3body::TrackDePt, + vtx3body::TrackDeEta, + vtx3body::TrackDePhi); + +// covariance matrix table +DECLARE_SOA_TABLE(Vtx3BodyCovs, "AOD", "VTX3BODYCOV", //! + vtx3body::CovProton, vtx3body::CovPion, vtx3body::CovDeuteron, + vtx3body::VtxCovMat); // MC candidate table for analysis -DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS", +DECLARE_SOA_TABLE(McVtx3BodyDatas, "AOD", "MC3BODYDATA", //! o2::soa::Index<>, - // hypertriton candidate - kfvtx3body::Mass, + vtx3body::Sign, + vtx3body::Mass, vtx3body::MassV0, vtx3body::X, vtx3body::Y, vtx3body::Z, - kfvtx3body::XErr, kfvtx3body::YErr, kfvtx3body::ZErr, - kfvtx3body::Px, kfvtx3body::Py, kfvtx3body::Pz, kfvtx3body::Pt, - kfvtx3body::PxErr, kfvtx3body::PyErr, kfvtx3body::PzErr, kfvtx3body::PtErr, - kfvtx3body::Sign, - kfvtx3body::DCAVtxToPVKF, kfvtx3body::DCAXYVtxToPVKF, - kfvtx3body::VtxCosPAKF, kfvtx3body::VtxCosXYPAKF, - kfvtx3body::VtxCosPAKFtopo, kfvtx3body::VtxCosXYPAKFtopo, - kfvtx3body::DecayLKF, kfvtx3body::DecayLXYKF, kfvtx3body::DecayLDeltaL, - kfvtx3body::Chi2geoNDF, kfvtx3body::Chi2topoNDF, - kfvtx3body::CTauKFtopo, kfvtx3body::TrackedClSize, - - // V0 - kfvtx3body::MassV0, kfvtx3body::Chi2MassV0, - kfvtx3body::CosPAV0, - - // daughters - vtx3body::PxTrack0, vtx3body::PyTrack0, vtx3body::PzTrack0, // proton - vtx3body::PxTrack1, vtx3body::PyTrack1, vtx3body::PzTrack1, // pion - vtx3body::PxTrack2, vtx3body::PyTrack2, vtx3body::PzTrack2, // deuteron - kfvtx3body::TPCInnerParamTrack0, kfvtx3body::TPCInnerParamTrack1, kfvtx3body::TPCInnerParamTrack2, // proton, pion, deuteron - kfvtx3body::TPCNClTrack0, kfvtx3body::TPCNClTrack1, kfvtx3body::TPCNClTrack2, // proton, pion, deuteron - kfvtx3body::TPCChi2NClDeuteron, - kfvtx3body::DeltaPhiDeuteron, kfvtx3body::DeltaPhiProton, - kfvtx3body::DCATrack0ToPVKF, kfvtx3body::DCATrack1ToPVKF, kfvtx3body::DCATrack2ToPVKF, kfvtx3body::DCAxyTrack0ToPVKF, kfvtx3body::DCAxyTrack1ToPVKF, kfvtx3body::DCAxyTrack2ToPVKF, - kfvtx3body::DCAxyTrack0ToSVKF, kfvtx3body::DCAxyTrack1ToSVKF, kfvtx3body::DCAxyTrack2ToSVKF, - kfvtx3body::DCATrack0ToTrack1KF, kfvtx3body::DCATrack0ToTrack2KF, kfvtx3body::DCATrack1ToTrack2KF, - kfvtx3body::DCAVtxDaughtersKF, - kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, - kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, - kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, kfvtx3body::TPCNSigmaPionBach, - kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, - kfvtx3body::TOFNSigmaDeuteron, - kfvtx3body::ITSClusSizeDeuteron, - kfvtx3body::PIDTrackingDeuteron, - - // MC information - kfvtx3body::GenP, - kfvtx3body::GenPt, - kfvtx3body::GenDecVtxX, kfvtx3body::GenDecVtxY, kfvtx3body::GenDecVtxZ, - kfvtx3body::GenCtau, - kfvtx3body::GenPhi, - kfvtx3body::GenEta, - kfvtx3body::GenRapidity, - kfvtx3body::GenPosP, kfvtx3body::GenPosPt, - kfvtx3body::GenNegP, kfvtx3body::GenNegPt, - kfvtx3body::GenBachP, kfvtx3body::GenBachPt, - kfvtx3body::IsTrueH3L, kfvtx3body::IsTrueAntiH3L, - kfvtx3body::PdgCodeDau0, kfvtx3body::PdgCodeDau1, kfvtx3body::PdgCodeDau2, - kfvtx3body::IsBachPrimary, - kfvtx3body::IsReco, - kfvtx3body::SurvEvSel); - -// Definition of labels for KFVtx3BodyDatas -namespace mckfvtx3bodylabel -{ -DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for KF Vtx3BodyDatas -} // namespace mckfvtx3bodylabel - -DECLARE_SOA_TABLE(McKFVtx3BodyLabels, "AOD", "MCKFVTXLABEL", //! Table joinable with KFVtx3BodyData containing the MC labels - mckfvtx3bodylabel::McParticleId); -using McKFVtx3BodyLabel = McKFVtx3BodyLabels::iterator; - -// Definition of labels for KFDecay3Bodys // Full table, joinable with KFDecay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA) -namespace mcfullkfvtx3bodylabel -{ -DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Decay3Bodys -} // namespace mcfullkfvtx3bodylabel + vtx3body::Px, vtx3body::Py, vtx3body::Pz, + vtx3body::Chi2, + vtx3body::TrackedClSize, + vtx3body::PxTrackPr, vtx3body::PyTrackPr, vtx3body::PzTrackPr, + vtx3body::PxTrackPi, vtx3body::PyTrackPi, vtx3body::PzTrackPi, + vtx3body::PxTrackDe, vtx3body::PyTrackDe, vtx3body::PzTrackDe, + vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, + vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, + vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, + vtx3body::DCAVtxDaughters, + vtx3body::TPCNSigmaPr, vtx3body::TPCNSigmaPi, vtx3body::TPCNSigmaDe, vtx3body::TPCNSigmaPiBach, + vtx3body::TOFNSigmaDe, + vtx3body::ITSClSizePr, vtx3body::ITSClSizePi, vtx3body::ITSClSizeDe, + vtx3body::TPCNClTrackPr, vtx3body::TPCNClTrackPi, vtx3body::TPCNClTrackDe, + vtx3body::PIDTrackingDe, + + // Monte Carlo information + vtx3body::GenPx, vtx3body::GenPy, vtx3body::GenPz, + vtx3body::GenX, vtx3body::GenY, vtx3body::GenZ, + vtx3body::GenCt, + vtx3body::GenPhi, vtx3body::GenEta, vtx3body::GenRap, + vtx3body::GenPPr, vtx3body::GenPPi, vtx3body::GenPDe, + vtx3body::GenPtPr, vtx3body::GenPtPi, vtx3body::GenPtDe, + vtx3body::IsTrueH3L, vtx3body::IsTrueAntiH3L, + vtx3body::IsReco, + vtx3body::PrPdgCode, vtx3body::PiPdgCode, vtx3body::DePdgCode, + vtx3body::IsDePrimary, + vtx3body::IsSurvEvSel, + + // Dynamic columns + vtx3body::P, + vtx3body::Pt, + vtx3body::GenP, + vtx3body::GenPt, + vtx3body::VtxRadius, + vtx3body::GenRadius, + vtx3body::DistOverTotMom, + vtx3body::VtxCosPA, + vtx3body::DCAVtxToPV, + + // Longitudinal + vtx3body::Rap, + vtx3body::Eta, + vtx3body::Phi, + vtx3body::TrackPrPt, + vtx3body::TrackPrEta, + vtx3body::TrackPrPhi, + vtx3body::TrackPiPt, + vtx3body::TrackPiEta, + vtx3body::TrackPiPhi, + vtx3body::TrackDePt, + vtx3body::TrackDeEta, + vtx3body::TrackDePhi); + +// Define joins +using Vtx3BodyDatasCovs = soa::Join; +using Vtx3BodyDatasCovsIndexed = soa::Join; -DECLARE_SOA_TABLE(McFullKFVtx3BodyLabels, "AOD", "MCFULLKFLABEL", //! Table joinable with Decay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA) - mcfullkfvtx3bodylabel::McParticleId); -using McFullKFVtx3BodyLabel = McFullKFVtx3BodyLabels::iterator; } // namespace o2::aod #endif // PWGLF_DATAMODEL_VTX3BODYTABLES_H_ diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index f8f62f22925..7138fe9ded7 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -11,7 +11,7 @@ o2physics_add_dpl_workflow(decay3bodybuilder SOURCES decay3bodybuilder.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter KFParticle::KFParticle O2Physics::AnalysisCore O2::TOFBase O2Physics::EventFilteringUtils O2::DetectorsVertexing + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2::TOFBase O2Physics::EventFilteringUtils O2::DetectorsVertexing COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(hyhefour-builder @@ -29,11 +29,6 @@ o2physics_add_dpl_workflow(lnn-reco-task PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(hypertriton3bodyfinder - SOURCES hypertriton3bodyfinder.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(nucleustreecreator SOURCES LFTreeCreatorNuclei.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -59,11 +54,6 @@ o2physics_add_dpl_workflow(threebodymcfinder PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(threebody-reco-task - SOURCES threebodyRecoTask.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore O2Physics::EventFilteringUtils - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(ebye-maker SOURCES ebyeMaker.cxx PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore @@ -79,11 +69,6 @@ o2physics_add_dpl_workflow(pidtof-generic PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::TOFBase COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(threebody-kf-task - SOURCES threebodyKFTask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(hypernuclei-kf-reco-task SOURCES hypKfRecoTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore KFParticle::KFParticle diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index b7b643bca21..77c3e5668a7 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -9,10 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +// ======================== /// \file decay3bodybuilder.cxx -/// \brief Builder task for 3-body decay reconstruction (p + pion + bachelor) +/// \brief Builder task for 3-body hypertriton decay reconstruction (proton + pion + deuteron) /// \author Yuanzhe Wang -/// \author Carolina Reetz (KFParticle specific part) +/// \author Carolina Reetz +// ======================== #include #include @@ -20,25 +22,20 @@ #include #include #include -#include #include - -#include -#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" #include "ReconstructionDataFormats/Track.h" -#include "DetectorsVertexing/SVertexHypothesis.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/Reduced3BodyTables.h" #include "PWGLF/DataModel/Vtx3BodyTables.h" #include "PWGLF/DataModel/pidTOFGeneric.h" +#include "PWGLF/Utils/decay3bodyBuilderHelper.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/Core/PID/PIDTOF.h" @@ -53,8 +50,6 @@ #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" -#include "DataFormatsTPC/BetheBlochAleph.h" -#include "DataFormatsCalibration/MeanVertexObject.h" #ifndef HomogeneousField #define HomogeneousField @@ -70,308 +65,207 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using std::array; - -using FullTracksExtIU = soa::Join; -using FullTracksExtPIDIU = soa::Join; - -using ColwithEvTimes = o2::soa::Join; -using ColwithEvTimesMults = o2::soa::Join; -using TrackExtIUwithEvTimes = soa::Join; -using TrackExtPIDIUwithEvTimes = soa::Join; - -using MCLabeledTracksIU = soa::Join; - -using ReducedCollisionsMults = soa::Join; -using ReducedCollisionsMultsCents = soa::Join; - -namespace -{ -const float pidCutsLambda[o2::vertexing::SVertexHypothesis::NPIDParams] = {0., 20, 0., 5.0, 0.0, 1.09004e-03, 2.62291e-04, 8.93179e-03, 2.83121}; // Lambda -} // namespace - -struct VtxCandidate { - int track0Id; - int track1Id; - int track2Id; - int collisionId; - int decay3bodyId; - float vtxPos[3]; - float track0P[3]; - float track1P[3]; - float track2P[3]; - float dcadaughters; - float daudcaxytopv[3]; // 0 - proton, 1 - pion, 2 - bachelor - float daudcatopv[3]; // 0 - proton, 1 - pion, 2 - bachelor - float bachelortofNsigma; -}; -struct kfCandidate { - // hypertriton - int collisionID; - int trackPosID; - int trackNegID; - int trackBachID; - int decay3bodyID; - float mass; - float pos[3]; - float posErr[3]; - float mom[4]; - float momErr[4]; - float charge; - float dcaToPV[2]; // 3D, xy - float cpaToPV[2]; // 3D, xy - float cpaToPVtopo[2]; // 3D, xy - float decLen[2]; // 3D, xy - float ldl; - float chi2geoNDF; - float chi2topoNDF; - float ctau; - float trackedClSize; - float DeltaPhiRotDeuteron; - float DeltaPhiRotProton; - // V0 - float massV0; - float chi2massV0; - float cpaV0ToPV; - // daughter momenta - float protonMom[3]; - float pionMom[3]; - float deuteronMom[3]; - float tpcInnerParam[3]; // proton, pion, deuteron - // daughter track quality - int tpcNClDaughters[3]; // proton, pion, deuteron - float tpcChi2NClDeuteron; - // daughter DCAs KF - float DCAdaughterToPV[3]; // proton, pion, deuteron - float DCAdaughterToPVxy[3]; // proton, pion, deuteron - float DCAdaughterToSVxy[3]; // proton, pion, deuteron - float DCAprotonToPion; - float DCAprotonToDeuteron; - float DCApionToDeuteron; - float DCAvtxDaughters3D; - // daughter DCAs to PV propagated with material - float trackDCAxy[3]; // pos, neg, bach - float trackDCA[3]; // pos, neg, bach - // daughter signs - float daughterCharge[3]; // proton, pion, deuteron - // daughter PID - float tpcNsigma[4]; // proton, pion, deuteron, bach with pion hyp - float tpcdEdx[3]; // proton, pion, deuteron - float tofNsigmaDeuteron; - float averageClusterSizeDeuteron; - float pidForTrackingDeuteron; +static constexpr int nParameters = 1; +static const std::vector tableNames{ + "Decay3BodyIndices", + "Vtx3BodyDatas", + "Vtx3BodyCovs", + "McVtx3BodyDatas"}; + +static constexpr int nTablesConst = 4; + +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[nTablesConst][nParameters]{ + {0}, // Decay3BodyIndices + {0}, // Vtx3BodyDatas + {0}, // Vtx3BodyCovs + {0} // McVtx3BodyDatas }; -struct decay3bodyBuilder { - - Produces vtx3bodydata; - Produces kfvtx3bodydata; - Produces kfvtx3bodydatalite; - Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - std::vector VtxCandidates; +using TracksExtPIDIUwithEvTimes = soa::Join; +using TracksExtPIDIUwithEvTimesLabeled = soa::Join; - std::unordered_map ccdbCache; // Maps runNumber -> d_bz - std::unordered_map> grpMagCache; // Maps runNumber -> grpmap +using ColswithEvTimes = o2::soa::Join; +using ColswithEvTimesLabeled = o2::soa::Join; - Zorro zorro; - OutputObj zorroSummary{"zorroSummary"}; +struct decay3bodyBuilder { - std::vector fTrackedClSizeVector; + // helper object + o2::pwglf::decay3bodyBuilderHelper helper; + + // table index : match order above + enum tableIndex { kDecay3BodyIndices = 0, + kVtx3BodyDatas, + kVtx3BodyCovs, + kMcVtx3BodyDatas, + nTables }; + + struct : ProducesGroup { + Produces decay3bodyindices; + Produces vtx3bodydatas; + Produces vtx3bodycovs; + Produces mcvtx3bodydatas; + } products; + + // enablde tables + Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTables, nParameters, tableNames, parameterNames}, + "Produce this table: 0 - false, 1 - true"}; + std::vector mEnabledTables; // Vector of enabled tables + + // general options + Configurable useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"}; + Configurable doTrackQA{"doTrackQA", false, "Flag to fill QA histograms for daughter tracks of (selected) decay3body candidates."}; + Configurable doVertexQA{"doVertexQA", false, "Flag to fill QA histograms for PV of (selected) events."}; + Configurable doSel8selection{"doSel8selection", true, "flag for sel8 event selection"}; + Configurable doPosZselection{"doPosZselection", true, "flag for posZ event selection"}; - // Configurables - Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; - - enum Hyp3Body { kH3L = 0, - kH4L, - kHe4L, - kHe5L, - kNHyp3body }; - - enum VtxStep { kVtxAll = 0, - kVtxTPCNcls, - kVtxPIDCut, - kVtxhasSV, - kVtxDcaDau, - kVtxCosPA, - kNVtxSteps }; - - enum kfvtxstep { kKfVtxAll = 0, - kKfVtxCharge, - kKfVtxEta, - kKfVtxTPCNcls, - kKfVtxTPCRows, - kKfVtxTPCPID, - kKfVtxDCAxyPV, - kKfVtxDCAzPV, - kKfVtxV0MassConst, - kKfVtxhasSV, - kKfVtxDcaDau, - kKfVtxDcaDauVtx, - kKfVtxDauPt, - kKfVtxRap, - kKfVtxPt, - kKfVtxMass, - kKfVtxCosPA, - kKfVtxCosPAXY, - kKfVtxChi2geo, - kKfVtxTopoConstr, - kKfVtxChi2topo, - kKfNVtxSteps }; - - HistogramRegistry registry{"registry", {}}; - - // hypothesis - Configurable motherhyp{"motherhyp", 0, "hypothesis of the 3body decayed particle"}; // corresponds to Hyp3Body - int bachelorcharge = 1; // to be updated in Init base on the hypothesis - o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; // to be updated in Init base on the hypothesis - - // Selection criteria - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - Configurable mintpcNCls{"mintpcNCls", 70, "min tpc Nclusters"}; - Configurable minCosPA3body{"minCosPA3body", 0.9, "minCosPA3body"}; - Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; - Configurable enablePidCut{"enablePidCut", 0, "enable function checkPIDH3L"}; - Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -5, "TofPidNsigmaMin"}; - Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 5, "TofPidNsigmaMax"}; - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable minBachPUseTOF{"minBachPUseTOF", 1, "minBachP Enable TOF PID"}; + // data processing options + Configurable doSkimmedProcessing{"doSkimmedProcessing", false, "Apply Zoroo counting in case of skimmed data input"}; + Configurable triggerList{"triggerList", "fTriggerEventF1Proton, fTrackedOmega, fTrackedXi, fOmegaLargeRadius, fDoubleOmega, fOmegaHighMult, fSingleXiYN, fQuadrupleXi, fDoubleXi, fhadronOmega, fOmegaXi, fTripleXi, fOmega, fGammaVeryLowPtEMCAL, fGammaVeryLowPtDCAL, fGammaHighPtEMCAL, fGammaLowPtEMCAL, fGammaVeryHighPtDCAL, fGammaVeryHighPtEMCAL, fGammaLowPtDCAL, fJetNeutralLowPt, fJetNeutralHighPt, fGammaHighPtDCAL, fJetFullLowPt, fJetFullHighPt, fEMCALReadout, fPCMandEE, fPHOSnbar, fPCMHighPtPhoton, fPHOSPhoton, fLD, fPPPHI, fPD, fLLL, fPLL, fPPL, fPPP, fLeadingPtTrack, fHighFt0cFv0Flat, fHighFt0cFv0Mult, fHighFt0Flat, fHighFt0Mult, fHighMultFv0, fHighTrackMult, fHfSingleNonPromptCharm3P, fHfSingleNonPromptCharm2P, fHfSingleCharm3P, fHfPhotonCharm3P, fHfHighPt2P, fHfSigmaC0K0, fHfDoubleCharm2P, fHfBeauty3P, fHfFemto3P, fHfFemto2P, fHfHighPt3P, fHfSigmaCPPK, fHfDoubleCharm3P, fHfDoubleCharmMix, fHfPhotonCharm2P, fHfV0Charm2P, fHfBeauty4P, fHfV0Charm3P, fHfSingleCharm2P, fHfCharmBarToXiBach, fSingleMuHigh, fSingleMuLow, fLMeeHMR, fDiMuon, fDiElectron, fLMeeIMR, fSingleE, fTrackHighPt, fTrackLowPt, fJetChHighPt, fJetChLowPt, fUDdiffLarge, fUDdiffSmall, fITSextremeIonisation, fITSmildIonisation, fH3L3Body, fHe, fH2", "List of triggers used to select events"}; + Configurable onlyKeepInterestedTrigger{"onlyKeepInterestedTrigger", false, "Flag to keep only interested trigger"}; - Configurable useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"}; // 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 lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - // CCDB TOF PID paras - 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"}; - // for KFParticle reconstruction struct : ConfigurableGroup { - Configurable cfgSkimmedProcessing{"kfparticleConfigurations.cfgSkimmedProcessing", false, "Flag for skimmed dataset processing"}; - Configurable triggerList{"kfparticleConfigurations.triggerList", "fH3L3Body", "List of triggers used to select events"}; - Configurable cfgOnlyKeepInterestedTrigger{"kfparticleConfigurations.cfgOnlyKeepInterestedTrigger", false, "Flag to keep only interested trigger"}; - Configurable fillCandidateFullTable{"kfparticleConfigurations.fillCandidateFullTable", false, "Switch to fill full table with candidate properties"}; - Configurable doSel8selection{"kfparticleConfigurations.doSel8selection", true, "flag for sel8 event selection"}; - Configurable doPosZselection{"kfparticleConfigurations.doPosZselection", true, "flag for posZ event selection"}; - Configurable doDCAFitterPreMinimum{"kfparticleConfigurations.doDCAFitterPreMinimum", false, "do DCAFitter pre-optimization before KF fit to include material corrections for decay3body vertex"}; - Configurable doTrackQA{"kfparticleConfigurations.doTrackQA", false, "Flag to fill QA histograms for daughter tracks."}; - Configurable doVertexQA{"kfparticleConfigurations.doVertexQA", false, "Flag to fill QA histograms for KFParticle PV."}; - Configurable useLambdaMassConstraint{"kfparticleConfigurations.useLambdaMassConstraint", false, "Apply Lambda mass constraint on proton-pion vertex"}; - Configurable doDCAPreSel{"kfparticleConfigurations.doDCAPreSel", false, "Apply selection on DCA of daughter tracks to PV"}; - Configurable maxEta{"kfparticleConfigurations.maxEta", 1.0, "Maximum eta for proton and pion daughter tracks"}; - Configurable maxEtaDeuteron{"kfparticleConfigurations.maxEtaDeuteron", 0.9, "Maximum eta for deuteron daughter track"}; - Configurable useTPCforPion{"kfparticleConfigurations.useTPCforPion", true, "Flag to ask for TPC info for pion track (PID, nClusters), false: pion track can be ITS only"}; - Configurable mintpcNClsProton{"kfparticleConfigurations.mintpcNClsProton", 70, "Minimum number of TPC clusters for proton track"}; - Configurable mintpcNClsPion{"kfparticleConfigurations.mintpcNClsPion", 70, "Minimum number of TPC clusters for pion track"}; - Configurable mintpcNClsBach{"kfparticleConfigurations.mintpcNClsBach", 70, "Minimum number of TPC clusters for bachelor track"}; - Configurable mintpcCrossedRows{"kfparticleConfigurations.mintpcCrossedRows", 70, "Minimum number of TPC crossed rows for proton and deuteron track"}; - Configurable mintpcCrossedRowsPion{"kfparticleConfigurations.mintpcCrossedRowsPion", 70, "Minimum number of TPC crossed rows for pion track"}; - Configurable minPtProton{"kfparticleConfigurations.minPtProton", 0.1, "Minimum pT of proton track"}; - Configurable maxPtProton{"kfparticleConfigurations.maxPtProton", 10, "Maximum pT of proton track"}; - Configurable minPtPion{"kfparticleConfigurations.minPtPion", 0.1, "Minimum pT of pion track"}; - Configurable maxPtPion{"kfparticleConfigurations.maxPtPion", 10, "Maximum pT of pion track"}; - Configurable minPtDeuteron{"kfparticleConfigurations.minPtDeuteron", 0.1, "Minimum pT of deuteron track"}; - Configurable maxPtDeuteron{"kfparticleConfigurations.maxPtDeuteron", 10, "Maximum pT of deuteron track"}; - Configurable mindcaXYPionPV{"kfparticleConfigurations.mindcaXYPionPV", 0.1, "Minimum DCA XY of the pion daughter track to the PV"}; - Configurable mindcaXYProtonPV{"kfparticleConfigurations.mindcaXYProtonPV", 0.1, "Minimum DCA XY of the proton daughter track to the PV"}; - Configurable mindcaZPionPV{"kfparticleConfigurations.mindcaZPionPV", 0.1, "Minimum DCA Z of the pion daughter track to the PV"}; - Configurable mindcaZProtonPV{"kfparticleConfigurations.mindcaZProtonPV", 0.1, "Minimum DCA Z of the proton daughter track to the PV"}; - Configurable maxtpcnSigma{"kfparticleConfigurations.maxtpcnSigma", 5., "Maximum nSigma TPC for daughter tracks"}; - Configurable maxDcaProDeu{"kfparticleConfigurations.maxDcaProDeu", 1000., "Maximum geometrical distance between proton and deuteron at the SV in 3D with KFParticle"}; - Configurable maxDcaProPi{"kfparticleConfigurations.maxDcaProPi", 1000., "Maximum geometrical distance between proton and pion at the SV in 3D with KFParticle"}; - Configurable maxDcaPiDe{"kfparticleConfigurations.maxDcaPiDe", 1000., "Maximum geometrical distance between pion and deuteron at the SV in 3D with KFParticle"}; - Configurable maxDcaXYSVDau{"kfparticleConfigurations.maxDcaXYSVDau", 1.0, "Maximum geometrical distance of daughter tracks from the SV in XY with KFParticle"}; - Configurable maxRapidityHt{"kfparticleConfigurations.maxRapidityHt", 1., "Maximum rapidity for Hypertriton candidates with KFParticle"}; - Configurable minPtHt{"kfparticleConfigurations.minPtHt", 0.01, "Minimum momentum for Hypertriton candidates with KFParticle (0.01 applied in SVertexer)"}; - Configurable maxPtHt{"kfparticleConfigurations.maxPtHt", 36., "Maximum momentum for Hypertriton candidates with KFParticle"}; - Configurable minMassHt{"kfparticleConfigurations.minMassHt", 2.96, "Minimum candidate mass with KFParticle"}; - Configurable maxMassHt{"kfparticleConfigurations.maxMassHt", 3.05, "Maximum candidate mass with KFParticle"}; - Configurable maxctauHt{"kfparticleConfigurations.maxctauHt", 40., "Maximum candidate ctau with KFParticle before topological constraint"}; - Configurable maxChi2geo{"kfparticleConfigurations.maxChi2geo", 1000., "Maximum chi2 geometrical with KFParticle"}; - Configurable minCosPA{"kfparticleConfigurations.minCosPA", 0.8, "Minimum cosine pointing angle with KFParticle (0.8 applied in SVertexer)"}; - Configurable minCosPAxy{"kfparticleConfigurations.minCosPAxy", 0.8, "Minimum cosine pointing angle in xy with KFParticle"}; - Configurable applyTopoSel{"kfparticleConfigurations.applyTopoSel", false, "Apply selection constraining the mother to the PV with KFParticle"}; - Configurable maxChi2topo{"kfparticleConfigurations.maxChi2topo", 1000., "Maximum chi2 topological with KFParticle"}; - Configurable nEvtMixing{"kfparticleConfigurations.nEvtMixing", 5, "Number of events to mix"}; - ConfigurableAxis binsVtxZ{"kfparticleConfigurations.binsVtxZ", {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 binsMultiplicity{"kfparticleConfigurations.binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 1.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"}; - // 3body mixing - Configurable mixingType{"kfparticleConfigurations.mixingType", 0, "0: mix V0 from one event with bachelor from another, 1: mix pion and bachelor from one event with proton from another "}; - Configurable applySVertexerV0Cuts{"kfparticleConfigurations.applySVertexerV0Cuts", false, "Apply virtual V0 cuts applied in SVertexer in case of proton mixing"}; - ConfigurableAxis bins3BodyRadius{"kfparticleConfigurations.bins3BodyRadius", {VARIABLE_WIDTH, 0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f, 30.0f, 1000.0}, "Mixing bins - 3body radius"}; - // ConfigurableAxis bins3BodyPhi{"kfparticleConfigurations.bins3BodyPhi", {VARIABLE_WIDTH, -180.0f*TMath::Pi()/180, -170.0f*TMath::Pi()/180, -160.0f*TMath::Pi()/180, -150.0f*TMath::Pi()/180, -140.0f*TMath::Pi()/180, -130.0f*TMath::Pi()/180, -120.0f*TMath::Pi()/180, -110.0f*TMath::Pi()/180, -100.0f*TMath::Pi()/180, -90.0f*TMath::Pi()/180, -80.0f*TMath::Pi()/180, -70.0f*TMath::Pi()/180, -60.0f*TMath::Pi()/180, -50.0f*TMath::Pi()/180, -40.0f*TMath::Pi()/180, -30.0f*TMath::Pi()/180, -20.0f*TMath::Pi()/180, -10.0f*TMath::Pi()/180, 0.0f, 10.0f*TMath::Pi()/180, 20.0f*TMath::Pi()/180, 30.0f*TMath::Pi()/180, 40.0f*TMath::Pi()/180, 50.0f*TMath::Pi()/180, 60.0f*TMath::Pi()/180, 70.0f*TMath::Pi()/180, 80.0f*TMath::Pi()/180, 90.0f*TMath::Pi()/180, 100.0f*TMath::Pi()/180, 110.0f*TMath::Pi()/180, 120.0f*TMath::Pi()/180, 130.0f*TMath::Pi()/180, 140.0f*TMath::Pi()/180, 150.0f*TMath::Pi()/180, 160.0f*TMath::Pi()/180, 170.0f*TMath::Pi()/180, 180.0f*TMath::Pi()/180}, "Mixing bins - 3body phi"}; - ConfigurableAxis bins3BodyPhi{"kfparticleConfigurations.bins3BodyPhi", {VARIABLE_WIDTH, -180.0f * TMath::Pi() / 180, -160.0f * TMath::Pi() / 180, -140.0f * TMath::Pi() / 180, -120.0f * TMath::Pi() / 180, -100.0f * TMath::Pi() / 180, -80.0f * TMath::Pi() / 180, -60.0f * TMath::Pi() / 180, -40.0f * TMath::Pi() / 180, -20.0f * TMath::Pi() / 180, 0.0f, 20.0f * TMath::Pi() / 180, 40.0f * TMath::Pi() / 180, 60.0f * TMath::Pi() / 180, 80.0f * TMath::Pi() / 180, 100.0f * TMath::Pi() / 180, 120.0f * TMath::Pi() / 180, 140.0f * TMath::Pi() / 180, 160.0f * TMath::Pi() / 180, 180.0f * TMath::Pi() / 180}, "Mixing bins - 3body phi"}; - ConfigurableAxis bins3BodyPosZ{"kfparticleConfigurations.bins3BodyPosZ", {VARIABLE_WIDTH, -300.0f, -42.0f, -13.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 13.0f, 42.0f, 300.0f}, "Mixing bins - 3body z position"}; - Configurable selectVtxZ3bodyMixing{"kfparticleConfigurations.selectVtxZ3bodyMixing", true, "Select same VtxZ events in case of 3body mixing"}; - Configurable VtxZBin3bodyMixing{"kfparticleConfigurations.VtxZBin3bodyMixing", 1., "Bin width for event vtx z position in case of 3body mixing"}; - } kfparticleConfigurations; - - //------------------------------------------------------------------ - // Sets for DCAFitter event mixing + std::string prefix = "ccdb"; + 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 lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + } ccdbConfigurations; + + // Decay3body building options struct : ConfigurableGroup { - Configurable nUseMixed{"dcaFitterEMSel.nUseMixed", 5, "nUseMixed"}; - Configurable mMinPt2V0{"dcaFitterEMSel.mMinPt2V0", 0.5, "mMinPt2V0"}; // minimum pT^2 of V0 - Configurable mMaxTgl2V0{"dcaFitterEMSel.mMaxTgl2V0", 4, "mMaxTgl2V0"}; // maximum tgLambda^2 of V0 - Configurable mMaxDCAXY2ToMeanVertex3bodyV0{"dcaFitterEMSel.mMaxDCAXY2ToMeanVertex3bodyV0", 4, "mMaxDCAXY2ToMeanVertex3bodyV0"}; // max DCA^2 of 2 body decay to mean vertex of 3 body decay in XY - Configurable minCosPAXYMeanVertex3bodyV0{"dcaFitterEMSel.minCosPAXYMeanVertex3bodyV0", 0.9, "minCosPAXYMeanVertex3bodyV0"}; // min CosPA of 2 body decay to mean vertex of 3 body decay in XY - Configurable minCosPA3bodyV0{"dcaFitterEMSel.minCosPA3bodyV0", 0.8, "minCosPA3bodyV0"}; // min CosPA of 3 body decay to PV - Configurable maxRDiffV03body{"dcaFitterEMSel.maxRDiffV03body", 3, "maxRDiffV03body"}; // Maximum difference between virtual V0 and 3body radius - Configurable minPt3Body = {"dcaFitterEMSel.minPt3Body", 0.01, ""}; // minimum pT of 3body Vertex - Configurable maxTgl3Body = {"dcaFitterEMSel.maxTgl3Body", 2, ""}; // maximum tgLambda of 3body Vertex - Configurable maxDCAXY3Body{"dcaFitterEMSel.maxDCAXY3Body", 0.5, "DCAXY H3L to PV"}; // max DCA of 3 body decay to PV in XY - Configurable maxDCAZ3Body{"dcaFitterEMSel.maxDCAZ3Body", 1.0, "DCAZ H3L to PV"}; // max DCA of 3 body decay to PV in Z - // Binning for mixing events - ConfigurableAxis binsVtxZ{"dcaFitterEMSel.binsVtxZ", {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 binsMultiplicity{"dcaFitterEMSel.binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 1.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"}; - Configurable maxDeltaRadiusColMixing{"dcaFitterEMSel.maxDeltaRadiusColMixing", 2., "max difference between pv z position in case of collision mixing"}; - Configurable maxDeltaPhiColMixing{"dcaFitterEMSel.maxDeltaPhiColMixing", 30., "max difference between Phi of monther particle in case of collision mixing (degree)"}; - // Configurations for mixing decay3bodys - // Configurable cfgUseDCAFitterInfo{"dcaFitterEMSel.cfgUseDCAFitterInfo", true, ""}; // if use information from dcatFitter while mixing reduced 3bodys - Configurable cfgMix3BodyMethod{"dcaFitterEMSel.cfgMix3BodyMethod", 0, ""}; // 0: bachelor, 1: pion, 2: proton - Configurable cfgApplyV0Cut{"dcaFitterEMSel.cfgApplyV0Cut", true, "if apply V0 cut while performing event-mixing"}; - ConfigurableAxis bins3BodyRadius{"dcaFitterEMSel.bins3BodyRadius", {VARIABLE_WIDTH, 0.0f, 2.0f, 4.0f, 7.0f, 10.0f, 14.0f, 18.0f, 22.0f, 30.0f, 40.0f}, "Mixing bins - 3body radius"}; - ConfigurableAxis bins3BodyPhi{"dcaFitterEMSel.bins3BodyPhi", {VARIABLE_WIDTH, -3.15, -2.15, -1, 0, 1, 2.15, 3.15}, "Mixing bins - 3body phi"}; - ConfigurableAxis bins3BodyPhiDegree{"dcaFitterEMSel.bins3BodyPhiDegree", {VARIABLE_WIDTH, -180, -120, -60, 0, 60, 120, 180}, "Mixing bins - 3body phi"}; - ConfigurableAxis bins3BodyPosZ{"dcaFitterEMSel.bins3BodyPosZ", {VARIABLE_WIDTH, -500.0f, -200.0f, -100.0f, -70.0f, -60.0f, -50.0f, -40.0f, -35.0f, -30.0f, -25.0f, -20.0f, -15.0f, -13.0f, -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 13.0f, 15.0f, 20.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f, 60.0f, 70.0f, 100.0f, 200.0f, 500.0f}, "3body SV z position"}; - Configurable selectPVPosZ3bodyMixing{"dcaFitterEMSel.selectPVPosZ3bodyMixing", true, "Select same pvPosZ events in case of 3body mixing"}; - Configurable maxDeltaPVPosZ3bodyMixing{"dcaFitterEMSel.maxDeltaPVPosZ3bodyMixing", 1., "max difference between pv z position in case of 3body mixing"}; - } dcaFitterEMSel; - - SliceCache cache; - using BinningTypeColEM = ColumnBinningPolicy; - using Binning3BodyDCAFitter = ColumnBinningPolicy; - using Binning3BodyKFInfo = ColumnBinningPolicy; - - // KF event mixing - using BinningTypeKF = ColumnBinningPolicy; + std::string prefix = "decay3bodyBuilderOpts"; + // 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 useSelections{"useSelections", true, "Apply selections 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 calculateCovariance{"calculateCovariance", true, "Calculate candidate and daughter covariance matrices"}; + // daughter track selections + Configurable maxEtaDaughters{"maxEtaDaughters", 0.9, "Max eta of daughters"}; + Configurable minTPCNClProton{"minTPCNClProton", 90, "Min TPC NClusters of proton daughter"}; + Configurable minTPCNClPion{"minTPCNClPion", 70, "Min TPC NClusters of pion daughter"}; + Configurable minTPCNClDeuteron{"minTPCNClDeuteron", 100, "Min TPC NClusters of deuteron daughter"}; + Configurable minDCAProtonToPV{"minDCAProtonToPV", 0.1, "Min DCA of proton to PV"}; + Configurable minDCAPionToPV{"minDCAPionToPV", 0.1, "Min DCA of pion to PV"}; + Configurable minDCADeuteronToPV{"minDCADeuteronToPV", 0.1, "Min DCA of deuteron to PV"}; + Configurable minPtProton{"minPtProton", 0.3, "Min Pt of proton daughter"}; + Configurable minPtPion{"minPtPion", 0.1, "Min Pt of pion daughter"}; + Configurable minPtDeuteron{"minPtDeuteron", 0.6, "Min Pt of deuteron daughter"}; + Configurable maxPtProton{"maxPtProton", 5.0, "Max Pt of proton daughter"}; + Configurable maxPtPion{"maxPtPion", 1.2, "Max Pt of pion daughter"}; + Configurable maxPtDeuteron{"maxPtDeuteron", 10.0, "Max Pt of deuteron daughter"}; + Configurable maxTPCnSigma{"maxTPCnSigma", 5.0, "Min/max TPC nSigma of daughter tracks"}; + 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)"}; + // candidate selections + Configurable maxRapidity{"maxRapidity", 1.0, "Max rapidity of decay3body vertex"}; + Configurable minPt{"minPt", 2.0, "Min Pt of decay3body candidate"}; + Configurable maxPt{"maxPt", 5.0, "Max Pt of decay3body candidate"}; + Configurable minMass{"minMass", 2.96, "Min mass of decay3body candidate"}; + Configurable maxMass{"maxMass", 3.04, "Max mass of decay3body candidate"}; + Configurable minCtau{"minCtau", 0.0, "Min ctau of decay3body candidate"}; + Configurable maxCtau{"maxCtau", 100.0, "Max ctau of decay3body candidate"}; + Configurable minCosPA{"minCosPA", 0.9, "Min cosPA of decay3body candidate"}; + Configurable maxChi2{"maxChi2", 100.0, "Max chi2 of decay3body candidate"}; + } decay3bodyBuilderOpts; - // 3body mixing - // using Binning3Body = ColumnBinningPolicy; - using Binning3Body = ColumnBinningPolicy; + struct : ConfigurableGroup { + std::string prefix = "mixingOpts"; + Configurable n3bodyMixing{"n3bodyMixing", 0, "Number of decay3bodys to mix: 0 - value set to maximum bin entry in hDecay3BodyRadiusPhi, > 0 - manual setting"}; + Configurable mixingType{"mixingType", 0, "0: mix V0 from one event with bachelor from another, 1: mix pion and bachelor from one event with proton from another, 1: mix proton and bachelor from one event with pion from another "}; + ConfigurableAxis bins3BodyRadius{"mixingOpts.bins3BodyRadius", {VARIABLE_WIDTH, 0.0f, 2.0f, 4.0f, 7.0f, 10.0f, 14.0f, 18.0f, 22.0f, 30.0f, 40.0f}, "Mixing bins - 3body radius"}; + ConfigurableAxis bins3BodyPhi{"mixingOpts.bins3BodyPhi", {VARIABLE_WIDTH, -180 * TMath::Pi() / 180, -120 * TMath::Pi() / 180, -60 * TMath::Pi() / 180, 0, 60 * TMath::Pi() / 180, 120 * TMath::Pi() / 180, 180 * TMath::Pi() / 180}, "Mixing bins - 3body phi (rad)"}; + ConfigurableAxis bins3BodyPhiDegree{"mixingOpts.bins3BodyPhiDegree", {VARIABLE_WIDTH, -180, -120, -60, 0, 60, 120, 180}, "Mixing bins - 3body phi (degree)"}; + ConfigurableAxis bins3BodyPosZ{"mixingOpts.bins3BodyPosZ", {VARIABLE_WIDTH, -500.0f, -200.0f, -100.0f, -70.0f, -60.0f, -50.0f, -40.0f, -35.0f, -30.0f, -25.0f, -20.0f, -15.0f, -13.0f, -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 13.0f, 15.0f, 20.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f, 60.0f, 70.0f, 100.0f, 200.0f, 500.0f}, "3body SV z position"}; + Configurable selectPVPosZ3bodyMixing{"selectPVPosZ3bodyMixing", true, "Select same pvPosZ events in case of 3body mixing"}; + Configurable maxDeltaPVPosZ3bodyMixing{"maxDeltaPVPosZ3bodyMixing", 1., "max difference between PV z position in case of 3body mixing"}; + // SVertexer selections + Configurable minPt2V0{"minPt2V0", 0.5, "Min Pt squared of V0"}; + Configurable maxTgl2V0{"maxTgl2V0", 4, "Max tgl squared of V0"}; + Configurable maxDCAXY2ToMeanVertex3bodyV0{"maxDCAXY2ToMeanVertex3bodyV0", 4, "Max DCA XY squared of V0 to mean vertex"}; + Configurable minCosPAXYMeanVertex3bodyV0{"minCosPAXYMeanVertex3bodyV0", 0.9, "Min cosPA XY of V0 to mean vertex"}; + Configurable minCosPA3bodyV0{"minCosPA3bodyV0", 0.8, "Min cosPA of V0"}; + Configurable maxRDiffV03body{"maxRDiffV03body", 3, "Max RDiff of V0 to 3body"}; + Configurable minPt3Body{"minPt3Body", 0.5, "Min Pt of 3body"}; + Configurable maxTgl3Body{"maxTgl3Body", 0.01, "Max tgl of 3body"}; + Configurable maxDCAXY3Body{"maxDCAXY3Body", 0.5, "Max DCA XY of 3body"}; + Configurable maxDCAZ3Body{"maxDCAZ3Body", 1.0, "Max DCA Z of 3body"}; + } mixingOpts; - // Filters and slices - Preslice perCollision = o2::aod::decay3body::collisionId; - Preslice perReducedCollision = o2::aod::reduceddecay3body::collisionId; + 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; + std::array genDecVtx{0.f}; + std::array genMomentum{0.f}; + float genCt; + float genPhi; + float genEta; + float genRapidity; + float genMomProton; + float genMomPion; + float genMomDeuteron; + float genPtProton; + float genPtPion; + float genPtDeuteron; + bool isTrueH3L; + bool isTrueAntiH3L; + bool isReco; + int daughterPrPdgCode; + int daughterPiPdgCode; + int daughterDePdgCode; + bool isDeuteronPrimary; + bool survivedEventSel; + }; + mc3Bodyinfo this3BodyMCInfo; + // CCDB and magnetic field int mRunNumber; float d_bz; - float maxSnp; // max sine phi for propagation - float maxStep; // max step size (cm) for propagation + Service ccdb; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + std::unordered_map ccdbCache; // Maps runNumber -> d_bz o2::base::MatLayerCylSet* lut = nullptr; - o2::vertexing::DCAFitterN<2> fitterV0; - o2::vertexing::DCAFitterN<3> fitter3body; + + // histogram registry + HistogramRegistry registry{"Registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // 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; - std::array mV0Hyps; // 0 - Lambda, 1 - AntiLambda - bool doUpdateGRPMagField = false; // if initialize magnetic field for each bc - o2::dataformats::VertexBase mMeanVertex{{0., 0., 0.}, {0.1 * 0.1, 0., 0.1 * 0.1, 0., 0., 6. * 6.}}; + + // 3body mixing + using Binning3BodyKF = ColumnBinningPolicy; + using Binning3BodyDCAfitter = ColumnBinningPolicy; + + // skimmed processing + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + // tracked cluster size + std::vector fTrackedClSizeVector; + + // MC info + std::vector isGoodCollision; void init(InitContext&) { @@ -379,276 +273,238 @@ struct decay3bodyBuilder { mRunNumber = 0; d_bz = 0; - maxSnp = 0.85f; // could be changed later - maxStep = 2.00f; // could be changed later - - // set hypothesis corresponds to Hyp3Body, tpcpid to be implemented - switch (motherhyp) { - case Hyp3Body::kH3L: - bachelorcharge = 1; - bachelorTOFPID.SetPidType(o2::track::PID::Deuteron); - break; - case Hyp3Body::kH4L: - bachelorcharge = 1; - bachelorTOFPID.SetPidType(o2::track::PID::Triton); - break; - case Hyp3Body::kHe4L: - bachelorcharge = 2; - bachelorTOFPID.SetPidType(o2::track::PID::Helium3); - break; - case Hyp3Body::kHe5L: - bachelorcharge = 2; - bachelorTOFPID.SetPidType(o2::track::PID::Alpha); - break; - default: - LOG(fatal) << "Wrong hypothesis for decay3body"; - return; - } - fitterV0.setPropagateToPCA(true); - fitterV0.setMaxR(200.); - fitterV0.setMinParamChange(1e-3); - fitterV0.setMinRelChi2Change(0.9); - fitterV0.setMaxDZIni(1e9); - fitterV0.setMaxChi2(1e9); - fitterV0.setUseAbsDCA(d_UseAbsDCA); - - fitter3body.setPropagateToPCA(true); - fitter3body.setMaxR(200.); //->maxRIni3body - fitter3body.setMinParamChange(1e-3); - fitter3body.setMinRelChi2Change(0.9); - fitter3body.setMaxDZIni(1e9); - fitter3body.setMaxChi2(1e9); - fitter3body.setUseAbsDCA(d_UseAbsDCA); - - // Material correction in the DCA fitter - ccdb->setURL(ccdburl); + mEnabledTables.resize(nTables, 0); + + // CCDB options + ccdb->setURL(ccdbConfigurations.ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + // Set material correction if (useMatCorrType == 1) { LOGF(info, "TGeo correction requested, loading geometry"); if (!o2::base::GeometryManager::isGeometryLoaded()) { - ccdb->get(geoPath); + ccdb->get(ccdbConfigurations.geoPath); } + matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo; } if (useMatCorrType == 2) { LOGF(info, "LUT correction requested, loading LUT"); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); - } - - // Material correction in the DCA fitter - if (useMatCorrType == 1) - matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo; - if (useMatCorrType == 2) + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbConfigurations.lutPath)); matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - - fitterV0.setMatCorrType(matCorr); - fitter3body.setMatCorrType(matCorr); - - // Add histograms separately for different process functions - if (doprocessRun3 == true || doprocessRun3Reduced) { - registry.add("hEventCounter", "hEventCounter", HistType::kTH1F, {{1, 0.0f, 1.0f}}); - } - - if (doprocessRun3 == true || doprocessRun3Reduced || doprocessRun3ReducedEM == true || doprocessRun3Reduced3bodyMixing == true || doprocessRun3Reduced3bodyMixingKFInfo == true) { - auto hVtx3BodyCounter = registry.add("hVtx3BodyCounter", "hVtx3BodyCounter", HistType::kTH1D, {{6, 0.0f, 6.0f}}); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(1, "Total"); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(2, "TPCNcls"); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(3, "PIDCut"); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(4, "HasSV"); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(5, "DcaDau"); - hVtx3BodyCounter->GetXaxis()->SetBinLabel(6, "CosPA"); - registry.add("hBachelorTOFNSigmaDe", "", HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}); } - if (doprocessRun3ReducedEM == true) { - registry.add("hEventCount", "hEventCount", HistType::kTH2F, {dcaFitterEMSel.binsVtxZ, dcaFitterEMSel.binsMultiplicity}); - registry.add("hEventPairs", "hEventPairs", HistType::kTH2F, {dcaFitterEMSel.binsVtxZ, dcaFitterEMSel.binsMultiplicity}); - registry.add("hDecay3BodyPairsBeforeCut", "hDecay3BodyPairsBeforeCut", HistType::kTH2F, {dcaFitterEMSel.binsVtxZ, dcaFitterEMSel.binsMultiplicity}); - registry.add("hDecay3BodyPairsAfterCut", "hDecay3BodyPairsAfterCut", HistType::kTH2F, {dcaFitterEMSel.binsVtxZ, dcaFitterEMSel.binsMultiplicity}); - registry.add("hRadius0", "hRadius0", HistType::kTH1F, {{200, 0.0f, 20.0f, "Radius (cm)"}}); - registry.add("hRadius1", "hRadius1", HistType::kTH1F, {{200, 0.0f, 20.0f, "Radius (cm)"}}); - registry.add("hDeltaRadius", "hDeltaRadius", HistType::kTH1F, {{400, -20.0f, 20.0f, "#Delta Radius (cm)"}}); - registry.add("hPhi0", "hPhi0", HistType::kTH1F, {{360, -180.0f, 180.0f, "#phi (degree)"}}); - registry.add("hPhi1", "hPhi1", HistType::kTH1F, {{360, -180.0f, 180.0f, "#phi (degree)"}}); - registry.add("hDeltaPhi", "hDeltaPhi", HistType::kTH1F, {{360, -180.0f, 180.0f, "#Delta #phi (degree)"}}); + helper.fitterV0.setMatCorrType(matCorr); + helper.fitter3body.setMatCorrType(matCorr); + + // set bachelor PID + bachelorTOFPID.SetPidType(o2::track::PID::Deuteron); + bachelorTOFPIDLabeled.SetPidType(o2::track::PID::Deuteron); + + // set decay3body parameters in the helper + helper.decay3bodyselections.maxEtaDaughters = decay3bodyBuilderOpts.maxEtaDaughters; + helper.decay3bodyselections.minTPCNClProton = decay3bodyBuilderOpts.minTPCNClProton; + helper.decay3bodyselections.minTPCNClPion = decay3bodyBuilderOpts.minTPCNClPion; + helper.decay3bodyselections.minTPCNClDeuteron = decay3bodyBuilderOpts.minTPCNClDeuteron; + helper.decay3bodyselections.minDCAProtonToPV = decay3bodyBuilderOpts.minDCAProtonToPV; + helper.decay3bodyselections.minDCAPionToPV = decay3bodyBuilderOpts.minDCAPionToPV; + helper.decay3bodyselections.minDCADeuteronToPV = decay3bodyBuilderOpts.minDCADeuteronToPV; + helper.decay3bodyselections.minPtProton = decay3bodyBuilderOpts.minPtProton; + helper.decay3bodyselections.minPtPion = decay3bodyBuilderOpts.minPtPion; + helper.decay3bodyselections.minPtDeuteron = decay3bodyBuilderOpts.minPtDeuteron; + helper.decay3bodyselections.maxPtProton = decay3bodyBuilderOpts.maxPtProton; + helper.decay3bodyselections.maxPtPion = decay3bodyBuilderOpts.maxPtPion; + helper.decay3bodyselections.maxPtDeuteron = decay3bodyBuilderOpts.maxPtDeuteron; + helper.decay3bodyselections.maxTPCnSigma = decay3bodyBuilderOpts.maxTPCnSigma; + helper.decay3bodyselections.minTOFnSigmaDeuteron = decay3bodyBuilderOpts.minTOFnSigmaDeuteron; + helper.decay3bodyselections.maxTOFnSigmaDeuteron = decay3bodyBuilderOpts.maxTOFnSigmaDeuteron; + helper.decay3bodyselections.minPDeuteronUseTOF = decay3bodyBuilderOpts.minPDeuteronUseTOF; + helper.decay3bodyselections.maxDCADauAtSV = decay3bodyBuilderOpts.maxDCADauAtSV; + helper.decay3bodyselections.maxRapidity = decay3bodyBuilderOpts.maxRapidity; + helper.decay3bodyselections.minPt = decay3bodyBuilderOpts.minPt; + helper.decay3bodyselections.maxPt = decay3bodyBuilderOpts.maxPt; + helper.decay3bodyselections.minMass = decay3bodyBuilderOpts.minMass; + helper.decay3bodyselections.maxMass = decay3bodyBuilderOpts.maxMass; + helper.decay3bodyselections.minCtau = decay3bodyBuilderOpts.minCtau; + helper.decay3bodyselections.maxCtau = decay3bodyBuilderOpts.maxCtau; + helper.decay3bodyselections.minCosPA = decay3bodyBuilderOpts.minCosPA; + helper.decay3bodyselections.maxChi2 = decay3bodyBuilderOpts.maxChi2; + + // set SVertexer selection parameters in the helper + helper.svertexerselections.minPt2V0 = mixingOpts.minPt2V0; + helper.svertexerselections.maxTgl2V0 = mixingOpts.maxTgl2V0; + helper.svertexerselections.maxDCAXY2ToMeanVertex3bodyV0 = mixingOpts.maxDCAXY2ToMeanVertex3bodyV0; + helper.svertexerselections.minCosPAXYMeanVertex3bodyV0 = mixingOpts.minCosPAXYMeanVertex3bodyV0; + helper.svertexerselections.minCosPA3bodyV0 = mixingOpts.minCosPA3bodyV0; + helper.svertexerselections.maxRDiffV03body = mixingOpts.maxRDiffV03body; + helper.svertexerselections.minPt3Body = mixingOpts.minPt3Body; + helper.svertexerselections.maxTgl3Body = mixingOpts.maxTgl3Body; + helper.svertexerselections.maxDCAXY3Body = mixingOpts.maxDCAXY3Body; + helper.svertexerselections.maxDCAZ3Body = mixingOpts.maxDCAZ3Body; + + // list enabled process functions + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + LOGF(info, " Decay3body builder: basic configuration listing"); + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + + if (doprocessRealData) { + LOGF(info, " ===> process function enabled: processRealData"); + } + if (doprocessRealDataReduced) { + LOGF(info, " ===> process function enabled: processRealDataReduced"); + } + if (doprocessRealDataReduced3bodyMixing) { + LOGF(info, " ===> process function enabled: processRealDataReduced3bodyMixing"); + } + if (doprocessMonteCarlo) { + LOGF(info, " ===> process function enabled: processMonteCarlo"); + } + + // list enabled tables + for (int i = 0; i < nTables; i++) { + if (mEnabledTables[i]) { + LOGF(info, " -~> Table enabled: %s", tableNames[i]); + } + } + + // print base cuts + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + LOGF(info, "-~> max daughter eta ..............: %f", decay3bodyBuilderOpts.maxEtaDaughters.value); + LOGF(info, "-~> min TPC ncls proton ...........: %i", decay3bodyBuilderOpts.minTPCNClProton.value); + LOGF(info, "-~> min TPC ncls pion .............: %i", decay3bodyBuilderOpts.minTPCNClPion.value); + LOGF(info, "-~> min TPC ncls bach .............: %i", decay3bodyBuilderOpts.minTPCNClDeuteron.value); + LOGF(info, "-~> min DCA proton to PV ..........: %f", decay3bodyBuilderOpts.minDCAProtonToPV.value); + LOGF(info, "-~> min DCA pion to PV ............: %f", decay3bodyBuilderOpts.minDCAPionToPV.value); + LOGF(info, "-~> min DCA bach to PV ............: %f", decay3bodyBuilderOpts.minDCADeuteronToPV.value); + LOGF(info, "-~> min pT proton .................: %f", decay3bodyBuilderOpts.minPtProton.value); + LOGF(info, "-~> min pT pion ...................: %f", decay3bodyBuilderOpts.minPtPion.value); + LOGF(info, "-~> min pT bach ...................: %f", decay3bodyBuilderOpts.minPtDeuteron.value); + LOGF(info, "-~> max pT proton .................: %f", decay3bodyBuilderOpts.maxPtProton.value); + LOGF(info, "-~> max pT pion ...................: %f", decay3bodyBuilderOpts.maxPtPion.value); + LOGF(info, "-~> max pT bach ...................: %f", decay3bodyBuilderOpts.maxPtDeuteron.value); + LOGF(info, "-~> max TPC nSigma ...............: %f", decay3bodyBuilderOpts.maxTPCnSigma.value); + 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 rapidity .................: %f", decay3bodyBuilderOpts.maxRapidity.value); + LOGF(info, "-~> min pT .......................: %f", decay3bodyBuilderOpts.minPt.value); + LOGF(info, "-~> max pT .......................: %f", decay3bodyBuilderOpts.maxPt.value); + LOGF(info, "-~> min mass .....................: %f", decay3bodyBuilderOpts.minMass.value); + LOGF(info, "-~> max mass .....................: %f", decay3bodyBuilderOpts.maxMass.value); + LOGF(info, "-~> min ctau .....................: %f", decay3bodyBuilderOpts.minCtau.value); + LOGF(info, "-~> max ctau .....................: %f", decay3bodyBuilderOpts.maxCtau.value); + LOGF(info, "-~> min cosPA ....................: %f", decay3bodyBuilderOpts.minCosPA.value); + LOGF(info, "-~> max chi2 .....................: %f", decay3bodyBuilderOpts.maxChi2.value); + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + + // bookkeeping histograms + auto h = registry.add("Counters/hTableBuildingStatistics", "hTableBuildingStatistics", kTH1D, {{nTablesConst, -0.5f, static_cast(nTablesConst)}}); + auto h2 = registry.add("Counters/hInputStatistics", "hInputStatistics", kTH1D, {{nTablesConst, -0.5f, static_cast(nTablesConst)}}); + h2->SetTitle("Input table sizes"); + + // configure tables to generate + for (int i = 0; i < nTables; i++) { + h->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str()); + h2->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str()); + h->SetBinContent(i + 1, 0); // mark all as disabled to start + + int f = enabledTables->get(tableNames[i].c_str(), "enable"); + if (f == 1) { + mEnabledTables[i] = 1; + h->SetBinContent(i + 1, 1); // mark enabled + } + } + + if (mEnabledTables[kVtx3BodyDatas] && mEnabledTables[kMcVtx3BodyDatas]) { + LOG(fatal) << "Tables Vtx3BodyDatas and McVtx3BodyDatas cannot both be enabled at the same time. Choose one!"; } - if (doprocessRun3Reduced3bodyMixing == true || doprocessRun3Reduced3bodyMixingKFInfo == true) { - registry.add("hDecay3BodyRadiusPhi", "hDecay3BodyRadiusPhi", HistType::kTH2F, {dcaFitterEMSel.bins3BodyRadius, dcaFitterEMSel.bins3BodyPhi}); - registry.add("hDecay3BodyPosZ", "hDecay3BodyPosZ", HistType::kTH1F, {dcaFitterEMSel.bins3BodyPosZ}); - auto h3bodyCombinationCounter = registry.add("h3bodyCombinationCounter", "h3bodyCombinationCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}}); - h3bodyCombinationCounter->GetXaxis()->SetBinLabel(1, "total"); - h3bodyCombinationCounter->GetXaxis()->SetBinLabel(2, "bach sign/ID"); - h3bodyCombinationCounter->GetXaxis()->SetBinLabel(3, "not same collision"); - h3bodyCombinationCounter->GetXaxis()->SetBinLabel(4, "collision VtxZ"); - } - - if (doprocessRun3ReducedEM == true || doprocessRun3Reduced3bodyMixing == true || doprocessRun3Reduced3bodyMixingKFInfo == true) { - doUpdateGRPMagField = true; - registry.add("h3bodyEMCutCounter", "h3bodyEMCutCounter", HistType::kTH1D, {{14, 0.0f, 14.0f}}); - } - - if (doprocessRun3withKFParticle == true || doprocessRun3withKFParticleStrangenessTracking == true || doprocessRun3withKFParticleReduced == true || doprocessRun3withKFParticleReducedEM == true || doprocessRun3withKFParticleReduced3bodyMixing == true) { - auto hEventCounterZorro = registry.add("Counters/hEventCounterZorro", "hEventCounterZorro", HistType::kTH1D, {{2, -0.5, 1.5}}); - hEventCounterZorro->GetXaxis()->SetBinLabel(1, "Zorro before evsel"); - hEventCounterZorro->GetXaxis()->SetBinLabel(2, "Zorro after evsel"); - auto hEventCounterKFParticle = registry.add("Counters/hEventCounterKFParticle", "hEventCounterKFParticle", HistType::kTH1D, {{4, 0.0f, 4.0f}}); - hEventCounterKFParticle->GetXaxis()->SetBinLabel(1, "total"); - hEventCounterKFParticle->GetXaxis()->SetBinLabel(2, "sel8"); - hEventCounterKFParticle->GetXaxis()->SetBinLabel(3, "vertexZ"); - hEventCounterKFParticle->GetXaxis()->SetBinLabel(4, "has candidate"); - hEventCounterKFParticle->LabelsOption("v"); - auto hVtx3BodyCounterKFParticle = registry.add("Counters/hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", HistType::kTH1D, {{21, 0.0f, 21.0f}}); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(1, "Total"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(2, "Charge"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(3, "Eta"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(4, "TPCNcls"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(5, "TPCRows"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(6, "TPCpid"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(7, "DCAxyPV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(8, "DCAzPV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(9, "V0MassConst"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(10, "HasSV"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(11, "DcaDau"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(12, "DCADauVtx"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(13, "DauPt"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(14, "Rapidity"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(15, "Pt"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(16, "Mass"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(17, "CosPA"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(18, "CosPAXY"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(19, "Chi2geo"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(20, "TopoConstr"); - hVtx3BodyCounterKFParticle->GetXaxis()->SetBinLabel(21, "Chi2topo"); - hVtx3BodyCounterKFParticle->LabelsOption("v"); - - registry.add("QA/Tracks/hTrackPosTPCNcls", "hTrackPosTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); - registry.add("QA/Tracks/hTrackNegTPCNcls", "hTrackNegTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); - registry.add("QA/Tracks/hTrackBachTPCNcls", "hTrackBachTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); - registry.add("QA/Tracks/hTrackPosHasTPC", "hTrackPosHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); - registry.add("QA/Tracks/hTrackNegHasTPC", "hTrackNegHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); - registry.add("QA/Tracks/hTrackBachHasTPC", "hTrackBachHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); - registry.add("QA/Tracks/hTrackBachITSClusSizes", "hTrackBachITSClusSizes", HistType::kTH1F, {{10, 0., 10., "ITS cluster sizes"}}); - registry.add("QA/Tracks/hTrackProtonTPCPID", "hTrackProtonTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); - registry.add("QA/Tracks/hTrackPionTPCPID", "hTrackPionTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); - registry.add("QA/Tracks/hTrackBachTPCPID", "hTrackBachTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); - registry.add("QA/Tracks/hTrackProtonPt", "hTrackProtonPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); - registry.add("QA/Tracks/hTrackPionPt", "hTrackPionPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); - registry.add("QA/Tracks/hTrackBachPt", "hTrackBachPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); - registry.add("QA/Event/hAllSelEventsVtxZ", "hAllSelEventsVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); - registry.add("QA/Event/hVtxXKF", "hVtxXKF", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV X (cm)"}}); - registry.add("QA/Event/hVtxYKF", "hVtxYKF", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV Y (cm)"}}); - registry.add("QA/Event/hVtxZKF", "hVtxZKF", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); - registry.add("QA/Event/hVtxCovXXKF", "hVtxCovXXKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XX) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovYYKF", "hVtxCovYYKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YY) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovZZKF", "hVtxCovZZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(ZZ) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovXYKF", "hVtxCovXYKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XY) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovXZKF", "hVtxCovXZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XZ) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovYZKF", "hVtxCovYZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YZ) (cm^{2})"}}); - registry.add("QA/Event/hVtxX", "hVtxX", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV X (cm)"}}); - registry.add("QA/Event/hVtxY", "hVtxY", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV Y (cm)"}}); - registry.add("QA/Event/hVtxZ", "hVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); - registry.add("QA/Event/hVtxCovXX", "hVtxCovXX", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XX) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovYY", "hVtxCovYY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YY) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovZZ", "hVtxCovZZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(ZZ) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovXY", "hVtxCovXY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XY) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovXZ", "hVtxCovXZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XZ) (cm^{2})"}}); - registry.add("QA/Event/hVtxCovYZ", "hVtxCovYZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YZ) (cm^{2})"}}); - } - - if (doprocessRun3withKFParticleReducedEM == true) { - registry.add("QA/EM/hPairCounterMixing", "hPairCounterMixing", HistType::kTH1D, {{1, 0.0f, 1.0f}}); - auto hCombinationCounterMixing = registry.add("QA/EM/hCombinationCounterMixing", "hCombinationCounterMixing", HistType::kTH1D, {{3, 0.0f, 3.0f}}); - hCombinationCounterMixing->GetXaxis()->SetBinLabel(1, "total"); - hCombinationCounterMixing->GetXaxis()->SetBinLabel(2, "bach sign/ID"); - hCombinationCounterMixing->GetXaxis()->SetBinLabel(3, "radius, phi"); - hCombinationCounterMixing->LabelsOption("v"); - - registry.add("QA/EM/hEventBinCounts", "hEventBinCounts", HistType::kTH2D, {{10, 0, 10, "bins VtxZ"}, {13, 0, 13, "bins mult"}}); - registry.add("QA/EM/h3bodyBinCounts", "h3bodyBinCounts", HistType::kTH2D, {{10, 0, 10, "bins VtxZ"}, {13, 0, 13, "bins mult"}}); - registry.add("QA/EM/hPairBinCounts", "hPairBinCounts", HistType::kTH2D, {{10, 0, 10, "bins VtxZ"}, {13, 0, 13, "bins mult"}}); - - registry.add("QA/EM/hRadius1", "hRadius1", HistType::kTH1F, {{200, 0.0f, 20.0f, "Radius (cm)"}}); - registry.add("QA/EM/hRadius2", "hRadius2", HistType::kTH1F, {{200, 0.0f, 20.0f, "Radius (cm)"}}); - registry.add("QA/EM/hPhi1", "hPhi1", HistType::kTH1F, {{360, 0.0f, 360.0f, "#phi (degree)"}}); - registry.add("QA/EM/hPhi2", "hPhi2", HistType::kTH1F, {{360, 0.0f, 360.0f, "#phi (degree)"}}); - registry.add("QA/EM/hDeltaRadius", "hDeltaRadius", HistType::kTH1F, {{200, 0.0f, 10.0f, "#Delta Radius (cm)"}}); - registry.add("QA/EM/hDeltaPhi", "hDeltaPhi", HistType::kTH1F, {{360, 0.0f, 360.0f, "#Delta #phi (degree)"}}); - } - - if (doprocessRun3withKFParticleReduced3bodyMixing == true) { - auto h3bodyCombinationCounter = registry.add("QA/EM/h3bodyCombinationCounter", "h3bodyCombinationCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}}); + // Add histograms separately for different process functions + if (doprocessRealData == true || doprocessMonteCarlo == true) { + auto hEventCounter = registry.add("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}}); + hEventCounter->GetXaxis()->SetBinLabel(1, "total"); + hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); + hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ"); + hEventCounter->LabelsOption("v"); + } + + if (doprocessRealData == true || doprocessRealDataReduced == true || doprocessMonteCarlo == true) { + if (doTrackQA) { // histograms for all daughter tracks of (selected) 3body candidates + registry.add("QA/Tracks/hTrackProtonTPCNcls", "hTrackProtonTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackPionTPCNcls", "hTrackPionTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackDeuteronTPCNcls", "hTrackDeuteronTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackProtonHasTPC", "hTrackProtonHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackPionHasTPC", "hTrackPionHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackDeuteronHasTPC", "hTrackDeuteronHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackDeuteronITSClusSizes", "hTrackDeuteronITSClusSizes", HistType::kTH1F, {{10, 0., 10., "ITS cluster sizes"}}); + registry.add("QA/Tracks/hTrackProtonTPCPID", "hTrackProtonTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackPionTPCPID", "hTrackPionTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackDeuteronTPCPID", "hTrackDeuteronTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackProtonPt", "hTrackProtonPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + registry.add("QA/Tracks/hTrackPionPt", "hTrackPionPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + registry.add("QA/Tracks/hTrackDeuteronPt", "hTrackDeuteronPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + } + if (doVertexQA) { + registry.add("QA/Event/hAllSelEventsVtxZ", "hAllSelEventsVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); + registry.add("QA/Event/hVtxX", "hVtxX", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV X (cm)"}}); + registry.add("QA/Event/hVtxY", "hVtxY", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV Y (cm)"}}); + registry.add("QA/Event/hVtxZ", "hVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); + registry.add("QA/Event/hVtxCovXX", "hVtxCovXX", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XX) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovYY", "hVtxCovYY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YY) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovZZ", "hVtxCovZZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(ZZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovXY", "hVtxCovXY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XY) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovXZ", "hVtxCovXZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovYZ", "hVtxCovYZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YZ) (cm^{2})"}}); + } + } + + if (doprocessRealDataReduced3bodyMixing == true) { + auto h3bodyCombinationCounter = registry.add("Mixing/h3bodyCombinationCounter", "h3bodyCombinationCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}}); h3bodyCombinationCounter->GetXaxis()->SetBinLabel(1, "total"); h3bodyCombinationCounter->GetXaxis()->SetBinLabel(2, "not same collision"); h3bodyCombinationCounter->GetXaxis()->SetBinLabel(3, "collision VtxZ"); h3bodyCombinationCounter->GetXaxis()->SetBinLabel(4, "bach sign/ID"); h3bodyCombinationCounter->LabelsOption("v"); - // registry.add("QA/EM/h3bodyBinCounts", "h3bodyBinCounts", HistType::kTH3D, {{16, 0, 16, "bins radius"}, {36, 0, 36, "bins phi"}, {12, 0, 12, "bins pos Z"}}); - registry.add("QA/EM/h3bodyBinCounts", "h3bodyBinCounts", HistType::kTH2D, {{16, 0, 16, "bins radius"}, {18, 0, 18, "bins phi"}}); - - AxisSpec radiusAxis = {kfparticleConfigurations.bins3BodyRadius, "Radius (cm)"}; - AxisSpec phiAxis = {kfparticleConfigurations.bins3BodyPhi, "#phi (degree)"}; - AxisSpec posZAxis = {kfparticleConfigurations.bins3BodyPosZ, "position in z (cm)"}; - - registry.add("QA/EM/hRadius", "hRadius", HistType::kTH1F, {radiusAxis}); - registry.add("QA/EM/hPhi", "hPhi", HistType::kTH1F, {phiAxis}); - registry.add("QA/EM/hPosZ", "hPosZ", HistType::kTH1F, {posZAxis}); + registry.add("Mixing/hDecay3BodyRadiusPhi", "hDecay3BodyRadiusPhi", HistType::kTH2F, {mixingOpts.bins3BodyRadius, mixingOpts.bins3BodyPhi}); + registry.add("Mixing/hDecay3BodyPosZ", "hDecay3BodyPosZ", HistType::kTH1F, {mixingOpts.bins3BodyPosZ}); } } - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + template + bool initCCDB(aod::BCsWithTimestamps const& bcs, TCollisions const& collisions) { - if (mRunNumber == bc.runNumber()) { - return; + 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 (kfparticleConfigurations.cfgSkimmedProcessing) { - zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), kfparticleConfigurations.triggerList); - zorro.populateHistRegistry(registry, bc.runNumber()); + + if (mRunNumber == bc.runNumber()) { + return true; } - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - fitterV0.setBz(d_bz); - fitter3body.setBz(d_bz); -#ifdef HomogeneousField - KFParticle::SetField(d_bz); -#endif - 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; + if (doSkimmedProcessing) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); + zorro.populateHistRegistry(registry, bc.runNumber()); } - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + auto timestamp = bc.timestamp(); o2::parameters::GRPMagField* grpmag = 0x0; - 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); - d_bz = o2::base::Propagator::Instance()->getNominalBz(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - // Set magnetic field value once known - fitterV0.setBz(d_bz); - fitter3body.setBz(d_bz); + grpmag = ccdb->getForTimeStamp(ccdbConfigurations.grpmagPath, timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField for timestamp " << timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + // Fetch magnetic field from ccdb for current collision + auto d_bz = o2::base::Propagator::Instance()->getNominalBz(); + LOG(info) << "Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << d_bz << " kG"; + + // set magnetic field value for DCA fitter + helper.fitterV0.setBz(d_bz); + helper.fitter3body.setBz(d_bz); // Set magnetic field for KF vertexing #ifdef HomogeneousField KFParticle::SetField(d_bz); @@ -657,1853 +513,849 @@ struct decay3bodyBuilder { if (useMatCorrType == 2) { // setMatLUT only after magfield has been initalized // (setMatLUT has implicit and problematic init field call if not) + LOG(info) << "Loading material look-up table for timestamp: " << timestamp; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->getForTimeStamp(ccdbConfigurations.lutPath, timestamp)); o2::base::Propagator::Instance()->setMatLUT(lut); } + // mark run as configured + mRunNumber = bc.runNumber(); + // Initial TOF PID Paras, copied from PIDTOF.h - timestamp.value = bc.timestamp(); - ccdb->setTimestamp(timestamp.value); + 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 (passName.value == "") { - passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << passName.value << "'"; + 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 '" << passName.value << "'"; + LOG(info) << "Using parameter collection, starting from pass '" << tofPIDOpts.passName.value << "'"; - const std::string fname = paramFileName.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: " << parametrizationPath.value; + LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << tofPIDOpts.parametrizationPath.value; if (1) { o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, parametrizationPath.value); + paramCollection.loadParamFromFile(fname, tofPIDOpts.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()); + 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", passName.value.data()); + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", tofPIDOpts.passName.value.data()); } } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(passName.value)); + mRespParamsV2.setShiftParameters(paramCollection.getPars(tofPIDOpts.passName.value)); mRespParamsV2.printShiftParameters(); } } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); + mRespParamsV2.loadParamFromFile(fname.data(), tofPIDOpts.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); + } 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, 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()); + 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", passName.value.data()); + 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(passName.value)); + mRespParamsV2.setShiftParameters(paramCollection->getPars(tofPIDOpts.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); + 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", timeShiftCCDBPath.value.c_str()), timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", timeShiftCCDBPath.value.c_str()), timestamp.value), false); + 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); + + return true; } - void initCCDBfromRunNumber(int runNumber) + float getMagFieldFromRunNumber(int runNumber) { - // set magnetic field only when run number changes - if (mRunNumber == runNumber) { - LOG(debug) << "CCDB initialized for run " << mRunNumber; - return; - } - mRunNumber = runNumber; // Update the last run number - + float magField; // Check if the CCDB data for this run is already cached if (ccdbCache.find(runNumber) != ccdbCache.end()) { LOG(debug) << "CCDB data already cached for run " << runNumber; - d_bz = ccdbCache[runNumber]; - if (doUpdateGRPMagField == true) { - o2::base::Propagator::initFieldFromGRP(grpMagCache[runNumber].get()); - } + magField = ccdbCache[runNumber]; + // if not, retrieve it from CCDB } else { - std::shared_ptr grpmag = std::make_shared(*ccdb->getForRun(grpmagPath, runNumber)); + std::shared_ptr grpmag = std::make_shared(*ccdb->getForRun(ccdbConfigurations.grpmagPath, runNumber)); if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for run number " << runNumber; + LOG(fatal) << "Got nullptr from CCDB for path " << ccdbConfigurations.grpmagPath << " of object GRPMagField and " << ccdbConfigurations.grpPath << " of object GRPObject for run number " << runNumber; } o2::base::Propagator::initFieldFromGRP(grpmag.get()); // Fetch magnetic field from ccdb for current collision - d_bz = o2::base::Propagator::Instance()->getNominalBz(); + magField = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << "Retrieved GRP for run number " << runNumber << " with magnetic field of " << d_bz << " kZG"; - ccdbCache[runNumber] = d_bz; - grpMagCache[runNumber] = grpmag; + // cache magnetic field info + ccdbCache[runNumber] = magField; + } + return magField; + } + + void initFittersWithMagField(int runNumber, float magField) + { + // set magnetic field only when run number changes + if (mRunNumber == runNumber) { + LOG(debug) << "CCDB initialized for run " << mRunNumber; + return; } + mRunNumber = runNumber; // Update the last run number + + // update propagator + o2::base::Propagator::Instance()->setNominalBz(magField); // Set magnetic field for KF vertexing #ifdef HomogeneousField - KFParticle::SetField(d_bz); + KFParticle::SetField(magField); #endif // Set field for DCAfitter - fitterV0.setBz(d_bz); - fitter3body.setBz(d_bz); - - mV0Hyps[0].set(o2::track::PID::Lambda, o2::track::PID::Proton, o2::track::PID::Pion, pidCutsLambda, d_bz); - mV0Hyps[1].set(o2::track::PID::Lambda, o2::track::PID::Pion, o2::track::PID::Proton, pidCutsLambda, d_bz); + helper.fitterV0.setBz(magField); + helper.fitter3body.setBz(magField); if (useMatCorrType == 2) { - // setMatLUT only after magfield has been initalized + // setMatLUT only after magfield has been initalized (setMatLUT has implicit and problematic init field call if not) o2::base::Propagator::Instance()->setMatLUT(lut); } - - // cache magnetic field info - ccdbCache[runNumber] = d_bz; } - //------------------------------------------------------------------ - //-------------------- DCA fitter reconstruction ------------------- - //------------------------------------------------------------------ - // Select decay3body candidate based on daughter track PID - template - bool checkPID(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackBachelor, const double& tofNSigmaBach) - { - if ((tofNSigmaBach < TofPidNsigmaMin || tofNSigmaBach > TofPidNsigmaMax) && trackBachelor.p() > minBachPUseTOF) { - return false; - } - if (std::abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut) { - return false; - } - if (std::abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut) { - return false; - } - return true; - } - // PID check for H3L - template - bool checkPIDH3L(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackBachelor, const double& tofNSigmaBach) + // ______________________________________________________________ + // function to build decay3body candidates + template + void buildCandidates(TBCs const&, + TCollisions const& collisions, + T3Bodys const& decay3bodys, + TMCParticles const& mcParticles, + TMCCollisions const& mcCollisions) { - if ((std::abs(trackBachelor.tpcNSigmaDe()) > TpcPidNsigmaCut) || !checkPID(trackProton, trackPion, trackBachelor, tofNSigmaBach)) { - return false; + if (!(mEnabledTables[kVtx3BodyDatas] || mEnabledTables[kMcVtx3BodyDatas])) { + LOG(info) << "No request for candidate analysis table in place, skipping candidate building." << std::endl; + return; // don't do if no request for decay3bodys in place } - return true; - } - //------------------------------------------------------------------ - // 3body candidate builder - template - void fillVtxCand(TCollisionTable const& collision, TTrackTable const& t0, TTrackTable const& t1, TTrackTable const& t2, int64_t decay3bodyId, int bachelorcharge = 1, double tofNSigmaBach = -999, bool saveInTable = true) - { - registry.fill(HIST("hVtx3BodyCounter"), kVtxAll); + // prepare MC container (not necessarily used) + std::vector mcParticleIsReco; - if (t0.tpcNClsFound() < mintpcNCls || t1.tpcNClsFound() < mintpcNCls || t2.tpcNClsFound() < mintpcNCls) { - return; + // clear and reserve size for MC info vectors + if constexpr (soa::is_table) { + isGoodCollision.resize(mcCollisions.size(), false); + mcParticleIsReco.resize(mcParticles.size(), false); } - registry.fill(HIST("hVtx3BodyCounter"), kVtxTPCNcls); - if (enablePidCut) { - if (t2.sign() > 0) { - if (!checkPIDH3L(t0, t1, t2, tofNSigmaBach)) - return; - } else { - if (!checkPIDH3L(t1, t0, t2, tofNSigmaBach)) - return; - } - } + // Loop over collisions for vertex QA + for (const auto& collision : collisions) { + if constexpr (soa::is_table) { // only do if NOT running over reduced data (already done in reducedCreator) + // Zorro event counting + bool isZorroSelected = false; + if (doSkimmedProcessing) { + isZorroSelected = zorro.isSelected(collision.template bc_as().globalBC()); + if (!isZorroSelected && onlyKeepInterestedTrigger) { + continue; + } + } - registry.fill(HIST("hVtx3BodyCounter"), kVtxPIDCut); + // event counting + registry.fill(HIST("Counters/hEventCounter"), 0.5); + if (doSel8selection && !collision.sel8()) { + continue; + } + registry.fill(HIST("Counters/hEventCounter"), 1.5); + if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { + continue; + } + registry.fill(HIST("Counters/hEventCounter"), 2.5); + } + + // vertex QA and counting + if (doVertexQA) { + registry.fill(HIST("QA/Event/hAllSelEventsVtxZ"), collision.posZ()); + registry.fill(HIST("QA/Event/hVtxX"), collision.posX()); + registry.fill(HIST("QA/Event/hVtxY"), collision.posY()); + registry.fill(HIST("QA/Event/hVtxZ"), collision.posZ()); + registry.fill(HIST("QA/Event/hVtxCovXX"), collision.covXX()); + registry.fill(HIST("QA/Event/hVtxCovYY"), collision.covYY()); + registry.fill(HIST("QA/Event/hVtxCovZZ"), collision.covZZ()); + registry.fill(HIST("QA/Event/hVtxCovXY"), collision.covXY()); + registry.fill(HIST("QA/Event/hVtxCovXZ"), collision.covXZ()); + registry.fill(HIST("QA/Event/hVtxCovYZ"), collision.covYZ()); + } + + // In case of MC: reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision + if constexpr (soa::is_table) { + if (collision.mcCollisionId() >= 0) { + isGoodCollision[collision.mcCollisionId()] = true; + } + } + } // loop over collisions - // Calculate DCA with respect to the collision associated to the V0, not individual tracks - std::array dcaInfo; + // Loop over all decay3bodys in same time frame + registry.fill(HIST("Counters/hInputStatistics"), kVtx3BodyDatas, decay3bodys.size()); + int lastRunNumber = -1; + for (const auto& decay3body : decay3bodys) { + // skip decay3body without assigned collision + /// TODO: do we want this?? + if (decay3body.collisionId() < 0) { + return; + } - auto Track0Par = getTrackPar(t0); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track0dcaXY = dcaInfo[0]; - auto Track0dca = std::sqrt(Track0dcaXY * Track0dcaXY + dcaInfo[1] * dcaInfo[1]); + // aquire collision + auto const& collision = collisions.rawIteratorAt(decay3body.collisionId()); - auto Track1Par = getTrackPar(t1); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track1dcaXY = dcaInfo[0]; - auto Track1dca = std::sqrt(Track1dcaXY * Track1dcaXY + dcaInfo[1] * dcaInfo[1]); + // initialise CCDB from run number saved in reduced collisions table when running over reduced data + if constexpr (!soa::is_table) { // only do if running over reduced data (otherwise CCDB is initialised in process function) + if (collision.runNumber() != lastRunNumber) { + initFittersWithMagField(collision.runNumber(), getMagFieldFromRunNumber(collision.runNumber())); + lastRunNumber = collision.runNumber(); // Update the last run number + LOG(debug) << "CCDB initialized for run " << lastRunNumber; + } + } - auto Track2Par = getTrackPar(t2); - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track2dcaXY = dcaInfo[0]; - auto Track2dca = std::sqrt(Track2dcaXY * Track2dcaXY + dcaInfo[1] * dcaInfo[1]); + // event selection + if constexpr (soa::is_table) { + if (doSel8selection && !collision.sel8()) { // only when NOT running over reduced data + continue; + } + } + if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { + continue; + } - auto Track0 = getTrackParCov(t0); - auto Track1 = getTrackParCov(t1); - auto Track2 = getTrackParCov(t2); - int n3bodyVtx = fitter3body.process(Track0, Track1, Track2); - if (n3bodyVtx == 0) { // discard this pair - return; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxhasSV); + // aquire tracks + auto trackPos = decay3body.template track0_as(); + auto trackNeg = decay3body.template track1_as(); + auto trackDeuteron = decay3body.template track2_as(); + auto trackProton = trackPos; + auto trackPion = trackNeg; + if (trackDeuteron.sign() < 0) { + trackProton = trackNeg; + trackPion = trackPos; + } + + // get deuteron TOF PID + float tofNSigmaDeuteron; + if constexpr (!soa::is_table) { // running over derived data + 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); + } else { // running over real data + tofNSigmaDeuteron = getTOFnSigma(collision, trackDeuteron); + } + } - std::array pos = {0.}; - const auto& vtxXYZ = fitter3body.getPCACandidate(); - for (int i = 0; i < 3; i++) { - pos[i] = vtxXYZ[i]; - } + /// build Decay3body candidate + if (!helper.buildDecay3BodyCandidate(collision, + trackProton, + trackPion, + trackDeuteron, + decay3body.globalIndex(), + tofNSigmaDeuteron, + fTrackedClSizeVector[decay3body.globalIndex()], + decay3bodyBuilderOpts.useKFParticle, + decay3bodyBuilderOpts.kfSetTopologicalConstraint, + decay3bodyBuilderOpts.useSelections, + decay3bodyBuilderOpts.useTPCforPion, + decay3bodyBuilderOpts.acceptTPCOnly, + decay3bodyBuilderOpts.calculateCovariance, + false /*isEventMixing*/)) { + continue; + } - std::array p0 = {0.}, p1 = {0.}, p2{0.}; - const auto& propagatedTrack0 = fitter3body.getTrack(0); - const auto& propagatedTrack1 = fitter3body.getTrack(1); - const auto& propagatedTrack2 = fitter3body.getTrack(2); - propagatedTrack0.getPxPyPzGlo(p0); - propagatedTrack1.getPxPyPzGlo(p1); - propagatedTrack2.getPxPyPzGlo(p2); - for (int i = 0; i < 3; i++) { - p2[i] *= bachelorcharge; - } - std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; + // fill QA histograms + if (doTrackQA) { // histograms filled for daughter tracks of (selected) 3body candidates + registry.fill(HIST("QA/Tracks/hTrackProtonTPCNcls"), trackProton.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackPionTPCNcls"), trackPion.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackDeuteronTPCNcls"), trackDeuteron.tpcNClsFound()); + registry.fill(HIST("QA/Tracks/hTrackProtonHasTPC"), trackProton.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackPionHasTPC"), trackPion.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackDeuteronHasTPC"), trackDeuteron.hasTPC()); + registry.fill(HIST("QA/Tracks/hTrackDeuteronITSClusSizes"), trackDeuteron.itsClusterSizes()); + registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackProton.sign() * trackProton.tpcInnerParam(), trackProton.tpcNSigmaPr()); + registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackPion.sign() * trackPion.tpcInnerParam(), trackPion.tpcNSigmaPi()); + registry.fill(HIST("QA/Tracks/hTrackDeuteronTPCPID"), trackDeuteron.sign() * trackDeuteron.tpcInnerParam(), trackDeuteron.tpcNSigmaDe()); + registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackProton.pt()); + registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackPion.pt()); + registry.fill(HIST("QA/Tracks/hTrackDeuteronPt"), trackDeuteron.pt()); + } + + // generate analysis tables with current candidate (only Vtx3BodyDatas is filled here, McVtx3BodyDatas table is filled later) + if (!mEnabledTables[kMcVtx3BodyDatas]) { + fillAnalysisTables(); + } + + // ___________________________________________________________ + // MC handling part: matching of reconstructed candidates + // ___________________________________________________________ + // fill MC table with reco MC candidate information and gen information if matched to MC particle + if constexpr (soa::is_table) { + // MC info + resetMCInfo(this3BodyMCInfo); + this3BodyMCInfo.isReco = true; + + // check if daughters have MC particle + if (!trackProton.has_mcParticle() || !trackPion.has_mcParticle() || !trackDeuteron.has_mcParticle()) { + continue; + } - if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { - return; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxDcaDau); + // get MC daughter particles + auto mcTrackProton = trackProton.template mcParticle_as(); + auto mcTrackPion = trackPion.template mcParticle_as(); + auto mcTrackDeuteron = trackDeuteron.template mcParticle_as(); + + // set daughter MC info (also for non-matched candidates) + this3BodyMCInfo.daughterPrPdgCode = mcTrackProton.pdgCode(); + this3BodyMCInfo.daughterPiPdgCode = mcTrackPion.pdgCode(); + this3BodyMCInfo.daughterDePdgCode = mcTrackDeuteron.pdgCode(); + this3BodyMCInfo.isDeuteronPrimary = mcTrackDeuteron.isPhysicalPrimary(); + this3BodyMCInfo.genMomProton = mcTrackProton.p(); + this3BodyMCInfo.genMomPion = mcTrackPion.p(); + this3BodyMCInfo.genMomDeuteron = mcTrackDeuteron.p(); + this3BodyMCInfo.genPtProton = mcTrackProton.pt(); + this3BodyMCInfo.genPtPion = mcTrackPion.pt(); + this3BodyMCInfo.genPtDeuteron = mcTrackDeuteron.pt(); + + // check if reco mother is true H3L/Anti-H3l + bool isMuonReco; + int motherID = checkH3LTruth(mcTrackProton, mcTrackPion, mcTrackDeuteron, isMuonReco); + + // get generated mother MC info + if (motherID > 0) { + auto mcTrackH3L = mcParticles.rawIteratorAt(motherID); + int chargeFactor = mcTrackH3L.pdgCode() > 0 ? 1 : -1; + this3BodyMCInfo.label = motherID; + this3BodyMCInfo.genMomentum = {mcTrackH3L.px(), mcTrackH3L.py(), mcTrackH3L.pz()}; + this3BodyMCInfo.genDecVtx = {mcTrackProton.vx(), mcTrackProton.vy(), mcTrackProton.vz()}; + this3BodyMCInfo.genCt = RecoDecay::sqrtSumOfSquares(mcTrackProton.vx() - mcTrackH3L.vx(), mcTrackProton.vy() - mcTrackH3L.vy(), mcTrackProton.vz() - mcTrackH3L.vz()) * o2::constants::physics::MassHyperTriton / mcTrackH3L.p(); + this3BodyMCInfo.genPhi = mcTrackH3L.phi(); + this3BodyMCInfo.genEta = mcTrackH3L.eta(); + this3BodyMCInfo.genRapidity = mcTrackH3L.y(); + this3BodyMCInfo.isTrueH3L = chargeFactor > 0; + this3BodyMCInfo.isTrueAntiH3L = chargeFactor < 0; + } - float VtxcosPA = RecoDecay::cpa(std::array{collision.posX(), collision.posY(), collision.posZ()}, std::array{pos[0], pos[1], pos[2]}, std::array{p3B[0], p3B[1], p3B[2]}); - if (VtxcosPA < minCosPA3body) { - return; - } - registry.fill(HIST("hVtx3BodyCounter"), kVtxCosPA); - registry.fill(HIST("hBachelorTOFNSigmaDe"), t2.sign() * t2.p(), tofNSigmaBach); - - // additional cut for EM - if (decay3bodyId == -1) { - registry.fill(HIST("h3bodyEMCutCounter"), 0.5); - auto v0Track0 = getTrackParCov(t0); - auto v0Track1 = getTrackParCov(t1); - int nV0 = fitterV0.process(v0Track0, v0Track1); - if (nV0 == 0) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 1.5); + // fill analysis tables (only McVtx3BodyDatas is filled here) + fillAnalysisTables(); - std::array v0pos = {0.}; - const auto& v0vtxXYZ = fitterV0.getPCACandidate(); - for (int i = 0; i < 3; i++) { - v0pos[i] = v0vtxXYZ[i]; - } - const int cand = 0; - if (!fitterV0.isPropagateTracksToVertexDone(cand) && !fitterV0.propagateTracksToVertex(cand)) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 2.5); - - const auto& trPProp = fitterV0.getTrack(0, cand); - const auto& trNProp = fitterV0.getTrack(1, cand); - std::array pP{}, pN{}; - trPProp.getPxPyPzGlo(pP); - trNProp.getPxPyPzGlo(pN); - std::array pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]}; - // Cut for Virtual V0 - float dxv0 = v0pos[0] - mMeanVertex.getX(), dyv0 = v0pos[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; - float rv0 = std::sqrt(r2v0); - float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; - if (dcaFitterEMSel.cfgApplyV0Cut && pt2V0 <= dcaFitterEMSel.mMinPt2V0) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 3.5); - if (dcaFitterEMSel.cfgApplyV0Cut && pV0[2] * pV0[2] / pt2V0 > dcaFitterEMSel.mMaxTgl2V0) { // tgLambda cut - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 4.5); - - float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); - // apply mass selections - float p2Pos = pP[0] * pP[0] + pP[1] * pP[1] + pP[2] * pP[2], p2Neg = pN[0] * pN[0] + pN[1] * pN[1] + pN[2] * pN[2]; - bool good3bodyV0Hyp = false; - for (int ipid = 0; ipid < 2; ipid++) { - float massForLambdaHyp = mV0Hyps[ipid].calcMass(p2Pos, p2Neg, p2V0); - if (massForLambdaHyp - mV0Hyps[ipid].getMassV0Hyp() < mV0Hyps[ipid].getMargin(ptV0)) { - good3bodyV0Hyp = true; - break; + // mark mcParticle as reconstructed + if (this3BodyMCInfo.label > -1) { + mcParticleIsReco[this3BodyMCInfo.label] = true; + } + } // constexpr requires mcParticles check + } // decay3body loop + + // ____________________________________________________________________ + // MC handling part: generated information of non-reco candidates + // ____________________________________________________________________ + if constexpr (soa::is_table) { + for (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; } - } - if (dcaFitterEMSel.cfgApplyV0Cut && !good3bodyV0Hyp) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 5.5); - float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; - float cosPAXY = prodXYv0 / rv0 * ptV0; - if (dcaFitterEMSel.cfgApplyV0Cut && dca2 > dcaFitterEMSel.mMaxDCAXY2ToMeanVertex3bodyV0) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 6.5); - // FIXME: V0 cosPA cut to be investigated - if (dcaFitterEMSel.cfgApplyV0Cut && cosPAXY < dcaFitterEMSel.minCosPAXYMeanVertex3bodyV0) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 7.5); - // Check: CosPA Cut of Virtual V0 may not be used since the V0 may be based on another PV - float dx = v0pos[0] - collision.posX(), dy = v0pos[1] - collision.posY(), dz = v0pos[2] - collision.posZ(), prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; - float v0CosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); - if (dcaFitterEMSel.cfgApplyV0Cut && v0CosPA < dcaFitterEMSel.minCosPA3bodyV0) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 8.5); + // set flag if corresponding MC collision has matched reconstructed collision which passed event selection + this3BodyMCInfo.survivedEventSel = isGoodCollision[mcparticle.mcCollisionId()]; - float r3body = std::hypot(pos[0], pos[1]); - if (r3body < 0.5) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 9.5); + // check if MC particle is hypertriton + if (std::abs(mcparticle.pdgCode()) != 1010010030) { + continue; + } - // Cut for the compatibility of V0 and 3body vertex - float deltaR = std::abs(rv0 - r3body); - if (deltaR > dcaFitterEMSel.maxRDiffV03body) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 10.5); + // check daughter identities + bool haveProton = false, havePion = false, haveDeuteron = false; + bool haveAntiProton = false, haveAntiPion = false, haveAntiDeuteron = false; + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == PDG_t::kProton) + haveProton = true; + if (mcparticleDaughter.pdgCode() == PDG_t::kProtonBar) + haveAntiProton = true; + if (mcparticleDaughter.pdgCode() == PDG_t::kPiPlus) + havePion = true; + if (mcparticleDaughter.pdgCode() == PDG_t::kPiMinus) + haveAntiPion = true; + if (mcparticleDaughter.pdgCode() == 1000010020) + haveDeuteron = true; + if (mcparticleDaughter.pdgCode() == -1000010020) + haveAntiDeuteron = true; + } - float pt3B = std::hypot(p3B[0], p3B[1]); - if (pt3B < dcaFitterEMSel.minPt3Body) { // pt cut - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 11.5); - if (p3B[2] / pt3B > dcaFitterEMSel.maxTgl3Body) { // tgLambda cut - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 12.5); - - // H3L DCA Check - const auto& vertexXYZ = fitter3body.getPCACandidatePos(); - auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, t2.sign()); - o2::dataformats::DCA dca; - if (!track3B.propagateToDCA({{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || - std::abs(dca.getY()) > dcaFitterEMSel.maxDCAXY3Body || std::abs(dca.getZ()) > dcaFitterEMSel.maxDCAZ3Body) { - return; - } - registry.fill(HIST("h3bodyEMCutCounter"), 13.5); - } + // check if hypertriton decayed via 3-body decay and is particle or anti-particle + if ((haveProton && haveAntiPion && haveDeuteron) || (haveAntiProton && havePion && haveAntiDeuteron)) { + if (mcparticle.pdgCode() > 0) { + this3BodyMCInfo.isTrueH3L = true; + } else if (mcparticle.pdgCode() < 0) { + this3BodyMCInfo.isTrueAntiH3L = true; + } + // get daughters + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (std::abs(mcparticleDaughter.pdgCode()) == PDG_t::kProton) { // proton + this3BodyMCInfo.genMomProton = mcparticleDaughter.p(); + this3BodyMCInfo.genPtProton = mcparticleDaughter.pt(); + this3BodyMCInfo.daughterPrPdgCode = mcparticleDaughter.pdgCode(); + this3BodyMCInfo.genDecVtx = {mcparticleDaughter.vx(), mcparticleDaughter.vy(), mcparticleDaughter.vz()}; + } else if (std::abs(mcparticleDaughter.pdgCode()) == PDG_t::kPiPlus) { // pion + this3BodyMCInfo.genMomPion = mcparticleDaughter.p(); + this3BodyMCInfo.genPtPion = mcparticleDaughter.pt(); + this3BodyMCInfo.daughterPiPdgCode = mcparticleDaughter.pdgCode(); + } else if (std::abs(mcparticleDaughter.pdgCode()) == 1000010020) { // deuteron + this3BodyMCInfo.genMomDeuteron = mcparticleDaughter.p(); + this3BodyMCInfo.genPtDeuteron = mcparticleDaughter.pt(); + this3BodyMCInfo.daughterDePdgCode = mcparticleDaughter.pdgCode(); + this3BodyMCInfo.isDeuteronPrimary = mcparticleDaughter.isPhysicalPrimary(); + } + } + } else { + continue; // stop if particle is not decayed via 3-body decay + } - VtxCandidate candVtx; - candVtx.track0Id = t0.globalIndex(); - candVtx.track1Id = t1.globalIndex(); - candVtx.track2Id = t2.globalIndex(); - candVtx.collisionId = collision.globalIndex(); - candVtx.decay3bodyId = decay3bodyId; - candVtx.vtxPos[0] = pos[0]; - candVtx.vtxPos[1] = pos[1]; - candVtx.vtxPos[2] = pos[2]; - candVtx.track0P[0] = p0[0]; - candVtx.track0P[1] = p0[1]; - candVtx.track0P[2] = p0[2]; - candVtx.track1P[0] = p1[0]; - candVtx.track1P[1] = p1[1]; - candVtx.track1P[2] = p1[2]; - candVtx.track2P[0] = p2[0]; - candVtx.track2P[1] = p2[1]; - candVtx.track2P[2] = p2[2]; - candVtx.dcadaughters = fitter3body.getChi2AtPCACandidate(); - candVtx.daudcaxytopv[0] = Track0dcaXY; - candVtx.daudcaxytopv[1] = Track1dcaXY; - candVtx.daudcaxytopv[2] = Track2dcaXY; - candVtx.daudcatopv[0] = Track0dca; - candVtx.daudcatopv[1] = Track1dca; - candVtx.daudcatopv[2] = Track2dca; - candVtx.bachelortofNsigma = tofNSigmaBach; - if (saveInTable) { - fillVtx3BodyTable(candVtx); - } else { - VtxCandidates.push_back(candVtx); - } + // calculate ctau + this3BodyMCInfo.genCt = RecoDecay::sqrtSumOfSquares(this3BodyMCInfo.genDecVtx[0] - mcparticle.vx(), this3BodyMCInfo.genDecVtx[1] - mcparticle.vy(), this3BodyMCInfo.genDecVtx[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); + + // fill MCDecay3BodyCores table if requested + if (mEnabledTables[kMcVtx3BodyDatas]) { + products.mcvtx3bodydatas(-1, // sign + -1., -1., // mass, massV0 + -1., -1., -1., // position + -1., -1., -1., // momentum + -1., // chi2 + -1., // trackedClSize + -1., -1., -1., // momProton + -1., -1., -1., // momPion + -1., -1., -1., // momDeuteron + -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., -1., -1., -1., // tpcNsigma: 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp + -1., // tofNsigmaDeuteron + -1., -1., -1., // average ITS cluster sizes: proton, pion, deuteron + -1., -1., -1., // TPCNCl: proton, pion, deuteron + -1., // pidForTrackingDeuteron + // MC information + mcparticle.px(), mcparticle.py(), mcparticle.pz(), + this3BodyMCInfo.genDecVtx[0], this3BodyMCInfo.genDecVtx[1], this3BodyMCInfo.genDecVtx[2], + this3BodyMCInfo.genCt, + mcparticle.phi(), mcparticle.eta(), mcparticle.y(), + this3BodyMCInfo.genMomProton, this3BodyMCInfo.genMomPion, this3BodyMCInfo.genMomDeuteron, + this3BodyMCInfo.genPtProton, this3BodyMCInfo.genPtPion, this3BodyMCInfo.genPtDeuteron, + this3BodyMCInfo.isTrueH3L, this3BodyMCInfo.isTrueAntiH3L, + this3BodyMCInfo.isReco, + this3BodyMCInfo.daughterPrPdgCode, this3BodyMCInfo.daughterPiPdgCode, this3BodyMCInfo.daughterDePdgCode, + this3BodyMCInfo.isDeuteronPrimary, + this3BodyMCInfo.survivedEventSel); + } // enabled table check + } // mcParticles loop + } // constexpr requires mcParticles check } - //------------------------------------------------------------------ - // event mixing - template - void doMixed3Body(TMixed3bodys decay3bodys, TBinningType binningType) + + // ______________________________________________________________ + // function to build mixed decay3body candidates + template + void buildMixedCandidates(TRedDecay3Bodys const& decay3bodys, TBinningType const& binningType) { + if (!mEnabledTables[kVtx3BodyDatas]) { + return; // don't do if no request for decay3bodys in place + } + // Strictly upper index policy for decay3body objects binned by radius, phi - for (const auto& [decay3body0, decay3body1] : selfCombinations(binningType, dcaFitterEMSel.nUseMixed, -1, decay3bodys, decay3bodys)) { - auto tpos0 = decay3body0.template track0_as(); - auto tneg0 = decay3body0.template track1_as(); - auto tbach0 = decay3body0.template track2_as(); - auto tpos1 = decay3body1.template track0_as(); - auto tneg1 = decay3body1.template track1_as(); - auto tbach1 = decay3body1.template track2_as(); - - registry.fill(HIST("h3bodyCombinationCounter"), 0.5); - - // ---------- selections ---------- - if ((tbach0.sign() > 0 && !(tbach1.sign() > 0)) || (tbach0.sign() < 0 && !(tbach1.sign() < 0)) || tbach0.globalIndex() == tbach1.globalIndex()) { // only combine if tbach1 has correct sign and is not same as tbach0 + for (const auto& [decay3body0, decay3body1] : selfPairCombinations(binningType, mixingOpts.n3bodyMixing, -1, decay3bodys)) { + auto trackPos0 = decay3body0.template track0_as(); + auto trackNeg0 = decay3body0.template track1_as(); + auto trackDeuteron0 = decay3body0.template track2_as(); + auto trackPos1 = decay3body1.template track0_as(); + auto trackNeg1 = decay3body1.template track1_as(); + auto trackDeuteron1 = decay3body1.template track2_as(); + + // assign tracks + auto trackProton0 = trackPos0; + auto trackPion0 = trackNeg0; + auto trackProton1 = trackPos1; + auto trackPion1 = trackNeg1; + if (trackDeuteron0.sign() < 0) { + trackProton0 = trackNeg0; + trackPion0 = trackPos0; + } + if (trackDeuteron1.sign() < 0) { + trackProton1 = trackNeg1; + trackPion1 = trackPos1; + } + + registry.fill(HIST("Mixing/h3bodyCombinationCounter"), 0.5); + + // only combine if from different event + if (decay3body0.collisionId() == decay3body1.collisionId()) { continue; } - registry.fill(HIST("h3bodyCombinationCounter"), 1.5); + registry.fill(HIST("Mixing/h3bodyCombinationCounter"), 1.5); + + // collision vertex selection + auto collision0 = decay3body0.template collision_as(); + auto collision1 = decay3body1.template collision_as(); + + // get b_z value for each collision (from CCDB or cache) and cache it for that run number + float magFieldCol0 = getMagFieldFromRunNumber(collision0.runNumber()); + float magFieldCol1 = getMagFieldFromRunNumber(collision1.runNumber()); - if (decay3body0.collisionId() == decay3body1.collisionId()) { // only combine if from different event + // only combine if collision similar in VtxZ + if (mixingOpts.selectPVPosZ3bodyMixing && std::abs(collision0.posZ() - collision1.posZ()) > mixingOpts.maxDeltaPVPosZ3bodyMixing) { continue; } - registry.fill(HIST("h3bodyCombinationCounter"), 2.5); + registry.fill(HIST("Mixing/h3bodyCombinationCounter"), 2.5); - auto c0 = decay3body0.template collision_as(); - auto c1 = decay3body1.template collision_as(); + // Charge selections + // same magnetic fields --> mix matter with matter + if ((magFieldCol0 / std::abs(magFieldCol0)) == (magFieldCol1 / std::abs(magFieldCol1))) { + if (trackDeuteron0.sign() != trackDeuteron1.sign()) { + continue; + } + } + // opposite magnetic fields --> mix matter with anti-matter + if ((magFieldCol0 / std::abs(magFieldCol0)) != (magFieldCol1 / std::abs(magFieldCol1))) { + if (trackDeuteron0.sign() == trackDeuteron1.sign()) { + continue; + } + } - if (dcaFitterEMSel.selectPVPosZ3bodyMixing && std::abs(c0.posZ() - c1.posZ()) > dcaFitterEMSel.maxDeltaPVPosZ3bodyMixing) { // only combine if collision similar in PV posZ + // don't mix 3body with itself + if ((trackDeuteron0.globalIndex() == trackDeuteron1.globalIndex()) || (trackProton0.globalIndex() == trackProton1.globalIndex()) || (trackPion0.globalIndex() == trackPion1.globalIndex())) { continue; } - registry.fill(HIST("h3bodyCombinationCounter"), 3.5); - - initCCDBfromRunNumber(c0.runNumber()); - - if (dcaFitterEMSel.cfgMix3BodyMethod == 0) { // mix bachelor (deuteron) - fillVtxCand(c0, tpos0, tneg0, tbach1, -1, bachelorcharge, tbach1.tofNSigmaDe()); - fillVtxCand(c1, tpos1, tneg1, tbach0, -1, bachelorcharge, tbach0.tofNSigmaDe()); - } else if ((dcaFitterEMSel.cfgMix3BodyMethod == 1 && tbach0.sign() > 0) || (dcaFitterEMSel.cfgMix3BodyMethod == 2 && tbach0.sign() < 0)) { // mix piMinus or proton - fillVtxCand(c0, tpos0, tneg1, tbach0, -1, bachelorcharge, tbach0.tofNSigmaDe()); - fillVtxCand(c1, tpos1, tneg0, tbach1, -1, bachelorcharge, tbach1.tofNSigmaDe()); - } else if ((dcaFitterEMSel.cfgMix3BodyMethod == 1 && tbach0.sign() < 0) || (dcaFitterEMSel.cfgMix3BodyMethod == 2 && tbach0.sign() > 0)) { // mix piPlus or anti-proton - fillVtxCand(c0, tpos1, tneg0, tbach0, -1, bachelorcharge, tbach0.tofNSigmaDe()); - fillVtxCand(c1, tpos0, tneg1, tbach1, -1, bachelorcharge, tbach1.tofNSigmaDe()); - } + registry.fill(HIST("Mixing/h3bodyCombinationCounter"), 3.5); - VtxCandidates.clear(); + // candidate analysis + // mix deuteron + if (mixingOpts.mixingType == 0) { + doMixing(collision0, trackProton0, trackPion0, trackDeuteron1, magFieldCol0); + doMixing(collision1, trackProton1, trackPion1, trackDeuteron0, magFieldCol1); + } + // mix proton + if (mixingOpts.mixingType == 1) { + doMixing(collision0, trackProton1, trackPion0, trackDeuteron0, magFieldCol0); + doMixing(collision1, trackProton0, trackPion1, trackDeuteron1, magFieldCol1); + } + // mix pion + if (mixingOpts.mixingType == 2) { + doMixing(collision0, trackProton0, trackPion1, trackDeuteron0, magFieldCol0); + doMixing(collision1, trackProton1, trackPion0, trackDeuteron1, magFieldCol1); + } } // end decay3body combinations loop } - //------------------------------------------------------------------ - // fill the StoredVtx3BodyDatas table - void fillVtx3BodyTable(VtxCandidate const& candVtx) + + // ______________________________________________________________ + // function to calculate correct TOF nSigma for deuteron track + template + double getTOFnSigma(TCollision const& collision, TTrack const& track) { - vtx3bodydata( - candVtx.track0Id, candVtx.track1Id, candVtx.track2Id, candVtx.collisionId, candVtx.decay3bodyId, - candVtx.vtxPos[0], candVtx.vtxPos[1], candVtx.vtxPos[2], - candVtx.track0P[0], candVtx.track0P[1], candVtx.track0P[2], candVtx.track1P[0], candVtx.track1P[1], candVtx.track1P[2], candVtx.track2P[0], candVtx.track2P[1], candVtx.track2P[2], - candVtx.dcadaughters, - candVtx.daudcaxytopv[0], candVtx.daudcaxytopv[1], candVtx.daudcaxytopv[2], - candVtx.daudcatopv[0], candVtx.daudcatopv[1], candVtx.daudcatopv[2], - candVtx.bachelortofNsigma); + // 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); + } else { + return bachelorTOFPID.GetTOFNSigma(track, originalcol, collision); + } + } + return -999; } - //------------------------------------------------------------------ - //-------------------- KFParticle reconstruction ------------------- - //------------------------------------------------------------------ - // function to select daughter track PID - template - bool selectTPCPID(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackDeuteron) + // ______________________________________________________________ + // function to fill analysis tables + void fillAnalysisTables() { - if (std::abs(trackProton.tpcNSigmaPr()) > kfparticleConfigurations.maxtpcnSigma) { - return false; - } - if (std::abs(trackDeuteron.tpcNSigmaDe()) > kfparticleConfigurations.maxtpcnSigma) { - return false; + // generate analysis tables + if (mEnabledTables[kDecay3BodyIndices]) { + products.decay3bodyindices(helper.decay3body.decay3bodyID, + helper.decay3body.protonID, helper.decay3body.pionID, helper.decay3body.deuteronID, + helper.decay3body.collisionID); + registry.fill(HIST("Counters/hTableBuildingStatistics"), kDecay3BodyIndices); + } + if (mEnabledTables[kVtx3BodyDatas]) { + products.vtx3bodydatas(helper.decay3body.sign, + helper.decay3body.mass, helper.decay3body.massV0, + helper.decay3body.position[0], helper.decay3body.position[1], helper.decay3body.position[2], + helper.decay3body.momentum[0], helper.decay3body.momentum[1], helper.decay3body.momentum[2], + helper.decay3body.chi2, + helper.decay3body.trackedClSize, + helper.decay3body.momProton[0], helper.decay3body.momProton[1], helper.decay3body.momProton[2], + helper.decay3body.momPion[0], helper.decay3body.momPion[1], helper.decay3body.momPion[2], + helper.decay3body.momDeuteron[0], helper.decay3body.momDeuteron[1], helper.decay3body.momDeuteron[2], + 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.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, + helper.decay3body.averageITSClSize[0], helper.decay3body.averageITSClSize[1], helper.decay3body.averageITSClSize[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.tpcNCl[0], helper.decay3body.tpcNCl[1], helper.decay3body.tpcNCl[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.pidForTrackingDeuteron); + registry.fill(HIST("Counters/hTableBuildingStatistics"), kVtx3BodyDatas); + } + if (mEnabledTables[kVtx3BodyCovs]) { + products.vtx3bodycovs(helper.decay3body.covProton, + helper.decay3body.covPion, + helper.decay3body.covDeuteron, + helper.decay3body.covariance); + registry.fill(HIST("Counters/hTableBuildingStatistics"), kVtx3BodyCovs); + } + if (mEnabledTables[kMcVtx3BodyDatas]) { + products.mcvtx3bodydatas(helper.decay3body.sign, + helper.decay3body.mass, helper.decay3body.massV0, + helper.decay3body.position[0], helper.decay3body.position[1], helper.decay3body.position[2], + helper.decay3body.momentum[0], helper.decay3body.momentum[1], helper.decay3body.momentum[2], + helper.decay3body.chi2, + helper.decay3body.trackedClSize, + helper.decay3body.momProton[0], helper.decay3body.momProton[1], helper.decay3body.momProton[2], + helper.decay3body.momPion[0], helper.decay3body.momPion[1], helper.decay3body.momPion[2], + helper.decay3body.momDeuteron[0], helper.decay3body.momDeuteron[1], helper.decay3body.momDeuteron[2], + 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.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, + helper.decay3body.averageITSClSize[0], helper.decay3body.averageITSClSize[1], helper.decay3body.averageITSClSize[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.tpcNCl[0], helper.decay3body.tpcNCl[1], helper.decay3body.tpcNCl[2], // 0 - proton, 1 - pion, 2 - deuteron + helper.decay3body.pidForTrackingDeuteron, + // MC information + this3BodyMCInfo.genMomentum[0], this3BodyMCInfo.genMomentum[1], this3BodyMCInfo.genMomentum[2], + this3BodyMCInfo.genDecVtx[0], this3BodyMCInfo.genDecVtx[1], this3BodyMCInfo.genDecVtx[2], + this3BodyMCInfo.genCt, + this3BodyMCInfo.genPhi, this3BodyMCInfo.genEta, this3BodyMCInfo.genRapidity, + this3BodyMCInfo.genMomProton, this3BodyMCInfo.genMomPion, this3BodyMCInfo.genMomDeuteron, + this3BodyMCInfo.genPtProton, this3BodyMCInfo.genPtPion, this3BodyMCInfo.genPtDeuteron, + this3BodyMCInfo.isTrueH3L, this3BodyMCInfo.isTrueAntiH3L, + this3BodyMCInfo.isReco, + this3BodyMCInfo.daughterPrPdgCode, this3BodyMCInfo.daughterPiPdgCode, this3BodyMCInfo.daughterDePdgCode, + this3BodyMCInfo.isDeuteronPrimary, + this3BodyMCInfo.survivedEventSel); + registry.fill(HIST("Counters/hTableBuildingStatistics"), kMcVtx3BodyDatas); } - if (kfparticleConfigurations.useTPCforPion && std::abs(trackPion.tpcNSigmaPi()) > kfparticleConfigurations.maxtpcnSigma) { - return false; + } + + // ______________________________________________________________ + // function to build mixed 3body candidate from selected tracks + template + void doMixing(TCollision const& collision, TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackDeuteron, float magField) + { + // set vertexers and propagator with correct mag field of this collision (only if run number changed compared to previous candidate build) + initFittersWithMagField(collision.runNumber(), magField); + if (helper.buildDecay3BodyCandidate(collision, trackProton, trackPion, trackDeuteron, + -1 /*decay3bodyIndex*/, + trackDeuteron.tofNSigmaDe(), + 0 /*trackedClSize*/, + decay3bodyBuilderOpts.useKFParticle, + decay3bodyBuilderOpts.kfSetTopologicalConstraint, + decay3bodyBuilderOpts.useSelections, + decay3bodyBuilderOpts.useTPCforPion, + decay3bodyBuilderOpts.acceptTPCOnly, + decay3bodyBuilderOpts.calculateCovariance, + true /*isEventMixing*/)) { + // fill analysis tables with built candidate + fillAnalysisTables(); + return; + } else { + return; } - return true; } - template - double getTOFnSigma(TCollision const& collision, TTrack const& track, bool isEventMixing) + // ______________________________________________________________ + // function to check if a reconstructed mother is a true H3L/Anti-H3L (returns -1 if not) + template + int checkH3LTruth(MCTrack3B const& mcParticlePr, MCTrack3B const& mcParticlePi, MCTrack3B const& mcParticleDe, bool& isMuonReco) { - // TOF PID of deuteron (set motherhyp correctly) - double tofNSigmaDeuteron = -999; - if (track.has_collision() && track.hasTOF()) { - if (isEventMixing) { - tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(track, collision, collision); - } else { - auto originalcol = track.template collision_as(); - tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(track, originalcol, collision); + if (std::abs(mcParticlePr.pdgCode()) != 2212 || std::abs(mcParticleDe.pdgCode()) != 1000010020) { + return -1; + } + // check proton and deuteron mother + int prDeMomID = -1; + for (const auto& motherPr : mcParticlePr.template mothers_as()) { + for (const auto& motherDe : mcParticleDe.template mothers_as()) { + if (motherPr.globalIndex() == motherDe.globalIndex() && std::abs(motherPr.pdgCode()) == 1010010030) { + prDeMomID = motherPr.globalIndex(); + break; + } + } + } + if (prDeMomID == -1) { + return -1; + } + if (std::abs(mcParticlePi.pdgCode()) != 211 && std::abs(mcParticlePi.pdgCode()) != 13) { + return -1; + } + // check if the pion track is a muon coming from a pi -> mu + vu decay, if yes, take the mother pi + auto mcParticlePiTmp = mcParticlePi; + if (std::abs(mcParticlePiTmp.pdgCode()) == 13) { + for (const auto& motherPi : mcParticlePiTmp.template mothers_as()) { + if (std::abs(motherPi.pdgCode()) == 211) { + mcParticlePiTmp = motherPi; + isMuonReco = true; + break; + } + } + } + // now loop over the pion mother + for (const auto& motherPi : mcParticlePiTmp.template mothers_as()) { + if (motherPi.globalIndex() == prDeMomID) { + return motherPi.globalIndex(); } } - return tofNSigmaDeuteron; + return -1; } - //------------------------------------------------------------------ - // function to fill candidate table - template - void fillCandidateTable(TCandidate const& candidate) + // ______________________________________________________________ + // function to reset MCInfo + void resetMCInfo(mc3Bodyinfo mcInfo) { - kfvtx3bodydatalite( - // hypertriton - candidate.mass, - candidate.pos[0], candidate.pos[1], candidate.pos[2], - candidate.mom[0], candidate.mom[1], candidate.mom[2], candidate.mom[3], - candidate.charge, - candidate.dcaToPV[0], candidate.dcaToPV[1], // 3D, xy - candidate.cpaToPV[0], candidate.cpaToPV[1], // 3D, xy - candidate.decLen[0], candidate.decLen[1], // 3D, xy - candidate.ldl, - candidate.chi2geoNDF, candidate.chi2topoNDF, - candidate.ctau, - candidate.trackedClSize, - // V0 - candidate.massV0, - candidate.cpaV0ToPV, - // daughter momenta at vertex - candidate.protonMom[0], candidate.protonMom[1], candidate.protonMom[2], - candidate.pionMom[0], candidate.pionMom[1], candidate.pionMom[2], - candidate.deuteronMom[0], candidate.deuteronMom[1], candidate.deuteronMom[2], - candidate.tpcInnerParam[0], candidate.tpcInnerParam[1], candidate.tpcInnerParam[2], // proton, pion, deuteron - // daughter track quality - candidate.tpcNClDaughters[0], candidate.tpcNClDaughters[1], candidate.tpcNClDaughters[2], // proton, pion, deuteron - candidate.tpcChi2NClDeuteron, - candidate.DeltaPhiRotDeuteron, candidate.DeltaPhiRotProton, - // daughter DCAs KF - candidate.DCAdaughterToPV[0], candidate.DCAdaughterToPV[1], candidate.DCAdaughterToPV[2], // proton, pion, deuteron - candidate.DCAdaughterToPVxy[0], candidate.DCAdaughterToPVxy[1], candidate.DCAdaughterToPVxy[2], // proton, pion, deuteron - candidate.DCAdaughterToSVxy[0], candidate.DCAdaughterToSVxy[1], candidate.DCAdaughterToSVxy[2], // proton, pion, deuteron - candidate.DCAprotonToPion, candidate.DCAprotonToDeuteron, candidate.DCApionToDeuteron, - candidate.DCAvtxDaughters3D, - // daughter signs - candidate.daughterCharge[0], candidate.daughterCharge[1], candidate.daughterCharge[2], // proton, pion, deuteron - // daughter PID - candidate.tpcNsigma[0], candidate.tpcNsigma[1], candidate.tpcNsigma[2], candidate.tpcNsigma[3], // proton, pion, deuteron, bach with pion hyp - candidate.tofNsigmaDeuteron, - candidate.averageClusterSizeDeuteron, - candidate.pidForTrackingDeuteron); - - if (kfparticleConfigurations.fillCandidateFullTable) { - kfvtx3bodydata( - candidate.collisionID, candidate.trackPosID, candidate.trackNegID, candidate.trackBachID, candidate.decay3bodyID, - // hypertriton - candidate.mass, - candidate.pos[0], candidate.pos[1], candidate.pos[2], - candidate.posErr[0], candidate.posErr[1], candidate.posErr[2], - candidate.mom[0], candidate.mom[1], candidate.mom[2], candidate.mom[3], - candidate.momErr[0], candidate.momErr[1], candidate.momErr[2], candidate.momErr[3], - candidate.charge, - candidate.dcaToPV[0], candidate.dcaToPV[1], // 3D, xy - candidate.cpaToPV[0], candidate.cpaToPV[1], // 3D, xy - candidate.cpaToPVtopo[0], candidate.cpaToPVtopo[1], // 3D, xy - candidate.decLen[0], candidate.decLen[1], // 3D, xy - candidate.ldl, - candidate.chi2geoNDF, candidate.chi2topoNDF, - candidate.ctau, - candidate.trackedClSize, - // V0 - candidate.massV0, candidate.chi2massV0, - candidate.cpaV0ToPV, - // daughter momenta (at vertex and TPC) - candidate.protonMom[0], candidate.protonMom[1], candidate.protonMom[2], - candidate.pionMom[0], candidate.pionMom[1], candidate.pionMom[2], - candidate.deuteronMom[0], candidate.deuteronMom[1], candidate.deuteronMom[2], - candidate.tpcInnerParam[0], candidate.tpcInnerParam[1], candidate.tpcInnerParam[2], // proton, pion, deuteron - // daughter track quality - candidate.tpcNClDaughters[0], candidate.tpcNClDaughters[1], candidate.tpcNClDaughters[2], // proton, pion, deuteron - candidate.tpcChi2NClDeuteron, - candidate.DeltaPhiRotDeuteron, candidate.DeltaPhiRotProton, - // daughter DCAs KF - candidate.DCAdaughterToPV[0], candidate.DCAdaughterToPV[1], candidate.DCAdaughterToPV[2], // proton, pion, deuteron - candidate.DCAdaughterToPVxy[0], candidate.DCAdaughterToPVxy[1], candidate.DCAdaughterToPVxy[2], // proton, pion, deuteron - candidate.DCAdaughterToSVxy[0], candidate.DCAdaughterToSVxy[1], candidate.DCAdaughterToSVxy[2], // proton, pion, deuteron - candidate.DCAprotonToPion, candidate.DCAprotonToDeuteron, candidate.DCApionToDeuteron, - candidate.DCAvtxDaughters3D, - // daughter DCAs to PV propagated with material - candidate.trackDCAxy[0], candidate.trackDCAxy[1], candidate.trackDCAxy[2], // pos, neg, bach - candidate.trackDCA[0], candidate.trackDCA[1], candidate.trackDCA[2], // pos, neg, bach - // daughter signs - candidate.daughterCharge[0], candidate.daughterCharge[1], candidate.daughterCharge[2], // proton, pion, deuteron - // daughter PID - candidate.tpcNsigma[0], candidate.tpcNsigma[1], candidate.tpcNsigma[2], candidate.tpcNsigma[3], // proton, pion, deuteron, bach with pion hyp - candidate.tpcdEdx[0], candidate.tpcdEdx[1], candidate.tpcdEdx[2], // proton, pion, deuteron - candidate.tofNsigmaDeuteron, - candidate.averageClusterSizeDeuteron, - candidate.pidForTrackingDeuteron); - } - LOG(debug) << "Table filled."; + mcInfo.label = -1; + mcInfo.genMomentum[0] = -1., mcInfo.genMomentum[1] = -1., mcInfo.genMomentum[2] = -1.; + mcInfo.genDecVtx[0] = -1., mcInfo.genDecVtx[1] = -1., mcInfo.genDecVtx[2] = -1.; + mcInfo.genCt = -1.; + mcInfo.genPhi = -1., mcInfo.genEta = -1., mcInfo.genRapidity = -1.; + mcInfo.genMomProton = -1., mcInfo.genMomPion = -1., mcInfo.genMomDeuteron = -1.; + mcInfo.genPtProton = -1., mcInfo.genPtPion = -1., mcInfo.genPtDeuteron = -1.; + mcInfo.isTrueH3L = false, mcInfo.isTrueAntiH3L = false; + mcInfo.isReco = false; + mcInfo.daughterPrPdgCode = -1, mcInfo.daughterPiPdgCode = -1, mcInfo.daughterDePdgCode = -1; + mcInfo.isDeuteronPrimary = false; + mcInfo.survivedEventSel = false; + return; } - //------------------------------------------------------------------ - // function to fit KFParticle 3body vertex - template - void fit3bodyVertex(TKFParticle& kfpProton, TKFParticle& kfpPion, TKFParticle& kfpDeuteron, TKFParticle& KFHt) + // ______________________________________________________________ + // process functions + void processRealData(ColswithEvTimes const& collisions, + aod::Decay3Bodys const& decay3bodys, + aod::Tracked3Bodys const& tracked3bodys, + TracksExtPIDIUwithEvTimes const&, + aod::BCsWithTimestamps const& bcs) { - // Construct 3body vertex - int nDaughters3body = 3; - const KFParticle* Daughters3body[3] = {&kfpProton, &kfpPion, &kfpDeuteron}; - KFHt.SetConstructMethod(2); - try { - KFHt.Construct(Daughters3body, nDaughters3body); - } catch (std::runtime_error& e) { - LOG(debug) << "Failed to create Hyper triton 3-body vertex." << e.what(); + // initialise CCDB from BCs + if (!initCCDB(bcs, collisions)) { + LOG(info) << "CCDB initialisation failed, skipping candidate building." << std::endl; return; } - // transport all daughter tracks to hypertriton vertex - float HtVtx[3] = {0.}; - HtVtx[0] = KFHt.GetX(); - HtVtx[1] = KFHt.GetY(); - HtVtx[2] = KFHt.GetZ(); - kfpProton.TransportToPoint(HtVtx); - kfpPion.TransportToPoint(HtVtx); - kfpDeuteron.TransportToPoint(HtVtx); - LOG(debug) << "Hypertriton vertex constructed."; + + // get tracked cluster size info + fTrackedClSizeVector.clear(); + fTrackedClSizeVector.resize(decay3bodys.size(), 0); + for (const auto& tvtx3body : tracked3bodys) { + fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize(); + } + + // do candidate analysis without MC processing + buildCandidates(bcs, // bc table + collisions, // collision table + decay3bodys, // decay3body table + static_cast(nullptr), // MC particle table + static_cast(nullptr)); // MC collision table } - //------------------------------------------------------------------ - // 3body candidate builder with KFParticle - template - void buildVtx3BodyDataTableKFParticle(TCollision const& collision, TTrack const& trackPos, TTrack const& trackNeg, TTrack const& trackBach, int64_t decay3bodyID, int bachelorcharge, double tofNSigmaDeuteron) + void processRealDataReduced(aod::RedCollisions const& collisions, + soa::Join const& decay3bodys, + aod::RedIUTracks const&) { - gROOT->SetBatch(true); - gRandom->SetSeed(42); - - // initialise KF primary vertex - KFPVertex kfpVertex = createKFPVertexFromCollision(collision); - KFParticle kfpv(kfpVertex); - LOG(debug) << "Created KF PV."; - - // fill event QA histograms --> only for events with a decay3body! - if (kfparticleConfigurations.doVertexQA) { - registry.fill(HIST("QA/Event/hVtxXKF"), kfpv.GetX()); - registry.fill(HIST("QA/Event/hVtxYKF"), kfpv.GetY()); - registry.fill(HIST("QA/Event/hVtxZKF"), kfpv.GetZ()); - registry.fill(HIST("QA/Event/hVtxCovXXKF"), kfpv.GetCovariance(0)); - registry.fill(HIST("QA/Event/hVtxCovYYKF"), kfpv.GetCovariance(2)); - registry.fill(HIST("QA/Event/hVtxCovZZKF"), kfpv.GetCovariance(5)); - registry.fill(HIST("QA/Event/hVtxCovXYKF"), kfpv.GetCovariance(1)); - registry.fill(HIST("QA/Event/hVtxCovXZKF"), kfpv.GetCovariance(3)); - registry.fill(HIST("QA/Event/hVtxCovYZKF"), kfpv.GetCovariance(4)); - registry.fill(HIST("QA/Event/hVtxX"), collision.posX()); - registry.fill(HIST("QA/Event/hVtxY"), collision.posY()); - registry.fill(HIST("QA/Event/hVtxZ"), collision.posZ()); - registry.fill(HIST("QA/Event/hVtxCovXX"), collision.covXX()); - registry.fill(HIST("QA/Event/hVtxCovYY"), collision.covYY()); - registry.fill(HIST("QA/Event/hVtxCovZZ"), collision.covZZ()); - registry.fill(HIST("QA/Event/hVtxCovXY"), collision.covXY()); - registry.fill(HIST("QA/Event/hVtxCovXZ"), collision.covXZ()); - registry.fill(HIST("QA/Event/hVtxCovYZ"), collision.covYZ()); + // get tracked cluster size info (saved in aod::Red3BodyInfo) + fTrackedClSizeVector.clear(); + fTrackedClSizeVector.resize(decay3bodys.size(), 0); + for (const auto& vtx3body : decay3bodys) { + fTrackedClSizeVector[vtx3body.globalIndex()] = vtx3body.trackedClSize(); } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxAll); - - auto trackParCovPos = getTrackParCov(trackPos); - auto trackParCovNeg = getTrackParCov(trackNeg); - auto trackParCovBach = getTrackParCov(trackBach); - LOG(debug) << "Got all daughter tracks."; - - bool isMatter = trackBach.sign() > 0 ? true : false; - - // ---------- fill track QA histograms ---------- - if (kfparticleConfigurations.doTrackQA) { - registry.fill(HIST("QA/Tracks/hTrackPosTPCNcls"), trackPos.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackNegTPCNcls"), trackNeg.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackBachTPCNcls"), trackBach.tpcNClsFound()); - registry.fill(HIST("QA/Tracks/hTrackPosHasTPC"), trackPos.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackNegHasTPC"), trackNeg.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackBachHasTPC"), trackBach.hasTPC()); - registry.fill(HIST("QA/Tracks/hTrackBachITSClusSizes"), trackBach.itsClusterSizes()); - if (isMatter) { - registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPr()); - registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPi()); - registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackPos.pt()); - registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackNeg.pt()); + // do candidate analysis without MC processing + buildCandidates(static_cast(nullptr), // bc table + collisions, // collision table + decay3bodys, // decay3body table + static_cast(nullptr), // MC particle table + static_cast(nullptr)); // MC collision table + } + + void processRealDataReduced3bodyMixing(aod::RedCollisions const&, + soa::Join const& decay3bodys, + aod::RedIUTracks const&) + { + auto xAxis = registry.get(HIST("Mixing/hDecay3BodyRadiusPhi"))->GetXaxis(); + auto yAxis = registry.get(HIST("Mixing/hDecay3BodyRadiusPhi"))->GetYaxis(); + + for (const auto& decay3body : decay3bodys) { + int bin_Radius, bin_Phi; + if (decay3bodyBuilderOpts.useKFParticle) { + bin_Radius = xAxis->FindBin(decay3body.radiusKF()); + bin_Phi = yAxis->FindBin(decay3body.phiKF()); + registry.fill(HIST("Mixing/hDecay3BodyPosZ"), decay3body.poszKF()); } else { - registry.fill(HIST("QA/Tracks/hTrackProtonTPCPID"), trackNeg.sign() * trackNeg.tpcInnerParam(), trackNeg.tpcNSigmaPr()); - registry.fill(HIST("QA/Tracks/hTrackPionTPCPID"), trackPos.sign() * trackPos.tpcInnerParam(), trackPos.tpcNSigmaPi()); - registry.fill(HIST("QA/Tracks/hTrackProtonPt"), trackNeg.pt()); - registry.fill(HIST("QA/Tracks/hTrackPionPt"), trackPos.pt()); + bin_Radius = xAxis->FindBin(decay3body.radiusDCA()); + bin_Phi = yAxis->FindBin(decay3body.phiDCA()); + registry.fill(HIST("Mixing/hDecay3BodyPosZ"), decay3body.poszDCA()); } - registry.fill(HIST("QA/Tracks/hTrackBachTPCPID"), trackBach.sign() * trackBach.tpcInnerParam(), trackBach.tpcNSigmaDe()); - registry.fill(HIST("QA/Tracks/hTrackBachPt"), trackBach.pt()); + registry.fill(HIST("Mixing/hDecay3BodyRadiusPhi"), xAxis->GetBinCenter(bin_Radius), yAxis->GetBinCenter(bin_Phi)); } - // -------- STEP 1: track selection -------- - // collision ID --> not correct? tracks can have different collisions, but belong to one 3prong vertex! - // if (trackPos.collisionId() != trackNeg.collisionId() || trackPos.collisionId() != trackBach.collisionId() || trackNeg.collisionId() != trackBach.collisionId()) { - // continue; - // } - // track IDs --> already checked in SVertexer! + if (decay3bodyBuilderOpts.useKFParticle) { + Binning3BodyKF binningOnRadPhiKF{{mixingOpts.bins3BodyRadius, mixingOpts.bins3BodyPhi}, true}; + buildMixedCandidates(decay3bodys, binningOnRadPhiKF); + } else { + Binning3BodyDCAfitter binningOnRadPhiDCA{{mixingOpts.bins3BodyRadius, mixingOpts.bins3BodyPhi}, true}; + buildMixedCandidates(decay3bodys, binningOnRadPhiDCA); + } + } - // track signs (pos, neg, bach) --> sanity check, should already be in SVertexer - if (trackPos.sign() != +1 || trackNeg.sign() != -1) { + void processMonteCarlo(ColswithEvTimesLabeled const& collisions, + aod::Decay3Bodys const& decay3bodys, + aod::Tracked3Bodys const& tracked3bodys, + TracksExtPIDIUwithEvTimesLabeled const&, + aod::BCsWithTimestamps const& bcs, + aod::McParticles const& mcParticles, + aod::McCollisions const& mcCollisions) + { + // initialise CCDB from BCs + if (!initCCDB(bcs, collisions)) { + LOG(info) << "CCDB initialisation failed, skipping candidate building." << std::endl; return; } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxCharge); - // track eta - if (std::abs(trackPos.eta()) > kfparticleConfigurations.maxEta || std::abs(trackNeg.eta()) > kfparticleConfigurations.maxEta || std::abs(trackBach.eta()) > kfparticleConfigurations.maxEtaDeuteron) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxEta); - - // number of TPC clusters - if (trackBach.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsBach) { - return; - } - if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { - return; - } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxTPCNcls); - - // number of TPC crossed rows - if (trackBach.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows) { - return; - } - if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { - return; - } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxTPCRows); - - // TPC PID - float tpcNsigmaProton; - float tpcNsigmaPion; - float dEdxProton; - float dEdxPion; - float tpcNsigmaDeuteron = trackBach.tpcNSigmaDe(); - float tpcNsigmaPionBach = trackBach.tpcNSigmaPi(); - float dEdxDeuteron = trackBach.tpcSignal(); - if (isMatter) { // hypertriton (proton, pi-, deuteron) - tpcNsigmaProton = trackPos.tpcNSigmaPr(); - tpcNsigmaPion = trackNeg.tpcNSigmaPi(); - dEdxProton = trackPos.tpcSignal(); - dEdxPion = trackNeg.tpcSignal(); - if (!selectTPCPID(trackPos, trackNeg, trackBach)) { - return; - } - } else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron) - tpcNsigmaProton = trackNeg.tpcNSigmaPr(); - tpcNsigmaPion = trackPos.tpcNSigmaPi(); - dEdxProton = trackNeg.tpcSignal(); - dEdxPion = trackPos.tpcSignal(); - if (!selectTPCPID(trackNeg, trackPos, trackBach)) { - return; - } - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxTPCPID); - LOG(debug) << "Basic track selections done."; - - // Average ITS cluster size of deuteron track - double averageClusterSizeDeuteron(0); - int nCls(0); - for (int i = 0; i < 7; i++) { - int clusterSize = trackBach.itsClsSizeInLayer(i); - averageClusterSizeDeuteron += static_cast(clusterSize); - if (clusterSize > 0) - nCls++; - } - averageClusterSizeDeuteron = averageClusterSizeDeuteron / static_cast(nCls); - - // track DCAxy and DCAz to PV associated with decay3body - o2::dataformats::VertexBase mPV; - o2::dataformats::DCA mDcaInfoCovPos; - o2::dataformats::DCA mDcaInfoCovNeg; - o2::dataformats::DCA mDcaInfoCovBach; - auto trackParCovPVPos = trackParCovPos; - auto trackParCovPVNeg = trackParCovNeg; - auto trackParCovPVBach = trackParCovBach; - mPV.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mPV.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVPos, 2.f, matCorr, &mDcaInfoCovPos); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVNeg, 2.f, matCorr, &mDcaInfoCovNeg); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPVBach, 2.f, matCorr, &mDcaInfoCovBach); - auto TrackPosDcaXY = mDcaInfoCovPos.getY(); - auto TrackNegDcaXY = mDcaInfoCovNeg.getY(); - auto TrackBachDcaXY = mDcaInfoCovBach.getY(); - auto TrackPosDcaZ = mDcaInfoCovPos.getZ(); - auto TrackNegDcaZ = mDcaInfoCovNeg.getZ(); - auto TrackBachDcaZ = mDcaInfoCovBach.getZ(); - // calculate 3D track DCA - auto TrackPosDca = std::sqrt(TrackPosDcaXY * TrackPosDcaXY + TrackPosDcaZ * TrackPosDcaZ); - auto TrackNegDca = std::sqrt(TrackNegDcaXY * TrackNegDcaXY + TrackNegDcaZ * TrackNegDcaZ); - auto TrackBachDca = std::sqrt(TrackBachDcaXY * TrackBachDcaXY + TrackBachDcaZ * TrackBachDcaZ); - // selection - if (kfparticleConfigurations.doDCAPreSel && isMatter && (std::fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || std::fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { - return; - } else if (kfparticleConfigurations.doDCAPreSel && !isMatter && (std::fabs(TrackPosDcaXY) <= kfparticleConfigurations.mindcaXYPionPV || std::fabs(TrackNegDcaXY) <= kfparticleConfigurations.mindcaXYProtonPV)) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxDCAxyPV); - if (kfparticleConfigurations.doDCAPreSel && isMatter && (std::fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZPionPV || std::fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { - return; - } else if (kfparticleConfigurations.doDCAPreSel && !isMatter && (std::fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZPionPV || std::fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxDCAzPV); - - // daughter track momentum at inner wall of TPC - float tpcInnerParamProton; - float tpcInnerParamPion; - float tpcInnerParamDeuteron = trackBach.tpcInnerParam(); - if (isMatter) { // hypertriton (proton, pi-, deuteron) - tpcInnerParamProton = trackPos.tpcInnerParam(); - tpcInnerParamPion = trackNeg.tpcInnerParam(); - } else if (!isMatter) { // anti-hypertriton (anti-proton, pi+, deuteron) - tpcInnerParamProton = trackNeg.tpcInnerParam(); - tpcInnerParamPion = trackPos.tpcInnerParam(); - } - - // -------- STEP 2: fit vertex with proton and pion -------- - // Fit vertex with DCA fitter to find minimization point --> uses material corrections implicitly - if (kfparticleConfigurations.doDCAFitterPreMinimum) { - try { - fitter3body.process(trackParCovPos, trackParCovNeg, trackParCovBach); - } catch (std::runtime_error& e) { - LOG(error) << "Exception caught in DCA fitter process call: Not able to fit decay3body vertex!"; - return; - } - // re-acquire tracks at vertex position from DCA fitter - trackParCovPos = fitter3body.getTrack(0); - trackParCovNeg = fitter3body.getTrack(1); - trackParCovBach = fitter3body.getTrack(2); - - LOG(debug) << "Minimum found with DCA fitter for decay3body."; - } - - // create KFParticle objects from tracks - KFParticle kfpProton, kfpPion; - if (isMatter) { - kfpProton = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassProton); - kfpPion = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassPionCharged); - } else if (!isMatter) { - kfpProton = createKFParticleFromTrackParCov(trackParCovNeg, trackNeg.sign(), constants::physics::MassProton); - kfpPion = createKFParticleFromTrackParCov(trackParCovPos, trackPos.sign(), constants::physics::MassPionCharged); - } - LOG(debug) << "KFParticle objects created from daughter tracks."; - - // Construct V0 as intermediate step - KFParticle KFV0; - int nDaughtersV0 = 2; - const KFParticle* DaughtersV0[2] = {&kfpProton, &kfpPion}; - KFV0.SetConstructMethod(2); - try { - KFV0.Construct(DaughtersV0, nDaughtersV0); - } catch (std::runtime_error& e) { - LOG(debug) << "Failed to create V0 vertex from daughter tracks." << e.what(); - return; - } - KFV0.TransportToDecayVertex(); - LOG(debug) << "V0 constructed."; - - // check V0 mass and set mass constraint - float massV0, sigmaMassV0; - KFV0.GetMass(massV0, sigmaMassV0); - KFParticle KFV0Mass = KFV0; - KFV0Mass.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); - float chi2massV0 = KFV0Mass.GetChi2() / KFV0Mass.GetNDF(); - if (kfparticleConfigurations.useLambdaMassConstraint) { - LOG(debug) << "V0 mass constraint applied."; - KFV0 = KFV0Mass; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxV0MassConst); - - // apply virtual V0 cuts used in SVertexer in case of 3body mixing with proton track - if (kfparticleConfigurations.mixingType == 1 && kfparticleConfigurations.applySVertexerV0Cuts) { - // V0 radius - if (std::sqrt(KFV0.GetX() * KFV0.GetX() + KFV0.GetY() * KFV0.GetY()) <= 0.5) { - return; - } - // pT - if (KFV0.GetPt() <= 0.01) { - return; - } - // pz/pT - if (KFV0.GetPz() / KFV0.GetPt() >= 2) { - return; - } - // cos(PA) - if (cpaXYFromKF(KFV0, kfpv) <= 0.9 || cpaFromKF(KFV0, kfpv) <= 0.8) { - return; - } - } - - // -------- STEP 3: fit three body vertex -------- - // Create KFParticle object from deuteron track - KFParticle kfpDeuteron; - kfpDeuteron = createKFParticleFromTrackParCov(trackParCovBach, trackBach.sign() * bachelorcharge, constants::physics::MassDeuteron); - LOG(debug) << "KFParticle created from deuteron track."; - - // Construct vertex - KFParticle KFHt; - fit3bodyVertex(kfpProton, kfpPion, kfpDeuteron, KFHt); - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxhasSV); - - // -------- STEP 4: daughter selections after geometrical vertex fit -------- - // daughter DCAs with KF - if ((kfpProton.GetDistanceFromParticle(kfpPion) >= kfparticleConfigurations.maxDcaProPi) || (kfpProton.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaProDeu) || (kfpPion.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaPiDe)) { - return; - } - float DCAvtxDaughters3D = kfpProton.GetDistanceFromParticle(kfpPion) + kfpProton.GetDistanceFromParticle(kfpDeuteron) + kfpPion.GetDistanceFromParticle(kfpDeuteron); - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxDcaDau); - LOG(debug) << "DCA selection after vertex fit applied."; - - // daughter DCAs to vertex - if (kfpProton.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpPion.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpDeuteron.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxDcaDauVtx); - LOG(debug) << "DCA to vertex selection after vertex fit applied."; - - // daughter pT - if (kfpProton.GetPt() < kfparticleConfigurations.minPtProton || kfpProton.GetPt() > kfparticleConfigurations.maxPtProton || kfpPion.GetPt() < kfparticleConfigurations.minPtPion || kfpPion.GetPt() > kfparticleConfigurations.maxPtPion || kfpDeuteron.GetPt() < kfparticleConfigurations.minPtDeuteron || kfpDeuteron.GetPt() > kfparticleConfigurations.maxPtDeuteron) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxDauPt); - LOG(debug) << "Daughter pT selection applied."; - - // -------- STEP 5: candidate selection and constraint after geometrical vertex fit -------- - // Rapidity - float rapHt = RecoDecay::y(std::array{KFHt.GetPx(), KFHt.GetPy(), KFHt.GetPz()}, o2::constants::physics::MassHyperTriton); - if (std::abs(rapHt) > kfparticleConfigurations.maxRapidityHt) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxRap); - - // Pt selection - if (KFHt.GetPt() <= kfparticleConfigurations.minPtHt || KFHt.GetPt() >= kfparticleConfigurations.maxPtHt) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxPt); - - // Mass window - float massHt, sigmaMassHt; - KFHt.GetMass(massHt, sigmaMassHt); - if (massHt <= kfparticleConfigurations.minMassHt || massHt >= kfparticleConfigurations.maxMassHt) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxMass); - - // cos(PA) to PV - if (std::abs(cpaFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPA) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxCosPA); - - // cos(PA) xy to PV - if (std::abs(cpaXYFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPAxy) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxCosPAXY); - - // chi2 geometrical - float chi2geoNDF = KFHt.GetChi2() / KFHt.GetNDF(); - if (kfparticleConfigurations.applyTopoSel && chi2geoNDF >= kfparticleConfigurations.maxChi2geo) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxChi2geo); - LOG(debug) << "Basic selections after vertex fit done."; - - // ctau before topo constraint - if (KFHt.GetLifeTime() > kfparticleConfigurations.maxctauHt) { - return; - } - - // Set vertex constraint and topological selection - KFParticle KFHtPV = KFHt; - try { - KFHtPV.SetProductionVertex(kfpv); - } catch (std::runtime_error& e) { - LOG(error) << "Exception caught KFParticle process call: Topological constraint failed"; - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxTopoConstr); // to check if topo constraint fails - // get topological chi2 - float chi2topoNDF = KFHtPV.GetChi2() / KFHtPV.GetNDF(); - KFHtPV.TransportToDecayVertex(); - if (kfparticleConfigurations.applyTopoSel && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) { - return; - } - registry.fill(HIST("Counters/hVtx3BodyCounterKFParticle"), kKfVtxChi2topo); - - // -------- STEP 6: collect and fill candidate info -------- - // get cluster size of strangeness tracked 3bodies - float trackedClSize; - if (decay3bodyID == -1) { - trackedClSize = 0; - } else { - trackedClSize = !fTrackedClSizeVector.empty() ? fTrackedClSizeVector[decay3bodyID] : 0; - } - - // candidate filling - kfCandidate candidate; - candidate.collisionID = collision.globalIndex(); - candidate.trackPosID = trackPos.globalIndex(); - candidate.trackNegID = trackNeg.globalIndex(); - candidate.trackBachID = trackBach.globalIndex(); - candidate.decay3bodyID = decay3bodyID; - // hypertriton - candidate.mass = massHt; - candidate.pos[0] = KFHt.GetX(); - candidate.pos[1] = KFHt.GetY(); - candidate.pos[2] = KFHt.GetZ(); - candidate.posErr[0] = KFHt.GetErrX(); - candidate.posErr[1] = KFHt.GetErrY(); - candidate.posErr[2] = KFHt.GetErrZ(); - candidate.mom[0] = KFHt.GetPx(); - candidate.mom[1] = KFHt.GetPy(); - candidate.mom[2] = KFHt.GetPz(); - candidate.mom[3] = KFHt.GetPt(); - candidate.momErr[0] = KFHt.GetErrPx(); - candidate.momErr[1] = KFHt.GetErrPy(); - candidate.momErr[2] = KFHt.GetErrPz(); - candidate.momErr[3] = KFHt.GetErrPt(); - candidate.charge = KFHt.GetQ(); - candidate.dcaToPV[0] = KFHt.GetDistanceFromVertex(kfpv); - candidate.dcaToPV[1] = KFHt.GetDistanceFromVertexXY(kfpv); - candidate.cpaToPV[0] = cpaFromKF(KFHt, kfpv); - candidate.cpaToPV[1] = cpaXYFromKF(KFHt, kfpv); - candidate.cpaToPVtopo[0] = cpaFromKF(KFHtPV, kfpv); - candidate.cpaToPVtopo[1] = cpaXYFromKF(KFHtPV, kfpv); - candidate.decLen[0] = KFHtPV.GetDecayLength(); - candidate.decLen[1] = KFHtPV.GetDecayLengthXY(); - candidate.ldl = KFHtPV.GetDecayLength() / KFHtPV.GetErrDecayLength(); - candidate.chi2geoNDF = chi2geoNDF; - candidate.chi2topoNDF = chi2topoNDF; - candidate.ctau = KFHtPV.GetLifeTime(); - candidate.trackedClSize = trackedClSize; - // V0 - candidate.massV0 = massV0; - candidate.chi2massV0 = chi2massV0; - candidate.cpaV0ToPV = cpaFromKF(KFV0, kfpv); - // daughter momenta - candidate.protonMom[0] = kfpProton.GetPx(); - candidate.protonMom[1] = kfpProton.GetPy(); - candidate.protonMom[2] = kfpProton.GetPz(); - candidate.pionMom[0] = kfpPion.GetPx(); - candidate.pionMom[1] = kfpPion.GetPy(); - candidate.pionMom[2] = kfpPion.GetPz(); - candidate.deuteronMom[0] = kfpDeuteron.GetPx(); - candidate.deuteronMom[1] = kfpDeuteron.GetPy(); - candidate.deuteronMom[2] = kfpDeuteron.GetPz(); - candidate.tpcInnerParam[0] = tpcInnerParamProton; - candidate.tpcInnerParam[1] = tpcInnerParamPion; - candidate.tpcInnerParam[2] = tpcInnerParamDeuteron; - // daughter DCAs with KF - candidate.DCAdaughterToPV[0] = kfpProton.GetDistanceFromVertex(kfpv); - candidate.DCAdaughterToPV[1] = kfpPion.GetDistanceFromVertex(kfpv); - candidate.DCAdaughterToPV[2] = kfpDeuteron.GetDistanceFromVertex(kfpv); - candidate.DCAdaughterToPVxy[0] = kfpProton.GetDistanceFromVertexXY(kfpv); - candidate.DCAdaughterToPVxy[1] = kfpPion.GetDistanceFromVertexXY(kfpv); - candidate.DCAdaughterToPVxy[2] = kfpDeuteron.GetDistanceFromVertexXY(kfpv); - candidate.DCAdaughterToSVxy[0] = kfpProton.GetDistanceFromVertexXY(KFHt); - candidate.DCAdaughterToSVxy[1] = kfpPion.GetDistanceFromVertexXY(KFHt); - candidate.DCAdaughterToSVxy[2] = kfpDeuteron.GetDistanceFromVertexXY(KFHt); - candidate.DCAprotonToPion = kfpProton.GetDistanceFromParticle(kfpPion); - candidate.DCAprotonToDeuteron = kfpProton.GetDistanceFromParticle(kfpDeuteron); - candidate.DCApionToDeuteron = kfpPion.GetDistanceFromParticle(kfpDeuteron); - candidate.DCAvtxDaughters3D = DCAvtxDaughters3D; - // daughter DCAs with material corrections - candidate.trackDCAxy[0] = TrackPosDcaXY; - candidate.trackDCAxy[1] = TrackNegDcaXY; - candidate.trackDCAxy[2] = TrackBachDcaXY; - candidate.trackDCA[0] = TrackPosDca; - candidate.trackDCA[1] = TrackNegDca; - candidate.trackDCA[2] = TrackBachDca; - // daughter signs - candidate.daughterCharge[0] = kfpProton.GetQ(); - candidate.daughterCharge[1] = kfpPion.GetQ(); - candidate.daughterCharge[2] = trackBach.sign(); - // daughter PID - candidate.tpcNsigma[0] = tpcNsigmaProton; - candidate.tpcNsigma[1] = tpcNsigmaPion; - candidate.tpcNsigma[2] = tpcNsigmaDeuteron; - candidate.tpcNsigma[3] = tpcNsigmaPionBach; - candidate.tpcdEdx[0] = dEdxProton; - candidate.tpcdEdx[1] = dEdxPion; - candidate.tpcdEdx[2] = dEdxDeuteron; - candidate.tofNsigmaDeuteron = tofNSigmaDeuteron; - candidate.averageClusterSizeDeuteron = averageClusterSizeDeuteron; - candidate.pidForTrackingDeuteron = trackBach.pidForTracking(); - - //------------------------------------------------------------------ - // table filling - fillCandidateTable(candidate); - LOG(debug) << "Table filled."; - - // fill event counter hist (has selected candidate) --> only filled once per vertex - registry.fill(HIST("Counters/hEventCounterKFParticle"), 3.5); - } // end buildVtx3BodyDataTableKFParticle - - //------------------------------------------------------------------ - void processRun3(ColwithEvTimes const& collisions, aod::Decay3Bodys const& decay3bodys, TrackExtPIDIUwithEvTimes const&, aod::BCsWithTimestamps const&) - { - VtxCandidates.clear(); - - registry.fill(HIST("hEventCounter"), 0.5, collisions.size()); - - for (const auto& d3body : decay3bodys) { - auto t0 = d3body.track0_as(); - auto t1 = d3body.track1_as(); - auto t2 = d3body.track2_as(); - auto collision = d3body.collision_as(); - auto bc = collision.bc_as(); - initCCDB(bc); - - // Recalculate the TOF PID - double tofNSigmaBach = -999; - if (t2.has_collision() && t2.hasTOF()) { - auto originalcol = t2.template collision_as(); - tofNSigmaBach = bachelorTOFPID.GetTOFNSigma(t2, originalcol, collision); - } - - fillVtxCand(collision, t0, t1, t2, d3body.globalIndex(), bachelorcharge, tofNSigmaBach); - } - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3, "Produce DCA fitter decay3body tables", true); - - //------------------------------------------------------------------ - void processRun3Reduced(aod::RedCollisions const& collisions, aod::RedDecay3Bodys const& decay3bodys, aod::RedIUTracks const&) - { - VtxCandidates.clear(); - - registry.fill(HIST("hEventCounter"), 0.5, collisions.size()); - - for (const auto& d3body : decay3bodys) { - auto t0 = d3body.track0_as(); - auto t1 = d3body.track1_as(); - auto t2 = d3body.track2_as(); - auto collision = d3body.collision_as(); - - initCCDBfromRunNumber(collision.runNumber()); - fillVtxCand(collision, t0, t1, t2, d3body.globalIndex(), bachelorcharge, t2.tofNSigmaDe()); - } - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3Reduced, "Produce DCA fitter decay3body tables with reduced data", false); - - //------------------------------------------------------------------ - // Event-mixing background - void processRun3ReducedEM(ReducedCollisionsMultsCents const& collisions, aod::RedDecay3Bodys const& decay3bodys, aod::RedIUTracks const&) - { - auto xAxis = registry.get(HIST("hEventPairs"))->GetXaxis(); - auto yAxis = registry.get(HIST("hEventPairs"))->GetYaxis(); - - // fill collisions counter - for (const auto& collision : collisions) { - int bin_PosZ = xAxis->FindBin(collision.posZ()); - int bin_Mult = yAxis->FindBin(collision.multNTracksPV()); - registry.fill(HIST("hEventCount"), xAxis->GetBinCenter(bin_PosZ), yAxis->GetBinCenter(bin_Mult)); - } - VtxCandidates.clear(); - - auto tuple = std::make_tuple(decay3bodys); - BinningTypeColEM binningEvent{{dcaFitterEMSel.binsVtxZ, dcaFitterEMSel.binsMultiplicity}, true}; - SameKindPair pair{binningEvent, dcaFitterEMSel.nUseMixed, -1, collisions, tuple, &cache}; - - for (const auto& [c0, decay3bodys0, c1, decay3bodys1] : pair) { - // LOG(info) << "Processing event mixing with collisions " << c0.globalIndex() << " and " << c1.globalIndex(); - initCCDBfromRunNumber(c0.runNumber()); - - int bin_PosZ = xAxis->FindBin(c0.posZ()); - int bin_Mult = yAxis->FindBin(c0.multNTracksPV()); - registry.fill(HIST("hEventPairs"), xAxis->GetBinCenter(bin_PosZ), yAxis->GetBinCenter(bin_Mult)); - - for (const auto& [d3body0, d3body1] : combinations(soa::CombinationsFullIndexPolicy(decay3bodys0, decay3bodys1))) { - - registry.fill(HIST("hDecay3BodyPairsBeforeCut"), xAxis->GetBinCenter(bin_PosZ), yAxis->GetBinCenter(bin_Mult)); - - auto tpos0 = d3body0.track0_as(); - auto tneg0 = d3body0.track1_as(); - auto tbach0 = d3body0.track2_as(); - auto tpos1 = d3body1.track0_as(); - auto tneg1 = d3body1.track1_as(); - auto tbach1 = d3body1.track2_as(); - - // try to fit the vertex for decay3body0 - auto Trackpos0 = getTrackParCov(tpos0); - auto Trackneg0 = getTrackParCov(tneg0); - auto Trackbach0 = getTrackParCov(tbach0); - int nVtx0 = fitter3body.process(Trackpos0, Trackneg0, Trackbach0); - if (nVtx0 == 0) { - continue; - ; - } - - if ((tbach0.sign() > 0 && !(tbach1.sign() > 0)) || (tbach0.sign() < 0 && !(tbach1.sign() < 0)) || tbach0.globalIndex() == tbach1.globalIndex()) { // only combine if tbach1 has correct sign and is not same as tbach0 - continue; - } - - const auto& vtx0XYZ = fitter3body.getPCACandidate(); - float rVtx0 = std::hypot(vtx0XYZ[0], vtx0XYZ[1]); - registry.fill(HIST("hRadius0"), rVtx0); - - std::array ppos0 = {0.}, pneg0 = {0.}, pbach0{0.}; - const auto& propagatedtpos0 = fitter3body.getTrack(0); - const auto& propagatedtneg0 = fitter3body.getTrack(1); - const auto& propagatedtbach0 = fitter3body.getTrack(2); - propagatedtpos0.getPxPyPzGlo(ppos0); - propagatedtneg0.getPxPyPzGlo(pneg0); - propagatedtbach0.getPxPyPzGlo(pbach0); - for (int i = 0; i < 3; i++) { - pbach0[i] *= bachelorcharge; - } - std::array p3B0 = {ppos0[0] + pneg0[0] + pbach0[0], ppos0[1] + pneg0[1] + pbach0[1], ppos0[2] + pneg0[2] + pbach0[2]}; - float phiVtx0 = std::atan2(p3B0[1], p3B0[0]); - - // try to fit the vertex for decay3body1 - auto Trackpos1 = getTrackParCov(tpos1); - auto Trackneg1 = getTrackParCov(tneg1); - auto Trackbach1 = getTrackParCov(tbach1); - int nVtx1 = fitter3body.process(Trackpos1, Trackneg1, Trackbach1); - if (nVtx1 == 0) { - continue; - } - - const auto& vtx1XYZ = fitter3body.getPCACandidate(); - float rVtx1 = std::hypot(vtx1XYZ[0], vtx1XYZ[1]); - registry.fill(HIST("hRadius1"), rVtx1); - - std::array ppos1 = {0.}, pneg1 = {0.}, pbach1{0.}; - const auto& propagatedtpos1 = fitter3body.getTrack(0); - const auto& propagatedtneg1 = fitter3body.getTrack(1); - const auto& propagatedtbach1 = fitter3body.getTrack(2); - propagatedtpos1.getPxPyPzGlo(ppos1); - propagatedtneg1.getPxPyPzGlo(pneg1); - propagatedtbach1.getPxPyPzGlo(pbach1); - for (int i = 0; i < 3; i++) { - pbach1[i] *= bachelorcharge; - } - std::array p3B1 = {ppos1[0] + pneg1[0] + pbach1[0], ppos1[1] + pneg1[1] + pbach1[1], ppos1[2] + pneg1[2] + pbach1[2]}; - float phiVtx1 = std::atan2(p3B1[1], p3B1[0]); - registry.fill(HIST("hPhi0"), phiVtx0 * o2::constants::math::Rad2Deg); - registry.fill(HIST("hPhi1"), phiVtx1 * o2::constants::math::Rad2Deg); - // convert deltaPhi to range [-pi, pi] - float deltaPhi = RecoDecay::constrainAngle(phiVtx1 - phiVtx0, -o2::constants::math::PI); - // check if radius and phi of the two vertices are compatible - registry.fill(HIST("hDeltaRadius"), rVtx1 - rVtx0); - registry.fill(HIST("hDeltaPhi"), deltaPhi * o2::constants::math::Rad2Deg); - if (std::abs(deltaPhi) * o2::constants::math::Rad2Deg > dcaFitterEMSel.maxDeltaPhiColMixing || std::abs(rVtx1 - rVtx0) > dcaFitterEMSel.maxDeltaRadiusColMixing) { - continue; - } - registry.fill(HIST("hDecay3BodyPairsAfterCut"), xAxis->GetBinCenter(bin_PosZ), yAxis->GetBinCenter(bin_Mult)); - - fillVtxCand(c0, tpos0, tneg0, tbach1, -1, bachelorcharge, tbach1.tofNSigmaDe()); - // initCCDBfromRunNumber(c1.runNumber()); - fillVtxCand(c1, tpos1, tneg1, tbach0, -1, bachelorcharge, tbach0.tofNSigmaDe()); - } - } - - // Aviod break of preslice in following workflow - /*std::sort(VtxCandidates.begin(), VtxCandidates.end(), [](const VtxCandidate a, const VtxCandidate b) { - return a.collisionId < b.collisionId; - });*/ - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3ReducedEM, "Produce event-mixing background", false); - - void processRun3Reduced3bodyMixing(ReducedCollisionsMults const&, aod::RedIUTracks const&, soa::Join const& decay3bodys) - { - VtxCandidates.clear(); - - auto xAxis = registry.get(HIST("hDecay3BodyRadiusPhi"))->GetXaxis(); - auto yAxis = registry.get(HIST("hDecay3BodyRadiusPhi"))->GetYaxis(); - - for (const auto& decay3body : decay3bodys) { - int bin_Radius = xAxis->FindBin(decay3body.svRadius()); - int bin_Phi = yAxis->FindBin(decay3body.momPhi()); - registry.fill(HIST("hDecay3BodyRadiusPhi"), xAxis->GetBinCenter(bin_Radius), yAxis->GetBinCenter(bin_Phi)); - registry.fill(HIST("hDecay3BodyPosZ"), decay3body.svPosZ()); - } - - Binning3BodyDCAFitter binningOnRadiusPhi{{dcaFitterEMSel.bins3BodyRadius, dcaFitterEMSel.bins3BodyPhiDegree}, true}; - doMixed3Body(decay3bodys, binningOnRadiusPhi); - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3Reduced3bodyMixing, "Produce mixing background directly from mixed decay3bodys based on DCAFitter Info", false); - - void processRun3Reduced3bodyMixingKFInfo(ReducedCollisionsMults const&, aod::RedIUTracks const&, soa::Join const& decay3bodys) - { - VtxCandidates.clear(); - - auto xAxis = registry.get(HIST("hDecay3BodyRadiusPhi"))->GetXaxis(); - auto yAxis = registry.get(HIST("hDecay3BodyRadiusPhi"))->GetYaxis(); - - for (const auto& decay3body : decay3bodys) { - int bin_Radius = xAxis->FindBin(decay3body.radius()); - int bin_Phi = yAxis->FindBin(decay3body.phi()); - registry.fill(HIST("hDecay3BodyRadiusPhi"), xAxis->GetBinCenter(bin_Radius), yAxis->GetBinCenter(bin_Phi)); - registry.fill(HIST("hDecay3BodyPosZ"), decay3body.posz()); - } - - Binning3BodyKFInfo binningOnRadiusPhi{{dcaFitterEMSel.bins3BodyRadius, dcaFitterEMSel.bins3BodyPhi}, true}; - doMixed3Body(decay3bodys, binningOnRadiusPhi); - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3Reduced3bodyMixingKFInfo, "Produce mixing background directly from mixed decay3bodys based on KF Info", false); - - //------------------------------------------------------------------ - void processRun3withKFParticle(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const&, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) - { - for (const auto& collision : collisions) { - - auto bc = collision.bc_as(); - initCCDB(bc); - LOG(debug) << "CCDB initialised."; - - // Zorro event counting - bool isZorroSelected = false; - if (kfparticleConfigurations.cfgSkimmedProcessing) { - isZorroSelected = zorro.isSelected(collision.template bc_as().globalBC()); - if (isZorroSelected) { - registry.fill(HIST("Counters/hEventCounterZorro"), 0.); - } else { - if (kfparticleConfigurations.cfgOnlyKeepInterestedTrigger) { - continue; - } - } - } - - // event selection - registry.fill(HIST("Counters/hEventCounterKFParticle"), 0.5); - if (kfparticleConfigurations.doSel8selection && !collision.sel8()) { - continue; - } - registry.fill(HIST("Counters/hEventCounterKFParticle"), 1.5); - if (kfparticleConfigurations.doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { - continue; - } - registry.fill(HIST("Counters/hEventCounterKFParticle"), 2.5); - registry.fill(HIST("QA/Event/hAllSelEventsVtxZ"), collision.posZ()); - - if (isZorroSelected) { - registry.fill(HIST("Counters/hEventCounterZorro"), 1.); - } - - // slice Decay3Body table by collision - const uint64_t collIdx = collision.globalIndex(); - auto Decay3BodyTable_thisCollision = decay3bodys.sliceBy(perCollision, collIdx); - for (auto& vtx3body : Decay3BodyTable_thisCollision) { - auto trackPos = vtx3body.template track0_as(); - auto trackNeg = vtx3body.template track1_as(); - auto trackBach = vtx3body.template track2_as(); - buildVtx3BodyDataTableKFParticle(collision, trackPos, trackNeg, trackBach, vtx3body.globalIndex(), bachelorcharge, getTOFnSigma(collision, trackBach, false /*isEventMixing*/)); - LOG(debug) << "End of processKFParticle."; - } - } - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticle, "Produce KFParticle decay3body tables", false); - - void processRun3withKFParticleStrangenessTracking(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const& tracks, aod::Decay3Bodys const& decay3bodys, aod::Tracked3Bodys const& tracked3bodys, aod::BCsWithTimestamps const& bcs) - { + // get tracked cluster size info fTrackedClSizeVector.clear(); fTrackedClSizeVector.resize(decay3bodys.size(), 0); for (const auto& tvtx3body : tracked3bodys) { fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize(); } - processRun3withKFParticle(collisions, tracks, decay3bodys, bcs); - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticleStrangenessTracking, "Produce KFParticle strangeness tracked decay3body tables", false); - - void processRun3withKFParticleReduced(aod::RedCollisions const& collisions, aod::RedIUTracks const&, aod::RedDecay3Bodys const& decay3bodys) - { - int lastRunNumber = -1; - - for (const auto& collision : collisions) { - // set magnetic field only when run number changes - if (collision.runNumber() != lastRunNumber) { - initCCDBfromRunNumber(collision.runNumber()); - lastRunNumber = collision.runNumber(); // Update the last run number - LOG(debug) << "CCDB initialized for run " << lastRunNumber; - } - - // event selection - registry.fill(HIST("Counters/hEventCounterKFParticle"), 2.5); - registry.fill(HIST("QA/Event/hAllSelEventsVtxZ"), collision.posZ()); - - // slice Decay3Body table by collision - const uint64_t collIdx = collision.globalIndex(); - auto Decay3BodyTable_thisCollision = decay3bodys.sliceBy(perReducedCollision, collIdx); - for (auto& vtx3body : Decay3BodyTable_thisCollision) { - auto trackPos = vtx3body.template track0_as(); - auto trackNeg = vtx3body.template track1_as(); - auto trackBach = vtx3body.template track2_as(); - buildVtx3BodyDataTableKFParticle(collision, trackPos, trackNeg, trackBach, vtx3body.globalIndex(), bachelorcharge, trackBach.tofNSigmaDe()); - } - LOG(debug) << "End of processKFParticleDerived."; - } - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticleReduced, "Produce KFParticle decay3body tables from derived decay3body data", false); - - void processRun3withKFParticleReducedEM(ReducedCollisionsMults const& collisions, aod::RedIUTracks const&, aod::RedDecay3Bodys const& decay3bodys) - { - // ------------- Check number of events in bins -------------- - // Define a 2D array to count events and pairs per bin - std::vector> binEventCounts(10, std::vector(13, 0)); // 10 vtxZ bins, 13 multiplicity bins - std::vector> binPairCounts(10, std::vector(13, 0)); - - // Function to find bin index (returns -1 if out of range) - auto findBin = [](float value, const std::vector& binEdges) -> int { - for (size_t i = 0; i < binEdges.size() - 1; ++i) { - if (value > binEdges[i] && value <= binEdges[i + 1]) { - return i; - } - } - return -1; // Shouldn't happen if events are within range - }; - // Loop over all collisions to count them in bins - for (auto& collision : collisions) { - float vtxZ = collision.posZ(); - float mult = collision.multNTracksPV(); - - // Determine bin indices - int vtxZBin = findBin(vtxZ, {-10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}); - int multBin = findBin(mult, {0.0f, 1.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}); - - if (vtxZBin >= 0 && multBin >= 0) { - binEventCounts[vtxZBin][multBin]++; - } - } - // Print out the number of events per bin - LOG(info) << "Event count per bin (vtxZ, mult):"; - for (size_t i = 0; i < binEventCounts.size(); ++i) { - for (size_t j = 0; j < binEventCounts[i].size(); ++j) { - LOG(info) << "Bin (" << i << ", " << j << "): " << binEventCounts[i][j] << " events"; - } - } - // Fill histogram with numbers per bin - for (size_t i = 0; i < binEventCounts.size(); ++i) { - for (size_t j = 0; j < binEventCounts[i].size(); ++j) { - registry.fill(HIST("QA/EM/hEventBinCounts"), i, j, binEventCounts[i][j]); - } - } - LOG(info) << "Integral of hEventBinCounts:" << registry.get(HIST("QA/EM/hEventBinCounts"))->Integral(); - - // ------------- Check number of decay3bodys in bins ------------- - // Define a 2D array to count events and pairs per bin - std::vector> binDecay3BodyCounts(10, std::vector(13, 0)); // 10 vtxZ bins, 13 multiplicity bins - // Loop over all decay3bodys to count them in bins - for (auto& decay3body : decay3bodys) { - auto collision = decay3body.template collision_as(); - float vtx3bodyZ = collision.posZ(); - float mult3body = collision.multNTracksPV(); - - // Determine bin indices - int vtx3bodyZBin = findBin(vtx3bodyZ, {-10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}); - int mult3bodyBin = findBin(mult3body, {0.0f, 1.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}); - - if (vtx3bodyZBin >= 0 && mult3bodyBin >= 0) { - binDecay3BodyCounts[vtx3bodyZBin][mult3bodyBin]++; - } - } - // Print out the number of events per bin - LOG(debug) << "Event count per bin (vtxZ, mult):"; - for (size_t i = 0; i < binDecay3BodyCounts.size(); ++i) { - for (size_t j = 0; j < binDecay3BodyCounts[i].size(); ++j) { - LOG(debug) << "Bin (" << i << ", " << j << "): " << binDecay3BodyCounts[i][j] << " events"; - } - } - // Fill histogram with numbers per bin - for (size_t i = 0; i < binDecay3BodyCounts.size(); ++i) { - for (size_t j = 0; j < binDecay3BodyCounts[i].size(); ++j) { - registry.fill(HIST("QA/EM/h3bodyBinCounts"), i, j, binDecay3BodyCounts[i][j]); - } - } - LOG(info) << "Integral of h3bodyBinCounts:" << registry.get(HIST("QA/EM/h3bodyBinCounts"))->Integral(); - - // ------------- Do event mixing -------------- - auto tuple = std::make_tuple(decay3bodys); - BinningTypeKF binningOnPosAndMult{{kfparticleConfigurations.binsVtxZ, kfparticleConfigurations.binsMultiplicity}, true}; // ignore over-/underflow - SameKindPair pair{binningOnPosAndMult, kfparticleConfigurations.nEvtMixing, -1, collisions, tuple, &cache}; // indicates that under/overflow (-1) to be ignored - - int lastRunNumber = -1; - - for (auto& [c1, decays3body1, c2, decays3body2] : pair) { - registry.fill(HIST("QA/EM/hPairCounterMixing"), 0.5); - - // event selection already applied in reducer task - - // set magnetic field only when run number changes - if (c1.runNumber() != lastRunNumber) { - initCCDBfromRunNumber(c1.runNumber()); - lastRunNumber = c1.runNumber(); // Update the last run number - LOG(debug) << "CCDB initialized for run " << lastRunNumber; - } - - // Get vtxZ and multiplicity from collision - float vtxZpair = c1.posZ(); - float multpair = c1.multNTracksPV(); - // Find the bin index - int vtxZpairBin = findBin(vtxZpair, {-10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}); - int multpairBin = findBin(multpair, {0.0f, 1.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}); - if (vtxZpairBin >= 0 && multpairBin >= 0) { - binPairCounts[vtxZpairBin][multpairBin]++; // Count the pair - } - - for (auto& [decay3body1, decay3body2] : soa::combinations(soa::CombinationsFullIndexPolicy(decays3body1, decays3body2))) { - auto trackPos1 = decay3body1.template track0_as(); - auto trackNeg1 = decay3body1.template track1_as(); - auto trackBach1 = decay3body1.template track2_as(); - auto trackPos2 = decay3body2.template track0_as(); - auto trackNeg2 = decay3body2.template track1_as(); - auto trackBach2 = decay3body2.template track2_as(); - - registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 0.5); - - // ---------- selections bachelor track ---------- - if ((trackBach1.sign() > 0 && !(trackBach2.sign() > 0)) || (trackBach1.sign() < 0 && !(trackBach2.sign() < 0)) || trackBach1.globalIndex() == trackBach2.globalIndex()) { // only combine if trackBach2 has correct sign and is not same as trackBach1 - continue; - } - registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 1.5); - - // ---------- check radius and phi of decay3bodys ---------- - auto trackParCovPos1 = getTrackParCov(trackPos1); - auto trackParCovNeg1 = getTrackParCov(trackNeg1); - auto trackParCovBach1 = getTrackParCov(trackBach1); - auto trackParCovPos2 = getTrackParCov(trackPos2); - auto trackParCovNeg2 = getTrackParCov(trackNeg2); - auto trackParCovBach2 = getTrackParCov(trackBach2); - // create KFParticle objects from tracks - KFParticle kfpProton1, kfpPion1, kfpDeuteron1; - if (trackBach1.sign() > 0) { - kfpProton1 = createKFParticleFromTrackParCov(trackParCovPos1, trackPos1.sign(), constants::physics::MassProton); - kfpPion1 = createKFParticleFromTrackParCov(trackParCovNeg1, trackNeg1.sign(), constants::physics::MassPionCharged); - } else if (!(trackBach1.sign() > 0)) { - kfpProton1 = createKFParticleFromTrackParCov(trackParCovNeg1, trackNeg1.sign(), constants::physics::MassProton); - kfpPion1 = createKFParticleFromTrackParCov(trackParCovPos1, trackPos1.sign(), constants::physics::MassPionCharged); - } - kfpDeuteron1 = createKFParticleFromTrackParCov(trackParCovBach1, trackBach1.sign() * bachelorcharge, constants::physics::MassDeuteron); - KFParticle kfpProton2, kfpPion2, kfpDeuteron2; - if (trackBach2.sign() > 0) { - kfpProton2 = createKFParticleFromTrackParCov(trackParCovPos2, trackPos2.sign(), constants::physics::MassProton); - kfpPion2 = createKFParticleFromTrackParCov(trackParCovNeg2, trackNeg2.sign(), constants::physics::MassPionCharged); - } else if (!(trackBach2.sign() > 0)) { - kfpProton2 = createKFParticleFromTrackParCov(trackParCovNeg2, trackNeg2.sign(), constants::physics::MassProton); - kfpPion2 = createKFParticleFromTrackParCov(trackParCovPos2, trackPos2.sign(), constants::physics::MassPionCharged); - } - kfpDeuteron2 = createKFParticleFromTrackParCov(trackParCovBach2, trackBach2.sign() * bachelorcharge, constants::physics::MassDeuteron); - // fit vertices - KFParticle KFHt1, KFHt2; - fit3bodyVertex(kfpProton1, kfpPion1, kfpDeuteron1, KFHt1); - fit3bodyVertex(kfpProton2, kfpPion2, kfpDeuteron2, KFHt2); - - // ---------- select common radius and phi region ---------- - auto radius1 = std::sqrt(KFHt1.GetX() * KFHt1.GetX() + KFHt1.GetY() * KFHt1.GetY()); - auto radius2 = std::sqrt(KFHt2.GetX() * KFHt2.GetX() + KFHt2.GetY() * KFHt2.GetY()); - registry.fill(HIST("QA/EM/hRadius1"), radius1); - registry.fill(HIST("QA/EM/hRadius2"), radius2); - registry.fill(HIST("QA/EM/hPhi1"), KFHt1.GetPhi() * (180.0 / TMath::Pi())); - registry.fill(HIST("QA/EM/hPhi2"), KFHt2.GetPhi() * (180.0 / TMath::Pi())); - registry.fill(HIST("QA/EM/hDeltaRadius"), std::abs(radius1 - radius2)); - registry.fill(HIST("QA/EM/hDeltaPhi"), std::abs(KFHt1.GetPhi() - KFHt2.GetPhi()) * (180.0 / TMath::Pi())); - if (std::abs(KFHt1.GetPhi() - KFHt2.GetPhi()) * (180.0 / TMath::Pi()) > 10 || std::abs(radius1 - radius2) > 2) { - continue; - } - registry.fill(HIST("QA/EM/hCombinationCounterMixing"), 2.5); - - // fill 2D pair counter per bin - registry.fill(HIST("QA/EM/hPairBinCounts"), vtxZpairBin, multpairBin, 1); - - // ---------- do candidate analysis ---------- - buildVtx3BodyDataTableKFParticle(c1, trackPos1, trackNeg1, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe()); - } // end decay3body combinations loop - } // end pairing loop - } // end process - PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticleReducedEM, "Produce KFParticle event mixing decay3body tables from derived decay3body data", false); - - void processRun3withKFParticleReduced3bodyMixing(ReducedCollisionsMults const&, aod::RedIUTracks const&, soa::Join const& decay3bodys) - { - // Define a 2D array to count 3bodies per bin (radius, phi, posZ) - std::vector> bin3bodyCounts(16, std::vector(36, 0)); - - // Function to find bin index (returns -1 if out of range) - auto findBin = [](float value, const std::vector& binEdges) -> int { - for (size_t i = 0; i < binEdges.size() - 1; ++i) { - if (value > binEdges[i] && value <= binEdges[i + 1]) { - return i; - } - } - return -1; // Out of range - }; - - int counter = 0; - // Loop over all collisions to count them in bins - for (auto& decay3body : decay3bodys) { - counter++; - float radius = decay3body.radius(); - float phi = decay3body.phi(); - float posZ = decay3body.posz(); - - registry.fill(HIST("QA/EM/hRadius"), radius); - registry.fill(HIST("QA/EM/hPhi"), phi); - registry.fill(HIST("QA/EM/hPosZ"), posZ); - - // float degToRad = TMath::Pi()/180; - - // Determine bin indices - int radiusBin = findBin(radius, {0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f, 30.0f, 1000.0}); - int phiBin = findBin(phi, {-180.0f * TMath::Pi() / 180, -160.0f * TMath::Pi() / 180, -140.0f * TMath::Pi() / 180, -120.0f * TMath::Pi() / 180, -100.0f * TMath::Pi() / 180, -80.0f * TMath::Pi() / 180, -60.0f * TMath::Pi() / 180, -40.0f * TMath::Pi() / 180, -20.0f * TMath::Pi() / 180, 0.0f, 20.0f * TMath::Pi() / 180, 40.0f * TMath::Pi() / 180, 60.0f * TMath::Pi() / 180, 80.0f * TMath::Pi() / 180, 100.0f * TMath::Pi() / 180, 120.0f * TMath::Pi() / 180, 140.0f * TMath::Pi() / 180, 160.0f * TMath::Pi() / 180, 180.0f * TMath::Pi() / 180}); - if (radiusBin >= 0 && phiBin >= 0) { // && posZBin >= 0) { - bin3bodyCounts[radiusBin][phiBin]++; //[posZBin]++; - } - } - LOG(info) << "3body counter: " << counter; - - // Print out the number of 3-body decays per bin - LOG(info) << "3body count per bin (radius, phi, posZ):"; - for (size_t i = 0; i < bin3bodyCounts.size(); ++i) { - for (size_t j = 0; j < bin3bodyCounts[i].size(); ++j) { - LOG(info) << "Bin (" << i << ", " << j << "): " << bin3bodyCounts[i][j] << " 3bodies"; - } - } - // Fill 3D histogram with numbers per bin - for (size_t i = 0; i < bin3bodyCounts.size(); ++i) { - for (size_t j = 0; j < bin3bodyCounts[i].size(); ++j) { - registry.fill(HIST("QA/EM/h3bodyBinCounts"), i, j, bin3bodyCounts[i][j]); - } - } - LOG(info) << "Integral of h3bodyBinCounts: " << registry.get(HIST("QA/EM/h3bodyBinCounts"))->Integral(); - - Binning3Body binningOnRadPhi{{kfparticleConfigurations.bins3BodyRadius, kfparticleConfigurations.bins3BodyPhi}, true}; - - // Strictly upper index policy for decay3body objects binned by radius, phi and z position - for (auto& [decay3body1, decay3body2] : selfPairCombinations(binningOnRadPhi, kfparticleConfigurations.nEvtMixing, -1, decay3bodys)) { - auto trackPos1 = decay3body1.template track0_as(); - auto trackNeg1 = decay3body1.template track1_as(); - auto trackBach1 = decay3body1.template track2_as(); - auto trackPos2 = decay3body2.template track0_as(); - auto trackNeg2 = decay3body2.template track1_as(); - auto trackBach2 = decay3body2.template track2_as(); - - registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 0.5); - - // collision vertex selections - auto collision1 = decay3body1.template collision_as(); - auto collision2 = decay3body2.template collision_as(); - initCCDBfromRunNumber(collision2.runNumber()); - initCCDBfromRunNumber(collision1.runNumber()); - - if (decay3body1.collisionId() == decay3body2.collisionId()) { // only combine if from different event - continue; - } - registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 1.5); - if (kfparticleConfigurations.selectVtxZ3bodyMixing && std::abs(collision1.posZ() - collision2.posZ()) > kfparticleConfigurations.VtxZBin3bodyMixing) { // only combine if collision similar in VtxZ - continue; - } - registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 2.5); - - // ---------- selections ---------- - if ((trackBach1.sign() > 0 && !(trackBach2.sign() > 0)) || (trackBach1.sign() < 0 && !(trackBach2.sign() < 0)) || trackBach1.globalIndex() == trackBach2.globalIndex()) { // only combine if trackBach2 has correct sign and is not same as trackBach1 - continue; - } - registry.fill(HIST("QA/EM/h3bodyCombinationCounter"), 3.5); - - // ---------- do candidate analysis ---------- - bool isMatter1 = false; - if (trackBach1.sign() > 0) { - isMatter1 = true; - } - if (kfparticleConfigurations.mixingType == 0) { // mix deuteron - buildVtx3BodyDataTableKFParticle(collision1, trackPos1, trackNeg1, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe()); - buildVtx3BodyDataTableKFParticle(collision2, trackPos2, trackNeg2, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe()); - } else if (kfparticleConfigurations.mixingType == 1) { // mix proton - if (isMatter1 == true) { - buildVtx3BodyDataTableKFParticle(collision1, trackPos2, trackNeg1, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe()); - buildVtx3BodyDataTableKFParticle(collision2, trackPos1, trackNeg2, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe()); - } else if (isMatter1 == false) { - buildVtx3BodyDataTableKFParticle(collision1, trackPos1, trackNeg2, trackBach1, -1 /*vtx3bodyID*/, bachelorcharge, trackBach1.tofNSigmaDe()); - buildVtx3BodyDataTableKFParticle(collision2, trackPos2, trackNeg1, trackBach2, -1 /*vtx3bodyID*/, bachelorcharge, trackBach2.tofNSigmaDe()); - } - } - } // end decay3body combinations loop - } - PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticleReduced3bodyMixing, "Produce KFParticle mixed decay3body tables from derived decay3body data", false); -}; - -// build link from decay3body -> vtx3body -struct decay3bodyDataLinkBuilder { - Produces VtxDataLink; - - void init(InitContext const&) {} - - template - void buildDecay3BodyLabel(TDecay3Bodys const& decay3bodytable, TVtx3BodyDatas const& vtxdatatable) - { - std::vector lIndices; - lIndices.reserve(decay3bodytable.size()); - for (int ii = 0; ii < decay3bodytable.size(); ii++) - lIndices[ii] = -1; - for (const auto& vtxdata : vtxdatatable) { - if (vtxdata.decay3bodyId() != -1) { - lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex(); - } - } - for (int ii = 0; ii < decay3bodytable.size(); ii++) { - VtxDataLink(lIndices[ii]); - } - } - - void processStandard(aod::Decay3Bodys const& decay3bodytable, aod::Vtx3BodyDatas const& vtxdatatable) - { - buildDecay3BodyLabel(decay3bodytable, vtxdatatable); - } - PROCESS_SWITCH(decay3bodyDataLinkBuilder, processStandard, "Produce label from decay3body to vtx3body", true); - - void processReduced(aod::RedDecay3Bodys const& decay3bodytable, aod::Vtx3BodyDatas const& vtxdatatable) - { - buildDecay3BodyLabel(decay3bodytable, vtxdatatable); - } - PROCESS_SWITCH(decay3bodyDataLinkBuilder, processReduced, "Produce label from reducedDecay3body to vtx3body", false); -}; - -struct kfdecay3bodyDataLinkBuilder { - Produces kfvtxdataLink; - - void init(InitContext const&) {} - - template - void buildDataLink(TDecay3Bodys const& decay3bodytable, TVtx3BodyDatas const& vtxdatatable) - { - std::vector lIndices; - lIndices.reserve(decay3bodytable.size()); - for (int ii = 0; ii < decay3bodytable.size(); ii++) - lIndices[ii] = -1; - for (auto& vtxdata : vtxdatatable) { - if (vtxdata.decay3bodyId() != -1) { - lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex(); - } - } - for (int ii = 0; ii < decay3bodytable.size(); ii++) { - kfvtxdataLink(lIndices[ii]); - } - } - - void processStandard(aod::Decay3Bodys const& decay3bodytable, aod::KFVtx3BodyDatas const& vtxdatatable) - { - buildDataLink(decay3bodytable, vtxdatatable); // build Decay3Body -> KFDecay3BodyData link table - } - PROCESS_SWITCH(kfdecay3bodyDataLinkBuilder, processStandard, "Build data link table.", true); - - void processReduced(aod::RedDecay3Bodys const& decay3bodytable, aod::KFVtx3BodyDatas const& vtxdatatable) - { - buildDataLink(decay3bodytable, vtxdatatable); // build ReducedDecay3Body -> KFDecay3BodyData link table - } - PROCESS_SWITCH(kfdecay3bodyDataLinkBuilder, processReduced, "Build data link table for reduced data.", false); -}; - -struct decay3bodyLabelBuilder { - - Produces vtxlabels; - Produces vtxfulllabels; - - HistogramRegistry registry{"registry", {}}; - - void init(InitContext const&) - { - if (doprocessDoNotBuildLabels == false) { - auto hLabelCounter = registry.add("hLabelCounter", "hLabelCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}}); - hLabelCounter->GetXaxis()->SetBinLabel(1, "Total"); - hLabelCounter->GetXaxis()->SetBinLabel(2, "Have Same MotherTrack"); - hLabelCounter->GetXaxis()->SetBinLabel(3, "True H3L"); - - registry.add("hHypertritonMCPt", "hHypertritonMCPt", HistType::kTH1F, {{100, 0.0f, 10.0f}}); - registry.add("hAntiHypertritonMCPt", "hAntiHypertritonMCPt", HistType::kTH1F, {{100, 0.0f, 10.0f}}); - registry.add("hHypertritonMCMass", "hHypertritonMCMass", HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}); - registry.add("hAntiHypertritonMCMass", "hAntiHypertritonMCMass", HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}); - registry.add("hHypertritonMCLifetime", "hHypertritonMCLifetime", HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}); - registry.add("hAntiHypertritonMCLifetime", "hAntiHypertritonMCLifetime", HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}); - } - } - - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - - void processDoNotBuildLabels(aod::Decay3BodyDataLink const&) // is it possible to have none parameter? - { - // dummy process function - should not be required in the future - }; - PROCESS_SWITCH(decay3bodyLabelBuilder, processDoNotBuildLabels, "Do not produce MC label tables", true); - - void processBuildLabels(aod::Decay3BodysLinked const& decay3bodys, aod::Vtx3BodyDatas const& vtx3bodydatas, MCLabeledTracksIU const&, aod::McParticles const&) - { - std::vector lIndices; - lIndices.reserve(vtx3bodydatas.size()); - for (int ii = 0; ii < vtx3bodydatas.size(); ii++) { - lIndices[ii] = -1; - } - for (const auto& decay3body : decay3bodys) { - - int lLabel = -1; - int lPDG = -1; - float lPt = -1; - double MClifetime = -1; - bool is3bodyDecay = false; - int lGlobalIndex = -1; - - auto lTrack0 = decay3body.track0_as(); - auto lTrack1 = decay3body.track1_as(); - auto lTrack2 = decay3body.track2_as(); - registry.fill(HIST("hLabelCounter"), 0.5); - - // Association check - // There might be smarter ways of doing this in the future - if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { - vtxfulllabels(-1); - continue; - } - auto lMCTrack0 = lTrack0.mcParticle_as(); - auto lMCTrack1 = lTrack1.mcParticle_as(); - auto lMCTrack2 = lTrack2.mcParticle_as(); - if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { - vtxfulllabels(-1); - continue; - } - - for (const auto& lMother0 : lMCTrack0.mothers_as()) { - for (const auto& lMother1 : lMCTrack1.mothers_as()) { - for (const auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - lGlobalIndex = lMother1.globalIndex(); - lPt = lMother1.pt(); - lPDG = lMother1.pdgCode(); - MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); // only for hypertriton - is3bodyDecay = true; // vtxs with the same mother - } - } - } - } // end association check - if (!is3bodyDecay) { - vtxfulllabels(-1); - continue; - } - registry.fill(HIST("hLabelCounter"), 1.5); - - // Intended for hypertriton cross-checks only - if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { - lLabel = lGlobalIndex; - double hypertritonMCMass = RecoDecay::m(std::array{std::array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, std::array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, std::array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hLabelCounter"), 2.5); - registry.fill(HIST("hHypertritonMCPt"), lPt); - registry.fill(HIST("hHypertritonMCLifetime"), MClifetime); - registry.fill(HIST("hHypertritonMCMass"), hypertritonMCMass); - } - if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { - lLabel = lGlobalIndex; - double antiHypertritonMCMass = RecoDecay::m(std::array{std::array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, std::array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, std::array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hLabelCounter"), 2.5); - registry.fill(HIST("hAntiHypertritonMCPt"), lPt); - registry.fill(HIST("hAntiHypertritonMCLifetime"), MClifetime); - registry.fill(HIST("hAntiHypertritonMCMass"), antiHypertritonMCMass); - } - - // Construct label table, only vtx which corresponds to true mother and true daughters with a specified order is labeled - // for matter: track0->p, track1->pi, track2->bachelor - // for antimatter: track0->pi, track1->p, track2->bachelor - vtxfulllabels(lLabel); - if (decay3body.vtx3BodyDataId() != -1) { - lIndices[decay3body.vtx3BodyDataId()] = lLabel; - } - } - for (int ii = 0; ii < vtx3bodydatas.size(); ii++) { - vtxlabels(lIndices[ii]); - } + // do candidate analysis with MC processing + buildCandidates(bcs, // bc table + collisions, // collision table + decay3bodys, // decay3body table + mcParticles, // MC particle table + mcCollisions); // MC collision table } - PROCESS_SWITCH(decay3bodyLabelBuilder, processBuildLabels, "Produce MC label tables", false); -}; -struct decay3bodyInitializer { - Spawns vtx3bodydatas; - void init(InitContext const&) {} + PROCESS_SWITCH(decay3bodyBuilder, processRealData, "process real data", true); + PROCESS_SWITCH(decay3bodyBuilder, processRealDataReduced, "process real reduced data", false); + PROCESS_SWITCH(decay3bodyBuilder, processRealDataReduced3bodyMixing, "process real reduced data", false); + PROCESS_SWITCH(decay3bodyBuilder, processMonteCarlo, "process monte carlo", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - }; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Nuspex/hypertriton3bodyfinder.cxx b/PWGLF/TableProducer/Nuspex/hypertriton3bodyfinder.cxx deleted file mode 100644 index bad62accce2..00000000000 --- a/PWGLF/TableProducer/Nuspex/hypertriton3bodyfinder.cxx +++ /dev/null @@ -1,1197 +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. - -// This 3-body method is not recommended due to high cost of computing resources -// author: yuanzhe.wang@cern.ch - -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/Vtx3BodyTables.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 "EventFiltering/filterTables.h" - -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -using FullTracksExtIU = soa::Join; -using MCLabeledTracksIU = soa::Join; - -template -bool is3bodyDecayedH3L(TMCParticle const& particle) -{ - if (particle.pdgCode() != 1010010030 && particle.pdgCode() != -1010010030) { - return false; - } - bool haveProton = false, havePionPlus = false, haveDeuteron = false; - bool haveAntiProton = false, havePionMinus = false, haveAntiDeuteron = false; - for (auto& mcparticleDaughter : particle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == 2212) - haveProton = true; - if (mcparticleDaughter.pdgCode() == -2212) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == 211) - havePionPlus = true; - if (mcparticleDaughter.pdgCode() == -211) - havePionMinus = true; - if (mcparticleDaughter.pdgCode() == 1000010020) - haveDeuteron = true; - if (mcparticleDaughter.pdgCode() == -1000010020) - haveAntiDeuteron = true; - } - if (haveProton && havePionMinus && haveDeuteron && particle.pdgCode() == 1010010030) { - return true; - } else if (haveAntiProton && havePionPlus && haveAntiDeuteron && particle.pdgCode() == -1010010030) { - return true; - } - return false; -} - -namespace o2::aod -{ -namespace v0goodpostrack -{ -DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -} // namespace v0goodpostrack -DECLARE_SOA_TABLE(V0GoodPosTracks, "AOD", "V0GOODPOSTRACKS", o2::soa::Index<>, v0goodpostrack::GoodTrackId, v0goodpostrack::CollisionId); -namespace v0goodnegtrack -{ -DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -} // namespace v0goodnegtrack -DECLARE_SOA_TABLE(V0GoodNegTracks, "AOD", "V0GOODNEGTRACKS", o2::soa::Index<>, v0goodnegtrack::GoodTrackId, v0goodnegtrack::CollisionId); -namespace v0goodtrack -{ -DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -} // namespace v0goodtrack -DECLARE_SOA_TABLE(V0GoodTracks, "AOD", "V0GOODTRACKS", o2::soa::Index<>, v0goodtrack::GoodTrackId, v0goodtrack::CollisionId); -} // namespace o2::aod - -struct trackprefilter { - HistogramRegistry registry{ - "registry", - { - {"hCrossedRows", "hCrossedRows", {HistType::kTH1F, {{50, 0.0f, 200.0f}}}}, - {"hGoodTrackCount", "hGoodTrackCount", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, - {"hGoodPosTrackCount", "hGoodPosTrackCount", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}}, - {"hGoodNegTrackCount", "hGoodNegTrackCount", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}}, - {"h3bodyCounter", "h3bodyCounter", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, - }, - }; - - // change the dca cut for helium3 - Configurable mintpcNCls{"mintpcNCls", 70, "min tpc Nclusters"}; - Configurable tpcrefit{"tpcrefit", 0, "demand TPC refit"}; - - Produces v0GoodPosTracks; - Produces v0GoodNegTracks; - Produces v0GoodTracks; - - // Fix: Add PID and pt cuts to tracks - void processDefault(aod::Collision const& /*collision*/, - FullTracksExtIU const& tracks) - { - for (auto& t0 : tracks) { - registry.fill(HIST("hGoodTrackCount"), 0.5); - registry.fill(HIST("hCrossedRows"), t0.tpcNClsCrossedRows()); - if (tpcrefit) { - if (!(t0.trackType() & o2::aod::track::TPCrefit)) { - continue; // TPC refit - } - } - registry.fill(HIST("hGoodTrackCount"), 1.5); - if (t0.tpcNClsFound() < mintpcNCls) { - continue; - } - registry.fill(HIST("hGoodTrackCount"), 2.5); - if (t0.signed1Pt() > 0.0f) { - v0GoodPosTracks(t0.globalIndex(), t0.collisionId()); - registry.fill(HIST("hGoodPosTrackCount"), 0.5); - registry.fill(HIST("hGoodTrackCount"), 3.5); - } - if (t0.signed1Pt() < 0.0f) { - v0GoodNegTracks(t0.globalIndex(), t0.collisionId()); - registry.fill(HIST("hGoodNegTrackCount"), 0.5); - registry.fill(HIST("hGoodTrackCount"), 3.5); - } - v0GoodTracks(t0.globalIndex(), t0.collisionId()); - } - } - PROCESS_SWITCH(trackprefilter, processDefault, "Default process function", true); - - // process function for MC d3body check - // void processCheck(aod::Collision const& collision, aod::Decay3Bodys const& decay3bodys, - void processCheck(aod::Decay3Bodys const& decay3bodys, - MCLabeledTracksIU const& /*tracks*/, aod::McParticles const& /*particlesMC*/) - { - for (auto& d3body : decay3bodys) { - registry.fill(HIST("h3bodyCounter"), 0.5); - auto lTrack0 = d3body.track0_as(); - auto lTrack1 = d3body.track1_as(); - auto lTrack2 = d3body.track2_as(); - if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { - continue; - } - registry.fill(HIST("h3bodyCounter"), 1.5); - auto lMCTrack0 = lTrack0.mcParticle_as(); - auto lMCTrack1 = lTrack1.mcParticle_as(); - auto lMCTrack2 = lTrack2.mcParticle_as(); - if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { - continue; - } - registry.fill(HIST("h3bodyCounter"), 2.5); - - int lPDG = -1; - bool is3bodyDecay = false; - for (auto& lMother0 : lMCTrack0.mothers_as()) { - for (auto& lMother1 : lMCTrack1.mothers_as()) { - for (auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - lPDG = lMother1.pdgCode(); - if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { - is3bodyDecay = true; // vtxs with the same mother - } - if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { - is3bodyDecay = true; // vtxs with the same mother - } - } - } - } - } // end association check - - if (!is3bodyDecay || std::abs(lPDG) != 1010010030) { - continue; - } - registry.fill(HIST("h3bodyCounter"), 3.5); - if (lTrack0.collisionId() != lTrack1.collisionId() || lTrack0.collisionId() != lTrack2.collisionId()) { - continue; - } - registry.fill(HIST("h3bodyCounter"), 4.5); - - if (lTrack0.collisionId() != d3body.collisionId()) { - continue; - } - registry.fill(HIST("h3bodyCounter"), 5.5); - - // LOG(info) << "; Track0ID: " << lTrack0.globalIndex() << "; Track1ID:" << lTrack1.globalIndex() << "; Track2ID:" << lTrack2.globalIndex(); - v0GoodPosTracks(lTrack0.globalIndex(), lTrack0.collisionId()); - v0GoodNegTracks(lTrack1.globalIndex(), lTrack1.collisionId()); - v0GoodTracks(lTrack2.globalIndex(), lTrack2.collisionId()); - } - } - PROCESS_SWITCH(trackprefilter, processCheck, "Check specific paired tracks", false); -}; - -struct hypertriton3bodyFinder { - - Produces vtx3bodydata; - Service ccdb; - - // Configurables - Configurable UseCFFilter{"UseCFFilter", true, "Reject event without CF LD trigger"}; - Configurable RejectBkgInMC{"RejectBkgInMC", false, "Reject fake 3-body pairs in MC check"}; - - Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - - // Selection criteria - Configurable minRToMeanVertex = {"minRToMeanVertex", 0.5, ""}; ///< min radial distance of V0 from beam line (mean vertex) - // Configurable causalityRTolerance = {"causalityRTolerance", 1., ""}; ///< V0 radius cannot exceed its contributors minR by more than this value - Configurable maxV0ToProngsRDiff = {"maxV0ToProngsRDiff", 50., ""}; ///< V0 radius cannot be lower than this ammount wrt minR of contributors - Configurable minPtV0 = {"minPtV0", 0.5, ""}; ///< v0 minimum pT - Configurable maxTglV0 = {"maxTglV0", 2., ""}; ///< maximum tgLambda of V0 - Configurable maxDCAXY2ToMeanVertex3bodyV0 = {"maxDCAXY2ToMeanVertex3bodyV0", 2 * 2, ""}; - Configurable minCosPAXYMeanVertex3bodyV0 = {"minCosPAXYMeanVertex3bodyV0", 0.9, ""}; ///< min cos of PA to beam line (mean vertex) in tr. plane for 3body V0 cand. - Configurable minCosPA3bodyV0 = {"minCosPA3bodyV0", 0.8, ""}; // min cos of PA to PV for 3body V0 - - // for 3 body reconstructed Vertex - Configurable minbachPt = {"minbachPt", 0.6, ""}; ///< Minimum bachelor Pt - Configurable maxRDiff3bodyV0 = {"maxRDiff3bodyV0", 3, ""}; ///< Maximum difference between V0 and 3body radii - Configurable minPt3Body = {"minPt3Body", 0.01, ""}; // minimum pT of 3body Vertex - Configurable maxTgl3Body = {"maxTgl3Body", 2, ""}; // maximum tgLambda of 3body Vertex - Configurable minCosPA3body = {"minCosPA3body", 0.8, ""}; // min cos of PA to PV for 3body Vertex - - // for DCA - Configurable dcavtxdau{"dcavtxdau", 2.0, "DCA Vtx Daughters"}; - Configurable d_UseH3LDCACut{"d_UseH3LDCACut", true, "Use Cuts for H3L DCA to PV"}; - Configurable maxDCAXY3Body{"maxDCAXY3Body", 0.5, "DCAXY H3L to PV"}; // max DCA of 3 body decay to PV in XY - Configurable maxDCAZ3Body{"maxDCAZ3Body", 1.0, "DCAZ H3L to PV"}; // max DCA of 3 body decay to PV in Z - - Configurable useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"}; - // 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 lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - - Preslice perCollisionGoodPosTracks = o2::aod::v0goodpostrack::collisionId; - Preslice perCollisionGoodNegTracks = o2::aod::v0goodnegtrack::collisionId; - Preslice perCollisionGoodTracks = o2::aod::v0goodtrack::collisionId; - Preslice perCollisionV0s = o2::aod::v0::collisionId; - Preslice perCollisionV0Datas = o2::aod::v0data::collisionId; - - // Helper struct to pass V0 information - HistogramRegistry registry{ - "registry", - { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hDauTrackCounter", "hDauTrackCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hV0Counter", "hV0Counter", {HistType::kTH1F, {{8, -0.5f, 7.5f}}}}, - {"hTrueV0Counter", "hTrueV0Counter", {HistType::kTH1F, {{8, -0.5f, 7.5f}}}}, - {"hVtx3BodyCounter", "hVtx3BodyCounter", {HistType::kTH1F, {{9, -0.5f, 8.5f}}}}, - {"hTrueVtx3BodyCounter", "hTrueVtx3BodyCounter", {HistType::kTH1F, {{9, -0.5f, 8.5f}}}}, - {"hVirtLambaCounter", "hVirtualLambaCounter", {HistType::kTH1F, {{6, -0.5f, 5.5f}}}}, - {"hCFFilteredVirtLambaCounter", "hCFFilteredVirtLambaCounter", {HistType::kTH1F, {{6, -0.5f, 5.5f}}}}, - }, - }; - - //------------------------------------------------------------------ - // Fill stats histograms - enum v0step { kV0All = 0, - kV0hasSV, - kV0Radius, - kV0Pt, - kV0TgLamda, - kV0InvMass, - kV0DcaXY, - kV0CosPA, - kNV0Steps }; - enum vtxstep { kVtxAll = 0, - kVtxbachPt, - kVtxhasSV, - kVtxRadius, - kVtxPt, - kVtxTgLamda, - kVtxCosPA, - kVtxDcaDau, - kVtxDcaH3L, - kNVtxSteps }; - - // Helper struct to do bookkeeping of building parameters - struct { - std::array v0stats; - std::array truev0stats; - std::array vtxstats; - std::array truevtxstats; - std::array virtLambdastats; - } statisticsRegistry; - - void resetHistos() - { - for (Int_t ii = 0; ii < kNV0Steps; ii++) { - statisticsRegistry.v0stats[ii] = 0; - statisticsRegistry.truev0stats[ii] = 0; - } - for (Int_t ii = 0; ii < kNVtxSteps; ii++) { - statisticsRegistry.vtxstats[ii] = 0; - statisticsRegistry.truevtxstats[ii] = 0; - } - for (Int_t ii = 0; ii < 12; ii++) { - statisticsRegistry.virtLambdastats[ii] = 0; - } - } - - void fillHistos() - { - for (Int_t ii = 0; ii < kNV0Steps; ii++) { - registry.fill(HIST("hV0Counter"), ii, statisticsRegistry.v0stats[ii]); - registry.fill(HIST("hTrueV0Counter"), ii, statisticsRegistry.truev0stats[ii]); - } - for (Int_t ii = 0; ii < kNVtxSteps; ii++) { - registry.fill(HIST("hVtx3BodyCounter"), ii, statisticsRegistry.vtxstats[ii]); - registry.fill(HIST("hTrueVtx3BodyCounter"), ii, statisticsRegistry.truevtxstats[ii]); - } - for (Int_t ii = 0; ii < 3; ii++) { - registry.fill(HIST("hVirtLambaCounter"), ii, statisticsRegistry.virtLambdastats[ii]); - registry.fill(HIST("hVirtLambaCounter"), ii + 3, statisticsRegistry.virtLambdastats[ii + 3]); - registry.fill(HIST("hCFFilteredVirtLambaCounter"), ii, statisticsRegistry.virtLambdastats[ii + 6]); - registry.fill(HIST("hCFFilteredVirtLambaCounter"), ii + 3, statisticsRegistry.virtLambdastats[ii + 9]); - } - } - - // v0, vtx, and virtual Lambda statiscs - void FillV0Counter(int kn, bool istrue = false) - { - statisticsRegistry.v0stats[kn]++; - if (istrue) { - statisticsRegistry.truev0stats[kn]++; - } - } - void FillVtxCounter(int kn, bool istrue = false) - { - statisticsRegistry.vtxstats[kn]++; - if (istrue) { - statisticsRegistry.truevtxstats[kn]++; - } - } - //------------------------------------------------------------------ - - int mRunNumber; - float d_bz; - float maxSnp; // max sine phi for propagation - float maxStep; // max step size (cm) for propagation - o2::base::MatLayerCylSet* lut = nullptr; - o2::vertexing::DCAFitterN<2> fitter; - o2::vertexing::DCAFitterN<3> fitter3body; - - void init(InitContext&) - { - resetHistos(); - mRunNumber = 0; - d_bz = 0; - maxSnp = 0.85f; // could be changed later - maxStep = 2.00f; // could be changed later - - TString DauCounterbinLabel[3] = {"Proton", "Pion", "Deuteron"}; - TString V0CounterbinLabel[8] = {"Total", "hasSV", "V0R", "V0Pt", "TgLambda", "V0Mass", "DcaXY", "CosPA"}; - TString VtxCounterbinLabel[9] = {"Total", "bachPt", "hasSV", "VtxR", "VtxPt", "TgLambda", "CosPA", "DcaDau", "DcaH3L"}; - for (int i{0}; i < 3; i++) { - registry.get(HIST("hDauTrackCounter"))->GetXaxis()->SetBinLabel(i + 1, DauCounterbinLabel[i]); - } - for (int i{0}; i < kNV0Steps; i++) { - registry.get(HIST("hV0Counter"))->GetXaxis()->SetBinLabel(i + 1, V0CounterbinLabel[i]); - registry.get(HIST("hTrueV0Counter"))->GetXaxis()->SetBinLabel(i + 1, V0CounterbinLabel[i]); - } - for (int i{0}; i < kNVtxSteps; i++) { - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(i + 1, VtxCounterbinLabel[i]); - registry.get(HIST("hTrueVtx3BodyCounter"))->GetXaxis()->SetBinLabel(i + 1, VtxCounterbinLabel[i]); - } - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - // Set 2-body fitter and 3-body fitter3body - fitter.setPropagateToPCA(true); - fitter.setMaxR(200.); //->maxRIni3body - fitter.setMinParamChange(1e-3); - fitter.setMinRelChi2Change(0.9); - fitter.setMaxDZIni(1e9); - fitter.setMaxChi2(1e9); - fitter.setUseAbsDCA(d_UseAbsDCA); - fitter3body.setPropagateToPCA(true); - fitter3body.setMaxR(200.); //->maxRIni3body - fitter3body.setMinParamChange(1e-3); - fitter3body.setMinRelChi2Change(0.9); - fitter3body.setMaxDZIni(1e9); - fitter3body.setMaxChi2(1e9); - fitter3body.setUseAbsDCA(d_UseAbsDCA); - - // Material correction in the DCA fitter - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - if (useMatCorrType == 1) { - LOGF(info, "TGeo correction requested, loading geometry"); - if (!o2::base::GeometryManager::isGeometryLoaded()) { - ccdb->get(geoPath); - } - matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo; - } - if (useMatCorrType == 2) { - LOGF(info, "LUT correction requested, loading LUT"); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); - matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - } - fitter.setMatCorrType(matCorr); - fitter3body.setMatCorrType(matCorr); - } - - 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; - fitter.setBz(d_bz); - fitter3body.setBz(d_bz); - 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 = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - o2::parameters::GRPMagField* grpmag = 0x0; - 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(); - // Set magnetic field value once known - fitter.setBz(d_bz); - fitter3body.setBz(d_bz); - - if (useMatCorrType == 2) { - // setMatLUT only after magfield has been initalized - // (setMatLUT has implicit and problematic init field call if not) - o2::base::Propagator::Instance()->setMatLUT(lut); - } - } - - //------------------------------------------------------------------ - // Check the info of good tracks - template - void CheckGoodTracks(TGoodTrackTable const& dGoodtracks, aod::McParticles const& /*particlesMC*/) - { - for (auto& goodtrackid : dGoodtracks) { - auto goodtrack = goodtrackid.template goodTrack_as(); - if (!goodtrack.has_mcParticle()) { - continue; - } - auto mcgoodtrack = goodtrack.template mcParticle_as(); - if (!mcgoodtrack.has_mothers()) { - continue; - } - bool flag_H3L = false; - for (auto& mothertrack : mcgoodtrack.template mothers_as()) { - if (is3bodyDecayedH3L(mothertrack)) { - flag_H3L = true; - } - } - if (flag_H3L && std::abs(mcgoodtrack.pdgCode()) == 2212) { - registry.fill(HIST("hDauTrackCounter"), 0.5); - } - if (flag_H3L && std::abs(mcgoodtrack.pdgCode()) == 211) { - registry.fill(HIST("hDauTrackCounter"), 1.5); - } - if (flag_H3L && std::abs(mcgoodtrack.pdgCode()) == 1000010020) { - registry.fill(HIST("hDauTrackCounter"), 2.5); - } - } - } - - o2::dataformats::VertexBase mMeanVertex{{0., 0., 0.}, {0.1 * 0.1, 0., 0.1 * 0.1, 0., 0., 6. * 6.}}; - //------------------------------------------------------------------ - // Virtual Lambda V0 finder - template - bool DecayV0Finder(TCollisionTable const& dCollision, TTrackTable const& dPtrack, TTrackTable const& dNtrack, float& rv0, bool isTrue3bodyV0 = false) - { - if (dPtrack.collisionId() != dNtrack.collisionId()) { - return false; - } - FillV0Counter(kV0All, isTrue3bodyV0); - if (!isTrue3bodyV0 && RejectBkgInMC) { - return false; - } - - auto Track0 = getTrackParCov(dPtrack); - auto Track1 = getTrackParCov(dNtrack); - int nCand = fitter.process(Track0, Track1); - if (nCand == 0) { - return false; - } - FillV0Counter(kV0hasSV, isTrue3bodyV0); - - // validate V0 radial position - // First check closeness to the beam-line as same as SVertexer - const auto& v0XYZ = fitter.getPCACandidate(); - float dxv0 = v0XYZ[0] - mMeanVertex.getX(), dyv0 = v0XYZ[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; - // float rv0 = std::sqrt(r2v0); - rv0 = std::sqrt(r2v0); - if (rv0 < minRToMeanVertex) { - return false; - } - FillV0Counter(kV0Radius, isTrue3bodyV0); - - // Not involved: Get minR with same way in SVertexer - // float drv0P = rv0 - Track0minR, drv0N = rv0 - Track1minR; - - // check: if the process function finish the propagation - if (!fitter.isPropagateTracksToVertexDone() && !fitter.propagateTracksToVertex()) { - return false; - } - - auto& trPProp = fitter.getTrack(0); - auto& trNProp = fitter.getTrack(1); - std::array pP, pN; - trPProp.getPxPyPzGlo(pP); - trNProp.getPxPyPzGlo(pN); - // estimate DCA of neutral V0 track to beamline: straight line with parametric equation - // x = X0 + pV0[0]*t, y = Y0 + pV0[1]*t reaches DCA to beamline (Xv, Yv) at - // t = -[ (x0-Xv)*pV0[0] + (y0-Yv)*pV0[1]) ] / ( pT(pV0)^2 ) - // Similar equation for 3D distance involving pV0[2] - std::array pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]}; - float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; - float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); - if (ptV0 < minPtV0) { // pt cut - return false; - } - FillV0Counter(kV0Pt, isTrue3bodyV0); - - if (pV0[2] / ptV0 > maxTglV0) { // tgLambda cut - return false; - } - FillV0Counter(kV0TgLamda, isTrue3bodyV0); - - // apply mass selections - float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); - float massMargin = 20 * (0.001 * (1. + 0.5 * ptV0)) + 0.07; - if (massV0LambdaHyp - o2::constants::physics::MassLambda > massMargin && massV0AntiLambdaHyp - o2::constants::physics::MassLambda > massMargin) { - return false; - } - FillV0Counter(kV0InvMass, isTrue3bodyV0); - - float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; - float cosPAXY = prodXYv0 / std::sqrt(r2v0 * pt2V0); - if (dca2 > maxDCAXY2ToMeanVertex3bodyV0) { - return false; - } - FillV0Counter(kV0DcaXY, isTrue3bodyV0); - - if (cosPAXY < minCosPAXYMeanVertex3bodyV0) { - return false; - } - float dx = v0XYZ[0] - dCollision.posX(), dy = v0XYZ[1] - dCollision.posY(), dz = v0XYZ[2] - dCollision.posZ(), prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; - float cosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); - if (cosPA < minCosPA3bodyV0) { - return false; - } - FillV0Counter(kV0CosPA, isTrue3bodyV0); - return true; - } - //------------------------------------------------------------------ - // 3body decay vertex finder - template - void Decay3bodyFinder(TCollisionTable const& dCollision, TTrackTable const& dPtrack, TTrackTable const& dNtrack, TTrackTable const& dBachtrack, float const& rv0, bool isTrue3bodyVtx = false) - { - if (dPtrack.collisionId() != dBachtrack.collisionId()) { - return; - } - if (dPtrack.globalIndex() == dBachtrack.globalIndex()) { - return; // skip the track used by V0 - } - FillVtxCounter(kVtxAll, isTrue3bodyVtx); - if (!isTrue3bodyVtx && RejectBkgInMC) { - return; - } - - auto track0 = getTrackParCov(dPtrack); - auto track1 = getTrackParCov(dNtrack); - auto bach = getTrackParCov(dBachtrack); - - if (bach.getPt() < minbachPt) { - return; - } - FillVtxCounter(kVtxbachPt, isTrue3bodyVtx); - - int n3bodyVtx = fitter3body.process(track0, track1, bach); - if (n3bodyVtx == 0) { // discard this pair - return; - } - FillVtxCounter(kVtxhasSV, isTrue3bodyVtx); - - const auto& vertexXYZ = fitter3body.getPCACandidatePos(); - // make sure the cascade radius is smaller than that of the vertex - float dxc = vertexXYZ[0] - dCollision.posX(), dyc = vertexXYZ[1] - dCollision.posY(), dzc = vertexXYZ[2] - dCollision.posZ(), r2vertex = dxc * dxc + dyc * dyc; - float rvertex = std::sqrt(r2vertex); - if (std::abs(rv0 - rvertex) > maxRDiff3bodyV0 || rvertex < minRToMeanVertex) { - return; - } - FillVtxCounter(kVtxRadius, isTrue3bodyVtx); - - // Not involved: bach.minR - rveretx check - - // check: if the process function finish the propagation - if (!fitter3body.isPropagateTracksToVertexDone() && !fitter3body.propagateTracksToVertex()) { - return; - } - - auto& tr0 = fitter3body.getTrack(0); - auto& tr1 = fitter3body.getTrack(1); - auto& tr2 = fitter3body.getTrack(2); - std::array p0, p1, p2; - tr0.getPxPyPzGlo(p0); - tr1.getPxPyPzGlo(p1); - tr2.getPxPyPzGlo(p2); - std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; - - float pt2 = p3B[0] * p3B[0] + p3B[1] * p3B[1], p2candidate = pt2 + p3B[2] * p3B[2]; - float pt = std::sqrt(pt2); - if (pt < minPt3Body) { // pt cut - return; - } - FillVtxCounter(kVtxPt, isTrue3bodyVtx); - - if (p3B[2] / pt > maxTgl3Body) { // tgLambda cut - return; - } - FillVtxCounter(kVtxTgLamda, isTrue3bodyVtx); - - float cosPA = (p3B[0] * dxc + p3B[1] * dyc + p3B[2] * dzc) / std::sqrt(p2candidate * (r2vertex + dzc * dzc)); - if (cosPA < minCosPA3body) { - return; - } - FillVtxCounter(kVtxCosPA, isTrue3bodyVtx); - - if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { - return; - } - FillVtxCounter(kVtxDcaDau, isTrue3bodyVtx); - - // Calculate DCA with respect to the collision associated to the V0, not individual tracks - std::array dcaInfo; - - auto Track0Par = getTrackPar(dPtrack); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track0dcaXY = dcaInfo[0]; - auto Track0dca = std::sqrt(Track0dcaXY * Track0dcaXY + dcaInfo[1] * dcaInfo[1]); - - auto Track1Par = getTrackPar(dNtrack); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track1dcaXY = dcaInfo[0]; - auto Track1dca = std::sqrt(Track1dcaXY * Track1dcaXY + dcaInfo[1] * dcaInfo[1]); - - auto Track2Par = getTrackPar(dBachtrack); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track2dcaXY = dcaInfo[0]; - auto Track2dca = std::sqrt(Track2dcaXY * Track2dcaXY + dcaInfo[1] * dcaInfo[1]); - - // H3L DCA Check - // auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, fitter3body.calcPCACovMatrixFlat(), t2.sign()); - auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, dBachtrack.sign()); - o2::dataformats::DCA dca; - if (d_UseH3LDCACut && (!track3B.propagateToDCA({{dCollision.posX(), dCollision.posY(), dCollision.posZ()}, {dCollision.covXX(), dCollision.covXY(), dCollision.covYY(), dCollision.covXZ(), dCollision.covYZ(), dCollision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || - std::abs(dca.getY()) > maxDCAXY3Body || std::abs(dca.getZ()) > maxDCAZ3Body)) { - return; - } - FillVtxCounter(kVtxDcaH3L, isTrue3bodyVtx); - - vtx3bodydata( - dPtrack.globalIndex(), dNtrack.globalIndex(), dBachtrack.globalIndex(), dCollision.globalIndex(), 0, - vertexXYZ[0], vertexXYZ[1], vertexXYZ[2], - p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], - fitter3body.getChi2AtPCACandidate(), - Track0dcaXY, Track1dcaXY, Track2dcaXY, - Track0dca, Track1dca, Track2dca, - 0); // To be fixed - } - //------------------------------------------------------------------ - // 3body decay finder for a collsion - template - void DecayFinder(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) - { - for (auto& t0id : dPtracks) { // FIXME: turn into combination(...) - auto t0 = t0id.template goodTrack_as(); - - for (auto& t1id : dNtracks) { - auto t1 = t1id.template goodTrack_as(); - float rv0; - if (!DecayV0Finder(dCollision, t0, t1, rv0)) { - continue; - } - - for (auto& t2id : dGoodtracks) { - auto t2 = t2id.template goodTrack_as(); - Decay3bodyFinder(dCollision, t0, t1, t2, rv0); - } - } - } - fillHistos(); - resetHistos(); - } - //------------------------------------------------------------------ - // MC 3body decay vertex finder - template - void DecayFinderMC(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) - { - for (auto& t0id : dPtracks) { // FIXME: turn into combination(...) - auto t0 = t0id.template goodTrack_as(); - for (auto& t1id : dNtracks) { - auto t1 = t1id.template goodTrack_as(); - if (t0.collisionId() != t1.collisionId()) { - continue; - } - - bool isTrue3bodyV0 = false; - if (t0.has_mcParticle() && t1.has_mcParticle()) { - auto t0mc = t0.template mcParticle_as(); - auto t1mc = t1.template mcParticle_as(); - if ((t0mc.pdgCode() == 2212 && t1mc.pdgCode() == -211) || (t0mc.pdgCode() == 211 && t1mc.pdgCode() == -2212)) { - if (t0mc.has_mothers() && t1mc.has_mothers()) { - for (auto& t0mother : t0mc.template mothers_as()) { - for (auto& t1mother : t1mc.template mothers_as()) { - if (t0mother.globalIndex() == t1mother.globalIndex() && std::abs(t0mother.pdgCode()) == 1010010030) { - isTrue3bodyV0 = true; - } - } - } - } - } - } - - float rv0; - if (!DecayV0Finder(dCollision, t0, t1, rv0, isTrue3bodyV0)) { - continue; - } - - for (auto& t2id : dGoodtracks) { - auto t2 = t2id.template goodTrack_as(); - - bool isTrue3bodyVtx = false; - if (t0.has_mcParticle() && t1.has_mcParticle() && t2.has_mcParticle()) { - auto t0mc = t0.template mcParticle_as(); - auto t1mc = t1.template mcParticle_as(); - auto t2mc = t2.template mcParticle_as(); - if ((t0mc.pdgCode() == 2212 && t1mc.pdgCode() == -211 && t2mc.pdgCode() == 1000010020) || (t0mc.pdgCode() == 211 && t1mc.pdgCode() == -2212 && t2mc.pdgCode() == -1000010020)) { - if (t0mc.has_mothers() && t1mc.has_mothers() && t2mc.has_mothers()) { - for (auto& t0mother : t0mc.template mothers_as()) { - for (auto& t1mother : t1mc.template mothers_as()) { - for (auto& t2mother : t2mc.template mothers_as()) { - if (t0mother.globalIndex() == t1mother.globalIndex() && t0mother.globalIndex() == t2mother.globalIndex() && std::abs(t0mother.pdgCode()) == 1010010030) { - isTrue3bodyVtx = true; - } - } - } - } - } - } - } - - Decay3bodyFinder(dCollision, t0, t1, t2, rv0, isTrue3bodyVtx); - } - } - } - fillHistos(); - resetHistos(); - } - //------------------------------------------------------------------ - // MC virtual lambda check - template - void VirtualLambdaCheck(TCollisionTable const& /*dCollision*/, TV0DataTable const& fullV0s, int bin) - { - for (auto& v0 : fullV0s) { - statisticsRegistry.virtLambdastats[bin]++; - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - if (postrack.has_mcParticle() && negtrack.has_mcParticle()) { - auto postrackmc = postrack.template mcParticle_as(); - auto negtrackmc = negtrack.template mcParticle_as(); - - if ((postrackmc.pdgCode() == 2212 && negtrackmc.pdgCode() == -211) || (postrackmc.pdgCode() == 211 && negtrackmc.pdgCode() == -2212)) { - if (postrackmc.has_mothers() && negtrackmc.has_mothers()) { - for (auto& posmother : postrackmc.template mothers_as()) { - for (auto& negmother : negtrackmc.template mothers_as()) { - if (posmother.globalIndex() == negmother.globalIndex()) { - if (posmother.pdgCode() == 1010010030) - statisticsRegistry.virtLambdastats[bin + 1]++; - else if (posmother.pdgCode() == -1010010030) - statisticsRegistry.virtLambdastats[bin + 2]++; - } - } - } - } - } - } - } - fillHistos(); - resetHistos(); - } - - //------------------------------------------------------------------ - // Process Function - void processData(aod::Collision const& collision, aod::V0GoodPosTracks const& ptracks, aod::V0GoodNegTracks const& ntracks, aod::V0GoodTracks const& goodtracks, FullTracksExtIU const&, aod::BCsWithTimestamps const&) - { - auto bc = collision.bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - - DecayFinder(collision, ptracks, ntracks, goodtracks); - } - PROCESS_SWITCH(hypertriton3bodyFinder, processData, "Produce StoredVtx3BodyDatas with data", true); - - void processCFFilteredData(aod::Collisions const& collisions, aod::CFFilters const& cffilters, aod::V0GoodPosTracks const& Ptracks, aod::V0GoodNegTracks const& Ntracks, aod::V0GoodTracks const& Goodtracks, FullTracksExtIU const&, aod::BCsWithTimestamps const&) - { - for (int i{0}; i < collisions.size(); i++) { - auto collision = collisions.iteratorAt(i); - auto cffilter = cffilters.iteratorAt(i); - auto bc = collision.bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - - auto ptracks = Ptracks.sliceBy(perCollisionGoodPosTracks, collision.globalIndex()); - auto ntracks = Ntracks.sliceBy(perCollisionGoodNegTracks, collision.globalIndex()); - auto goodtracks = Goodtracks.sliceBy(perCollisionGoodTracks, collision.globalIndex()); - - if (!cffilter.hasLD_LooseKstar() && UseCFFilter) { - continue; - } - registry.fill(HIST("hEventCounter"), 1.5); - - DecayFinder(collision, ptracks, ntracks, goodtracks); - } - } - PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredData, "Produce StoredVtx3BodyDatas with data using CFtriggers", false); - - void processMC(aod::Collision const& collision, aod::V0GoodPosTracks const& ptracks, aod::V0GoodNegTracks const& ntracks, aod::V0GoodTracks const& goodtracks, aod::McParticles const& particlesMC, MCLabeledTracksIU const&, aod::BCsWithTimestamps const&) - { - auto bc = collision.bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - - CheckGoodTracks(goodtracks, particlesMC); - DecayFinderMC(collision, ptracks, ntracks, goodtracks); - } - PROCESS_SWITCH(hypertriton3bodyFinder, processMC, "Produce StoredVtx3BodyDatas with MC", false); - - void processCFFilteredMC(aod::Collisions const& collisions, aod::CFFilters const& cffilters, aod::V0GoodPosTracks const& Ptracks, aod::V0GoodNegTracks const& Ntracks, aod::V0GoodTracks const& Goodtracks, aod::V0s const& V0s, aod::V0Datas const& fullV0s, aod::McParticles const& particlesMC, MCLabeledTracksIU const&, aod::BCsWithTimestamps const&) - { - for (int i{0}; i < collisions.size(); i++) { - auto collision = collisions.iteratorAt(i); - auto cffilter = cffilters.iteratorAt(i); - auto bc = collision.bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - - auto goodtracks = Goodtracks.sliceBy(perCollisionGoodTracks, collision.globalIndex()); - CheckGoodTracks(goodtracks, particlesMC); - auto v0s = V0s.sliceBy(perCollisionV0s, collision.globalIndex()); - auto fullv0s = fullV0s.sliceBy(perCollisionV0Datas, collision.globalIndex()); - VirtualLambdaCheck(collision, v0s, 0); - VirtualLambdaCheck(collision, fullv0s, 3); - - if (!cffilter.hasLD_LooseKstar() && UseCFFilter) { - continue; - } - registry.fill(HIST("hEventCounter"), 1.5); - - auto ptracks = Ptracks.sliceBy(perCollisionGoodPosTracks, collision.globalIndex()); - auto ntracks = Ntracks.sliceBy(perCollisionGoodNegTracks, collision.globalIndex()); - - VirtualLambdaCheck(collision, v0s, 6); - VirtualLambdaCheck(collision, fullv0s, 9); - DecayFinderMC(collision, ptracks, ntracks, goodtracks); - } - } - PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredMC, "Produce StoredVtx3BodyDatas with MC using CFtriggers", false); -}; - -struct hypertriton3bodyLabelBuilder { - - Produces vtxlabels; - - // for bookkeeping purposes: how many V0s come from same mother etc - HistogramRegistry registry{ - "registry", - { - {"hLabelCounter", "hLabelCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hHypertritonMCPt", "hHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hAntiHypertritonMCPt", "hAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hHypertritonMCMass", "hHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hAntiHypertritonMCMass", "hAntiHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hHypertritonMCLifetime", "hHypertritonMCLifetime", {HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}}}, - {"hAntiHypertritonMCLifetime", "hAntiHypertritonMCLifetime", {HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}}}, - }, - }; - - void init(InitContext const&) - { - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(2, "Same MotherParticle"); - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(3, "True H3L"); - } - - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - - void processDoNotBuildLabels(aod::Collisions::iterator const&) - { - // dummy process function - should not be required in the future - } - PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processDoNotBuildLabels, "Do not produce MC label tables", true); - - void processBuildLabels(aod::Vtx3BodyDatas const& vtx3bodydatas, MCLabeledTracksIU const&, aod::McParticles const& /*particlesMC*/) - { - std::vector lIndices; - lIndices.reserve(vtx3bodydatas.size()); - for (int ii = 0; ii < vtx3bodydatas.size(); ii++) { - lIndices[ii] = -1; - } - - for (auto& vtx3body : vtx3bodydatas) { - - int lLabel = -1; - int lPDG = -1; - float lPt = -1; - double MClifetime = -1; - bool is3bodyDecay = false; - int lGlobalIndex = -1; - - auto lTrack0 = vtx3body.track0_as(); - auto lTrack1 = vtx3body.track1_as(); - auto lTrack2 = vtx3body.track2_as(); - registry.fill(HIST("hLabelCounter"), 0.5); - - // Association check - // There might be smarter ways of doing this in the future - if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { - vtxlabels(-1); - continue; - } - auto lMCTrack0 = lTrack0.mcParticle_as(); - auto lMCTrack1 = lTrack1.mcParticle_as(); - auto lMCTrack2 = lTrack2.mcParticle_as(); - if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { - vtxlabels(-1); - continue; - } - - for (auto& lMother0 : lMCTrack0.mothers_as()) { - for (auto& lMother1 : lMCTrack1.mothers_as()) { - for (auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - lGlobalIndex = lMother1.globalIndex(); - lPt = lMother1.pt(); - lPDG = lMother1.pdgCode(); - MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); - is3bodyDecay = true; // vtxs with the same mother - } - } - } - } // end association check - if (!is3bodyDecay) { - vtxlabels(-1); - continue; - } - registry.fill(HIST("hLabelCounter"), 1.5); - - // Intended for cross-checks only - // N.B. no rapidity cut! - if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { - lLabel = lGlobalIndex; - double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hLabelCounter"), 2.5); - registry.fill(HIST("hHypertritonMCPt"), lPt); - registry.fill(HIST("hHypertritonMCLifetime"), MClifetime); - registry.fill(HIST("hHypertritonMCMass"), hypertritonMCMass); - } - if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { - lLabel = lGlobalIndex; - double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hLabelCounter"), 2.5); - registry.fill(HIST("hAntiHypertritonMCPt"), lPt); - registry.fill(HIST("hAntiHypertritonMCLifetime"), MClifetime); - registry.fill(HIST("hAntiHypertritonMCMass"), antiHypertritonMCMass); - } - - // Construct label table, only true hypertriton and true daughters with a specified order is labeled - // for matter: track0->p, track1->pi, track2->d - // for antimatter: track0->pi, track1->p, track2->d - vtxlabels(lLabel); - } - } - PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processBuildLabels, "Produce MC label tables", false); -}; - -struct hypertriton3bodyComparewithDecay3body { - - HistogramRegistry registry{ - "registry", - { - {"hMCInfoCounter", "hMCInfoCounter", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, - {"hCheckCounter", "hCheckCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - {"hHypertritonMCPtTotal", "hHypertritonMCPtTotal", {HistType::kTH1F, {{20, 0.0f, 10.0f}}}}, - {"hHypertritonMCPt", "hHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hAntiHypertritonMCPt", "hAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hHypertritonMCMass", "hHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f}}}}, - {"hAntiHypertritonMCMass", "hAntiHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f}}}}, - {"hPairedHypertritonMCPt", "hPairedHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hPairedAntiHypertritonMCPt", "hPairedAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hSameMcIndexCounter", "hSameMcIndexCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - }, - }; - - void init(InitContext const&) - { - registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(2, "Sig in Decay3body"); - registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(3, "Sig SameCol"); - registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(4, "Sig contained by finder"); - registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(5, "Sig SameIndex"); - } - struct Indexdaughters { // check duplicated paired daughters - int64_t index0; - int64_t index1; - int64_t index2; - bool operator==(const Indexdaughters& t) const - { - return (this->index0 == t.index0 && this->index1 == t.index1 && this->index2 == t.index2); - } - }; - - void processDoNotCompare(aod::Collisions::iterator const&) - { - // dummy process function - should not be required in the future - } - PROCESS_SWITCH(hypertriton3bodyComparewithDecay3body, processDoNotCompare, "Do not do comparison", true); - - void processDoComparison(aod::Decay3Bodys const& decay3bodytable, soa::Join const& vtx3bodydatas, MCLabeledTracksIU const&, aod::McParticles const& /*particlesMC*/) - { - std::vector set_pair; - for (auto d3body : decay3bodytable) { - registry.fill(HIST("hCheckCounter"), 0.5); - registry.fill(HIST("hMCInfoCounter"), 0.5); - auto lTrack0 = d3body.track0_as(); - auto lTrack1 = d3body.track1_as(); - auto lTrack2 = d3body.track2_as(); - if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { - continue; - } - registry.fill(HIST("hMCInfoCounter"), 1.5); - auto lMCTrack0 = lTrack0.mcParticle_as(); - auto lMCTrack1 = lTrack1.mcParticle_as(); - auto lMCTrack2 = lTrack2.mcParticle_as(); - if (lMCTrack0.isPhysicalPrimary() || lMCTrack1.isPhysicalPrimary() || lMCTrack2.isPhysicalPrimary()) { - continue; - } - if (lMCTrack0.producedByGenerator() || lMCTrack1.producedByGenerator() || lMCTrack2.producedByGenerator()) { - continue; - } - registry.fill(HIST("hMCInfoCounter"), 2.5); - - if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { - continue; - } - registry.fill(HIST("hMCInfoCounter"), 3.5); - - int lPDG = -1; - float lPt = -1; - bool is3bodyDecayedH3L = false; - int lGlobalIndex = -1; - - for (auto& lMother0 : lMCTrack0.mothers_as()) { - for (auto& lMother1 : lMCTrack1.mothers_as()) { - for (auto& lMother2 : lMCTrack2.mothers_as()) { - registry.fill(HIST("hMCInfoCounter"), 4.5); - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { // vtxs with the same mother - registry.fill(HIST("hMCInfoCounter"), 7.5); - lGlobalIndex = lMother1.globalIndex(); - lPDG = lMother1.pdgCode(); - lPt = lMother1.pt(); - if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { - is3bodyDecayedH3L = true; - double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hHypertritonMCPt"), lPt); - registry.fill(HIST("hHypertritonMCMass"), hypertritonMCMass); - } - if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { - is3bodyDecayedH3L = true; - double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hAntiHypertritonMCPt"), lPt); - registry.fill(HIST("hAntiHypertritonMCMass"), antiHypertritonMCMass); - } - } - } - } - } // end association check - - if (!is3bodyDecayedH3L) { - continue; - } - - registry.fill(HIST("hCheckCounter"), 1.5); - registry.fill(HIST("hMCInfoCounter"), 5.5); - // for check - registry.fill(HIST("hHypertritonMCPtTotal"), lPt); - - Indexdaughters temp = {lMCTrack0.globalIndex(), lMCTrack1.globalIndex(), lMCTrack2.globalIndex()}; - auto p = std::find(set_pair.begin(), set_pair.end(), temp); - if (p == set_pair.end()) { - set_pair.push_back(temp); - registry.fill(HIST("hMCInfoCounter"), 6.5); - } - - if (lTrack0.collisionId() != lTrack1.collisionId() || lTrack0.collisionId() != lTrack2.collisionId()) { - continue; - } - registry.fill(HIST("hCheckCounter"), 2.5); - - for (auto vtx : vtx3bodydatas) { - if (vtx.mcParticleId() == -1) { - continue; - } - auto mcparticle = vtx.mcParticle_as(); - if (mcparticle.globalIndex() == lGlobalIndex) { - registry.fill(HIST("hCheckCounter"), 4.5); // rare case check: if motherId matches but daughters not - if (lTrack0.globalIndex() == vtx.track0Id() && lTrack1.globalIndex() == vtx.track1Id() && lTrack2.globalIndex() == vtx.track2Id()) { - registry.fill(HIST("hCheckCounter"), 3.5); - if (lPDG > 0) { - registry.fill(HIST("hPairedHypertritonMCPt"), lPt); - } else { - registry.fill(HIST("hPairedAntiHypertritonMCPt"), lPt); - } - break; - } - } - } - } - } - PROCESS_SWITCH(hypertriton3bodyComparewithDecay3body, processDoComparison, "Compare decay3bodys and finder method with MC", false); -}; - -struct hypertriton3bodyInitializer { - Spawns vtx3bodydatas; - void init(InitContext const&) {} -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - }; -} diff --git a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx index f8d3d04856a..4f52fdd8066 100644 --- a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx +++ b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx @@ -35,6 +35,7 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/RecoDecay.h" #include "TableHelper.h" #include "Tools/KFparticle/KFUtilities.h" @@ -78,7 +79,6 @@ struct reduced3bodyCreator { Produces reducedDecay3Bodys; Produces reduced3BodyInfo; Produces reducedFullTracksPIDIU; - Produces dcaFitterSVInfo; Service ccdb; Zorro zorro; @@ -88,7 +88,6 @@ struct reduced3bodyCreator { o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; Configurable event_posZ_selection{"event_posZ_selection", true, "event selection count post poZ cut"}; // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -114,6 +113,9 @@ struct reduced3bodyCreator { float d_bz; o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + // tracked cluster size + std::vector fTrackedClSizeVector; + HistogramRegistry registry{"registry", {}}; void init(InitContext&) @@ -282,7 +284,7 @@ struct reduced3bodyCreator { //------------------------------------------------------------------ // function to fit KFParticle 3body vertex template - void fit3bodyVertex(TKFParticle& kfpProton, TKFParticle& kfpPion, TKFParticle& kfpDeuteron, TKFParticle& KFHt) + bool fit3bodyVertex(TKFParticle& kfpProton, TKFParticle& kfpPion, TKFParticle& kfpDeuteron, TKFParticle& KFHt) { // Construct 3body vertex int nDaughters3body = 3; @@ -292,12 +294,13 @@ struct reduced3bodyCreator { KFHt.Construct(Daughters3body, nDaughters3body); } catch (std::runtime_error& e) { LOG(debug) << "Failed to create Hyper triton 3-body vertex." << e.what(); - return; + return false; } LOG(debug) << "Hypertriton vertex constructed."; + return true; } - void process(ColwithEvTimesMultsCents const& collisions, TrackExtPIDIUwithEvTimes const&, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + void process(ColwithEvTimesMultsCents const& collisions, TrackExtPIDIUwithEvTimes const&, aod::Decay3Bodys const& decay3bodys, aod::Tracked3Bodys const& tracked3bodys, aod::BCsWithTimestamps const&) { std::vector triggeredCollisions(collisions.size(), false); @@ -340,7 +343,14 @@ struct reduced3bodyCreator { int lastCollisionID = -1; // collisionId of last analysed decay3body. Table is sorted. - // Creat reduced table + // get tracked cluster size info + fTrackedClSizeVector.clear(); + fTrackedClSizeVector.resize(decay3bodys.size(), 0); + for (const auto& tvtx3body : tracked3bodys) { + fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize(); + } + + // Create reduced table for (const auto& d3body : decay3bodys) { auto collision = d3body.template collision_as(); @@ -398,7 +408,7 @@ struct reduced3bodyCreator { const auto trackStartIndex = reducedFullTracksPIDIU.lastIndex(); reducedDecay3Bodys(collisionIndex, trackStartIndex - 2, trackStartIndex - 1, trackStartIndex); - // -------- save reduced decay3body info table -------- + // -------- get decay3body info with KF -------- // get trackParCov daughters auto trackParCovPos = getTrackParCov(daughter0); auto trackParCovNeg = getTrackParCov(daughter1); @@ -413,23 +423,29 @@ struct reduced3bodyCreator { kfpPion = createKFParticleFromTrackParCov(trackParCovPos, daughter0.sign(), constants::physics::MassPionCharged); } kfpDeuteron = createKFParticleFromTrackParCov(trackParCovBach, daughter2.sign(), constants::physics::MassDeuteron); - // fit 3body vertex + // fit 3body vertex and caclulate radius, phi, z position + float radius, phi, posZ; KFParticle KFHt; - fit3bodyVertex(kfpProton, kfpPion, kfpDeuteron, KFHt); - // calculate radius and phi - auto radius = std::sqrt(KFHt.GetX() * KFHt.GetX() + KFHt.GetY() * KFHt.GetY()); - float phi, sigma; - KFHt.GetPhi(phi, sigma); - // fill 3body info table - reduced3BodyInfo(radius, phi, KFHt.GetZ()); - - // -------- save dcaFitter secondary vertex info table -------- + if (fit3bodyVertex(kfpProton, kfpPion, kfpDeuteron, KFHt)) { + radius = std::hypot(KFHt.GetX(), KFHt.GetY()); + phi = std::atan2(KFHt.GetPx(), KFHt.GetPy()); + posZ = KFHt.GetZ(); + } else { + radius = -999.; + phi = -999.; + posZ = -999.; + } + + // -------- get decay3body info with DCA fitter -------- auto Track0 = getTrackParCov(daughter0); auto Track1 = getTrackParCov(daughter1); auto Track2 = getTrackParCov(daughter2); int n3bodyVtx = fitter3body.process(Track0, Track1, Track2); + float phiVtx, rVtx, zVtx; if (n3bodyVtx == 0) { // discard this pair - dcaFitterSVInfo(-999, -999, -999); + phiVtx = -999.; + rVtx = -999.; + zVtx = -999.; } else { const auto& vtxXYZ = fitter3body.getPCACandidate(); @@ -441,10 +457,13 @@ struct reduced3bodyCreator { propagatedTrack1.getPxPyPzGlo(p1); propagatedTrack2.getPxPyPzGlo(p2); std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; - float phiVtx = std::atan2(p3B[1], p3B[0]); - float rVtx = std::hypot(vtxXYZ[0], vtxXYZ[1]); - dcaFitterSVInfo(rVtx, phiVtx, vtxXYZ[2]); + phiVtx = std::atan2(p3B[1], p3B[0]); + rVtx = std::hypot(vtxXYZ[0], vtxXYZ[1]); + zVtx = vtxXYZ[2]; } + + // fill 3body info table (KF and DCA fitter info) + reduced3BodyInfo(radius, phi, posZ, rVtx, phiVtx, zVtx, fTrackedClSizeVector[d3body.globalIndex()]); } // end decay3body loop registry.fill(HIST("hEventCounter"), 3.5, reducedCollisions.lastIndex() + 1); diff --git a/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx deleted file mode 100644 index 1fed55805c2..00000000000 --- a/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx +++ /dev/null @@ -1,488 +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 Analysis task for KFVtx3BodyDatas (3body candidates reconstructed with KF) -/// \author Carolina Reetz --> partly copied from threebodyRecoTask.cxx -// ======================== - -#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/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/Vtx3BodyTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/PhysicsConstants.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -using MCLabeledTracksIU = soa::Join; - -struct threebodyKFTask { - - Produces outputMCTable; - std::vector filledMothers; - std::vector isGoodCollision; - - // Configurables - Configurable bachelorPdgCode{"bachelorPdgCode", 1000010020, "pdgCode of bachelor daughter"}; - Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother"}; - - ConfigurableAxis m2PrPiBins{"m2PrPiBins", {60, 1., 3.3}, "Binning for m2(p,pi) axis"}; - ConfigurableAxis m2PiDeBins{"m2PiDeBins", {120, 4.0, 8.0}, "Binning for m2(pi,d) axis"}; - - // collision filter and preslice - Filter collisionFilter = (aod::evsel::sel8 == true && nabs(aod::collision::posZ) < 10.f); - Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - - void init(InitContext const&) - { - const AxisSpec axisM2PrPi{m2PrPiBins, "#it{m}^{2}(p,#pi^{-}) ((GeV/#it{c}^{2})^{2})"}; - const AxisSpec axisM2PiDe{m2PiDeBins, "#it{m}^{2}(#pi^{+},#bar{d}) ((GeV/#it{c}^{2})^{2})"}; - - registry.add("hCentFT0C", "hCentFT0C", HistType::kTH1F, {{100, 0.0f, 100.0f, "FT0C Centrality"}}); - - // mass spectrum of reco candidates - registry.add("hMassHypertriton", "Mass hypertriton", HistType::kTH1F, {{80, 2.96f, 3.04f, "#it{m}(p,#pi^{-},d) (GeV/#it{c}^{2})"}}); - registry.add("hMassAntiHypertriton", "Mass anti-hypertriton", HistType::kTH1F, {{80, 2.96f, 3.04f, "#it{m}(#bar{p},#pi^{+},#bar{d}) (GeV/#it{c}^{2})"}}); - // Dalitz diagrams of reco candidates - registry.add("hDalitzHypertriton", "Dalitz diagram", HistType::kTH2F, {axisM2PrPi, axisM2PiDe})->GetYaxis()->SetTitle("#it{m}^{2}(#pi^{-},d) ((GeV/#it{c}^{2})^{2})"); - registry.add("hDalitzAntiHypertriton", "Dalitz diagram", HistType::kTH2F, {axisM2PrPi, axisM2PiDe})->GetXaxis()->SetTitle("#it{m}^{2}(#bar{p},#pi^{+}) ((GeV/#it{c}^{2})^{2})"); - - // bachelor histgrams - registry.add("hAverageITSClusterSizeBachelor", "Average ITS cluster size bachelor track", HistType::kTH1F, {{15, 0.5, 15.5, "#langle ITS cluster size #rangle"}}); - registry.add("hdEdxBachelor", "TPC dE/dx bachelor track", HistType::kTH1F, {{200, 0.0f, 200.0f, "Average ITS cluster size"}}); - registry.add("hPIDTrackingBachelor", "Tracking PID bachelor track", HistType::kTH1F, {{20, 0.5, 20.5, "Tracking PID identifier"}}); - - // for gen information of reco candidates - auto LabelHist = registry.add("hLabelCounter", "Reco MC candidate counter", HistType::kTH1F, {{3, 0.0f, 3.0f}}); - LabelHist->GetXaxis()->SetBinLabel(1, "Total"); - LabelHist->GetXaxis()->SetBinLabel(2, "Have Same MotherTrack"); - LabelHist->GetXaxis()->SetBinLabel(3, "True H3L/Anti-H3L"); - registry.add("hTrueHypertritonMCPt", "pT gen. of reco. H3L", HistType::kTH1F, {{100, -10.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}}); - registry.add("hTrueHypertritonMCMass", "mass gen. of reco. H3L", HistType::kTH1F, {{40, 2.96f, 3.04f, "#it{m}(p,#pi^{-},d) (GeV/#it{c}^{2})"}}); - registry.add("hTrueHypMassWithMuReco", "mass gen. of reco. H3L", HistType::kTH1F, {{40, 2.96f, 3.04f, "#it{m}(p,#pi^{-},d) (GeV/#it{c}^{2})"}}); - registry.add("hTrueHypertritonMCCTau", "#it{c}#tau gen. of reco. H3L", HistType::kTH1F, {{50, 0.0f, 50.0f, "#it{c}#tau(cm)"}}); - registry.add("hTrueHypertritonMCMassPrPi", "inv. mass gen. of reco. V0 pair (H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(p,#pi^{-}) (GeV/#it{c}^{2})"}}); - - // for gen information of non reco candidates - registry.add("hTrueHypertritonMCMassPrPi_nonReco", "inv. mass gen. of non-reco. V0 pair (H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(p,#pi^{-}) (GeV/#it{c}^{2})"}}); - registry.add("hTrueHypertritonMCPtPion_nonReco", "Pion #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(#pi) (GeV/#it{c})"}}); - registry.add("hTrueHypertritonMCPtProton_nonReco", "Proton #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(p) (GeV/#it{c})"}}); - } - - // helper function to check if a mother track is a true H3L/Anti-H3L - template - int checkH3LTruth(MCTrack3B const& mcParticlePr, MCTrack3B const& mcParticlePi, MCTrack3B const& mcParticleDe, bool& isMuonReco) - { - if (abs(mcParticlePr.pdgCode()) != 2212 || abs(mcParticleDe.pdgCode()) != 1000010020) { - return -1; - } - // check proton and deuteron mother - int prDeMomID = -1; - for (const auto& motherPr : mcParticlePr.template mothers_as()) { - for (const auto& motherDe : mcParticleDe.template mothers_as()) { - if (motherPr.globalIndex() == motherDe.globalIndex() && std::abs(motherPr.pdgCode()) == 1010010030) { - prDeMomID = motherPr.globalIndex(); - break; - } - } - } - if (prDeMomID == -1) { - return -1; - } - if (std::abs(mcParticlePi.pdgCode()) != 211 && std::abs(mcParticlePi.pdgCode()) != 13) { - return -1; - } - // check if the pion track is a muon coming from a pi -> mu + vu decay, if yes, take the mother pi - auto mcParticlePiTmp = mcParticlePi; - if (std::abs(mcParticlePiTmp.pdgCode()) == 13) { - for (const auto& motherPi : mcParticlePiTmp.template mothers_as()) { - if (std::abs(motherPi.pdgCode()) == 211) { - mcParticlePiTmp = motherPi; - isMuonReco = true; - break; - } - } - } - // now loop over the pion mother - for (const auto& motherPi : mcParticlePiTmp.template mothers_as()) { - if (motherPi.globalIndex() == prDeMomID) { - return motherPi.globalIndex(); - } - } - return -1; - } - - template - void fillQAPlots(TCand const& vtx3body) - { - // Mass plot - if (vtx3body.track2sign() > 0) { // hypertriton - registry.fill(HIST("hMassHypertriton"), vtx3body.mass()); - } else if (vtx3body.track2sign() < 0) { // anti-hypertriton - registry.fill(HIST("hMassAntiHypertriton"), vtx3body.mass()); - } - - // Dalitz plot - auto m2prpi = RecoDecay::m2(array{array{vtx3body.pxtrack0(), vtx3body.pytrack0(), vtx3body.pztrack0()}, array{vtx3body.pxtrack1(), vtx3body.pytrack1(), vtx3body.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - auto m2pide = RecoDecay::m2(array{array{vtx3body.pxtrack1(), vtx3body.pytrack1(), vtx3body.pztrack1()}, array{vtx3body.pxtrack2(), vtx3body.pytrack2(), vtx3body.pztrack2()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - if (std::abs(vtx3body.mass() - o2::constants::physics::MassHyperTriton) <= 0.005) { - if (vtx3body.track2sign() > 0) { // hypertriton - registry.fill(HIST("hDalitzHypertriton"), m2prpi, m2pide); - } else if (vtx3body.track2sign() < 0) { // anti-hypertriton - registry.fill(HIST("hDalitzAntiHypertriton"), m2prpi, m2pide); - } - } - - // ITS cluster sizes - registry.fill(HIST("hAverageITSClusterSizeBachelor"), vtx3body.itsclussizedeuteron()); - registry.fill(HIST("hdEdxBachelor"), vtx3body.tpcdedxdeuteron()); - registry.fill(HIST("hPIDTrackingBachelor"), vtx3body.pidtrackingdeuteron()); - } - - //------------------------------------------------------------------ - // process real data analysis - void processData(soa::Filtered>::iterator const& collision, - aod::KFVtx3BodyDatas const& vtx3bodydatas) - { - registry.fill(HIST("hCentFT0C"), collision.centFT0C()); - - for (auto& vtx3bodydata : vtx3bodydatas) { - // QA histograms - fillQAPlots(vtx3bodydata); - } - } - PROCESS_SWITCH(threebodyKFTask, processData, "Data analysis", true); - - //------------------------------------------------------------------ - // process mc analysis - void processMC(soa::Join const& collisions, - aod::KFVtx3BodyDatas const& vtx3bodydatas, - aod::McParticles const& particlesMC, - MCLabeledTracksIU const&, - aod::McCollisions const& mcCollisions) - { - filledMothers.clear(); - isGoodCollision.resize(mcCollisions.size(), false); - - // loop over collisions - for (const auto& collision : collisions) { - // event selection - if (!collision.sel8() || std::abs(collision.posZ()) > 10.f) { - continue; - } - // reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision - if (collision.mcCollisionId() >= 0) { - isGoodCollision[collision.mcCollisionId()] = true; - } - - // fill MC table with reco MC candidate information and gen information if matched to MC particle - auto Decay3BodyTable_thisCollision = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - for (auto& vtx3bodydata : Decay3BodyTable_thisCollision) { - registry.fill(HIST("hLabelCounter"), 0.5); - - // fill QA histograms for all reco candidates - fillQAPlots(vtx3bodydata); - - auto track0 = vtx3bodydata.track0_as(); - auto track1 = vtx3bodydata.track1_as(); - auto track2 = vtx3bodydata.track2_as(); - - if (!track0.has_mcParticle() || !track1.has_mcParticle() || !track2.has_mcParticle()) { - continue; - } - - auto mcTrack0 = track0.mcParticle_as(); - auto mcTrack1 = track1.mcParticle_as(); - auto mcTrack2 = track2.mcParticle_as(); - - float genPosPt = mcTrack0.pt(); - float genPosP = mcTrack0.p(); - int daughter0PDGcode = mcTrack0.pdgCode(); - float genNegPt = mcTrack1.pt(); - float genNegP = mcTrack1.p(); - int daughter1PDGcode = mcTrack1.pdgCode(); - float genBachPt = mcTrack2.pt(); - float genBachP = mcTrack2.p(); - int daughter2PDGcode = mcTrack2.pdgCode(); - bool isBachPrimary = mcTrack2.isPhysicalPrimary(); - - double MClifetime = -1.; - bool isTrueH3L = false; - bool isTrueAntiH3L = false; - float genPhi = -1.; - float genEta = -1.; - float genRap = -1.; - float genP = -1.; - float genPt = -1.; - std::array genDecVtx{-1.f}; - bool isMuonReco = false; - auto& mcTrackPr = vtx3bodydata.sign() > 0 ? mcTrack0 : mcTrack1; - auto& mcTrackPi = vtx3bodydata.sign() > 0 ? mcTrack1 : mcTrack0; - auto& mcTrackDe = mcTrack2; - int motherID = checkH3LTruth(mcTrackPr, mcTrackPi, mcTrackDe, isMuonReco); - if (motherID > 0) { - auto mcTrackHyp = particlesMC.rawIteratorAt(motherID); - genPhi = mcTrackHyp.phi(); - genEta = mcTrackHyp.eta(); - genPt = mcTrackHyp.pt(); - int chargeFactor = mcTrackHyp.pdgCode() > 0 ? 1 : -1; - isTrueH3L = chargeFactor > 0; - isTrueAntiH3L = chargeFactor < 0; - MClifetime = RecoDecay::sqrtSumOfSquares(mcTrackPr.vx() - mcTrackHyp.vx(), mcTrackPr.vy() - mcTrackHyp.vy(), mcTrackPr.vz() - mcTrackHyp.vz()) * o2::constants::physics::MassHyperTriton / mcTrackHyp.p(); - double MCMass = RecoDecay::m(array{array{mcTrackPr.px(), mcTrackPr.py(), mcTrackPr.pz()}, array{mcTrackPi.px(), mcTrackPi.py(), mcTrackPi.pz()}, array{mcTrackDe.px(), mcTrackDe.py(), mcTrackDe.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - float MCmassPrPi = RecoDecay::m(array{array{mcTrackPr.px(), mcTrackPr.py(), mcTrackPr.pz()}, array{mcTrackPi.px(), mcTrackPi.py(), mcTrackPi.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - registry.fill(HIST("hLabelCounter"), 2.5); - registry.fill(HIST("hTrueHypertritonMCPt"), mcTrackHyp.pt() * chargeFactor); - registry.fill(HIST("hTrueHypertritonMCCTau"), MClifetime); - registry.fill(HIST("hTrueHypertritonMCMass"), MCMass); - registry.fill(HIST("hTrueHypertritonMCMassPrPi"), MCmassPrPi); - if (isMuonReco) { - registry.fill(HIST("hTrueHypMassWithMuReco"), MCMass); - } - filledMothers.push_back(mcTrackHyp.globalIndex()); - } - outputMCTable( // filled for each reconstructed candidate (in KFVtx3BodyDatas) - vtx3bodydata.mass(), - vtx3bodydata.x(), vtx3bodydata.y(), vtx3bodydata.z(), - vtx3bodydata.xerr(), vtx3bodydata.yerr(), vtx3bodydata.zerr(), - vtx3bodydata.px(), vtx3bodydata.py(), vtx3bodydata.pz(), vtx3bodydata.pt(), - vtx3bodydata.pxerr(), vtx3bodydata.pyerr(), vtx3bodydata.pzerr(), vtx3bodydata.pterr(), - vtx3bodydata.sign(), - vtx3bodydata.dcavtxtopvkf(), vtx3bodydata.dcaxyvtxtopvkf(), - vtx3bodydata.vtxcospakf(), vtx3bodydata.vtxcosxypakf(), - vtx3bodydata.vtxcospakftopo(), vtx3bodydata.vtxcosxypakftopo(), - vtx3bodydata.decaylkf(), vtx3bodydata.decaylxykf(), vtx3bodydata.decayldeltal(), - vtx3bodydata.chi2geondf(), vtx3bodydata.chi2topondf(), - vtx3bodydata.ctaukftopo(), - vtx3bodydata.trackedclsize(), - vtx3bodydata.massv0(), vtx3bodydata.chi2massv0(), - vtx3bodydata.cospav0(), - vtx3bodydata.pxtrack0(), vtx3bodydata.pytrack0(), vtx3bodydata.pztrack0(), // proton - vtx3bodydata.pxtrack1(), vtx3bodydata.pytrack1(), vtx3bodydata.pztrack1(), // pion - vtx3bodydata.pxtrack2(), vtx3bodydata.pytrack2(), vtx3bodydata.pztrack2(), // deuteron - vtx3bodydata.tpcinnerparamtrack0(), vtx3bodydata.tpcinnerparamtrack1(), vtx3bodydata.tpcinnerparamtrack2(), // proton, pion, deuteron - vtx3bodydata.tpcncltrack0(), vtx3bodydata.tpcncltrack1(), vtx3bodydata.tpcncltrack1(), // proton, pion, deuteron - vtx3bodydata.tpcchi2ncldeuteron(), - vtx3bodydata.deltaphideuteron(), vtx3bodydata.deltaphiproton(), - vtx3bodydata.dcatrack0topvkf(), vtx3bodydata.dcatrack1topvkf(), vtx3bodydata.dcatrack2topvkf(), // proton, pion, deuteron - vtx3bodydata.dcaxytrack0topvkf(), vtx3bodydata.dcaxytrack1topvkf(), vtx3bodydata.dcaxytrack2topvkf(), // proton, pion, deuteron - vtx3bodydata.dcaxytrack0tosvkf(), vtx3bodydata.dcaxytrack1tosvkf(), vtx3bodydata.dcaxytrack2tosvkf(), // proton, pion, deuteron - vtx3bodydata.dcatrack0totrack1kf(), vtx3bodydata.dcatrack0totrack2kf(), vtx3bodydata.dcatrack1totrack2kf(), - vtx3bodydata.dcavtxdaughterskf(), - vtx3bodydata.dcaxytrackpostopv(), vtx3bodydata.dcaxytracknegtopv(), vtx3bodydata.dcaxytrackbachtopv(), - vtx3bodydata.dcatrackpostopv(), vtx3bodydata.dcatracknegtopv(), vtx3bodydata.dcatrackbachtopv(), - vtx3bodydata.track0sign(), vtx3bodydata.track1sign(), vtx3bodydata.track2sign(), // proton, pion, deuteron - vtx3bodydata.tpcnsigmaproton(), vtx3bodydata.tpcnsigmapion(), vtx3bodydata.tpcnsigmadeuteron(), vtx3bodydata.tpcnsigmapionbach(), - vtx3bodydata.tpcdedxproton(), vtx3bodydata.tpcdedxpion(), vtx3bodydata.tpcdedxdeuteron(), - vtx3bodydata.tofnsigmadeuteron(), - vtx3bodydata.itsclussizedeuteron(), - vtx3bodydata.pidtrackingdeuteron(), - // MC info (-1 if not matched to MC particle) - genP, - genPt, - genDecVtx[0], genDecVtx[1], genDecVtx[2], - MClifetime, - genPhi, - genEta, - genRap, - genPosP, genPosPt, genNegP, genNegPt, genBachP, genBachPt, - isTrueH3L, isTrueAntiH3L, - daughter0PDGcode, daughter1PDGcode, daughter2PDGcode, isBachPrimary, - true, // is reconstructed - true); // reco event passed event selection - } // end vtx3bodydatas loop - } // end collision loop - - // generated MC particle analysis - // fill MC table with gen information for all generated but not reconstructed particles - for (auto& mcparticle : particlesMC) { - - double genMCmassPrPi = -1.; - bool isTrueGenH3L = false; - bool isTrueGenAntiH3L = false; - float genPBach = -1.; - float genPtBach = -1.; - float genPPos = -1.; - float genPtPos = -1.; - float genPNeg = -1.; - float genPtNeg = -1.; - int posDauPdgCode = -1; - int negDauPdgCode = -1; - int bachDauPdgCode = -1; - - // check if mcparticle was reconstructed and already filled in the table - if (std::find(filledMothers.begin(), filledMothers.end(), mcparticle.globalIndex()) != std::end(filledMothers)) { - continue; - } - - // set flag if corresponding reco collision survived event selection - bool survEvSel = isGoodCollision[mcparticle.mcCollisionId()]; - - // check if MC particle is hypertriton with 3-body decay - if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { - continue; - } - bool haveProton = false, havePion = false, haveBachelor = false; - bool haveAntiProton = false, haveAntiPion = false, haveAntiBachelor = false; - for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == 2212) - haveProton = true; - if (mcparticleDaughter.pdgCode() == -2212) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == 211) - havePion = true; - if (mcparticleDaughter.pdgCode() == -211) - haveAntiPion = true; - if (mcparticleDaughter.pdgCode() == bachelorPdgCode) - haveBachelor = true; - if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) - haveAntiBachelor = true; - } - - // check if particle or anti-particle - if (haveProton && haveAntiPion && haveBachelor && mcparticle.pdgCode() > 0) { - isTrueGenH3L = true; - // get proton and pion daughter - std::array protonMom{0.f}; - std::array piMinusMom{0.f}; - for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == 2212) { - protonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; - genPPos = mcparticleDaughter.p(); - genPtPos = mcparticleDaughter.pt(); - posDauPdgCode = mcparticleDaughter.pdgCode(); - } else if (mcparticleDaughter.pdgCode() == -211) { - piMinusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; - genPNeg = mcparticleDaughter.p(); - genPtNeg = mcparticleDaughter.pt(); - negDauPdgCode = mcparticleDaughter.pdgCode(); - } - } - genMCmassPrPi = RecoDecay::m(array{protonMom, piMinusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - registry.fill(HIST("hTrueHypertritonMCMassPrPi_nonReco"), genMCmassPrPi); - registry.fill(HIST("hTrueHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(protonMom[0], protonMom[1])); - registry.fill(HIST("hTrueHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piMinusMom[0], piMinusMom[1])); - } else if (haveAntiProton && havePion && haveAntiBachelor && mcparticle.pdgCode() < 0) { - isTrueGenAntiH3L = true; - // get anti-proton and pion daughter - std::array antiProtonMom{0.f}; - std::array piPlusMom{0.f}; - for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == -2212) { - antiProtonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; - genPNeg = mcparticleDaughter.p(); - genPtNeg = mcparticleDaughter.pt(); - negDauPdgCode = mcparticleDaughter.pdgCode(); - } else if (mcparticleDaughter.pdgCode() == 211) { - piPlusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; - genPPos = mcparticleDaughter.p(); - genPtPos = mcparticleDaughter.pt(); - posDauPdgCode = mcparticleDaughter.pdgCode(); - } - } - genMCmassPrPi = RecoDecay::m(array{antiProtonMom, piPlusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - registry.fill(HIST("hTrueHypertritonMCMassPrPi_nonReco"), genMCmassPrPi); - registry.fill(HIST("hTrueHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(antiProtonMom[0], antiProtonMom[1])); - registry.fill(HIST("hTrueHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piPlusMom[0], piPlusMom[1])); - } else { - continue; // stop if particle is no true H3L or Anti-H3L - } - - // get gen decay vertex and calculate ctau - std::array genDecayVtx{0.f}; - for (auto& mcDaughter : mcparticle.daughters_as()) { - if (std::abs(mcDaughter.pdgCode()) == bachelorPdgCode) { - genDecayVtx = {mcDaughter.vx(), mcDaughter.vy(), mcDaughter.vz()}; - genPBach = mcDaughter.p(); - genPtBach = mcDaughter.pt(); - bachDauPdgCode = mcDaughter.pdgCode(); - } - } - double genMClifetime = RecoDecay::sqrtSumOfSquares(genDecayVtx[0] - mcparticle.vx(), genDecayVtx[1] - mcparticle.vy(), genDecayVtx[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - outputMCTable( // reco information (-1) - -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, - -1, -1, - -1, -1, - -1, -1, - -1, -1, -1, - -1, -1, - -1, - -1, - -1, -1, - -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, - -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, - -1, - -1, - -1, - // gen information - mcparticle.p(), - mcparticle.pt(), - genDecayVtx[0], genDecayVtx[1], genDecayVtx[2], - genMClifetime, - mcparticle.phi(), - mcparticle.eta(), - mcparticle.y(), - genPPos, genPtPos, genPNeg, genPtNeg, genPBach, genPtBach, - isTrueGenH3L, isTrueGenAntiH3L, - posDauPdgCode, negDauPdgCode, bachDauPdgCode, - false, // isBachPrimary - false, // is reconstructed - survEvSel); - } // end mcparticles loop - } - PROCESS_SWITCH(threebodyKFTask, processMC, "MC analysis", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - }; -} diff --git a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx deleted file mode 100644 index 36af287f95e..00000000000 --- a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx +++ /dev/null @@ -1,909 +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 threebodyRecoTask.cxx -/// \brief Analysis task for 3-body decay process (now mainly for hypertriton) -/// \author Yuanzhe Wang - -#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/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/Vtx3BodyTables.h" -#include "PWGLF/DataModel/Reduced3BodyTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/PhysicsConstants.h" -#include "CCDB/BasicCCDBManager.h" - -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -using ReducedCols = soa::Join; -using FullTracksExtIU = soa::Join; -using MCLabeledTracksIU = soa::Join; - -std::vector triggerLabels = { - "fTriggerEventF1Proton", "fTrackedOmega", "fTrackedXi", "fOmegaLargeRadius", - "fDoubleOmega", "fOmegaHighMult", "fSingleXiYN", "fQuadrupleXi", "fDoubleXi", - "fhadronOmega", "fOmegaXi", "fTripleXi", "fOmega", "fGammaVeryLowPtEMCAL", - "fGammaVeryLowPtDCAL", "fGammaHighPtEMCAL", "fGammaLowPtEMCAL", "fGammaVeryHighPtDCAL", - "fGammaVeryHighPtEMCAL", "fGammaLowPtDCAL", "fJetNeutralLowPt", "fJetNeutralHighPt", - "fGammaHighPtDCAL", "fJetFullLowPt", "fJetFullHighPt", "fEMCALReadout", "fPCMandEE", - "fPHOSnbar", "fPCMHighPtPhoton", "fPHOSPhoton", "fLD", "fPPPHI", "fPD", "fLLL", "fPLL", - "fPPL", "fPPP", "fLeadingPtTrack", "fHighFt0cFv0Flat", "fHighFt0cFv0Mult", "fHighFt0Flat", - "fHighFt0Mult", "fHighMultFv0", "fHighTrackMult", "fHfSingleNonPromptCharm3P", - "fHfSingleNonPromptCharm2P", "fHfSingleCharm3P", "fHfPhotonCharm3P", "fHfHighPt2P", - "fHfSigmaC0K0", "fHfDoubleCharm2P", "fHfBeauty3P", "fHfFemto3P", "fHfFemto2P", - "fHfHighPt3P", "fHfSigmaCPPK", "fHfDoubleCharm3P", "fHfDoubleCharmMix", - "fHfPhotonCharm2P", "fHfV0Charm2P", "fHfBeauty4P", "fHfV0Charm3P", "fHfSingleCharm2P", - "fHfCharmBarToXiBach", "fSingleMuHigh", "fSingleMuLow", "fLMeeHMR", "fDiMuon", - "fDiElectron", "fLMeeIMR", "fSingleE", "fTrackHighPt", "fTrackLowPt", "fJetChHighPt", - "fJetChLowPt", "fUDdiffLarge", "fUDdiffSmall", "fITSextremeIonisation", - "fITSmildIonisation", "fH3L3Body", "fHe", "fH2"}; - -struct Candidate3body { - // Index - int mcmotherId; - int track0Id; - int track1Id; - int track2Id; - // Collision - float colCentFT0C; - // sv and candidate - bool isMatter; - float invmass; - float ct; - float cosPA; - float dcadaughters; - float dcacandtopv; - float vtxradius; - // daughter tracks - TLorentzVector lcand; - TLorentzVector lproton; - TLorentzVector lpion; - TLorentzVector lbachelor; - uint8_t dautpcNclusters[3]; // 0 - proton, 1 - pion, 2 - bachelor - uint32_t dauitsclussize[3]; // 0 - proton, 1 - pion, 2 - bachelor - float daudcaxytopv[3]; // 0 - proton, 1 - pion, 2 - bachelor - float daudcatopv[3]; // 0 - proton, 1 - pion, 2 - bachelor - float dautpcNsigma[3]; // 0 - proton, 1 - pion, 2 - bachelor - float dauinnermostR[3]; // 0 - proton, 1 - pion, 2 - bachelor !!! TracksIU required !!! - float bachelortofNsigma; - bool isBachPrimary = false; - // MC infomartion - TLorentzVector lgencand = {0, 0, 0, 0}; - float genct = -1; - float genrapidity = -999; - bool isSignal = false; - bool isReco = false; - int pdgCode = -1; - bool survivedEventSelection = false; -}; - -struct ThreebodyRecoTask { - - Produces outputDataTable; - Produces outputMCTable; - std::vector candidates3body; - std::vector filledMothers; - std::vector isGoodCollision; - - Service ccdb; - Zorro zorro; - OutputObj zorroSummary{"zorroSummary"}; - - //------------------------------------------------------------------ - PresliceUnsorted perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - - // Configurable for trigger selection - Configurable triggerList{"triggerList", "fTriggerEventF1Proton, fTrackedOmega, fTrackedXi, fOmegaLargeRadius, fDoubleOmega, fOmegaHighMult, fSingleXiYN, fQuadrupleXi, fDoubleXi, fhadronOmega, fOmegaXi, fTripleXi, fOmega, fGammaVeryLowPtEMCAL, fGammaVeryLowPtDCAL, fGammaHighPtEMCAL, fGammaLowPtEMCAL, fGammaVeryHighPtDCAL, fGammaVeryHighPtEMCAL, fGammaLowPtDCAL, fJetNeutralLowPt, fJetNeutralHighPt, fGammaHighPtDCAL, fJetFullLowPt, fJetFullHighPt, fEMCALReadout, fPCMandEE, fPHOSnbar, fPCMHighPtPhoton, fPHOSPhoton, fLD, fPPPHI, fPD, fLLL, fPLL, fPPL, fPPP, fLeadingPtTrack, fHighFt0cFv0Flat, fHighFt0cFv0Mult, fHighFt0Flat, fHighFt0Mult, fHighMultFv0, fHighTrackMult, fHfSingleNonPromptCharm3P, fHfSingleNonPromptCharm2P, fHfSingleCharm3P, fHfPhotonCharm3P, fHfHighPt2P, fHfSigmaC0K0, fHfDoubleCharm2P, fHfBeauty3P, fHfFemto3P, fHfFemto2P, fHfHighPt3P, fHfSigmaCPPK, fHfDoubleCharm3P, fHfDoubleCharmMix, fHfPhotonCharm2P, fHfV0Charm2P, fHfBeauty4P, fHfV0Charm3P, fHfSingleCharm2P, fHfCharmBarToXiBach, fSingleMuHigh, fSingleMuLow, fLMeeHMR, fDiMuon, fDiElectron, fLMeeIMR, fSingleE, fTrackHighPt, fTrackLowPt, fJetChHighPt, fJetChLowPt, fUDdiffLarge, fUDdiffSmall, fITSextremeIonisation, fITSmildIonisation, fH3L3Body, fHe, fH2", "List of triggers used to select events"}; - Configurable cfgOnlyKeepInterestedTrigger{"cfgOnlyKeepInterestedTrigger", false, "Flag to keep only interested trigger"}; - Configurable bcTolerance{"bcTolerance", 100, "Tolerance for BC in Zorro"}; - // Configuration to enable like-sign analysis - Configurable cfgLikeSignAnalysis{"cfgLikeSignAnalysis", false, "Enable like-sign analysis"}; - // Selection criteria - Configurable vtxcospa{"vtxcospa", 0.99, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut - Configurable dcapiontopv{"dcapiontopv", .05, "DCA Pion To PV"}; - Configurable etacut{"etacut", 0.9, "etacut"}; - Configurable rapiditycut{"rapiditycut", 1, "rapiditycut"}; - Configurable tofPIDNSigmaMin{"tofPIDNSigmaMin", -5, "tofPIDNSigmaMin"}; - Configurable tofPIDNSigmaMax{"tofPIDNSigmaMax", 5, "tofPIDNSigmaMax"}; - Configurable tpcPIDNSigmaCut{"tpcPIDNSigmaCut", 5, "tpcPIDNSigmaCut"}; - Configurable eventSel8Cut{"eventSel8Cut", true, "flag to enable event sel8 selection"}; - Configurable mcEventCut{"mcEventCut", true, "flag to enable mc event selection: kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable eventPosZCut{"eventPosZCut", true, "flag to enable event posZ selection"}; - Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct - Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; - Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; - Configurable minPionPt{"minPionPt", 0.1, "minPionPt"}; - Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; - Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; - Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; - Configurable minDeuteronPUseTOF{"minDeuteronPUseTOF", 1, "minDeuteronPt Enable TOF PID"}; - Configurable h3LMassLowerlimit{"h3LMassLowerlimit", 2.96, "Hypertriton mass lower limit"}; - Configurable h3LMassUpperlimit{"h3LMassUpperlimit", 3.04, "Hypertriton mass upper limit"}; - Configurable mintpcNClsproton{"mintpcNClsproton", 90, "min tpc Nclusters for proton"}; - Configurable mintpcNClspion{"mintpcNClspion", 70, "min tpc Nclusters for pion"}; - Configurable mintpcNClsdeuteron{"mintpcNClsdeuteron", 100, "min tpc Nclusters for deuteron"}; - - Configurable mcsigma{"mcsigma", 0.0015, "sigma of mc invariant mass fit"}; // obtained from MC - Configurable bachelorPdgCode{"bachelorPdgCode", 1000010020, "pdgCode of bachelor daughter"}; - Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother track"}; - - // 3sigma region for Dalitz plot - float lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - float uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; - - // CCDB options - 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 pidPath{"pidPath", "", "Path to the PID response object"}; - - // Zorro counting - Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Skimmed dataset processing"}; - - HistogramRegistry registry{ - "registry", - { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - {"hCentFT0C", "hCentFT0C", {HistType::kTH1F, {{100, 0.0f, 100.0f, "FT0C Centrality"}}}}, - {"hCandidatesCounter", "hCandidatesCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, - {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassHypertritonTotal", "hMassHypertritonTotal", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, - {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hProtonTPCBB", "hProtonTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hPionTPCBB", "hPionTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDeuteronTPCBB", "hDeuteronTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hProtonTPCVsPt", "hProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hPionTPCVsPt", "hPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTPCVsPt", "hDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTOFVsPBeforeTOFCut", "hDeuteronTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAtferTOFCut", "hDeuteronTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - - {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, - }, - }; - - //------------------------------------------------------------------ - // Fill stats histograms - enum Vtxstep { kCandAll = 0, - kCandDauEta, - kCandDauPt, - kCandTPCNcls, - kCandTPCPID, - kCandTOFPID, - kCandDcaToPV, - kCandRapidity, - kCandct, - kCandCosPA, - kCandDcaDau, - kCandInvMass, - kNCandSteps }; - - struct { - std::array candstats; - std::array truecandstats; - } statisticsRegistry; - - void resetHistos() - { - for (int ii = 0; ii < kNCandSteps; ii++) { - statisticsRegistry.candstats[ii] = 0; - statisticsRegistry.truecandstats[ii] = 0; - } - } - void fillCandCounter(int kn, bool istrue = false) - { - statisticsRegistry.candstats[kn]++; - if (istrue) { - statisticsRegistry.truecandstats[kn]++; - } - } - void fillHistos() - { - for (int ii = 0; ii < kNCandSteps; ii++) { - registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); - if (doprocessMC == true) { - registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); - } - } - } - - int mRunNumber; - - void init(InitContext const&) - { - zorroSummary.setObject(zorro.getZorroSummary()); - - mRunNumber = 0; - - ccdb->setURL(ccdbUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(1, "total"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(2, "sel8"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(3, "vertexZ"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(4, "Zorro H3L 3body event"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(5, "has Candidate"); - - // Check for selection criteria !!! TracksIU required !!! - registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton - registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion - registry.add("hDiffRVtxDeuteron", "hDiffRVtxDeuteron", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of deuteron - registry.add("hDiffDaughterR", "hDiffDaughterR", HistType::kTH1F, {{10000, -100, 100}}); // difference between minR of pion&proton and R of deuteron(bachelor) - - // Check triggers - auto hEventTriggerCount = registry.add("hEventTriggerCount", "hEventTriggerCount", HistType::kTH1F, {{static_cast(triggerLabels.size() + 1), 0, static_cast(triggerLabels.size() + 1)}}); - for (size_t i = 0; i < triggerLabels.size(); i++) { - hEventTriggerCount->GetXaxis()->SetBinLabel(i + 1, triggerLabels[i].c_str()); - } - hEventTriggerCount->GetXaxis()->SetBinLabel(triggerLabels.size() + 1, "NoTrigger"); - - if (cfgLikeSignAnalysis) { - registry.add("hInvMassCorrectSign", "hInvMassCorrectSign", HistType::kTH1F, {{80, 2.96f, 3.04f}}); // check if there are contamination of possible signals which are caused by unexpected PID - } - - if (doprocessMC == true) { - registry.add("hTrueHypertritonCounter", "hTrueHypertritonCounter", HistType::kTH1F, {{12, 0.0f, 12.0f}}); - auto hGeneratedHypertritonCounter = registry.add("hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", HistType::kTH1F, {{2, 0.0f, 2.0f}}); - hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(1, "Total"); - hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(2, "3-body decay"); - registry.add("hPtGeneratedHypertriton", "hPtGeneratedHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); - registry.add("hctGeneratedHypertriton", "hctGeneratedHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); - registry.add("hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); - registry.add("hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); - registry.add("hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - } - - TString candCounterbinLabel[kNCandSteps] = {"Total", "TrackEta", "DauPt", "TPCNcls", "TPCPID", "d TOFPID", "PionDcatoPV", "MomRapidity", "Lifetime", "VtxCosPA", "VtxDcaDau", "InvMass"}; - for (int i{0}; i < kNCandSteps; i++) { - registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, candCounterbinLabel[i]); - if (doprocessMC == true) { - registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, candCounterbinLabel[i]); - } - } - } - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - if (cfgSkimmedProcessing) { - zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); - zorro.populateHistRegistry(registry, bc.runNumber()); - } - - LOGF(info, "Initializing CCDB for run %d", bc.runNumber()); - mRunNumber = bc.runNumber(); - } - - //------------------------------------------------------------------ - // Check if the mcparticle is hypertriton which decays into 3 daughters - template - bool is3bodyDecayed(TMCParticle const& particle) - { - if (std::abs(particle.pdgCode()) != motherPdgCode) { - return false; - } - bool haveProton = false, havePion = false, haveBachelor = false; - bool haveAntiProton = false, haveAntiPion = false, haveAntiBachelor = false; - for (const auto& mcparticleDaughter : particle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == PDG_t::kProton) - haveProton = true; - if (mcparticleDaughter.pdgCode() == PDG_t::kProtonBar) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == PDG_t::kPiPlus) - havePion = true; - if (mcparticleDaughter.pdgCode() == PDG_t::kPiMinus) - haveAntiPion = true; - if (mcparticleDaughter.pdgCode() == bachelorPdgCode) - haveBachelor = true; - if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) - haveAntiBachelor = true; - } - if (haveProton && haveAntiPion && haveBachelor && particle.pdgCode() > 0) { - return true; - } else if (haveAntiProton && havePion && haveAntiBachelor && particle.pdgCode() < 0) { - return true; - } - return false; - } - - //------------------------------------------------------------------ - // Event Selection - template - bool eventSelection(TCollision const& collision) - { - auto bc = collision.template bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - - if (eventSel8Cut && !collision.sel8()) { - return false; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (eventPosZCut && std::abs(collision.posZ()) > 10.f) { // 10cm - return false; - } - registry.fill(HIST("hEventCounter"), 2.5); - registry.fill(HIST("hCentFT0C"), collision.centFT0C()); - - if (cfgSkimmedProcessing) { - bool zorroSelected = zorro.isSelected(bc.globalBC()); /// Just let Zorro do the accounting - if (zorroSelected) { - registry.fill(HIST("hEventCounter"), 3.5); - } else { - if (cfgOnlyKeepInterestedTrigger) { - return false; - } - } - } - - return true; - } - - //------------------------------------------------------------------ - // Fill candidate table - template - void fillCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double mcLifetime = -1, bool isBachPrimary = false) - { - double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); - double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; - - Candidate3body cand3body; - cand3body.isMatter = isMatter; - if (isMatter == true) { - cand3body.lproton.SetXYZM(candData.pxtrack0(), candData.pytrack0(), candData.pztrack0(), o2::constants::physics::MassProton); - cand3body.lpion.SetXYZM(candData.pxtrack1(), candData.pytrack1(), candData.pztrack1(), o2::constants::physics::MassPionCharged); - } else { - cand3body.lproton.SetXYZM(candData.pxtrack1(), candData.pytrack1(), candData.pztrack1(), o2::constants::physics::MassPionCharged); - cand3body.lpion.SetXYZM(candData.pxtrack0(), candData.pytrack0(), candData.pztrack0(), o2::constants::physics::MassProton); - } - - cand3body.mcmotherId = lLabel; - cand3body.track0Id = candData.track0Id(); - cand3body.track1Id = candData.track1Id(); - cand3body.track2Id = candData.track2Id(); - cand3body.colCentFT0C = collision.centFT0C(); - cand3body.invmass = cand3body.isMatter ? candData.mHypertriton() : candData.mAntiHypertriton(); - cand3body.lcand.SetXYZM(candData.px(), candData.py(), candData.pz(), o2::constants::physics::MassHyperTriton); - cand3body.ct = ct; - cand3body.cosPA = cospa; - cand3body.dcadaughters = candData.dcaVtxdaughters(); - cand3body.dcacandtopv = candData.dcavtxtopv(collision.posX(), collision.posY(), collision.posZ()); - cand3body.vtxradius = candData.vtxradius(); - cand3body.lbachelor.SetXYZM(candData.pxtrack2(), candData.pytrack2(), candData.pztrack2(), o2::constants::physics::MassDeuteron); - cand3body.dautpcNclusters[0] = trackProton.tpcNClsFound(); - cand3body.dautpcNclusters[1] = trackPion.tpcNClsFound(); - cand3body.dautpcNclusters[2] = trackDeuteron.tpcNClsFound(); - cand3body.dauitsclussize[0] = trackProton.itsClusterSizes(); - cand3body.dauitsclussize[1] = trackPion.itsClusterSizes(); - cand3body.dauitsclussize[2] = trackDeuteron.itsClusterSizes(); - cand3body.dautpcNsigma[0] = trackProton.tpcNSigmaPr(); - cand3body.dautpcNsigma[1] = trackPion.tpcNSigmaPi(); - cand3body.dautpcNsigma[2] = trackDeuteron.tpcNSigmaDe(); - cand3body.daudcaxytopv[0] = cand3body.isMatter ? candData.dcaXYtrack0topv() : candData.dcaXYtrack1topv(); - cand3body.daudcaxytopv[1] = cand3body.isMatter ? candData.dcaXYtrack1topv() : candData.dcaXYtrack0topv(); - cand3body.daudcaxytopv[2] = candData.dcaXYtrack2topv(); - cand3body.daudcatopv[0] = cand3body.isMatter ? candData.dcatrack0topv() : candData.dcatrack1topv(); - cand3body.daudcatopv[1] = cand3body.isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); - cand3body.daudcatopv[2] = candData.dcatrack2topv(); - cand3body.dauinnermostR[0] = trackProton.x(); - cand3body.dauinnermostR[1] = trackPion.x(); - cand3body.dauinnermostR[2] = trackDeuteron.x(); - - cand3body.bachelortofNsigma = candData.tofNSigmaBachDe(); - cand3body.isBachPrimary = isBachPrimary; - if (isTrueCand) { - cand3body.mcmotherId = lLabel; - cand3body.lgencand = lmother; - cand3body.genct = mcLifetime; - cand3body.genrapidity = lmother.Rapidity(); - cand3body.isSignal = true; - cand3body.isReco = true; - cand3body.pdgCode = cand3body.isMatter ? motherPdgCode : -motherPdgCode; - cand3body.survivedEventSelection = true; - filledMothers.push_back(lLabel); - } - - candidates3body.push_back(cand3body); - - registry.fill(HIST("hProtonTPCBB"), trackProton.sign() * trackProton.p(), trackProton.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), trackPion.sign() * trackPion.p(), trackPion.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), trackProton.pt(), trackProton.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), trackProton.pt(), trackPion.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), trackDeuteron.pt(), trackDeuteron.tpcNSigmaDe()); - registry.fill(HIST("hTOFPIDDeuteron"), candData.tofNSigmaBachDe()); - registry.fill(HIST("hDiffRVtxProton"), trackProton.x() - candData.vtxradius()); - registry.fill(HIST("hDiffRVtxPion"), trackPion.x() - candData.vtxradius()); - registry.fill(HIST("hDiffRVtxDeuteron"), trackDeuteron.x() - candData.vtxradius()); - float diffTrackR = trackDeuteron.x() - std::min(trackProton.x(), trackPion.x()); - registry.fill(HIST("hDiffDaughterR"), diffTrackR); - } - - //------------------------------------------------------------------ - // Selections for candidates - template - bool selectCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false) - { - fillCandCounter(kCandAll, isTrueCand); - - // Selection on daughters - if (std::abs(trackProton.eta()) > etacut || std::abs(trackPion.eta()) > etacut || std::abs(trackDeuteron.eta()) > etacut) { - return false; - } - fillCandCounter(kCandDauEta, isTrueCand); - - if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { - return false; - } - fillCandCounter(kCandDauPt, isTrueCand); - - if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { - return false; - } - fillCandCounter(kCandTPCNcls, isTrueCand); - - if (std::abs(trackProton.tpcNSigmaPr()) > tpcPIDNSigmaCut || std::abs(trackPion.tpcNSigmaPi()) > tpcPIDNSigmaCut || std::abs(trackDeuteron.tpcNSigmaDe()) > tpcPIDNSigmaCut) { - return false; - } - fillCandCounter(kCandTPCPID, isTrueCand); - - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - if ((candData.tofNSigmaBachDe() < tofPIDNSigmaMin || candData.tofNSigmaBachDe() > tofPIDNSigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { - return false; - } - fillCandCounter(kCandTOFPID, isTrueCand); - registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - - double dcapion = isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); - if (std::abs(dcapion) < dcapiontopv) { - return false; - } - fillCandCounter(kCandDcaToPV, isTrueCand); - - // Selection on candidate hypertriton - if (std::abs(candData.yHypertriton()) > rapiditycut) { - return false; - } - fillCandCounter(kCandRapidity, isTrueCand); - - double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - return false; - } - fillCandCounter(kCandct, isTrueCand); - - double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); - if (cospa < vtxcospa) { - return false; - } - fillCandCounter(kCandCosPA, isTrueCand); - - if (candData.dcaVtxdaughters() > dcavtxdau) { - return false; - } - fillCandCounter(kCandDcaDau, isTrueCand); - - if ((isMatter && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { - // Hypertriton - registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); - if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - } else if ((!isMatter && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { - // AntiHypertriton - registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); - if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - } else { - return false; - } - fillCandCounter(kCandInvMass, isTrueCand); - - return true; - } - - //------------------------------------------------------------------ - // Analysis process for a single candidate - template - void candidateAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& ifHasCandidate, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double mcLifetime = -1, double isBachPrimary = false) - { - auto track0 = candData.template track0_as(); - auto track1 = candData.template track1_as(); - auto track2 = candData.template track2_as(); - - bool isMatter = track2.sign() > 0; // true if the candidate is hypertriton (p pi- d) - - auto& trackProton = isMatter ? track0 : track1; - auto& trackPion = isMatter ? track1 : track0; - auto& trackDeuteron = track2; - - if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { - ifHasCandidate = true; - fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, mcLifetime, isBachPrimary); - } - } - - //------------------------------------------------------------------ - // Analysis process for like-sign candidates : (p pi- anti-d) or (anti-p pi+ d) - template - void likeSignAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& ifHasCandidate, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double mcLifetime = -1, double isBachPrimary = false) - { - auto track0 = candData.template track0_as(); - auto track1 = candData.template track1_as(); - auto track2 = candData.template track2_as(); - - bool isMatter = track2.sign() < 0; // true if seach for background consists of (p pi- anti-d) - - // Assume proton has an oppisite charge with deuteron - auto& trackProton = isMatter ? track0 : track1; - auto& trackPion = isMatter ? track1 : track0; - auto& trackDeuteron = track2; - - if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { - ifHasCandidate = true; - fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, mcLifetime, isBachPrimary); - // QA for if signals have the possibility to be reconginzed as a like-sign background - if (isMatter) { - registry.fill(HIST("hInvMassCorrectSign"), candData.mHypertriton()); - } else { - registry.fill(HIST("hInvMassCorrectSign"), candData.mAntiHypertriton()); - } - } - } - - //------------------------------------------------------------------ - // Analysis process for reduced data - template - void reducedAnalysis(TCollisionTable const& collision, TCandTable const& candData, TTracks tracks, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double mcLifetime = -1, double isBachPrimary = false) - { - auto track0 = tracks.rawIteratorAt(candData.track0Id()); - auto track1 = tracks.rawIteratorAt(candData.track1Id()); - auto track2 = tracks.rawIteratorAt(candData.track2Id()); - - bool isMatter = track2.sign() > 0; // true if the candidate is hypertriton (p pi- d) - - auto& trackProton = isMatter ? track0 : track1; - auto& trackPion = isMatter ? track1 : track0; - auto& trackDeuteron = track2; - - if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { - fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, mcLifetime, isBachPrimary); - } - } - - //------------------------------------------------------------------ - // Analysis process for reduced data with like-sign candidates - template - void reducedLikeSignAnalysis(TCollisionTable const& collision, TCandTable const& candData, TTracks tracks, bool isTrueCand = false, int lLabel = -1, TLorentzVector lmother = {0, 0, 0, 0}, double mcLifetime = -1, bool isBachPrimary = false) - { - auto track0 = tracks.rawIteratorAt(candData.track0Id()); - auto track1 = tracks.rawIteratorAt(candData.track1Id()); - auto track2 = tracks.rawIteratorAt(candData.track2Id()); - - bool isMatter = track2.sign() < 0; // true if seach for background consists of (p pi- anti-d) - - // Assume proton has an oppisite charge with deuteron - auto& trackProton = isMatter ? track0 : track1; - auto& trackPion = isMatter ? track1 : track0; - auto& trackDeuteron = track2; - - if (selectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand)) { - fillCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, lLabel, lmother, mcLifetime, isBachPrimary); - // QA for if signals have the possibility to be reconginzed as a like-sign background - if (isMatter) { - registry.fill(HIST("hInvMassCorrectSign"), candData.mHypertriton()); - } else { - registry.fill(HIST("hInvMassCorrectSign"), candData.mAntiHypertriton()); - } - } - } - - //------------------------------------------------------------------ - void fillOutputDataTable(Candidate3body const& cand3body) - { - outputDataTable(cand3body.colCentFT0C, - cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, - cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, cand3body.vtxradius, - cand3body.lproton.Pt(), cand3body.lproton.Eta(), cand3body.lproton.Phi(), cand3body.dauinnermostR[0], - cand3body.lpion.Pt(), cand3body.lpion.Eta(), cand3body.lpion.Phi(), cand3body.dauinnermostR[1], - cand3body.lbachelor.Pt(), cand3body.lbachelor.Eta(), cand3body.lbachelor.Phi(), cand3body.dauinnermostR[2], - cand3body.dautpcNclusters[0], cand3body.dautpcNclusters[1], cand3body.dautpcNclusters[2], - cand3body.dauitsclussize[0], cand3body.dauitsclussize[1], cand3body.dauitsclussize[2], - cand3body.dautpcNsigma[0], cand3body.dautpcNsigma[1], cand3body.dautpcNsigma[2], cand3body.bachelortofNsigma, - cand3body.daudcaxytopv[0], cand3body.daudcaxytopv[1], cand3body.daudcaxytopv[2], - cand3body.daudcatopv[0], cand3body.daudcatopv[1], cand3body.daudcatopv[2]); - } - - //------------------------------------------------------------------ - // collect information for generated hypertriton (should be called after event selection) - void getGeneratedH3LInfo(aod::McParticles const& particlesMC) - { - for (const auto& mcparticle : particlesMC) { - if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { - continue; - } - registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); - - bool haveProton = false, havePionPlus = false, haveDeuteron = false; - bool haveAntiProton = false, havePionMinus = false, haveAntiDeuteron = false; - double mcLifetime = -1; - for (const auto& mcparticleDaughter : mcparticle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == PDG_t::kProton) - haveProton = true; - if (mcparticleDaughter.pdgCode() == PDG_t::kProtonBar) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == PDG_t::kPiPlus) - havePionPlus = true; - if (mcparticleDaughter.pdgCode() == -PDG_t::kPiPlus) - havePionMinus = true; - if (mcparticleDaughter.pdgCode() == bachelorPdgCode) { - haveDeuteron = true; - mcLifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - } - if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) { - haveAntiDeuteron = true; - mcLifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - } - } - if (haveProton && havePionMinus && haveDeuteron && mcparticle.pdgCode() == motherPdgCode) { - registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); - registry.fill(HIST("hPtGeneratedHypertriton"), mcparticle.pt()); - registry.fill(HIST("hctGeneratedHypertriton"), mcLifetime); - registry.fill(HIST("hEtaGeneratedHypertriton"), mcparticle.eta()); - registry.fill(HIST("hRapidityGeneratedHypertriton"), mcparticle.y()); - } else if (haveAntiProton && havePionPlus && haveAntiDeuteron && mcparticle.pdgCode() == -motherPdgCode) { - registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); - registry.fill(HIST("hPtGeneratedAntiHypertriton"), mcparticle.pt()); - registry.fill(HIST("hctGeneratedAntiHypertriton"), mcLifetime); - registry.fill(HIST("hEtaGeneratedAntiHypertriton"), mcparticle.eta()); - registry.fill(HIST("hRapidityGeneratedAntiHypertriton"), mcparticle.y()); - } - } - } - - //------------------------------------------------------------------ - // process real data analysis - void processData(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const&, aod::BCsWithTimestamps const&) - { - for (const auto& collision : collisions) { - candidates3body.clear(); - - if (!eventSelection(collision)) { - continue; - } - - bool ifHasCandidate = false; - auto d3BodyCands = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - for (const auto& vtx : d3BodyCands) { - if (cfgLikeSignAnalysis) { - likeSignAnalysis(collision, vtx, ifHasCandidate); - } else { - candidateAnalysis(collision, vtx, ifHasCandidate); - } - } - - if (ifHasCandidate) { - auto bc = collision.bc_as(); - auto triggerSelection = zorro.getTriggerOfInterestResults(bc.globalBC(), bcTolerance); - for (size_t i = 0; i < triggerSelection.size(); i++) { - if (triggerSelection[i]) { - registry.fill(HIST("hEventTriggerCount"), i + 0.5); - } - } - if (zorro.isNotSelectedByAny(bc.globalBC(), bcTolerance)) { - registry.fill(HIST("hEventTriggerCount"), triggerLabels.size() + 0.5); - } - registry.fill(HIST("hEventCounter"), 4.5); - } - fillHistos(); - resetHistos(); - - for (const auto& cand3body : candidates3body) { - fillOutputDataTable(cand3body); - } - } - } - PROCESS_SWITCH(ThreebodyRecoTask, processData, "Real data reconstruction", true); - - //------------------------------------------------------------------ - // process reduced data analysis - void processReducedData(ReducedCols const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, aod::RedIUTracks const& tracks) - { - candidates3body.clear(); - - registry.fill(HIST("hEventCounter"), 0.5, collisions.size()); - - for (const auto& vtx : vtx3bodydatas) { - const auto& collision = collisions.iteratorAt(vtx.collisionId()); - if (cfgLikeSignAnalysis) { - reducedLikeSignAnalysis(collision, vtx, tracks); - } else { - reducedAnalysis(collision, vtx, tracks); - } - for (const auto& cand3body : candidates3body) { - fillOutputDataTable(cand3body); - } - candidates3body.clear(); - } - fillHistos(); - resetHistos(); - } - PROCESS_SWITCH(ThreebodyRecoTask, processReducedData, "Reduced data reconstruction", false); - - //------------------------------------------------------------------ - // process mc analysis - void processMC(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, aod::McParticles const& particlesMC, MCLabeledTracksIU const& /*tracks*/, aod::McCollisions const& mcCollisions) - { - filledMothers.clear(); - getGeneratedH3LInfo(particlesMC); - isGoodCollision.resize(mcCollisions.size(), false); - - for (const auto& collision : collisions) { - candidates3body.clear(); - registry.fill(HIST("hEventCounter"), 0.5); - if (mcEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - continue; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (eventPosZCut && std::abs(collision.posZ()) > 10.f) { // 10cm - continue; - } - registry.fill(HIST("hEventCounter"), 2.5); - registry.fill(HIST("hCentFT0C"), collision.centFT0C()); - - if (collision.mcCollisionId() >= 0) { - isGoodCollision[collision.mcCollisionId()] = true; - } - - bool ifHasCandidate = false; - auto vtxsThisCol = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - - for (const auto& vtx : vtxsThisCol) { - bool isBachPrimary = false; - int lLabel = -1; - int lPDG = -1; - double mcLifetime = -1; - TLorentzVector lmother; - bool isTrueCand = false; - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); - if (track0.has_mcParticle() && track1.has_mcParticle() && track2.has_mcParticle()) { - auto lMCTrack0 = track0.mcParticle_as(); - auto lMCTrack1 = track1.mcParticle_as(); - auto lMCTrack2 = track2.mcParticle_as(); - - if (lMCTrack2.isPhysicalPrimary()) { - isBachPrimary = true; - } - - if (lMCTrack0.has_mothers() && lMCTrack1.has_mothers() && lMCTrack2.has_mothers()) { - for (const auto& lMother0 : lMCTrack0.mothers_as()) { - for (const auto& lMother1 : lMCTrack1.mothers_as()) { - for (const auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - lLabel = lMother0.globalIndex(); - lPDG = lMother0.pdgCode(); - if ((lPDG == motherPdgCode && lMCTrack0.pdgCode() == PDG_t::kProton && lMCTrack1.pdgCode() == PDG_t::kPiMinus && lMCTrack2.pdgCode() == bachelorPdgCode) || - (lPDG == -motherPdgCode && lMCTrack0.pdgCode() == PDG_t::kPiPlus && lMCTrack1.pdgCode() == PDG_t::kProtonBar && lMCTrack2.pdgCode() == -bachelorPdgCode)) { - isTrueCand = true; - mcLifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); - lmother.SetXYZM(lMother0.px(), lMother0.py(), lMother0.pz(), o2::constants::physics::MassHyperTriton); - } - } - } - } - } - } - } - - candidateAnalysis(collision, vtx, ifHasCandidate, isTrueCand, lLabel, lmother, mcLifetime, isBachPrimary); - } - - if (ifHasCandidate) - registry.fill(HIST("hEventCounter"), 4.5); - fillHistos(); - resetHistos(); - - for (const auto& cand3body : candidates3body) { - outputMCTable(cand3body.colCentFT0C, - cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, - cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, cand3body.vtxradius, - cand3body.lproton.Pt(), cand3body.lproton.Eta(), cand3body.lproton.Phi(), cand3body.dauinnermostR[0], - cand3body.lpion.Pt(), cand3body.lpion.Eta(), cand3body.lpion.Phi(), cand3body.dauinnermostR[1], - cand3body.lbachelor.Pt(), cand3body.lbachelor.Eta(), cand3body.lbachelor.Phi(), cand3body.dauinnermostR[2], - cand3body.dautpcNclusters[0], cand3body.dautpcNclusters[1], cand3body.dautpcNclusters[2], - cand3body.dauitsclussize[0], cand3body.dauitsclussize[1], cand3body.dauitsclussize[2], - cand3body.dautpcNsigma[0], cand3body.dautpcNsigma[1], cand3body.dautpcNsigma[2], cand3body.bachelortofNsigma, - cand3body.daudcaxytopv[0], cand3body.daudcaxytopv[1], cand3body.daudcaxytopv[2], - cand3body.daudcatopv[0], cand3body.daudcatopv[1], cand3body.daudcatopv[2], - cand3body.isBachPrimary, - cand3body.lgencand.P(), cand3body.lgencand.Pt(), cand3body.genct, cand3body.lgencand.Phi(), cand3body.lgencand.Eta(), cand3body.lgencand.Rapidity(), - cand3body.isSignal, cand3body.isReco, cand3body.pdgCode, cand3body.survivedEventSelection); - } - } - - // now we fill only the signal candidates that were not reconstructed - for (const auto& mcparticle : particlesMC) { - if (!is3bodyDecayed(mcparticle)) { - continue; - } - if (std::find(filledMothers.begin(), filledMothers.end(), mcparticle.globalIndex()) != std::end(filledMothers)) { - continue; - } - bool isSurEvSelection = isGoodCollision[mcparticle.mcCollisionId()]; - std::array posSV{0.f}; - for (const auto& mcDaughter : mcparticle.daughters_as()) { - if (std::abs(mcDaughter.pdgCode()) == bachelorPdgCode) { - posSV = {mcDaughter.vx(), mcDaughter.vy(), mcDaughter.vz()}; - } - } - double mcLifetime = RecoDecay::sqrtSumOfSquares(posSV[0] - mcparticle.vx(), posSV[1] - mcparticle.vy(), posSV[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - outputMCTable(-1, - -1, -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, - -1, -1, -1, - false, - mcparticle.p(), mcparticle.pt(), mcLifetime, mcparticle.phi(), mcparticle.eta(), mcparticle.y(), - true, false, mcparticle.pdgCode(), isSurEvSelection); - } - } - PROCESS_SWITCH(ThreebodyRecoTask, processMC, "MC reconstruction", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - }; -} diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index b2af549c871..895e15935fc 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -24,16 +24,6 @@ o2physics_add_dpl_workflow(nuclei-hist PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(hypertriton3bodyanalysis - SOURCES hypertriton3bodyanalysis.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(hypertriton3bodymcqa - SOURCES hypertriton3bodyMcqa.cxx - PUBLIC_LINK_LIBRARIES O2::DCAFitter O2Physics::AnalysisCore O2::TOFBase - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(helium-flow SOURCES helium_flow.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyMcqa.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyMcqa.cxx deleted file mode 100644 index ef8dfb4b958..00000000000 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyMcqa.cxx +++ /dev/null @@ -1,908 +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 hypertriton3bodyMcqa.cxx -/// \brief QA for MC productions which contain hypertriton 3body decay process, including special checks for TOF PID -/// \author Yuanzhe Wang - -#include -#include -#include -#include -#include -#include -#include - -#include "CommonDataFormat/InteractionRecord.h" -#include "CommonDataFormat/IRFrame.h" -#include "Framework/runDataProcessing.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 "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/PhysicsConstants.h" -#include "CCDB/BasicCCDBManager.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; -using ColwithEvTimes = o2::soa::Join; -using FullTracksExtIU = soa::Join; -using MCLabeledTracksIU = soa::Join; - -template -bool is3bodyDecayedH3L(TMCParticle const& particle) -{ - if (std::abs(particle.pdgCode()) != 1010010030) { - return false; - } - bool haveProton = false, havePion = false, haveDeuteron = false; - bool haveAntiProton = false, haveAntiPion = false, haveAntiDeuteron = false; - for (const auto& mcDaughter : particle.template daughters_as()) { - if (mcDaughter.pdgCode() == 2212) - haveProton = true; - if (mcDaughter.pdgCode() == -2212) - haveAntiProton = true; - if (mcDaughter.pdgCode() == 211) - havePion = true; - if (mcDaughter.pdgCode() == -211) - haveAntiPion = true; - if (mcDaughter.pdgCode() == 1000010020) - haveDeuteron = true; - if (mcDaughter.pdgCode() == -1000010020) - haveAntiDeuteron = true; - } - if (haveProton && haveAntiPion && haveDeuteron && particle.pdgCode() > 0) { - return true; - } else if (haveAntiProton && havePion && haveAntiDeuteron && particle.pdgCode() < 0) { - return true; - } - return false; -} - -template -bool isPairedH3LDaughters(TMCParticle const& mctrack0, TMCParticle const& mctrack1, TMCParticle const& mctrack2) -{ - for (const auto& particleMother : mctrack0.template mothers_as()) { - if (!(particleMother.pdgCode() == 1010010030 && mctrack0.pdgCode() == 2212 && mctrack1.pdgCode() == -211 && mctrack2.pdgCode() == 1000010020) && - !(particleMother.pdgCode() == -1010010030 && mctrack0.pdgCode() == -2212 && mctrack1.pdgCode() == 211 && mctrack2.pdgCode() == -1000010020)) { - continue; - } - bool flag1 = false, flag2 = false; - for (const auto& mcDaughter : particleMother.template daughters_as()) { - if (mcDaughter.globalIndex() == mctrack1.globalIndex()) - flag1 = true; - if (mcDaughter.globalIndex() == mctrack2.globalIndex()) - flag2 = true; - } - if (!flag1 || !flag2) - continue; - // move the requirement in mass region into the loop to draw a histogram - // double hypertritonMCMass = RecoDecay::m(array{array{mctrack0.px(), mctrack0.py(), mctrack0.pz()}, array{mctrack1.px(), mctrack1.py(), mctrack1.pz()}, array{mctrack2.px(), mctrack2.py(), mctrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - // if (hypertritonMCMass > 2.990 && hypertritonMCMass < 2.993) - return true; - } - return false; -} - -// check the properties of daughters candidates and true daughters -struct Hypertriton3bodyMcqa { - - Service ccdb; - Preslice perCollisionTracks = aod::track::collisionId; - - int mRunNumber; - - // Basic checks - HistogramRegistry registry{ - "registry", - { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hParticleCounter", "hParticleCounter", {HistType::kTH1F, {{7, 0.0f, 7.0f}}}}, - - {"hTPCNCls", "hTPCNCls", {HistType::kTH1F, {{160, 0.0f, 160.0f}}}}, - {"hTPCNClsCrossedRows", "hTPCNClsCrossedRows", {HistType::kTH1F, {{160, 0.0f, 160.0f}}}}, - {"hTrackEta", "hTrackEta", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hTrackITSNcls", "hTrackITSNcls", {HistType::kTH1F, {{10, 0.0f, 10.0f}}}}, - {"hTrackMcRapidity", "hTrackMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hTrackNsigmaProton", "hTrackNsigmaProton", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hTrackNsigmaPion", "hTrackNsigmaPion", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hTrackNsigmaDeuteron", "hTrackNsigmaDeuteron", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - - {"hHypertritonEta", "hHypertritomEta", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hHypertritonMcRapidity", "hHypertritonMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hHypertritonMcPt", "hHypertritonMcPt", {HistType::kTH1F, {{300, 0.0f, 15.0f}}}}, - - {"hProtonCounter", "hProtonCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hProtonPt", "hProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hProtonP", "hProtonP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hProtonMcPt", "hProtonMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hProtonMcP", "hProtonMcP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hProtonEta", "hProtonEta", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hProtonMcRapidity", "hProtonMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hProtonNsigmaProton", "hProtonNsigmaProton", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hProtonTPCNCls", "hProtonTPCNCls", {HistType::kTH1F, {{120, 0.0f, 120.0f}}}}, - {"hProtonTPCBB", "hProtonTPCBB", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hProtonTPCBBAfterTPCNclsCut", "hProtonTPCBBAfterTPCNclsCut", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDauProtonPt", "hDauProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauProtonMcPt", "hDauProtonMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauProtonNsigmaProton", "hDauProtonNsigmaProton", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hDauProtonTPCVsPt", "hDauProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - - {"hPionCounter", "hPionCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hPionPt", "hPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPionP", "hPionP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPionMcPt", "hPionMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPionMcP", "hPionMcP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPionEta", "hPionEta", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hPionMcRapidity", "hPionMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hPionNsigmaPion", "hPionNsigmaPion", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hPionTPCNCls", "hPionTPCNCls", {HistType::kTH1F, {{160, 0.0f, 160.0f}}}}, - {"hPionTPCBB", "hPionTPCBB", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hPionTPCBBAfterTPCNclsCut", "hPionTPCBBAfterTPCNclsCut", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDauPionPt", "hDauPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauPionMcPt", "hDauPionMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauPionNsigmaPion", "hDauPionNsigmaPion", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hDauPionTPCVsPt", "hDauPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDauPionDcaXY", "hDauPionDcaXY", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}}, - - {"hDeuteronCounter", "hDeuteronCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hDeuteronPt", "hDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDeuteronP", "hDeuteronP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDeuteronMcPt", "hDeuteronMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDeuteronMcP", "hDeuteronMcP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDeuteronEta", "hDeuteronEta", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hDeuteronMcRapidity", "hDeuteronMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, - {"hDeuteronNsigmaDeuteron", "hDeuteronNsigmaDeuteron", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hDeuteronTPCNCls", "hDeuteronTPCNCls", {HistType::kTH1F, {{120, 0.0f, 120.0f}}}}, - {"hDeuteronTPCBB", "hDeuteronTPCBB", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDeuteronTPCBBAfterTPCNclsCut", "hDeuteronTPCBBAfterTPCNclsCut", {HistType::kTH2F, {{320, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDauDeuteronPt", "hDauDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauDeuteronMcPt", "hDauDeuteronMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDauDeuteronTPCVsPt", "hDauDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsP", "hDauDeuteronTOFNSigmaVsP", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsPHasTOF", "hDauDeuteronTOFNSigmaVsPHasTOF", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronMatchCounter", "hDauDeuteronMatchCounter", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, - - {"hTPCBB", "hTPCBB", {HistType::kTH2F, {{120, -8.0f, 8.0f, "p/z(GeV/c)"}, {100, 0.0f, 1000.0f, "TPCSignal"}}}}, - - {"hPairedH3LDaughers", "hPairedH3LDaughers", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hPairedH3LDaughersInvMass", "hPairedH3LDaughersInvMass", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, - {"hDuplicatedH3LDaughers", "hDuplicatedH3LDaughers", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - - // Diff checks always requir hasTOF - {"hDiffTrackTOFSignal", "hDiffTrackTOFSignal", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hDiffEvTimeForTrack", "hDiffEvTimeForTrack", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hDiffTrackTOFNSigmaDe", "hDiffTrackTOFNSigmaDe", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hDauDeuteronNewTOFNSigmaVsP", "hDauDeuteronNewTOFNSigmaVsP", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hWrongDeuteronTOFNSigmaVsP", "hWrongDeuteronTOFNSigmaVsP", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hWrongDeuteronNewTOFNSigmaVsP", "hWrongDeuteronNewTOFNSigmaVsP", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDiffColTime", "hDiffColTime", {HistType::kTH1F, {{200, -100.0f, 100.0f}}}}, - {"hDauDeuteronDiffTOFNsigmaDeHasTOF", "hDauDeuteronDiffTOFNsigmaDeHasTOF", {HistType::kTH1F, {{200, -100.0f, 100.0f}}}}, - - // _v2 for using relinked collision - {"hDauDeuteronTOFNSigmaVsP_CorrectCol", "hDauDeuteronTOFNSigmaVsP_CorrectCol", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronNewTOFNSigmaVsP_CorrectCol", "hDauDeuteronNewTOFNSigmaVsP_CorrectCol", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsP_v2", "hDauDeuteronTOFNSigmaVsP_v2", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronNewTOFNSigmaVsP_v2_AO2D", "hDauDeuteronNewTOFNSigmaVsP_v2 AO2D", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronNewTOFNSigmaVsP_v2_EvSel", "hDauDeuteronNewTOFNSigmaVsP_v2 EvSel", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsColTimeRes_v2", "hDauDeuteronTOFNSigmaVsColTimeRes_v2", {HistType::kTH2F, {{100, 0.0f, 400.0f, "CollisionTimeRes(ns)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsColTimeRes_v2_AO2D", "hDauDeuteronTOFNSigmaVsColTimeRes_v2 AO2D", {HistType::kTH2F, {{100, 0.0f, 400.0f, "CollisionTimeRes(ns)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFNSigmaVsColTimeRes_v2_EvSel", "hDauDeuteronTOFNSigmaVsColTimeRes_v2 EvSel", {HistType::kTH2F, {{100, 0.0f, 400.0f, "CollisionTimeRes(ns)"}, {600, -300.0f, 300.0f, "TOF n#sigma"}}}}, - {"hDauDeuteronTOFPIDCounter", "hDauDeuteronTOFPIDCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - {"hDauDeuteronTOFPIDCounter_CloseBC", "hDauDeuteronTOFPIDCounter CloseBC", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - }, - }; - - void init(InitContext&) - { - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(2, "Has_mcparticle"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(3, "Rapidity Cut"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(4, "McisHypertriton"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(5, "McisProton"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(6, "McisPion"); - registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(7, "McisDeuteron"); - - TString trackCounterbinLabel[2] = {"hasMom", "FromHypertriton"}; - for (int i{0}; i < 2; i++) { - registry.get(HIST("hProtonCounter"))->GetXaxis()->SetBinLabel(i + 1, trackCounterbinLabel[i]); - registry.get(HIST("hPionCounter"))->GetXaxis()->SetBinLabel(i + 1, trackCounterbinLabel[i]); - registry.get(HIST("hDeuteronCounter"))->GetXaxis()->SetBinLabel(i + 1, trackCounterbinLabel[i]); - } - registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(1, "proton"); - registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(2, "pion"); - registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(3, "deuteron"); - - registry.get(HIST("hDauDeuteronMatchCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hDauDeuteronMatchCounter"))->GetXaxis()->SetBinLabel(2, "correct collision"); - registry.get(HIST("hDauDeuteronMatchCounter"))->GetXaxis()->SetBinLabel(3, "hasTOF"); - registry.get(HIST("hDauDeuteronMatchCounter"))->GetXaxis()->SetBinLabel(4, "hasTOF & correct collsion"); - - registry.get(HIST("hDauDeuteronTOFPIDCounter"))->GetXaxis()->SetBinLabel(1, "Origin |n#sigma| >= 5"); - registry.get(HIST("hDauDeuteronTOFPIDCounter"))->GetXaxis()->SetBinLabel(2, "BothBC work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter"))->GetXaxis()->SetBinLabel(3, "Only BCAO2D work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter"))->GetXaxis()->SetBinLabel(4, "Only BCEvSel work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter"))->GetXaxis()->SetBinLabel(5, "BothBC not work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter_CloseBC"))->GetXaxis()->SetBinLabel(1, "Origin |n#sigma| < 6"); - registry.get(HIST("hDauDeuteronTOFPIDCounter_CloseBC"))->GetXaxis()->SetBinLabel(2, "BothBC work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter_CloseBC"))->GetXaxis()->SetBinLabel(3, "Only BCAO2D work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter_CloseBC"))->GetXaxis()->SetBinLabel(4, "Only BCEvSel work"); - registry.get(HIST("hDauDeuteronTOFPIDCounter_CloseBC"))->GetXaxis()->SetBinLabel(5, "BothBC not work"); - } - - Configurable dcapiontopv{"dcapiontopv", .05, "DCA Pion To PV"}; - Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; - Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; - Configurable minPionPt{"minPionPt", 0.1, "minPionPt"}; - Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; - Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; - Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable event_posZ_selection{"event_posZ_selection", true, "event selection count post poZ cut"}; - - // CCDB TOF PID paras - 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"}; - - o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - mRunNumber = bc.runNumber(); - - // 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); - } - } - - bachelorTOFPID.SetParams(mRespParamsV2); - } - - struct Indexdaughters { // check duplicated paired daughters - int64_t index0; - int64_t index1; - int64_t index2; - bool operator==(const Indexdaughters& t) const - { - return (this->index0 == t.index0 && this->index1 == t.index1 && this->index2 == t.index2); - } - }; - - void process(ColwithEvTimes const& collisions, MCLabeledTracksIU const& tracks, aod::McParticles const& /*particlesMC*/, aod::McCollisions const& /*mcCollisions*/, aod::BCsWithTimestamps const&) - { - for (const auto& collision : collisions) { - auto bc = collision.bc_as(); - initCCDB(bc); - - registry.fill(HIST("hEventCounter"), 0.5); - if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - continue; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm - continue; - } - registry.fill(HIST("hEventCounter"), 2.5); - - std::vector protons, pions, deuterons; // index for daughter tracks - std::unordered_set set_proton, set_pion, set_deuteron; // check duplicated daughters - int itrack = -1; - - auto coltracks = tracks.sliceBy(perCollisionTracks, collision.globalIndex()); - - for (const auto& track : coltracks) { - - ++itrack; - registry.fill(HIST("hParticleCounter"), 0.5); - registry.fill(HIST("hTrackITSNcls"), track.itsNCls()); - registry.fill(HIST("hTPCNCls"), track.tpcNClsFound()); - registry.fill(HIST("hTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); - registry.fill(HIST("hTrackNsigmaDeuteron"), track.tpcNSigmaDe()); - registry.fill(HIST("hTrackNsigmaProton"), track.tpcNSigmaPr()); - registry.fill(HIST("hTrackNsigmaPion"), track.tpcNSigmaPi()); - - if (!track.has_mcParticle()) { - continue; - } - auto mcparticle = track.mcParticle_as(); - registry.fill(HIST("hTPCBB"), track.p() * track.sign(), track.tpcSignal()); - - registry.fill(HIST("hParticleCounter"), 1.5); - - // if (TMath::Abs(mcparticle.y()) > 0.9) {continue;} - registry.fill(HIST("hParticleCounter"), 2.5); - registry.fill(HIST("hTrackEta"), track.eta()); - registry.fill(HIST("hTrackMcRapidity"), mcparticle.y()); - - // Hypertriton detected directly - if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hParticleCounter"), 3.5); - registry.fill(HIST("hHypertritonMcPt"), mcparticle.pt()); - registry.fill(HIST("hHypertritonEta"), track.eta()); - registry.fill(HIST("hHypertritonMcRapidity"), mcparticle.y()); - } - - // Proton - if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { - registry.fill(HIST("hParticleCounter"), 4.5); - if (track.tpcNClsFound() > 70) { - registry.fill(HIST("hProtonTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); - } - - if (mcparticle.has_mothers()) { - registry.fill(HIST("hProtonCounter"), 0.5); - for (const auto& particleMother : mcparticle.mothers_as()) { - bool flag_H3L = is3bodyDecayedH3L(particleMother); - if (!flag_H3L) { - continue; - } - protons.push_back(itrack); - auto p = set_proton.insert(mcparticle.globalIndex()); - if (p.second == false) - registry.fill(HIST("hDuplicatedH3LDaughers"), 0); - registry.fill(HIST("hProtonCounter"), 1.5); - registry.fill(HIST("hDauProtonPt"), track.pt()); - registry.fill(HIST("hDauProtonMcPt"), mcparticle.pt()); - registry.fill(HIST("hDauProtonNsigmaProton"), track.tpcNSigmaPr()); - registry.fill(HIST("hDauProtonTPCVsPt"), track.pt(), track.tpcNSigmaPr()); - } - } - - registry.fill(HIST("hProtonMcPt"), mcparticle.pt()); - registry.fill(HIST("hProtonMcP"), mcparticle.p()); - registry.fill(HIST("hProtonPt"), track.pt()); - registry.fill(HIST("hProtonP"), track.p()); - - registry.fill(HIST("hProtonNsigmaProton"), track.tpcNSigmaPr()); - registry.fill(HIST("hProtonTPCNCls"), track.tpcNClsFound()); - registry.fill(HIST("hProtonEta"), track.eta()); - registry.fill(HIST("hProtonMcRapidity"), mcparticle.y()); - registry.fill(HIST("hProtonTPCBB"), track.p() * track.sign(), track.tpcSignal()); - } - - // Pion - if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { - registry.fill(HIST("hParticleCounter"), 5.5); - if (track.tpcNClsFound() > 70) { - registry.fill(HIST("hPionTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); - } - - if (mcparticle.has_mothers()) { - registry.fill(HIST("hPionCounter"), 0.5); - for (const auto& particleMother : mcparticle.mothers_as()) { - bool flag_H3L = is3bodyDecayedH3L(particleMother); - if (!flag_H3L) { - continue; - } - pions.push_back(itrack); - auto p = set_pion.insert(mcparticle.globalIndex()); - if (p.second == false) { - registry.fill(HIST("hDuplicatedH3LDaughers"), 1); - } - registry.fill(HIST("hPionCounter"), 1.5); - registry.fill(HIST("hDauPionPt"), track.pt()); - registry.fill(HIST("hDauPionMcPt"), mcparticle.pt()); - registry.fill(HIST("hDauPionTPCVsPt"), track.pt(), track.tpcNSigmaPi()); - registry.fill(HIST("hDauPionDcaXY"), track.dcaXY()); - } - } - - registry.fill(HIST("hPionMcPt"), mcparticle.pt()); - registry.fill(HIST("hPionMcP"), mcparticle.p()); - registry.fill(HIST("hPionPt"), track.pt()); - registry.fill(HIST("hPionP"), track.p()); - - registry.fill(HIST("hPionNsigmaPion"), track.tpcNSigmaPi()); - registry.fill(HIST("hPionTPCNCls"), track.tpcNClsFound()); - registry.fill(HIST("hPionEta"), track.eta()); - registry.fill(HIST("hPionMcRapidity"), mcparticle.y()); - registry.fill(HIST("hPionTPCBB"), track.p() * track.sign(), track.tpcSignal()); - } - - float tofNsigmaDe = -999; - static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; // c in cm/ps - - if (track.hasTOF() && track.has_collision()) { - auto responseDe = o2::pid::tof::ExpTimes(); - // float bachExpTime = track.length() * sqrt((o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - - float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; - float bachExpTime = track.length() * std::sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - float tofsignal = track.trackTime() * 1000 + bachExpTime; // in ps - - float expSigma = responseDe.GetExpectedSigma(mRespParamsV2, track, tofsignal, track.tofEvTimeErr()); - // tofNsigmaDe = (track.tofSignal() - track.tofEvTime() - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - tofNsigmaDe = (tofsignal - track.tofEvTime() - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - // tofNsigmaDe = (tofsignal - track.evTimeForTrack() - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - - if (collision.bcId() == collision.foundBCId()) { - registry.fill(HIST("hDiffColTime"), track.tofEvTime() - collision.collisionTime()); - } - - // Assume deuterons linked to the correct collision, result of new TOF PID should be same as the default one - registry.fill(HIST("hDiffTrackTOFSignal"), track.tofSignal() - tofsignal); - registry.fill(HIST("hDiffEvTimeForTrack"), track.tofEvTime() - track.evTimeForTrack()); - registry.fill(HIST("hDiffTrackTOFNSigmaDe"), track.tofNSigmaDe() - bachelorTOFPID.GetTOFNSigma(o2::track::PID::Deuteron, track, collision, collision)); - // registry.fill(HIST("hDiffTrackTOFNSigmaDe"), track.tofExpSigmaDe() - bachelorTOFPID.GetTOFNSigma(o2::track::PID::Deuteron, track, collision, collision)); - } - - // Deuteron - if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - registry.fill(HIST("hParticleCounter"), 6.5); - if (track.tpcNClsFound() > 70) { - registry.fill(HIST("hDeuteronTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); - } - - if (mcparticle.has_mothers()) { - registry.fill(HIST("hDeuteronCounter"), 0.5); - for (const auto& particleMother : mcparticle.mothers_as()) { - bool flag_H3L = is3bodyDecayedH3L(particleMother); - if (!flag_H3L) { - continue; - } - deuterons.push_back(itrack); - auto p = set_deuteron.insert(mcparticle.globalIndex()); - if (p.second == false) - registry.fill(HIST("hDuplicatedH3LDaughers"), 2); - registry.fill(HIST("hDeuteronCounter"), 1.5); - registry.fill(HIST("hDauDeuteronPt"), track.pt()); - registry.fill(HIST("hDauDeuteronMcPt"), mcparticle.pt()); - registry.fill(HIST("hDauDeuteronTPCVsPt"), track.pt(), track.tpcNSigmaDe()); - registry.fill(HIST("hDauDeuteronTOFNSigmaVsP"), track.sign() * track.p(), track.tofNSigmaDe()); - - registry.fill(HIST("hDauDeuteronNewTOFNSigmaVsP"), track.sign() * track.p(), tofNsigmaDe); - if (track.hasTOF()) { - registry.fill(HIST("hDauDeuteronTOFNSigmaVsPHasTOF"), track.sign() * track.p(), track.tofNSigmaDe()); - registry.fill(HIST("hDauDeuteronDiffTOFNsigmaDeHasTOF"), track.tofNSigmaDe() - tofNsigmaDe); - } - registry.fill(HIST("hDauDeuteronMatchCounter"), 0.5); - if (mcparticle.mcCollisionId() == collision.mcCollisionId()) { - registry.fill(HIST("hDauDeuteronMatchCounter"), 1.5); - } - if (track.hasTOF()) { - registry.fill(HIST("hDauDeuteronMatchCounter"), 2.5); - if (mcparticle.mcCollisionId() == collision.mcCollisionId()) { - registry.fill(HIST("hDauDeuteronMatchCounter"), 3.5); - } - } - } - } - - registry.fill(HIST("hDeuteronMcPt"), mcparticle.pt()); - registry.fill(HIST("hDeuteronMcP"), mcparticle.p()); - registry.fill(HIST("hDeuteronPt"), track.pt()); - registry.fill(HIST("hDeuteronP"), track.p()); - - registry.fill(HIST("hDeuteronNsigmaDeuteron"), track.tpcNSigmaDe()); - registry.fill(HIST("hDeuteronTPCNCls"), track.tpcNClsFound()); - registry.fill(HIST("hDeuteronEta"), track.eta()); - registry.fill(HIST("hDeuteronMcRapidity"), mcparticle.y()); - registry.fill(HIST("hDeuteronTPCBB"), track.p() * track.sign(), track.tpcSignal()); - } else { - if (track.hasTOF()) { - registry.fill(HIST("hWrongDeuteronTOFNSigmaVsP"), track.sign() * track.p(), track.tofNSigmaDe()); - registry.fill(HIST("hWrongDeuteronNewTOFNSigmaVsP"), track.sign() * track.p(), tofNsigmaDe); - } - } - } - - std::vector set_pair; - for (size_t iproton = 0; iproton < protons.size(); iproton++) { - auto track0 = tracks.iteratorAt(protons[iproton]); - auto mctrack0 = track0.mcParticle_as(); - for (size_t ipion = 0; ipion < pions.size(); ipion++) { - auto track1 = tracks.iteratorAt(pions[ipion]); - auto mctrack1 = track1.mcParticle_as(); - for (size_t ideuteron = 0; ideuteron < deuterons.size(); ideuteron++) { - auto track2 = tracks.iteratorAt(deuterons[ideuteron]); - auto mctrack2 = track2.mcParticle_as(); - if (isPairedH3LDaughters(mctrack0, mctrack1, mctrack2)) { - registry.fill(HIST("hPairedH3LDaughers"), 0); - // MC mass cut, to check if the daughters are from materials - double hypertritonMCMass = RecoDecay::m(std::array{std::array{mctrack0.px(), mctrack0.py(), mctrack0.pz()}, std::array{mctrack1.px(), mctrack1.py(), mctrack1.pz()}, std::array{mctrack2.px(), mctrack2.py(), mctrack2.pz()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hPairedH3LDaughersInvMass"), hypertritonMCMass); - if (hypertritonMCMass < 2.990 || hypertritonMCMass > 2.993) - continue; - registry.fill(HIST("hPairedH3LDaughers"), 1); - // duplicated daughters check - Indexdaughters temp = {mctrack0.globalIndex(), mctrack1.globalIndex(), mctrack2.globalIndex()}; - auto p = std::find(set_pair.begin(), set_pair.end(), temp); - if (p == set_pair.end()) { - set_pair.push_back(temp); - registry.fill(HIST("hPairedH3LDaughers"), 2); - } - } - } - } - } - } - - // Check for recalculated TOF PID for secondary deuterons - - std::vector SelectedEvents(collisions.size()); - int nevts = 0; - for (const auto& collision : collisions) { - SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); - } - - for (const auto& track : tracks) { - if (!track.has_mcParticle()) { - continue; - } - auto mcparticle = track.mcParticle_as(); - if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - if (!mcparticle.has_mothers()) { - continue; - } - const auto evtReconstructed = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcparticle.mcCollision_as().globalIndex()); - if (evtReconstructed == SelectedEvents.end() || !track.has_collision()) { - continue; - } - if (!track.has_collision()) { - continue; - } - auto collision = collisions.iteratorAt(evtReconstructed - SelectedEvents.begin()); - auto originalcollision = track.collision_as(); - - for (const auto& particleMother : mcparticle.mothers_as()) { - bool flag_H3L = is3bodyDecayedH3L(particleMother); - if (!flag_H3L) { - continue; - } - - auto bc = collision.bc_as(); - initCCDB(bc); - float tofNsigmaDeAO2D = -999; - float tofNsigmaDeEvSel = -999; - - if (track.hasTOF()) { - /*auto responseDe = o2::pid::tof::ExpTimes(); - //float bachExpTime = track.length() * sqrt((o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; - float bachExpTime = track.length() * std::sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - */ - - tofNsigmaDeAO2D = bachelorTOFPID.GetTOFNSigma(o2::track::PID::Deuteron, track, originalcollision, collision); - tofNsigmaDeEvSel = bachelorTOFPID.GetTOFNSigma(o2::track::PID::Deuteron, track, originalcollision, collision, false); - - if (collision.globalIndex() == originalcollision.globalIndex()) { - registry.fill(HIST("hDauDeuteronTOFNSigmaVsP_CorrectCol"), track.sign() * track.p(), track.tofNSigmaDe()); - registry.fill(HIST("hDauDeuteronNewTOFNSigmaVsP_CorrectCol"), track.sign() * track.p(), tofNsigmaDeAO2D); - continue; - } - - /*if (originalcollision.collisionTimeRes() > 40){ - continue; - }*/ - registry.fill(HIST("hDauDeuteronTOFNSigmaVsP_v2"), track.sign() * track.p(), track.tofNSigmaDe()); - registry.fill(HIST("hDauDeuteronNewTOFNSigmaVsP_v2_AO2D"), track.sign() * track.p(), tofNsigmaDeAO2D); - registry.fill(HIST("hDauDeuteronNewTOFNSigmaVsP_v2_EvSel"), track.sign() * track.p(), tofNsigmaDeEvSel); - registry.fill(HIST("hDauDeuteronTOFNSigmaVsColTimeRes_v2"), collision.collisionTimeRes(), track.tofNSigmaDe()); - registry.fill(HIST("hDauDeuteronTOFNSigmaVsColTimeRes_v2_AO2D"), originalcollision.collisionTimeRes(), tofNsigmaDeAO2D); - registry.fill(HIST("hDauDeuteronTOFNSigmaVsColTimeRes_v2_EvSel"), originalcollision.collisionTimeRes(), tofNsigmaDeEvSel); - - if (std::abs(track.tofNSigmaDe()) >= 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter"), 0.5); - if (std::abs(tofNsigmaDeAO2D) < 5 && std::abs(tofNsigmaDeEvSel) < 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter"), 1.5); - } else if (std::abs(tofNsigmaDeAO2D) < 5 && std::abs(tofNsigmaDeEvSel) >= 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter"), 2.5); - } else if (std::abs(tofNsigmaDeAO2D) >= 5 && std::abs(tofNsigmaDeEvSel) < 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter"), 3.5); - } else if (std::abs(tofNsigmaDeAO2D) >= 5 && std::abs(tofNsigmaDeEvSel) >= 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter"), 4.5); - } - } else if (std::abs(track.tofNSigmaDe()) < 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter_CloseBC"), 0.5); - if (std::abs(tofNsigmaDeAO2D) < 5 && std::abs(tofNsigmaDeEvSel) < 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter_CloseBC"), 1.5); - } else if (std::abs(tofNsigmaDeAO2D) < 5 && std::abs(tofNsigmaDeEvSel) >= 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter_CloseBC"), 2.5); - } else if (std::abs(tofNsigmaDeAO2D) >= 5 && std::abs(tofNsigmaDeEvSel) < 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter_CloseBC"), 3.5); - } else if (std::abs(tofNsigmaDeAO2D) >= 5 && std::abs(tofNsigmaDeEvSel) >= 5) { - registry.fill(HIST("hDauDeuteronTOFPIDCounter_CloseBC"), 4.5); - } - } - } - } - } - } - } -}; - -// check the performance of mcparticle -struct Hypertriton3bodyMcParticleCheck { - // Basic checks - HistogramRegistry registry{ - "registry", - { - {"hMcCollCounter", "hMcCollCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - - {"h3dMCDecayedHypertriton", "h3dMCDecayedHypertriton", {HistType::kTH3F, {{20, -1.0f, 1.0f, "Rapidity"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {50, 0.0f, 50.0f, "ct(cm)"}}}}, - - {"hMcHypertritonCounter", "hMcHypertritonCounter", {HistType::kTH1F, {{9, 0.0f, 9.0f}}}}, - {"hMcHypertritonPt", "hMcHypertritonPt", {HistType::kTH1F, {{300, 0.0f, 15.0f}}}}, - {"hMcProtonPt", "hMcProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hMcPionPt", "hMcPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hMcDeuteronPt", "hMcDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - - {"hMcRecoInvMass", "hMcRecoInvMass", {HistType::kTH1F, {{100, 2.95, 3.05f}}}}, - - {"hDiffDaughterR", "hDiffDaughterR", {HistType::kTH1F, {{10000, -100, 100}}}}, // difference between minR of pion&proton and R of deuteron(bachelor) - {"hTrackX", "hTrackX", {HistType::kTH1F, {{10000, -100, 100}}}}, - {"hTrackY", "hTrackY", {HistType::kTH1F, {{10000, -100, 100}}}}, - {"hTrackZ", "hTrackZ", {HistType::kTH1F, {{10000, -100, 100}}}}, - }, - }; - - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; - - void init(InitContext&) - { - registry.get(HIST("hMcCollCounter"))->GetXaxis()->SetBinLabel(1, "Total Counter"); - registry.get(HIST("hMcCollCounter"))->GetXaxis()->SetBinLabel(2, "Reconstructed"); - - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "Hypertriton All"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "Matter All"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(3, "AntiMatter All"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(4, "confirm to 3-body decay"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(5, "Matter"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(6, "AntiMatter"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(7, "Rapidity"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(8, "Lifetime"); - registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(9, "PtCut"); - } - - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable event_posZ_selection{"event_posZ_selection", true, "event selection count post poZ cut"}; - - Preslice permcCollision = o2::aod::mcparticle::mcCollisionId; - - std::vector mcPartIndices; - template - void SetTrackIDForMC(aod::McParticles const& particlesMC, TTrackTable const& tracks) - { - mcPartIndices.clear(); - mcPartIndices.resize(particlesMC.size()); - std::fill(mcPartIndices.begin(), mcPartIndices.end(), -1); - for (const auto& track : tracks) { - if (track.has_mcParticle()) { - auto mcparticle = track.template mcParticle_as(); - if (mcPartIndices[mcparticle.globalIndex()] == -1) { - mcPartIndices[mcparticle.globalIndex()] = track.globalIndex(); - } else { - auto candTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); - // Use the track which has innest information (also best quality? - if (track.x() < candTrack.x()) { - mcPartIndices[mcparticle.globalIndex()] = track.globalIndex(); - } - } - - // Checks for TrackR - registry.fill(HIST("hTrackX"), track.x()); - registry.fill(HIST("hTrackY"), track.y()); - registry.fill(HIST("hTrackZ"), track.z()); - } - } - } - - void process(aod::McCollisions const& mcCollisions, aod::McParticles const& particlesMC, const o2::soa::Join& collisions, MCLabeledTracksIU const& tracks) - { - SetTrackIDForMC(particlesMC, tracks); - std::vector SelectedEvents(collisions.size()); - int nevts = 0; - for (const auto& collision : collisions) { - if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - continue; - } - if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm - continue; - } - SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); - } - SelectedEvents.resize(nevts); - - for (const auto& mcCollision : mcCollisions) { - registry.fill(HIST("hMcCollCounter"), 0.5); - const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); - if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection - continue; - } - registry.fill(HIST("hMcCollCounter"), 1.5); - - const auto& dparticlesMC = particlesMC.sliceBy(permcCollision, mcCollision.globalIndex()); - - for (const auto& mcparticle : dparticlesMC) { - - if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { - registry.fill(HIST("hMcProtonPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { - registry.fill(HIST("hMcPionPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - registry.fill(HIST("hMcDeuteronPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hMcHypertritonCounter"), 1.5); - } else if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCounter"), 2.5); - } - if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCounter"), 0.5); - registry.fill(HIST("hMcHypertritonPt"), mcparticle.pt()); - - double dauDeuteronPos[3] = {-999, -999, -999}; - double dauProtonMom[3] = {-999, -999, -999}; - double dauPionMom[3] = {-999, -999, -999}; - double dauDeuteronMom[3] = {-999, -999, -999}; - double MClifetime = 999; - double dauProtonTrackR = 9999, dauPionTrackR = 99999, dauDeuteronTrackR = 999999; - bool flag_H3L = is3bodyDecayedH3L(mcparticle); - if (!flag_H3L) { - continue; - } - for (const auto& mcparticleDaughter : mcparticle.daughters_as()) { - if (std::abs(mcparticleDaughter.pdgCode()) == 2212) { - dauProtonMom[0] = mcparticleDaughter.px(); - dauProtonMom[1] = mcparticleDaughter.py(); - dauProtonMom[2] = mcparticleDaughter.pz(); - if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { - auto trackProton = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); - dauProtonTrackR = trackProton.x(); - } - } - if (std::abs(mcparticleDaughter.pdgCode()) == 211) { - dauPionMom[0] = mcparticleDaughter.px(); - dauPionMom[1] = mcparticleDaughter.py(); - dauPionMom[2] = mcparticleDaughter.pz(); - if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { - auto trackPion = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); - dauPionTrackR = trackPion.x(); - } - } - if (std::abs(mcparticleDaughter.pdgCode()) == 1000010020) { - dauDeuteronPos[0] = mcparticleDaughter.vx(); - dauDeuteronPos[1] = mcparticleDaughter.vy(); - dauDeuteronPos[2] = mcparticleDaughter.vz(); - dauDeuteronMom[0] = mcparticleDaughter.px(); - dauDeuteronMom[1] = mcparticleDaughter.py(); - dauDeuteronMom[2] = mcparticleDaughter.pz(); - if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { - auto trackDeuteron = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); - dauDeuteronTrackR = trackDeuteron.x(); - } - } - } - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hMcHypertritonCounter"), 3.5); - registry.fill(HIST("hMcHypertritonCounter"), 4.5); - } - if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCounter"), 3.5); - registry.fill(HIST("hMcHypertritonCounter"), 5.5); - } - double hypertritonMCMass = RecoDecay::m(std::array{std::array{dauProtonMom[0], dauProtonMom[1], dauProtonMom[2]}, std::array{dauPionMom[0], dauPionMom[1], dauPionMom[2]}, std::array{dauDeuteronMom[0], dauDeuteronMom[1], dauDeuteronMom[2]}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); - registry.fill(HIST("hMcRecoInvMass"), hypertritonMCMass); - - if (hypertritonMCMass > 2.990 && hypertritonMCMass < 2.993) { - MClifetime = RecoDecay::sqrtSumOfSquares(dauDeuteronPos[0] - mcparticle.vx(), dauDeuteronPos[1] - mcparticle.vy(), dauDeuteronPos[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - registry.fill(HIST("h3dMCDecayedHypertriton"), mcparticle.y(), mcparticle.pt(), MClifetime); - - double diffTrackR = dauDeuteronTrackR - std::min(dauPionTrackR, dauProtonTrackR); - registry.fill(HIST("hDiffDaughterR"), diffTrackR); - - // int daughterPionCount = 0; - // for (auto& mcparticleDaughter : mcparticle.daughters_as()) { - // if (std::abs(mcparticleDaughter.pdgCode()) == 211) { - // daughterPionCount++; - // } - // } - - // Counter for hypertriton N_gen - if (std::abs(mcparticle.y()) < 1) { - registry.fill(HIST("hMcHypertritonCounter"), 6.5); - if (MClifetime < 40) { - registry.fill(HIST("hMcHypertritonCounter"), 7.5); - if (mcparticle.pt() > 1 && mcparticle.pt() < 10) { - registry.fill(HIST("hMcHypertritonCounter"), 8.5); - } - } - } - } - } - } - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - }; -} diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx deleted file mode 100644 index b8aeb1d34c3..00000000000 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx +++ /dev/null @@ -1,797 +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 hypertriton3bodyanalysis.cxx -/// \brief Standard analysis workflow for hypertriton 3-body decay -/// \author Yuanzhe Wang - -#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/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -// #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/Vtx3BodyTables.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 "CommonConstants/PhysicsConstants.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -using FullTracksExtIU = soa::Join; -// using FullTracksExtIU = soa::Join; // For TOF PID check -using MCLabeledTracksIU = soa::Join; - -struct hypertriton3bodyQa { - // Basic checks - HistogramRegistry registry{ - "registry", - { - {"hVtxRadius", "hVtxRadius", {HistType::kTH1F, {{1000, 0.0f, 100.0f, "cm"}}}}, - {"hVtxCosPA", "hVtxCosPA", {HistType::kTH1F, {{1000, 0.9f, 1.0f}}}}, - {"hPtProton", "hPtProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtPionMinus", "hPtPionMinus", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtDeuteron", "hPtDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiProton", "hPtAntiProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtPionPlus", "hPtPionPlus", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiDeuteron", "hPtAntiDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDCAXYProtonToPV", "hDCAXYProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYPionToPV", "hDCAXYPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYDeuteronToPV", "hDCAXYDeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAProtonToPV", "hDCAProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAPionToPV", "hDCAPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCADeuteronToPV", "hDCADeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hProtonTPCNcls", "hProtonTPCNcls", {HistType::kTH1F, {{300, 0, 300, "TPC cluster"}}}}, - {"hPionTPCNcls", "hPionTPCNcls", {HistType::kTH1F, {{300, 0, 300, "TPC cluster"}}}}, - {"hDeuteronTPCNcls", "hDeuteronTPCNcls", {HistType::kTH1F, {{300, 0, 300, "TPC cluster"}}}}, - {"hDCAVtxDau", "hDCAVtxDau", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "cm^{2}"}}}}, - {"hVtxPt", "hVtxPt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, - {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hDeuTOFNsigma", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {2000, -100, 100, "TOF n#sigma"}}}}, - {"hDeuTOFNsigmaWithTPC", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {1000, -100, 100, "TOF n#sigma"}}}}, - }, - }; - - void init(InitContext const&) - { - AxisSpec massAxis = {120, 2.9f, 3.2f, "Inv. Mass (GeV/c^{2})"}; - registry.add("hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {massAxis}}); - registry.add("hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {massAxis}}); - // Check for selection criteria - registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton - registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion - registry.add("hDiffRVtxDeuteron", "hDiffRVtxDeuteron", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of deuteron - registry.add("hDiffDaughterR", "hDiffDaughterR", HistType::kTH1F, {{10000, -100, 100}}); // difference between minR of pion&proton and R of deuteron(bachelor) - } - - void process(aod::Collision const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) - { - for (const auto& vtx : vtx3bodydatas) { - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); - - registry.fill(HIST("hVtxRadius"), vtx.vtxradius()); - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hVtxPt"), vtx.pt()); - registry.fill(HIST("hMassHypertriton"), vtx.mHypertriton()); - registry.fill(HIST("hMassAntiHypertriton"), vtx.mAntiHypertriton()); - if (std::abs(track2.tpcNSigmaDe()) < 5) { - registry.fill(HIST("hDeuTOFNsigmaWithTPC"), track2.tpcInnerParam() * track2.sign(), vtx.tofNSigmaBachDe()); - } - if (track2.sign() > 0) { - registry.fill(HIST("hPtProton"), track0.pt()); - registry.fill(HIST("hPtPionMinus"), track1.pt()); - registry.fill(HIST("hPtDeuteron"), track2.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), vtx.dcaXYtrack0topv()); - registry.fill(HIST("hDCAXYPionToPV"), vtx.dcaXYtrack1topv()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hProtonTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hDiffRVtxProton"), track0.x() - vtx.vtxradius()); - registry.fill(HIST("hDiffRVtxPion"), track1.x() - vtx.vtxradius()); - } else { - registry.fill(HIST("hPtPionPlus"), track0.pt()); - registry.fill(HIST("hPtAntiProton"), track1.pt()); - registry.fill(HIST("hPtAntiDeuteron"), track2.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), vtx.dcaXYtrack1topv()); - registry.fill(HIST("hDCAXYPionToPV"), vtx.dcaXYtrack0topv()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hProtonTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hDiffRVtxProton"), track1.x() - vtx.vtxradius()); - registry.fill(HIST("hDiffRVtxPion"), track0.x() - vtx.vtxradius()); - } - registry.fill(HIST("hDCAXYDeuteronToPV"), vtx.dcaXYtrack2topv()); - registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); - registry.fill(HIST("hTOFPIDDeuteron"), vtx.tofNSigmaBachDe()); - registry.fill(HIST("hDeuTOFNsigma"), track2.tpcInnerParam() * track2.sign(), vtx.tofNSigmaBachDe()); - registry.fill(HIST("hDiffRVtxDeuteron"), track2.x() - vtx.vtxradius()); - float diffTrackR = track2.x() - std::min(track0.x(), track1.x()); - registry.fill(HIST("hDiffDaughterR"), diffTrackR); - } - } -}; - -struct hypertriton3bodyAnalysis { - - Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - - // Selection criteria - Configurable vtxcospa{"vtxcospa", 0.99, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut - Configurable dcapiontopv{"dcapiontopv", .05, "DCA Pion To PV"}; - Configurable etacut{"etacut", 0.9, "etacut"}; - Configurable rapiditycut{"rapiditycut", 1, "rapiditycut"}; - Configurable tofPIDNSigmaMin{"tofPIDNSigmaMin", -5, "tofPIDNSigmaMin"}; - Configurable tofPIDNSigmaMax{"tofPIDNSigmaMax", 5, "tofPIDNSigmaMax"}; - Configurable tpcPIDNSigmaCut{"tpcPIDNSigmaCut", 5, "tpcPIDNSigmaCut"}; - Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable event_posZ_selection{"event_posZ_selection", true, "event selection count post poZ cut"}; - Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct - Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; - Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; - Configurable minPionPt{"minPionPt", 0.1, "minPionPt"}; - Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; - Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; - Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; - Configurable minDeuteronPUseTOF{"minDeuteronPUseTOF", 1, "minDeuteronPt Enable TOF PID"}; - Configurable h3LMassLowerlimit{"h3LMassLowerlimit", 2.96, "Hypertriton mass lower limit"}; - Configurable h3LMassUpperlimit{"h3LMassUpperlimit", 3.04, "Hypertriton mass upper limit"}; - Configurable mintpcNClsproton{"mintpcNClsproton", 90, "min tpc Nclusters for proton"}; - Configurable mintpcNClspion{"mintpcNClspion", 70, "min tpc Nclusters for pion"}; - Configurable mintpcNClsdeuteron{"mintpcNClsdeuteron", 100, "min tpc Nclusters for deuteron"}; - - Configurable mcsigma{"mcsigma", 0.0015, "sigma of mc invariant mass fit"}; // obtained from MC - Configurable bachelorPdgCode{"bachelorPdgCode", 1000010020, "pdgCode of bachelor daughter"}; - Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother track"}; - - // 3sigma region for Dalitz plot - float lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - float uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; - - HistogramRegistry registry{ - "registry", - { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, - {"hCandidatesCounter", "hCandidatesCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, - {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hMassHypertritonTotal", "hMassHypertritonTotal", {HistType::kTH1F, {{300, 2.9f, 3.2f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hPtProton", "hPtProton", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hPtPionMinus", "hPtPionMinus", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hPtDeuteron", "hPtDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hPtAntiProton", "hPtAntiProton", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hPtPionPlus", "hPtPionPlus", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hPtAntiDeuteron", "hPtAntiDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"hDCAXYProtonToPV", "hDCAXYProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYPionToPV", "hDCAXYPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYDeuteronToPV", "hDCAXYDeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAProtonToPV", "hDCAProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAPionToPV", "hDCAPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCADeuteronToPV", "hDCADeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hProtonTPCNcls", "hProtonTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hPionTPCNcls", "hPionTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hDeuteronTPCNcls", "hDeuteronTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hVtxCosPA", "hVtxCosPA", {HistType::kTH1F, {{1000, 0.9f, 1.0f}}}}, - {"hDCAVtxDau", "hDCAVtxDau", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "cm^{2}"}}}}, - {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hTPCPIDProton", "hTPCPIDProton", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hTPCPIDPion", "hTPCPIDPion", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hTPCPIDDeuteron", "hTPCPIDDeuteron", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, - {"hProtonTPCBB", "hProtonTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hPionTPCBB", "hPionTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDeuteronTPCBB", "hDeuteronTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hProtonTPCVsPt", "hProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hPionTPCVsPt", "hPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTPCVsPt", "hDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTOFVsPBeforeTOFCut", "hDeuteronTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAfterTOFCut", "hDeuteronTOFVsPAfterTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - - {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, - {"h3dMassHypertriton", "h3dMassHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dMassAntiHypertriton", "h3dMassAntiHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dTotalHypertriton", "h3dTotalHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - - {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAfterTOFCutSig", "hDeuteronTOFVsPAfterTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"h3dTotalTrueHypertriton", "h3dTotalTrueHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - // For TOF PID check - /*{"hDeuteronDefaultTOFVsPBeforeTOFCut", "hDeuteronDefaultTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronDefaultTOFVsPAtferTOFCut", "hDeuteronDefaultTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronDefaultTOFVsPBeforeTOFCutSig", "hDeuteronDefaultTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronDefaultTOFVsPAfterTOFCutSig", "hDeuteronDefaultTOFVsPAfterTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}},*/ - }, - }; - - //------------------------------------------------------------------ - // Fill stats histograms - enum vtxstep { kCandAll = 0, - kCandDauEta, - kCandDauPt, - kCandTPCNcls, - kCandTPCPID, - kCandTOFPID, - kCandDcaToPV, - kCandRapidity, - kCandct, - kCandCosPA, - kCandDcaDau, - kCandInvMass, - kNCandSteps }; - - struct { - std::array candstats; - std::array truecandstats; - } statisticsRegistry; - - void resetHistos() - { - for (int ii = 0; ii < kNCandSteps; ii++) { - statisticsRegistry.candstats[ii] = 0; - statisticsRegistry.truecandstats[ii] = 0; - } - } - void FillCandCounter(int kn, bool istrue = false) - { - statisticsRegistry.candstats[kn]++; - if (istrue) { - statisticsRegistry.truecandstats[kn]++; - } - } - void fillHistos() - { - for (int ii = 0; ii < kNCandSteps; ii++) { - registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); - if (doprocessMC == true) { - registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); - } - } - } - - ConfigurableAxis dcaBinning{"dca-binning", {200, 0.0f, 1.0f}, ""}; - ConfigurableAxis ptBinning{"pt-binning", {200, 0.0f, 10.0f}, ""}; - - void init(InitContext const&) - { - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(1, "total"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(2, "sel8"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(3, "vertexZ"); - registry.get(HIST("hEventCounter"))->GetXaxis()->SetBinLabel(4, "has Candidate"); - - if (doprocessMC == true) { - registry.add("hTrueHypertritonCounter", "hTrueHypertritonCounter", HistType::kTH1F, {{12, 0.0f, 12.0f}}); - auto hGeneratedHypertritonCounter = registry.add("hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", HistType::kTH1F, {{2, 0.0f, 2.0f}}); - hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(1, "Total"); - hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(2, "3-body decay"); - registry.add("hPtGeneratedHypertriton", "hPtGeneratedHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); - registry.add("hctGeneratedHypertriton", "hctGeneratedHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); - registry.add("hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); - registry.add("hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); - registry.add("hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); - } - - TString CandCounterbinLabel[kNCandSteps] = {"Total", "TrackEta", "DauPt", "TPCNcls", "TPCPID", "d TOFPID", "PionDcatoPV", "MomRapidity", "Lifetime", "VtxCosPA", "VtxDcaDau", "InvMass"}; - for (int i{0}; i < kNCandSteps; i++) { - registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); - if (doprocessMC == true) { - registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); - } - } - } - - //------------------------------------------------------------------ - // Selections for candidates - template - bool SelectCand(TCollisionTable const& collision, TCandTable const& candData, TTrackTable const& trackProton, TTrackTable const& trackPion, TTrackTable const& trackDeuteron, bool isMatter, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) - { - FillCandCounter(kCandAll, isTrueCand); - - // Selection on daughters - if (std::abs(trackProton.eta()) > etacut || std::abs(trackPion.eta()) > etacut || std::abs(trackDeuteron.eta()) > etacut) { - return false; - } - FillCandCounter(kCandDauEta, isTrueCand); - - if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { - return false; - } - FillCandCounter(kCandDauPt, isTrueCand); - - if (trackProton.tpcNClsFound() < mintpcNClsproton || trackPion.tpcNClsFound() < mintpcNClspion || trackDeuteron.tpcNClsFound() < mintpcNClsdeuteron) { - return false; - } - FillCandCounter(kCandTPCNcls, isTrueCand); - - if (std::abs(trackProton.tpcNSigmaPr()) > tpcPIDNSigmaCut || std::abs(trackPion.tpcNSigmaPi()) > tpcPIDNSigmaCut || std::abs(trackDeuteron.tpcNSigmaDe()) > tpcPIDNSigmaCut) { - return false; - } - FillCandCounter(kCandTPCPID, isTrueCand); - - // registry.fill(HIST("hDeuteronDefaultTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - if (isTrueCand) { - // registry.fill(HIST("hDeuteronDefaultTOFVsPBeforeTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - } - if ((candData.tofNSigmaBachDe() < tofPIDNSigmaMin || candData.tofNSigmaBachDe() > tofPIDNSigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { - return false; - } - FillCandCounter(kCandTOFPID, isTrueCand); - // registry.fill(HIST("hDeuteronDefaultTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); - registry.fill(HIST("hDeuteronTOFVsPAfterTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - if (isTrueCand) { - // registry.fill(HIST("hDeuteronDefaultTOFVsPAfterTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); - registry.fill(HIST("hDeuteronTOFVsPAfterTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - } - - double dcapion = isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); - if (std::abs(dcapion) < dcapiontopv) { - return false; - } - FillCandCounter(kCandDcaToPV, isTrueCand); - - // Selection on candidate hypertriton - if (std::abs(candData.yHypertriton()) > rapiditycut) { - return false; - } - FillCandCounter(kCandRapidity, isTrueCand); - - double ct = candData.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - return false; - } - FillCandCounter(kCandct, isTrueCand); - - double cospa = candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()); - if (cospa < vtxcospa) { - return false; - } - FillCandCounter(kCandCosPA, isTrueCand); - - if (candData.dcaVtxdaughters() > dcavtxdau) { - return false; - } - FillCandCounter(kCandDcaDau, isTrueCand); - - if ((isMatter && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { - // Hypertriton - registry.fill(HIST("hPtProton"), trackProton.pt()); - registry.fill(HIST("hPtPionMinus"), trackPion.pt()); - registry.fill(HIST("hPtDeuteron"), trackDeuteron.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), candData.dcaXYtrack0topv()); - registry.fill(HIST("hDCAXYPionToPV"), candData.dcaXYtrack1topv()); - registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack0topv()); - registry.fill(HIST("hDCAPionToPV"), candData.dcatrack1topv()); - - registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); - registry.fill(HIST("h3dMassHypertriton"), 0., candData.pt(), candData.mHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mHypertriton()); - if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - if (isTrueCand) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); - } - } else if ((!isMatter && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { - // AntiHypertriton - registry.fill(HIST("hPtAntiProton"), trackProton.pt()); - registry.fill(HIST("hPtPionPlus"), trackPion.pt()); - registry.fill(HIST("hPtAntiDeuteron"), trackDeuteron.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), candData.dcaXYtrack1topv()); - registry.fill(HIST("hDCAXYPionToPV"), candData.dcaXYtrack0topv()); - registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack1topv()); - registry.fill(HIST("hDCAPionToPV"), candData.dcatrack0topv()); - - registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); - registry.fill(HIST("h3dMassAntiHypertriton"), 0., candData.pt(), candData.mAntiHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mAntiHypertriton()); - if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(std::array{std::array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, std::array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - if (isTrueCand) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); - } - } else { - return false; - } - - FillCandCounter(kCandInvMass, isTrueCand); - - registry.fill(HIST("hDCAXYDeuteronToPV"), candData.dcaXYtrack2topv()); - registry.fill(HIST("hDCADeuteronToPV"), candData.dcatrack2topv()); - registry.fill(HIST("hVtxCosPA"), candData.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), candData.dcaVtxdaughters()); - registry.fill(HIST("hProtonTPCNcls"), trackProton.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), trackPion.tpcNClsCrossedRows()); - registry.fill(HIST("hDeuteronTPCNcls"), trackDeuteron.tpcNClsCrossedRows()); - registry.fill(HIST("hTPCPIDProton"), trackProton.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), trackPion.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), trackDeuteron.tpcNSigmaDe()); - registry.fill(HIST("hProtonTPCBB"), trackProton.sign() * trackProton.p(), trackProton.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), trackPion.sign() * trackPion.p(), trackPion.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), trackProton.pt(), trackProton.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), trackProton.pt(), trackPion.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), trackDeuteron.pt(), trackDeuteron.tpcNSigmaDe()); - registry.fill(HIST("hTOFPIDDeuteron"), candData.tofNSigmaBachDe()); - - return true; - } - - //------------------------------------------------------------------ - // Analysis process for a single candidate - template - void CandidateAnalysis(TCollisionTable const& collision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) - { - - auto track0 = candData.template track0_as(); - auto track1 = candData.template track1_as(); - auto track2 = candData.template track2_as(); - - bool isMatter = track2.sign() > 0; - - auto& trackProton = isMatter ? track0 : track1; - auto& trackPion = isMatter ? track1 : track0; - auto& trackDeuteron = track2; - - if (SelectCand(collision, candData, trackProton, trackPion, trackDeuteron, isMatter, isTrueCand, MClifetime, lPt)) { - if_hasvtx = true; - } - } - - //------------------------------------------------------------------ - // collect information for generated hypertriton (should be called after event selection) - void GetGeneratedH3LInfo(aod::McParticles const& particlesMC) - { - for (const auto& mcparticle : particlesMC) { - if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { - continue; - } - registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); - - bool haveProton = false, havePionPlus = false, haveDeuteron = false; - bool haveAntiProton = false, havePionMinus = false, haveAntiDeuteron = false; - double MClifetime = -1; - for (const auto& mcparticleDaughter : mcparticle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == 2212) - haveProton = true; - if (mcparticleDaughter.pdgCode() == -2212) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == 211) - havePionPlus = true; - if (mcparticleDaughter.pdgCode() == -211) - havePionMinus = true; - if (mcparticleDaughter.pdgCode() == bachelorPdgCode) { - haveDeuteron = true; - MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - } - if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) { - haveAntiDeuteron = true; - MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - } - } - if (haveProton && havePionMinus && haveDeuteron && mcparticle.pdgCode() == motherPdgCode) { - registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); - registry.fill(HIST("hPtGeneratedHypertriton"), mcparticle.pt()); - registry.fill(HIST("hctGeneratedHypertriton"), MClifetime); - registry.fill(HIST("hEtaGeneratedHypertriton"), mcparticle.eta()); - registry.fill(HIST("hRapidityGeneratedHypertriton"), mcparticle.y()); - } else if (haveAntiProton && havePionPlus && haveAntiDeuteron && mcparticle.pdgCode() == -motherPdgCode) { - registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); - registry.fill(HIST("hPtGeneratedAntiHypertriton"), mcparticle.pt()); - registry.fill(HIST("hctGeneratedAntiHypertriton"), MClifetime); - registry.fill(HIST("hEtaGeneratedAntiHypertriton"), mcparticle.eta()); - registry.fill(HIST("hRapidityGeneratedAntiHypertriton"), mcparticle.y()); - } - } - } - - //------------------------------------------------------------------ - // process real data analysis - void processData(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) - { - registry.fill(HIST("hEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { - return; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm - return; - } - registry.fill(HIST("hEventCounter"), 2.5); - - bool if_hasvtx = false; - - for (const auto& vtx : vtx3bodydatas) { - CandidateAnalysis(collision, vtx, if_hasvtx); - } - - if (if_hasvtx) - registry.fill(HIST("hEventCounter"), 3.5); - fillHistos(); - resetHistos(); - } - PROCESS_SWITCH(hypertriton3bodyAnalysis, processData, "Real data analysis", true); - - //------------------------------------------------------------------ - // process mc analysis - void processMC(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, aod::McParticles const& particlesMC, MCLabeledTracksIU const& /*tracks*/) - { - GetGeneratedH3LInfo(particlesMC); - - for (const auto& collision : collisions) { - registry.fill(HIST("hEventCounter"), 0.5); - if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - continue; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm - continue; - } - registry.fill(HIST("hEventCounter"), 2.5); - - bool if_hasvtx = false; - auto vtxsthiscol = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); - - for (const auto& vtx : vtxsthiscol) { - // int lLabel = -1; - int lPDG = -1; - float lPt = -1; - double MClifetime = -1; - bool isTrueCand = false; - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); - if (track0.has_mcParticle() && track1.has_mcParticle() && track2.has_mcParticle()) { - auto lMCTrack0 = track0.mcParticle_as(); - auto lMCTrack1 = track1.mcParticle_as(); - auto lMCTrack2 = track2.mcParticle_as(); - if (lMCTrack0.has_mothers() && lMCTrack1.has_mothers() && lMCTrack2.has_mothers()) { - for (const auto& lMother0 : lMCTrack0.mothers_as()) { - for (const auto& lMother1 : lMCTrack1.mothers_as()) { - for (const auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - // lLabel = lMother1.globalIndex(); - lPt = lMother1.pt(); - lPDG = lMother1.pdgCode(); - if ((lPDG == motherPdgCode && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == bachelorPdgCode) || - (lPDG == -motherPdgCode && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -bachelorPdgCode)) { - isTrueCand = true; - MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); - } - } - } - } - } - } - } - - CandidateAnalysis(collision, vtx, if_hasvtx, isTrueCand, MClifetime, lPt); - } - - if (if_hasvtx) - registry.fill(HIST("hEventCounter"), 3.5); - fillHistos(); - resetHistos(); - } - } - PROCESS_SWITCH(hypertriton3bodyAnalysis, processMC, "MC analysis", false); -}; - -// check vtx3body with mclabels -struct hypertriton3bodyLabelCheck { - - Configurable mc_event_selection{"mc_event_selection", true, "mc event selection count post kIsTriggerTVX and kNoTimeFrameBorder"}; - Configurable event_posZ_selection{"event_posZ_selection", false, "event selection count post poZ cut"}; - Configurable tpcPIDNSigmaCut{"tpcPIDNSigmaCut", 5, "tpcPIDNSigmaCut"}; - Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother track"}; - - HistogramRegistry registry{"registry", {}}; - - void init(InitContext const&) - { - if (doprocessData == false) { - auto hLabeledVtxCounter = registry.add("hLabeledVtxCounter", "hLabeledVtxCounter", HistType::kTH1F, {{3, 0.0f, 3.0f}}); - hLabeledVtxCounter->GetXaxis()->SetBinLabel(1, "Readin"); - hLabeledVtxCounter->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); - hLabeledVtxCounter->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); - registry.add("hMassTrueH3L", "hMassTrueH3L", HistType::kTH1F, {{80, 2.96f, 3.04f}}); - registry.add("hMassTrueH3LMatter", "hMassTrueH3LMatter", HistType::kTH1F, {{80, 2.96f, 3.04f}}); - registry.add("hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", HistType::kTH1F, {{80, 2.96f, 3.04f}}); - auto hPIDCounter = registry.add("hPIDCounter", "hPIDCounter", HistType::kTH1F, {{6, 0.0f, 6.0f}}); - hPIDCounter->GetXaxis()->SetBinLabel(1, "H3L Proton PID > 5"); - hPIDCounter->GetXaxis()->SetBinLabel(2, "H3L Pion PID > 5"); - hPIDCounter->GetXaxis()->SetBinLabel(3, "H3L Deuteron PID > 5"); - hPIDCounter->GetXaxis()->SetBinLabel(4, "#bar{H3L} Proton PID > 5"); - hPIDCounter->GetXaxis()->SetBinLabel(5, "#bar{H3L} Pion PID > 5"); - hPIDCounter->GetXaxis()->SetBinLabel(6, "#bar{H3L} Deuteron PID > 5"); - auto hHypertritonCounter = registry.add("hHypertritonCounter", "hHypertritonCounter", HistType::kTH1F, {{4, 0.0f, 4.0f}}); - hHypertritonCounter->GetXaxis()->SetBinLabel(1, "H3L"); - hHypertritonCounter->GetXaxis()->SetBinLabel(2, "H3L daughters pass PID"); - hHypertritonCounter->GetXaxis()->SetBinLabel(3, "#bar{H3L}"); - hHypertritonCounter->GetXaxis()->SetBinLabel(4, "#bar{H3L} daughters pass PID"); - auto hDecay3BodyCounter = registry.add("hDecay3BodyCounter", "hDecay3BodyCounter", HistType::kTH1F, {{5, 0.0f, 5.0f}}); - hDecay3BodyCounter->GetXaxis()->SetBinLabel(1, "Total"); - hDecay3BodyCounter->GetXaxis()->SetBinLabel(2, "True H3L"); - hDecay3BodyCounter->GetXaxis()->SetBinLabel(3, "Unduplicated H3L"); - hDecay3BodyCounter->GetXaxis()->SetBinLabel(4, "Correct collision"); - hDecay3BodyCounter->GetXaxis()->SetBinLabel(5, "Same ColID for daughters"); - registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton - registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion - registry.add("hDiffRVtxDeuteron", "hDiffRVtxDeuteron", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of deuteron - } - } - - struct Indexdaughters { // check duplicated paired daughters - int64_t index0; - int64_t index1; - int64_t index2; - bool operator==(const Indexdaughters& t) const - { - return (this->index0 == t.index0 && this->index1 == t.index1 && this->index2 == t.index2); - } - }; - - void processData(soa::Join::iterator const&) - { - // dummy function - } - PROCESS_SWITCH(hypertriton3bodyLabelCheck, processData, "Donot check MC label tables", true); - - void processCheckLabel(soa::Join::iterator const& collision, aod::Decay3Bodys const& decay3bodys, soa::Join const& vtx3bodydatas, MCLabeledTracksIU const& /*tracks*/, aod::McParticles const& /*particlesMC*/, aod::McCollisions const& /*mcCollisions*/) - { - // check the decay3body table - std::vector set_pair; - for (const auto& d3body : decay3bodys) { - registry.fill(HIST("hDecay3BodyCounter"), 0.5); - auto lTrack0 = d3body.track0_as(); - auto lTrack1 = d3body.track1_as(); - auto lTrack2 = d3body.track2_as(); - if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { - continue; - } - auto lMCTrack0 = lTrack0.mcParticle_as(); - auto lMCTrack1 = lTrack1.mcParticle_as(); - auto lMCTrack2 = lTrack2.mcParticle_as(); - if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { - continue; - } - - for (const auto& lMother0 : lMCTrack0.mothers_as()) { - for (const auto& lMother1 : lMCTrack1.mothers_as()) { - for (const auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - registry.fill(HIST("hDecay3BodyCounter"), 1.5); - // duplicated daughters check - Indexdaughters temp = {lMCTrack0.globalIndex(), lMCTrack1.globalIndex(), lMCTrack2.globalIndex()}; - auto p = std::find(set_pair.begin(), set_pair.end(), temp); - if (p == set_pair.end()) { - set_pair.push_back(temp); - registry.fill(HIST("hDecay3BodyCounter"), 2.5); - if (lMother0.mcCollisionId() == collision.mcCollisionId()) { - registry.fill(HIST("hDecay3BodyCounter"), 3.5); - if (lTrack0.collisionId() == lTrack1.collisionId() && lTrack0.collisionId() == lTrack2.collisionId()) { - registry.fill(HIST("hDecay3BodyCounter"), 4.5); - } - } - } - } - } - } - } - } - - if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - return; - } - - if (event_posZ_selection && std::abs(collision.posZ()) > 10.f) { // 10cm - return; - } - - std::vector set_mothertrack; - for (const auto& vtx : vtx3bodydatas) { - registry.fill(HIST("hLabeledVtxCounter"), 0.5); - if (vtx.mcParticleId() != -1) { - auto mcparticle = vtx.mcParticle_as(); - auto lTrack0 = vtx.track0_as(); - auto lTrack1 = vtx.track1_as(); - auto lTrack2 = vtx.track2_as(); - if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { - continue; - } - registry.fill(HIST("hLabeledVtxCounter"), 1.5); - registry.fill(HIST("hDiffRVtxDeuteron"), lTrack2.x() - vtx.vtxradius()); - if (mcparticle.pdgCode() > 0) { - registry.fill(HIST("hHypertritonCounter"), 0.5); - registry.fill(HIST("hMassTrueH3L"), vtx.mHypertriton()); - registry.fill(HIST("hMassTrueH3LMatter"), vtx.mHypertriton()); - registry.fill(HIST("hDiffRVtxProton"), lTrack0.x() - vtx.vtxradius()); - registry.fill(HIST("hDiffRVtxPion"), lTrack1.x() - vtx.vtxradius()); - auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); - if (p == set_mothertrack.end()) { - set_mothertrack.push_back(mcparticle.globalIndex()); - registry.fill(HIST("hLabeledVtxCounter"), 2.5); - } - if (std::abs(lTrack0.tpcNSigmaPr()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 0.5); - } - if (std::abs(lTrack1.tpcNSigmaPi()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 1.5); - } - if (std::abs(lTrack2.tpcNSigmaDe()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 2.5); - } - if (std::abs(lTrack0.tpcNSigmaPr()) < tpcPIDNSigmaCut && std::abs(lTrack1.tpcNSigmaPi()) < tpcPIDNSigmaCut && std::abs(lTrack2.tpcNSigmaDe()) < tpcPIDNSigmaCut) { - registry.fill(HIST("hHypertritonCounter"), 1.5); - } - } else { - registry.fill(HIST("hHypertritonCounter"), 2.5); - registry.fill(HIST("hMassTrueH3L"), vtx.mAntiHypertriton()); - registry.fill(HIST("hMassTrueH3LAntiMatter"), vtx.mAntiHypertriton()); - registry.fill(HIST("hDiffRVtxProton"), lTrack1.x() - vtx.vtxradius()); - registry.fill(HIST("hDiffRVtxPion"), lTrack0.x() - vtx.vtxradius()); - auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); - if (p == set_mothertrack.end()) { - set_mothertrack.push_back(mcparticle.globalIndex()); - registry.fill(HIST("hLabeledVtxCounter"), 2.5); - } - if (std::abs(lTrack0.tpcNSigmaPi()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 4.5); - } - if (std::abs(lTrack1.tpcNSigmaPr()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 3.5); - } - if (std::abs(lTrack2.tpcNSigmaDe()) > tpcPIDNSigmaCut) { - registry.fill(HIST("hPIDCounter"), 5.5); - } - if (std::abs(lTrack0.tpcNSigmaPi()) < tpcPIDNSigmaCut && std::abs(lTrack1.tpcNSigmaPr()) < tpcPIDNSigmaCut && std::abs(lTrack2.tpcNSigmaDe()) < tpcPIDNSigmaCut) { - registry.fill(HIST("hHypertritonCounter"), 3.5); - } - } - } - } - } - PROCESS_SWITCH(hypertriton3bodyLabelCheck, processCheckLabel, "Check MC label tables", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - }; -} diff --git a/PWGLF/Utils/decay3bodyBuilderHelper.h b/PWGLF/Utils/decay3bodyBuilderHelper.h new file mode 100644 index 00000000000..550625f2fc6 --- /dev/null +++ b/PWGLF/Utils/decay3bodyBuilderHelper.h @@ -0,0 +1,838 @@ +// 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_UTILS_DECAY3BODYBUILDERHELPER_H_ +#define PWGLF_UTILS_DECAY3BODYBUILDERHELPER_H_ + +#include +#include +#include +#include "DCAFitter/DCAFitterN.h" +#include "Framework/AnalysisDataModel.h" +#include "ReconstructionDataFormats/Track.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsVertexing/SVertexHypothesis.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/trackUtilities.h" +#include "Common/Core/RecoDecay.h" +#include "Tools/KFparticle/KFUtilities.h" + +#ifndef HomogeneousField +#define HomogeneousField +#endif + +/// includes KFParticle +#include "KFParticle.h" +#include "KFPTrack.h" +#include "KFPVertex.h" +#include "KFParticleBase.h" +#include "KFVertex.h" + +namespace o2 +{ +namespace pwglf +{ + +//_______________________________________________________________________ +// Deca3body information storage +struct decay3bodyCandidate { + // indexing + int collisionID = -1; + int decay3bodyID = -1; + int protonID = -1; + int pionID = -1; + int deuteronID = -1; + + // daughter properties + std::array momProton = {0.0f, 0.0f, 0.0f}; + std::array momPion = {0.0f, 0.0f, 0.0f}; + std::array momDeuteron = {0.0f, 0.0f, 0.0f}; + std::array posProton = {0.0f, 0.0f, 0.0f}; + std::array posPion = {0.0f, 0.0f, 0.0f}; + std::array posDeuteron = {0.0f, 0.0f, 0.0f}; + std::array trackDCAxyToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array trackDCAzToPV = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array tpcNsigma = {0.0f, 0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp + double tofNsigmaDeuteron = 0.0f; + std::array averageITSClSize = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + std::array tpcNCl = {0.0f, 0.0f, 0.0f}; // 0 - proton, 1 - pion, 2 - deuteron + int pidForTrackingDeuteron = 0; + + // vertex properties + float mass; + float massV0; + 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 daughterDCAatSV = 0.0f; // quadratic sum of DCA between daughters at SV + std::array daughterDCAtoSV = {0.0f, 0.0f, 0.0f}; // 0 - pos, 1 - neg, 2 - bach + + // covariance matrix + float covProton[21] = {0.0f}; + float covPion[21] = {0.0f}; + float covDeuteron[21] = {0.0f}; + float covariance[21] = {0.0f}; +}; + +//_______________________________________________________________________ +// builder helper class +class decay3bodyBuilderHelper +{ + public: + decay3bodyBuilderHelper() + { + fitter3body.setPropagateToPCA(true); + fitter3body.setMaxR(200.); //->maxRIni3body + fitter3body.setMinParamChange(1e-3); + fitter3body.setMinRelChi2Change(0.9); + fitter3body.setMaxDZIni(1e9); + fitter3body.setMaxDXYIni(4.0f); + fitter3body.setMaxChi2(1e9); + fitter3body.setUseAbsDCA(true); + + fitterV0.setPropagateToPCA(true); + fitterV0.setMaxR(200.); + fitterV0.setMinParamChange(1e-3); + fitterV0.setMinRelChi2Change(0.9); + fitterV0.setMaxDZIni(1e9); + fitterV0.setMaxChi2(1e9); + fitterV0.setUseAbsDCA(true); + + // mag field has to be set later + fitter3body.setBz(-999.9f); // will NOT make sense if not changed + }; + + o2::vertexing::DCAFitterN<2> fitterV0; // 2-prong o2 dca fitter + o2::vertexing::DCAFitterN<3> fitter3body; // 3-prong o2 dca fitter + + decay3bodyCandidate decay3body; // storage for Decay3body candidate properties + + o2::dataformats::VertexBase mMeanVertex{{0., 0., 0.}, {0.1 * 0.1, 0., 0.1 * 0.1, 0., 0., 6. * 6.}}; + o2::vertexing::SVertexHypothesis mV0Hyps; // 0 - Lambda, 1 - AntiLambda + + // decay3body candidate criteria + struct { + // daughter tracks + float maxEtaDaughters; + int minTPCNClProton; + int minTPCNClPion; + int minTPCNClDeuteron; + float minDCAProtonToPV; + float minDCAPionToPV; + float minDCADeuteronToPV; + float minPtProton; + float minPtPion; + float minPtDeuteron; + float maxPtProton; + float maxPtPion; + float maxPtDeuteron; + float maxTPCnSigma; + double minTOFnSigmaDeuteron; + double maxTOFnSigmaDeuteron; + float minPDeuteronUseTOF; + float maxDCADauAtSV; + // candidate + float maxRapidity; + float minPt; + float maxPt; + float minMass; + float maxMass; + float minCtau; + float maxCtau; + float minCosPA; + float maxChi2; + } decay3bodyselections; + + // SVertexer selection criteria + struct { + float minPt2V0; + float maxTgl2V0; + float maxDCAXY2ToMeanVertex3bodyV0; + float minCosPAXYMeanVertex3bodyV0; + float minCosPA3bodyV0; + float maxRDiffV03body; + float minPt3Body; + float maxTgl3Body; + float maxDCAXY3Body; + float maxDCAZ3Body; + } svertexerselections; + + //_______________________________________________________________________ + // build Decay3body from three tracks, including V0 building. + template + bool buildDecay3BodyCandidate(TCollision const& collision, + TTrack const& trackProton, + TTrack const& trackPion, + TTrack const& trackDeuteron, + int decay3bodyIndex, + double tofNsigmaDeuteron, + float trackedClSize, + bool useKFParticle = false, + bool kfSetTopologicalConstraint = false, + bool useSelections = true, + bool useTPCforPion = false, + bool acceptTPCOnly = false, + bool calculateCovariance = true, + bool isEventMixing = false) + { + int collisionIndex = collision.globalIndex(); + float pvX = collision.posX(); + float pvY = collision.posY(); + float pvZ = collision.posZ(); + + auto trackParCovProton = getTrackParCov(trackProton); + auto trackParCovPion = getTrackParCov(trackPion); + auto trackParCovDeuteron = getTrackParCov(trackDeuteron); + + decay3body.collisionID = collisionIndex; + decay3body.decay3bodyID = decay3bodyIndex; + decay3body.protonID = trackProton.globalIndex(); + decay3body.pionID = trackPion.globalIndex(); + decay3body.deuteronID = trackDeuteron.globalIndex(); + + //_______________________________________________________________________ + // track selections + if (useSelections) { + // proton track quality + if (trackProton.tpcNClsFound() < decay3bodyselections.minTPCNClProton) { + decay3body = {}; + return false; + } + // pion track quality + if (useTPCforPion) { + if (trackPion.tpcNClsFound() < decay3bodyselections.minTPCNClPion) { + decay3body = {}; + return false; + } + } + // deuteron track quality + if (trackDeuteron.tpcNClsFound() < decay3bodyselections.minTPCNClDeuteron) { + decay3body = {}; + return false; + } + + // track eta + if (std::fabs(trackProton.eta()) > decay3bodyselections.maxEtaDaughters) { + decay3body = {}; + return false; + } + if (std::fabs(trackPion.eta()) > decay3bodyselections.maxEtaDaughters) { + decay3body = {}; + return false; + } + if (std::fabs(trackDeuteron.eta()) > decay3bodyselections.maxEtaDaughters) { + decay3body = {}; + return false; + } + + // TPC only + if (!acceptTPCOnly && (!trackProton.hasITS() || !trackPion.hasITS() || !trackDeuteron.hasITS())) { + decay3body = {}; + return false; + } + + // daughter TPC PID + if (std::fabs(trackProton.tpcNSigmaPr()) > decay3bodyselections.maxTPCnSigma) { + decay3body = {}; + return false; + } + if (useTPCforPion && std::fabs(trackPion.tpcNSigmaPi()) > decay3bodyselections.maxTPCnSigma) { + decay3body = {}; + return false; + } + if (std::fabs(trackDeuteron.tpcNSigmaDe()) > decay3bodyselections.maxTPCnSigma) { + decay3body = {}; + return false; + } + + // deuteron TOF PID + if ((tofNsigmaDeuteron < decay3bodyselections.minTOFnSigmaDeuteron || tofNsigmaDeuteron > decay3bodyselections.maxTOFnSigmaDeuteron) && trackDeuteron.p() > decay3bodyselections.minPDeuteronUseTOF) { + decay3body = {}; + return false; + } + } // end of selections + + //_______________________________________________________________________ + // daughter track DCA to PV associated with decay3body + o2::dataformats::VertexBase mPV; + o2::dataformats::DCA mDcaInfoCov; + auto trackParCovProtonCopy = trackParCovProton; + auto trackParCovPionCopy = trackParCovPion; + auto trackParCovDeuteronCopy = trackParCovDeuteron; + mPV.setPos({pvX, pvY, pvZ}); + mPV.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + + // proton track + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovProtonCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPV[0] = mDcaInfoCov.getY(); + decay3body.trackDCAzToPV[0] = mDcaInfoCov.getZ(); + auto trackProtonDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[0] * decay3body.trackDCAxyToPV[0] + decay3body.trackDCAzToPV[0] * decay3body.trackDCAzToPV[0]); + if (useSelections) { + if (trackProtonDCAToPV < decay3bodyselections.minDCAProtonToPV) { + decay3body = {}; + return false; + } + } + // pion track + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovPionCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPV[1] = mDcaInfoCov.getY(); + decay3body.trackDCAzToPV[1] = mDcaInfoCov.getZ(); + auto trackPionDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[1] * decay3body.trackDCAxyToPV[1] + decay3body.trackDCAzToPV[1] * decay3body.trackDCAzToPV[1]); + if (useSelections) { + if (trackPionDCAToPV < decay3bodyselections.minDCAPionToPV) { + decay3body = {}; + return false; + } + } + // deuteron track + o2::base::Propagator::Instance()->propagateToDCABxByBz(mPV, trackParCovDeuteronCopy, 2.f, fitter3body.getMatCorrType(), &mDcaInfoCov); + decay3body.trackDCAxyToPV[2] = mDcaInfoCov.getY(); + decay3body.trackDCAzToPV[2] = mDcaInfoCov.getZ(); + auto trackDeuteronDCAToPV = std::sqrt(decay3body.trackDCAxyToPV[2] * decay3body.trackDCAxyToPV[2] + decay3body.trackDCAzToPV[2] * decay3body.trackDCAzToPV[2]); + if (useSelections) { + if (trackDeuteronDCAToPV < decay3bodyselections.minDCADeuteronToPV) { + decay3body = {}; + return false; + } + } + + //_______________________________________________________________________ + // fit 3body vertex + if (!useKFParticle) { + fitVertexWithDCAFitter(trackProton, trackPion, trackDeuteron, calculateCovariance); + } else { + fitVertexWithKF(collision, trackProton, trackPion, trackDeuteron, kfSetTopologicalConstraint, calculateCovariance); + } + + //_______________________________________________________________________ + // get vertex information + // daughter pT + auto trackProtonPt = std::sqrt(decay3body.momProton[0] * decay3body.momProton[0] + decay3body.momProton[1] * decay3body.momProton[1]); + 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( + decay3body.posProton[0] - decay3body.position[0], + decay3body.posProton[1] - decay3body.position[1], + decay3body.posProton[2] - decay3body.position[2]); + // pion daughter + decay3body.daughterDCAtoSV[1] = std::hypot( + decay3body.posPion[0] - decay3body.position[0], + decay3body.posPion[1] - decay3body.position[1], + decay3body.posPion[2] - decay3body.position[2]); + // deuteron daughter + decay3body.daughterDCAtoSV[2] = std::hypot( + decay3body.posDeuteron[0] - decay3body.position[0], + decay3body.posDeuteron[1] - decay3body.position[1], + decay3body.posDeuteron[2] - decay3body.position[2]); + + //_____________________________________________________ + // selections after vertex fit + if (useSelections) { + // daughter pT + // proton + if (trackProtonPt < decay3bodyselections.minPtProton || trackProtonPt > decay3bodyselections.maxPtProton) { + decay3body = {}; + return false; + } + // pion + if (trackPionPt < decay3bodyselections.minPtPion || trackPionPt > decay3bodyselections.maxPtPion) { + decay3body = {}; + return false; + } + // deuteron + if (trackDeuteronPt < decay3bodyselections.minPtDeuteron || trackDeuteronPt > decay3bodyselections.maxPtDeuteron) { + decay3body = {}; + return false; + } + + // daughter DCAs at SV + if (decay3body.daughterDCAatSV > decay3bodyselections.maxDCADauAtSV) { + decay3body = {}; + return false; + } + + // rapidity + float rapidity = RecoDecay::y(std::array{decay3body.momentum[0], decay3body.momentum[1], decay3body.momentum[2]}, o2::constants::physics::MassHyperTriton); + if (std::fabs(rapidity) > decay3bodyselections.maxRapidity) { + decay3body = {}; + return false; + } + + // pT + float pT = RecoDecay::pt(std::array{decay3body.momentum[0], decay3body.momentum[1], decay3body.momentum[2]}); + if (pT < decay3bodyselections.minPt || pT > decay3bodyselections.maxPt) { + decay3body = {}; + return false; + } + + // mass window + if (decay3body.mass < decay3bodyselections.minMass || decay3body.mass > decay3bodyselections.maxMass) { + decay3body = {}; + return false; + } + + // pointing angle + float cpa = RecoDecay::cpa(std::array{pvX, pvY, pvZ}, std::array{decay3body.position[0], decay3body.position[1], decay3body.position[2]}, std::array{decay3body.momentum[0], decay3body.momentum[1], decay3body.momentum[2]}); + if (cpa < decay3bodyselections.minCosPA) { + decay3body = {}; + return false; + } + + // vertex chi2 + if (decay3body.chi2 > decay3bodyselections.maxChi2) { + decay3body = {}; + return false; + } + + // ctau + float P = RecoDecay::sqrtSumOfSquares(decay3body.momentum[0], decay3body.momentum[1], decay3body.momentum[2]); + float ctau = std::sqrt(std::pow(decay3body.position[0] - pvX, 2) + std::pow(decay3body.position[1] - pvY, 2) + std::pow(decay3body.position[2] - pvZ, 2)) / (P + 1E-10) * o2::constants::physics::MassHyperTriton; + if (ctau < decay3bodyselections.minCtau || ctau > decay3bodyselections.maxCtau) { + decay3body = {}; + return false; + } + } + + //_______________________________________________________________________ + // SVertexer selections in case of event mixing + if (isEventMixing) { + applySVertexerCuts(collision, trackProton, trackPion, trackDeuteron, /*applyV0Cut = */ true); + } + + //_______________________________________________________________________ + // fill remaining candidate information + // daughter PID + decay3body.tpcNsigma[0] = trackProton.tpcNSigmaPr(); + decay3body.tpcNsigma[1] = trackPion.tpcNSigmaPi(); + decay3body.tpcNsigma[2] = trackDeuteron.tpcNSigmaDe(); + decay3body.tpcNsigma[3] = trackDeuteron.tpcNSigmaPi(); + // recalculated bachelor TOF PID + decay3body.tofNsigmaDeuteron = tofNsigmaDeuteron; + + // average ITS cluster size of daughter tracks + double averageClusterSizeProton(0), averageClusterSizePion(0), averageClusterSizeDeuteron(0); + int nClsProton(0), nClsPion(0), nClsDeuteron(0); + for (int i = 0; i < 7; i++) { + int clusterSizePr = trackProton.itsClsSizeInLayer(i); + int clusterSizePi = trackPion.itsClsSizeInLayer(i); + int clusterSizeDe = trackDeuteron.itsClsSizeInLayer(i); + averageClusterSizeProton += static_cast(clusterSizePr); + averageClusterSizePion += static_cast(clusterSizePi); + averageClusterSizeDeuteron += static_cast(clusterSizeDe); + if (clusterSizePr > 0) + nClsProton++; + if (clusterSizePi > 0) + nClsPion++; + if (clusterSizeDe > 0) + nClsDeuteron++; + } + averageClusterSizeProton = averageClusterSizeProton / static_cast(nClsProton); + averageClusterSizePion = averageClusterSizePion / static_cast(nClsPion); + averageClusterSizeDeuteron = averageClusterSizeDeuteron / static_cast(nClsDeuteron); + decay3body.averageITSClSize[0] = averageClusterSizeProton; + decay3body.averageITSClSize[1] = averageClusterSizePion; + decay3body.averageITSClSize[2] = averageClusterSizeDeuteron; + + // number of TPC clusters + decay3body.tpcNCl[0] = trackProton.tpcNClsFound(); + decay3body.tpcNCl[1] = trackPion.tpcNClsFound(); + decay3body.tpcNCl[2] = trackDeuteron.tpcNClsFound(); + + // PID for tracking of deuteron track + decay3body.pidForTrackingDeuteron = trackDeuteron.pidForTracking(); + + // tracked cluster size + decay3body.trackedClSize = trackedClSize; + + return true; + } + + //___________________________________________________________________________________ + // functionality to fit 3body vertex with KFParticle and fill vertex information + template + void fitVertexWithKF(TCollision const& collision, + TTrack const& trackProton, + TTrack const& trackPion, + TTrack const& trackDeuteron, + bool kfSetTopologicalConstraint = true, + bool calculateCovariance = true) + { + // get TrackParCov daughters + auto trackParCovProton = getTrackParCov(trackProton); + auto trackParCovPion = getTrackParCov(trackPion); + auto trackParCovDeuteron = getTrackParCov(trackDeuteron); + + // initialise KF primary vertex + KFVertex kfpVertex = createKFPVertexFromCollision(collision); + KFParticle kfpv(kfpVertex); + + // create KFParticle objects + KFParticle kfpProton, kfpPion, kfpDeuteron; + kfpProton = createKFParticleFromTrackParCov(trackParCovProton, trackProton.sign(), constants::physics::MassProton); + kfpPion = createKFParticleFromTrackParCov(trackParCovPion, trackPion.sign(), constants::physics::MassPionCharged); + kfpDeuteron = createKFParticleFromTrackParCov(trackParCovDeuteron, trackDeuteron.sign(), constants::physics::MassDeuteron); + + // construct V0 vertex + KFParticle KFV0; + int nDaughtersV0 = 2; + const KFParticle* DaughtersV0[2] = {&kfpProton, &kfpPion}; + KFV0.SetConstructMethod(2); + try { + KFV0.Construct(DaughtersV0, nDaughtersV0); + } catch (std::runtime_error& e) { + LOG(debug) << "Failed to create V0 vertex." << e.what(); + return; + } + + // construct vertex + KFParticle KFH3L; + int nDaughters3body = 3; + const KFParticle* Daughters3body[3] = {&kfpProton, &kfpPion, &kfpDeuteron}; + KFH3L.SetConstructMethod(2); + try { + KFH3L.Construct(Daughters3body, nDaughters3body); + } catch (std::runtime_error& e) { + LOG(debug) << "Failed to create Hyper triton 3-body vertex." << e.what(); + return; + } + + // topological constraint + if (kfSetTopologicalConstraint) { + KFH3L.SetProductionVertex(kfpv); + KFH3L.TransportToDecayVertex(); + } + + // get vertex position and momentum + decay3body.position[0] = KFH3L.GetX(); + decay3body.position[1] = KFH3L.GetY(); + decay3body.position[2] = KFH3L.GetZ(); + decay3body.momentum[0] = KFH3L.GetPx(); + decay3body.momentum[1] = KFH3L.GetPy(); + decay3body.momentum[2] = KFH3L.GetPz(); + + // get sign + decay3body.sign = KFH3L.GetQ() / std::abs(KFH3L.GetQ()); + + // transport all daughter tracks to hypertriton vertex + kfpProton.TransportToPoint(decay3body.position); + kfpPion.TransportToPoint(decay3body.position); + kfpDeuteron.TransportToPoint(decay3body.position); + + // daughter positions + decay3body.posProton[0] = kfpProton.GetX(); + decay3body.posProton[1] = kfpProton.GetY(); + decay3body.posProton[2] = kfpProton.GetZ(); + decay3body.posPion[0] = kfpPion.GetX(); + decay3body.posPion[1] = kfpPion.GetY(); + decay3body.posPion[2] = kfpPion.GetZ(); + decay3body.posDeuteron[0] = kfpDeuteron.GetX(); + decay3body.posDeuteron[1] = kfpDeuteron.GetY(); + decay3body.posDeuteron[2] = kfpDeuteron.GetZ(); + + // daughter momenta + decay3body.momProton[0] = kfpProton.GetPx(); + decay3body.momProton[1] = kfpProton.GetPy(); + decay3body.momProton[2] = kfpProton.GetPz(); + decay3body.momPion[0] = kfpPion.GetPx(); + decay3body.momPion[1] = kfpPion.GetPy(); + decay3body.momPion[2] = kfpPion.GetPz(); + decay3body.momDeuteron[0] = kfpDeuteron.GetPx(); + decay3body.momDeuteron[1] = kfpDeuteron.GetPy(); + decay3body.momDeuteron[2] = kfpDeuteron.GetPz(); + + // candidate mass + float mass, massErr; + KFH3L.GetMass(mass, massErr); + decay3body.mass = mass; + + // V0 mass + float massV0, massV0Err; + KFV0.GetMass(massV0, massV0Err); + decay3body.massV0 = massV0; + + // vertex chi2 + decay3body.chi2 = KFH3L.GetChi2() / KFH3L.GetNDF(); + + // caluclate covariance matrices + if (calculateCovariance) { + // candidate covariance matrix + std::array covKF; + for (int i = 0; i < 21; i++) { // get covariance matrix elements (lower triangle) + covKF[i] = KFH3L.GetCovariance(i); + decay3body.covariance[i] = covKF[i]; + } + // daughter track covariance matrices + for (int i = 0; i < 21; i++) { // get covariance matrix elements (lower triangle) + decay3body.covProton[i] = kfpProton.GetCovariance(i); + decay3body.covPion[i] = kfpPion.GetCovariance(i); + decay3body.covDeuteron[i] = kfpDeuteron.GetCovariance(i); + } + } + + return; + } + + //_______________________________________________________________________ + // functionality to fit 3body vertex with DCAFitter + template + void fitVertexWithDCAFitter(TTrack const& trackProton, + TTrack const& trackPion, + TTrack const& trackDeuteron, + bool calculateCovariance = true) + { + // get TrackParCov daughters + auto trackParCovProton = getTrackParCov(trackProton); + auto trackParCovPion = getTrackParCov(trackPion); + auto trackParCovDeuteron = getTrackParCov(trackDeuteron); + + // fit the vertex + int n3bodyVtx = fitter3body.process(trackParCovProton, trackParCovPion, trackParCovDeuteron); + if (n3bodyVtx == 0) { // discard this pair + return; + } + + // get vertex position + const auto& vtxXYZ = fitter3body.getPCACandidate(); + for (int i = 0; i < 3; i++) { + decay3body.position[i] = vtxXYZ[i]; + } + + // get daughter momenta + const auto& propagatedTrackProton = fitter3body.getTrack(0); + const auto& propagatedTrackPion = fitter3body.getTrack(1); + const auto& propagatedTrackDeuteron = fitter3body.getTrack(2); + propagatedTrackProton.getPxPyPzGlo(decay3body.momProton); + propagatedTrackPion.getPxPyPzGlo(decay3body.momPion); + propagatedTrackDeuteron.getPxPyPzGlo(decay3body.momDeuteron); + propagatedTrackProton.getXYZGlo(decay3body.posProton); + propagatedTrackPion.getXYZGlo(decay3body.posPion); + propagatedTrackDeuteron.getXYZGlo(decay3body.posDeuteron); + + // get daughter positions at vertex + + // calculate candidate momentum + decay3body.momentum[0] = decay3body.momProton[0] + decay3body.momPion[0] + decay3body.momDeuteron[0]; + decay3body.momentum[1] = decay3body.momProton[1] + decay3body.momPion[1] + decay3body.momDeuteron[1]; + decay3body.momentum[2] = decay3body.momProton[2] + decay3body.momPion[2] + decay3body.momDeuteron[2]; + + // candidate and V0 mass + decay3body.mass = RecoDecay::m( + std::array{std::array{decay3body.momProton[0], decay3body.momProton[1], decay3body.momProton[2]}, + std::array{decay3body.momPion[0], decay3body.momPion[1], decay3body.momPion[2]}, + std::array{decay3body.momDeuteron[0], decay3body.momDeuteron[1], decay3body.momDeuteron[2]}}, + std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + decay3body.massV0 = RecoDecay::m( + std::array{std::array{decay3body.momProton[0], decay3body.momProton[1], decay3body.momProton[2]}, + std::array{decay3body.momPion[0], decay3body.momPion[1], decay3body.momPion[2]}}, + std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + + // vertex chi2 at PCA + decay3body.chi2 = fitter3body.getChi2AtPCACandidate(); + + // candidate sign + decay3body.sign = trackDeuteron.sign(); + + // caluclate covariance matrices + if (calculateCovariance) { + // candidate position covariance matrix + auto covVtxV = fitter3body.calcPCACovMatrix(0); + decay3body.covariance[0] = covVtxV(0, 0); + decay3body.covariance[1] = covVtxV(1, 0); + decay3body.covariance[2] = covVtxV(1, 1); + decay3body.covariance[3] = covVtxV(2, 0); + decay3body.covariance[4] = covVtxV(2, 1); + decay3body.covariance[5] = covVtxV(2, 2); + // daughter covariance matrices + std::array covTproton = {0.}; + std::array covTpion = {0.}; + std::array covTdeuteron = {0.}; + propagatedTrackProton.getCovXYZPxPyPzGlo(covTproton); + propagatedTrackPion.getCovXYZPxPyPzGlo(covTpion); + propagatedTrackDeuteron.getCovXYZPxPyPzGlo(covTdeuteron); + for (int i = 0; i < 21; i++) { + decay3body.covProton[i] = covTproton[i]; + decay3body.covPion[i] = covTpion[i]; + decay3body.covDeuteron[i] = covTdeuteron[i]; + } + // candidate momentum covairance matrix + constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 6; i++) { + decay3body.covariance[MomInd[i]] = covTproton[MomInd[i]] + covTpion[MomInd[i]] + covTdeuteron[MomInd[i]]; + } + /// WARNING: position-momentum covariances are not calculated in the DCAFitter - remain zero + } + + return; + } + + //_______________________________________________________________________ + // functionality to apply SVertexer cuts in case of event mixing + template + void applySVertexerCuts(TCollision const& collision, + TTrack const& trackProton, + TTrack const& trackPion, + TTrack const& trackDeuteron, + bool applyV0Cut = true) + { + // get TrackParCov daughters + auto trackParCovProton = getTrackParCov(trackProton); + auto trackParCovPion = getTrackParCov(trackPion); + auto trackParCovDeuteron = getTrackParCov(trackDeuteron); + + const float pidCutsLambda[o2::vertexing::SVertexHypothesis::NPIDParams] = {0., 20, 0., 5.0, 0.0, 1.09004e-03, 2.62291e-04, 8.93179e-03, 2.83121}; // Lambda + mV0Hyps.set(o2::track::PID::Lambda, o2::track::PID::Proton, o2::track::PID::Pion, pidCutsLambda, fitter3body.getBz()); + + int nV0 = fitterV0.process(trackParCovProton, trackParCovPion); + if (nV0 == 0) { + return; + } + + std::array v0pos = {0.}; + const auto& v0vtxXYZ = fitterV0.getPCACandidate(); + for (int i = 0; i < 3; i++) { + v0pos[i] = v0vtxXYZ[i]; + } + const int cand = 0; + if (!fitterV0.isPropagateTracksToVertexDone(cand) && !fitterV0.propagateTracksToVertex(cand)) { + return; + } + + const auto& trProtonProp = fitterV0.getTrack(0, cand); + const auto& trPionProp = fitterV0.getTrack(1, cand); + std::array pProtonV0{}, pPionV0{}; + trProtonProp.getPxPyPzGlo(pProtonV0); + trPionProp.getPxPyPzGlo(pPionV0); + std::array pV0 = {pProtonV0[0] + pPionV0[0], pProtonV0[1] + pPionV0[1], pProtonV0[2] + pPionV0[2]}; + // Cut for Virtual V0 + float dxv0 = v0pos[0] - mMeanVertex.getX(), dyv0 = v0pos[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; + float rv0 = std::sqrt(r2v0); + float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; + if (applyV0Cut && pt2V0 <= svertexerselections.minPt2V0) { + return; + } + if (applyV0Cut && pV0[2] * pV0[2] / pt2V0 > svertexerselections.maxTgl2V0) { // tgLambda cut + return; + } + + float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); + // apply mass selections + float p2Proton = pProtonV0[0] * pProtonV0[0] + pProtonV0[1] * pProtonV0[1] + pProtonV0[2] * pProtonV0[2], p2Pion = pPionV0[0] * pPionV0[0] + pPionV0[1] * pPionV0[1] + pPionV0[2] * pPionV0[2]; + bool good3bodyV0Hyp = false; + float massForLambdaHyp = mV0Hyps.calcMass(p2Proton, p2Pion, p2V0); + if (massForLambdaHyp - mV0Hyps.getMassV0Hyp() < mV0Hyps.getMargin(ptV0)) { + good3bodyV0Hyp = true; + } + if (applyV0Cut && !good3bodyV0Hyp) { + return; + } + + float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; + float cosPAXY = prodXYv0 / rv0 * ptV0; + if (applyV0Cut && dca2 > svertexerselections.maxDCAXY2ToMeanVertex3bodyV0) { + return; + } + // FIXME: V0 cosPA cut to be investigated + if (applyV0Cut && cosPAXY < svertexerselections.minCosPAXYMeanVertex3bodyV0) { + return; + } + // Check: CosPA Cut of Virtual V0 may not be used since the V0 may be based on another PV + float dx = v0pos[0] - collision.posX(); + float dy = v0pos[1] - collision.posY(); + float dz = v0pos[2] - collision.posZ(); + float prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; + float v0CosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); + if (applyV0Cut && v0CosPA < svertexerselections.minCosPA3bodyV0) { + return; + } + + // 3body vertex + int n3bodyVtx = fitter3body.process(trackParCovProton, trackParCovPion, trackParCovDeuteron); + if (n3bodyVtx == 0) { // discard this pair + return; + } + const auto& vertexXYZ = fitter3body.getPCACandidatePos(); + std::array pos = {0.}; + for (int i = 0; i < 3; i++) { + pos[i] = vertexXYZ[i]; + } + + std::array pProton = {0.}, pPion = {0.}, pDeuteron{0.}; + const auto& propagatedTrackProton = fitter3body.getTrack(0); + const auto& propagatedTrackPion = fitter3body.getTrack(1); + const auto& propagatedTrackDeuteron = fitter3body.getTrack(2); + propagatedTrackProton.getPxPyPzGlo(pProton); + propagatedTrackPion.getPxPyPzGlo(pPion); + propagatedTrackDeuteron.getPxPyPzGlo(pDeuteron); + std::array p3B = {pProton[0] + pPion[0] + pDeuteron[0], pProton[1] + pPion[1] + pDeuteron[1], pProton[2] + pPion[2] + pDeuteron[2]}; + + float r3body = std::hypot(pos[0], pos[1]); + if (r3body < 0.5) { + return; + } + + // Cut for the compatibility of V0 and 3body vertex + float deltaR = std::abs(rv0 - r3body); + if (deltaR > svertexerselections.maxRDiffV03body) { + return; + } + + float pt3B = std::hypot(p3B[0], p3B[1]); + if (pt3B < svertexerselections.minPt3Body) { // pt cut + return; + } + if (p3B[2] / pt3B > svertexerselections.maxTgl3Body) { // tgLambda cut + return; + } + + // H3L DCA Check + auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, trackDeuteron.sign()); + o2::dataformats::DCA dca; + if (!track3B.propagateToDCA({{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || + std::abs(dca.getY()) > svertexerselections.maxDCAXY3Body || std::abs(dca.getZ()) > svertexerselections.maxDCAZ3Body) { + return; + } + + return; + } + + private: + // internal helper to calculate DCA (3D) of a straight line to a given PV analytically + float CalculateDCAStraightToPV(float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) + { + return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); + } +}; + +} // namespace pwglf +} // namespace o2 + +#endif // PWGLF_UTILS_DECAY3BODYBUILDERHELPER_H_ From 55286a01dfcc160df461f4c9779872d5b5e0fb52 Mon Sep 17 00:00:00 2001 From: chengtt0406 <39661669+chengtt0406@users.noreply.github.com> Date: Thu, 12 Jun 2025 15:49:47 +0800 Subject: [PATCH 034/116] [PWGHF] Remove indexRexCharmBaryon=-1 case for MC rec matching (#11556) --- PWGHF/TableProducer/treeCreatorOmegacSt.cxx | 81 +++++++++++---------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index 8d2780cd435..4d3c59cfcd1 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -15,39 +15,41 @@ /// \author Jochen Klein /// \author Tiantian Cheng -#include -#include -#include -#include +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.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 "DCAFitter/DCAFitterN.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" -#include "DCAFitter/DCAFitterN.h" #include "DetectorsBase/Propagator.h" -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" +#include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoA.h" #include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" + +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -369,8 +371,7 @@ struct HfTreeCreatorOmegacSt { } else if (idxKaonDaughter >= 0 && idxCascDaughter >= 0) { decayChannel = o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK; // OmegaC -> Omega + K } else { - decayChannel = -1; - LOG(warning) << "Decay channel not recognized!"; + decayChannel = -1; // LOG(warning) << "Decay channel not recognized!"; } if (decayChannel != -1) { int idxDaughter = (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) ? idxPionDaughter : idxKaonDaughter; @@ -662,32 +663,36 @@ struct HfTreeCreatorOmegacSt { // Match Omegac0 → Omega- + Pi+ indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughters, o2::constants::physics::kOmegaC0, std::array{+kPiPlus, +kKMinus, +kProton, +kPiMinus}, true, &sign, 3, &nPiToMuOmegac0, &nKaToPiOmegac0); + indexRecCharmBaryon = indexRec; + if (indexRec > -1) { + // Omega- → K pi p (Cascade match) + indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersCasc, +kOmegaMinus, std::array{+kKMinus, +kProton, +kPiMinus}, true, &signCasc, 2, &nPiToMuCasc, &nKaToPiCasc); + if (indexRec > -1) { + // Lambda → p pi (Lambda match) + indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersV0, +kLambda0, std::array{+kProton, +kPiMinus}, true, &signV0, 1, &nPiToMuV0); + if (indexRec > -1) { + isMatched = true; + } + } + } } else if (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { // Match Omegac0 → Omega- + K+ indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughters, o2::constants::physics::kOmegaC0, std::array{+kKPlus, +kKMinus, +kProton, +kPiMinus}, true, &sign, 3, &nPiToMuOmegac0, &nKaToPiOmegac0); - } - indexRecCharmBaryon = indexRec; - if (indexRec > -1) { - // Omega- → K pi p (Cascade match) - indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersCasc, +kOmegaMinus, std::array{+kKMinus, +kProton, +kPiMinus}, true, &signCasc, 2, &nPiToMuCasc, &nKaToPiCasc); + indexRecCharmBaryon = indexRec; if (indexRec > -1) { - // Lambda → p pi (Lambda match) - indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersV0, +kLambda0, std::array{+kProton, +kPiMinus}, true, &signV0, 1, &nPiToMuV0); - if (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi) { - if (nPiToMuOmegac0 >= 1 && nKaToPiOmegac0 == 0) { - isMatched = true; - } else if (nPiToMuOmegac0 == 0 && nKaToPiOmegac0 == 0) { - isMatched = true; - } - } else if (decayChannel == o2::aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK) { - if (nPiToMuOmegac0 == 0 && nKaToPiOmegac0 == 0) { + // Omega- → K pi p (Cascade match) + indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersCasc, +kOmegaMinus, std::array{+kKMinus, +kProton, +kPiMinus}, true, &signCasc, 2, &nPiToMuCasc, &nKaToPiCasc); + if (indexRec > -1) { + // Lambda → p pi (Lambda match) + indexRec = RecoDecay::getMatchedMCRec(mcParticles->get(), arrayDaughtersV0, +kLambda0, std::array{+kProton, +kPiMinus}, true, &signV0, 1, &nPiToMuV0); + if (indexRec > -1) { isMatched = true; } } } } - if (isMatched) { + if (isMatched && indexRecCharmBaryon > -1) { auto particle = mcParticles->get().rawIteratorAt(indexRecCharmBaryon); origin = RecoDecay::getCharmHadronOrigin(mcParticles->get(), particle, false, &idxBhadMothers); } From eac108d1d9d614723c1d2682c168456a3a43b9e4 Mon Sep 17 00:00:00 2001 From: sashingo Date: Thu, 12 Jun 2025 16:50:27 +0900 Subject: [PATCH 035/116] [PWGHF] added some histograms for EMCal (#11554) --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index be71ab35a01..72ff0ccdf8d 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -160,6 +160,8 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisM02{100, 0, 1, "M02"}; const AxisSpec axisdPhi{100, -0.5, 0.5, "dPhi"}; const AxisSpec axisdEta{100, -0.5, 0.5, "dEta"}; + const AxisSpec axisdR{20, 0.0, 0.2, "dR"}; + const AxisSpec axisNcell{50, 0.0, 50.0, "Ncell"}; const AxisSpec axisPhi{350, 0, 7, "Phi"}; const AxisSpec axisEop{200, 0, 2, "Eop"}; const AxisSpec axisChi2{250, 0.0, 25.0, "#chi^{2}"}; @@ -184,7 +186,8 @@ struct HfTaskElectronWeakBoson { registry.add("hPt", "track pt", kTH1F, {axisPt}); registry.add("hTPCNsigma", "TPC electron Nsigma", kTH2F, {{axisPt}, {axisNsigma}}); registry.add("hEnergy", "EMC cluster energy", kTH1F, {axisE}); - registry.add("hTrMatch", "Track EMC Match", kTH2F, {{axisdPhi}, {axisdEta}}); + registry.add("hEnergyNcell", "EMC cluster energy and cell", kTH2F, {{axisE}, {axisNcell}}); + registry.add("hTrMatchR", "Track EMC Match in radius", kTH2F, {{axisPt}, {axisdR}}); registry.add("hTrMatch_mim", "Track EMC Match minimu minimumm", kTH2F, {{axisdPhi}, {axisdEta}}); registry.add("hMatchPhi", "Match in Phi", kTH2F, {{axisPhi}, {axisPhi}}); registry.add("hMatchEta", "Match in Eta", kTH2F, {{axisEta}, {axisEta}}); @@ -198,6 +201,7 @@ struct HfTaskElectronWeakBoson { registry.add("hInvMassZeeLs", "invariant mass for Z LS pair", kTH2F, {{axisPt}, {axisInvMassZ}}); registry.add("hInvMassZeeUls", "invariant mass for Z ULS pair", kTH2F, {{axisPt}, {axisInvMassZ}}); registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack}); + registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); // hisotgram for EMCal trigger registry.add("hEMCalTrigger", "EMCal trigger", kTH1F, {axisTrigger}); @@ -298,7 +302,7 @@ struct HfTaskElectronWeakBoson { registry.fill(HIST("hEMCalTrigger"), isTriggered ? 1 : 0); // Skip event if not triggered and we're processing skimmed data - if (!isTriggered && cfgSkimmedProcessing) { + if (!isTriggered) { return; } } @@ -397,13 +401,16 @@ struct HfTaskElectronWeakBoson { dPhiMin = dPhi; dEtaMin = dEta; } - registry.fill(HIST("hTrMatch"), dPhi, dEta); + registry.fill(HIST("hTHnTrMatch"), match.track_as().pt(), dPhi, dEta); registry.fill(HIST("hEMCtime"), timeEmc); registry.fill(HIST("hEnergy"), energyEmc); - if (r > rMatchMax) + if (std::abs(dPhi) > rMatchMax || std::abs(dEta) > rMatchMax) continue; + registry.fill(HIST("hTrMatchR"), match.track_as().pt(), r); + registry.fill(HIST("hEnergyNcell"), energyEmc, match.emcalcluster_as().nCells()); + const auto& cluster = match.emcalcluster_as(); double eop = energyEmc / match.track_as().p(); From 3ae243858aa626fa27c2c299edc9fe575834ab5a Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:31:21 +0200 Subject: [PATCH 036/116] Add number of PV contributors (#11558) Co-authored-by: Francesco Mazzaschi --- PWGLF/DataModel/LFSlimNucleiTables.h | 8 ++- PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx | 6 +-- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 54 +++++++++---------- PWGLF/TableProducer/Nuspex/nucleiUtils.h | 1 + 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h index e562c35ddc6..e1c0e0eb364 100644 --- a/PWGLF/DataModel/LFSlimNucleiTables.h +++ b/PWGLF/DataModel/LFSlimNucleiTables.h @@ -14,10 +14,11 @@ /// \brief Slim nuclei tables /// -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" #include "Common/DataModel/Centrality.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + #ifndef PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ #define PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ @@ -31,6 +32,7 @@ DECLARE_SOA_COLUMN(Phi, phi, float); DECLARE_SOA_COLUMN(TPCInnerParam, tpcInnerParam, float); DECLARE_SOA_COLUMN(Beta, beta, float); DECLARE_SOA_COLUMN(Zvertex, zVertex, float); +DECLARE_SOA_COLUMN(NContrib, nContrib, int); DECLARE_SOA_COLUMN(DCAxy, dcaxy, float); DECLARE_SOA_COLUMN(DCAz, dcaz, float); DECLARE_SOA_COLUMN(TPCsignal, tpcSignal, float); @@ -102,6 +104,7 @@ DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", NucleiTableNS::TPCInnerParam, NucleiTableNS::Beta, NucleiTableNS::Zvertex, + NucleiTableNS::NContrib, NucleiTableNS::DCAxy, NucleiTableNS::DCAz, NucleiTableNS::TPCsignal, @@ -139,6 +142,7 @@ DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", NucleiTableNS::TPCInnerParam, NucleiTableNS::Beta, NucleiTableNS::Zvertex, + NucleiTableNS::NContrib, NucleiTableNS::DCAxy, NucleiTableNS::DCAz, NucleiTableNS::TPCsignal, diff --git a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx index 68c9b7ac91d..6c15c2a626c 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx @@ -440,7 +440,7 @@ struct nucleiFlowTree { } nuclei::candidates.emplace_back(NucleusCandidate{ static_cast(track.globalIndex()), static_cast(track.collisionId()), (1 - 2 * iC) * mTrackParCov.getPt(), mTrackParCov.getEta(), mTrackParCov.getPhi(), - correctedTpcInnerParam, beta, collision.posZ(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tofChi2(), + correctedTpcInnerParam, beta, collision.posZ(), collision.numContrib(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tofChi2(), nSigmaTPC, tofMasses, fillTree, fillDCAHist, correctPV, isSecondary, fromWeakDecay, flag, track.tpcNClsFindable(), static_cast(track.tpcNClsCrossedRows()), track.itsClusterMap(), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared()), static_cast(track.itsNCls()), static_cast(track.itsClusterSizes())}); } @@ -456,7 +456,7 @@ struct nucleiFlowTree { } fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, 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); + nucleiTable(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); } for (auto& c : nuclei::candidates_flow) { nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr); @@ -473,7 +473,7 @@ struct nucleiFlowTree { } fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, 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); + nucleiTable(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); } for (auto& c : nuclei::candidates_flow) { nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr); diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 205c0eda0a4..22945965595 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -19,52 +19,47 @@ // o2-analysis-pid-tof-base, o2-analysis-multiplicity-table, o2-analysis-event-selection // (to add flow: o2-analysis-qvector-table, o2-analysis-centrality-table) -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" - -#include "CCDB/BasicCCDBManager.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFSlimNucleiTables.h" +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/PID/PIDTOF.h" #include "Common/TableProducer/PID/pidTOFBase.h" -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/Qvectors.h" -#include "Common/Core/RecoDecay.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsTPC/BetheBlochAleph.h" #include "DetectorsBase/GeometryManager.h" #include "DetectorsBase/Propagator.h" - -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.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/EPCalibrationTables.h" -#include "PWGLF/DataModel/LFSlimNucleiTables.h" - +#include "Math/Vector4D.h" #include "TRandom3.h" +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -79,6 +74,7 @@ struct NucleusCandidate { float tpcInnerParam; float beta; float zVertex; + int nContrib; float DCAxy; float DCAz; float TPCsignal; @@ -793,7 +789,7 @@ struct nucleiSpectra { } nuclei::candidates.emplace_back(NucleusCandidate{ static_cast(track.globalIndex()), static_cast(track.collisionId()), (1 - 2 * iC) * mTrackParCov.getPt(), mTrackParCov.getEta(), mTrackParCov.getPhi(), - correctedTpcInnerParam, beta, collision.posZ(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tofChi2(), + correctedTpcInnerParam, beta, collision.posZ(), collision.numContrib(), dcaInfo[0], dcaInfo[1], track.tpcSignal(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tofChi2(), nSigmaTPC, tofMasses, fillTree, fillDCAHist, correctPV, isSecondary, fromWeakDecay, flag, track.tpcNClsFindable(), static_cast(track.tpcNClsCrossedRows()), track.itsClusterMap(), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared()), static_cast(track.itsNCls()), static_cast(track.itsClusterSizes())}); } @@ -814,7 +810,7 @@ struct nucleiSpectra { for (size_t i1{0}; i1 < nuclei::candidates.size(); ++i1) { auto& c1 = nuclei::candidates[i1]; if (c1.fillTree) { - nucleiTable(c1.pt, c1.eta, c1.phi, c1.tpcInnerParam, c1.beta, c1.zVertex, c1.DCAxy, c1.DCAz, c1.TPCsignal, c1.ITSchi2, c1.TPCchi2, c1.TOFchi2, c1.flags, c1.TPCfindableCls, c1.TPCcrossedRows, c1.ITSclsMap, c1.TPCnCls, c1.TPCnClsShared, c1.clusterSizesITS); + nucleiTable(c1.pt, c1.eta, c1.phi, c1.tpcInnerParam, c1.beta, c1.zVertex, c1.nContrib, c1.DCAxy, c1.DCAz, c1.TPCsignal, c1.ITSchi2, c1.TPCchi2, c1.TOFchi2, c1.flags, c1.TPCfindableCls, c1.TPCcrossedRows, c1.ITSclsMap, c1.TPCnCls, c1.TPCnClsShared, c1.clusterSizesITS); if (cfgFillPairTree) { for (size_t i2{i1 + 1}; i2 < nuclei::candidates.size(); ++i2) { auto& c2 = nuclei::candidates[i2]; @@ -849,7 +845,7 @@ struct nucleiSpectra { fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { if (c.fillTree) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, 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); + nucleiTable(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); } if (c.fillDCAHist) { for (int iS{0}; iS < nuclei::species; ++iS) { @@ -878,7 +874,7 @@ struct nucleiSpectra { fillDataInfo(collision, tracks); for (auto& c : nuclei::candidates) { if (c.fillTree) { - nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, 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); + nucleiTable(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); } if (c.fillDCAHist) { for (int iS{0}; iS < nuclei::species; ++iS) { @@ -971,7 +967,7 @@ struct nucleiSpectra { isReconstructed[particle.globalIndex()] = true; float absoDecL = computeAbsoDecL(particle); - nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, 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); + 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); } int index{0}; @@ -1014,7 +1010,7 @@ struct nucleiSpectra { if (!isReconstructed[index] && (cfgTreeConfig->get(iS, 0u) || cfgTreeConfig->get(iS, 1u))) { float absDecL = computeAbsoDecL(particle); - nucleiTableMC(999., 999., 999., 0., 0., 999., 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absDecL); + nucleiTableMC(999., 999., 999., 0., 0., 999., -1, 999., 999., -1, -1, -1, -1, flags, 0, 0, 0, 0, 0, 0, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absDecL); } break; } diff --git a/PWGLF/TableProducer/Nuspex/nucleiUtils.h b/PWGLF/TableProducer/Nuspex/nucleiUtils.h index 2a9a64bc4b2..29cd489768d 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiUtils.h +++ b/PWGLF/TableProducer/Nuspex/nucleiUtils.h @@ -29,6 +29,7 @@ struct NucleusCandidate { float tpcInnerParam; float beta; float zVertex; + int nContrib; float DCAxy; float DCAz; float TPCsignal; From c0df1a2d7d19e74bb5a1cf2cb2f15df8509a4af7 Mon Sep 17 00:00:00 2001 From: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Date: Thu, 12 Jun 2025 11:23:57 +0200 Subject: [PATCH 037/116] [PWGJE] trackEfficiency: use true track weight for numerator for fake tracks (#11493) --- PWGJE/Tasks/trackEfficiency.cxx | 86 ++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/PWGJE/Tasks/trackEfficiency.cxx b/PWGJE/Tasks/trackEfficiency.cxx index a591c32f958..87e37014ae7 100644 --- a/PWGJE/Tasks/trackEfficiency.cxx +++ b/PWGJE/Tasks/trackEfficiency.cxx @@ -82,6 +82,9 @@ struct TrackEfficiency { Configurable ptHatMin{"ptHatMin", 5, "min pT hat of collisions"}; Configurable ptHatMax{"ptHatMax", 300, "max pT hat of collisions"}; Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMaxFractionMCD{"pTHatMaxFractionMCD", 999.0, "maximum fraction of hard scattering for reconstructed track acceptance in MC"}; + + Configurable useTrueTrackWeight{"useTrueTrackWeight", 1, "test configurable, to be removed"}; std::vector eventSelectionBits; int trackSelection = -1; @@ -110,6 +113,13 @@ struct TrackEfficiency { if (!(jetderiveddatautilities::selectTrack(track, trackSelection) && jetderiveddatautilities::selectTrackDcaZ(track, trackDcaZmax))) { continue; } + + float simPtRef = 10.; + float pTHat = simPtRef / (std::pow(weight, 1.0 / pTHatExponent)); + if (track.pt() > pTHatMaxFractionMCD * pTHat) { + 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); @@ -164,8 +174,16 @@ struct TrackEfficiency { registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(1, "allTracksInSelColl"); registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(2, "trackSel"); registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(3, "hasMcParticle"); - registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(4, "mcPartIsPrimary"); - registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(5, "etaAcc"); // not actually applied here but it will give an idea of what will be done in the post processing + + if (doprocessEFficiencyPurity) { + registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(4, "mcPartIsPrimary"); + registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(5, "etaAcc"); // not actually applied here but it will give an idea of what will be done in the post processing + } + if (doprocessEFficiencyPurityWeighted) { + registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(4, "ptHatMaxFraction"); + registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(5, "mcPartIsPrimary"); + registry.get(HIST("hTrackCutsCounts"))->GetXaxis()->SetBinLabel(6, "etaAcc"); // not actually applied here but it will give an idea of what will be done in the post processing + } AxisSpec ptAxisEff = {nBinsLowPt, 0., 10., "#it{p}_{T} (GeV/#it{c})"}; AxisSpec ptAxisHighEff = {18, 10., 100., "#it{p}_{T} (GeV/#it{c})"}; @@ -478,8 +496,9 @@ struct TrackEfficiency { } registry.fill(HIST("hMcCollCutsCounts"), 5.5); // at least one of the reconstructed collisions associated with this mcCollision is selected with regard to centrality - float eventWeight = mcCollision.weight(); - float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + float simPtRef = 10.; + float mcCollEventWeight = mcCollision.weight(); + float pTHat = simPtRef / (std::pow(mcCollEventWeight, 1.0 / pTHatExponent)); if (pTHat < ptHatMin || pTHat > ptHatMax) { // only allows mcCollisions with weight in between min and max return; } @@ -493,16 +512,16 @@ struct TrackEfficiency { } registry.fill(HIST("hMcPartCutsCounts"), 1.5); // isCharged - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_mcpart_nonprimary"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), eventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_mcpart_nonprimary"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), mcCollEventWeight); if (checkPrimaryPart && !jMcParticle.isPhysicalPrimary()) { // global tracks should be mostly primaries continue; } registry.fill(HIST("hMcPartCutsCounts"), 2.5); // isPrimary - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_mcpartofinterest"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), eventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_mcpartofinterest"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), mcCollEventWeight); - registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_mcpartofinterest"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), eventWeight); + registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_mcpartofinterest"), jMcParticle.pt(), jMcParticle.eta(), jMcParticle.phi(), mcCollEventWeight); if ((std::abs(jMcParticle.eta()) < trackEtaAcceptanceCountQA)) { // removed from actual cuts for now because all the histograms have an eta axis registry.fill(HIST("hMcPartCutsCounts"), 3.5); // etaAccept // not actually applied here but it will give an idea of what will be done in the post processing @@ -532,27 +551,36 @@ struct TrackEfficiency { registry.fill(HIST("hTrackCutsCounts"), 1.5); if (!track.has_mcParticle()) { - registry.fill(HIST("h3_track_pt_track_eta_track_phi_nonassociatedtrack"), track.pt(), track.eta(), track.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_track_eta_track_phi_nonassociatedtrack"), track.pt(), track.eta(), track.phi(), mcCollEventWeight); // weight attribution here not trivial; I use the one of the current mcCollision, but track belongs to no collision; what should be its weight? could be a moot point but algo has complained about invalid index for mcParticle if I put th etrueTrackCollEventWeight before this cut - registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_nonassociatedtrack"), track.pt(), track.eta(), track.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_nonassociatedtrack"), track.pt(), track.eta(), track.phi(), mcCollEventWeight); continue; } registry.fill(HIST("hTrackCutsCounts"), 2.5); + if (track.pt() > pTHatMaxFractionMCD * pTHat) { + continue; + } + registry.fill(HIST("hTrackCutsCounts"), 3.5); + + auto mcParticle = track.mcParticle_as(); + auto trueTrackMcCollision = mcParticle.mcCollision_as(); + float trueTrackCollEventWeight = useTrueTrackWeight ? trueTrackMcCollision.weight() : mcCollEventWeight; // test1 + auto jMcParticleFromTrack = track.mcParticle_as(); if (!jMcParticleFromTrack.isPhysicalPrimary()) { - registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_nonprimary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_nonprimary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); - registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_nonprimary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_nonprimary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); if (std::find(seenMcParticlesVector.begin(), seenMcParticlesVector.end(), jMcParticleFromTrack.globalIndex()) != seenMcParticlesVector.end()) { - registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_split_nonprimary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_split_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_split_nonprimary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_split_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); - registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_split_nonprimary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_split_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_split_nonprimary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_split_nonprimary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); } else { seenMcParticlesVector.push_back(jMcParticleFromTrack.globalIndex()); } @@ -560,28 +588,28 @@ struct TrackEfficiency { continue; } - registry.fill(HIST("hTrackCutsCounts"), 3.5); + registry.fill(HIST("hTrackCutsCounts"), 4.5); - registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_primary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); - registry.fill(HIST("h2_particle_pt_track_pt_residual_associatedtrack_primary"), jMcParticleFromTrack.pt(), (jMcParticleFromTrack.pt() - track.pt()) / jMcParticleFromTrack.pt(), eventWeight); + registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_primary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h2_particle_pt_track_pt_residual_associatedtrack_primary"), jMcParticleFromTrack.pt(), (jMcParticleFromTrack.pt() - track.pt()) / jMcParticleFromTrack.pt(), trueTrackCollEventWeight); - registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_primary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); - registry.fill(HIST("h2_particle_pt_high_track_pt_high_residual_associatedtrack_primary"), jMcParticleFromTrack.pt(), (jMcParticleFromTrack.pt() - track.pt()) / jMcParticleFromTrack.pt(), eventWeight); + registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_primary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h2_particle_pt_high_track_pt_high_residual_associatedtrack_primary"), jMcParticleFromTrack.pt(), (jMcParticleFromTrack.pt() - track.pt()) / jMcParticleFromTrack.pt(), trueTrackCollEventWeight); if (std::find(seenMcParticlesVector.begin(), seenMcParticlesVector.end(), jMcParticleFromTrack.globalIndex()) != seenMcParticlesVector.end()) { - registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_split_primary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_split_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_track_eta_track_phi_associatedtrack_split_primary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_particle_eta_particle_phi_associatedtrack_split_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); - registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_split_primary"), track.pt(), track.eta(), track.phi(), eventWeight); - registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_split_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), eventWeight); + registry.fill(HIST("h3_track_pt_high_track_eta_track_phi_associatedtrack_split_primary"), track.pt(), track.eta(), track.phi(), trueTrackCollEventWeight); + registry.fill(HIST("h3_particle_pt_high_particle_eta_particle_phi_associatedtrack_split_primary"), jMcParticleFromTrack.pt(), jMcParticleFromTrack.eta(), jMcParticleFromTrack.phi(), trueTrackCollEventWeight); } else { seenMcParticlesVector.push_back(jMcParticleFromTrack.globalIndex()); } if (std::abs(jMcParticleFromTrack.eta()) < trackEtaAcceptanceCountQA) { // not actually applied here but it will give an idea of what will be done in the post processing - registry.fill(HIST("hTrackCutsCounts"), 4.5); + registry.fill(HIST("hTrackCutsCounts"), 5.5); } } } From 51b7ff98384387eb587b09a68df0d57f443b7ce7 Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Thu, 12 Jun 2025 11:26:11 +0200 Subject: [PATCH 038/116] [PWGJE] removal of the redundant outlier cut from Data (#11534) --- PWGJE/Tasks/fullJetSpectra.cxx | 35 ++++++---------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index 40e233f9a90..5ddcde82ffb 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -674,8 +674,6 @@ struct FullJetSpectra { void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { bool eventAccepted = false; - double weight = 1.0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); registry.fill(HIST("hDetcollisionCounter"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { @@ -683,37 +681,24 @@ struct FullJetSpectra { } registry.fill(HIST("hDetcollisionCounter"), 1.5); // DetCollWithVertexZ - // outlier check: for every outlier jet, reject the whole event - for (auto const& jet : jets) { - if (jet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { // for MCD jets only to remove outliers; setting pTHatMaxMCD = 1 improves purity - registry.fill(HIST("hDetcollisionCounter"), 2.5); // RejectedDetCollWithOutliers - return; - } - // this cut only to be used for calculating Jet Purity and not for Response Matrix - // this is mainly applied to remove all high weight jets causing big fluctuations - if (jet.pt() > 1 * pTHat) { - registry.fill(HIST("h_full_jet_pt_pTHatcut"), jet.pt(), weight); - } - } - if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - registry.fill(HIST("hDetcollisionCounter"), 3.5); // MBRejectedDetEvents + registry.fill(HIST("hDetcollisionCounter"), 2.5); // MBRejectedDetEvents return; } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hDetcollisionCounter"), 4.5); // EventsNotSatisfyingEventSelection + registry.fill(HIST("hDetcollisionCounter"), 3.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"), 5.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC eventAccepted = true; } } @@ -724,10 +709,10 @@ struct FullJetSpectra { fillRejectedJetHistograms(jet, 1.0); } } - registry.fill(HIST("hDetcollisionCounter"), 6.5); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hDetcollisionCounter"), 5.5); // AllRejectedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hDetcollisionCounter"), 7.5); // EMCAcceptedDetColl + registry.fill(HIST("hDetcollisionCounter"), 6.5); // EMCAcceptedDetColl for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -1410,8 +1395,6 @@ struct FullJetSpectra { void processDataTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) { bool eventAccepted = false; - double weight = 1.0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); registry.fill(HIST("hCollisionsUnweighted"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { @@ -1419,12 +1402,6 @@ struct FullJetSpectra { } registry.fill(HIST("hCollisionsUnweighted"), 1.5); // DetCollWithVertexZ - // for (auto const& track : tracks) { - if (pTHat < pTHatAbsoluteMin) { // Track outlier rejection: should this be for every track iteration or for every collision? - return; - } - // } - if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { registry.fill(HIST("hCollisionsUnweighted"), 2.5); // MBRejectedDetEvents return; From b458464c33f8f5eb9cb7324ea6c8fbca910c57bf Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Thu, 12 Jun 2025 18:26:44 +0900 Subject: [PATCH 039/116] [PWGJE] improvement of the track selection in jetShape.cxx (#11546) --- PWGJE/Tasks/jetShape.cxx | 89 +++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index d7e1f2f0557..3c2bfb4c03c 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -13,14 +13,10 @@ /// \author Yuto Nishida /// \brief Task for measuring the dependence of the jet shape function rho(r) on the distance r from the jet axis. -#include -#include -#include - -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/DataModel/Jet.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" @@ -28,13 +24,16 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetUtilities.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/Jet.h" - +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -61,6 +60,7 @@ struct JetShapeTask { {"ptSum", "ptSum", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}}, {"ptSumBg1", "ptSumBg1", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}}, {"ptSumBg2", "ptSumBg2", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}}, + {"event/vertexz", ";Vtx_{z} (cm);Entries", {HistType::kTH1F, {{100, -20, 20}}}}, {"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}}}}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; @@ -79,9 +79,13 @@ struct JetShapeTask { Configurable> distanceCategory{"distanceCategory", {0.00f, 0.05f, 0.10f, 0.15f, 0.20f, 0.25f, 0.30f, 0.35f, 0.40f, 0.45f, 0.50f, 0.55f, 0.60f, 0.65f, 0.70f}, "distance of category"}; // for ppi production - Configurable maxTpcNClsCrossedRows{"maxTpcNClsCrossedRows", 70, ""}; - Configurable maxDcaXY{"maxDcaXY", 0.2, ""}; - Configurable maxItsNCls{"maxItsNCls", 2, ""}; + Configurable etaTrUp{"etaTrUp", 0.7f, "maximum track eta"}; + Configurable dcaxyMax{"dcaxyMax", 2.0f, "mximum DCA xy"}; + Configurable chi2ItsMax{"chi2ItsMax", 15.0f, "its chi2 cut"}; + Configurable chi2TpcMax{"chi2TpcMax", 4.0f, "tpc chi2 cut"}; + Configurable nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"}; + Configurable nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"}; + Configurable nclcrossTpcMin{"nclcrossTpcMin", 70.0f, "tpc # of crossedRows cut"}; 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"}; @@ -145,18 +149,10 @@ struct JetShapeTask { void processJetShape(soa::Filtered>::iterator const& collision, aod::JetTracks const& tracks, soa::Join const& jets) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - std::vector ptDensity; - std::vector ptDensityBg1; - std::vector ptDensityBg2; - - ptDensity.reserve(distanceCategory->size() - 1); - ptDensityBg1.reserve(distanceCategory->size() - 1); - ptDensityBg2.reserve(distanceCategory->size() - 1); - // std::cout << collision.centrality() << std::endl; + std::vector ptDensity(distanceCategory->size() - 1, 0.f); + std::vector ptDensityBg1(distanceCategory->size() - 1, 0.f); + std::vector ptDensityBg2(distanceCategory->size() - 1, 0.f); for (auto const& jet : jets) { if (!isAcceptedJet(jet)) { @@ -178,12 +174,10 @@ struct JetShapeTask { registry.fill(HIST("ptVsCentrality"), collision.centrality(), track.pt()); // calculate compornents of jetshapefunction rho(r) - std::vector trackPtSum; - std::vector trackPtSumBg1; - std::vector trackPtSumBg2; - trackPtSum.reserve(distanceCategory->size() - 1); - trackPtSumBg1.reserve(distanceCategory->size() - 1); - trackPtSumBg2.reserve(distanceCategory->size() - 1); + std::vector trackPtSum(distanceCategory->size() - 1, 0.f); + std::vector trackPtSumBg1(distanceCategory->size() - 1, 0.f); + std::vector trackPtSumBg2(distanceCategory->size() - 1, 0.f); + float phiBg1 = jet.phi() + (o2::constants::math::PIHalf); float phiBg2 = jet.phi() - (o2::constants::math::PIHalf); @@ -197,11 +191,11 @@ struct JetShapeTask { float distanceBg2 = std::sqrt(deltaEta * deltaEta + deltaPhiBg2 * deltaPhiBg2); for (size_t i = 0; i < distanceCategory->size() - 1; i++) { - if (distance < distanceCategory->at(i + 1)) + if (distanceCategory->at(i) <= distance && distance < distanceCategory->at(i + 1)) trackPtSum[i] += track.pt(); - if (distanceBg1 < distanceCategory->at(i + 1)) + if (distanceCategory->at(i) <= distanceBg1 && distanceBg1 < distanceCategory->at(i + 1)) trackPtSumBg1[i] += track.pt(); - if (distanceBg2 < distanceCategory->at(i + 1)) + if (distanceCategory->at(i) <= distanceBg2 && distanceBg2 < distanceCategory->at(i + 1)) trackPtSumBg2[i] += track.pt(); } @@ -221,9 +215,9 @@ struct JetShapeTask { for (size_t i = 0; i < distanceCategory->size() - 1; i++) { double jetX = (distanceCategory->at(i + 1) - distanceCategory->at(i)) * i + (distanceCategory->at(i + 1) - distanceCategory->at(i)) / 2; - double jetShapeFunction = ptDensity[i + 1]; - double jetShapeFunctionBg1 = ptDensityBg1[i + 1]; - double jetShapeFunctionBg2 = ptDensityBg2[i + 1]; + double jetShapeFunction = ptDensity[i]; + double jetShapeFunctionBg1 = ptDensityBg1[i]; + double jetShapeFunctionBg2 = ptDensityBg2[i]; registry.fill(HIST("ptSum"), jetX, jetShapeFunction); registry.fill(HIST("ptSumBg1"), jetX, jetShapeFunctionBg1); registry.fill(HIST("ptSumBg2"), jetX, jetShapeFunctionBg2); @@ -238,6 +232,8 @@ struct JetShapeTask { return; } + registry.fill(HIST("event/vertexz"), collision.posZ()); + for (auto const& jet : jets) { if (!isAcceptedJet(jet)) { continue; @@ -245,13 +241,20 @@ struct JetShapeTask { // tracks conditions for (const auto& track : tracks) { - if (track.tpcNClsCrossedRows() < maxTpcNClsCrossedRows) + if (std::abs(track.eta()) > etaTrUp) continue; - if (std::fabs(track.dcaXY()) > maxDcaXY) + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) continue; - if (track.itsNCls() < maxItsNCls) { + if (std::abs(track.dcaXY()) > dcaxyMax) + continue; + if (track.itsChi2NCl() > chi2ItsMax) + continue; + if (track.tpcChi2NCl() > chi2TpcMax) + continue; + if (track.tpcNClsFound() < nclTpcMin) + continue; + if (track.itsNCls() < nclItsMin) continue; - } // PID check registry.fill(HIST("tpcDedx"), track.pt(), track.tpcSignal()); From eca9ddb7a2fd9ef04c2e4c63a4f9c92d4be156f0 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Thu, 12 Jun 2025 12:01:30 +0200 Subject: [PATCH 040/116] [PWGLF] Fix the reweighting for cascades in MC + temporarily disabling histograms for secondary lambdas (#11559) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 408 ++++++++++++------ 1 file changed, 267 insertions(+), 141 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index b7e65345661..3cb2ac41f2b 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -12,7 +12,7 @@ /// \file strangenessInJets.cxx /// /// \brief task for analysis of strangeness in jets -/// \author Alberto Caliva (alberto.caliva@cern.ch), Francesca Ercolessi (francesca.ercolessi@cern.ch), Nicolò Jacazio (nicolo.jacazio@cern.ch) +/// \author Alberto Caliva (alberto.caliva@cern.ch), Francesca Ercolessi (francesca.ercolessi@cern.ch), Nicolò Jacazio (nicolo.jacazio@cern.ch), Sara Pucillo (sara.pucillo@cern.ch) /// \since May 22, 2024 #include @@ -156,9 +156,13 @@ struct StrangenessInJets { Configurable histoNameWeightAntilambdaJet{"histoNameWeightAntilambdaJet", "", "reweighting histogram: antilambda in jet"}; Configurable histoNameWeightAntilambdaUe{"histoNameWeightAntilambdaUe", "", "reweighting histogram: antilambda in ue"}; Configurable histoNameWeightsXiInJet{"histoNameWeightsXiInJet", "", "reweighting histogram: xi in jet"}; - Configurable histoNameWeightsXiInUe{"histoNameWeightsXiInUe", "", "reweighting histogram: xi in ue"}; + Configurable histoNameWeightsXiUe{"histoNameWeightsXiUe", "", "reweighting histogram: xi in ue"}; Configurable histoNameWeightsAntiXiInJet{"histoNameWeightsAntiXiInJet", "", "reweighting histogram: antixi in jet"}; - Configurable histoNameWeightsAntiXiInUe{"histoNameWeightsAntiXiInUe", "", "reweighting histogram: antixi in ue"}; + Configurable histoNameWeightsAntiXiUe{"histoNameWeightsAntiXiUe", "", "reweighting histogram: antixi in ue"}; + Configurable histoNameWeightsOmegaInJet{"histoNameWeightsOmegaInJet", "", "reweighting histogram: omega in jet"}; + Configurable histoNameWeightsOmegaUe{"histoNameWeightsOmegaUe", "", "reweighting histogram: omega in ue"}; + Configurable histoNameWeightsAntiOmegaInJet{"histoNameWeightsAntiOmegaInJet", "", "reweighting histogram: antiomega in jet"}; + Configurable histoNameWeightsAntiOmegaUe{"histoNameWeightsAntiOmegaUe", "", "reweighting histogram: antiomega in ue"}; // Two-dimensional weights TH2F* twodWeightsPiplusJet = nullptr; @@ -171,10 +175,14 @@ struct StrangenessInJets { TH2F* twodWeightsLambdaUe; TH2F* twodWeightsAntilambdaJet; TH2F* twodWeightsAntilambdaUe; - TH1F* weightsXiInJet; - TH1F* weightsXiInUe; - TH1F* weightsAntiXiInJet; - TH1F* weightsAntiXiInUe; + TH2F* twodWeightsXiInJet; + TH2F* twodWeightsXiUe; + TH2F* twodWeightsAntiXiInJet; + TH2F* twodWeightsAntiXiUe; + TH2F* twodWeightsOmegaInJet; + TH2F* twodWeightsOmegaUe; + TH2F* twodWeightsAntiOmegaInJet; + TH2F* twodWeightsAntiOmegaUe; // List of Particles enum Option { KZeroLambda, @@ -214,10 +222,14 @@ struct StrangenessInJets { twodWeightsLambdaUe = nullptr; twodWeightsAntilambdaJet = nullptr; twodWeightsAntilambdaUe = nullptr; - weightsXiInJet = nullptr; - weightsXiInUe = nullptr; - weightsAntiXiInJet = nullptr; - weightsAntiXiInUe = nullptr; + twodWeightsXiInJet = nullptr; + twodWeightsXiUe = nullptr; + twodWeightsAntiXiInJet = nullptr; + twodWeightsAntiXiUe = nullptr; + twodWeightsOmegaInJet = nullptr; + twodWeightsOmegaUe = nullptr; + twodWeightsAntiOmegaInJet = nullptr; + twodWeightsAntiOmegaUe = nullptr; } // Event Counters @@ -241,8 +253,8 @@ struct StrangenessInJets { registryQC.add("sumPtUE", "sumPtUE", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); registryQC.add("nJets_found", "nJets_found", HistType::kTH1F, {{10, 0, 10, "#it{n}_{Jet}"}}); registryQC.add("nJets_selected", "nJets_selected", HistType::kTH1F, {{10, 0, 10, "#it{n}_{Jet}"}}); - registryQC.add("dcaxy_vs_pt", "dcaxy_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); - registryQC.add("dcaz_vs_pt", "dcaz_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{z} (cm)"}}); + // registryQC.add("dcaxy_vs_pt", "dcaxy_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); + // registryQC.add("dcaz_vs_pt", "dcaz_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{z} (cm)"}}); registryQC.add("jet_jet_overlaps", "jet_jet_overlaps", HistType::kTH2F, {{20, 0.0, 20.0, "#it{n}_{jet}"}, {200, 0.0, 200.0, "#it{n}_{overlaps}"}}); registryQC.add("jet_ue_overlaps", "jet_ue_overlaps", HistType::kTH2F, {{20, 0.0, 20.0, "#it{n}_{jet}"}, {200, 0.0, 200.0, "#it{n}_{overlaps}"}}); registryQC.add("ue_ue_overlaps", "ue_ue_overlaps", HistType::kTH2F, {{20, 0.0, 20.0, "#it{n}_{jet}"}, {200, 0.0, 200.0, "#it{n}_{overlaps}"}}); @@ -344,10 +356,14 @@ struct StrangenessInJets { registryMC.add("Lambda_generated_ue", "Lambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("AntiLambda_generated_jet", "AntiLambda_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("AntiLambda_generated_ue", "AntiLambda_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_generated", "XiPos_generated", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_generated", "XiNeg_generated", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_generated", "OmegaPos_generated", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_generated", "OmegaNeg_generated", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_generated_jet", "XiPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_generated_ue", "XiPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_generated_jet", "XiNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_generated_ue", "XiNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_generated_jet", "OmegaPos_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_generated_ue", "OmegaPos_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_generated_jet", "OmegaNeg_generated_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_generated_ue", "OmegaNeg_generated_ue", HistType::kTH2F, {multBinning, ptAxis}); // Histograms for efficiency (reconstructed) registryMC.add("K0s_reconstructed_jet", "K0s_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); @@ -356,21 +372,30 @@ struct StrangenessInJets { registryMC.add("Lambda_reconstructed_ue", "Lambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("AntiLambda_reconstructed_jet", "AntiLambda_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("AntiLambda_reconstructed_ue", "AntiLambda_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiPos_reconstructed", "XiPos_reconstructed", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("XiNeg_reconstructed", "XiNeg_reconstructed", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaPos_reconstructed", "OmegaPos_reconstructed", HistType::kTH2F, {multBinning, ptAxis}); - registryMC.add("OmegaNeg_reconstructed", "OmegaNeg_reconstructed", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_reconstructed_jet", "XiPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_reconstructed_ue", "XiPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_reconstructed_jet", "XiNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_reconstructed_ue", "XiNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_reconstructed_jet", "OmegaPos_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_reconstructed_ue", "OmegaPos_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_reconstructed_jet", "OmegaNeg_reconstructed_jet", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_reconstructed_ue", "OmegaNeg_reconstructed_ue", HistType::kTH2F, {multBinning, ptAxis}); // Histograms for secondary hadrons registryMC.add("K0s_reconstructed_incl", "K0s_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("Lambda_reconstructed_incl", "Lambda_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); registryMC.add("AntiLambda_reconstructed_incl", "AntiLambda_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiPos_reconstructed_incl", "XiPos_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("XiNeg_reconstructed_incl", "XiNeg_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaPos_reconstructed_incl", "OmegaPos_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); + registryMC.add("OmegaNeg_reconstructed_incl", "OmegaNeg_reconstructed_incl", HistType::kTH2F, {multBinning, ptAxis}); + // Histograms for secondary lambda in jet and UE - registryMC.add("Secondary_Lambda_InJet", "Secondary_Lambda_InJet", HistType::kTH1F, {ptAxis}); - registryMC.add("Secondary_Lambda_InUe", "Secondary_Lambda_InUe", HistType::kTH1F, {ptAxis}); - registryMC.add("Secondary_AntiLambda_InJet", "Secondary_AntiLambda_InJet", HistType::kTH1F, {ptAxis}); - registryMC.add("Secondary_AntiLambda_InUe", "Secondary_AntiLambda_InUe", HistType::kTH1F, {ptAxis}); + // registryMC.add("Secondary_Lambda_InJet", "Secondary_Lambda_InJet", HistType::kTH1F, {ptAxis}); + // registryMC.add("Secondary_Lambda_Ue", "Secondary_Lambda_Ue", HistType::kTH1F, {ptAxis}); + // registryMC.add("Secondary_AntiLambda_InJet", "Secondary_AntiLambda_InJet", HistType::kTH1F, {ptAxis}); + // registryMC.add("Secondary_AntiLambda_Ue", "Secondary_AntiLambda_Ue", HistType::kTH1F, {ptAxis}); // Histograms for 2d reweighting (pion) registryMC.add("mc_pi_plus_eta_pt/jet", "", HistType::kTH2F, {ptAxisPi, etaAxis}); @@ -399,20 +424,20 @@ struct StrangenessInJets { registryMC.add("AntiLambda_eta_pt_pythia", "AntiLambda_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); // Histograms for 2d reweighting (Xi) - registryMC.add("Xi_eta_pt_jet", "Xi_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("Xi_eta_pt_ue", "Xi_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("Xi_eta_pt_pythia", "Xi_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiXi_eta_pt_jet", "AntiXi_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiXi_eta_pt_ue", "AntiXi_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiXi_eta_pt_pythia", "AntiXi_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiNeg_eta_pt_jet", "Xi_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiNeg_eta_pt_ue", "Xi_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiNeg_eta_pt_pythia", "Xi_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiPos_eta_pt_jet", "AntiXi_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiPos_eta_pt_ue", "AntiXi_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("XiPos_eta_pt_pythia", "AntiXi_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); // Histograms for 2d reweighting (Omega) - registryMC.add("Omega_eta_pt_jet", "Omega_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("Omega_eta_pt_ue", "Omega_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("Omega_eta_pt_pythia", "Omega_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiOmega_eta_pt_jet", "AntiOmega_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiOmega_eta_pt_ue", "AntiOmega_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); - registryMC.add("AntiOmega_eta_pt_pythia", "AntiOmega_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaNeg_eta_pt_jet", "Omega_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaNeg_eta_pt_ue", "Omega_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaNeg_eta_pt_pythia", "Omega_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaPos_eta_pt_jet", "AntiOmega_eta_pt_jet", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaPos_eta_pt_ue", "AntiOmega_eta_pt_ue", HistType::kTH2F, {ptAxis, etaAxis}); + registryMC.add("OmegaPos_eta_pt_pythia", "AntiOmega_eta_pt_pythia", HistType::kTH2F, {ptAxis, etaAxis}); // Histograms for efficiency (pions) registryMC.add("mc_pi_plus/in_jet/gen", "", HistType::kTH2F, {multBinning, ptAxisPi}); @@ -1017,25 +1042,17 @@ struct StrangenessInJets { get2DWeightHisto(histoNameWeightAntilambdaJet, twodWeightsAntilambdaJet); get2DWeightHisto(histoNameWeightAntilambdaUe, twodWeightsAntilambdaUe); - auto get1DWeightHisto = [&](Configurable name, TH1F*& histo) { - LOG(info) << "Looking for 1D weight histogram '" << name.value << "' for " << name.name; - if (name.value == "") { - LOG(info) << " -> Skipping"; - return; - } - histo = static_cast(l->FindObject(name.value.c_str())); - if (!histo) { - LOG(error) << "Could not open histogram '" << name.value << "'"; - return; - } - LOG(info) << "Opened histogram " << histo->ClassName() << " " << histo->GetName(); - }; - - // Secondary Lambda - get1DWeightHisto(histoNameWeightsXiInJet, weightsXiInJet); - get1DWeightHisto(histoNameWeightsXiInUe, weightsXiInUe); - get1DWeightHisto(histoNameWeightsAntiXiInJet, weightsAntiXiInJet); - get1DWeightHisto(histoNameWeightsAntiXiInUe, weightsAntiXiInUe); + // Xi + get2DWeightHisto(histoNameWeightsXiInJet, twodWeightsXiInJet); + get2DWeightHisto(histoNameWeightsXiUe, twodWeightsXiUe); + get2DWeightHisto(histoNameWeightsAntiXiInJet, twodWeightsAntiXiInJet); + get2DWeightHisto(histoNameWeightsAntiXiUe, twodWeightsAntiXiUe); + + // Omega + get2DWeightHisto(histoNameWeightsOmegaInJet, twodWeightsOmegaInJet); + get2DWeightHisto(histoNameWeightsOmegaUe, twodWeightsOmegaUe); + get2DWeightHisto(histoNameWeightsAntiOmegaInJet, twodWeightsAntiOmegaInJet); + get2DWeightHisto(histoNameWeightsAntiOmegaUe, twodWeightsAntiOmegaUe); } void processData(SelCollisions::iterator const& collision, @@ -1271,22 +1288,22 @@ struct StrangenessInJets { } bool isInJet = false; - bool isInUe = false; + bool isUe = false; if (deltaRjet < rJet) isInJet = true; if (deltaRue1 < rJet || deltaRue2 < rJet) - isInUe = true; + isUe = true; if (isHighPurityPion(track, nsigmaTPC, nsigmaTOF)) { if (track.sign() > 0) { if (isInJet) registryData.fill(HIST("piplus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); - if (isInUe) + if (isUe) registryData.fill(HIST("piplus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); } else { if (isInJet) registryData.fill(HIST("piminus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); - if (isInUe) + if (isUe) registryData.fill(HIST("piminus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); } } @@ -1301,7 +1318,7 @@ struct StrangenessInJets { if (isInJet) { registryData.fill(HIST("piplus_tpc_in_jet"), multiplicity, track.pt(), nsigmaTPC); } - if (isInUe) { + if (isUe) { registryData.fill(HIST("piplus_tpc_in_ue"), multiplicity, track.pt(), nsigmaTPC); } break; @@ -1309,7 +1326,7 @@ struct StrangenessInJets { if (isInJet) { registryData.fill(HIST("piminus_tpc_in_jet"), multiplicity, track.pt(), nsigmaTPC); } - if (isInUe) { + if (isUe) { registryData.fill(HIST("piminus_tpc_in_ue"), multiplicity, track.pt(), nsigmaTPC); } break; @@ -1327,7 +1344,7 @@ struct StrangenessInJets { if (isInJet) { registryData.fill(HIST("piplus_tof_in_jet"), multiplicity, track.pt(), nsigmaTOF); } - if (isInUe) { + if (isUe) { registryData.fill(HIST("piplus_tof_in_ue"), multiplicity, track.pt(), nsigmaTOF); } break; @@ -1335,7 +1352,7 @@ struct StrangenessInJets { if (isInJet) { registryData.fill(HIST("piminus_tof_in_jet"), multiplicity, track.pt(), nsigmaTOF); } - if (isInUe) { + if (isUe) { registryData.fill(HIST("piminus_tof_in_ue"), multiplicity, track.pt(), nsigmaTOF); } break; @@ -1504,66 +1521,66 @@ struct StrangenessInJets { TVector3 momentumV0 = momentumPos + momentumNeg; // Feed-down for lambda - if (passedLambdaSelection(v0, pos, neg) && pdgParent == kLambda0) { - if (!isPhysPrim) { - double wSecLambdaInJet(1.0); - double wSecLambdaInUe(1.0); - int idMother = posParticle.mothersIds()[0]; - const auto& mother = mcParticles.iteratorAt(idMother); - int idGrandMother = mother.mothersIds()[0]; - const auto& grandMother = mcParticles.iteratorAt(idGrandMother); - switch (grandMother.pdgCode()) { - case kXiMinus: - case kXiPlusBar: - // case 3322: - // case -3322: - if (weightsXiInJet) { - int ibinXiInJet = weightsXiInJet->GetXaxis()->FindBin(grandMother.pt()); - wSecLambdaInJet = weightsXiInJet->GetBinContent(ibinXiInJet); - } - if (weightsXiInUe) { - int ibinXiInUe = weightsXiInUe->GetXaxis()->FindBin(grandMother.pt()); - wSecLambdaInUe = weightsXiInUe->GetBinContent(ibinXiInUe); - } - break; - default: - break; - } - registryMC.fill(HIST("Secondary_Lambda_InJet"), v0.pt(), wSecLambdaInJet); - registryMC.fill(HIST("Secondary_Lambda_InUe"), v0.pt(), wSecLambdaInUe); - } - } + // if (passedLambdaSelection(v0, pos, neg) && pdgParent == kLambda0) { + // if (!isPhysPrim) { + // double wSecLambdaInJet(1.0); + // double wSecLambdaUe(1.0); + // int idMother = posParticle.mothersIds()[0]; + // const auto& mother = mcParticles.iteratorAt(idMother); + // int idGrandMother = mother.mothersIds()[0]; + // const auto& grandMother = mcParticles.iteratorAt(idGrandMother); + // switch (grandMother.pdgCode()) { + // case kXiMinus: + // case kXiPlusBar: + // // case 3322: + // // case -3322: + // if (weightsXiInJet) { + // int ibinXiInJet = weightsXiInJet->GetXaxis()->FindBin(grandMother.pt()); + // wSecLambdaInJet = weightsXiInJet->GetBinContent(ibinXiInJet); + // } + // if (weightsXiUe) { + // int ibinXiUe = weightsXiUe->GetXaxis()->FindBin(grandMother.pt()); + // wSecLambdaUe = weightsXiUe->GetBinContent(ibinXiUe); + // } + // break; + // default: + // break; + // } + // registryMC.fill(HIST("Secondary_Lambda_InJet"), v0.pt(), wSecLambdaInJet); + // registryMC.fill(HIST("Secondary_Lambda_Ue"), v0.pt(), wSecLambdaUe); + // } + //} // Feed-down for antilambda - if (passedAntiLambdaSelection(v0, pos, neg) && pdgParent == kLambda0Bar) { - if (!isPhysPrim) { - double wSecAntiLambdaInJet(1.0); - double wSecAntiLambdaInUe(1.0); - int idMother = posParticle.mothersIds()[0]; - const auto& mother = mcParticles.iteratorAt(idMother); - int idGrandMother = mother.mothersIds()[0]; - const auto& grandMother = mcParticles.iteratorAt(idGrandMother); - switch (grandMother.pdgCode()) { - case kXiMinus: - case kXiPlusBar: - // case 3322: - // case -3322: - if (weightsAntiXiInJet) { - int ibinAntiXiInJet = weightsAntiXiInJet->GetXaxis()->FindBin(grandMother.pt()); - wSecAntiLambdaInJet = weightsAntiXiInJet->GetBinContent(ibinAntiXiInJet); - } - if (weightsAntiXiInUe) { - int ibinAntiXiInUe = weightsAntiXiInUe->GetXaxis()->FindBin(grandMother.pt()); - wSecAntiLambdaInUe = weightsAntiXiInUe->GetBinContent(ibinAntiXiInUe); - } - break; - default: - break; - } - registryMC.fill(HIST("Secondary_AntiLambda_InJet"), v0.pt(), wSecAntiLambdaInJet); - registryMC.fill(HIST("Secondary_AntiLambda_InUe"), v0.pt(), wSecAntiLambdaInUe); - } - } + // if (passedAntiLambdaSelection(v0, pos, neg) && pdgParent == kLambda0Bar) { + // if (!isPhysPrim) { + // double wSecAntiLambdaInJet(1.0); + // double wSecAntiLambdaUe(1.0); + // int idMother = posParticle.mothersIds()[0]; + // const auto& mother = mcParticles.iteratorAt(idMother); + // int idGrandMother = mother.mothersIds()[0]; + // const auto& grandMother = mcParticles.iteratorAt(idGrandMother); + // switch (grandMother.pdgCode()) { + // case kXiMinus: + // case kXiPlusBar: + // // case 3322: + // // case -3322: + // if (weightsAntiXiInJet) { + // int ibinAntiXiInJet = weightsAntiXiInJet->GetXaxis()->FindBin(grandMother.pt()); + // wSecAntiLambdaInJet = weightsAntiXiInJet->GetBinContent(ibinAntiXiInJet); + // } + // if (weightsAntiXiUe) { + // int ibinAntiXiUe = weightsAntiXiUe->GetXaxis()->FindBin(grandMother.pt()); + // wSecAntiLambdaUe = weightsAntiXiUe->GetBinContent(ibinAntiXiUe); + // } + // break; + // default: + // break; + // } + // registryMC.fill(HIST("Secondary_AntiLambda_InJet"), v0.pt(), wSecAntiLambdaInJet); + // registryMC.fill(HIST("Secondary_AntiLambda_Ue"), v0.pt(), wSecAntiLambdaUe); + // } + //} if (passedK0ShortSelection(v0, pos, neg) && pdgParent == kK0Short) { registryMC.fill(HIST("K0s_reconstructed_incl"), multiplicity, v0.pt()); @@ -1645,6 +1662,7 @@ struct StrangenessInJets { continue; int pdgParent(0); + bool isPhysPrim = false; for (const auto& particleMotherOfNeg : negParticle.mothers_as()) { for (const auto& particleMotherOfPos : posParticle.mothers_as()) { for (const auto& particleMotherOfBach : bachParticle.mothers_as()) { @@ -1656,27 +1674,95 @@ struct StrangenessInJets { continue; pdgParent = particleMotherOfBach.pdgCode(); + isPhysPrim = particleMotherOfBach.isPhysicalPrimary(); } } } if (pdgParent == 0) continue; + // Generated Momentum of casc + TVector3 momentumPos(posParticle.px(), posParticle.py(), posParticle.pz()); + TVector3 momentumNeg(negParticle.px(), negParticle.py(), negParticle.pz()); + TVector3 momentumBach(bachParticle.px(), bachParticle.py(), bachParticle.pz()); + TVector3 momentumV0 = momentumPos + momentumNeg; + TVector3 momentumCasc = momentumV0 + momentumBach; + + // Xi+ + if (passedXiSelection(casc, pos, neg, bach, collision) && pdgParent == kXiPlusBar) { + registryMC.fill(HIST("XiPos_reconstructed_incl"), multiplicity, casc.pt()); + } + // Xi- + if (passedXiSelection(casc, pos, neg, bach, collision) && pdgParent == kXiMinus) { + registryMC.fill(HIST("XiNeg_reconstructed_incl"), multiplicity, casc.pt()); + } + // Omega+ + if (passedOmegaSelection(casc, pos, neg, bach, collision) && pdgParent == kOmegaPlusBar) { + registryMC.fill(HIST("OmegaPos_reconstructed_incl"), multiplicity, casc.pt()); + } + // Omega- + if (passedOmegaSelection(casc, pos, neg, bach, collision) && pdgParent == kOmegaMinus) { + registryMC.fill(HIST("OmegaNeg_reconstructed_incl"), multiplicity, casc.pt()); + } + + if (!isPhysPrim) + continue; + + double wXiPosJet(1.0), wXiPosUe(1.0), wXiNegJet(1.0), wXiNegUe(1.0), wOmegaPosJet(1.0), wOmegaPosUe(1.0), wOmegaNegJet(1.0), wOmegaNegUe(1.0); + if (applyReweighting) { + int ix = twodWeightsXiInJet->GetXaxis()->FindBin(momentumCasc.Pt()); + int iy = twodWeightsXiInJet->GetYaxis()->FindBin(momentumCasc.Eta()); + wXiPosJet = twodWeightsAntiXiInJet->GetBinContent(ix, iy); + wXiPosUe = twodWeightsAntiXiUe->GetBinContent(ix, iy); + wXiNegJet = twodWeightsXiInJet->GetBinContent(ix, iy); + wXiNegUe = twodWeightsXiUe->GetBinContent(ix, iy); + wOmegaPosJet = twodWeightsAntiOmegaInJet->GetBinContent(ix, iy); + wOmegaPosUe = twodWeightsAntiOmegaUe->GetBinContent(ix, iy); + wOmegaNegJet = twodWeightsOmegaInJet->GetBinContent(ix, iy); + wOmegaNegUe = twodWeightsOmegaUe->GetBinContent(ix, iy); + + // protections + if (ix == 0 || ix > twodWeightsXiInJet->GetNbinsX()) { + wXiPosJet = 1.0; + wXiPosUe = 1.0; + wXiNegJet = 1.0; + wXiNegUe = 1.0; + wOmegaPosJet = 1.0; + wOmegaPosUe = 1.0; + wOmegaNegJet = 1.0; + wOmegaNegUe = 1.0; + } + if (iy == 0 || iy > twodWeightsXiInJet->GetNbinsY()) { + wXiPosJet = 1.0; + wXiPosUe = 1.0; + wXiNegJet = 1.0; + wXiNegUe = 1.0; + wOmegaPosJet = 1.0; + wOmegaPosUe = 1.0; + wOmegaNegJet = 1.0; + wOmegaNegUe = 1.0; + } + } + // Xi+ if (passedXiSelection(casc, pos, neg, bach, collision) && pdgParent == kXiPlusBar) { - registryMC.fill(HIST("XiPos_reconstructed"), multiplicity, casc.pt()); + registryMC.fill(HIST("XiPos_reconstructed_jet"), multiplicity, casc.pt(), wXiPosJet); + registryMC.fill(HIST("XiPos_reconstructed_ue"), multiplicity, casc.pt(), wXiPosUe); } // Xi- if (passedXiSelection(casc, pos, neg, bach, collision) && pdgParent == kXiMinus) { - registryMC.fill(HIST("XiNeg_reconstructed"), multiplicity, casc.pt()); + registryMC.fill(HIST("XiNeg_reconstructed_jet"), multiplicity, casc.pt(), wXiNegJet); + registryMC.fill(HIST("XiNeg_reconstructed_ue"), multiplicity, casc.pt(), wXiNegUe); } // Omega+ if (passedOmegaSelection(casc, pos, neg, bach, collision) && pdgParent == kOmegaPlusBar) { - registryMC.fill(HIST("OmegaPos_reconstructed"), multiplicity, casc.pt()); + registryMC.fill(HIST("OmegaPos_reconstructed_jet"), multiplicity, casc.pt(), wOmegaPosJet); + registryMC.fill(HIST("OmegaPos_reconstructed_ue"), multiplicity, casc.pt(), wOmegaPosUe); } // Omega- if (passedOmegaSelection(casc, pos, neg, bach, collision) && pdgParent == kOmegaMinus) { - registryMC.fill(HIST("OmegaNeg_reconstructed"), multiplicity, casc.pt()); + registryMC.fill(HIST("OmegaNeg_reconstructed_jet"), multiplicity, casc.pt(), wOmegaNegJet); + registryMC.fill(HIST("OmegaNeg_reconstructed_ue"), multiplicity, casc.pt(), wOmegaNegUe); } } @@ -1854,6 +1940,42 @@ struct StrangenessInJets { } } + double wXiPosJet(1.0), wXiPosUe(1.0), wXiNegJet(1.0), wXiNegUe(1.0), wOmegaPosJet(1.0), wOmegaPosUe(1.0), wOmegaNegJet(1.0), wOmegaNegUe(1.0); + if (applyReweighting) { + int ix = twodWeightsXiInJet->GetXaxis()->FindBin(mcParticle.pt()); + int iy = twodWeightsXiInJet->GetYaxis()->FindBin(mcParticle.eta()); + wXiPosJet = twodWeightsAntiXiInJet->GetBinContent(ix, iy); + wXiPosUe = twodWeightsAntiXiUe->GetBinContent(ix, iy); + wXiNegJet = twodWeightsXiInJet->GetBinContent(ix, iy); + wXiNegUe = twodWeightsXiUe->GetBinContent(ix, iy); + wOmegaPosJet = twodWeightsAntiOmegaInJet->GetBinContent(ix, iy); + wOmegaPosUe = twodWeightsAntiOmegaUe->GetBinContent(ix, iy); + wOmegaNegJet = twodWeightsOmegaInJet->GetBinContent(ix, iy); + wOmegaNegUe = twodWeightsOmegaUe->GetBinContent(ix, iy); + + // protections + if (ix == 0 || ix > twodWeightsXiInJet->GetNbinsX()) { + wXiPosJet = 1.0; + wXiPosUe = 1.0; + wXiNegJet = 1.0; + wXiNegUe = 1.0; + wOmegaPosJet = 1.0; + wOmegaPosUe = 1.0; + wOmegaNegJet = 1.0; + wOmegaNegUe = 1.0; + } + if (iy == 0 || iy > twodWeightsXiInJet->GetNbinsY()) { + wXiPosJet = 1.0; + wXiPosUe = 1.0; + wXiNegJet = 1.0; + wXiNegUe = 1.0; + wOmegaPosJet = 1.0; + wOmegaPosUe = 1.0; + wOmegaNegJet = 1.0; + wOmegaNegUe = 1.0; + } + } + switch (mcParticle.pdgCode()) { /* case kPiPlus: // Pi+ @@ -1903,20 +2025,24 @@ struct StrangenessInJets { registryMC.fill(HIST("AntiLambda_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; case kXiPlusBar: // Xi Pos - registryMC.fill(HIST("XiPos_generated"), multiplicity, mcParticle.pt()); + registryMC.fill(HIST("XiPos_generated_jet"), multiplicity, mcParticle.pt(), wXiPosJet); + registryMC.fill(HIST("XiPos_generated_ue"), multiplicity, mcParticle.pt(), wXiPosUe); registryMC.fill(HIST("Xi_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; case kXiMinus: // Xi Neg - registryMC.fill(HIST("XiNeg_generated"), multiplicity, mcParticle.pt()); - registryMC.fill(HIST("AntiXi_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); + registryMC.fill(HIST("XiNeg_generated_jet"), multiplicity, mcParticle.pt(), wXiNegJet); + registryMC.fill(HIST("XiNeg_generated_ue"), multiplicity, mcParticle.pt(), wXiNegUe); + registryMC.fill(HIST("XiNeg_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; case kOmegaPlusBar: // Omega Pos - registryMC.fill(HIST("OmegaPos_generated"), multiplicity, mcParticle.pt()); - registryMC.fill(HIST("Omega_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); + registryMC.fill(HIST("OmegaPos_generated_jet"), multiplicity, mcParticle.pt(), wOmegaPosJet); + registryMC.fill(HIST("OmegaPos_generated_ue"), multiplicity, mcParticle.pt(), wOmegaPosUe); + registryMC.fill(HIST("OmegaPos_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; case kOmegaMinus: // Omega Neg - registryMC.fill(HIST("OmegaNeg_generated"), multiplicity, mcParticle.pt()); - registryMC.fill(HIST("AntiOmega_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); + registryMC.fill(HIST("OmegaNeg_generated_jet"), multiplicity, mcParticle.pt(), wOmegaNegJet); + registryMC.fill(HIST("OmegaNeg_generated_ue"), multiplicity, mcParticle.pt(), wOmegaNegUe); + registryMC.fill(HIST("OmegaNeg_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; } } @@ -2038,16 +2164,16 @@ struct StrangenessInJets { registryMC.fill(HIST("AntiLambda_eta_pt_jet"), particle.pt(), particle.eta()); break; case kXiMinus: - registryMC.fill(HIST("Xi_eta_pt_jet"), particle.pt(), particle.eta()); + registryMC.fill(HIST("XiNeg_eta_pt_jet"), particle.pt(), particle.eta()); break; case kXiPlusBar: - registryMC.fill(HIST("AntiXi_eta_pt_jet"), particle.pt(), particle.eta()); + registryMC.fill(HIST("XiPos_eta_pt_jet"), particle.pt(), particle.eta()); break; case kOmegaMinus: - registryMC.fill(HIST("Omega_eta_pt_jet"), particle.pt(), particle.eta()); + registryMC.fill(HIST("OmegaNeg_eta_pt_jet"), particle.pt(), particle.eta()); break; case kOmegaPlusBar: - registryMC.fill(HIST("AntiOmega_eta_pt_jet"), particle.pt(), particle.eta()); + registryMC.fill(HIST("OmegaPos_eta_pt_jet"), particle.pt(), particle.eta()); break; default: continue; @@ -2074,16 +2200,16 @@ struct StrangenessInJets { registryMC.fill(HIST("AntiLambda_eta_pt_ue"), particle.pt(), particle.eta()); break; case kXiMinus: - registryMC.fill(HIST("Xi_eta_pt_ue"), particle.pt(), particle.eta()); + registryMC.fill(HIST("XiNeg_eta_pt_ue"), particle.pt(), particle.eta()); break; case kXiPlusBar: - registryMC.fill(HIST("AntiXi_eta_pt_ue"), particle.pt(), particle.eta()); + registryMC.fill(HIST("XiPos_eta_pt_ue"), particle.pt(), particle.eta()); break; case kOmegaMinus: - registryMC.fill(HIST("Omega_eta_pt_ue"), particle.pt(), particle.eta()); + registryMC.fill(HIST("OmegaNeg_eta_pt_ue"), particle.pt(), particle.eta()); break; case kOmegaPlusBar: - registryMC.fill(HIST("AntiOmega_eta_pt_ue"), particle.pt(), particle.eta()); + registryMC.fill(HIST("OmegaPos_eta_pt_ue"), particle.pt(), particle.eta()); break; default: continue; From bbd15bff2815ce21d7396bb8f3524ba1745f8b2a Mon Sep 17 00:00:00 2001 From: Javier Castillo Castellanos Date: Thu, 12 Jun 2025 13:31:32 +0200 Subject: [PATCH 041/116] [Common] Use MCH track counterpart of global muon (#11542) --- Common/Tasks/qaMuon.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index 1f210249089..7c854935930 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -2399,7 +2399,7 @@ struct muonQa { mch::Track mchrealigned1, mchrealigned2; VarClusters fgValuesCls1, fgValuesCls2; - if (!FillClusters(muonTrack1, clusters, fgValuesCls1, mchrealigned1) || !FillClusters(muonTrack2, clusters, fgValuesCls2, mchrealigned2)) { + if (!FillClusters(mchTrack1, clusters, fgValuesCls1, mchrealigned1) || !FillClusters(mchTrack2, clusters, fgValuesCls2, mchrealigned2)) { continue; // Refit is not valid } From 5e3822f8a791aafd15b83dc8bf7189f4878e5d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 12 Jun 2025 13:47:59 +0200 Subject: [PATCH 042/116] [ALICE3] Update FastTracker (#11570) Co-authored-by: ALICE Action Bot --- ALICE3/Core/FastTracker.cxx | 198 ++++++++++++++++-------------------- ALICE3/Core/FastTracker.h | 87 +++++++++------- 2 files changed, 139 insertions(+), 146 deletions(-) diff --git a/ALICE3/Core/FastTracker.cxx b/ALICE3/Core/FastTracker.cxx index 1d06958504b..fe89fcd80fd 100644 --- a/ALICE3/Core/FastTracker.cxx +++ b/ALICE3/Core/FastTracker.cxx @@ -9,13 +9,17 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include +#include "FastTracker.h" + +#include "ReconstructionDataFormats/TrackParametrization.h" + #include "TMath.h" #include "TMatrixD.h" -#include "TRandom.h" #include "TMatrixDSymEigen.h" -#include "FastTracker.h" +#include "TRandom.h" + +#include +#include namespace o2 { @@ -24,36 +28,6 @@ namespace fastsim // +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+ -FastTracker::FastTracker() -{ - // base constructor - magneticField = 20; // in kiloGauss - applyZacceptance = false; - applyMSCorrection = true; - applyElossCorrection = true; - applyEffCorrection = true; - covMatFactor = 0.99f; - verboseLevel = 0; - - // last fast-tracked track properties - covMatOK = 0; - covMatNotOK = 0; - nIntercepts = 0; - nSiliconPoints = 0; - nGasPoints = 0; - - maxRadiusSlowDet = 10; - integrationTime = 0.02; // ms - crossSectionMinB = 8; - dNdEtaCent = 2200; - dNdEtaMinB = 1; - avgRapidity = 0.45; - sigmaD = 6.0; - luminosity = 1.e27; - otherBackground = 0.0; // [0, 1] - upcBackgroundMultiplier = 1.0; -} - void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type) { DetLayer newLayer(name, r, z, x0, xrho, resRPhi, resZ, eff, type); @@ -61,6 +35,17 @@ void FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, if (newLayer.getEfficiency() > 0.0f && newLayer.isInert()) { LOG(error) << "Layer " << name << " with efficiency > 0.0 should not be inert"; } + // Layers should be ordered by increasing radius, check this + if (!layers.empty() && newLayer.getRadius() < layers.back().getRadius()) { + LOG(fatal) << "Layer " << newLayer << " is not ordered correctly, it should be after layer " << layers.back(); + } + // Layers should all have different names + for (const auto& layer : layers) { + if (layer.getName() == newLayer.getName()) { + LOG(fatal) << "Layer with name " << newLayer.getName() << " already exists in FastTracker layers"; + } + } + // Add the new layer to the layers vector layers.push_back(newLayer); } @@ -78,7 +63,7 @@ DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers) const return layers[layerIdx]; } -int FastTracker::GetLayerIndex(std::string name) const +int FastTracker::GetLayerIndex(const std::string& name) const { int i = 0; for (const auto& layer : layers) { @@ -211,9 +196,9 @@ float FastTracker::Dist(float z, float r) // https://github.com/AliceO2Group/DelphesO2/blob/master/src/DetectorK/DetectorK.cxx#L743 int index = 1; int nSteps = 301; - double dist = 0.0; - double dz0 = (4 * sigmaD - (-4) * sigmaD / (nSteps = 1)); - double z0 = 0.0; + float dist = 0.0; + float dz0 = (4 * sigmaD - (-4) * sigmaD / (nSteps = 1)); + float z0 = 0.0; for (int i = 0; i < nSteps; i++) { if (i == nSteps - 1) index = 1; @@ -243,7 +228,7 @@ float FastTracker::IntegratedHitDensity(float multiplicity, float radius) // porting of DetektorK::IntegratedHitDensity // see here: // https://github.com/AliceO2Group/DelphesO2/blob/master/src/DetectorK/DetectorK.cxx#L712 - float zdcHz = luminosity * 1.e24 * crossSectionMinB; + float zdcHz = luminosity * 1.e24 * mCrossSectionMinB; float den = zdcHz * integrationTime / 1000. * multiplicity * Dist(0., radius) / (o2::constants::math::TwoPI * radius); if (den < OneEventHitDensity(multiplicity, radius)) den = OneEventHitDensity(multiplicity, radius); @@ -301,6 +286,7 @@ float FastTracker::ProbGoodChiSqHit(float radius, float searchRadiusRPhi, float // returns number of intercepts (generic for now) int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, const float nch) { + dNdEtaCent = nch; // set the number of charged particles per unit rapidity hits.clear(); nIntercepts = 0; nSiliconPoints = 0; @@ -310,38 +296,54 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa const float initialRadius = std::hypot(posIni[0], posIni[1]); const float kTrackingMargin = 0.1; const int kMaxNumberOfDetectors = 20; + if (kMaxNumberOfDetectors < layers.size()) { + LOG(fatal) << "Too many layers in FastTracker, increase kMaxNumberOfDetectors"; + return -1; // too many layers + } + int firstActiveLayer = -1; // first layer that is not inert + for (size_t i = 0; i < layers.size(); ++i) { + if (!layers[i].isInert()) { + firstActiveLayer = i; + break; + } + } + if (firstActiveLayer <= 0) { + LOG(fatal) << "No active layers found in FastTracker, check layer setup"; + return -2; // no active layers + } const int xrhosteps = 100; const bool applyAngularCorrection = true; goodHitProbability.clear(); - for (int i = 0; i < kMaxNumberOfDetectors; ++i) + for (int i = 0; i < kMaxNumberOfDetectors; ++i) { goodHitProbability.push_back(-1.); - goodHitProbability[0] = 1.; + } + goodHitProbability[0] = 1.; // we use layer zero to accumulate // +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+ // Outward pass to find intercepts int firstLayerReached = -1; int lastLayerReached = -1; new (&outputTrack)(o2::track::TrackParCov)(inputTrack); - for (uint32_t il = 0; il < layers.size(); il++) { + for (size_t il = 0; il < layers.size(); il++) { // check if layer is doable - if (layers[il].getRadius() < initialRadius) + if (layers[il].getRadius() < initialRadius) { continue; // this layer should not be attempted, but go ahead + } // check if layer is reached float targetX = 1e+3; - bool ok = true; inputTrack.getXatLabR(layers[il].getRadius(), targetX, magneticField); if (targetX > 999.f) { LOGF(debug, "Failed to find intercept for layer %d at radius %.2f cm", il, layers[il].getRadius()); break; // failed to find intercept } - ok = inputTrack.propagateTo(targetX, magneticField); - if (ok && applyMSCorrection && layers[il].getRadiationLength() > 0) { + bool ok = inputTrack.propagateTo(targetX, magneticField); + if (ok && mApplyMSCorrection && layers[il].getRadiationLength() > 0) { ok = inputTrack.correctForMaterial(layers[il].getRadiationLength(), 0, applyAngularCorrection); } - if (ok && applyElossCorrection && layers[il].getDensity() > 0) { // correct in small steps + if (ok && mApplyElossCorrection && layers[il].getDensity() > 0) { // correct in small steps for (int ise = xrhosteps; ise--;) { ok = inputTrack.correctForMaterial(0, -layers[il].getDensity() / xrhosteps, applyAngularCorrection); if (!ok) @@ -361,7 +363,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa break; } } - if (std::abs(inputTrack.getZ()) > layers[il].getZ() && applyZacceptance) { + if (std::abs(inputTrack.getZ()) > layers[il].getZ() && mApplyZacceptance) { break; // out of acceptance bounds } @@ -384,39 +386,19 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa o2::track::TrackParCov inwardTrack(inputTrack); // Enlarge covariance matrix - std::array trPars = {0.}; - for (int ip = 0; ip < 5; ip++) { + std::array trPars = {0.}; + for (int ip = 0; ip < o2::track::kNParams; ip++) { trPars[ip] = outputTrack.getParam(ip); } - std::array largeCov = {0.}; - enum { kY, - kZ, - kSnp, - kTgl, - kPtI }; // track parameter aliases - enum { kY2, - kYZ, - kZ2, - kYSnp, - kZSnp, - kSnp2, - kYTgl, - kZTgl, - kSnpTgl, - kTgl2, - kYPtI, - kZPtI, - kSnpPtI, - kTglPtI, - kPtI2 }; // cov.matrix aliases - const double kLargeErr2Coord = 5 * 5; - const double kLargeErr2Dir = 0.7 * 0.7; - const double kLargeErr2PtI = 30.5 * 30.5; - for (int ic = 15; ic--;) + static constexpr float kLargeErr2Coord = 5 * 5; + static constexpr float kLargeErr2Dir = 0.7 * 0.7; + static constexpr float kLargeErr2PtI = 30.5 * 30.5; + std::array largeCov = {0.}; + for (int ic = o2::track::kCovMatSize; ic--;) largeCov[ic] = 0.; - largeCov[kY2] = largeCov[kZ2] = kLargeErr2Coord; - largeCov[kSnp2] = largeCov[kTgl2] = kLargeErr2Dir; - largeCov[kPtI2] = kLargeErr2PtI * trPars[kPtI] * trPars[kPtI]; + largeCov[o2::track::CovLabels::kSigY2] = largeCov[o2::track::CovLabels::kSigZ2] = kLargeErr2Coord; + largeCov[o2::track::CovLabels::kSigSnp2] = largeCov[o2::track::CovLabels::kSigTgl2] = kLargeErr2Dir; + largeCov[o2::track::CovLabels::kSigQ2Pt2] = kLargeErr2PtI * trPars[o2::track::ParLabels::kQ2Pt] * trPars[o2::track::ParLabels::kQ2Pt]; inwardTrack.setCov(largeCov); inwardTrack.checkCovariance(); @@ -434,7 +416,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa continue; // failed to propagate } - if (std::abs(inputTrack.getZ()) > layers[il].getZ() && applyZacceptance) { + if (std::abs(inputTrack.getZ()) > layers[il].getZ() && mApplyZacceptance) { continue; // out of acceptance bounds but continue inwards } @@ -444,10 +426,10 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa std::vector thisHit = {spacePoint[0], spacePoint[1], spacePoint[2]}; // towards adding cluster: move to track alpha - double alpha = inwardTrack.getAlpha(); - double xyz1[3]{ - TMath::Cos(alpha) * spacePoint[0] + TMath::Sin(alpha) * spacePoint[1], - -TMath::Sin(alpha) * spacePoint[0] + TMath::Cos(alpha) * spacePoint[1], + float alpha = inwardTrack.getAlpha(); + float xyz1[3]{ + std::cos(alpha) * spacePoint[0] + std::sin(alpha) * spacePoint[1], + -std::sin(alpha) * spacePoint[0] + std::cos(alpha) * spacePoint[1], spacePoint[2]}; if (!inwardTrack.propagateTo(xyz1[0], magneticField)) continue; @@ -462,7 +444,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa inwardTrack.checkCovariance(); } - if (applyMSCorrection && layers[il].getRadiationLength() > 0) { + if (mApplyMSCorrection && layers[il].getRadiationLength() > 0) { if (!inputTrack.correctForMaterial(layers[il].getRadiationLength(), 0, applyAngularCorrection)) { return -6; } @@ -470,7 +452,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa return -6; } } - if (applyElossCorrection && layers[il].getDensity() > 0) { + if (mApplyElossCorrection && layers[il].getDensity() > 0) { for (int ise = xrhosteps; ise--;) { // correct in small steps if (!inputTrack.correctForMaterial(0, layers[il].getDensity() / xrhosteps, applyAngularCorrection)) { return -7; @@ -488,9 +470,9 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa hits.push_back(thisHit); - if (applyEffCorrection && !layers[il].isInert()) { // good hit probability calculation - double sigYCmb = o2::math_utils::sqrt(inwardTrack.getSigmaY2() + layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi()); - double sigZCmb = o2::math_utils::sqrt(inwardTrack.getSigmaZ2() + layers[il].getResolutionZ() * layers[il].getResolutionZ()); + if (!layers[il].isInert()) { // good hit probability calculation + float sigYCmb = o2::math_utils::sqrt(inwardTrack.getSigmaY2() + layers[il].getResolutionRPhi() * layers[il].getResolutionRPhi()); + float sigZCmb = o2::math_utils::sqrt(inwardTrack.getSigmaZ2() + layers[il].getResolutionZ() * layers[il].getResolutionZ()); goodHitProbability[il] = ProbGoodChiSqHit(layers[il].getRadius() * 100, sigYCmb * 100, sigZCmb * 100); goodHitProbability[0] *= goodHitProbability[il]; } @@ -498,9 +480,11 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa // backpropagate to original radius float finalX = 1e+3; - inwardTrack.getXatLabR(initialRadius, finalX, magneticField); - if (finalX > 999) + bool inPropStatus = inwardTrack.getXatLabR(initialRadius, finalX, magneticField); + if (finalX > 999) { + LOG(debug) << "Failed to find intercept for initial radius " << initialRadius << " cm, x = " << finalX << " and status " << inPropStatus << " and sn = " << inwardTrack.getSnp() << " r = " << inwardTrack.getY() * inwardTrack.getY(); return -3; // failed to find intercept + } if (!inwardTrack.propagateTo(finalX, magneticField)) { return -4; // failed to propagate @@ -511,17 +495,15 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa return nIntercepts; // generate efficiency - if (applyEffCorrection) { - dNdEtaCent = nch; - float eff = 1.; - for (int i = 0; i < kMaxNumberOfDetectors; i++) { - float iGoodHit = goodHitProbability[i]; - if (iGoodHit <= 0) - continue; - - eff *= iGoodHit; - } + float eff = 1.; + for (int i = 0; i < kMaxNumberOfDetectors; i++) { + float iGoodHit = goodHitProbability[i]; + if (iGoodHit <= 0) + continue; + eff *= iGoodHit; + } + if (mApplyEffCorrection) { if (gRandom->Uniform() > eff) return -8; } @@ -530,11 +512,11 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa outputTrack.checkCovariance(); // Use covariance matrix based smearing - std::array covMat = {0.}; - for (int ii = 0; ii < 15; ii++) + std::array covMat = {0.}; + for (int ii = 0; ii < o2::track::kCovMatSize; ii++) covMat[ii] = outputTrack.getCov()[ii]; TMatrixDSym m(5); - double fcovm[5][5]; + float fcovm[5][5]; for (int ii = 0, k = 0; ii < 5; ++ii) { for (int j = 0; j < ii + 1; ++j, ++k) { @@ -544,7 +526,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa } // evaluate ruben's conditional, regularise - bool makePositiveDefinite = (covMatFactor > -1e-5); // apply fix + const bool makePositiveDefinite = (covMatFactor > -1e-5); // apply fix bool rubenConditional = false; for (int ii = 0; ii < 5; ii++) { for (int jj = 0; jj < 5; jj++) { @@ -571,7 +553,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa } if (negEigVal && rubenConditional && makePositiveDefinite) { - if (verboseLevel > 0) { + if (mVerboseLevel > 0) { LOG(info) << "WARNING: this diagonalization (at pt = " << inputTrack.getPt() << ") has negative eigenvalues despite Ruben's fix! Please be careful!"; LOG(info) << "Printing info:"; LOG(info) << "Kalman updates: " << nIntercepts; @@ -585,9 +567,9 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa covMatOK++; // transform parameter vector and smear - double params_[5]; + float params_[5]; for (int ii = 0; ii < 5; ++ii) { - double val = 0.; + float val = 0.; for (int j = 0; j < 5; ++j) val += eigVec[j][ii] * outputTrack.getParam(j); // smear parameters according to eigenvalues @@ -598,7 +580,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa eigVec.Invert(); // transform back params vector for (int ii = 0; ii < 5; ++ii) { - double val = 0.; + float val = 0.; for (int j = 0; j < 5; ++j) val += eigVec[j][ii] * params_[j]; outputTrack.setParam(val, ii); diff --git a/ALICE3/Core/FastTracker.h b/ALICE3/Core/FastTracker.h index 702caa9e84b..a0dba5d7ec5 100644 --- a/ALICE3/Core/FastTracker.h +++ b/ALICE3/Core/FastTracker.h @@ -12,12 +12,15 @@ #ifndef ALICE3_CORE_FASTTRACKER_H_ #define ALICE3_CORE_FASTTRACKER_H_ -#include // not a system header but megalinter thinks so -#include -#include #include "DetLayer.h" + #include "ReconstructionDataFormats/Track.h" +#include // not a system header but megalinter thinks so + +#include +#include + namespace o2 { namespace fastsim @@ -32,13 +35,16 @@ class FastTracker { public: // Constructor/destructor - FastTracker(); + FastTracker() = default; + // Destructor virtual ~FastTracker() {} // Layer and layer configuration void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0); DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const; - int GetLayerIndex(const std::string name) const; + int GetLayerIndex(const std::string& name) const; + size_t GetNLayers() const { return layers.size(); } + bool IsLayerInert(const int layer) const { return layers[layer].isInert(); } void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].setRadiationLength(x0); } void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].setRadius(r); } void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].setResolutionRPhi(resRPhi); } @@ -80,20 +86,24 @@ class FastTracker void SetIntegrationTime(float t) { integrationTime = t; } void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; } void SetAvgRapidity(float y) { avgRapidity = y; } - void SetdNdEtaCent(float d) { dNdEtaCent = d; } + void SetdNdEtaCent(int d) { dNdEtaCent = d; } void SetLhcUPCscale(float s) { lhcUPCScale = s; } void SetBField(float b) { magneticField = b; } void SetMinRadTrack(float r) { fMinRadTrack = r; } void SetMagneticField(float b) { magneticField = b; } - void SetApplyZacceptance(bool b) { applyZacceptance = b; } - void SetApplyMSCorrection(bool b) { applyMSCorrection = b; } - void SetApplyElossCorrection(bool b) { applyElossCorrection = b; } + void SetApplyZacceptance(bool b) { mApplyZacceptance = b; } + void SetApplyMSCorrection(bool b) { mApplyMSCorrection = b; } + void SetApplyElossCorrection(bool b) { mApplyElossCorrection = b; } + void SetApplyEffCorrection(bool b) { mApplyEffCorrection = b; } // Getters for the last track int GetNIntercepts() const { return nIntercepts; } int GetNSiliconPoints() const { return nSiliconPoints; } int GetNGasPoints() const { return nGasPoints; } - float GetGoodHitProb(int layer) const { return goodHitProbability[layer]; } + float GetGoodHitProb(int layer) const + { + return (layer >= 0 && static_cast(layer) < goodHitProbability.size()) ? goodHitProbability[layer] : 0.0f; + } std::size_t GetNHits() const { return hits.size(); } float GetHitX(const int i) const { return hits[i][0]; } float GetHitY(const int i) const { return hits[i][1]; } @@ -106,34 +116,35 @@ class FastTracker std::vector layers; std::vector> hits; // bookkeep last added hits - // operational - bool applyZacceptance; // check z acceptance or not - bool applyMSCorrection; // Apply correction for multiple scattering - bool applyElossCorrection; // Apply correction for eloss (requires MS correction) - bool applyEffCorrection; // Apply correction for hit efficiency - int verboseLevel; // 0: not verbose, >0 more verbose - int crossSectionMinB; - int dNdEtaCent; - int dNdEtaMinB; - float integrationTime; - float magneticField; // in kiloGauss (5 = 0.5T, etc) - float covMatFactor; // covmat off-diagonal factor to use for covmat fix (negative: no factor) - float sigmaD; - float luminosity; - float otherBackground; - float maxRadiusSlowDet; - float avgRapidity; - float lhcUPCScale; - float upcBackgroundMultiplier; - float fMinRadTrack = 132.; - - uint64_t covMatOK; // cov mat has negative eigenvals - uint64_t covMatNotOK; // cov mat has negative eigenvals - - // last track information - int nIntercepts; // found in first outward propagation - int nSiliconPoints; // silicon-based space points added to track - int nGasPoints; // tpc-based space points added to track + /// configuration parameters + bool mApplyZacceptance = false; /// check z acceptance or not + bool mApplyMSCorrection = true; /// Apply correction for multiple scattering + bool mApplyElossCorrection = true; /// Apply correction for eloss (requires MS correction) + bool mApplyEffCorrection = true; /// Apply correction for hit efficiency + int mVerboseLevel = 0; /// 0: not verbose, >0 more verbose + const float mCrossSectionMinB = 8; /// Minimum bias Cross section for event under study (PbPb MinBias ~ 8 Barns) + int dNdEtaCent = 2200; /// dN/deta e.g. at centrality 0-5% (for 5 TeV PbPb) + int dNdEtaMinB = 1; /// dN/deta for minimum bias events + float integrationTime = 0.02f; /// Integration time in ms + float magneticField = 20.f; /// Magnetic field in kiloGauss (5 = 0.5T, 20 = 2T, etc) + float covMatFactor = 0.99f; /// covmat off-diagonal factor to use for covmat fix (negative: no factor) + float sigmaD = 6.0f; /// sigma for the detector resolution in cm + float luminosity = 1.e27f; /// luminosity in cm^-2 s^-1 (e.g. 1.e27 for PbPb at 5 TeV) + float otherBackground = 0.0f; /// background from other sources, e.g. pileup, in [0, 1] + float maxRadiusSlowDet = 10.f; /// maximum radius of slow detectors in cm + float avgRapidity = 0.45f; /// average rapidity for hit density calculation + float lhcUPCScale = 1.0f; /// scale factor for LHC UPC events + float upcBackgroundMultiplier = 1.0f; /// multiplier for UPC background + float fMinRadTrack = 132.f; /// minimum radius for track propagation in cm + + /// counters for covariance matrix statuses + uint64_t covMatOK = 0; /// cov mat has positive eigenvals + uint64_t covMatNotOK = 0; /// cov mat has negative eigenvals + + /// last track information + int nIntercepts = 0; /// found in first outward propagation + int nSiliconPoints = 0; /// silicon-based space points added to track + int nGasPoints = 0; /// tpc-based space points added to track std::vector goodHitProbability; ClassDef(FastTracker, 1); From cd56de7443ab03dec8ad124f5e7c2d39ee949045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Thu, 12 Jun 2025 14:32:16 +0200 Subject: [PATCH 043/116] [Common] Include What You Use (#11547) --- Common/Core/fwdtrackUtilities.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Common/Core/fwdtrackUtilities.h b/Common/Core/fwdtrackUtilities.h index 13fb27c5862..74fe125c2f0 100644 --- a/Common/Core/fwdtrackUtilities.h +++ b/Common/Core/fwdtrackUtilities.h @@ -18,10 +18,18 @@ #ifndef COMMON_CORE_FWDTRACKUTILITIES_H_ #define COMMON_CORE_FWDTRACKUTILITIES_H_ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + #include -#include -#include "Math/SMatrix.h" -#include "TGeoGlobalMagField.h" namespace o2::aod { From 19e218734db13541c89ff9164b37705a9be9fc05 Mon Sep 17 00:00:00 2001 From: marcobianchi463 <121625445+marcobianchi463@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:13:33 +0200 Subject: [PATCH 044/116] [PWGLF] Harmonics configurable and amplitude definition (#11555) --- PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx | 10 ++--- PWGLF/TableProducer/QC/flowQC.cxx | 42 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx index 6c15c2a626c..14192166fae 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiFlowTree.cxx @@ -428,11 +428,11 @@ struct nucleiFlowTree { computeEventPlane(collision.qvecTPCallImVec()[cfgHarmonics - 2], collision.qvecTPCallReVec()[cfgHarmonics - 2]), computeEventPlane(collision.qvecTPCnegImVec()[cfgHarmonics - 2], collision.qvecTPCnegReVec()[cfgHarmonics - 2]), computeEventPlane(collision.qvecTPCposImVec()[cfgHarmonics - 2], collision.qvecTPCposReVec()[cfgHarmonics - 2]), - collision.sumAmplFT0A(), - collision.sumAmplFT0C(), - static_cast(collision.nTrkTPCall()), - static_cast(collision.nTrkTPCneg()), - static_cast(collision.nTrkTPCpos())}); + std::hypot(collision.qvecFT0AImVec()[cfgHarmonics - 2], collision.qvecFT0AReVec()[cfgHarmonics - 2]), + std::hypot(collision.qvecFT0CImVec()[cfgHarmonics - 2], collision.qvecFT0CReVec()[cfgHarmonics - 2]), + std::hypot(collision.qvecTPCallImVec()[cfgHarmonics - 2], collision.qvecTPCallReVec()[cfgHarmonics - 2]), + std::hypot(collision.qvecTPCnegImVec()[cfgHarmonics - 2], collision.qvecTPCnegReVec()[cfgHarmonics - 2]), + std::hypot(collision.qvecTPCposImVec()[cfgHarmonics - 2], collision.qvecTPCposReVec()[cfgHarmonics - 2])}); } if (flag & kTriton) { if (track.pt() < cfgCutPtMinTree || track.pt() > cfgCutPtMaxTree || track.sign() > 0) diff --git a/PWGLF/TableProducer/QC/flowQC.cxx b/PWGLF/TableProducer/QC/flowQC.cxx index f5dfa06f9d7..1e32b954120 100644 --- a/PWGLF/TableProducer/QC/flowQC.cxx +++ b/PWGLF/TableProducer/QC/flowQC.cxx @@ -111,9 +111,11 @@ struct flowQC { int mRunNumber = 0; float mBz = 0.f; + Configurable cfgHarmonics{"cfgHarmonics", 2, "Harmonics for flow analysis"}; + // Flow analysis using CollWithEPandQvec = soa::Join::iterator; + aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms, aod::CentFV0As, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::EPCalibrationTables, aod::QvectorFT0CVecs, aod::QvectorFT0AVecs, aod::QvectorFT0MVecs, aod::QvectorFV0AVecs, aod::QvectorTPCallVecs, aod::QvectorTPCposVecs, aod::QvectorTPCnegVecs>::iterator; HistogramRegistry general{"general", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry flow_ep{"flow_ep", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -171,15 +173,15 @@ struct flowQC { const AxisSpec centAxis{cfgCentralityBins, fmt::format("{} percentile", (std::string)centDetectorNames[cfgCentralityEstimator])}; - const AxisSpec QxAxis{cfgQvecBins, "Q_{2,x}"}; - const AxisSpec QyAxis{cfgQvecBins, "Q_{2,y}"}; + const AxisSpec QxAxis{cfgQvecBins, Form("Q_{%d,x}", cfgHarmonics.value)}; + const AxisSpec QyAxis{cfgQvecBins, Form("Q_{%d,y}", cfgHarmonics.value)}; - const AxisSpec NormQxAxis{cfgQvecBins, "#frac{Q_{2,x}}{||#vec{Q_{2}}||}"}; - const AxisSpec NormQyAxis{cfgQvecBins, "#frac{Q_{2,y}}{||#vec{Q_{2}}||}"}; + const AxisSpec NormQxAxis{cfgQvecBins, Form("#frac{Q_{%d,x}}{||#vec{Q_{%d}}||}", cfgHarmonics.value, cfgHarmonics.value)}; + const AxisSpec NormQyAxis{cfgQvecBins, Form("#frac{Q_{%d,y}}{||#vec{Q_{%d}}||}", cfgHarmonics.value, cfgHarmonics.value)}; - const AxisSpec psiAxis{cfgPhiBins, "#psi_{2}"}; - const AxisSpec psiCompAxis{cfgPhiBins, "#psi_{2}^{EP} - #psi_{2}^{Qvec}"}; - const AxisSpec cosPsiCompAxis{cfgCosPhiBins, "cos[2(#psi_{2}^{EP} - #psi_{2}^{Qvec})]"}; + const AxisSpec psiAxis{cfgPhiBins, Form("#psi_{%d}", cfgHarmonics.value)}; + const AxisSpec psiCompAxis{cfgPhiBins, Form("#psi_{%d}^{EP} - #psi_{%d}^{Qvec}", cfgHarmonics.value, cfgHarmonics.value)}; + const AxisSpec cosPsiCompAxis{cfgCosPhiBins, Form("cos[2(#psi_{%d}^{EP} - #psi_{%d}^{Qvec})]", cfgHarmonics.value, cfgHarmonics.value)}; // z vertex histogram general.add("hRecVtxZData", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}}); @@ -203,12 +205,12 @@ struct flowQC { hDeltaPsi[iMethod][iQvecDet][jQvecDet] = registry->add(Form("hDeltaPsi_%s_%s_%s", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str(), suffixes[iMethod].c_str()), "", HistType::kTH2F, {centAxis, {cfgDeltaPhiBins, Form("#psi_{%s} - #psi_{%s}", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str())}}); // Scalar-product histograms - auto spLabel = Form("#vec{Q}_{2}^{%s} #upoint #vec{Q}_{2}^{%s}", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str()); + auto spLabel = Form("#vec{Q}_{%d}^{%s} #upoint #vec{Q}_{%d}^{%s}", cfgHarmonics.value, qVecDetectorNames[iQvecDet].c_str(), cfgHarmonics.value, qVecDetectorNames[jQvecDet].c_str()); hScalarProduct[iMethod][iQvecDet][jQvecDet] = registry->add(Form("hScalarProduct_%s_%s_%s", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str(), suffixes[iMethod].c_str()), "", HistType::kTH2F, {centAxis, {cfgQvecBins, spLabel}}); // Normalised scalar-product histograms - auto normSpLabel = Form("#frac{#vec{Q}_{2}^{%s} #upoint #vec{Q}_{2}^{%s}}{||#vec{Q}_{2}^{%s}|| ||#vec{Q}_{2}^{%s}||}", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str(), qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str()); + auto normSpLabel = Form("#frac{#vec{Q}_{%d}^{%s} #upoint #vec{Q}_{%d}^{%s}}{||#vec{Q}_{%d}^{%s}|| ||#vec{Q}_{%d}^{%s}||}", cfgHarmonics.value, qVecDetectorNames[iQvecDet].c_str(), cfgHarmonics.value, qVecDetectorNames[jQvecDet].c_str(), cfgHarmonics.value, qVecDetectorNames[iQvecDet].c_str(), cfgHarmonics.value, qVecDetectorNames[jQvecDet].c_str()); hNormalisedScalarProduct[iMethod][iQvecDet][jQvecDet] = registry->add(Form("hNormalisedScalarProduct_%s_%s_%s", qVecDetectorNames[iQvecDet].c_str(), qVecDetectorNames[jQvecDet].c_str(), suffixes[iMethod].c_str()), "", HistType::kTH2F, {centAxis, {cfgQvecBins, normSpLabel}}); } @@ -285,28 +287,28 @@ struct flowQC { float QyTPC_EP = QmodTPC_EP * std::sin(2 * psiTPC_EP); // Qvec method - float QxFT0A_Qvec = collision.qvecFT0ARe(); - float QyFT0A_Qvec = collision.qvecFT0AIm(); + float QxFT0A_Qvec = collision.qvecFT0AReVec()[cfgHarmonics - 2]; + float QyFT0A_Qvec = collision.qvecFT0AImVec()[cfgHarmonics - 2]; float QmodFT0A_Qvec = std::hypot(QxFT0A_Qvec, QyFT0A_Qvec); float psiFT0A_Qvec = computeEventPlane(QyFT0A_Qvec, QxFT0A_Qvec); - float QxFT0C_Qvec = collision.qvecFT0CRe(); - float QyFT0C_Qvec = collision.qvecFT0CIm(); + float QxFT0C_Qvec = collision.qvecFT0CReVec()[cfgHarmonics - 2]; + float QyFT0C_Qvec = collision.qvecFT0CImVec()[cfgHarmonics - 2]; float QmodFT0C_Qvec = std::hypot(QxFT0C_Qvec, QyFT0C_Qvec); float psiFT0C_Qvec = computeEventPlane(QyFT0C_Qvec, QxFT0C_Qvec); - float QxTPCl_Qvec = collision.qvecBNegRe(); - float QyTPCl_Qvec = collision.qvecBNegIm(); + float QxTPCl_Qvec = collision.qvecTPCnegReVec()[cfgHarmonics - 2]; + float QyTPCl_Qvec = collision.qvecTPCnegImVec()[cfgHarmonics - 2]; float QmodTPCl_Qvec = std::hypot(QxTPCl_Qvec, QyTPCl_Qvec); float psiTPCl_Qvec = computeEventPlane(QyTPCl_Qvec, QxTPCl_Qvec); - float QxTPCr_Qvec = collision.qvecBPosRe(); - float QyTPCr_Qvec = collision.qvecBPosIm(); + float QxTPCr_Qvec = collision.qvecTPCposReVec()[cfgHarmonics - 2]; + float QyTPCr_Qvec = collision.qvecTPCposImVec()[cfgHarmonics - 2]; float QmodTPCr_Qvec = std::hypot(QxTPCr_Qvec, QyTPCr_Qvec); float psiTPCr_Qvec = computeEventPlane(QyTPCr_Qvec, QxTPCr_Qvec); - float QxTPC_Qvec = collision.qvecBTotRe(); - float QyTPC_Qvec = collision.qvecBTotIm(); + float QxTPC_Qvec = collision.qvecTPCallReVec()[cfgHarmonics - 2]; + float QyTPC_Qvec = collision.qvecTPCallImVec()[cfgHarmonics - 2]; float QmodTPC_Qvec = std::hypot(QxTPC_Qvec, QyTPC_Qvec); float psiTPC_Qvec = computeEventPlane(QyTPC_Qvec, QxTPC_Qvec); From e6cfe892884a612f63144e1da17726cd92793d31 Mon Sep 17 00:00:00 2001 From: hernasab Date: Thu, 12 Jun 2025 09:31:25 -0500 Subject: [PATCH 045/116] [PWGCF] added ccdb objects (#11568) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 131 +++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 34 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 3bad6691449..18b92bbfff8 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -14,30 +14,34 @@ /// \since 10/01/2024 /// \brief task to evaluate flow and neutron skin with information from ZDC -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/CCDB/EventSelectionParams.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 "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include #include "TList.h" -#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; @@ -98,7 +102,10 @@ struct FlowZdcTask { Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "T0C Occu cut?"}; Configurable isTDCcut{"isTDCcut", false, "Use TDC cut?"}; Configurable isZEMcut{"isZEMcut", true, "Use ZEM cut?"}; + Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; + Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; + Configurable nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"}; Configurable minNchSel{"minNchSel", 5., "min Nch Selection"}; Configurable znBasedCut{"znBasedCut", 100, "ZN-based cut"}; Configurable zemCut{"zemCut", 1000., "ZEM cut"}; @@ -106,6 +113,11 @@ struct FlowZdcTask { Configurable minOccCut{"minOccCut", 0, "min Occu cut"}; Configurable maxOccCut{"maxOccCut", 500, "max Occu cut"}; Configurable minITSnCls{"minITSnCls", 5, "min ITSnCls"}; + Configurable minPt{"minPt", 0.1, "minimum pt of the tracks"}; + Configurable maxPt{"maxPt", 3., "maximum pt of the tracks"}; + Configurable maxPtSpectra{"maxPtSpectra", 50., "maximum pt of the tracks"}; + Configurable minEta{"minEta", -0.8, "minimum eta"}; + Configurable maxEta{"maxEta", +0.8, "maximum eta"}; // axis configs ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -138,9 +150,12 @@ struct FlowZdcTask { using CollisionDataTable = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; - std::complex qTPC; // init q TPC - std::complex qZNA{0, 0}; // init qZNA - std::complex qZNC{0, 0}; // init qZNC + + // CCDB paths + Configurable paTH{"paTH", "Users/s/sahernan/test", "base path to the ccdb object"}; + Configurable paTHmeanNch{"paTHmeanNch", "Users/s/shernan/test", "base path to the ccdb object"}; + Configurable paTHsigmaNch{"paTHsigmaNch", "Users/s/shernan/testSigma", "base path to the ccdb object"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; enum EvCutLabel { All = 1, @@ -164,8 +179,7 @@ struct FlowZdcTask { // Begin Histogram Registry HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - OutputObj pCosPsiDifferences{TProfile("pCosPsiDifferences", "Differences in cos(psi) vs Centrality;Centrality;Mean cos(psi) Difference", 200, 0, 100, -1, 1)}; - OutputObj pSinPsiDifferences{TProfile("pSinPsiDifferences", "Differences in sin(psi) vs Centrality;Centrality;Mean sin(psi) Difference", 200, 0, 100, -1, 1)}; + Service ccdb; OutputObj pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)}; OutputObj pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)}; OutputObj pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)}; @@ -337,6 +351,24 @@ struct FlowZdcTask { 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.}}}); } + LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; + LOG(info) << "\tapplyEff=" << applyEff.value; + LOG(info) << "\tpaTH=" << paTH.value; + LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; + LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; + LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; + LOG(info) << "\tminPt=" << minPt.value; + LOG(info) << "\tmaxPt=" << maxPt.value; + 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); } template bool isEventSelected(EventCuts const& col) @@ -480,6 +512,7 @@ struct FlowZdcTask { histos.fill(HIST("hEventCounter"), EvCutLabel::Zem); } + const double normT0M{(aT0A + aT0C) / 100.}; float znA = zdc.amplitudeZNA() / cfgCollisionEnergy; float znC = zdc.amplitudeZNC() / cfgCollisionEnergy; float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy; @@ -506,7 +539,50 @@ struct FlowZdcTask { } 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)) { + histos.fill(HIST("ExcludedEvtVsNch"), glbTracks); + } else { + skipEvent = true; + } + } + if (!skipEvent) { + return; + } + + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + + histos.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); + histos.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); + histos.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(); + } histos.fill(HIST("zPos"), collision.posZ()); histos.fill(HIST("T0Ccent"), collision.centFT0C()); @@ -574,18 +650,12 @@ struct FlowZdcTask { int globalTracks = tracks.size(); if (globalTracks < 1) return; - // this is the q vector for the TPC data. it is a complex function - double qTpcReal = 0.0; // Initialize qTPC_real - double qTpcIm = 0.0; // init qTPC_imaginary - std::complex qTPC(0, 0); // Starting with a q-vector of zero int nTot{0}; // Tracks are already filtered with GlobalTrack || GlobalTrackSDD for (const auto& track : tracks) { - double phi = track.phi(); nTot++; histos.fill(HIST("etaHistogram"), track.eta()); histos.fill(HIST("phiHistogram"), track.phi()); histos.fill(HIST("ptHistogram"), track.pt()); - qTPC += std::complex(std::cos(2.0 * phi), std::sin(2.0 * phi)); } // end track loop 1 double pT{0}; for (const auto& track : tracks) { @@ -599,16 +669,9 @@ struct FlowZdcTask { histos.fill(HIST("multvsCent"), cent, nTot); histos.fill(HIST("hYield"), nTot, pT); histos.fill(HIST("multHistogram"), nTot); - qTpcReal = qTPC.real() / nTot; // normalize these vectors by the total number of particles - qTpcIm = qTPC.imag() / nTot; - - histos.fill(HIST("REqHistogram"), qTpcReal); - histos.fill(HIST("IMqHistogram"), qTpcIm); histos.fill(HIST("TPCmultiplicity"), multTPC); histos.fill(HIST("hGlobalTracks"), globalTracks); - - histos.fill(HIST("revsimag"), qTpcReal, qTpcIm); } void processZdcCollAssoc( AodCollisions::iterator const& collision, From 831f016ec46069d59e34c51293b1ff24fbbb29da Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:55:59 +0200 Subject: [PATCH 046/116] [Common] Add timestamp, centrality and evSelection to inter-calib table (#11457) Co-authored-by: ALICE Action Bot --- Common/DataModel/ZDCInterCalib.h | 35 +++--- Common/TableProducer/CMakeLists.txt | 4 +- ...k-intercalib.cxx => zdcTaskInterCalib.cxx} | 116 ++++++++++++++++-- 3 files changed, 129 insertions(+), 26 deletions(-) rename Common/TableProducer/{zdc-task-intercalib.cxx => zdcTaskInterCalib.cxx} (53%) diff --git a/Common/DataModel/ZDCInterCalib.h b/Common/DataModel/ZDCInterCalib.h index 290a3ac61fe..d7b66575340 100644 --- a/Common/DataModel/ZDCInterCalib.h +++ b/Common/DataModel/ZDCInterCalib.h @@ -20,21 +20,23 @@ namespace o2::aod { -namespace znoutput +namespace znoutput // o2-linter: disable=name/workflow-file { -DECLARE_SOA_COLUMN(ZNApmc, commonPMZNA, float); //! PMC ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm1, ZNAPM1, float); //! PM1 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm2, ZNAPM2, float); //! PM2 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm3, ZNAPM3, float); //! PM3 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNApm4, ZNAPM4, float); //! PM4 ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNAtdc, ZNATDC, float); //! TDC ZNA // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpmc, commonPMZNC, float); //! PMC ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm1, ZNCPM1, float); //! PM1 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm2, ZNCPM2, float); //! PM2 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm3, ZNCPM3, float); //! PM3 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCpm4, ZNCPM4, float); //! PM4 ZNC // o2-linter: disable=name/o2-column -DECLARE_SOA_COLUMN(ZNCtdc, ZNCTDC, float); //! TDC ZNC // o2-linter: disable=name/o2-column - +DECLARE_SOA_COLUMN(ZNApmc, commonPMZNA, float); //! PMC ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNApm1, ZNAPM1, float); //! PM1 ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNApm2, ZNAPM2, float); //! PM2 ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNApm3, ZNAPM3, float); //! PM3 ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNApm4, ZNAPM4, float); //! PM4 ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNAtdc, ZNATDC, float); //! TDC ZNA // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCpmc, commonPMZNC, float); //! PMC ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCpm1, ZNCPM1, float); //! PM1 ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCpm2, ZNCPM2, float); //! PM2 ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCpm3, ZNCPM3, float); //! PM3 ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCpm4, ZNCPM4, float); //! PM4 ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(ZNCtdc, ZNCTDC, float); //! TDC ZNC // o2-linter: disable=name/o2-column +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality +DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp +DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags } // namespace znoutput DECLARE_SOA_TABLE(ZDCInterCalib, "AOD", "ZDCIC", o2::soa::Index<>, @@ -49,7 +51,10 @@ DECLARE_SOA_TABLE(ZDCInterCalib, "AOD", "ZDCIC", o2::soa::Index<>, znoutput::ZNCpm2, znoutput::ZNCpm3, znoutput::ZNCpm4, - znoutput::ZNCtdc); + znoutput::ZNCtdc, + znoutput::Centrality, + znoutput::Timestamp, + znoutput::SelectionBits); } // namespace o2::aod #endif // COMMON_DATAMODEL_ZDCINTERCALIB_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 1d6918d6121..d2d59ea2506 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -125,8 +125,8 @@ o2physics_add_dpl_workflow(match-mft-ft0 O2::DetectorsBase O2::DetectorsCommonDataFormats COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(zdc-task-intercalib - SOURCES zdc-task-intercalib.cxx +o2physics_add_dpl_workflow(zdc-task-inter-calib + SOURCES zdcTaskInterCalib.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/zdc-task-intercalib.cxx b/Common/TableProducer/zdcTaskInterCalib.cxx similarity index 53% rename from Common/TableProducer/zdc-task-intercalib.cxx rename to Common/TableProducer/zdcTaskInterCalib.cxx index 77b590bde57..78054580b81 100644 --- a/Common/TableProducer/zdc-task-intercalib.cxx +++ b/Common/TableProducer/zdcTaskInterCalib.cxx @@ -9,12 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file zdc-task-intercalib.cxx +/// \file zdcTaskInterCalib.cxx /// \brief Task for ZDC tower inter-calibration /// \author chiara.oppedisano@cern.ch -// o2-linter: disable=name/workflow-file -// o2-linter: disable=name/file-cpp #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/HistogramRegistry.h" @@ -35,9 +33,9 @@ using namespace o2::framework::expressions; using namespace o2::aod::evsel; using BCsRun3 = soa::Join; -using ColEvSels = soa::Join; +using ColEvSels = soa::Join; -struct ZDCCalibTower { +struct ZdcTaskInterCalib { Produces zTab; @@ -48,9 +46,32 @@ struct ZDCCalibTower { Configurable tdcCut{"tdcCut", false, "Flag for TDC cut"}; Configurable tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"}; Configurable tdcZNmaxcut{"tdcZNmaxcut", -2.5, "Max ZN TDC cut"}; + // Event selections + Configurable cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"}; + Configurable cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"}; + Configurable cfgEvSelsDoOccupancySel{"cfgEvSelsDoOccupancySel", true, "Event selection: do occupancy selection"}; + Configurable cfgEvSelsMaxOccupancy{"cfgEvSelsMaxOccupancy", 10000, "Event selection: set max occupancy"}; + Configurable cfgEvSelsNoSameBunchPileupCut{"cfgEvSelsNoSameBunchPileupCut", true, "Event selection: no same bunch pileup cut"}; + Configurable cfgEvSelsIsGoodZvtxFT0vsPV{"cfgEvSelsIsGoodZvtxFT0vsPV", true, "Event selection: is good ZVTX FT0 vs PV"}; + Configurable cfgEvSelsNoCollInTimeRangeStandard{"cfgEvSelsNoCollInTimeRangeStandard", true, "Event selection: no collision in time range standard"}; + Configurable cfgEvSelsIsVertexITSTPC{"cfgEvSelsIsVertexITSTPC", true, "Event selection: is vertex ITSTPC"}; + Configurable cfgEvSelsIsGoodITSLayersAll{"cfgEvSelsIsGoodITSLayersAll", true, "Event selection: is good ITS layers all"}; // HistogramRegistry registry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + enum SelectionCriteria { + evSel_zvtx, + evSel_sel8, + evSel_occupancy, + evSel_kNoSameBunchPileup, + evSel_kIsGoodZvtxFT0vsPV, + evSel_kNoCollInTimeRangeStandard, + evSel_kIsVertexITSTPC, + evSel_kIsGoodITSLayersAll, + evSel_allEvents, + nEventSelections + }; + void init(InitContext const&) { registry.add("ZNApmc", "ZNApmc; ZNA PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); @@ -65,16 +86,93 @@ struct ZDCCalibTower { registry.add("ZNCpm4", "ZNCpm4; ZNC PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}}); + + registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}}); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll"); + } + + template + uint8_t eventSelected(TCollision collision) + { + uint8_t selectionBits = 0; + bool selected; + + registry.fill(HIST("hEventCount"), evSel_allEvents); + + selected = std::fabs(collision.posZ()) < cfgEvSelVtxZ; + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_zvtx); + registry.fill(HIST("hEventCount"), evSel_zvtx); + } + + selected = collision.sel8(); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_sel8); + registry.fill(HIST("hEventCount"), evSel_sel8); + } + + auto occupancy = collision.trackOccupancyInTimeRange(); + selected = occupancy <= cfgEvSelsMaxOccupancy; + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_occupancy); + registry.fill(HIST("hEventCount"), evSel_occupancy); + } + + selected = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kNoSameBunchPileup); + registry.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup); + } + + selected = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodZvtxFT0vsPV); + registry.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV); + } + + selected = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kNoCollInTimeRangeStandard); + registry.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard); + } + + selected = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kIsVertexITSTPC); + registry.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC); + } + + selected = collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll); + if (selected) { + selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodITSLayersAll); + registry.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll); + } + + return selectionBits; } void process(ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/) { // collision-based event selection + int nTowers = 4; // number of ZDC towers + for (auto const& collision : cols) { const auto& foundBC = collision.foundBC_as(); if (foundBC.has_zdc()) { const auto& zdc = foundBC.zdc(); + uint8_t evSelection = eventSelected(collision); + + float centrality = collision.centFT0C(); + // To assure that ZN have a genuine signal (tagged by the relative TDC) // we can check that the amplitude is >0 or that ADC is NOT very negative (-inf) @@ -117,7 +215,7 @@ struct ZDCCalibTower { }; // if (isZNChit) { - for (int it = 0; it < 4; it++) { + for (int it = 0; it < nTowers; it++) { pmqZNC[it] = (zdc.energySectorZNC())[it]; sumZNC += pmqZNC[it]; } @@ -129,7 +227,7 @@ struct ZDCCalibTower { registry.get(HIST("ZNCsumq"))->Fill(sumZNC); } if (isZNAhit) { - for (int it = 0; it < 4; it++) { + for (int it = 0; it < nTowers; it++) { pmqZNA[it] = (zdc.energySectorZNA())[it]; sumZNA += pmqZNA[it]; } @@ -142,7 +240,7 @@ struct ZDCCalibTower { registry.get(HIST("ZNAsumq"))->Fill(sumZNA); } if (isZNAhit || isZNChit) - zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNC, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNA); + zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNC, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNA, centrality, foundBC.timestamp(), evSelection); } } } @@ -151,5 +249,5 @@ struct ZDCCalibTower { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) // o2-linter: disable=name/file-cpp { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 04295d717f1f52ab2414494e5b388e9fa7de9d42 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Thu, 12 Jun 2025 18:02:14 +0200 Subject: [PATCH 047/116] Add flag to disable its rof cut (#11572) Co-authored-by: Francesco Mazzaschi --- PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 51 ++++++++++---------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index 09ed3ec07b8..5a8624e50e1 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -11,39 +11,39 @@ // // Build hypertriton candidates from V0s and tracks -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFHypernucleiTables.h" +#include "PWGLF/Utils/svPoolCreator.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/PID/TPCPIDResponse.h" #include "Common/Core/RecoDecay.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 "PWGLF/DataModel/EPCalibrationTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" - +#include "Common/TableProducer/PID/pidTOFBase.h" #include "EventFiltering/Zorro.h" #include "EventFiltering/ZorroSummary.h" -#include "Common/Core/PID/TPCPIDResponse.h" -#include "Common/Core/PID/PIDTOF.h" -#include "Common/TableProducer/PID/pidTOFBase.h" -#include "DataFormatsTPC/BetheBlochAleph.h" +#include "CCDB/BasicCCDBManager.h" #include "DCAFitter/DCAFitterN.h" -#include "PWGLF/Utils/svPoolCreator.h" -#include "PWGLF/DataModel/LFHypernucleiTables.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/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -168,6 +168,7 @@ struct hyperRecoTask { Configurable useCustomVertexer{"useCustomVertexer", false, "Use custom vertexer"}; Configurable skipAmbiTracks{"skipAmbiTracks", false, "Skip ambiguous tracks"}; + Configurable disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROC cut for event selection"}; Configurable customVertexerTimeMargin{"customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleName, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"}; Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", true, "If true, divide tpcInnerParam by the electric charge"}; @@ -341,7 +342,7 @@ struct hyperRecoTask { initCCDB(bc); hEvents->Fill(0.); - if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { continue; } From 40a494d560189e38a91304dd1b90bf6e9bd6bb05 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Thu, 12 Jun 2025 18:44:43 +0200 Subject: [PATCH 048/116] [PWGJE] PWGJE Change scheme for outlier removal (#11577) --- PWGJE/Tasks/recoilJets.cxx | 117 +++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index f39d1c9fe25..26abd49517a 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -13,35 +13,33 @@ /// \file recoilJets.cxx /// \brief hadron-jet correlation analysis -#include -#include -#include +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" -#include "TRandom3.h" -#include "TVector2.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/filterTables.h" +#include "CommonConstants/MathConstants.h" #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" -#include "CommonConstants/MathConstants.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/RecoDecay.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetFinder.h" -#include "PWGJE/Core/JetFindingUtilities.h" -#include "PWGJE/DataModel/Jet.h" - -#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "TRandom3.h" +#include "TVector2.h" -#include "EventFiltering/filterTables.h" +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -82,7 +80,6 @@ struct RecoilJets { // 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 pTHatMaxTrack{"pTHatMaxTrack", 999.0, "Maximum fraction of hard scattering for track acceptance in MC"}; // Parameters for recoil jet selection Configurable ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"}; @@ -130,17 +127,29 @@ struct RecoilJets { void init(InitContext const&) { - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(evSel)); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trkSel)); + std::string evSelToString = static_cast(evSel); + std::string trkSelToString = static_cast(trkSel); + + 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 @@ -228,28 +237,33 @@ struct RecoilJets { // Fill histograms with raw or MC det. level data template - void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, bool bIsMC = false, float weight = 1.) + void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, float weight = 1.) { - bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; int nTT = 0; - float pTHat = 0.; - if (bIsMC) - pTHat = getPtHat(weight); + float pTHat = getPtHat(weight); auto dice = rand->Rndm(); if (dice < fracSig) bSigEv = true; + // Remove whole event if jet passes the outlier removal condition + for (const auto& jet : jets) { + if (jet.pt() > pTHatMax * pTHat) { + spectra.fill(HIST("hEventSelectionCount"), 2.5); + return; + } + } + for (const auto& track : tracks) { - if (skipTrack(track)) - continue; + spectra.fill(HIST("hTrackSelectionCount"), 0.5); - if (bIsMC && (track.pt() > pTHatMaxTrack * pTHat)) + if (skipTrack(track)) continue; + spectra.fill(HIST("hTrackSelectionCount"), 1.5); spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), weight); // Search for TT candidate @@ -279,10 +293,6 @@ struct RecoilJets { } for (const auto& jet : jets) { - - if (bIsMC && (jet.pt() > pTHatMax * pTHat)) - continue; - spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); if (nTT > 0) { @@ -327,6 +337,11 @@ struct RecoilJets { if (dice < fracSig) bSigEv = true; + for (const auto& jet : jets) { + if (jet.pt() > pTHatMax * pTHat) + return; + } + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle) @@ -337,9 +352,6 @@ struct RecoilJets { if (bParticleNeutral || !particle.isPhysicalPrimary()) continue; - if (particle.pt() > pTHatMaxTrack * pTHat) - continue; - spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), particle.phi(), weight); if (bSigEv && (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { @@ -367,10 +379,6 @@ struct RecoilJets { } for (const auto& jet : jets) { - - if (jet.pt() > pTHatMax * pTHat) - continue; - spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); if (nTT > 0) { @@ -410,13 +418,15 @@ struct RecoilJets { double phiTTSig = 0.; float pTHat = getPtHat(weight); + for (const auto& jetBase : jetsBase) { + if (jetBase.pt() > pTHatMax * pTHat) + return; + } + for (const auto& track : tracks) { if (skipTrack(track)) continue; - if (track.pt() > pTHatMaxTrack * pTHat) - continue; - if (track.pt() > ptTTsigMin && track.pt() < ptTTsigMax) { vPhiOfTT.push_back(track.phi()); } @@ -428,9 +438,6 @@ struct RecoilJets { phiTTSig = getPhiTT(vPhiOfTT); for (const auto& jetBase : jetsBase) { - if (jetBase.pt() > pTHatMax * pTHat) - continue; - bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); } @@ -440,9 +447,13 @@ struct RecoilJets { FilteredTracks const& tracks, FilteredJets const& jets) { + spectra.fill(HIST("hEventSelectionCount"), 0.5); + if (skipEvent(collision)) return; + spectra.fill(HIST("hEventSelectionCount"), 1.5); + spectra.fill(HIST("vertexZ"), collision.posZ()); fillHistograms(collision, jets, tracks); } @@ -452,11 +463,14 @@ struct RecoilJets { FilteredTracks const& tracks, FilteredJetsDetLevel const& jets) { + spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; + spectra.fill(HIST("hEventSelectionCount"), 1.5); + spectra.fill(HIST("vertexZ"), collision.posZ()); - fillHistograms(collision, jets, tracks, true); + fillHistograms(collision, jets, tracks); } PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", false); @@ -465,9 +479,12 @@ struct RecoilJets { FilteredTracks const& tracks, FilteredJetsDetLevel const& jets) { + spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; + spectra.fill(HIST("hEventSelectionCount"), 1.5); + auto weight = collision.mcCollision().weight(); spectra.fill(HIST("vertexZ"), collision.posZ(), weight); @@ -477,7 +494,7 @@ struct RecoilJets { spectra.fill(HIST("hHasAssocMcCollision"), 1.5, weight); } - fillHistograms(collision, jets, tracks, true, weight); + fillHistograms(collision, jets, tracks, weight); } PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level with event weight", false); From 457296919c8401eda53e0623efce4e9600b66e74 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Thu, 12 Jun 2025 20:17:27 +0200 Subject: [PATCH 049/116] [PWGLF] adjusted size of 2D array for mixing in derived data (#11583) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 33157c327bf..be85c214406 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -985,8 +985,8 @@ struct LfTaskLambdaSpinCorr { auto groupV02 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); auto groupV03 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.index()); - size_t rows = groupV03.size() + 20; - size_t cols = groupV01.size() + 20; + size_t rows = groupV03.size() + 1600; + size_t cols = groupV01.size() + 1600; std::vector> pairStatus(rows, std::vector(cols, false)); histos.fill(HIST("hv0Mult"), groupV01.size()); for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02))) { From 85e9628eb14097938a991480d75aa4f84ad1f5ef Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Fri, 13 Jun 2025 03:20:06 +0800 Subject: [PATCH 050/116] [PWGCF] add TPC cross row (#11574) --- PWGCF/Flow/Tasks/flowTask.cxx | 6 ++- .../Tasks/diHadronCor.cxx | 39 ++++++++++++------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 4390131be3a..7477aa90aed 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -65,7 +65,8 @@ struct FlowTask { O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "Maximal pT for all tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum 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(cfgCutDCAxyppPass3Enabled, bool, false, "switch of ppPass3 DCAxy pt dependent cut") @@ -477,6 +478,7 @@ struct FlowTask { myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); + myTrackSel.SetMinNCrossedRowsTPC(cfgCutTPCCrossedRows); myTrackSel.SetMinNClustersITS(cfgCutITSclu); if (cfgCutDCAxyppPass3Enabled) myTrackSel.SetMaxDcaXYPtDep([](float pt) { return 0.004f + 0.013f / pt; }); // Tuned on the LHC22f anchored MC LHC23d1d on primary pions. 7 Sigmas of the resolution @@ -686,7 +688,7 @@ struct FlowTask { if (cfgTrkSelSwitch) { return myTrackSel.IsSelected(track); } else { - return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu)); + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index 189e201ef68..e79c61b3096 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -62,7 +62,8 @@ struct DiHadronCor { 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, 70.0f, "minimum 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") @@ -242,7 +243,11 @@ struct DiHadronCor { LOGF(fatal, "Full simulation and on-the-fly processing of mixed event not supported"); } if (doprocessMCSame || doprocessOntheflySame) { - registry.add("MCTrue/MCeventcount", "MCeventcount", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event + registry.add("MCTrue/MCeventcount", "MCeventcount", {HistType::kTH1F, {{5, 0, 5, "bin"}}}); // histogram to see how many events are in the same and mixed event + registry.get(HIST("MCTrue/MCeventcount"))->GetXaxis()->SetBinLabel(2, "same all"); + registry.get(HIST("MCTrue/MCeventcount"))->GetXaxis()->SetBinLabel(3, "same reco"); + registry.get(HIST("MCTrue/MCeventcount"))->GetXaxis()->SetBinLabel(4, "mixed all"); + registry.get(HIST("MCTrue/MCeventcount"))->GetXaxis()->SetBinLabel(5, "mixed reco"); registry.add("MCTrue/MCCentrality", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); registry.add("MCTrue/MCNch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); registry.add("MCTrue/MCzVtx", "MCzVtx", {HistType::kTH1D, {axisVertex}}); @@ -254,13 +259,15 @@ struct DiHadronCor { registry.add("MCTrue/MCdeltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); } if (doprocessMCEfficiency) { - registry.add("MCEffeventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); - registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(1, "MC"); - registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(2, "Reco Primary"); - registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(3, "Reco All"); - registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(4, "Fake"); + registry.add("MCEffeventcount", "bin", {HistType::kTH1F, {{5, 0, 5, "bin"}}}); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(1, "All"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(2, "MC"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(3, "Reco Primary"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(4, "Reco All"); + registry.get(HIST("MCEffeventcount"))->GetXaxis()->SetBinLabel(5, "Fake"); } + LOGF(info, "Initializing correlation container"); std::vector corrAxis = {{axisSample, "Sample"}, {axisVertex, "z-vtx (cm)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, @@ -276,6 +283,8 @@ struct DiHadronCor { same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + + LOGF(info, "End of init"); } int getMagneticField(uint64_t timestamp) @@ -319,7 +328,7 @@ struct DiHadronCor { template bool trackSelected(TTrack track) { - return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu)); + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } template @@ -727,13 +736,14 @@ struct DiHadronCor { void processMCEfficiency(FilteredMcCollisions::iterator const& mcCollision, soa::SmallGroups> const& collisions, FilteredMcParticles const& mcParticles, FilteredTracksWithMCLabels const& tracks) { - if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + registry.fill(HIST("MCEffeventcount"), 0.5); + if (cfgSelCollByNch && (mcParticles.size() < cfgCutMultMin || mcParticles.size() >= cfgCutMultMax)) { return; } // Primaries for (const auto& mcParticle : mcParticles) { if (mcParticle.isPhysicalPrimary()) { - registry.fill(HIST("MCEffeventcount"), 0.5); + registry.fill(HIST("MCEffeventcount"), 1.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::MC, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } } @@ -746,16 +756,16 @@ struct DiHadronCor { for (const auto& track : groupedTracks) { if (track.has_mcParticle()) { - const auto& mcParticle = track.mcParticle(); + auto mcParticle = track.mcParticle(); if (mcParticle.isPhysicalPrimary()) { - registry.fill(HIST("MCEffeventcount"), 1.5); + registry.fill(HIST("MCEffeventcount"), 2.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } - registry.fill(HIST("MCEffeventcount"), 2.5); + registry.fill(HIST("MCEffeventcount"), 3.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoAll, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), 0., mcCollision.posZ()); } else { // fake track - registry.fill(HIST("MCEffeventcount"), 3.5); + registry.fill(HIST("MCEffeventcount"), 4.5); same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, track.eta(), track.pt(), 0, 0., mcCollision.posZ()); } } @@ -858,6 +868,7 @@ struct DiHadronCor { continue; } + registry.fill(HIST("MCTrue/MCeventcount"), 4.5); fillMCCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, eventWeight); } } From fd1043542ebcdfd15a4d051810ac04d03620cc26 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Thu, 12 Jun 2025 21:20:09 +0100 Subject: [PATCH 051/116] [PWGJE] Fixing recoil jet response to fill with delta phi (#11578) --- PWGJE/Tasks/jetHadronRecoil.cxx | 108 ++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 33 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 71946c49aee..97cd31cfb5c 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -446,17 +446,6 @@ struct JetHadronRecoil { return; } - for (const auto& mcdjetWTA : mcdjetsWTA) { - double djet = RecoDecay::sqrtSumOfSquares(RecoDecay::constrainAngle(jetBase.phi() - mcdjetWTA.phi(), -o2::constants::math::PI), jetBase.eta() - mcdjetWTA.eta()); - if (mcdjetWTA.pt() > pTHatMaxMCD * pTHat) { - continue; - } - if (djet < 0.6 * jetR) { - dR = djet; - break; - } - } - dR = getWTAaxisDifference(jetBase, mcdjetsWTA, tracks, true); if (jetBase.has_matchedJetGeo()) { @@ -481,6 +470,77 @@ 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) + { + std::vector phiTTAr; + std::vector phiTTArPart; + double phiTT = 0; + 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()) { + continue; + } + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + if (track.pt() > pTHatTrackMaxMCD * pTHat) { + return; + } + if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { + phiTTAr.push_back(track.phi()); + nTT++; + auto particle = track.template mcParticle_as(); + phiTTArPart.push_back(particle.phi()); + } + } + + if (nTT > 0) { + trigNumber = rand->Integer(nTT); + phiTT = phiTTAr[trigNumber]; + phiTTPart = phiTTAr[trigNumber]; + } else { + return; + } + + for (const auto& jetBase : jetsBase) { + double dR = 0; + double dRp = 0; + + if (jetBase.pt() > pTHatMaxMCD * pTHat) { + return; + } + + float dphi = RecoDecay::constrainAngle(jetBase.phi() - phiTT); + dR = getWTAaxisDifference(jetBase, mcdjetsWTA, tracks, true); + + if (jetBase.has_matchedJetGeo()) { + for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + return; + } + + float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTTPart); + dRp = getWTAaxisDifference(jetTag, mcpjetsWTA, particles, true); + + registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight); + registry.fill(HIST("hPhiMatched"), dphi, dphip, weight); + registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight); + registry.fill(HIST("hPhiResolution"), dphip, dphip - dphi, weight); + registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight); + registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight); + registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight); + registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight); + registry.fill(HIST("hDeltaRMatched1d"), dRp, weight); + } + } + } + } + void processData(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, @@ -711,7 +771,7 @@ struct JetHadronRecoil { soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - soa::Filtered const& tracks, + soa::Filtered const& tracks, soa::Filtered const& particles, aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) @@ -724,16 +784,7 @@ struct JetHadronRecoil { } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - bool ishJetEvent = false; - for (const auto& track : tracks) { - if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { - ishJetEvent = true; - break; - } - } - if (ishJetEvent) { - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); - } + fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); @@ -741,7 +792,7 @@ struct JetHadronRecoil { soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - soa::Filtered const& tracks, + soa::Filtered const& tracks, soa::Filtered const& particles, aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) @@ -754,16 +805,7 @@ struct JetHadronRecoil { } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - bool ishJetEvent = false; - for (const auto& track : tracks) { - if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { - ishJetEvent = true; - break; - } - } - if (ishJetEvent) { - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight()); - } + fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight()); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); From f730ae09aa0174a9b00687be4d45d4552a657366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Thu, 12 Jun 2025 22:35:43 +0200 Subject: [PATCH 052/116] [PWGLF] Update inelGt.h (#11579) Co-authored-by: ALICE Builder --- PWGLF/Utils/inelGt.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGLF/Utils/inelGt.h b/PWGLF/Utils/inelGt.h index 2ed513a902c..70c3de8ab4f 100644 --- a/PWGLF/Utils/inelGt.h +++ b/PWGLF/Utils/inelGt.h @@ -19,6 +19,10 @@ #ifndef PWGLF_UTILS_INELGT_H_ #define PWGLF_UTILS_INELGT_H_ +#include "Framework/O2DatabasePDGPlugin.h" + +#include "TParticlePDG.h" + #include namespace o2 From b908e2055dcdfa3c7aa1ef0fab451bfcf7511f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Thu, 12 Jun 2025 22:40:10 +0200 Subject: [PATCH 053/116] [PWGHF,Tutorial] Include What You Use (#11589) --- Tutorials/PWGHF/skimCreatorMini.cxx | 2 -- Tutorials/PWGHF/taskMini.cxx | 1 - 2 files changed, 3 deletions(-) diff --git a/Tutorials/PWGHF/skimCreatorMini.cxx b/Tutorials/PWGHF/skimCreatorMini.cxx index 6fba171cfbf..e3aae5bbaf4 100644 --- a/Tutorials/PWGHF/skimCreatorMini.cxx +++ b/Tutorials/PWGHF/skimCreatorMini.cxx @@ -27,11 +27,9 @@ #include #include #include -#include #include #include #include -#include #include #include diff --git a/Tutorials/PWGHF/taskMini.cxx b/Tutorials/PWGHF/taskMini.cxx index 1876d6230cc..813e9879ce4 100644 --- a/Tutorials/PWGHF/taskMini.cxx +++ b/Tutorials/PWGHF/taskMini.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include From c858688a9fd0046b7b17487bb23a5b407a55c326 Mon Sep 17 00:00:00 2001 From: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Date: Fri, 13 Jun 2025 00:12:51 +0200 Subject: [PATCH 054/116] [PWGCF] Add flag to disable ITS based track selection cuts (#11576) --- PWGCF/Flow/Tasks/flowPtEfficiency.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx index 78dbc0fc731..217b6f7fb36 100644 --- a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx +++ b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx @@ -60,6 +60,7 @@ struct FlowPtEfficiency { 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") + O2_DEFINE_CONFIGURABLE(cfgEnableITSCuts, bool, true, "switch of enabling ITS based track selection cuts") O2_DEFINE_CONFIGURABLE(cfgSelRunNumberEnabled, bool, false, "switch of run number selection") O2_DEFINE_CONFIGURABLE(cfgFlowEnabled, bool, false, "switch of calculating flow") O2_DEFINE_CONFIGURABLE(cfgFlowNbootstrap, int, 30, "Number of subsamples") @@ -219,10 +220,12 @@ struct FlowPtEfficiency { fGFWReco->CreateRegions(); } - if (cfgTrkSelRun3ITSMatch) { - myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default); - } else { - myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + if (cfgEnableITSCuts) { + if (cfgTrkSelRun3ITSMatch) { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } else { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } } if (cfgCutDCAxyppPass3Enabled) { myTrackSel.SetMaxDcaXYPtDep([](float pt) { return 0.004f + 0.013f / pt; }); @@ -230,8 +233,9 @@ struct FlowPtEfficiency { myTrackSel.SetMaxDcaXY(cfgCutDCAxy); } myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); - myTrackSel.SetMinNClustersITS(cfgCutITSclu); myTrackSel.SetMinNCrossedRowsTPC(cfgCutTPCcrossedrows); + if (cfgEnableITSCuts) + myTrackSel.SetMinNClustersITS(cfgCutITSclu); if (!cfgCutDCAzPtDepEnabled) myTrackSel.SetMaxDcaZ(cfgCutDCAz); } @@ -358,10 +362,12 @@ struct FlowPtEfficiency { template bool trackSelected(TTrack track) { - if (cfgkIsTrackGlobal && !track.isGlobalTrack()) + if (cfgkIsTrackGlobal && !track.isGlobalTrack()) { return false; - if (cfgCutDCAzPtDepEnabled && (track.dcaZ() > (0.004f + 0.013f / track.pt()))) + } + if (cfgCutDCAzPtDepEnabled && (track.dcaZ() > (0.004f + 0.013f / track.pt()))) { return false; + } return myTrackSel.IsSelected(track); } @@ -378,7 +384,6 @@ struct FlowPtEfficiency { if (!std::count(cfgRunNumberList.value.begin(), cfgRunNumberList.value.end(), runNumber)) return; } - float imp = 0; bool impFetched = false; float evPhi = 0; @@ -393,7 +398,6 @@ struct FlowPtEfficiency { fGFWReco->Clear(); } - for (const auto& track : tracks) { if (!trackSelected(track)) continue; From 46cc605b0e14d5f015a1ec8d401b0aa62ff6df7a Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Fri, 13 Jun 2025 01:27:43 +0200 Subject: [PATCH 055/116] [PWGCF] FemtoUniverse: Addidng 3D histo of qLCMS vs deta vs deta (#11594) --- .../Core/FemtoUniverseDetaDphiStar.h | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 0a06b3513e8..bc4c6f1ea4e 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -68,6 +68,9 @@ class FemtoUniverseDetaDphiStar histdetadpimixed[0][0] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[0][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); histdetadpimixed[0][1] = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][0])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpiqlcmssame = mHistogramRegistry->add((dirName + static_cast(HistNamesSame[1][7])).c_str(), "; #it{q}_{LCMS}; #Delta #eta; #Delta #phi", kTH3F, {{100, 0.0, 0.5}, {100, -0.15, 0.15}, {100, -0.15, 0.15}}); + histdetadpiqlcmsmixed = mHistogramRegistry->add((dirName + static_cast(HistNamesMixed[1][7])).c_str(), "; #it{q}_{LCMS}; #Delta #eta; #Delta #phi", kTH3F, {{100, 0.0, 0.5}, {100, -0.15, 0.15}, {100, -0.15, 0.15}}); + if (plotForEveryRadii) { for (int i = 0; i < 9; i++) { histdetadpiRadii[0][i] = mHistogramRegistryQA->add((dirName + static_cast(HistNamesRadii[0][i])).c_str(), "; #Delta #eta; #Delta #phi", kTH2F, {{100, -0.15, 0.15}, {100, -0.15, 0.15}}); @@ -407,23 +410,42 @@ class FemtoUniverseDetaDphiStar } } + /// Check if pair is close or not + template + void ClosePairqLCMS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, double qlcms) // add typename Parts and variable parts for adding MClabels + { + magfield = lmagfield; + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = averagePhiStar(part1, part2, 0); + + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpiqlcmssame->Fill(qlcms, deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpiqlcmsmixed->Fill(qlcms, deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + } + } + private: HistogramRegistry* mHistogramRegistry = nullptr; ///< For main output HistogramRegistry* mHistogramRegistryQA = nullptr; ///< For QA output static constexpr std::string_view DirNames[6] = {"kTrack_kTrack/", "kTrack_kV0/", "kV0_kV0/", "kTrack_kPhi/", "kTrack_kD0/", "kCascade_kCascade/"}; - static constexpr std::string_view HistNamesSame[2][7] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", + static constexpr std::string_view HistNamesSame[2][8] = {{"detadphidetadphi0BeforeSame_0", "detadphidetadphi0BeforeSame_1", "detadphidetadphi0BeforeSame_2", "detadphidetadphi0BeforeSame_3", "detadphidetadphi0BeforeSame_4", "detadphidetadphi0BeforeSame_5", - "detadphidetadphi0BeforeSame_6"}, + "detadphidetadphi0BeforeSame_6", "detadphidetadphi0BeforeSameqLCMS"}, {"detadphidetadphi0AfterSame_0", "detadphidetadphi0AfterSame_1", "detadphidetadphi0AfterSame_2", "detadphidetadphi0AfterSame_3", "detadphidetadphi0AfterSame_4", "detadphidetadphi0AfterSame_5", - "detadphidetadphi0AfterSame_6"}}; - static constexpr std::string_view HistNamesMixed[2][7] = {{"detadphidetadphi0BeforeMixed_0", "detadphidetadphi0BeforeMixed_1", "detadphidetadphi0BeforeMixed_2", + "detadphidetadphi0AfterSame_6", "detadphidetadphi0AfterSameqLCMS"}}; + static constexpr std::string_view HistNamesMixed[2][8] = {{"detadphidetadphi0BeforeMixed_0", "detadphidetadphi0BeforeMixed_1", "detadphidetadphi0BeforeMixed_2", "detadphidetadphi0BeforeMixed_3", "detadphidetadphi0BeforeMixed_4", "detadphidetadphi0BeforeMixed_5", - "detadphidetadphi0BeforeMixed_6"}, + "detadphidetadphi0BeforeMixed_6", "detadphidetadphi0BeforeMixedqLCMS"}, {"detadphidetadphi0AfterMixed_0", "detadphidetadphi0AfterMixed_1", "detadphidetadphi0AfterMixed_2", "detadphidetadphi0AfterMixed_3", "detadphidetadphi0AfterMixed_4", "detadphidetadphi0AfterMixed_5", - "detadphidetadphi0AfterMixed_6"}}; + "detadphidetadphi0AfterMixed_6", "detadphidetadphi0AfterMixedqLCMS"}}; static constexpr std::string_view HistNamesRadii[7][9] = {{"detadphidetadphi0Before_0_0", "detadphidetadphi0Before_0_1", "detadphidetadphi0Before_0_2", "detadphidetadphi0Before_0_3", "detadphidetadphi0Before_0_4", "detadphidetadphi0Before_0_5", @@ -471,6 +493,9 @@ class FemtoUniverseDetaDphiStar std::array, 2>, 7> histdetadpimixed{}; std::array, 9>, 7> histdetadpiRadii{}; + std::shared_ptr histdetadpiqlcmssame{}; + std::shared_ptr histdetadpiqlcmsmixed{}; + /// Calculate phi at all required radii stored in TmpRadiiTPC /// Magnetic field to be provided in Tesla template From 05d68bc75024e512f1ed7eae49e672635f659876 Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Fri, 13 Jun 2025 01:39:22 +0200 Subject: [PATCH 056/116] [PWGCF] Addition New PID function (#11582) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 127 ++++++++++++++++++++++++++---- 1 file changed, 113 insertions(+), 14 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index dfcf5fb42fc..1d979488da3 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -36,6 +36,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Multiplicity.h" #include "CommonConstants/PhysicsConstants.h" @@ -82,13 +83,14 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgTpcCluster, int, 70, "Number of TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgTpcCrossRows, int, 70, "Number of TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, true, "Fill and output NUA weights") O2_DEFINE_CONFIGURABLE(cfgOutputRunByRun, bool, true, "Fill and output NUA weights run by run") 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(cfgTpcNsigmaCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons") + O2_DEFINE_CONFIGURABLE(cfgTpcCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons") O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 2.0f, "DCAxy range for tracks") O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz range for tracks") @@ -97,18 +99,20 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgCutOccupancyMax, int, 2000, "Maximum occupancy cut") O2_DEFINE_CONFIGURABLE(cfgUseGlobalTrack, bool, true, "use Global track") O2_DEFINE_CONFIGURABLE(cfgITScluster, int, 5, "Number of ITS cluster") - O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, true, "Use track density efficiency correction") + O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, false, "Use track density efficiency correction") O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiEtaVtxz, bool, false, "Use Phi, Eta, VertexZ dependent NUA weights") O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiPtCent, bool, false, "Use Phi, Pt, Centrality dependent NUA weights") O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiEtaPt, bool, true, "Use Phi, Eta, Pt dependent NUA weights") O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC") O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut") + O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts"); 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> cfgTofNsigmaCut{"cfgTofNsigmaCut", std::vector{1.5, 1.5, 1.5}, "TOF n-sigma cut for pions, kaons, protons"}; - Configurable> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector{3, 2.5, 2}, "ITS n-sigma cut for pions, kaons, protons"}; + Configurable> cfgTofNsigmaCut{"cfgTofNsigmaCut", 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> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector{3, 2.5, 2, 3, 2.5, 2}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> cfgTpcNsigmaCut{"cfgTpcNsigmaCut", 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> cfgUseEventCuts{"cfgUseEventCuts", std::vector{1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0}, "Switch for various event cuts [kNoTimeFrameBorder, kNoITSROFrameBorder, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV, kNoCollInTimeRangeStandard, kIsGoodITSLayersAll, kNoCollInRofStandard, kNoHighMultCollInPrevRof, Occupancy, Multiplicity correlation, T0AV0A 3 sigma cut, kIsVertexITSTPC, kTVXinTRD]"}; Configurable cfgRegions{"cfgRegions", {{"refN08", "refP08", "full", "poiN", "olN", "poiP", "olP", "poi", "ol", "poiNpi", "olNpi", "poiPpi", "olPpi", "poifullpi", "olfullpi", "poiNka", "olNka", "poiPka", "olPka", "poifullka", "olfullka", "poiNpr", "olNpr", "poiPpr", "olPpr", "poifullpr", "olfullpr"}, {-0.8, 0.4, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8}, {-0.4, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8}, {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 128, 256, 128, 256, 128, 256, 2, 16, 2, 16, 2, 16, 4, 32, 4, 32, 4, 32, 8, 64, 8, 64, 8, 64}}, "Configurations for GFW regions"}; @@ -123,9 +127,11 @@ struct FlowPbpbPikp { ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; + ConfigurableAxis axisTOFbeta{"axisTOFbeta", {200, 0, 2}, "axis for TOF beta"}; std::vector tofNsigmaCut = cfgTofNsigmaCut; std::vector itsNsigmaCut = cfgItsNsigmaCut; + std::vector tpcNsigmaCut = cfgTofNsigmaCut; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); @@ -238,11 +244,15 @@ struct FlowPbpbPikp { histos.add("c24_full_pi", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c24_full_ka", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c24_full_pr", "", {HistType::kTProfile, {axisMultiplicity}}); + + histos.add("TpcdEdx", "", {HistType::kTH2D, {axisPt, axisTPCsignal}}); + histos.add("TofBeta", "", {HistType::kTH2D, {axisPt, axisTOFbeta}}); + histos.add("TofTpcNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); - histos.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{15, 0, 15}}}); + histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, 0, 15}}}); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "kNoTimeFrameBorder"); @@ -259,6 +269,18 @@ struct FlowPbpbPikp { histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(14, "kIsVertexITSTPC"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(15, "kTVXinTRD"); + histos.add("hTrackCount", "Number of Tracks;; Count", {HistType::kTH1D, {{10, 0, 10}}}); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(1, "Filtered track"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(2, "Global tracks"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(3, "PV contributor"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(4, "ITS clusters"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(5, "TPC signal"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(6, "TPC clusters"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(7, "TPC crossed rows"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(8, "Pions"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(9, "Kaons"); + histos.get(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(10, "Protons"); + if (cfgOutputNUAWeights && !cfgOutputRunByRun) { histos.add("NUA/hPhiEtaVtxz_ref", ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, axisEta, axisVertex}}); histos.add("NUA/hPhiEtaVtxz_ch", ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, axisEta, axisVertex}}); @@ -386,13 +408,38 @@ struct FlowPbpbPikp { template bool selectionTrack(const TTrack& track) { - if (cfgUseGlobalTrack && !(track.isGlobalTrack() && track.isPVContributor() && track.itsNCls() > cfgITScluster && track.tpcNClsFound() > cfgTpcCluster && track.hasTPC())) { - return false; + histos.fill(HIST("hTrackCount"), 0.5); // Filtered tracks + if (cfgUseGlobalTrack && !(track.isGlobalTrack())) { + return 0; } - if (!cfgUseGlobalTrack && !(track.isPVContributor() && track.itsNCls() > cfgITScluster && track.hasTPC())) { - return false; + if (cfgUseGlobalTrack) + histos.fill(HIST("hTrackCount"), 1.5); // After global track selection + + if (!(track.isPVContributor())) { + return 0; } - return true; + histos.fill(HIST("hTrackCount"), 2.5); // After PV contributor selection + + if (!(track.itsNCls() > cfgITScluster)) { + return 0; + } + histos.fill(HIST("hTrackCount"), 3.5); // After ITS cluster selection + + if (!(track.hasTPC())) { + return 0; + } + histos.fill(HIST("hTrackCount"), 4.5); // If track has TPC signal + + if (!(track.tpcNClsFound() > cfgTpcCluster)) { + return 0; + } + histos.fill(HIST("hTrackCount"), 5.5); // After TPC cluster selection + + if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows)) { + return 0; + } + histos.fill(HIST("hTrackCount"), 6.5); // After TPC crossed rows selection + return 1; } template @@ -402,6 +449,7 @@ struct FlowPbpbPikp { switch (pidIndex) { case 1: histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt()); + histos.fill(HIST("hTrackCount"), 7.5); // Pion count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pi_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // pion weights if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent) @@ -411,6 +459,7 @@ struct FlowPbpbPikp { break; case 2: histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt()); + histos.fill(HIST("hTrackCount"), 8.5); // Kaon count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_ka_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // kaon weights if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent) @@ -420,6 +469,7 @@ struct FlowPbpbPikp { break; case 3: histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt()); + histos.fill(HIST("hTrackCount"), 9.5); // Proton count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pr_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // proton weights if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent) @@ -437,12 +487,12 @@ struct FlowPbpbPikp { std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; int pid = -1; - float nsigma = cfgTpcNsigmaCut; + float nsigma = cfgTpcCut; // Choose which nSigma to use std::array nSigmaToUse = (track.pt() > cfgTofPtCut && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; if (track.pt() > cfgTofPtCut && !track.hasTOF()) - return -1; + return 0; const int numSpecies = 3; int pidCount = 0; @@ -450,7 +500,7 @@ struct FlowPbpbPikp { for (int i = 0; i < numSpecies; ++i) { if (std::abs(nSigmaToUse[i]) < nsigma) { if (pidCount > 0 && cfgUseStrictPID) - return -1; // more than one particle with low nsigma + return 0; // more than one particle with low nsigma pidCount++; pid = i; @@ -461,6 +511,52 @@ struct FlowPbpbPikp { return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } + template + int getNsigmaPIDTpcTofAssymmetric(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()}; + int pid = -1; + + bool isPion, isKaon, isProton; + bool isTpcPion = nSigmaTPC[0] < tpcNsigmaCut[0] && nSigmaTPC[0] > tpcNsigmaCut[0 + 3]; + bool isTpcKaon = nSigmaTPC[1] < tpcNsigmaCut[1] && nSigmaTPC[1] > tpcNsigmaCut[1 + 3]; + bool isTpcProton = nSigmaTPC[2] < tpcNsigmaCut[2] && nSigmaTPC[2] > tpcNsigmaCut[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() > cfgTofPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgTofPtCut && track.hasTOF()) { + isPion = isTofPion && isTpcPion; + isKaon = isTofKaon && isTpcKaon; + isProton = isTofProton && isTpcProton; + } else { + isPion = isTpcPion; + isKaon = isTpcKaon; + isProton = isTpcProton; + } + + 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 + } + template void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) { @@ -814,6 +910,9 @@ struct FlowPbpbPikp { histos.fill(HIST("hEta"), track.eta()); histos.fill(HIST("hPt"), pt); + histos.fill(HIST("TpcdEdx"), pt, track.tpcSignal()); + histos.fill(HIST("TofBeta"), pt, track.beta()); + histos.fill(HIST("TofTpcNsigma_before"), PIONS, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); histos.fill(HIST("TofTpcNsigma_before"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); histos.fill(HIST("TofTpcNsigma_before"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); @@ -821,7 +920,7 @@ struct FlowPbpbPikp { bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range - pidIndex = getNsigmaPIDTpcTof(track); + pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDTpcTofAssymmetric(track) : getNsigmaPIDTpcTof(track); weff = 1; // Initializing weff for each track // NUA weights From ac790757978633c85887aefee4357d48e4e90eac Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Fri, 13 Jun 2025 07:10:26 +0200 Subject: [PATCH 057/116] [Common] Unified, simple, fully self-configuring mult/cent provider (#11495) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder Co-authored-by: romainschotter Co-authored-by: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> --- Common/DataModel/Centrality.h | 9 + Common/TableProducer/CMakeLists.txt | 5 + Common/TableProducer/multCentTable.cxx | 204 ++++ Common/Tools/MultModule.h | 1336 ++++++++++++++++++++++++ 4 files changed, 1554 insertions(+) create mode 100644 Common/TableProducer/multCentTable.cxx create mode 100644 Common/Tools/MultModule.h diff --git a/Common/DataModel/Centrality.h b/Common/DataModel/Centrality.h index c3074a63c67..fa7e2ec51bc 100644 --- a/Common/DataModel/Centrality.h +++ b/Common/DataModel/Centrality.h @@ -60,6 +60,11 @@ DECLARE_SOA_TABLE(CentMFTs, "AOD", "CENTMFT", cent::CentMFT); //! Ru // Run 3 variant tables DECLARE_SOA_TABLE(CentFT0CVariant1s, "AOD", "CENTFT0Cvar1", cent::CentFT0CVariant1); //! Run 3 FT0C variant 1 +// Run 3 centrality per BC (joinable with BC) +DECLARE_SOA_TABLE(BCCentFT0Ms, "AOD", "BCCENTFT0M", cent::CentFT0M, o2::soa::Marker<1>); //! Run 3 FT0M BC centrality table +DECLARE_SOA_TABLE(BCCentFT0As, "AOD", "BCCENTFT0A", cent::CentFT0A, o2::soa::Marker<1>); //! Run 3 FT0A BC centrality table +DECLARE_SOA_TABLE(BCCentFT0Cs, "AOD", "BCCENTFT0C", cent::CentFT0C, o2::soa::Marker<1>); //! Run 3 FT0C BC centrality table + using CentRun2V0M = CentRun2V0Ms::iterator; using CentRun2V0A = CentRun2V0As::iterator; using CentRun2SPDTrk = CentRun2SPDTrks::iterator; @@ -77,6 +82,10 @@ using CentNTPV = CentNTPVs::iterator; using CentNGlobal = CentNGlobals::iterator; using CentMFT = CentMFTs::iterator; +using BCCentFT0M = BCCentFT0Ms::iterator; +using BCCentFT0A = BCCentFT0As::iterator; +using BCCentFT0C = BCCentFT0Cs::iterator; + template concept HasRun2Centrality = requires(T&& t) { { t.centRun2V0M() }; diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index d2d59ea2506..62211406807 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -32,6 +32,11 @@ o2physics_add_dpl_workflow(multiplicity-table PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(multcenttable + SOURCES multCentTable.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(multiplicity-extra-table SOURCES multiplicityExtraTable.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/Common/TableProducer/multCentTable.cxx b/Common/TableProducer/multCentTable.cxx new file mode 100644 index 00000000000..421e813bad4 --- /dev/null +++ b/Common/TableProducer/multCentTable.cxx @@ -0,0 +1,204 @@ +// 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 multCentTable.cxx +/// \brief unified, self-configuring mult/cent provider +/// \author ALICE + +//=============================================================== +// +// Unified, self-configuring multiplicity+centrality task +// still work in progress: use at your own discretion +// +//=============================================================== + +#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 "CCDB/CcdbApi.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.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/O2DatabasePDGPlugin.h" +#include "MetadataHelper.h" +#include "Common/Tools/MultModule.h" + +using namespace o2; +using namespace o2::framework; +// using namespace o2::framework::expressions; + +MetadataHelper metadataInfo; // Metadata helper + +struct MultCentTable { + o2::common::multiplicity::standardConfigurables opts; + o2::common::multiplicity::products products; + o2::common::multiplicity::MultModule module; + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + Service pdg; + + // hold multiplicity values for layover to centrality calculation + std::vector mults; + + // slicers + Preslice> slicerTracksIU = o2::aod::track::collisionId; + Preslice> slicerTracksIUwithSelections = o2::aod::track::collisionId; + Preslice> slicerTrackRun2 = o2::aod::track::collisionId; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + module.init(opts, initContext); + } + + void processRun2(soa::Join const& collisions, + soa::Join const& tracks, + soa::Join const& bcs, + aod::Zdcs const&, + aod::FV0As const&, + aod::FV0Cs const&, + aod::FT0s const&) + { + mults.clear(); + for (auto const& collision : collisions) { + o2::common::multiplicity::multEntry mult; + const auto& bc = bcs.rawIteratorAt(collision.getId()); + const uint64_t collIdx = collision.globalIndex(); + auto tracksThisCollision = tracks.sliceBy(slicerTrackRun2, collIdx); + mult = module.collisionProcessRun2(collision, tracksThisCollision, bc, products); + mults.push_back(mult); + } + } + + void processRun3(soa::Join const& collisions, + soa::Join const& tracks, + soa::Join const&, + aod::Zdcs const&, + aod::FV0As const&, + aod::FT0s const&, + aod::FDDs const&) + { + mults.clear(); + for (auto const& collision : collisions) { + o2::common::multiplicity::multEntry mult; + const auto& bc = collision.bc_as>(); + const uint64_t collIdx = collision.globalIndex(); + auto tracksThisCollision = tracks.sliceBy(slicerTracksIU, collIdx); + mult = module.collisionProcessRun3(ccdb, metadataInfo, collision, tracksThisCollision, bc, products); + mults.push_back(mult); + } + } + + void processRun3WithGlobalCounters(soa::Join const& collisions, + soa::Join const& tracks, + soa::Join const&, + aod::Zdcs const&, + aod::FV0As const&, + aod::FT0s const&, + aod::FDDs const&) + { + mults.clear(); + for (auto const& collision : collisions) { + o2::common::multiplicity::multEntry mult; + const auto& bc = collision.bc_as>(); + const uint64_t collIdx = collision.globalIndex(); + auto tracksThisCollision = tracks.sliceBy(slicerTracksIUwithSelections, collIdx); + mult = module.collisionProcessRun3(ccdb, metadataInfo, collision, tracksThisCollision, bc, products); + mults.push_back(mult); + } + } + void processMFT(soa::Join::iterator const& collision, + o2::aod::MFTTracks const& mfttracks, + soa::SmallGroups const& retracks) + { + if (opts.mEnabledTables[o2::common::multiplicity::kMFTMults]) { + // populates MFT information in the mults buffer (in addition to filling table) + module.collisionProcessMFT(collision, mfttracks, retracks, mults, products); + } + } + void processMonteCarlo(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) + { + if (opts.mEnabledTables[o2::common::multiplicity::kMultMCExtras]) { + module.collisionProcessMonteCarlo(mcCollision, mcParticles, pdg, products); + } + } + void processMonteCarlo2Mults(soa::Join::iterator const& collision) + { + if (opts.mEnabledTables[o2::common::multiplicity::kMult2MCExtras]) { + // establish simple interlink for posterior analysis (derived data) + products.tableExtraMult2MCExtras(collision.mcCollisionId()); + } + } + void processCentralityRun2(aod::Collisions const& collisions, soa::Join const& bcs) + { + // it is important that this function is at the end of the other process functions. + // it requires `mults` to be properly set, which will only happen after the other process + // functions have been called. + + // internally, the function below will do nothing if no centrality is requested. + // it is thus safer to always keep the actual process function for centrality + // generation to true, since the requisites for being in this context are + // always fulfilled + if (collisions.size() != static_cast(mults.size())) { + LOGF(fatal, "Size of collisions doesn't match size of multiplicity buffer!"); + } + module.generateCentralitiesRun2(ccdb, metadataInfo, bcs, mults, products); + } + void processCentralityRun3(aod::Collisions const& collisions, soa::Join const& bcs, aod::FT0s const&) + { + // it is important that this function is at the end of the other process functions. + // it requires `mults` to be properly set, which will only happen after the other process + // functions have been called. + + // internally, the function below will do nothing if no centrality is requested. + // it is thus safer to always keep the actual process function for centrality + // generation to true, since the requisites for being in this context are + // always fulfilled + if (collisions.size() != static_cast(mults.size())) { + LOGF(fatal, "Size of collisions doesn't match size of multiplicity buffer!"); + } + module.generateCentralitiesRun3(ccdb, metadataInfo, bcs, mults, products); + } + + PROCESS_SWITCH(MultCentTable, processRun2, "Process Run 2", false); + PROCESS_SWITCH(MultCentTable, processRun3, "Process Run 3", true); + PROCESS_SWITCH(MultCentTable, processRun3WithGlobalCounters, "Process Run 3 + global tracking counters", false); + PROCESS_SWITCH(MultCentTable, processMFT, "Process MFT info", false); + PROCESS_SWITCH(MultCentTable, processMonteCarlo, "Process Monte Carlo information", false); + PROCESS_SWITCH(MultCentTable, processMonteCarlo2Mults, "Process Monte Carlo information", false); + PROCESS_SWITCH(MultCentTable, processCentralityRun2, "Generate Run 2 centralities", false); + PROCESS_SWITCH(MultCentTable, processCentralityRun3, "Generate Run 3 centralities", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + metadataInfo.initMetadata(cfgc); + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h new file mode 100644 index 00000000000..07397131b68 --- /dev/null +++ b/Common/Tools/MultModule.h @@ -0,0 +1,1336 @@ +// 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 MultModule.h +/// \brief combined multiplicity + centrality module with autodetect features +/// \author ALICE + +#ifndef COMMON_TOOLS_MULTMODULE_H_ +#define COMMON_TOOLS_MULTMODULE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "Framework/AnalysisDataModel.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramSpec.h" +#include "TableHelper.h" +#include "Common/Core/TPCVDriftManager.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" +#include "TFormula.h" + +//__________________________________________ +// MultModule + +namespace o2 +{ +namespace common +{ +namespace multiplicity +{ + +// statics necessary for the configurables in this namespace +static constexpr int nParameters = 1; +static const std::vector tableNames{ + // multiplicity subcomponent + "FV0Mults", + "FV0AOuterMults", + "FT0Mults", + "FDDMults", + "ZDCMults", + "TrackletMults", + "TPCMults", + "PVMults", + "MultsExtra", + "MultSelections", + "FV0MultZeqs", + "FT0MultZeqs", + "FDDMultZeqs", + "PVMultZeqs", + "MultMCExtras", + "kMult2MCExtras", + "kMFTMults", + "kMultsGlobal", + + // centrality subcomponent + "CentRun2V0Ms", + "CentRun2V0As", + "CentRun2SPDTrks", + "CentRun2SPDClss", + "CentRun2CL0s", + "CentRun2CL1s", + "CentFV0As", + "CentFT0Ms", + "CentFT0As", + "CentFT0Cs", + "CentFT0CVariant1s", + "CentFDDMs", + "CentNTPVs", + "CentNGlobals", + "CentMFTs", + "BCCentFT0Ms", + "BCCentFT0As", + "BCCentFT0Cs"}; + +static constexpr int nTablesConst = 36; + +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[nTablesConst][nParameters]{ + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}}; + +// table index : match order above +enum tableIndex { kFV0Mults, // standard + kFV0AOuterMults, // standard + kFT0Mults, // standard + kFDDMults, // standard + kZDCMults, // standard + kTrackletMults, // Run 2 + kTPCMults, // standard + kPVMults, // standard + kMultsExtra, // standard + kMultSelections, // event selection + kFV0MultZeqs, // zeq calib, standard + kFT0MultZeqs, // zeq calib, standard + kFDDMultZeqs, // zeq calib, standard + kPVMultZeqs, // zeq calib, standard + kMultMCExtras, // MC exclusive + kMult2MCExtras, // MC exclusive + kMFTMults, // requires MFT task + kMultsGlobal, // requires track selection task + + // centrality subcomponent + kCentRun2V0Ms, // Run 2 + kCentRun2V0As, // Run 2 + kCentRun2SPDTrks, // Run 2 + kCentRun2SPDClss, // Run 2 + kCentRun2CL0s, // Run 2 + kCentRun2CL1s, // Run 2 + kCentFV0As, // standard Run 3 + kCentFT0Ms, // standard Run 3 + kCentFT0As, // standard Run 3 + kCentFT0Cs, // standard Run 3 + kCentFT0CVariant1s, // standard Run 3 + kCentFDDMs, // standard Run 3 + kCentNTPVs, // standard Run 3 + kCentNGlobals, // requires track selection task + kCentMFTs, // requires MFT task + kBCCentFT0Ms, // bc centrality + kBCCentFT0As, // bc centrality + kBCCentFT0Cs, // bc centrality + kNTables }; + +struct products : o2::framework::ProducesGroup { + //__________________________________________________ + // multiplicity tables + o2::framework::Produces tableFV0; + o2::framework::Produces tableFV0AOuter; + o2::framework::Produces tableFT0; + o2::framework::Produces tableFDD; + o2::framework::Produces tableZDC; + o2::framework::Produces tableTracklet; + o2::framework::Produces tableTpc; + o2::framework::Produces tablePv; + o2::framework::Produces tableExtra; + o2::framework::Produces multSelections; + o2::framework::Produces tableFV0Zeqs; + o2::framework::Produces tableFT0Zeqs; + o2::framework::Produces tableFDDZeqs; + o2::framework::Produces tablePVZeqs; + o2::framework::Produces tableExtraMc; + o2::framework::Produces tableExtraMult2MCExtras; + o2::framework::Produces mftMults; + o2::framework::Produces multsGlobal; + + //__________________________________________________ + // centrality tables (per collision / default) + o2::framework::Produces centRun2V0M; + o2::framework::Produces centRun2V0A; + o2::framework::Produces centRun2SPDTracklets; + o2::framework::Produces centRun2SPDClusters; + o2::framework::Produces centRun2CL0; + o2::framework::Produces centRun2CL1; + o2::framework::Produces centFV0A; + o2::framework::Produces centFT0M; + o2::framework::Produces centFT0A; + o2::framework::Produces centFT0C; + o2::framework::Produces centFT0CVariant1; + o2::framework::Produces centFDDM; + o2::framework::Produces centNTPV; + o2::framework::Produces centNGlobals; + o2::framework::Produces centMFTs; + o2::framework::Produces bcCentFT0A; + o2::framework::Produces bcCentFT0C; + o2::framework::Produces bcCentFT0M; + + //__________________________________________________ + // centrality tables per BC + // FIXME - future development +}; + +// for providing temporary buffer +// FIXME ideally cursors could be readable +// to avoid duplicate memory allocation but ok +struct multEntry { + float multFV0A = 0.0f; + float multFV0C = 0.0f; + float multFV0AOuter = 0.0f; + float multFT0A = 0.0f; + float multFT0C = 0.0f; + float multFDDA = 0.0f; + float multFDDC = 0.0f; + float multZNA = 0.0f; + float multZNC = 0.0f; + float multZEM1 = 0.0f; + float multZEM2 = 0.0f; + float multZPA = 0.0f; + float multZPC = 0.0f; + int multTracklets = 0; + + int multNContribs = 0; // PVMult 0.8 + int multNContribsEta1 = 0; // PVMult 1.0 + int multNContribsEtaHalf = 0; // PVMult 0.5 + int multTPC = 0; // all TPC (PV contrib unchecked) + int multHasTPC = 0; // extras + int multHasITS = 0; // extras + int multHasTOF = 0; // extras + int multHasTRD = 0; // extras + int multITSOnly = 0; // extras + int multTPCOnly = 0; // extras + int multITSTPC = 0; // extras + int multAllTracksTPCOnly = 0; // extras + int multAllTracksITSTPC = 0; // extras + + float multFV0AZeq = -999.0f; + float multFV0CZeq = -999.0f; + float multFT0AZeq = -999.0f; + float multFT0CZeq = -999.0f; + float multFDDAZeq = -999.0f; + float multFDDCZeq = -999.0f; + float multNContribsZeq = 0; + + int multGlobalTracks = 0; // multsGlobal + int multNbrContribsEta05GlobalTrackWoDCA = 0; // multsGlobal + int multNbrContribsEta08GlobalTrackWoDCA = 0; // multsGlobal + int multNbrContribsEta10GlobalTrackWoDCA = 0; // multsGlobal + + int multMFTAllTracks = 0; // mft + int multMFTTracks = 0; // mft + + // For Run2 only + float posZ = -999.0f; + uint16_t spdClustersL0 = 0; + uint16_t spdClustersL1 = 0; +}; + +// strangenessBuilder: 1st-order configurables +struct standardConfigurables : o2::framework::ConfigurableGroup { + // self-configuration configurables + o2::framework::Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTablesConst, nParameters, tableNames, parameterNames}, + "Produce this table: -1 for autodetect; otherwise, 0/1 is false/true"}; + std::vector mEnabledTables; // Vector of enabled tables + + // Autoconfigure process functions + o2::framework::Configurable autoConfigureProcess{"autoConfigureProcess", false, "if true, will configure process function switches based on metadata"}; + + // do vertex-Z equalized or not + o2::framework::Configurable doVertexZeq{"doVertexZeq", 1, "if 1: do vertex Z eq mult table"}; + + // global track counter configurables + o2::framework::Configurable minPtGlobalTrack{"minPtGlobalTrack", 0.15, "min. pT for global tracks"}; + o2::framework::Configurable maxPtGlobalTrack{"maxPtGlobalTrack", 1e+10, "max. pT for global tracks"}; + o2::framework::Configurable minNclsITSGlobalTrack{"minNclsITSGlobalTrack", 5, "min. number of ITS clusters for global tracks"}; + o2::framework::Configurable minNclsITSibGlobalTrack{"minNclsITSibGlobalTrack", 1, "min. number of ITSib clusters for global tracks"}; + + // ccdb information + o2::framework::Configurable ccdbPathVtxZ{"ccdbPathVtxZ", "Centrality/Calibration", "The CCDB path for vertex-Z calibration"}; + o2::framework::Configurable ccdbPathCentrality{"ccdbPathCentrality", "Centrality/Estimators", "The CCDB path for centrality information"}; + o2::framework::Configurable reconstructionPass{"reconstructionPass", "", {"Apass to use when fetching the calibration tables. Empty (default) does not check for any pass. Use `metadata` to fetch it from the AO2D metadata. Otherwise it will override the metadata."}}; + + // centrality operation + o2::framework::Configurable generatorName{"generatorName", "", {"Specify if and only if this is MC. Typical: PYTHIA"}}; + o2::framework::Configurable embedINELgtZEROselection{"embedINELgtZEROselection", false, {"Option to do percentile 100.5 if not INELgtZERO"}}; +}; + +class MultModule +{ + public: + MultModule() + { + // constructor + mRunNumber = 0; + mRunNumberCentrality = 0; + lCalibLoaded = false; + lCalibObjects = nullptr; + hVtxZFV0A = nullptr; + hVtxZFT0A = nullptr; + hVtxZFT0C = nullptr; + hVtxZFDDA = nullptr; + hVtxZFDDC = nullptr; + hVtxZNTracks = nullptr; + } + + // internal: calib related, vtx-z profiles + int mRunNumber; + int mRunNumberCentrality; + bool lCalibLoaded; + TList* lCalibObjects; + TProfile* hVtxZFV0A; + TProfile* hVtxZFT0A; + TProfile* hVtxZFT0C; + TProfile* hVtxZFDDA; + TProfile* hVtxZFDDC; + TProfile* hVtxZNTracks; + + // declaration of structs here + // (N.B.: will be invisible to the outside, create your own copies) + o2::common::multiplicity::standardConfigurables internalOpts; + + //_________________________________________________ + // centrality-related objects + struct TagRun2V0MCalibration { + bool mCalibrationStored = false; + TFormula* mMCScale = nullptr; + float mMCScalePars[6] = {0.0}; + TH1* mhVtxAmpCorrV0A = nullptr; + TH1* mhVtxAmpCorrV0C = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2V0MInfo; + struct TagRun2V0ACalibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorrV0A = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2V0AInfo; + struct TagRun2SPDTrackletsCalibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorr = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2SPDTksInfo; + struct TagRun2SPDClustersCalibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorrCL0 = nullptr; + TH1* mhVtxAmpCorrCL1 = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2SPDClsInfo; + struct TagRun2CL0Calibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorr = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2CL0Info; + struct TagRun2CL1Calibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorr = nullptr; + TH1* mhMultSelCalib = nullptr; + } Run2CL1Info; + struct CalibrationInfo { + std::string name = ""; + bool mCalibrationStored = false; + TH1* mhMultSelCalib = nullptr; + float mMCScalePars[6] = {0.0}; + TFormula* mMCScale = nullptr; + explicit CalibrationInfo(std::string name) + : name(name), + mCalibrationStored(false), + mhMultSelCalib(nullptr), + mMCScalePars{0.0}, + mMCScale(nullptr) + { + } + bool isSane(bool fatalize = false) + { + if (!mhMultSelCalib) { + return true; + } + for (int i = 1; i < mhMultSelCalib->GetNbinsX() + 1; i++) { + if (mhMultSelCalib->GetXaxis()->GetBinLowEdge(i) > mhMultSelCalib->GetXaxis()->GetBinUpEdge(i)) { + if (fatalize) { + LOG(fatal) << "Centrality calibration table " << name << " has bins with low edge > up edge"; + } + LOG(warning) << "Centrality calibration table " << name << " has bins with low edge > up edge"; + return false; + } + } + return true; + } + }; + + CalibrationInfo fv0aInfo = CalibrationInfo("FV0"); + CalibrationInfo ft0mInfo = CalibrationInfo("FT0"); + CalibrationInfo ft0aInfo = CalibrationInfo("FT0A"); + CalibrationInfo ft0cInfo = CalibrationInfo("FT0C"); + CalibrationInfo ft0cVariant1Info = CalibrationInfo("FT0Cvar1"); + CalibrationInfo fddmInfo = CalibrationInfo("FDD"); + CalibrationInfo ntpvInfo = CalibrationInfo("NTracksPV"); + CalibrationInfo nGlobalInfo = CalibrationInfo("NGlobal"); + CalibrationInfo mftInfo = CalibrationInfo("MFT"); + + template + void init(TConfigurables& opts, TInitContext& context) + { + // read in configurations from the task where it's used + internalOpts = opts; + internalOpts.mEnabledTables.resize(nTablesConst, 0); + + LOGF(info, "Configuring tables to generate"); + auto& workflows = context.services().template get(); + + TString listOfRequestors[nTablesConst]; + for (int i = 0; i < nTablesConst; i++) { + int f = internalOpts.enabledTables->get(tableNames[i].c_str(), "enable"); + if (f == 1) { + internalOpts.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())); + internalOpts.mEnabledTables[i] = 1; + } + } + } + } + } + } + + 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; + listOfRequestors[kFV0MultZeqs].Append(Form("%s ", "dependency check")); + } + if ((internalOpts.mEnabledTables[kCentFT0As] || internalOpts.mEnabledTables[kCentFT0Cs] || internalOpts.mEnabledTables[kCentFT0Ms] || internalOpts.mEnabledTables[kCentFT0CVariant1s]) && !internalOpts.mEnabledTables[kFT0MultZeqs]) { + internalOpts.mEnabledTables[kFT0MultZeqs] = 1; + listOfRequestors[kFT0MultZeqs].Append(Form("%s ", "dependency check")); + } + if (internalOpts.mEnabledTables[kCentFDDMs] && !internalOpts.mEnabledTables[kFDDMultZeqs]) { + internalOpts.mEnabledTables[kFDDMultZeqs] = 1; + listOfRequestors[kFDDMultZeqs].Append(Form("%s ", "dependency check")); + } + + mRunNumber = 0; + mRunNumberCentrality = 0; + lCalibLoaded = false; + hVtxZFV0A = nullptr; + hVtxZFT0A = nullptr; + hVtxZFT0C = nullptr; + hVtxZFDDA = nullptr; + hVtxZFDDC = nullptr; + hVtxZNTracks = nullptr; + } + + //__________________________________________________ + template + o2::common::multiplicity::multEntry collisionProcessRun2(TCollision const& collision, TTracks const& tracks, TBC const& bc, TOutputGroup& cursors) + { + // initialize properties + o2::common::multiplicity::multEntry mults; + + mults.posZ = collision.posZ(); + mults.spdClustersL0 = bc.spdClustersL0(); + mults.spdClustersL1 = bc.spdClustersL1(); + //_______________________________________________________________________ + // forward detector signals, raw + if (collision.has_fv0a()) { + for (const auto& amplitude : collision.fv0a().amplitude()) { + mults.multFV0A += amplitude; + } + } + if (collision.has_fv0c()) { + for (const auto& amplitude : collision.fv0c().amplitude()) { + mults.multFV0C += amplitude; + } + } + if (collision.has_ft0()) { + auto ft0 = collision.ft0(); + for (const auto& amplitude : ft0.amplitudeA()) { + mults.multFT0A += amplitude; + } + for (const auto& amplitude : ft0.amplitudeC()) { + mults.multFT0C += amplitude; + } + } + if (collision.has_zdc()) { + auto zdc = collision.zdc(); + mults.multZNA = zdc.energyCommonZNA(); + mults.multZNC = zdc.energyCommonZNC(); + } + + //_______________________________________________________________________ + // determine if barrel track loop is required, do it (once!) if so but save CPU if not + if (internalOpts.mEnabledTables[kPVMults] || internalOpts.mEnabledTables[kTPCMults] || internalOpts.mEnabledTables[kTrackletMults]) { + // Try to do something Similar to https://github.com/alisw/AliPhysics/blob/22862a945004f719f8e9664c0264db46e7186a48/OADB/AliPPVsMultUtils.cxx#L541C26-L541C37 + for (const auto& track : tracks) { + // check whether the track is a tracklet + if (track.trackType() == o2::aod::track::Run2Tracklet) { + if (internalOpts.mEnabledTables[kTrackletMults]) { + mults.multTracklets++; + } + if (internalOpts.mEnabledTables[kPVMults]) { + if (std::abs(track.eta()) < 1.0) { + mults.multNContribsEta1++; // pvmults + if (std::abs(track.eta()) < 0.8) { + mults.multNContribs++; // pvmults + if (std::abs(track.eta()) < 0.5) { + mults.multNContribsEtaHalf++; // pvmults + } + } + } + } + } + // check whether the track is a global ITS-TPC track + if (track.tpcNClsFindable() > 0) { + if (internalOpts.mEnabledTables[kTPCMults]) { + mults.multTPC++; + } + } + } + } + + // fill standard cursors if required + if (internalOpts.mEnabledTables[kFV0Mults]) { + cursors.tableFV0(mults.multFV0A, mults.multFV0C); + } + if (internalOpts.mEnabledTables[kFT0Mults]) { + cursors.tableFT0(mults.multFT0A, mults.multFT0C); + } + if (internalOpts.mEnabledTables[kFDDMults]) { + cursors.tableFDD(mults.multFDDA, mults.multFDDC); + } + if (internalOpts.mEnabledTables[kZDCMults]) { + cursors.tableZDC(mults.multZNA, mults.multZNC, 0.0f, 0.0f, 0.0f, 0.0f); + } + if (internalOpts.mEnabledTables[kTrackletMults]) { // Tracklets only Run2 + cursors.tableTracklet(mults.multTracklets); + } + if (internalOpts.mEnabledTables[kTPCMults]) { + cursors.tableTpc(mults.multTPC); + } + if (internalOpts.mEnabledTables[kPVMults]) { + cursors.tablePv(mults.multNContribs, mults.multNContribsEta1, mults.multNContribsEtaHalf); + } + + return mults; + } + + //__________________________________________________ + template + o2::common::multiplicity::multEntry collisionProcessRun3(TCCDB const& ccdb, TMetadataInfo const& metadataInfo, TCollision const& collision, TTracks const& tracks, TBC const& bc, TOutputGroup& cursors) + { + // initialize properties + o2::common::multiplicity::multEntry mults; + + //_______________________________________________________________________ + // preparatory steps + if (internalOpts.doVertexZeq > 0) { + if (bc.runNumber() != mRunNumber) { + mRunNumber = bc.runNumber(); // mark this run as at least tried + if (internalOpts.reconstructionPass.value == "") { + lCalibObjects = ccdb->template getForRun(internalOpts.ccdbPathVtxZ, mRunNumber); + } else if (internalOpts.reconstructionPass.value == "metadata") { + std::map metadata; + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + lCalibObjects = ccdb->template getSpecificForRun(internalOpts.ccdbPathVtxZ, mRunNumber, metadata); + } else { + std::map metadata; + metadata["RecoPassName"] = internalOpts.reconstructionPass.value; + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", internalOpts.reconstructionPass.value); + lCalibObjects = ccdb->template getSpecificForRun(internalOpts.ccdbPathVtxZ, mRunNumber, metadata); + } + + if (lCalibObjects) { + hVtxZFV0A = static_cast(lCalibObjects->FindObject("hVtxZFV0A")); + hVtxZFT0A = static_cast(lCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = static_cast(lCalibObjects->FindObject("hVtxZFT0C")); + hVtxZFDDA = static_cast(lCalibObjects->FindObject("hVtxZFDDA")); + hVtxZFDDC = static_cast(lCalibObjects->FindObject("hVtxZFDDC")); + hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + lCalibLoaded = true; + // Capture error + if (!hVtxZFV0A || !hVtxZFT0A || !hVtxZFT0C || !hVtxZFDDA || !hVtxZFDDC || !hVtxZNTracks) { + LOGF(error, "Problem loading CCDB objects! Please check"); + lCalibLoaded = false; + } + } else { + LOGF(error, "Problem loading CCDB object! Please check"); + lCalibLoaded = false; + } + } + } + + //_______________________________________________________________________ + // forward detector signals, raw + if (collision.has_foundFV0()) { + const auto& fv0 = collision.foundFV0(); + for (size_t ii = 0; ii < fv0.amplitude().size(); ii++) { + auto amplitude = fv0.amplitude()[ii]; + auto channel = fv0.channel()[ii]; + mults.multFV0A += amplitude; + if (channel > 7) { + mults.multFV0AOuter += amplitude; + } + } + } else { + mults.multFV0A = -999.f; + mults.multFV0AOuter = -999.f; + } + if (collision.has_foundFT0()) { + const auto& ft0 = collision.foundFT0(); + for (const auto& amplitude : ft0.amplitudeA()) { + mults.multFT0A += amplitude; + } + for (const auto& amplitude : ft0.amplitudeC()) { + mults.multFT0C += amplitude; + } + } else { + mults.multFT0A = -999.f; + mults.multFT0C = -999.f; + } + if (collision.has_foundFDD()) { + const auto& fdd = collision.foundFDD(); + for (const auto& amplitude : fdd.chargeA()) { + mults.multFDDA += amplitude; + } + for (const auto& amplitude : fdd.chargeC()) { + mults.multFDDC += amplitude; + } + } else { + mults.multFDDA = -999.f; + mults.multFDDC = -999.f; + } + if (bc.has_zdc()) { + mults.multZNA = bc.zdc().amplitudeZNA(); + mults.multZNC = bc.zdc().amplitudeZNC(); + mults.multZEM1 = bc.zdc().amplitudeZEM1(); + mults.multZEM2 = bc.zdc().amplitudeZEM2(); + mults.multZPA = bc.zdc().amplitudeZPA(); + mults.multZPC = bc.zdc().amplitudeZPC(); + } else { + mults.multZNA = -999.f; + mults.multZNC = -999.f; + mults.multZEM1 = -999.f; + mults.multZEM2 = -999.f; + mults.multZPA = -999.f; + mults.multZPC = -999.f; + } + + // fill standard cursors if required + if (internalOpts.mEnabledTables[kTrackletMults]) { // Tracklets (only Run2) nothing to do (to be removed!) + cursors.tableTracklet(0); + } + if (internalOpts.mEnabledTables[kFV0Mults]) { + cursors.tableFV0(mults.multFV0A, mults.multFV0C); + } + if (internalOpts.mEnabledTables[kFV0AOuterMults]) { + cursors.tableFV0AOuter(mults.multFV0AOuter); + } + if (internalOpts.mEnabledTables[kFT0Mults]) { + cursors.tableFT0(mults.multFT0A, mults.multFT0C); + } + if (internalOpts.mEnabledTables[kFDDMults]) { + cursors.tableFDD(mults.multFDDA, mults.multFDDC); + } + if (internalOpts.mEnabledTables[kZDCMults]) { + cursors.tableZDC(mults.multZNA, mults.multZNC, mults.multZEM1, mults.multZEM2, mults.multZPA, mults.multZPC); + } + + //_______________________________________________________________________ + // forward detector signals, vertex-Z equalized + if (internalOpts.mEnabledTables[kFV0MultZeqs]) { + if (std::fabs(collision.posZ() && lCalibLoaded)) { + mults.multFV0AZeq = hVtxZFV0A->Interpolate(0.0) * mults.multFV0A / hVtxZFV0A->Interpolate(collision.posZ()); + } else { + mults.multFV0AZeq = 0.0f; + } + cursors.tableFV0Zeqs(mults.multFV0AZeq); + } + if (internalOpts.mEnabledTables[kFT0MultZeqs]) { + if (std::fabs(collision.posZ() && 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 { + mults.multFT0AZeq = 0.0f; + mults.multFT0CZeq = 0.0f; + } + cursors.tableFT0Zeqs(mults.multFT0AZeq, mults.multFT0CZeq); + } + if (internalOpts.mEnabledTables[kFDDMultZeqs]) { + if (std::fabs(collision.posZ() && 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 { + mults.multFDDAZeq = 0.0f; + mults.multFDDCZeq = 0.0f; + } + cursors.tableFDDZeqs(mults.multFDDAZeq, mults.multFDDCZeq); + } + + //_______________________________________________________________________ + // 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]) { + // single loop to calculate all + for (const auto& track : tracks) { + if (track.hasTPC()) { + mults.multTPC++; + if (track.hasITS()) { + mults.multAllTracksITSTPC++; // multsextra + } else { + mults.multAllTracksTPCOnly++; // multsextra + } + } + // PV contributor checked explicitly + if (track.isPVContributor()) { + if (std::abs(track.eta()) < 1.0) { + mults.multNContribsEta1++; // pvmults + if (std::abs(track.eta()) < 0.8) { + mults.multNContribs++; // pvmults + if (std::abs(track.eta()) < 0.5) { + mults.multNContribsEtaHalf++; // pvmults + } + } + } + if (track.hasITS()) { + mults.multHasITS++; // multsextra + if (track.hasTPC()) + mults.multITSTPC++; // multsextra + if (!track.hasTPC() && !track.hasTOF() && !track.hasTRD()) { + mults.multITSOnly++; // multsextra + } + } + if (track.hasTPC()) { + mults.multHasTPC++; // multsextra + if (!track.hasITS() && !track.hasTOF() && !track.hasTRD()) { + mults.multTPCOnly++; // multsextra + } + } + if (track.hasTOF()) { + mults.multHasTOF++; // multsextra + } + if (track.hasTRD()) { + mults.multHasTRD++; // multsextra + } + } + + // global counters: do them only in case information is provided in tracks table + if constexpr (requires { tracks.isQualityTrack(); }) { + if (track.pt() < internalOpts.maxPtGlobalTrack.value && track.pt() > internalOpts.minPtGlobalTrack.value && std::fabs(track.eta()) < 1.0f && track.isPVContributor() && tracks.isQualityTrack()) { + if (track.itsNCls() < internalOpts.minNclsITSGlobalTrack || track.itsNClsInnerBarrel() < internalOpts.minNclsITSibGlobalTrack) { + continue; + } + mults.multNbrContribsEta10GlobalTrackWoDCA++; + + if (std::abs(track.eta()) < 0.8) { + mults.multNbrContribsEta08GlobalTrackWoDCA++; + } + if (std::abs(track.eta()) < 0.5) { + mults.multNbrContribsEta05GlobalTrackWoDCA++; + } + } + if (std::fabs(track.eta()) < 0.8 && track.tpcNClsFound() >= 80 && track.tpcNClsCrossedRows() >= 100) { + if (track.isGlobalTrack()) { + mults.multGlobalTracks++; + } + } + } // end constexpr requires track selection stuff + } + + cursors.multsGlobal(mults.multGlobalTracks, mults.multNbrContribsEta08GlobalTrackWoDCA, mults.multNbrContribsEta10GlobalTrackWoDCA, mults.multNbrContribsEta05GlobalTrackWoDCA); + } + + // fill track counters at this stage if requested + if (internalOpts.mEnabledTables[kTPCMults]) { + cursors.tableTpc(mults.multTPC); + } + if (internalOpts.mEnabledTables[kPVMults]) { + cursors.tablePv(mults.multNContribs, mults.multNContribsEta1, mults.multNContribsEtaHalf); + } + if (internalOpts.mEnabledTables[kMultsExtra]) { + cursors.tableExtra(collision.numContrib(), collision.chi2(), collision.collisionTimeRes(), + bc.runNumber(), collision.posZ(), collision.sel8(), + mults.multHasITS, mults.multHasTPC, mults.multHasTOF, mults.multHasTRD, + mults.multITSOnly, mults.multTPCOnly, mults.multITSTPC, + mults.multAllTracksTPCOnly, mults.multAllTracksITSTPC, + collision.trackOccupancyInTimeRange(), + collision.ft0cOccupancyInTimeRange(), + collision.flags()); + } + if (internalOpts.mEnabledTables[kPVMultZeqs]) { + if (std::fabs(collision.posZ()) && lCalibLoaded) { + mults.multNContribsZeq = hVtxZNTracks->Interpolate(0.0) * mults.multNContribs / hVtxZNTracks->Interpolate(collision.posZ()); + } else { + mults.multNContribsZeq = 0.0f; + } + cursors.tablePVZeqs(mults.multNContribsZeq); + } + + // return multiplicity object such that it is handled properly when computing centrality + return mults; + } + + //__________________________________________________ + template + void collisionProcessMonteCarlo(TMCCollision const& mccollision, TMCParticles const& mcparticles, TPDGService const& pdg, TOutputGroup& cursors) + { + int multFT0A = 0; + int multFV0A = 0; + int multFT0C = 0; + int multFDDA = 0; + int multFDDC = 0; + int multBarrelEta05 = 0; + int multBarrelEta08 = 0; + int multBarrelEta10 = 0; + for (auto const& mcPart : mcparticles) { + if (!mcPart.isPhysicalPrimary()) { + continue; + } + + auto charge = 0.; + auto* p = pdg->GetParticle(mcPart.pdgCode()); + if (p != nullptr) { + charge = p->Charge(); + } + if (std::abs(charge) < 1e-3) { + continue; // reject neutral particles in counters + } + + if (std::abs(mcPart.eta()) < 1.0) { + multBarrelEta10++; + if (std::abs(mcPart.eta()) < 0.8) { + multBarrelEta08++; + if (std::abs(mcPart.eta()) < 0.5) { + multBarrelEta05++; + } + } + } + if (-3.3 < mcPart.eta() && mcPart.eta() < -2.1) + multFT0C++; + if (3.5 < mcPart.eta() && mcPart.eta() < 4.9) + multFT0A++; + if (2.2 < mcPart.eta() && mcPart.eta() < 5.0) + multFV0A++; + if (-6.9 < mcPart.eta() && mcPart.eta() < -4.9) + multFDDC++; + if (4.7 < mcPart.eta() && mcPart.eta() < 6.3) + multFDDA++; + } + cursors.tableExtraMc(multFT0A, multFT0C, multFV0A, multFDDA, multFDDC, multBarrelEta05, multBarrelEta08, multBarrelEta10, mccollision.posZ()); + } + + //__________________________________________________ + template + void collisionProcessMFT(TCollision const& collision, TMFTTracks const& mfttracks, TBestCollisionsFwd const& retracks, TMultBuffer& mults, TOutputGroup& cursors) + { + int nAllTracks = 0; + int nTracks = 0; + + for (const auto& track : mfttracks) { + if (track.nClusters() >= 5) { // hardcoded for now + nAllTracks++; + } + } + + if (retracks.size() > 0) { + for (const auto& retrack : retracks) { + auto track = retrack.mfttrack(); + if (track.nClusters() < 5) { + continue; // min cluster requirement + } + if ((track.eta() > -2.0f) && (track.eta() < -3.9f)) { + continue; // too far to be of true interest + } + if (std::abs(retrack.bestDCAXY()) > 2.0f) { + continue; // does not point to PV properly + } + nTracks++; + } + } + cursors.mftMults(nAllTracks, nTracks); + mults[collision.globalIndex()].multMFTAllTracks = nAllTracks; + mults[collision.globalIndex()].multMFTTracks = nTracks; + } + + //__________________________________________________ + template + void ConfigureCentralityRun2(TCCDB& ccdb, TMetadata const& metadataInfo, TBC const& bc) + { + if (bc.runNumber() != mRunNumberCentrality) { + mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome + LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); + TList* callst = nullptr; + // Check if the ccdb path is a root file + if (internalOpts.ccdbPathCentrality.value.find(".root") != std::string::npos) { + TFile f(internalOpts.ccdbPathCentrality.value.c_str(), "READ"); + f.GetObject(internalOpts.reconstructionPass.value.c_str(), callst); + if (!callst) { + f.ls(); + LOG(fatal) << "No calibration list " << internalOpts.reconstructionPass.value << " found."; + } + } else { + if (internalOpts.reconstructionPass.value == "") { + callst = ccdb->template getForRun(internalOpts.ccdbPathCentrality, bc.runNumber()); + } else if (internalOpts.reconstructionPass.value == "metadata") { + std::map metadata; + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + callst = ccdb->template getSpecificForRun(internalOpts.ccdbPathCentrality, bc.runNumber(), metadata); + } else { + std::map metadata; + metadata["RecoPassName"] = internalOpts.reconstructionPass.value; + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", internalOpts.reconstructionPass.value); + callst = ccdb->template getSpecificForRun(internalOpts.ccdbPathCentrality, bc.runNumber(), metadata); + } + } + + Run2V0MInfo.mCalibrationStored = false; + Run2V0AInfo.mCalibrationStored = false; + Run2SPDTksInfo.mCalibrationStored = false; + Run2SPDClsInfo.mCalibrationStored = false; + Run2CL0Info.mCalibrationStored = false; + Run2CL1Info.mCalibrationStored = false; + if (callst != nullptr) { + auto getccdb = [callst](const char* ccdbhname) { + TH1* h = reinterpret_cast(callst->FindObject(ccdbhname)); + return h; + }; + auto getformulaccdb = [callst](const char* ccdbhname) { + TFormula* f = reinterpret_cast(callst->FindObject(ccdbhname)); + return f; + }; + + if (internalOpts.mEnabledTables[kCentRun2V0Ms]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2V0MInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized"); + Run2V0MInfo.mhVtxAmpCorrV0C = getccdb("hVtx_fAmplitude_V0C_Normalized"); + Run2V0MInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0M"); + Run2V0MInfo.mMCScale = getformulaccdb(TString::Format("%s-V0M", internalOpts.generatorName->c_str()).Data()); + if ((Run2V0MInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0MInfo.mhVtxAmpCorrV0C != nullptr) && (Run2V0MInfo.mhMultSelCalib != nullptr)) { + if (internalOpts.generatorName->length() != 0) { + if (Run2V0MInfo.mMCScale != nullptr) { + for (int ixpar = 0; ixpar < 6; ++ixpar) { + Run2V0MInfo.mMCScalePars[ixpar] = Run2V0MInfo.mMCScale->GetParameter(ixpar); + } + } else { + // continue filling with non-valid values (105) + LOGF(info, "MC Scale information from V0M for run %d not available", bc.runNumber()); + } + } + Run2V0MInfo.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from V0M for run %d corrupted, will fill V0M tables with dummy values", bc.runNumber()); + } + } + if (internalOpts.mEnabledTables[kCentRun2V0As]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2V0AInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized"); + Run2V0AInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0A"); + if ((Run2V0AInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0AInfo.mhMultSelCalib != nullptr)) { + Run2V0AInfo.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from V0A for run %d corrupted, will fill V0A tables with dummy values", bc.runNumber()); + } + } + if (internalOpts.mEnabledTables[kCentRun2SPDTrks]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2SPDTksInfo.mhVtxAmpCorr = getccdb("hVtx_fnTracklets_Normalized"); + Run2SPDTksInfo.mhMultSelCalib = getccdb("hMultSelCalib_SPDTracklets"); + if ((Run2SPDTksInfo.mhVtxAmpCorr != nullptr) && (Run2SPDTksInfo.mhMultSelCalib != nullptr)) { + Run2SPDTksInfo.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from SPD tracklets for run %d corrupted, will fill SPD tracklets tables with dummy values", bc.runNumber()); + } + } + if (internalOpts.mEnabledTables[kCentRun2SPDClss]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2SPDClsInfo.mhVtxAmpCorrCL0 = getccdb("hVtx_fnSPDClusters0_Normalized"); + Run2SPDClsInfo.mhVtxAmpCorrCL1 = getccdb("hVtx_fnSPDClusters1_Normalized"); + Run2SPDClsInfo.mhMultSelCalib = getccdb("hMultSelCalib_SPDClusters"); + if ((Run2SPDClsInfo.mhVtxAmpCorrCL0 != nullptr) && (Run2SPDClsInfo.mhVtxAmpCorrCL1 != nullptr) && (Run2SPDClsInfo.mhMultSelCalib != nullptr)) { + Run2SPDClsInfo.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from SPD clusters for run %d corrupted, will fill SPD clusters tables with dummy values", bc.runNumber()); + } + } + if (internalOpts.mEnabledTables[kCentRun2CL0s]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2CL0Info.mhVtxAmpCorr = getccdb("hVtx_fnSPDClusters0_Normalized"); + Run2CL0Info.mhMultSelCalib = getccdb("hMultSelCalib_CL0"); + if ((Run2CL0Info.mhVtxAmpCorr != nullptr) && (Run2CL0Info.mhMultSelCalib != nullptr)) { + Run2CL0Info.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from CL0 multiplicity for run %d corrupted, will fill CL0 multiplicity tables with dummy values", bc.runNumber()); + } + } + if (internalOpts.mEnabledTables[kCentRun2CL1s]) { + LOGF(debug, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + Run2CL1Info.mhVtxAmpCorr = getccdb("hVtx_fnSPDClusters1_Normalized"); + Run2CL1Info.mhMultSelCalib = getccdb("hMultSelCalib_CL1"); + if ((Run2CL1Info.mhVtxAmpCorr != nullptr) && (Run2CL1Info.mhMultSelCalib != nullptr)) { + Run2CL1Info.mCalibrationStored = true; + } else { + // continue filling with non-valid values (105) + LOGF(info, "Calibration information from CL1 multiplicity for run %d corrupted, will fill CL1 multiplicity tables with dummy values", bc.runNumber()); + } + } + } else { + LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp()); + } + } + } + + //__________________________________________________ + template + void ConfigureCentralityRun3(TCCDB& ccdb, TMetadata const& metadataInfo, TBC const& bc) + { + if (bc.runNumber() != mRunNumberCentrality) { + mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome + LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); + TList* callst = nullptr; + // Check if the ccdb path is a root file + if (internalOpts.ccdbPathCentrality.value.find(".root") != std::string::npos) { + TFile f(internalOpts.ccdbPathCentrality.value.c_str(), "READ"); + f.GetObject(internalOpts.reconstructionPass.value.c_str(), callst); + if (!callst) { + f.ls(); + LOG(fatal) << "No calibration list " << internalOpts.reconstructionPass.value << " found."; + } + } else { + if (internalOpts.reconstructionPass.value == "") { + callst = ccdb->template getForRun(internalOpts.ccdbPathCentrality, bc.runNumber()); + } else if (internalOpts.reconstructionPass.value == "metadata") { + std::map metadata; + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + callst = ccdb->template getSpecificForRun(internalOpts.ccdbPathCentrality, bc.runNumber(), metadata); + } else { + std::map metadata; + metadata["RecoPassName"] = internalOpts.reconstructionPass.value; + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", internalOpts.reconstructionPass.value); + callst = ccdb->template getSpecificForRun(internalOpts.ccdbPathCentrality, bc.runNumber(), metadata); + } + } + + fv0aInfo.mCalibrationStored = false; + ft0mInfo.mCalibrationStored = false; + ft0aInfo.mCalibrationStored = false; + ft0cInfo.mCalibrationStored = false; + ft0cVariant1Info.mCalibrationStored = false; + fddmInfo.mCalibrationStored = false; + ntpvInfo.mCalibrationStored = false; + nGlobalInfo.mCalibrationStored = false; + mftInfo.mCalibrationStored = false; + if (callst != nullptr) { + LOGF(info, "Getting new histograms with %d run number for %d run number", mRunNumber, bc.runNumber()); + auto getccdb = [callst, bc](struct CalibrationInfo& estimator, const o2::framework::Configurable generatorName) { // TODO: to consider the name inside the estimator structure + estimator.mhMultSelCalib = reinterpret_cast(callst->FindObject(TString::Format("hCalibZeq%s", estimator.name.c_str()).Data())); + estimator.mMCScale = reinterpret_cast(callst->FindObject(TString::Format("%s-%s", generatorName->c_str(), estimator.name.c_str()).Data())); + if (estimator.mhMultSelCalib != nullptr) { + if (generatorName->length() != 0) { + LOGF(info, "Retrieving MC calibration for %d, generator name: %s", bc.runNumber(), generatorName->c_str()); + if (estimator.mMCScale != nullptr) { + for (int ixpar = 0; ixpar < 6; ++ixpar) { + estimator.mMCScalePars[ixpar] = estimator.mMCScale->GetParameter(ixpar); + LOGF(info, "Parameter index %i value %.5f", ixpar, estimator.mMCScalePars[ixpar]); + } + } else { + LOGF(warning, "MC Scale information from %s for run %d not available", estimator.name.c_str(), bc.runNumber()); + } + } + estimator.mCalibrationStored = true; + estimator.isSane(); + } else { + LOGF(info, "Calibration information from %s for run %d not available, will fill this estimator with invalid values and continue (no crash).", estimator.name.c_str(), bc.runNumber()); + } + }; + + // invoke loading only for requested centralities + if (internalOpts.mEnabledTables[kCentFV0As]) + getccdb(fv0aInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFT0Ms]) + getccdb(ft0mInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFT0As]) + getccdb(ft0aInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFT0Cs]) + getccdb(ft0cInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFT0CVariant1s]) + getccdb(ft0cVariant1Info, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentFDDMs]) + getccdb(fddmInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentNTPVs]) + getccdb(ntpvInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentNGlobals]) + getccdb(nGlobalInfo, internalOpts.generatorName); + if (internalOpts.mEnabledTables[kCentMFTs]) + getccdb(mftInfo, internalOpts.generatorName); + } else { + LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp()); + } + } + } + + //__________________________________________________ + template + void generateCentralitiesRun3(TCCDB& ccdb, TMetadata const& metadataInfo, TBCs const& bcs, TMultBuffer const& mults, TOutputGroup& cursors) + { + // takes multiplicity buffer and generates the desirable centrality values (if any) + + // first step: did someone actually ask for it? Otherwise, go home + if ( + internalOpts.mEnabledTables[kCentFV0As] || internalOpts.mEnabledTables[kCentFT0Ms] || + internalOpts.mEnabledTables[kCentFT0As] || internalOpts.mEnabledTables[kCentFT0Cs] || + internalOpts.mEnabledTables[kCentFT0CVariant1s] || internalOpts.mEnabledTables[kCentFDDMs] || + internalOpts.mEnabledTables[kCentNTPVs] || internalOpts.mEnabledTables[kCentNGlobals] || + internalOpts.mEnabledTables[kCentMFTs] || internalOpts.mEnabledTables[kBCCentFT0Ms] || + internalOpts.mEnabledTables[kBCCentFT0As] || internalOpts.mEnabledTables[kBCCentFT0Cs]) { + // check and update centrality calibration objects for Run 3 + const auto& firstbc = bcs.begin(); + ConfigureCentralityRun3(ccdb, metadataInfo, firstbc); + + /************************************************************ + * @brief Populates a table with data based on the given calibration information and multiplicity. + * + * @param table The table to populate. + * @param estimator The calibration information. + * @param multiplicity The multiplicity value. + *************************************************************/ + + auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) { + const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0; + auto scaleMC = [](float x, float pars[6]) { + return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); + }; + + float percentile = 105.0f; + float scaledMultiplicity = multiplicity; + if (estimator.mCalibrationStored) { + if (estimator.mMCScale != nullptr) { + scaledMultiplicity = scaleMC(multiplicity, estimator.mMCScalePars); + LOGF(debug, "Unscaled %s multiplicity: %f, scaled %s multiplicity: %f", estimator.name.c_str(), multiplicity, estimator.name.c_str(), scaledMultiplicity); + } + percentile = estimator.mhMultSelCalib->GetBinContent(estimator.mhMultSelCalib->FindFixBin(scaledMultiplicity)); + if (assignOutOfRange) + percentile = 100.5f; + } + LOGF(debug, "%s centrality/multiplicity percentile = %.0f for a zvtx eq %s value %.0f", estimator.name.c_str(), percentile, estimator.name.c_str(), scaledMultiplicity); + table(percentile); + return percentile; + }; + + // populate centralities per event + for (size_t iEv = 0; iEv < mults.size(); iEv++) { + bool isInelGt0 = (mults[iEv].multNContribsEta1 > 0); + if (internalOpts.mEnabledTables[kCentFV0As]) + populateTable(cursors.centFV0A, fv0aInfo, mults[iEv].multFV0AZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFT0Ms]) + populateTable(cursors.centFT0M, ft0mInfo, mults[iEv].multFT0AZeq + mults[iEv].multFT0CZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFT0As]) + populateTable(cursors.centFT0A, ft0aInfo, mults[iEv].multFT0AZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFT0Cs]) + populateTable(cursors.centFT0C, ft0cInfo, mults[iEv].multFT0CZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFT0CVariant1s]) + populateTable(cursors.centFT0CVariant1, ft0cVariant1Info, mults[iEv].multFT0CZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentFDDMs]) + populateTable(cursors.centFDDM, fddmInfo, mults[iEv].multFDDAZeq + mults[iEv].multFDDCZeq, isInelGt0); + if (internalOpts.mEnabledTables[kCentNTPVs]) + populateTable(cursors.centNTPV, ntpvInfo, mults[iEv].multNContribs, isInelGt0); + if (internalOpts.mEnabledTables[kCentNGlobals]) + populateTable(cursors.centNGlobals, nGlobalInfo, mults[iEv].multGlobalTracks, isInelGt0); + if (internalOpts.mEnabledTables[kCentMFTs]) + populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracks, isInelGt0); + } + + // populate centralities per BC + for (size_t ibc = 0; ibc < static_cast(bcs.size()); ibc++) { + float bcMultFT0A = 0; + float bcMultFT0C = 0; + + const auto& bc = bcs.rawIteratorAt(ibc); + if (bc.has_foundFT0()) { + const auto& ft0 = bc.foundFT0(); + for (const auto& amplitude : ft0.amplitudeA()) { + bcMultFT0A += amplitude; + } + for (const auto& amplitude : ft0.amplitudeC()) { + bcMultFT0C += amplitude; + } + } else { + bcMultFT0A = -999.f; + bcMultFT0C = -999.f; + } + + if (internalOpts.mEnabledTables[kBCCentFT0Ms]) + populateTable(cursors.bcCentFT0M, ft0mInfo, bcMultFT0A + bcMultFT0C, true); + if (internalOpts.mEnabledTables[kBCCentFT0As]) + populateTable(cursors.bcCentFT0A, ft0aInfo, bcMultFT0A, true); + if (internalOpts.mEnabledTables[kBCCentFT0Cs]) + populateTable(cursors.bcCentFT0C, ft0cInfo, bcMultFT0C, true); + } + } + } + //__________________________________________________ + template + void generateCentralitiesRun2(TCCDB& ccdb, TMetadata const& metadataInfo, TBCs const& bcs, TMultBuffer const& mults, TOutputGroup& cursors) + { + // takes multiplicity buffer and generates the desirable centrality values (if any) + // For Run 2 + if ( + internalOpts.mEnabledTables[kCentRun2V0Ms] || internalOpts.mEnabledTables[kCentRun2V0As] || + internalOpts.mEnabledTables[kCentRun2SPDTrks] || internalOpts.mEnabledTables[kCentRun2SPDClss] || + internalOpts.mEnabledTables[kCentRun2CL0s] || internalOpts.mEnabledTables[kCentRun2CL1s]) { + // check and update centrality calibration objects for Run 3 + const auto& firstbc = bcs.begin(); + ConfigureCentralityRun2(ccdb, metadataInfo, firstbc); + + auto scaleMC = [](float x, float pars[6]) { + return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]); + }; + + // populate centralities per event + for (size_t iEv = 0; iEv < mults.size(); iEv++) { + if (internalOpts.mEnabledTables[kCentRun2V0Ms]) { + float cV0M = 105.0f; + if (Run2V0MInfo.mCalibrationStored) { + float v0m; + if (Run2V0MInfo.mMCScale != nullptr) { + v0m = scaleMC(mults[iEv].multFV0A + mults[iEv].multFV0C, Run2V0MInfo.mMCScalePars); + LOGF(debug, "Unscaled v0m: %f, scaled v0m: %f", mults[iEv].multFV0A + mults[iEv].multFV0C, v0m); + } else { + v0m = mults[iEv].multFV0A * Run2V0MInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0A->FindFixBin(mults[iEv].posZ)) + + mults[iEv].multFV0C * Run2V0MInfo.mhVtxAmpCorrV0C->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0C->FindFixBin(mults[iEv].posZ)); + } + cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); + } + LOGF(debug, "centRun2V0M=%.0f", cV0M); + // fill centrality columns + cursors.centRun2V0M(cV0M); + } + if (internalOpts.mEnabledTables[kCentRun2V0As]) { + float cV0A = 105.0f; + if (Run2V0AInfo.mCalibrationStored) { + float v0a = mults[iEv].multFV0A * Run2V0AInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0AInfo.mhVtxAmpCorrV0A->FindFixBin(mults[iEv].posZ)); + cV0A = Run2V0AInfo.mhMultSelCalib->GetBinContent(Run2V0AInfo.mhMultSelCalib->FindFixBin(v0a)); + } + LOGF(debug, "centRun2V0A=%.0f", cV0A); + // fill centrality columns + cursors.centRun2V0A(cV0A); + } + if (internalOpts.mEnabledTables[kCentRun2SPDTrks]) { + float cSPD = 105.0f; + if (Run2SPDTksInfo.mCalibrationStored) { + float spdm = mults[iEv].multTracklets * Run2SPDTksInfo.mhVtxAmpCorr->GetBinContent(Run2SPDTksInfo.mhVtxAmpCorr->FindFixBin(mults[iEv].posZ)); + cSPD = Run2SPDTksInfo.mhMultSelCalib->GetBinContent(Run2SPDTksInfo.mhMultSelCalib->FindFixBin(spdm)); + } + LOGF(debug, "centSPDTracklets=%.0f", cSPD); + cursors.centRun2SPDTracklets(cSPD); + } + if (internalOpts.mEnabledTables[kCentRun2SPDClss]) { + float cSPD = 105.0f; + if (Run2SPDClsInfo.mCalibrationStored) { + float spdm = mults[iEv].spdClustersL0 * Run2SPDClsInfo.mhVtxAmpCorrCL0->GetBinContent(Run2SPDClsInfo.mhVtxAmpCorrCL0->FindFixBin(mults[iEv].posZ)) + + mults[iEv].spdClustersL1 * Run2SPDClsInfo.mhVtxAmpCorrCL1->GetBinContent(Run2SPDClsInfo.mhVtxAmpCorrCL1->FindFixBin(mults[iEv].posZ)); + cSPD = Run2SPDClsInfo.mhMultSelCalib->GetBinContent(Run2SPDClsInfo.mhMultSelCalib->FindFixBin(spdm)); + } + LOGF(debug, "centSPDClusters=%.0f", cSPD); + cursors.centRun2SPDClusters(cSPD); + } + if (internalOpts.mEnabledTables[kCentRun2CL0s]) { + float cCL0 = 105.0f; + if (Run2CL0Info.mCalibrationStored) { + float cl0m = mults[iEv].spdClustersL0 * Run2CL0Info.mhVtxAmpCorr->GetBinContent(Run2CL0Info.mhVtxAmpCorr->FindFixBin(mults[iEv].posZ)); + cCL0 = Run2CL0Info.mhMultSelCalib->GetBinContent(Run2CL0Info.mhMultSelCalib->FindFixBin(cl0m)); + } + LOGF(debug, "centCL0=%.0f", cCL0); + cursors.centRun2CL0(cCL0); + } + if (internalOpts.mEnabledTables[kCentRun2CL1s]) { + float cCL1 = 105.0f; + if (Run2CL1Info.mCalibrationStored) { + float cl1m = mults[iEv].spdClustersL1 * Run2CL1Info.mhVtxAmpCorr->GetBinContent(Run2CL1Info.mhVtxAmpCorr->FindFixBin(mults[iEv].posZ)); + cCL1 = Run2CL1Info.mhMultSelCalib->GetBinContent(Run2CL1Info.mhMultSelCalib->FindFixBin(cl1m)); + } + LOGF(debug, "centCL1=%.0f", cCL1); + cursors.centRun2CL1(cCL1); + } + } + } + } +}; // end BuilderModule + +} // namespace multiplicity +} // namespace common +} // namespace o2 + +#endif // COMMON_TOOLS_MULTMODULE_H_ From 517903c596a3c3bd875094980d817ad7a344d527 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Fri, 13 Jun 2025 10:09:50 +0200 Subject: [PATCH 058/116] [PWGLF] Update reweighting for cascades in MC (#11597) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index 3cb2ac41f2b..a783c324687 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -2027,7 +2027,7 @@ struct StrangenessInJets { case kXiPlusBar: // Xi Pos registryMC.fill(HIST("XiPos_generated_jet"), multiplicity, mcParticle.pt(), wXiPosJet); registryMC.fill(HIST("XiPos_generated_ue"), multiplicity, mcParticle.pt(), wXiPosUe); - registryMC.fill(HIST("Xi_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); + registryMC.fill(HIST("XiPos_eta_pt_pythia"), mcParticle.pt(), mcParticle.eta()); break; case kXiMinus: // Xi Neg registryMC.fill(HIST("XiNeg_generated_jet"), multiplicity, mcParticle.pt(), wXiNegJet); From 401d3bab557e7e99eae720ee40fae2ba7baab31f Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 13 Jun 2025 03:11:25 -0500 Subject: [PATCH 059/116] [PWGLF] Updated the MC correction procedure (#11590) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 191 ++++++++++++------- 1 file changed, 124 insertions(+), 67 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 7da02f51416..478c49fae87 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -15,18 +15,6 @@ /// \author Omar Vazquez (omar.vazquez.rueda@cern.ch) /// \since January 29, 2025 -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/TriggerAliases.h" #include "Common/Core/TrackSelection.h" @@ -34,6 +22,7 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" + #include "CommonConstants/MathConstants.h" #include "CommonConstants/ZDCConstants.h" #include "Framework/ASoAHelpers.h" // required for Filter op. @@ -44,7 +33,20 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/GlobalTrackID.h" #include "ReconstructionDataFormats/Track.h" +#include + #include "TPDGCode.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace std; using namespace o2; @@ -81,6 +83,7 @@ struct UccZdc { Configurable isZEMcut{"isZEMcut", true, "Use ZEM cut"}; Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; + Configurable correctNch{"correctNch", true, "Correct also Nch"}; // Event selection Configurable posZcut{"posZcut", +10.0, "z-vertex position cut"}; @@ -126,7 +129,8 @@ struct UccZdc { ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; // CCDB paths - Configurable paTH{"paTH", "Users/o/omvazque/TrackingEfficiency", "base path to the ccdb object"}; + Configurable paTHEff{"paTHEff", "Users/o/omvazque/MCcorrection/perTimeStamp/TrackingEff", "base path to the ccdb object"}; + Configurable paTHFD{"paTHFD", "Users/o/omvazque/MCcorrection/perTimeStamp/FeedDown", "base path to the ccdb object"}; Configurable paTHmeanNch{"paTHmeanNch", "Users/o/omvazque/FitMeanNch_9May2025", "base path to the ccdb object"}; Configurable paTHsigmaNch{"paTHsigmaNch", "Users/o/omvazque/FitSigmaNch_9May2025", "base path to the ccdb object"}; Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; @@ -238,6 +242,9 @@ struct UccZdc { 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}}); // Corrections + registry.add("NchRec", "Corrections;#it{N}_{ch} (|#eta| < 0.8);Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("NchTrue", "Corrections;#it{N}_{ch} (|#eta| < 0.8);Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); + 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}}}); @@ -292,8 +299,11 @@ struct UccZdc { LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; LOG(info) << "\tapplyEff=" << applyEff.value; - LOG(info) << "\tpaTH=" << paTH.value; + LOG(info) << "\tcorrectNch=" << correctNch.value; + LOG(info) << "\tpaTHEff=" << paTHEff.value; + LOG(info) << "\tpaTHFD=" << paTHFD.value; LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; + LOG(info) << "\tnSigmaNchCut=" << nSigmaNchCut.value; LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; LOG(info) << "\tminPt=" << minPt.value; @@ -681,48 +691,55 @@ struct UccZdc { } } + // Skip event based on number of Nch sigmas if (!skipEvent) { return; } - auto efficiency = ccdb->getForTimeStamp(paTH.value, foundBC.timestamp()); - // auto efficiency = ccdb->getForRun(paTH.value, foundBC.runNumber()); - if (!efficiency) { + auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); + auto fd = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); + if (!efficiency || !fd) { return; } std::vector pTs; - std::vector wIs; - // Calculates the event weight, W_k + std::vector vecFD; + std::vector vecOneOverEff; + + // Calculates the Nch multiplicity for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { continue; } - if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } float pt{track.pt()}; - double weight{1.}; + float effValue{1.0}; if (applyEff) { - weight = efficiency->GetBinContent(efficiency->FindBin(pt)); + effValue = efficiency->GetBinContent(efficiency->FindBin(pt)); } - if (weight > 0.) { - pTs.emplace_back(pt); - wIs.emplace_back(weight); + if (effValue > 0.) { + vecOneOverEff.emplace_back(1. / effValue); } } - double p1, p2, p3, p4, w1, w2, w3, w4; - p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; - getPTpowers(pTs, wIs, p1, w1, p2, w2, p3, w3, p4, w4); - const double nch{static_cast(pTs.size())}; - if (nch < minNchSel) { + double nchMult{0.}; + nchMult = std::accumulate(vecOneOverEff.begin(), vecOneOverEff.end(), 0); + if (!applyEff) + nchMult = static_cast(glbTracks); + if (applyEff && !correctNch) + nchMult = static_cast(glbTracks); + if (nchMult < minNchSel) { return; } - // To calculate event-averaged + // Fill vectors for [pT] measurement + pTs.clear(); + vecFD.clear(); + vecOneOverEff.clear(); for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -731,9 +748,27 @@ struct UccZdc { if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { continue; } - registry.fill(HIST("NchVsZNVsPt"), w1, sumZNs, track.pt()); + + float pt{track.pt()}; + float effValue{1.}; + float fdValue{1.}; + if (applyEff) { + effValue = efficiency->GetBinContent(efficiency->FindBin(pt)); + fdValue = fd->GetBinContent(fd->FindBin(pt)); + } + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecOneOverEff.emplace_back(1. / effValue); + vecFD.emplace_back(fdValue); + } + // 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, vecOneOverEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); + // EbE one-particle pT correlation double oneParCorr{p1 / w1}; @@ -752,20 +787,20 @@ struct UccZdc { 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}; - registry.fill(HIST("Nch"), w1); + registry.fill(HIST("Nch"), nchMult); registry.fill(HIST("ZNamp"), sumZNs); - registry.fill(HIST("NchVsZN"), w1, sumZNs); - registry.fill(HIST("NchVsZP"), w1, sumZPs); + 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"), w1, oneParCorr, w1); - registry.fill(HIST("NchVsOneParCorrVsZN"), w1, sumZNs, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorrVsZN"), w1, sumZNs, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorrVsZN"), w1, sumZNs, threeParCorr, denThreeParCorr); - registry.fill(HIST("NchVsFourParCorrVsZN"), w1, sumZNs, fourParCorr, denFourParCorr); + 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); @@ -774,7 +809,6 @@ struct UccZdc { TRandom* randPointer = new TRandom(); void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups const& collisions, o2::aod::BCsRun3 const& /*bcs*/, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks) { - float rndNum = randPointer->Uniform(0.0, 1.0); registry.fill(HIST("RandomNumber"), rndNum); @@ -809,14 +843,17 @@ struct UccZdc { // To use run-by-run efficiency const auto& foundBC = collision.foundBC_as(); - // auto efficiency = ccdb->getForTimeStamp(paTH.value, foundBC.timestamp()); - auto efficiency = ccdb->getForRun(paTH.value, foundBC.runNumber()); - if (!efficiency) { - continue; + auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); + auto fd = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); + if (!efficiency || !fd) { + return; } + int nchRaw{0}; std::vector pTs; - std::vector wIs; + std::vector vecFD; + std::vector vecOneOverEff; + // std::vector wIs; const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; // Calculates the event weight, W_k for (const auto& track : groupedTracks) { @@ -826,22 +863,29 @@ struct UccZdc { } float pt{track.pt()}; - double weight{efficiency->GetBinContent(efficiency->FindBin(pt))}; - if (!(weight > 0.)) { - continue; + float effValue{1.}; + float fdValue{1.}; + nchRaw++; + if (applyEff) { + effValue = efficiency->GetBinContent(efficiency->FindBin(pt)); + fdValue = fd->GetBinContent(fd->FindBin(pt)); + } + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecOneOverEff.emplace_back(1. / effValue); + vecFD.emplace_back(fdValue); } - pTs.emplace_back(pt); - wIs.emplace_back(weight); } - const double nch{static_cast(pTs.size())}; - if (nch < minNchSel) { - continue; + double nchMult{0.}; + nchMult = std::accumulate(vecOneOverEff.begin(), vecOneOverEff.end(), 0); + 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, wIs, p1, w1, p2, w2, p3, w3, p4, w4); + getPTpowers(pTs, vecOneOverEff, 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}; @@ -855,16 +899,18 @@ struct UccZdc { const double threeParCorr{numThreeParCorr / denThreeParCorr}; const double fourParCorr{numFourParCorr / denFourParCorr}; - registry.fill(HIST("Nch"), w1); - registry.fill(HIST("NchUncorrected"), nch); - registry.fill(HIST("NchVsOneParCorr"), w1, oneParCorr, w1); - registry.fill(HIST("NchVsTwoParCorr"), w1, twoParCorr, denTwoParCorr); - registry.fill(HIST("NchVsThreeParCorr"), w1, threeParCorr, denThreeParCorr); - registry.fill(HIST("NchVsFourParCorr"), w1, fourParCorr, 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; - std::vector wIsMC; + std::vector vecFullEff; + std::vector vecFDEqualOne; + // Calculates the event weight, W_k for (const auto& particle : mcParticles) { if (particle.eta() < minEta || particle.eta() > maxEta) { @@ -879,17 +925,19 @@ struct UccZdc { float pt{particle.pt()}; pTsMC.emplace_back(pt); - wIsMC.emplace_back(1.); + vecFullEff.emplace_back(1.); + vecFDEqualOne.emplace_back(1.); } - const double nchMC{static_cast(pTsMC.size())}; + double nchMC{0}; + nchMult = std::accumulate(vecFullEff.begin(), vecFullEff.end(), 0); if (nchMC < minNchSel) { continue; } double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC; p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0; - getPTpowers(pTsMC, wIsMC, p1MC, w1MC, p2MC, w2MC, p3MC, w3MC, p4MC, w4MC); + 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}; @@ -911,6 +959,8 @@ struct UccZdc { } else { // Correction with the remaining half of the sample registry.fill(HIST("EvtsDivided"), 1); //----- MC reconstructed -----// + int nchTrue{0}; + int nchRec{0}; const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; for (const auto& track : groupedTracks) { // Track Selection @@ -932,6 +982,7 @@ struct UccZdc { continue; } + nchRec++; registry.fill(HIST("Pt_ch"), cent, track.pt()); if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) { registry.fill(HIST("Pt_pi"), cent, track.pt()); @@ -960,6 +1011,7 @@ struct UccZdc { continue; } + nchTrue++; registry.fill(HIST("PtMC_ch"), cent, particle.pt()); if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) { // pion registry.fill(HIST("PtMC_pi"), cent, particle.pt()); @@ -975,18 +1027,23 @@ struct UccZdc { registry.fill(HIST("PtMC_re"), cent, particle.pt()); } } + + registry.fill(HIST("NchRec"), nchRec); + registry.fill(HIST("NchTrue"), nchTrue); } // Half of statistics for corrections } // Collisions } PROCESS_SWITCH(UccZdc, processMCclosure, "Process MC closure", false); template - void getPTpowers(const T& pTs, const T& wIs, U& pOne, U& wOne, U& pTwo, U& wTwo, U& pThree, U& wThree, U& pFour, U& wFour) + void getPTpowers(const T& pTs, const T& vecOneOverEff, const T& vecFD, U& pOne, U& wOne, U& pTwo, U& wTwo, U& pThree, U& wThree, U& pFour, U& wFour) { pOne = wOne = pTwo = wTwo = pThree = wThree = pFour = wFour = 0.; for (std::size_t i = 0; i < pTs.size(); ++i) { const float pTi{pTs.at(i)}; - const float wEighti{wIs.at(i)}; + const float eFFi{vecOneOverEff.at(i)}; + const float fDi{vecFD.at(i)}; + const float wEighti{eFFi * fDi}; pOne += wEighti * pTi; wOne += wEighti; pTwo += std::pow(wEighti * pTi, 2.); From 8b56b4963714623d8b950f87f65251c22c995a78 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Fri, 13 Jun 2025 14:07:09 +0200 Subject: [PATCH 060/116] [PWGCF] Fix 2prong filter MC particle indexing (#11585) --- PWGCF/TableProducer/filter2Prong.cxx | 28 +++++++------- PWGCF/Tasks/correlations.cxx | 57 +++++++++++++++------------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 25bee387660..4d86c4deda5 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -11,26 +11,24 @@ /// \author Jasper Parkkila -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" - -#include "MathUtils/detail/TypeTruncation.h" - #include "PWGCF/DataModel/CorrelationsDerived.h" - #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "MathUtils/detail/TypeTruncation.h" + #include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -143,11 +141,11 @@ struct Filter2Prong { } PROCESS_SWITCH(Filter2Prong, processData, "Process data D0 candidates", true); - void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, aod::McParticles const& mcparticles) + void processMC(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) { - const auto& mcParticle = mcparticles.iteratorAt(r.mcParticleId()); + const auto& mcParticle = r.mcParticle(); if (mcParticle.daughtersIds().size() != 2) { output2ProngMcParts(-1, -1); continue; diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 7461cc4b671..1e079482284 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -13,36 +13,37 @@ /// \brief task for the correlation calculations with CF-filtered tracks for O2 analysis /// \author Jan Fiete Grosse-Oetringhaus , Jasper Parkkila -#include -#include -#include +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" -#include -#include -#include -#include -#include -#include +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" #include "CCDB/BasicCCDBManager.h" -#include "Framework/StepTHn.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 "CommonConstants/MathConstants.h" -#include "Common/Core/RecoDecay.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" -#include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -1065,17 +1066,21 @@ struct CorrelationTask { for (const auto& p2track : grouped2ProngTracks) { // Check if the mc particles of the prongs are found. + if (p2track.cfTrackProng0Id() < 0 || p2track.cfTrackProng1Id() < 0) { + // fake track + same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 0, multiplicity, mcCollision.posZ()); + } const auto& p0 = p2track.cfTrackProng0_as(); const auto& p1 = p2track.cfTrackProng1_as(); if (p0.has_cfMCParticle() && p1.has_cfMCParticle()) { // find the 2-prong MC particle by the daughter MC particle IDs auto m = std::find_if(p2indexCache.begin(), p2indexCache.end(), [&](const auto& t) -> bool { - const auto& mcParticle = mcParticles.iteratorAt(t); + const auto& mcParticle = mcParticles.iteratorAt(t - mcParticles.begin().globalIndex()); return p0.cfMCParticleId() == mcParticle.cfParticleDaugh0Id() && p1.cfMCParticleId() == mcParticle.cfParticleDaugh1Id(); }); if (m == p2indexCache.end()) continue; - const auto& mcParticle = mcParticles.iteratorAt(*m); + const auto& mcParticle = mcParticles.iteratorAt(*m - mcParticles.begin().globalIndex()); if (mcParticle.isPhysicalPrimary()) { same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ()); } From c45e5ec5e9a1edc422232283272f3e84f32393e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 13 Jun 2025 15:00:03 +0200 Subject: [PATCH 061/116] [PWGHF,Trigger] Include What You Use (#11548) --- EventFiltering/PWGHF/HFFilter.cxx | 75 ++++++++++++------- .../PWGHF/HFFilterCharmHadronSignals.cxx | 58 ++++++++------ EventFiltering/PWGHF/HFFilterHelpers.h | 63 +++++++++------- .../PWGHF/HFFilterPrepareMLSamples.cxx | 53 ++++++++----- 4 files changed, 151 insertions(+), 98 deletions(-) diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index 4c0d2d891de..7a538f53f27 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -8,7 +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. -// O2 includes /// \file HFFilter.cxx /// \brief task for selection of events with HF signals @@ -20,40 +19,60 @@ /// \author Federica Zanone , Heidelberg University /// \author Antonio Palasciano , INFN Bari -#include -#include -#include -#include - -#include "TRandom3.h" - -#include "CommonConstants/PhysicsConstants.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DCAFitter/DCAFitterN.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" +#include "EventFiltering/PWGHF/HFFilterHelpers.h" +#include "EventFiltering/filterTables.h" +// +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +// +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.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 "PWGEM/PhotonMeson/DataModel/gammaTables.h" - -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" - -#include "EventFiltering/filterTables.h" -#include "EventFiltering/PWGHF/HFFilterHelpers.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::soa; diff --git a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx index ab46a5e2504..3cd5a047bb9 100644 --- a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx +++ b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx @@ -8,37 +8,53 @@ // 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. -// O2 includes /// \file HFFilterCharmHadronSignals.cxx /// \brief task for the quality control of the signals of D0, D+, Ds+, Lc+, and D*+ selected in the HFFilter.cxx task /// /// \author Fabrizio Grosa , CERN -#include -#include - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - +#include "EventFiltering/PWGHF/HFFilterHelpers.h" +// +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +// +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" - -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -#include "EventFiltering/filterTables.h" -#include "EventFiltering/PWGHF/HFFilterHelpers.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.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::analysis; diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 72b2f71cae4..af70e4c05fa 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -8,7 +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. -// O2 includes /// \file HFFilterHelpers.h /// \brief Header file with definition of variables, methods, and tables used in the HFFilter.cxx task @@ -23,41 +22,47 @@ #ifndef EVENTFILTERING_PWGHF_HFFILTERHELPERS_H_ #define EVENTFILTERING_PWGHF_HFFILTERHELPERS_H_ +#include "EventFiltering/filterTables.h" +// +#include "PWGHF/Core/SelectorCuts.h" +// +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include +#include +#include +#include + +#include + #include #include #include +#include +#include #include -#include #include +#include #include -#include "Math/GenVector/Boost.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" - -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/MathConstants.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DataFormatsTPC/BetheBlochAleph.h" -#include "DCAFitter/DCAFitterN.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/DataTypes.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/AnalysisHelpers.h" -#include "Framework/O2DatabasePDGPlugin.h" - -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" - -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -#include "EventFiltering/filterTables.h" - namespace o2::aod { diff --git a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx index 2a5dda41464..6a5f50eb158 100644 --- a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx +++ b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx @@ -8,7 +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. -// O2 includes /// \file HFFilterPrepareMLSamples.cxx /// \brief task for trainings of ML models to be used in the HFFilter.cxx task @@ -19,31 +18,45 @@ /// \author Biao Zhang , CCNU /// \author Antonio Palasciano , INFN Bari -#include +#include "EventFiltering/PWGHF/HFFilterHelpers.h" +// +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +// +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + #if __has_include() #include // needed for HFFilterHelpers, to be fixed #else #include #endif -#include "CommonConstants/PhysicsConstants.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - -#include "Common/Core/trackUtilities.h" - -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -#include "EventFiltering/PWGHF/HFFilterHelpers.h" +#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::analysis; From 2fa94e55772815922c3f2f3aa37edb0eb8d24609 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Fri, 13 Jun 2025 15:15:07 +0200 Subject: [PATCH 062/116] [PWGLF] nuclei-proton angular correlations: Add dp and pp correlation (#11605) --- .../Tasks/Nuspex/hadronnucleicorrelation.cxx | 433 ++++++++++++++---- 1 file changed, 350 insertions(+), 83 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 6407e12a3c9..f90d12d75b1 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -13,36 +13,38 @@ /// \author Francesca Ercolessi /// \since 21 April 2024 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "TGrid.h" +#include "PWGCF/Femto3D/Core/femto3dPairTask.h" +#include "PWGCF/Femto3D/DataModel/singletrackselector.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Multiplicity.h" #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" - #include "Framework/ASoA.h" -#include "MathUtils/Utils.h" -#include "Framework/DataTypes.h" -#include "Common/DataModel/Multiplicity.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" #include "Framework/Expressions.h" - +#include "Framework/HistogramRegistry.h" #include "Framework/StaticFor.h" -#include "PWGCF/Femto3D/DataModel/singletrackselector.h" -#include "PWGCF/Femto3D/Core/femto3dPairTask.h" +#include "Framework/runDataProcessing.h" +#include "MathUtils/Utils.h" + +#include "TGrid.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::soa; @@ -56,6 +58,8 @@ struct hadronnucleicorrelation { static constexpr int pdgProton = 2212; static constexpr int pdgDeuteron = 1000010020; + Configurable mode{"mode", 0, "0: antid-antip, 1: d-p, 2: antid-p, 3: d-antip, 4: antip-p, 5: antip-antip, 6: p-p"}; + Configurable doQA{"doQA", true, "save QA histograms"}; Configurable doMCQA{"doMCQA", false, "save MC QA histograms"}; Configurable isMC{"isMC", false, "is MC"}; @@ -143,16 +147,21 @@ struct hadronnucleicorrelation { // key: pair of an integer and a float - value: vector of colType objects // for each key I have a vector of collisions - std::map, std::vector> mixbins_antidantip; + std::map, std::vector> mixbins_antid; + std::map, std::vector> mixbins_d; + std::map, std::vector> mixbins_antip; + std::map, std::vector> mixbins_p; std::map, std::vector> mixbinsPID_antidantip; std::map> mixbinsMC_antidantip; std::map> mixbinsMC_dp; - std::vector> hEtaPhi_AntiDeAntiPr_SE; - std::vector> hEtaPhi_AntiDeAntiPr_ME; - std::vector> hCorrEtaPhi_AntiDeAntiPr_SE; - std::vector> hCorrEtaPhi_AntiDeAntiPr_ME; + // Data histograms + std::vector> hEtaPhi_SE; + std::vector> hEtaPhi_ME; + std::vector> hCorrEtaPhi_SE; + std::vector> hCorrEtaPhi_ME; + // MC histograms std::vector> hEtaPhiRec_AntiDeAntiPr_SE; std::vector> hEtaPhiGen_AntiDeAntiPr_SE; std::vector> hEtaPhiRec_AntiDeAntiPr_ME; @@ -161,7 +170,6 @@ struct hadronnucleicorrelation { std::vector> hPIDEtaPhiGen_AntiDeAntiPr_SE; std::vector> hPIDEtaPhiRec_AntiDeAntiPr_ME; std::vector> hPIDEtaPhiGen_AntiDeAntiPr_ME; - std::vector> hEtaPhiGen_AntiPrAntiPr_SE; std::vector> hEtaPhiGen_AntiPrAntiPr_ME; @@ -193,19 +201,21 @@ struct hadronnucleicorrelation { AxisSpec ptBinnedAxis = {pTBins, "#it{p}_{T} of #bar{p} (GeV/c)"}; AxisSpec etaAxis = {100, -1., 1., "#eta"}; - AxisSpec phiAxis = {157, 0., 2 * o2::constants::math::PI, "#phi (rad)"}; + AxisSpec phiAxis = {157, 0., o2::constants::math::TwoPI, "#phi (rad)"}; AxisSpec pTAxis = {200, -10.f, 10.f, "p_{T} GeV/c"}; AxisSpec pTAxis_small = {100, -5.f, 5.f, "p_{T} GeV/c"}; AxisSpec DeltaEtaAxis = {100, -1.5, 1.5, "#Delta#eta"}; - AxisSpec DeltaPhiAxis = {60, -o2::constants::math::PI / 2, 1.5 * o2::constants::math::PI, "#Delta#phi (rad)"}; + AxisSpec DeltaPhiAxis = {60, -1 * o2::constants::math::PIHalf, 3 * o2::constants::math::PIHalf, "#Delta#phi (rad)"}; - registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{5, 0.f, 5.f}}}); + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{7, 0.f, 7.f}}}); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "Selected"); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "events with #bar{d}-#bar{p}"); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "events with d-p"); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "events with #bar{d}"); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "events with d"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(6, "events with #bar{p}"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(7, "events with p"); nBinspT = pTBins.value.size() - 1; @@ -251,17 +261,40 @@ struct hadronnucleicorrelation { } } + TString name = "AntiDeAntiPr"; + switch (mode) { + case 1: + name = "DePr"; + break; + case 2: + name = "AntiDePr"; + break; + case 3: + name = "DeAntiPr"; + break; + case 4: + name = "AntiPrPr"; + break; + case 5: + name = "AntiPrAntiPr"; + break; + case 6: + name = "PrPr"; + break; + } + if (!isMC) { for (int i = 0; i < nBinspT; i++) { - auto htempSE_AntiDeAntiPr = registry.add(Form("hEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_SE_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_%s_ME_pt%02.0f%02.0f", name.Data(), pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f - void mixTracks(Type const& tracks1, Type const& tracks2, bool isMCPID) + void mixTracks(Type const& tracks1, Type const& tracks2, bool isIdentical, bool isMCPID) { // last value: 0 -- SE; 1 -- ME for (auto it1 : tracks1) { for (auto it2 : tracks2) { @@ -529,7 +562,7 @@ struct hadronnucleicorrelation { // Calculate Delta-eta Delta-phi (reco) float deltaEta = it2->eta() - it1->eta(); float deltaPhi = it2->phi() - it1->phi(); - deltaPhi = getDeltaPhi(deltaPhi); + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -1 * o2::constants::math::PIHalf); // Calculate Delta-eta Delta-phi (gen) float deltaEtaGen = -999.; @@ -537,24 +570,52 @@ struct hadronnucleicorrelation { if constexpr (doMC) { deltaEtaGen = it2->eta_MC() - it1->eta_MC(); deltaPhiGen = it2->phi_MC() - it1->phi_MC(); - deltaPhiGen = getDeltaPhi(deltaPhiGen); + deltaPhiGen = RecoDecay::constrainAngle(deltaPhiGen, -1 * o2::constants::math::PIHalf); } - float antipcorr = 1, antidcorr = 1; - for (int k = 0; k < nBinspT; k++) { if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { + float corr1 = 1, corr2 = 1; + if (docorrection) { // Apply corrections - antipcorr = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); - antidcorr = hEffpTEta_antideuteron->Interpolate(it1->pt(), it1->eta()); + switch (mode) { + case 0: + corr1 = hEffpTEta_antideuteron->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); + break; + case 1: + corr1 = hEffpTEta_deuteron->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_proton->Interpolate(it2->pt(), it2->eta()); + break; + case 2: + corr1 = hEffpTEta_antideuteron->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_proton->Interpolate(it2->pt(), it2->eta()); + break; + case 3: + corr1 = hEffpTEta_deuteron->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); + break; + case 4: + corr1 = hEffpTEta_antiproton->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_proton->Interpolate(it2->pt(), it2->eta()); + break; + case 5: + corr1 = hEffpTEta_antiproton->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); + break; + case 6: + corr1 = hEffpTEta_proton->Interpolate(it1->pt(), it1->eta()); + corr2 = hEffpTEta_proton->Interpolate(it2->pt(), it2->eta()); + break; + } } if (ME) { if constexpr (!doMC) { // Data - hEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); + hEtaPhi_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hCorrEtaPhi_ME[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (corr1 * corr2)); } else { // MC if (isMCPID) { hPIDEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); @@ -566,8 +627,12 @@ struct hadronnucleicorrelation { } } else { if constexpr (!doMC) { // Data - hEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); + // is Identical (pp and antip-antip)? + if (isIdentical && std::abs(deltaPhi) < 0.001 && std::abs(deltaEta) < 0.001) { + continue; + } + hEtaPhi_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hCorrEtaPhi_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (corr1 * corr2)); } else { // MC if (isMCPID) { hPIDEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); @@ -591,7 +656,7 @@ struct hadronnucleicorrelation { for (auto it2 : particles2) { // Calculate Delta-eta Delta-phi (gen) float deltaEtaGen = it2->eta() - it1->eta(); - float deltaPhiGen = getDeltaPhi(it2->phi() - it1->phi()); + float deltaPhiGen = RecoDecay::constrainAngle(it2->phi() - it1->phi(), -1 * o2::constants::math::PIHalf); // Loop over pT bins for (int k = 0; k < nBinspT; k++) { @@ -615,7 +680,7 @@ struct hadronnucleicorrelation { for (auto it2 : particles2) { // Calculate Delta-eta Delta-phi (gen) float deltaEtaGen = it2->eta() - it1->eta(); - float deltaPhiGen = getDeltaPhi(it2->phi() - it1->phi()); + float deltaPhiGen = RecoDecay::constrainAngle(it2->phi() - it1->phi(), -1 * o2::constants::math::PIHalf); if (!ME && std::abs(deltaPhiGen) < 0.001 && std::abs(deltaEtaGen) < 0.001) { continue; @@ -636,16 +701,6 @@ struct hadronnucleicorrelation { } } - float getDeltaPhi(float deltaPhi) - { - if (deltaPhi < -o2::constants::math::PI / 2) { - return deltaPhi += 2 * o2::constants::math::PI; - } else if (deltaPhi >= 3 * o2::constants::math::PI / 2) { - return deltaPhi -= 2 * o2::constants::math::PI; - } - return deltaPhi; - } - void GetCorrection(o2::framework::Service const& ccdbObj, TString filepath, TString histname) { TList* l = ccdbObj->get(filepath.Data()); @@ -793,14 +848,180 @@ struct hadronnucleicorrelation { if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end()) { registry.fill(HIST("hNEvents"), 3.5); + mixbins_antid[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + if (selectedtracks_d.find(collision.globalIndex()) != selectedtracks_d.end()) { + registry.fill(HIST("hNEvents"), 4.5); + mixbins_d[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + if (selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { + registry.fill(HIST("hNEvents"), 5.5); + mixbins_antip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + if (selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) { + registry.fill(HIST("hNEvents"), 6.5); + mixbins_p[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + } + + if (mode == 0 && !mixbins_antid.empty()) { + + for (auto i = mixbins_antid.begin(); i != mixbins_antid.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { + mixTracks<0, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 0, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } - mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { + mixTracks<1, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col2->index()], 0, 0); // mixing ME + } + } + } } } - if (!mixbins_antidantip.empty()) { + if (mode == 1 && !mixbins_d.empty()) { - for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) { // iterating over all vertex&mult bins + for (auto i = mixbins_d.begin(); i != mixbins_d.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) { + mixTracks<0, 0>(selectedtracks_d[col1->index()], selectedtracks_p[col1->index()], 0, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_p.find(col2->index()) != selectedtracks_p.end()) { + mixTracks<1, 0>(selectedtracks_d[col1->index()], selectedtracks_p[col2->index()], 0, 0); // mixing ME + } + } + } + } + } + + if (mode == 2 && !mixbins_antid.empty()) { + + for (auto i = mixbins_antid.begin(); i != mixbins_antid.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) { + mixTracks<0, 0>(selectedtracks_antid[col1->index()], selectedtracks_p[col1->index()], 0, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_p.find(col2->index()) != selectedtracks_p.end()) { + mixTracks<1, 0>(selectedtracks_antid[col1->index()], selectedtracks_p[col2->index()], 0, 0); // mixing ME + } + } + } + } + } + + if (mode == 3 && !mixbins_d.empty()) { + + for (auto i = mixbins_d.begin(); i != mixbins_d.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { + mixTracks<0, 0>(selectedtracks_d[col1->index()], selectedtracks_antip[col1->index()], 0, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { + mixTracks<1, 0>(selectedtracks_d[col1->index()], selectedtracks_antip[col2->index()], 0, 0); // mixing ME + } + } + } + } + } + + if (mode == 4 && !mixbins_antip.empty()) { + + for (auto i = mixbins_antip.begin(); i != mixbins_antip.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) { + mixTracks<0, 0>(selectedtracks_antip[col1->index()], selectedtracks_p[col1->index()], 0, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_p.find(col2->index()) != selectedtracks_p.end()) { + mixTracks<1, 0>(selectedtracks_antip[col1->index()], selectedtracks_p[col2->index()], 0, 0); // mixing ME + } + } + } + } + } + + if (mode == 5 && !mixbins_antip.empty()) { + + for (auto i = mixbins_antip.begin(); i != mixbins_antip.end(); i++) { // iterating over all vertex&mult bins std::vector value = i->second; int EvPerBin = value.size(); // number of collisions in each vertex&mult bin @@ -810,7 +1031,7 @@ struct hadronnucleicorrelation { auto col1 = value[indx1]; if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { - mixTracks<0, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 0); // mixing SE + mixTracks<0, 0>(selectedtracks_antip[col1->index()], selectedtracks_antip[col1->index()], 1, 0); // mixing SE } for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -822,7 +1043,38 @@ struct hadronnucleicorrelation { } if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { - mixTracks<1, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col2->index()], 0); // mixing ME + mixTracks<1, 0>(selectedtracks_antip[col1->index()], selectedtracks_antip[col2->index()], 1, 0); // mixing ME + } + } + } + } + } + + if (mode == 6 && !mixbins_p.empty()) { + + for (auto i = mixbins_p.begin(); i != mixbins_p.end(); i++) { // iterating over all vertex&mult bins + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + auto col1 = value[indx1]; + + if (selectedtracks_p.find(col1->index()) != selectedtracks_p.end()) { + mixTracks<0, 0>(selectedtracks_p[col1->index()], selectedtracks_p[col1->index()], 1, 0); // mixing SE + } + + for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_p.find(col2->index()) != selectedtracks_p.end()) { + mixTracks<1, 0>(selectedtracks_p[col1->index()], selectedtracks_p[col2->index()], 1, 0); // mixing ME } } } @@ -846,10 +1098,25 @@ struct hadronnucleicorrelation { (i->second).clear(); selectedtracks_d.clear(); - for (auto& pair : mixbins_antidantip) { + for (auto& pair : mixbins_antid) { + pair.second.clear(); // Clear the vector associated with the key + } + mixbins_antid.clear(); // Then clear the map itself + + for (auto& pair : mixbins_d) { + pair.second.clear(); // Clear the vector associated with the key + } + mixbins_d.clear(); // Then clear the map itself + + for (auto& pair : mixbins_antip) { + pair.second.clear(); // Clear the vector associated with the key + } + mixbins_antip.clear(); // Then clear the map itself + + for (auto& pair : mixbins_p) { pair.second.clear(); // Clear the vector associated with the key } - mixbins_antidantip.clear(); // Then clear the map itself + mixbins_p.clear(); // Then clear the map itself } PROCESS_SWITCH(hadronnucleicorrelation, processData, "processData", true); @@ -1222,7 +1489,7 @@ struct hadronnucleicorrelation { int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); if (selectedtracksMC_antid.find(collision.globalIndex()) != selectedtracksMC_antid.end()) { - mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + mixbins_antid[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); } if (selectedtracksPIDMC_antid.find(collision.globalIndex()) != selectedtracksPIDMC_antid.end()) { @@ -1230,9 +1497,9 @@ struct hadronnucleicorrelation { } } // coll - if (!mixbins_antidantip.empty()) { + if (!mixbins_antid.empty()) { - for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) { // iterating over all vertex&mult bins + for (auto i = mixbins_antid.begin(); i != mixbins_antid.end(); i++) { // iterating over all vertex&mult bins std::vector value = i->second; int EvPerBin = value.size(); // number of collisions in each vertex&mult bin @@ -1242,7 +1509,7 @@ struct hadronnucleicorrelation { auto col1 = value[indx1]; if (selectedtracksMC_antip.find(col1->index()) != selectedtracksMC_antip.end()) { - mixTracks<0, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col1->index()], 0); // mixing SE + mixTracks<0, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col1->index()], 0, 0); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1254,7 +1521,7 @@ struct hadronnucleicorrelation { } if (selectedtracksMC_antip.find(col2->index()) != selectedtracksMC_antip.end()) { - mixTracks<1, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col2->index()], 0); // mixing ME + mixTracks<1, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col2->index()], 0, 0); // mixing ME } } } @@ -1273,7 +1540,7 @@ struct hadronnucleicorrelation { auto col1 = value[indx1]; if (selectedtracksPIDMC_antip.find(col1->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<0, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col1->index()], 1); // mixing SE + mixTracks<0, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col1->index()], 0, 1); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1285,7 +1552,7 @@ struct hadronnucleicorrelation { } if (selectedtracksPIDMC_antip.find(col2->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<1, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col2->index()], 1); // mixing ME + mixTracks<1, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col2->index()], 0, 1); // mixing ME } } } @@ -1330,10 +1597,10 @@ struct hadronnucleicorrelation { } mixbinsPID_antidantip.clear(); // clear the map - for (auto& pair : mixbins_antidantip) { + for (auto& pair : mixbins_antid) { pair.second.clear(); // clear the vector associated with the key } - mixbins_antidantip.clear(); // clear the map + mixbins_antid.clear(); // clear the map } PROCESS_SWITCH(hadronnucleicorrelation, processMC, "processMC", false); From b901a1f7df85dbecc08a4dfbaa05e0be61af916b Mon Sep 17 00:00:00 2001 From: YubiaoWang Date: Fri, 13 Jun 2025 21:19:00 +0800 Subject: [PATCH 063/116] [PWGJE] Add MCD and MCP in jet v2 task, Updated Data and MC fitting check plots (#11596) --- PWGJE/Tasks/jetChargedV2.cxx | 1287 +++++++++++++++++++++++++++------- 1 file changed, 1028 insertions(+), 259 deletions(-) diff --git a/PWGJE/Tasks/jetChargedV2.cxx b/PWGJE/Tasks/jetChargedV2.cxx index 6133cc19a27..20ea7907a75 100644 --- a/PWGJE/Tasks/jetChargedV2.cxx +++ b/PWGJE/Tasks/jetChargedV2.cxx @@ -13,70 +13,60 @@ /// \file jetChargedV2.cxx /// \brief This file contains the implementation for the Charged Jet v2 analysis in the ALICE experiment -#include -#include -#include -#include -#include -#include -#include -#include -#include -// o2Physics includes. -#include "CommonConstants/MathConstants.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" - -#include "Framework/runDataProcessing.h" - -#include "Common/DataModel/FT0Corrected.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/CCDB/ctpRateFetcher.h" - -//< evt pln .h >// -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/DataModel/Jet.h" -#include "Common/DataModel/Qvectors.h" #include "Common/Core/EventPlaneHelper.h" -//< evt pln .h | end >// - -// o2 includes. -#include "DetectorsCommonDataFormats/AlignParam.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/filterTables.h" +#include "CommonConstants/PhysicsConstants.h" #include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetFinder.h" -#include "PWGJE/Core/JetFindingUtilities.h" -#include "PWGJE/DataModel/Jet.h" +#include +#include +#include +#include +#include +#include +#include +#include -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "EventFiltering/filterTables.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct JetChargedV2 { + using McParticleCollision = soa::Join; + using ChargedMCDMatchedJets = soa::Join; + using ChargedMCPMatchedJets = soa::Join; + HistogramRegistry registry; HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; - Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; @@ -95,6 +85,7 @@ struct JetChargedV2 { Configurable jetPtMax{"jetPtMax", 200.0, "maximum pT acceptance for jets"}; Configurable jetEtaMin{"jetEtaMin", -0.9, "minimum eta acceptance for jets"}; Configurable jetEtaMax{"jetEtaMax", 0.9, "maximum eta acceptance for jets"}; + Configurable nBinsEta{"nBinsEta", 200, "number of bins for eta axes"}; Configurable jetRadius{"jetRadius", 0.2, "jet resolution parameters"}; Configurable randomConeLeadJetDeltaR{"randomConeLeadJetDeltaR", -99.0, "min distance between leading jet axis and random cone (RC) axis; if negative, min distance is set to automatic value of R_leadJet+R_RC "}; @@ -104,6 +95,7 @@ struct JetChargedV2 { Configurable randomConeR{"randomConeR", 0.4, "size of random Cone for estimating background fluctuations"}; Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; + //=====================< evt pln >=====================// Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "event selection"}; Configurable> cfgnMods{"cfgnMods", {2}, "Modulation of interest"}; @@ -124,6 +116,16 @@ struct JetChargedV2 { int refAId; int refBId; + //=====================< jetSpectraConfig to this analysis >=====================// + Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + Configurable acceptSplitCollisions{"acceptSplitCollisions", 0, "0: only look at mcCollisions that are not split; 1: accept split mcCollisions, 2: accept split mcCollisions but only look at the first reco collision associated with it"}; + Configurable pTHatAbsoluteMin{"pTHatAbsoluteMin", -99.0, "minimum value of pTHat"}; + Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection can also be applied at the jet finder level for jets only, here rejection is applied for collision and track process functions for the first time, and on jets in case it was set to false at the jet finder level"}; + Configurable checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"}; + 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 checkLeadConstituentPtForMcpJets{"checkLeadConstituentPtForMcpJets", false, "flag to choose whether particle level jets should have their lead track pt above leadingConstituentPtMin to be accepted; off by default, as leadingConstituentPtMin cut is only applied on MCD jets for the Pb-Pb analysis using pp MC anchored to Pb-Pb for the response matrix"}; + template int getDetId(const T& name) { @@ -148,7 +150,7 @@ struct JetChargedV2 { return 0; } } - //=====================< evt pln | end >=====================// + //=====================< evt p615ln | end >=====================// Configurable selectedJetsRadius{"selectedJetsRadius", 0.2, "resolution parameter for histograms without radius"}; @@ -160,7 +162,12 @@ struct JetChargedV2 { double evtnum = 0; double accptTrack = 0; double fitTrack = 0; + float collQvecAmpDetId = 1e-8; TH1F* hPtsumSumptFit = nullptr; + TH1F* hPtsumSumptFitMCP = nullptr; + TF1* fFitModulationV2v3 = 0x0; + TH1F* hPtsumSumptFitP = nullptr; + TF1* fFitModulationV2v3P = 0x0; void init(o2::framework::InitContext&) { @@ -173,6 +180,12 @@ struct JetChargedV2 { refAId = 4; refBId = 5; } + auto jetRadiiBins = (std::vector)jetRadii; + if (jetRadiiBins.size() > 1) { + jetRadiiBins.push_back(jetRadiiBins[jetRadiiBins.size() - 1] + (std::abs(jetRadiiBins[jetRadiiBins.size() - 1] - jetRadiiBins[jetRadiiBins.size() - 2]))); + } else { + jetRadiiBins.push_back(jetRadiiBins[jetRadiiBins.size() - 1] + 0.1); + } auto jetPtTemp = 0.0; jetPtBins.push_back(jetPtTemp); @@ -200,8 +213,14 @@ struct JetChargedV2 { } std::sort(jetPtBinsRhoAreaSub.begin(), jetPtBinsRhoAreaSub.end()); - AxisSpec jetPtAxis = {jetPtBins, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec jetPtAxisRhoAreaSub = {jetPtBinsRhoAreaSub, "#it{p}_{T} (GeV/#it{c})"}; + //< MCAxis >// + AxisSpec centralityAxis = {1200, -10., 110., "Centrality"}; + AxisSpec trackPtAxis = {200, -0.5, 199.5, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec trackEtaAxis = {nBinsEta, -1.0, 1.0, "#eta"}; + AxisSpec phiAxis = {160, -1.0, 7.0, "#varphi"}; + AxisSpec jetPtAxis = {200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetPtAxisRhoAreaSub = {400, -200., 200., "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec jetEtaAxis = {nBinsEta, -1.0, 1.0, "#eta"}; AxisSpec axisPt = {40, 0.0, 4.0}; AxisSpec axisEta = {32, -0.8, 0.8}; @@ -211,102 +230,177 @@ struct JetChargedV2 { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); - //< Track efficiency plots >// - registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); - registry.add("h2_centrality_collisions", "centrality vs collisions; centrality; collisions", {HistType::kTH2F, {{120, -10., 110.}, {4, 0.0, 4.0}}}); - registry.add("h2_centrality_track_pt", "centrality vs track pT; centrality; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{1200, -10.0, 110.0}, {200, 0., 200.}}}); - registry.add("h2_centrality_track_eta", "centrality vs track #eta; centrality; #eta_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {100, -1.0, 1.0}}}); - registry.add("h2_centrality_track_phi", "centrality vs track #varphi; centrality; #varphi_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {160, -1.0, 7.}}}); - registry.add("h2_centrality_track_energy", "centrality vs track energy; centrality; Energy GeV", {HistType::kTH2F, {{120, -10., 110.}, {100, 0.0, 100.0}}}); - registry.add("h2_track_pt_track_sigmapt", "#sigma(#it{p}_{T})/#it{p}_{T}; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 10.}, {100000, 0.0, 100.0}}}); - registry.add("h2_track_pt_high_track_sigmapt", "#sigma(#it{p}_{T})/#it{p}_{T}; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{90, 10., 100.}, {100000, 0.0, 100.0}}}); - registry.add("h2_track_pt_track_sigma1overpt", "#sigma(1/#it{p}_{T}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 10.}, {1000, 0.0, 10.0}}}); - registry.add("h2_track_pt_high_track_sigma1overpt", "#sigma(1/#it{p}_{T}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{90, 10., 100.}, {1000, 0.0, 10.0}}}); - - //< \sigma p_T at local rho test plot > - registry.add("h_accept_Track", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("h_accept_Track_init", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - registry.add("h_accept_Track_Fit", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); - - registry.add("h_ptsum_collnum", "ptsum collnum;collnum;entries", {HistType::kTH1F, {{40, 0.0, 40}}}); - registry.add("h_ptsum_sumpt", "jet sumpt;sum p_{T};entries", {HistType::kTH1F, {{40, 0., o2::constants::math::TwoPI}}}); - registry.add("h2_phi_track_eta", "phi vs track eta; #eta (GeV/#it{c}); #varphi", {HistType::kTH2F, {{100, -1.0, 1.0}, {40, 0., o2::constants::math::TwoPI}}}); - registry.add("h2_centrality_phi_w_pt", "centrality vs jet #varphi; centrality; entries", {HistType::kTH2F, {{100, 0.0, 100.0}, {40, 0., o2::constants::math::TwoPI}}}); - registry.add("h2_evtnum_phi_w_pt", "eventNumber vs jet #varphi; #eventNumber; entries", {HistType::kTH2F, {{1000, 0.0, 1000}, {40, 0., o2::constants::math::TwoPI}}}); - - //< fit quality >// - registry.add("h_PvalueCDF_CombinFit", "cDF #chi^{2}; entries", {HistType::kTH1F, {{50, 0, 1}}}); - registry.add("h2_PvalueCDFCent_CombinFit", "p-value cDF vs centrality; centrality; p-value", {HistType::kTH2F, {{100, 0, 100}, {40, 0, 1}}}); - registry.add("h2_Chi2Cent_CombinFit", "Chi2 vs centrality; centrality; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 100}, {100, 0, 5}}}); - registry.add("h2_PChi2_CombinFit", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); - - registry.add("Thn_PChi2_CombinFitCent", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTHnSparseF, {{100, 0.0, 100.0}, {100, 0, 1}, {100, 0, 5}}}); - registry.add("h2_PChi2_CombinFitA", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); - registry.add("h2_PChi2_CombinFitB", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); - - registry.add("h_evtnum_centrlity", "eventNumber vs centrality ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - registry.add("h_evtnum_NTrk", "eventNumber vs Number of Track ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - - registry.add("Thn_evtnum_phi_centrality", "eventNumber vs jet #varphi; #eventNumber; entries", {HistType::kTHnSparseF, {{1000, 0.0, 1000}, {40, 0., o2::constants::math::TwoPI}, {100, 0.0, 100.0}}}); - - registry.add("h2_evt_fitpara", "event vs fit parameter; evtnum; parameter", {HistType::kTH2F, {cfgAxisEvtfit, {5, 0., 5}}}); - - registry.add("h_v2obs_centrality", "fitparameter v2obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); - registry.add("h_v3obs_centrality", "fitparameter v3obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); - - registry.add("h_fitparaRho_evtnum", "fitparameter #rho_{0} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - registry.add("h_fitparaPsi2_evtnum", "fitparameter #Psi_{2} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - registry.add("h_fitparaPsi3_evtnum", "fitparameter #Psi_{3} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - registry.add("h_fitparav2obs_evtnum", "fitparameter v2obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - registry.add("h_fitparav3obs_evtnum", "fitparameter v3obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); - - registry.add("h2_fitParaZero_cent", "#varphi vs #rho(#varphi); #cent; #fitParameter[0] ", {HistType::kTH2F, {{100, 0., 100}, {210, -10.0, 200.0}}}); - registry.add("h2_phi_rhophi", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho_{ch}(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); - registry.add("h2_phi_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); - registry.add("h2_phi_rholocal_cent", "#varphi vs #rho(#varphi); #cent; #rho(#varphi) ", {HistType::kTH2F, {{100, 0., 100}, {210, -10.0, 200.0}}}); - registry.add("h3_centrality_localrho_phi", "centrality; #rho_{local}; #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {200, 0.0, 200.0}, {40, 0., o2::constants::math::TwoPI}}}); - - registry.add("h3_centrality_rhovsphi_phi", "centrality; #rho(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {200, 0.0, 200.0}, {40, 0., o2::constants::math::TwoPI}}}); - //< \sigma p_T at local rho test plot | end > - - registry.add("h_jet_pt_rhoareasubtracted", "jet pT rhoareasubtracted;#it{p}_{T,jet} (GeV/#it{c}); entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_rholocal", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - - registry.add("h2_centrality_jet_pt_rhoareasubtracted", "centrality vs #it{p}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{1200, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - - registry.add("leadJetPt", "leadJet Pt ", {HistType::kTH1F, {{200, 0., 200.0}}}); - registry.add("leadJetPhi", "leadJet constituent #phi ", {HistType::kTH1F, {{80, -1.0, 7.}}}); - registry.add("leadJetEta", "leadJet constituent #eta ", {HistType::kTH1F, {{100, -1.0, 1.0}}}); - - //< RC test plots >// - registry.add("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - registry.add("h3_centrality_deltapT_RandomCornPhi_localrhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - registry.add("h2_centrality_deltapT_RandomCornPhi_RCprocess_rhorandomconewithoutleadingjet", "#it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH2F, {{400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - - registry.add("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); - //< bkg sub plot | end >// - //< median rho >// - registry.add("h_jet_pt_in_plane_v2", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_out_of_plane_v2", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_in_plane_v3", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_out_of_plane_v3", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - - registry.add("h2_centrality_jet_pt_in_plane_v2", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_out_of_plane_v2", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_in_plane_v3", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_out_of_plane_v3", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - //< rho(phi) >// - registry.add("h_jet_pt_inclusive_v2_rho", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_in_plane_v2_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_out_of_plane_v2_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_in_plane_v3_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - registry.add("h_jet_pt_out_of_plane_v3_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); - - registry.add("h2_centrality_jet_pt_in_plane_v2_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_out_of_plane_v2_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_in_plane_v3_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); - registry.add("h2_centrality_jet_pt_out_of_plane_v3_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h_jet_phat", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_jet_phat_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + + if (doprocessSigmaPtMCP) { + registry.add("h_jet_eta_part_rhoareasubtracted", "part jet #eta;#eta^{part}; counts", {HistType::kTH1F, {jetEtaAxis}}); + registry.add("h_jet_phi_part_rhoareasubtracted", "part jet #varphi;#varphi^{part}; counts", {HistType::kTH1F, {phiAxis}}); + registry.add("h2_jet_pt_part_jet_area_part_rhoareasubtracted", "part jet #it{p}_{T,jet} vs. Area_{jet}; #it{p}_{T,jet}^{part} (GeV/#it{c}); Area_{jet}^{part}", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {150, 0., 1.5}}}); + registry.add("h3_jet_pt_jet_eta_jet_phi_part_rhoareasubtracted", "part jet pt vs. eta vs.phi", {HistType::kTH3F, {jetPtAxisRhoAreaSub, jetEtaAxis, phiAxis}}); + registry.add("leadJetPtMCP", "MCP leadJet Pt ", {HistType::kTH1F, {{200, 0., 200.0}}}); + registry.add("leadJetPhiMCP", "MCP leadJet constituent #phi ", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("leadJetEtaMCP", "MCP leadJet constituent #eta ", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_mcp_evtnum_NTrk", "MCP eventNumber vs Number of Track ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h3_mcp_centrality_localrho_phi", "MCP centrality; #rho_{local}; #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {200, 0.0, 200.0}, {40, 0., o2::constants::math::TwoPI}}}); + registry.add("h_mcp_jet_pt_rholocal", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h2_mcp_phi_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); + //< MCP fit test >// + registry.add("h_mcp_ptsum_sumpt", "jet sumpt;sum p_{T};entries", {HistType::kTH1F, {{40, 0., o2::constants::math::TwoPI}}}); + registry.add("h2_mcp_phi_track_eta", "phi vs track eta; #eta (GeV/#it{c}); #varphi", {HistType::kTH2F, {{100, -1.0, 1.0}, {40, 0., o2::constants::math::TwoPI}}}); + registry.add("h_mcp_evtnum_centrlity", "eventNumber vs centrality ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_v2obs_centrality", "fitparameter v2obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); + registry.add("h_mcp_v3obs_centrality", "fitparameter v3obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); + registry.add("h_mcp_fitparaRho_evtnum", "fitparameter #rho_{0} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_fitparaPsi2_evtnum", "fitparameter #Psi_{2} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_fitparaPsi3_evtnum", "fitparameter #Psi_{3} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_fitparav2obs_evtnum", "fitparameter v2obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_mcp_fitparav3obs_evtnum", "fitparameter v3obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + + registry.add("h_mcp_jet_pt_in_plane_v2_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_mcp_jet_pt_out_of_plane_v2_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_mcp_jet_pt_in_plane_v3_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_mcp_jet_pt_out_of_plane_v3_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("h2_mcp_centrality_jet_pt_in_plane_v2_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_mcp_centrality_jet_pt_out_of_plane_v2_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_mcp_centrality_jet_pt_in_plane_v3_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_mcp_centrality_jet_pt_out_of_plane_v3_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + + registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + registry.add("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + + registry.add("h_mcColl_counts_areasub", " number of mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(1, "allMcColl"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(2, "vertexZ"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(4, "splitColl"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(5, "recoEvtSel"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(6, "centralitycut"); + registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(7, "occupancycut"); + registry.add("h_mcColl_rho", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, 0.0, 500.0}}}); + + //< \sigma p_T at local rho test plot > + registry.add("h_accept_Track", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(1, "acceptTrk"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(2, "acceptTrkInFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(3, "beforeSumptFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(4, "afterSumptFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(5, "getNtrk"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(6, "getNtrkMCP"); + //< fit test >// + registry.add("h_ptsum_collnum", "ptsum collnum;collnum;entries", {HistType::kTH1F, {{40, 0.0, 40}}}); + registry.add("h_ptsum_sumpt", "jet sumpt;sum p_{T};entries", {HistType::kTH1F, {{40, 0., o2::constants::math::TwoPI}}}); + } + if (doprocessInOutJetV2 || doprocessInOutJetV2MCD || doprocessSigmaPt || doprocessSigmaPtMCD) { + //< Track efficiency plots >// + registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("h2_centrality_collisions", "centrality vs collisions; centrality; collisions", {HistType::kTH2F, {{120, -10., 110.}, {4, 0.0, 4.0}}}); + registry.add("h2_centrality_track_pt", "centrality vs track pT; centrality; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{1200, -10.0, 110.0}, {200, 0., 200.}}}); + registry.add("h2_centrality_track_eta", "centrality vs track #eta; centrality; #eta_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {100, -1.0, 1.0}}}); + registry.add("h2_centrality_track_phi", "centrality vs track #varphi; centrality; #varphi_{track}", {HistType::kTH2F, {{1200, -10.0, 110.0}, {160, -1.0, 7.}}}); + registry.add("h2_centrality_track_energy", "centrality vs track energy; centrality; Energy GeV", {HistType::kTH2F, {{120, -10., 110.}, {100, 0.0, 100.0}}}); + registry.add("h2_track_pt_track_sigmapt", "#sigma(#it{p}_{T})/#it{p}_{T}; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 10.}, {100000, 0.0, 100.0}}}); + registry.add("h2_track_pt_high_track_sigmapt", "#sigma(#it{p}_{T})/#it{p}_{T}; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{90, 10., 100.}, {100000, 0.0, 100.0}}}); + registry.add("h2_track_pt_track_sigma1overpt", "#sigma(1/#it{p}_{T}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{100, 0., 10.}, {1000, 0.0, 10.0}}}); + registry.add("h2_track_pt_high_track_sigma1overpt", "#sigma(1/#it{p}_{T}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{90, 10., 100.}, {1000, 0.0, 10.0}}}); + + //< \sigma p_T at local rho test plot > + registry.add("h_accept_Track", "all and accept track;Track;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(1, "acceptTrk"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(2, "acceptTrkInFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(3, "beforeSumptFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(4, "afterSumptFit"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(5, "getNtrk"); + registry.get(HIST("h_accept_Track"))->GetXaxis()->SetBinLabel(6, "getNtrkMCP"); + + registry.add("h_ptsum_collnum", "ptsum collnum;collnum;entries", {HistType::kTH1F, {{40, 0.0, 40}}}); + registry.add("h_ptsum_sumpt", "jet sumpt;sum p_{T};entries", {HistType::kTH1F, {{40, 0., o2::constants::math::TwoPI}}}); + registry.add("h2_phi_track_eta", "phi vs track eta; #eta (GeV/#it{c}); #varphi", {HistType::kTH2F, {{100, -1.0, 1.0}, {40, 0., o2::constants::math::TwoPI}}}); + registry.add("h2_centrality_phi_w_pt", "centrality vs jet #varphi; centrality; entries", {HistType::kTH2F, {{100, 0.0, 100.0}, {40, 0., o2::constants::math::TwoPI}}}); + registry.add("h2_evtnum_phi_w_pt", "eventNumber vs jet #varphi; #eventNumber; entries", {HistType::kTH2F, {{1000, 0.0, 1000}, {40, 0., o2::constants::math::TwoPI}}}); + + //< fit quality >// + registry.add("h_PvalueCDF_CombinFit", "cDF #chi^{2}; entries", {HistType::kTH1F, {{50, 0, 1}}}); + registry.add("h2_PvalueCDFCent_CombinFit", "p-value cDF vs centrality; centrality; p-value", {HistType::kTH2F, {{100, 0, 100}, {40, 0, 1}}}); + registry.add("h2_Chi2Cent_CombinFit", "Chi2 vs centrality; centrality; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 100}, {100, 0, 5}}}); + registry.add("h2_PChi2_CombinFit", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); + + registry.add("Thn_PChi2_CombinFitCent", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTHnSparseF, {{100, 0.0, 100.0}, {100, 0, 1}, {100, 0, 5}}}); + registry.add("h2_PChi2_CombinFitA", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); + registry.add("h2_PChi2_CombinFitB", "p-value vs #tilde{#chi^{2}}; p-value; #tilde{#chi^{2}}", {HistType::kTH2F, {{100, 0, 1}, {100, 0, 5}}}); + + registry.add("h_evtnum_centrlity", "eventNumber vs centrality ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_evtnum_NTrk", "eventNumber vs Number of Track ; #eventNumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + + registry.add("Thn_evtnum_phi_centrality", "eventNumber vs jet #varphi; #eventNumber; entries", {HistType::kTHnSparseF, {{1000, 0.0, 1000}, {40, 0., o2::constants::math::TwoPI}, {100, 0.0, 100.0}}}); + + registry.add("h2_evt_fitpara", "event vs fit parameter; evtnum; parameter", {HistType::kTH2F, {cfgAxisEvtfit, {5, 0., 5}}}); + registry.add("h_v2obs_centrality", "fitparameter v2obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); + registry.add("h_v3obs_centrality", "fitparameter v3obs vs centrality ; #centrality", {HistType::kTProfile, {cfgAxisVnCent}}); + + registry.add("h_fitparaRho_evtnum", "fitparameter #rho_{0} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_fitparaPsi2_evtnum", "fitparameter #Psi_{2} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_fitparaPsi3_evtnum", "fitparameter #Psi_{3} vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_fitparav2obs_evtnum", "fitparameter v2obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + registry.add("h_fitparav3obs_evtnum", "fitparameter v3obs vs evtnum ; #eventnumber", {HistType::kTH1F, {{1000, 0.0, 1000}}}); + + registry.add("h2_fitParaZero_cent", "#varphi vs #rho(#varphi); #cent; #fitParameter[0] ", {HistType::kTH2F, {{100, 0., 100}, {210, -10.0, 200.0}}}); + registry.add("h2_phi_rhophi", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho_{ch}(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); + registry.add("h2_phi_rholocal", "#varphi vs #rho(#varphi); #varphi - #Psi_{EP,2}; #rho(#varphi) ", {HistType::kTH2F, {{40, 0., o2::constants::math::TwoPI}, {210, -10.0, 200.0}}}); + registry.add("h2_phi_rholocal_cent", "#varphi vs #rho(#varphi); #cent; #rho(#varphi) ", {HistType::kTH2F, {{100, 0., 100}, {210, -10.0, 200.0}}}); + registry.add("h3_centrality_localrho_phi", "centrality; #rho_{local}; #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {200, 0.0, 200.0}, {40, 0., o2::constants::math::TwoPI}}}); + + registry.add("h3_centrality_rhovsphi_phi", "centrality; #rho(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{120, -10.0, 110.0}, {200, 0.0, 200.0}, {40, 0., o2::constants::math::TwoPI}}}); + //< \sigma p_T at local rho test plot | end > + + registry.add("h_jet_pt_rhoareasubtracted", "jet pT rhoareasubtracted;#it{p}_{T,jet} (GeV/#it{c}); entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_rholocal", "jet pT rholocal;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("leadJetPt", "leadJet Pt ", {HistType::kTH1F, {{200, 0., 200.0}}}); + registry.add("leadJetPhi", "leadJet constituent #phi ", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("leadJetEta", "leadJet constituent #eta ", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + + //< RC test plots >// + registry.add("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + registry.add("h3_centrality_deltapT_RandomCornPhi_localrhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + + registry.add("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}(#varphi); #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {100, 0., o2::constants::math::TwoPI}}}); + //< bkg sub plot | end >// + //< median rho >// + registry.add("h_jet_pt_in_plane_v2", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v2", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_in_plane_v3", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v3", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("h2_centrality_jet_pt_in_plane_v2", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v2", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_in_plane_v3", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v3", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + //< rho(phi) >// + registry.add("h_jet_pt_inclusive_v2_rho", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_in_plane_v2_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v2_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_in_plane_v3_rho", "jet pT;#it{p}^{in-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + registry.add("h_jet_pt_out_of_plane_v3_rho", "jet pT;#it{p}^{out-of-plane}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); + + registry.add("h2_centrality_jet_pt_in_plane_v2_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v2_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_in_plane_v3_rho", "centrality vs #it{p}^{in-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_pt_out_of_plane_v3_rho", "centrality vs #it{p}^{out-of-plane}_{T,jet}; centrality; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH2F, {{120, -10.0, 110.0}, jetPtAxisRhoAreaSub}}); + + registry.add("h2_centrality_jet_pt_rhoareasubtracted", "centrality vs. jet pT;centrality; #it{p}_{T,jet} (GeV/#it{c}); counts", {HistType::kTH2F, {centralityAxis, jetPtAxisRhoAreaSub}}); + registry.add("h2_centrality_jet_eta_rhoareasubtracted", "centrality vs. jet eta;centrality; #eta; counts", {HistType::kTH2F, {centralityAxis, jetEtaAxis}}); + registry.add("h2_centrality_jet_phi_rhoareasubtracted", "centrality vs. jet phi;centrality; #varphi; counts", {HistType::kTH2F, {centralityAxis, phiAxis}}); + registry.add("h2_jet_pt_jet_area_rhoareasubtracted", "jet #it{p}_{T,jet} vs. Area_{jet}; #it{p}_{T,jet} (GeV/#it{c}); Area_{jet}", {HistType::kTH2F, {jetPtAxis, {150, 0., 1.5}}}); + registry.add("h3_jet_pt_jet_eta_jet_phi_rhoareasubtracted", "jet_pt_eta_phi_rhoareasubtracted", {HistType::kTH3F, {jetPtAxisRhoAreaSub, jetEtaAxis, phiAxis}}); + registry.add("h2_jet_pt_track_pt_rhoareasubtracted", "jet #it{p}_{T,jet} vs. #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, trackPtAxis}}); + } + //< track test >// + registry.add("h_track_pt", "track #it{p}_{T} ; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH1F, {trackPtAxis}}); + registry.add("h2_track_eta_track_phi", "track eta vs. track phi; #eta; #phi; counts", {HistType::kTH2F, {trackEtaAxis, phiAxis}}); //=====================< evt pln plot >=====================// AxisSpec axisCent{cfgAxisCent, "centrality"}; AxisSpec axisQvec{cfgAxisQvec, "Q"}; @@ -334,34 +428,37 @@ struct JetChargedV2 { //=====================< evt pln plot | end >=====================// } - Preslice jetsPerJCollision = o2::aod::jet::collisionId; - Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; - + Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; 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); + PresliceUnsorted> collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; - template - bool isAcceptedJet(U const& jet) + template + bool isAcceptedJet(TJets const& jet, bool mcLevelIsParticleLevel = false) { - double jetAreaFractionMinCfgMin = -98.0; - double jetAreaFractionMinCfgMax = 9998.0; - if (jetAreaFractionMin > jetAreaFractionMinCfgMin) { + double jetAreaFractionMinAcc = -98.0; + double leadingConstituentPtMinAcc = -98.0; + double leadingConstituentPtMaxAcc = 9998.0; + if (jetAreaFractionMin > jetAreaFractionMinAcc) { if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { return false; } } bool checkConstituentPt = true; - bool checkConstituentMinPt = (leadingConstituentPtMin > jetAreaFractionMinCfgMin); - bool checkConstituentMaxPt = (leadingConstituentPtMax < jetAreaFractionMinCfgMax); + bool checkConstituentMinPt = (leadingConstituentPtMin > leadingConstituentPtMinAcc); + bool checkConstituentMaxPt = (leadingConstituentPtMax < leadingConstituentPtMaxAcc); if (!checkConstituentMinPt && !checkConstituentMaxPt) { checkConstituentPt = false; } + if (mcLevelIsParticleLevel && !checkLeadConstituentPtForMcpJets) { + checkConstituentPt = false; + } if (checkConstituentPt) { bool isMinLeadingConstituent = !checkConstituentMinPt; bool isMaxLeadingConstituent = true; - for (const auto& constituent : jet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { double pt = constituent.pt(); if (checkConstituentMinPt && pt >= leadingConstituentPtMin) { @@ -373,51 +470,322 @@ struct JetChargedV2 { } return isMinLeadingConstituent && isMaxLeadingConstituent; } - return true; } - template - bool trackIsInJet(T const& track, U const& jet) + double chiSquareCDF(int nDF, double x) { - for (auto const& constituentId : jet.tracksIds()) { - if (constituentId == track.globalIndex()) { - return true; + return TMath::Gamma(nDF / 2., x / 2.); + } + + // leading jet fill + template + void fillLeadingJetQA(T const& jets, double& leadingJetPt, double& leadingJetPhi, double& leadingJetEta) + { + for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + leadingJetEta = jet.eta(); + leadingJetPhi = jet.phi(); } } - return false; + registry.fill(HIST("leadJetPt"), leadingJetPt); + registry.fill(HIST("leadJetPhi"), leadingJetPhi); + registry.fill(HIST("leadJetEta"), leadingJetEta); } + // create h_ptsum_sumpt_fit, with number of Track template - void fillTrackHistograms(T const& collision, U const& tracks, float weight = 1.0) + void getNtrk(T const& tracks, U const& jets, int& nTrk, double& evtnum, double& leadingJetEta) { - for (auto const& track : tracks) { - if (!(jetderiveddatautilities::selectTrack(track, trackSelection) && jetderiveddatautilities::selectTrackDcaZ(track, trackDcaZmax))) { + if (jets.size() > 0) { + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { + registry.fill(HIST("h_accept_Track"), 4.5); + nTrk += 1; + } + } + registry.fill(HIST("h_evtnum_NTrk"), evtnum, nTrk); + } + } + + // fill nTrk plot for fit rho(varphi) + template + void fillNtrkCheck(T const& collision, U const& tracks, J const& jets, TH1F* hPtsumSumptFit, double& leadingJetEta, double& evtnum) + { + if (jets.size() > 0) { + for (auto const& trackfit : tracks) { + registry.fill(HIST("h_accept_Track"), 0.5); + if (jetderiveddatautilities::selectTrack(trackfit, trackSelection) && (std::fabs(trackfit.eta() - leadingJetEta) > jetRadius) && trackfit.pt() >= localRhoFitPtMin && trackfit.pt() <= localRhoFitPtMax) { + registry.fill(HIST("h_accept_Track"), 1.5); + } + } + + for (auto const& track : tracks) { + registry.fill(HIST("h_accept_Track"), 2.5); + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { + registry.fill(HIST("h_accept_Track"), 3.5); + hPtsumSumptFit->Fill(track.phi(), track.pt()); + registry.fill(HIST("h2_phi_track_eta"), track.eta(), track.phi()); + registry.fill(HIST("h_ptsum_sumpt"), track.phi(), track.pt()); + registry.fill(HIST("h2_centrality_phi_w_pt"), collision.centrality(), track.phi(), track.pt()); + registry.fill(HIST("h2_evtnum_phi_w_pt"), evtnum, track.phi(), track.pt()); + registry.fill(HIST("Thn_evtnum_phi_centrality"), evtnum, track.phi(), collision.centrality()); + } + } + } + } + + // MCP leading jet fill + template + void fillLeadingJetQAMCP(T const& jets, double& leadingJetPt, double& leadingJetPhi, double& leadingJetEta) + { + for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + leadingJetEta = jet.eta(); + leadingJetPhi = jet.phi(); + } + } + registry.fill(HIST("leadJetPtMCP"), leadingJetPt); + registry.fill(HIST("leadJetPhiMCP"), leadingJetPhi); + registry.fill(HIST("leadJetEtaMCP"), leadingJetEta); + } + + template + void fitFncMCP(U const& collision, T const& tracks, J const& jets, TH1F* hPtsumSumptFitMCP, double leadingJetEta, bool mcLevelIsParticleLevel, float weight = 1.0) + { + double ep2 = 0.; + double ep3 = 0.; + int cfgNmodA = 2; + int cfgNmodB = 3; + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + if (nmode == cfgNmodA) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } else if (nmode == cfgNmodB) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } + } + + const char* fitFunctionV2v3P = "[0] * (1. + 2. * ([1] * std::cos(2. * (x - [2])) + [3] * std::cos(3. * (x - [4]))))"; + fFitModulationV2v3P = new TF1("fit_kV3", fitFunctionV2v3P, 0, o2::constants::math::TwoPI); + //=========================< set parameter >=========================// + fFitModulationV2v3P->SetParameter(0, 1.); + fFitModulationV2v3P->SetParameter(1, 0.01); + fFitModulationV2v3P->SetParameter(3, 0.01); + + double ep2fix = 0.; + double ep3fix = 0.; + + if (ep2 < 0) { + ep2fix = RecoDecay::constrainAngle(ep2); + fFitModulationV2v3P->FixParameter(2, ep2fix); + } else { + fFitModulationV2v3P->FixParameter(2, ep2); + } + if (ep3 < 0) { + ep3fix = RecoDecay::constrainAngle(ep3); + fFitModulationV2v3P->FixParameter(4, ep3fix); + } else { + fFitModulationV2v3P->FixParameter(4, ep3); + } + + hPtsumSumptFitMCP->Fit(fFitModulationV2v3P, "Q", "ep", 0, o2::constants::math::TwoPI); + + // int paraNum = 5; + double temppara[5]; + temppara[0] = fFitModulationV2v3P->GetParameter(0); + temppara[1] = fFitModulationV2v3P->GetParameter(1); + temppara[2] = fFitModulationV2v3P->GetParameter(2); + temppara[3] = fFitModulationV2v3P->GetParameter(3); + temppara[4] = fFitModulationV2v3P->GetParameter(4); + if (temppara[0] == 0) { + return; + } + registry.fill(HIST("h_mcp_fitparaRho_evtnum"), evtnum, temppara[0]); + registry.fill(HIST("h_mcp_fitparav2obs_evtnum"), evtnum, temppara[1]); + registry.fill(HIST("h_mcp_fitparaPsi2_evtnum"), evtnum, temppara[2]); + registry.fill(HIST("h_mcp_fitparav3obs_evtnum"), evtnum, temppara[3]); + 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()); + + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; + } + if (jet.r() != round(selectedJetsRadius * 100.0f)) { + continue; + } + + double integralValue = fFitModulationV2v3P->Integral(jet.phi() - jetRadius, jet.phi() + jetRadius); + double rholocal = collision.rho() / (2 * jetRadius * temppara[0]) * integralValue; + registry.fill(HIST("h3_mcp_centrality_localrho_phi"), collision.centrality(), rholocal, jet.phi() - ep2, weight); + + if (nmode == cfgNmodA) { + registry.fill(HIST("h_mcp_jet_pt_rholocal"), jet.pt() - (rholocal * jet.area()), weight); + + double phiMinusPsi2; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + phiMinusPsi2 = jet.phi() - ep2; + + registry.fill(HIST("h2_mcp_phi_rholocal"), jet.phi() - ep2, rholocal, weight); + + 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); + } 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); + } + } else if (nmode == cfgNmodB) { + double phiMinusPsi3; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); + phiMinusPsi3 = jet.phi() - ep3; + + 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); + } 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); + } + } + } + } + // RCpT + for (uint i = 0; i < cfgnMods->size(); i++) { + TRandom3 randomNumber(0); + float randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + float randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); + float randomConePt = 0; + double integralValueRC = fFitModulationV2v3P->Integral(randomConePhi - randomConeR, randomConePhi + randomConeR); + double rholocalRC = collision.rho() / (2 * randomConeR * temppara[0]) * integralValueRC; + + int nmode = cfgnMods->at(i); + if (nmode == cfgNmodA) { + double rcPhiPsi2; + rcPhiPsi2 = randomConePhi - ep2; + + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-o2::constants::math::PI)); + float dEta = track.eta() - randomConeEta; + if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centrality(), 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 + float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-o2::constants::math::PI)); + float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + + bool jetWasInCone = false; + while ((randomConeLeadJetDeltaR <= 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) { + jetWasInCone = true; + randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); + randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); + dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-o2::constants::math::PI)); + dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; + } + if (jetWasInCone) { + randomConePt = 0.0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > randomConeR)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here + float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-o2::constants::math::PI)); + float dEta = track.eta() - randomConeEta; + if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + randomConePt += track.pt(); + } + } + } + } + } + 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); + } else if (nmode == cfgNmodB) { 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_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); } } - void fillLeadingJetQA(double leadingJetPt, double leadingJetPhi, double leadingJetEta) + template + void fillJetAreaSubHistograms(TJets const& jet, float centrality, float rho, float weight = 1.0) { - registry.fill(HIST("leadJetPt"), leadingJetPt); - registry.fill(HIST("leadJetPhi"), leadingJetPhi); - registry.fill(HIST("leadJetEta"), leadingJetEta); + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { + return; + } + double jetcorrpt = jet.pt() - (rho * jet.area()); + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + // fill jet histograms after area-based subtraction + registry.fill(HIST("h2_centrality_jet_pt_rhoareasubtracted"), centrality, jetcorrpt, weight); + registry.fill(HIST("h3_jet_pt_jet_eta_jet_phi_rhoareasubtracted"), jetcorrpt, jet.eta(), jet.phi(), weight); + if (jetcorrpt > 0) { + registry.fill(HIST("h2_centrality_jet_eta_rhoareasubtracted"), centrality, jet.eta(), weight); + registry.fill(HIST("h2_centrality_jet_phi_rhoareasubtracted"), centrality, jet.phi(), weight); + registry.fill(HIST("h2_jet_pt_jet_area_rhoareasubtracted"), jetcorrpt, jet.area(), weight); + } + } + + for (const auto& constituent : jet.template tracks_as()) { + registry.fill(HIST("h2_jet_pt_track_pt_rhoareasubtracted"), jetcorrpt, constituent.pt(), weight); + } } - double chiSquareCDF(int nDF, double x) + template + void fillMCPAreaSubHistograms(TJets const& jet, float rho = 0.0, float weight = 1.0) { - return TMath::Gamma(nDF / 2., x / 2.); + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { + return; + } + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + // fill mcp jet histograms + double jetcorrpt = jet.pt() - (rho * jet.area()); + registry.fill(HIST("h3_jet_pt_jet_eta_jet_phi_part_rhoareasubtracted"), jetcorrpt, jet.eta(), jet.phi(), weight); + if (jetcorrpt > 0) { + registry.fill(HIST("h_jet_eta_part_rhoareasubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_part_rhoareasubtracted"), jet.phi(), weight); + registry.fill(HIST("h2_jet_pt_part_jet_area_part_rhoareasubtracted"), jetcorrpt, jet.area(), weight); + } + } + } + + template + void fillTrackHistograms(TTracks const& track, float weight = 1.0) + { + registry.fill(HIST("h_track_pt"), track.pt(), weight); + registry.fill(HIST("h2_track_eta_track_phi"), track.eta(), track.phi(), weight); } + //=======================================[ process area ]=============================================// void processInOutJetV2(soa::Filtered>::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) @@ -430,18 +798,18 @@ struct JetChargedV2 { } //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// histosQA.fill(HIST("histCent"), collision.cent()); + + //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// + int cfgNmodA = 2; + int cfgNmodB = 3; for (uint i = 0; i < cfgnMods->size(); i++) { int nmode = cfgnMods->at(i); int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); int refAInd = refAId * 4 + cfgnTotalSystem * 4 * (nmode - 2); int refBInd = refBId * 4 + cfgnTotalSystem * 4 * (nmode - 2); - int cfgNmodA = 2; - int cfgNmodB = 3; - int evtPlnAngleA = 7; - int evtPlnAngleB = 3; - int evtPlnAngleC = 5; + if (nmode == cfgNmodA) { - if (collision.qvecAmp()[detId] > 1e-8 || collision.qvecAmp()[refAId] < 1e-8 || collision.qvecAmp()[refBId] < 1e-8) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId || collision.qvecAmp()[refAId] < collQvecAmpDetId || collision.qvecAmp()[refBId] < collQvecAmpDetId) { histosQA.fill(HIST("histQvecUncorV2"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.cent()); histosQA.fill(HIST("histQvecRectrV2"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.cent()); histosQA.fill(HIST("histQvecTwistV2"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.cent()); @@ -471,10 +839,18 @@ struct JetChargedV2 { histosQA.fill(HIST("histEvtPlRes_SigRefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); histosQA.fill(HIST("histEvtPlRes_RefARefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); } + } + + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); if (nmode == cfgNmodA) { double phiMinusPsi2; - if (collision.qvecAmp()[detId] < 1e-8) { + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { continue; } float ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); @@ -489,7 +865,6 @@ struct JetChargedV2 { continue; } registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (collision.rho() * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_rhoareasubtracted"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); 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)) { @@ -526,7 +901,123 @@ struct JetChargedV2 { } } } - PROCESS_SWITCH(JetChargedV2, processInOutJetV2, "Jet V2 in and out of plane", true); + PROCESS_SWITCH(JetChargedV2, processInOutJetV2, "Jet V2 in and out of plane", false); + + void processInOutJetV2MCD(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// + histosQA.fill(HIST("histCent"), collision.cent()); + //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// + int cfgNmodA = 2; + int cfgNmodB = 3; + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + int refAInd = refAId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + int refBInd = refBId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + if (nmode == cfgNmodA) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId || collision.qvecAmp()[refAId] < collQvecAmpDetId || collision.qvecAmp()[refBId] < collQvecAmpDetId) { + histosQA.fill(HIST("histQvecUncorV2"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.cent()); + histosQA.fill(HIST("histQvecRectrV2"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.cent()); + histosQA.fill(HIST("histQvecTwistV2"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.cent()); + histosQA.fill(HIST("histQvecFinalV2"), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], collision.cent()); + + histosQA.fill(HIST("histEvtPlUncorV2"), helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRectrV2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlTwistV2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), collision.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); + } + } else if (nmode == cfgNmodB) { + histosQA.fill(HIST("histQvecUncorV3"), collision.qvecRe()[detInd], collision.qvecIm()[detInd], collision.cent()); + histosQA.fill(HIST("histQvecRectrV3"), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], collision.cent()); + histosQA.fill(HIST("histQvecTwistV3"), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], collision.cent()); + histosQA.fill(HIST("histQvecFinalV3"), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], collision.cent()); + + histosQA.fill(HIST("histEvtPlUncorV3"), helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRectrV3"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlTwistV3"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2], nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlFinalV3"), helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), collision.cent()); + + histosQA.fill(HIST("histEvtPlRes_SigRefAV3"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRes_SigRefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); + histosQA.fill(HIST("histEvtPlRes_RefARefBV3"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecRe()[refAInd + 3], collision.qvecIm()[refAInd + 3], nmode), helperEP.GetEventPlane(collision.qvecRe()[refBInd + 3], collision.qvecIm()[refBInd + 3], nmode), nmode), collision.cent()); + } + } + + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + if (nmode == cfgNmodA) { + double phiMinusPsi2; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + float ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + if (jet.r() != round(selectedJetsRadius * 100.0f)) { + continue; + } + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (collision.rho() * jet.area()), 1.0); + + 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); + } 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); + } + } + } else if (nmode == cfgNmodB) { + double phiMinusPsi3; + float ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + if (jet.r() != round(selectedJetsRadius * 100.0f)) { + continue; + } + phiMinusPsi3 = jet.phi() - ep3; + + 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_jet_pt_in_plane_v3"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v3"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } else { + registry.fill(HIST("h_jet_pt_out_of_plane_v3"), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v3"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + } + } + } + } + } + PROCESS_SWITCH(JetChargedV2, processInOutJetV2MCD, "Jet V2 in and out of plane MCD", false); void processSigmaPt(soa::Filtered>::iterator const& collision, soa::Join const& jets, @@ -541,60 +1032,21 @@ struct JetChargedV2 { return; } registry.fill(HIST("h_collisions"), 2.5); + double leadingJetPt = -1; double leadingJetPhi = -1; double leadingJetEta = -1; - for (const auto& jet : jets) { - if (jet.pt() > leadingJetPt) { - leadingJetPt = jet.pt(); - leadingJetEta = jet.eta(); - leadingJetPhi = jet.phi(); - } - } - fillLeadingJetQA(leadingJetPt, leadingJetPhi, leadingJetEta); + fillLeadingJetQA(jets, leadingJetPt, leadingJetPhi, leadingJetEta); int nTrk = 0; - if (jets.size() > 0) { - for (auto const& track : tracks) { - if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { - registry.fill(HIST("h_accept_Track"), 2.5); - nTrk += 1; - } - } - registry.fill(HIST("h_evtnum_NTrk"), evtnum, nTrk); - } - + getNtrk(tracks, jets, nTrk, evtnum, leadingJetEta); if (nTrk <= 0) { - return; - } - - hPtsumSumptFit = new TH1F("h_ptsum_sumpt_fit", "h_ptsum_sumpt fit use", TMath::CeilNint(std::sqrt(nTrk)), 0., o2::constants::math::TwoPI); - - if (jets.size() > 0) { - for (auto const& trackfit : tracks) { - registry.fill(HIST("h_accept_Track"), 0.5); - if (jetderiveddatautilities::selectTrack(trackfit, trackSelection) && (std::fabs(trackfit.eta() - leadingJetEta) > jetRadius) && trackfit.pt() >= localRhoFitPtMin && trackfit.pt() <= localRhoFitPtMax) { - registry.fill(HIST("h_accept_Track_Fit"), 0.5); - fitTrack += 1; - } - } - - for (auto const& track : tracks) { - registry.fill(HIST("h_accept_Track"), 1.5); - if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { - accptTrack += 1; - registry.fill(HIST("h_accept_Track"), 2.5); - hPtsumSumptFit->Fill(track.phi(), track.pt()); - registry.fill(HIST("h2_phi_track_eta"), track.eta(), track.phi()); - registry.fill(HIST("h_ptsum_sumpt"), track.phi(), track.pt()); - registry.fill(HIST("h2_centrality_phi_w_pt"), collision.centrality(), track.phi(), track.pt()); - registry.fill(HIST("h2_evtnum_phi_w_pt"), evtnum, track.phi(), track.pt()); - registry.fill(HIST("Thn_evtnum_phi_centrality"), evtnum, track.phi(), collision.centrality()); - registry.fill(HIST("h_accept_Track_init"), accptTrack); - registry.fill(HIST("h_accept_Track_Fit"), 1.5); - } - } + return; } + hPtsumSumptFit = new TH1F("h_ptsum_sumpt_fit", "h_ptsum_sumpt fit use", TMath::CeilNint(std::sqrt(nTrk)), 0., o2::constants::math::TwoPI); + + fillNtrkCheck(collision, tracks, jets, hPtsumSumptFit, leadingJetEta, evtnum); + registry.fill(HIST("h_ptsum_collnum"), 0.5); double ep2 = 0.; @@ -608,17 +1060,16 @@ struct JetChargedV2 { int nmode = cfgnMods->at(i); int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); if (nmode == cfgNmodA) { - if (collision.qvecAmp()[detId] > 1e-8) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); } } else if (nmode == cfgNmodB) { - if (collision.qvecAmp()[detId] > 1e-8) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); } } } - TF1* fFitModulationV2v3 = 0x0; const char* fitFunctionV2v3 = "[0] * (1. + 2. * ([1] * std::cos(2. * (x - [2])) + [3] * std::cos(3. * (x - [4]))))"; fFitModulationV2v3 = new TF1("fit_kV3", fitFunctionV2v3, 0, o2::constants::math::TwoPI); //=========================< set parameter >=========================// @@ -700,6 +1151,7 @@ struct JetChargedV2 { int evtMidAreaMax = 50; if (evtcent >= evtCentAreaMin && evtcent <= evtCentAreaMax) { registry.fill(HIST("h2_PChi2_CombinFitA"), cDF, chiSqr / (static_cast(nDF))); + } else if (evtcent >= evtMidAreaMin && evtcent <= evtMidAreaMax) { registry.fill(HIST("h2_PChi2_CombinFitB"), cDF, chiSqr / (static_cast(nDF))); } @@ -730,7 +1182,7 @@ struct JetChargedV2 { registry.fill(HIST("h_jet_pt_rholocal"), jet.pt() - (rholocal * jet.area()), 1.0); double phiMinusPsi2; - if (collision.qvecAmp()[detId] < 1e-8) { + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { continue; } phiMinusPsi2 = jet.phi() - ep2; @@ -747,7 +1199,7 @@ struct JetChargedV2 { } } else if (nmode == cfgNmodB) { double phiMinusPsi3; - if (collision.qvecAmp()[detId] < 1e-8) { + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { continue; } ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); @@ -821,35 +1273,229 @@ struct JetChargedV2 { } } delete hPtsumSumptFit; + delete fFitModulationV2v3; evtnum += 1; } - PROCESS_SWITCH(JetChargedV2, processSigmaPt, "Sigma pT and bkg as fcn of phi", true); + PROCESS_SWITCH(JetChargedV2, processSigmaPt, "Sigma pT and bkg as fcn of phi", false); - void processRandomConeDataV2(soa::Filtered>::iterator const& collision, - soa::Join const& jets, - soa::Filtered const& tracks) + void processSigmaPtMCD(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const& tracks) { + registry.fill(HIST("h_collisions"), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + return; + } + registry.fill(HIST("h_collisions"), 1.5); if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + registry.fill(HIST("h_collisions"), 2.5); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + fillJetAreaSubHistograms(jet, collision.centrality(), collision.rho()); + } + + double leadingJetPt = -1; + double leadingJetPhi = -1; + double leadingJetEta = -1; + fillLeadingJetQA(jets, leadingJetPt, leadingJetPhi, leadingJetEta); + + int nTrk = 0; + getNtrk(tracks, jets, nTrk, evtnum, leadingJetEta); + if (nTrk <= 0) { + return; + } + hPtsumSumptFit = new TH1F("h_ptsum_sumpt_fit", "h_ptsum_sumpt fit use", TMath::CeilNint(std::sqrt(nTrk)), 0., o2::constants::math::TwoPI); + + fillNtrkCheck(collision, tracks, jets, hPtsumSumptFit, leadingJetEta, evtnum); + + registry.fill(HIST("h_ptsum_collnum"), 0.5); + + double ep2 = 0.; + double ep3 = 0.; + int cfgNmodA = 2; + int cfgNmodB = 3; + int evtPlnAngleA = 7; + int evtPlnAngleB = 3; + int evtPlnAngleC = 5; + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + if (nmode == cfgNmodA) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep2 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } else if (nmode == cfgNmodB) { + if (collision.qvecAmp()[detId] > collQvecAmpDetId) { + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3], nmode); + } + } + } + + const char* fitFunctionV2v3 = "[0] * (1. + 2. * ([1] * std::cos(2. * (x - [2])) + [3] * std::cos(3. * (x - [4]))))"; + fFitModulationV2v3 = new TF1("fit_kV3", fitFunctionV2v3, 0, o2::constants::math::TwoPI); + //=========================< set parameter >=========================// + fFitModulationV2v3->SetParameter(0, 1.); + fFitModulationV2v3->SetParameter(1, 0.01); + fFitModulationV2v3->SetParameter(3, 0.01); + + double ep2fix = 0.; + double ep3fix = 0.; + + if (ep2 < 0) { + ep2fix = RecoDecay::constrainAngle(ep2); + fFitModulationV2v3->FixParameter(2, ep2fix); + } else { + fFitModulationV2v3->FixParameter(2, ep2); + } + if (ep3 < 0) { + ep3fix = RecoDecay::constrainAngle(ep3); + fFitModulationV2v3->FixParameter(4, ep3fix); + } else { + fFitModulationV2v3->FixParameter(4, ep3); + } + + hPtsumSumptFit->Fit(fFitModulationV2v3, "Q", "ep", 0, o2::constants::math::TwoPI); + + double temppara[5]; + temppara[0] = fFitModulationV2v3->GetParameter(0); + temppara[1] = fFitModulationV2v3->GetParameter(1); + temppara[2] = fFitModulationV2v3->GetParameter(2); + temppara[3] = fFitModulationV2v3->GetParameter(3); + temppara[4] = fFitModulationV2v3->GetParameter(4); + int paraNum = 5; + for (int i = 1; i <= paraNum; i++) { + registry.fill(HIST("h2_evt_fitpara"), evtnum, i - 0.5, temppara[i - 1]); + } + + registry.fill(HIST("h_fitparaRho_evtnum"), evtnum, temppara[0]); + registry.fill(HIST("h_fitparav2obs_evtnum"), evtnum, temppara[1]); + registry.fill(HIST("h_fitparaPsi2_evtnum"), evtnum, temppara[2]); + registry.fill(HIST("h_fitparav3obs_evtnum"), evtnum, temppara[3]); + 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()); + + if (temppara[0] == 0) { return; } + registry.fill(HIST("h2_fitParaZero_cent"), collision.centrality(), temppara[0], 1.0); + + int nDF = 1; + int numOfFreePara = 2; + nDF = static_cast(fFitModulationV2v3->GetXaxis()->GetNbins()) - numOfFreePara; + if (nDF == 0 || static_cast(nDF) <= 0.) + return; + double chi2 = 0.; + for (int i = 0; i < hPtsumSumptFit->GetXaxis()->GetNbins(); i++) { + if (hPtsumSumptFit->GetBinContent(i + 1) <= 0.) + continue; + chi2 += std::pow((hPtsumSumptFit->GetBinContent(i + 1) - fFitModulationV2v3->Eval(hPtsumSumptFit->GetXaxis()->GetBinCenter(1 + i))), 2) / hPtsumSumptFit->GetBinContent(i + 1); + } + + double chiSqr = 999.; + double cDF = 1.; + + chiSqr = chi2; + cDF = 1. - chiSquareCDF(nDF, chiSqr); + + 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_PChi2_CombinFit"), cDF, chiSqr / (static_cast(nDF))); + registry.fill(HIST("Thn_PChi2_CombinFitCent"), collision.centrality(), cDF, chiSqr / (static_cast(nDF))); + double evtcent = collision.centrality(); + int evtCentAreaMin = 0; + int evtCentAreaMax = 5; + int evtMidAreaMin = 30; + int evtMidAreaMax = 50; + if (evtcent >= evtCentAreaMin && evtcent <= evtCentAreaMax) { + registry.fill(HIST("h2_PChi2_CombinFitA"), cDF, chiSqr / (static_cast(nDF))); + + } else if (evtcent >= evtMidAreaMin && evtcent <= evtMidAreaMax) { + registry.fill(HIST("h2_PChi2_CombinFitB"), cDF, chiSqr / (static_cast(nDF))); + } + for (uint i = 0; i < cfgnMods->size(); i++) { + int nmode = cfgnMods->at(i); + int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + if (jet.r() != round(selectedJetsRadius * 100.0f)) { + continue; + } + + double integralValue = fFitModulationV2v3->Integral(jet.phi() - jetRadius, jet.phi() + jetRadius); + double rholocal = collision.rho() / (2 * jetRadius * temppara[0]) * integralValue; + registry.fill(HIST("h2_phi_rhophi"), jet.phi() - ep2, fFitModulationV2v3->Eval(jet.phi()), 1.0); + registry.fill(HIST("h3_centrality_rhovsphi_phi"), collision.centrality(), fFitModulationV2v3->Eval(jet.phi()), jet.phi() - ep2); + + registry.fill(HIST("h2_phi_rholocal_cent"), collision.centrality(), rholocal, 1.0); + registry.fill(HIST("h3_centrality_localrho_phi"), collision.centrality(), rholocal, jet.phi() - ep2); + + if (nmode == cfgNmodA) { + registry.fill(HIST("h_jet_pt_rholocal"), jet.pt() - (rholocal * jet.area()), 1.0); + + double phiMinusPsi2; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + phiMinusPsi2 = jet.phi() - ep2; + + registry.fill(HIST("h2_phi_rholocal"), jet.phi() - ep2, rholocal, 1.0); + registry.fill(HIST("h_jet_pt_inclusive_v2_rho"), jet.pt() - (rholocal * jet.area()), 1.0); + + 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); + } 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); + } + } else if (nmode == cfgNmodB) { + double phiMinusPsi3; + if (collision.qvecAmp()[detId] < collQvecAmpDetId) { + continue; + } + ep3 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); + phiMinusPsi3 = jet.phi() - ep3; + 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_jet_pt_in_plane_v3_rho"), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v3_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + } else { + registry.fill(HIST("h_jet_pt_out_of_plane_v3_rho"), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v3_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + } + } + } + } + // RCpT for (uint i = 0; i < cfgnMods->size(); i++) { TRandom3 randomNumber(0); float randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); float randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); float randomConePt = 0; + double integralValueRC = fFitModulationV2v3->Integral(randomConePhi - randomConeR, randomConePhi + randomConeR); + double rholocalRC = collision.rho() / (2 * randomConeR * temppara[0]) * integralValueRC; int nmode = cfgnMods->at(i); - int detInd = detId * 4 + cfgnTotalSystem * 4 * (nmode - 2); - int cfgNmodA = 2; - int cfgNmodB = 3; if (nmode == cfgNmodA) { double rcPhiPsi2; - float evtPl2 = helperEP.GetEventPlane(collision.qvecRe()[detInd], collision.qvecIm()[detInd], nmode); - rcPhiPsi2 = randomConePhi - evtPl2; + rcPhiPsi2 = randomConePhi - ep2; for (auto const& track : tracks) { if (jetderiveddatautilities::selectTrack(track, trackSelection)) { @@ -860,13 +1506,15 @@ struct JetChargedV2 { } } } + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centrality(), 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 float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast(-o2::constants::math::PI)); float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta; bool jetWasInCone = false; - while (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR) { + while ((randomConeLeadJetDeltaR <= 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) { jetWasInCone = true; randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR); randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI); @@ -876,7 +1524,7 @@ struct JetChargedV2 { if (jetWasInCone) { randomConePt = 0.0; for (auto const& track : tracks) { - if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > randomConeR)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast(-o2::constants::math::PI)); float dEta = track.eta() - randomConeEta; if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { @@ -886,30 +1534,151 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h2_centrality_deltapT_RandomCornPhi_RCprocess_rhorandomconewithoutleadingjet"), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, 1.0); + 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); } else if (nmode == cfgNmodB) { continue; } } + delete hPtsumSumptFit; + delete fFitModulationV2v3; + evtnum += 1; + } + PROCESS_SWITCH(JetChargedV2, processSigmaPtMCD, "jet spectra with rho-area subtraction for MCD", false); + + void processSigmaPtMCP(McParticleCollision::iterator const& mccollision, + soa::SmallGroups> const& collisions, + soa::Join const& jets, + aod::JetTracks const& tracks, + aod::JetParticles const&) + { + bool mcLevelIsParticleLevel = true; + int acceptSplitCollInMCP = 2; + + registry.fill(HIST("h_mcColl_counts_areasub"), 0.5); + if (std::abs(mccollision.posZ()) > vertexZCut) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 1.5); + if (collisions.size() < 1) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 2.5); + if (acceptSplitCollisions == 0 && collisions.size() > 1) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 3.5); + + bool hasSel8Coll = false; + bool centralityIsGood = false; + bool occupancyIsGood = false; + if (acceptSplitCollisions == acceptSplitCollInMCP) { + if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax)) { + centralityIsGood = true; + } + if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + } else { + for (auto const& collision : collisions) { + if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax)) { + centralityIsGood = true; + } + if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + } + } + if (!hasSel8Coll) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 4.5); + + if (!centralityIsGood) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 5.5); + + if (!occupancyIsGood) { + return; + } + registry.fill(HIST("h_mcColl_counts_areasub"), 6.5); + registry.fill(HIST("h_mcColl_rho"), mccollision.rho()); + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; + } + fillMCPAreaSubHistograms(jet, mccollision.rho()); + } + + for (auto const& collision : collisions) { + auto collTracks = tracks.sliceBy(tracksPerJCollision, collision.globalIndex()); + + double leadingJetPt = -1; + double leadingJetPhi = -1; + double leadingJetEta = -1; + fillLeadingJetQAMCP(jets, leadingJetPt, leadingJetPhi, leadingJetEta); + + int nTrk = 0; + if (jets.size() > 0) { + for (auto const& track : collTracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { + registry.fill(HIST("h_accept_Track"), 5.5); + nTrk += 1; + } + } + registry.fill(HIST("h_mcp_evtnum_NTrk"), evtnum, nTrk); + } + if (nTrk <= 0) { + return; + } + hPtsumSumptFitMCP = new TH1F("h_ptsum_sumpt_fit", "h_ptsum_sumpt fit use", TMath::CeilNint(std::sqrt(nTrk)), 0., o2::constants::math::TwoPI); + + if (jets.size() > 0) { + for (auto const& track : collTracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > jetRadius) && track.pt() >= localRhoFitPtMin && track.pt() <= localRhoFitPtMax) { + hPtsumSumptFitMCP->Fill(track.phi(), track.pt()); + registry.fill(HIST("h2_mcp_phi_track_eta"), track.eta(), track.phi()); + registry.fill(HIST("h_mcp_ptsum_sumpt"), track.phi(), track.pt()); + } + } + } + + registry.fill(HIST("h_ptsum_collnum"), 0.5); + fitFncMCP(collision, tracks, jets, hPtsumSumptFitMCP, leadingJetEta, mcLevelIsParticleLevel); + } + + delete hPtsumSumptFitMCP; + delete fFitModulationV2v3P; + evtnum += 1; } - PROCESS_SWITCH(JetChargedV2, processRandomConeDataV2, "QA for random cone estimation of background fluctuations in data", true); + PROCESS_SWITCH(JetChargedV2, processSigmaPtMCP, "jet spectra with area-based subtraction for MC particle level", false); void processTracksQA(soa::Filtered>::iterator const& collision, soa::Filtered> const& tracks) { - registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 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); 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); - fillTrackHistograms(collision, tracks); + for (auto const& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + fillTrackHistograms(track); + } } PROCESS_SWITCH(JetChargedV2, processTracksQA, "QA for charged tracks", false); }; From f7dace12a5489ea4e724f6cfc0393168cf53e9bf Mon Sep 17 00:00:00 2001 From: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Date: Fri, 13 Jun 2025 18:58:37 +0530 Subject: [PATCH 064/116] [PWGHF] Add configurable for mixed event pair in correlatorHfeHadrons (#11591) Co-authored-by: Rashi Gupta --- PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx | 5 +++-- .../TableProducer/electronSelectionWithTpcEmcal.cxx | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index 25b5d476269..277111d8817 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -54,6 +54,7 @@ struct HfCorrelatorHfeHadrons { Configurable zPvPosMax{"zPvPosMax", 10., "Maximum z of the primary vertex (cm)"}; Configurable isRun3{"isRun3", true, "Data is from Run3 or Run2"}; + Configurable numberEventsMixed{"numberEventsMixed", 5, "number of events mixed in ME process"}; // Associated Hadron selection Configurable ptTrackMin{"ptTrackMin", 0.1f, "Transverse momentum range for associated hadron tracks"}; Configurable etaTrackMax{"etaTrackMax", 0.8f, "Eta range for associated hadron tracks"}; @@ -377,7 +378,7 @@ struct HfCorrelatorHfeHadrons { void processDataMixedEvent(TableCollisions const& collision, aod::HfCorrSelEl const& electron, TableTracks const& tracks) { auto tracksTuple = std::make_tuple(electron, tracks); - Pair pair{corrBinning, 5, -1, collision, tracksTuple, &cache}; + Pair pair{corrBinning, numberEventsMixed, -1, collision, tracksTuple, &cache}; // loop over the rows of the new table for (const auto& [c1, tracks1, c2, tracks2] : pair) { @@ -392,7 +393,7 @@ struct HfCorrelatorHfeHadrons { void processMcRecMixedEvent(McTableCollisions const& mccollision, aod::HfCorrSelEl const& electron, McTableTracks const& mcTracks) { auto tracksTuple = std::make_tuple(electron, mcTracks); - Pair pairMcRec{corrBinning, 5, -1, mccollision, tracksTuple, &cache}; + Pair pairMcRec{corrBinning, numberEventsMixed, -1, mccollision, tracksTuple, &cache}; // loop over the rows of the new table for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index ae8be97b6b9..24ebae0ea8a 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -202,8 +202,9 @@ struct HfElectronSelectionWithTpcEmcal { registry.add("hAfterPIDEtaPhi", "PID Info after PID Cuts Eta vs Phi ; #eta; #varphi; ", {HistType::kTH2F, {{axisEta}, {axisPhi}}}); registry.add("hEPRatioAfterPID", "E/P Ratio after PID Cuts apply only trackwodca filter", {HistType::kTH2F, {{axisPt}, {axisEmcEnergy}}}); - registry.add("hPIDAfterPIDCuts", "PID Info after PID cuts; E/P;#it{p}_{T} (GeV#it{/c});n#sigma;m02; m20;", {HistType::kTHnSparseF, {{binsEoP}, {binsPt}, {binsnSigma}, {binsM02}, {binsM20}}}); - registry.add("hEmcClsTrkEtaPhiDiffTime", "EmcClsTrkEtaPhiDiffTime;#Delta#eta;#Delta#varphi;Sec;", {HistType::kTH3F, {{binsDeltaEta}, {binsDeltaPhi}, {binsEmcClsTime}}}); + + registry.add("hPIDAfterPIDCuts", "PID Info after PID cuts; E/P;#it{p}_{T} (GeV#it{/c});n#sigma;m02; m20;", {HistType::kTHnSparseF, {{axisEoP}, {axisPt}, {axisnSigma}, {axisM02}, {axisM20}}}); + registry.add("hEmcClsTrkEtaPhiDiffTime", "EmcClsTrkEtaPhiDiffTime;#Delta#eta;#Delta#varphi;Sec;", {HistType::kTH3F, {{axisDeltaEta}, {axisDeltaPhi}, {axisEmcClsTime}}}); } // Track Selection Cut template @@ -365,6 +366,11 @@ struct HfElectronSelectionWithTpcEmcal { return; registry.fill(HIST("hNevents"), 1); + + // skip events with no clusters + if (emcClusters.size() == 0) { + return; + } registry.fill(HIST("hZvertex"), collision.posZ()); ///////////////////////////////// From ff7830b63c62a4045a82e9af5e1bc5480cbb3e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 13 Jun 2025 15:39:21 +0200 Subject: [PATCH 065/116] [PWGLF] Include What You Use (#11551) --- PWGLF/DataModel/LFStrangenessTables.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index ce2e9e65eda..3ee36c7c54a 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -8,22 +8,29 @@ // 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_LFSTRANGENESSTABLES_H_ #define PWGLF_DATAMODEL_LFSTRANGENESSTABLES_H_ -#include -#include -#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/SPCalibrationTables.h" +#include "PWGUD/DataModel/UDTables.h" + #include "Common/Core/RecoDecay.h" -#include "CommonConstants/PhysicsConstants.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/McCollisionExtra.h" // IWYU pragma: keep (FIXME: not used, remove asap) #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/Qvectors.h" -#include "Common/DataModel/McCollisionExtra.h" -#include "PWGLF/DataModel/EPCalibrationTables.h" -#include "PWGLF/DataModel/SPCalibrationTables.h" -#include "PWGUD/DataModel/UDTables.h" + +#include +#include +#include + +#include +#include +#include +#include namespace o2::aod { From 84277d3cd950e58cd0184339e60c336e153b7fab Mon Sep 17 00:00:00 2001 From: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Date: Fri, 13 Jun 2025 16:01:07 +0200 Subject: [PATCH 066/116] [Common,PWGHF] Add reduced workflow for B+, B0s -> J/Psi X analyses (#11368) Co-authored-by: ALICE Action Bot --- Common/Core/RecoDecay.h | 14 + PWGHF/Core/DecayChannels.h | 24 + PWGHF/Core/HfHelper.h | 250 +++- PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h | 179 +++ PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h | 201 +++ PWGHF/Core/SelectorCuts.h | 159 +++ PWGHF/D2H/DataModel/ReducedDataModel.h | 288 ++++- PWGHF/D2H/TableProducer/CMakeLists.txt | 10 + .../candidateCreatorB0Reduced.cxx | 22 +- .../candidateCreatorBToJpsiReduced.cxx | 482 +++++++ .../candidateCreatorBplusReduced.cxx | 20 +- .../candidateCreatorBsReduced.cxx | 20 +- .../dataCreatorCharmHadPiReduced.cxx | 65 +- .../dataCreatorJpsiHadReduced.cxx | 1120 +++++++++++++++++ PWGHF/D2H/Tasks/CMakeLists.txt | 10 + PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx | 535 ++++++++ PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx | 582 +++++++++ PWGHF/D2H/Utils/utilsRedDataFormat.h | 35 +- .../DataModel/CandidateReconstructionTables.h | 226 +++- PWGHF/DataModel/CandidateSelectionTables.h | 14 +- PWGHF/Utils/utilsTrkCandHf.h | 27 +- 21 files changed, 4141 insertions(+), 142 deletions(-) create mode 100644 PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h create mode 100644 PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h create mode 100644 PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx create mode 100644 PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx create mode 100644 PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx create mode 100644 PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx diff --git a/Common/Core/RecoDecay.h b/Common/Core/RecoDecay.h index 2bdf3b82b60..7716a8d64a0 100644 --- a/Common/Core/RecoDecay.h +++ b/Common/Core/RecoDecay.h @@ -22,6 +22,7 @@ #include // std::array #include // std::abs, std::sqrt #include +#include // std::apply #include // std::move #include // std::vector @@ -285,6 +286,19 @@ struct RecoDecay { return static_cast(length) * static_cast(mass) / p(mom); } + /// Calculates proper lifetime times c (pseudoproper decay length) in XY from information on daughter tracks. + /// \param posPV {x, y, z} or {x, y} position of the primary vertex + /// \param posSV {x, y, z} or {x, y} position of the secondary vertex + /// \param mom array of {x, y, z} or {x, y} momentum arrays of the decay products + /// \param mass mass of the decay products + /// \return pseudoproper decay length + template + static double ctXY(const T& posPV, const U& posSV, const std::array, N>& mom, const std::array mass) + { + // c t_xy = l_xy * m c^2 / (pT c) + return distanceXY(posPV, posSV) * m(mom, mass) / std::apply([](const auto&... args) { return pt(args...); }, mom); + } + /// Calculates cosine of θ* (theta star). /// \note Implemented for 2 prongs only. /// \param arrMom array of two 3-momentum arrays diff --git a/PWGHF/Core/DecayChannels.h b/PWGHF/Core/DecayChannels.h index f56e8ce1005..44fefb4eeff 100644 --- a/PWGHF/Core/DecayChannels.h +++ b/PWGHF/Core/DecayChannels.h @@ -174,6 +174,30 @@ enum DecayChannelResonant : int8_t { // LastChannelResonant }; +/// @brief beauty candidates: beauty to J/ψ decay channels +enum DecayChannelToJpsiMain : int8_t { + // B0 + B0ToJpsiPiK = 1, // J/ψ π- K+ + // Bs0 + BsToJpsiKK, // J/ψ K+ K- + // Λb0 + LbToJpsiPK, // J/ψ p K- + // B+ + BplusToJpsiK, // J/ψ K+ + // Bc+ + BcToJpsiPi, // J/ψ π+ + // + LastChannelToJpsiMain +}; +/// @brief beauty candidates: beauty to J/ψ resonant decay channels +enum DecayChannelToJpsiResonant : int8_t { + // B0 + B0ToJpsiKstar0 = 1, // J/ψ K*0(892) + // Bs0 + BsToJpsiPhi, // J/ψ φ + // + LastChannelToJpsiResonant +}; } // namespace hf_cand_beauty } // namespace o2::hf_decay diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 3f991854956..5c613a4b69a 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -17,21 +17,21 @@ #ifndef PWGHF_CORE_HFHELPER_H_ #define PWGHF_CORE_HFHELPER_H_ -#include -#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include "PWGHF/Utils/utilsAnalysis.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelectorPID.h" #include #include +#include +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) + #include #include #include -#include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelectorPID.h" - -#include "PWGHF/Utils/utilsAnalysis.h" - class HfHelper { public: @@ -173,6 +173,12 @@ class HfHelper return candidate.m(std::array{o2::constants::physics::MassD0, o2::constants::physics::MassPiPlus}); } + template + auto invMassBplusToJpsiK(const T& candidate) + { + return candidate.m(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}); + } + template auto cosThetaStarBplus(const T& candidate) { @@ -659,6 +665,12 @@ class HfHelper return candidate.m(std::array{o2::constants::physics::MassDSBar, o2::constants::physics::MassPiPlus}); } + template + auto invMassBsToJpsiPhi(const T& candidate) + { + return candidate.m(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); + } + template auto cosThetaStarBs(const T& candidate) { @@ -784,8 +796,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of B0 candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B0 candidate passes all selections - template - bool selectionB0ToDPiPid(const T1& pidTrackPi, const T2& acceptPIDNotApplicable) + bool selectionB0ToDPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -805,10 +816,10 @@ class HfHelper template bool selectionBplusToD0PiTopol(const T1& candBp, const T2& cuts, const T3& binsPt) { - auto ptcandBp = candBp.pt(); + auto ptCandBp = candBp.pt(); auto ptPi = RecoDecay::pt(candBp.pxProng1(), candBp.pyProng1()); - int pTBin = o2::analysis::findBin(binsPt, ptcandBp); + int pTBin = o2::analysis::findBin(binsPt, ptCandBp); if (pTBin == -1) { return false; } @@ -860,8 +871,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of B+ candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of B+ candidate passes all selections - template - bool selectionBplusToD0PiPid(const T1& pidTrackPi, const T2& acceptPIDNotApplicable) + bool selectionBplusToD0PiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -873,6 +883,105 @@ class HfHelper return true; } + // Apply topological cuts as defined in SelectorCuts.h + /// \param candBp B+ candidate + /// \param cuts B+ candidate selection per pT bin + /// \param binsPt pT bin limits + /// \return true if candidate passes all selections + template + bool selectionBplusToJpsiKTopol(const T1& candBp, const T2& cuts, const T3& binsPt) + { + auto ptCandBp = candBp.pt(); + auto mCandBp = invMassBplusToJpsiK(candBp); + auto ptJpsi = RecoDecay::pt(candBp.pxProng0(), candBp.pyProng0()); + auto ptKa = RecoDecay::pt(candBp.pxProng1(), candBp.pyProng1()); + auto candJpsi = candBp.jpsi(); + float pseudoPropDecLen = candBp.decayLengthXY() * mCandBp / ptCandBp; + + int binPt = o2::analysis::findBin(binsPt, ptCandBp); + if (binPt == -1) { + return false; + } + + // B+ mass cut + if (std::abs(mCandBp - o2::constants::physics::MassBPlus) > cuts->get(binPt, "m")) { + return false; + } + + // kaon pt + if (ptKa < cuts->get(binPt, "pT K")) { + return false; + } + + // J/Psi pt + if (ptJpsi < cuts->get(binPt, "pT J/Psi")) { + return false; + } + + // J/Psi mass + if (std::abs(candJpsi.m() - o2::constants::physics::MassJPsi) < cuts->get(binPt, "DeltaM J/Psi")) { + return false; + } + + // d0(J/Psi)xd0(K) + if (candBp.impactParameterProduct() > cuts->get(binPt, "B Imp. Par. Product")) { + return false; + } + + // B+ Decay length + if (candBp.decayLength() < cuts->get(binPt, "B decLen")) { + return false; + } + + // B+ Decay length XY + if (candBp.decayLengthXY() < cuts->get(binPt, "B decLenXY")) { + return false; + } + + // B+ CPA cut + if (candBp.cpa() < cuts->get(binPt, "CPA")) { + return false; + } + + // B+ CPAXY cut + if (candBp.cpaXY() < cuts->get(binPt, "CPAXY")) { + return false; + } + + // d0 of K + if (std::abs(candBp.impactParameter1()) < cuts->get(binPt, "d0 K")) { + return false; + } + + // d0 of J/Psi + if (std::abs(candBp.impactParameter0()) < cuts->get(binPt, "d0 J/Psi")) { + return false; + } + + // B pseudoproper decay length + if (pseudoPropDecLen < cuts->get(binPt, "B pseudoprop. decLen")) { + return false; + } + + return true; + } + + /// Apply PID selection + /// \param pidTrackKa PID status of trackKa (prong1 of B+ candidate) + /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable + /// \return true if prong1 of B+ candidate passes all selections + bool selectionBplusToJpsiKPid(const int pidTrackKa, const bool acceptPIDNotApplicable) + { + if (!acceptPIDNotApplicable && pidTrackKa != TrackSelectorPID::Accepted) { + return false; + } + if (acceptPIDNotApplicable && pidTrackKa == TrackSelectorPID::Rejected) { + return false; + } + + return true; + } + /// Apply topological cuts as defined in SelectorCuts.h /// \param candBs Bs candidate /// \param cuts Bs candidate selections @@ -947,8 +1056,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of Bs candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of Bs candidate passes all selections - template - bool selectionBsToDsPiPid(const T1& pidTrackPi, const T2& acceptPIDNotApplicable) + bool selectionBsToDsPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; @@ -960,6 +1068,115 @@ class HfHelper return true; } + // Apply topological cuts as defined in SelectorCuts.h + /// \param candBs Bs candidate + /// \param candKa0 kaon candidate 0 (phi daughter) + /// \param candKa1 kaon candidate 1 (phi daughter) + /// \param cuts Bs candidate selection per pT bin + /// \param binsPt pT bin limits + /// \return true if candidate passes all selections + template + bool selectionBsToJpsiPhiTopol(const T1& candBs, const T2& candKa0, const T3& candKa1, const T4& cuts, const T5& binsPt) + { + auto ptCandBs = candBs.pt(); + auto mCandBs = invMassBsToJpsiPhi(candBs); + std::array pVecKa0 = candKa0.pVector(); + std::array pVecKa1 = candKa1.pVector(); + auto mCandPhi = RecoDecay::m(std::array{pVecKa0, pVecKa1}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); + auto ptJpsi = RecoDecay::pt(candBs.pxProng0(), candBs.pyProng0()); + auto candJpsi = candBs.jpsi(); + float pseudoPropDecLen = candBs.decayLengthXY() * mCandBs / ptCandBs; + + int binPt = o2::analysis::findBin(binsPt, ptCandBs); + if (binPt == -1) { + return false; + } + + // Bs mass cut + if (std::abs(mCandBs - o2::constants::physics::MassBPlus) > cuts->get(binPt, "m")) { + return false; + } + + // kaon pt + if (candKa0.pt() < cuts->get(binPt, "pT K") && + candKa1.pt() < cuts->get(binPt, "pT K")) { + return false; + } + + // J/Psi pt + if (ptJpsi < cuts->get(binPt, "pT J/Psi")) { + return false; + } + + // phi mass + if (std::abs(mCandPhi - o2::constants::physics::MassPhi) < cuts->get(binPt, "DeltaM phi")) { + return false; + } + + // J/Psi mass + if (std::abs(candJpsi.m() - o2::constants::physics::MassJPsi) < cuts->get(binPt, "DeltaM J/Psi")) { + return false; + } + + // d0(J/Psi)xd0(phi) + if (candBs.impactParameterProduct() > cuts->get(binPt, "B Imp. Par. Product")) { + return false; + } + + // Bs Decay length + if (candBs.decayLength() < cuts->get(binPt, "B decLen")) { + return false; + } + + // Bs Decay length XY + if (candBs.decayLengthXY() < cuts->get(binPt, "B decLenXY")) { + return false; + } + + // Bs CPA cut + if (candBs.cpa() < cuts->get(binPt, "CPA")) { + return false; + } + + // Bs CPAXY cut + if (candBs.cpaXY() < cuts->get(binPt, "CPAXY")) { + return false; + } + + // d0 of phi + if (std::abs(candBs.impactParameter1()) < cuts->get(binPt, "d0 phi")) { + return false; + } + + // d0 of J/Psi + if (std::abs(candBs.impactParameter0()) < cuts->get(binPt, "d0 J/Psi")) { + return false; + } + + // B pseudoproper decay length + if (pseudoPropDecLen < cuts->get(binPt, "B pseudoprop. decLen")) { + return false; + } + + return true; + } + + /// Apply PID selection + /// \param pidTrackKa PID status of trackKa (prong1 of B+ candidate) + /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable + /// \return true if prong1 of B+ candidate passes all selections + bool selectionBsToJpsiPhiPid(const int pidTrackKa, const bool acceptPIDNotApplicable) + { + if (!acceptPIDNotApplicable && pidTrackKa != TrackSelectorPID::Accepted) { + return false; + } + if (acceptPIDNotApplicable && pidTrackKa == TrackSelectorPID::Rejected) { + return false; + } + + return true; + } + /// Apply topological cuts as defined in SelectorCuts.h /// \param candLb Lb candidate /// \param cuts Lb candidate selection per pT bin" @@ -1028,8 +1245,7 @@ class HfHelper /// \param pidTrackPi PID status of trackPi (prong1 of Lb candidate) /// \param acceptPIDNotApplicable switch to accept Status::NotApplicable /// \return true if prong1 of Lb candidate passes all selections - template - bool selectionLbToLcPiPid(const T1& pidTrackPi, const T2& acceptPIDNotApplicable) + bool selectionLbToLcPiPid(const int pidTrackPi, const bool acceptPIDNotApplicable) { if (!acceptPIDNotApplicable && pidTrackPi != TrackSelectorPID::Accepted) { return false; diff --git a/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h b/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h new file mode 100644 index 00000000000..5f218ec6259 --- /dev/null +++ b/PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h @@ -0,0 +1,179 @@ +// 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 HfMlResponseBplusToJpsiKReduced.h +/// \brief Class to compute the ML response for B± → J/Psi K± analysis selections in the reduced format +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino + +#ifndef PWGHF_CORE_HFMLRESPONSEBPLUSTOJPSIKREDUCED_H_ +#define PWGHF_CORE_HFMLRESPONSEBPLUSTOJPSIKREDUCED_H_ + +#include "PWGHF/Core/HfMlResponse.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" + +#include + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_BPLUS(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesBplusToJpsiKReduced::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBplusToJpsiKReduced::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the GETTER function taking OBJECT in argument +#define CHECK_AND_FILL_VEC_BPLUS_FUNC(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBplusToJpsiKReduced::FEATURE): { \ + inputFeatures.emplace_back(GETTER(OBJECT)); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_BPLUS(GETTER) \ + case static_cast(InputFeaturesBplusToJpsiKReduced::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate, FEATURE = GETTER, and args are needed +#define CHECK_AND_FILL_VEC_BPLUS_WITH_ARGS(GETTER, ARGS...) \ + case static_cast(InputFeaturesBplusToJpsiKReduced::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER(ARGS)); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesBplusToJpsiKReduced : uint8_t { + ptProng0 = 0, + ptProng1, + impactParameter0, + impactParameter1, + impactParameter2, + impactParameterProduct, + impactParameterProductJpsi, + chi2PCA, + decayLength, + decayLengthXY, + decayLengthNormalised, + decayLengthXYNormalised, + cpa, + cpaXY, + maxNormalisedDeltaIP, + ctXY, + tpcNSigmaKa1, + tofNSigmaKa1, + tpcTofNSigmaKa1 +}; + +template +class HfMlResponseBplusToJpsiKReduced : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseBplusToJpsiKReduced() = default; + /// Default destructor + virtual ~HfMlResponseBplusToJpsiKReduced() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the B+ candidate + /// \param prong1 is the candidate's prong1 + /// \return inputFeatures vector + template + std::vector getInputFeatures(T1 const& candidate, + T2 const& prong1) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + CHECK_AND_FILL_VEC_BPLUS(ptProng0); + CHECK_AND_FILL_VEC_BPLUS(ptProng1); + CHECK_AND_FILL_VEC_BPLUS(impactParameter0); + CHECK_AND_FILL_VEC_BPLUS(impactParameter1); + CHECK_AND_FILL_VEC_BPLUS(impactParameter2); + CHECK_AND_FILL_VEC_BPLUS(impactParameterProduct); + CHECK_AND_FILL_VEC_BPLUS(impactParameterProductJpsi); + CHECK_AND_FILL_VEC_BPLUS(chi2PCA); + CHECK_AND_FILL_VEC_BPLUS(decayLength); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXY); + CHECK_AND_FILL_VEC_BPLUS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BPLUS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BPLUS(cpa); + CHECK_AND_FILL_VEC_BPLUS(cpaXY); + CHECK_AND_FILL_VEC_BPLUS(maxNormalisedDeltaIP); + CHECK_AND_FILL_VEC_BPLUS_WITH_ARGS(ctXY, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}); + // TPC PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tpcNSigmaKa1, tpcNSigmaKa); + // TOF PID variable + CHECK_AND_FILL_VEC_BPLUS_FULL(prong1, tofNSigmaKa1, tofNSigmaKa); + // Combined PID variables + CHECK_AND_FILL_VEC_BPLUS_FUNC(prong1, tpcTofNSigmaKa1, o2::pid_tpc_tof_utils::getTpcTofNSigmaKa1); + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_BPLUS(ptProng0), + FILL_MAP_BPLUS(ptProng1), + FILL_MAP_BPLUS(impactParameter0), + FILL_MAP_BPLUS(impactParameter1), + FILL_MAP_BPLUS(impactParameter2), + FILL_MAP_BPLUS(impactParameterProduct), + FILL_MAP_BPLUS(impactParameterProductJpsi), + FILL_MAP_BPLUS(chi2PCA), + FILL_MAP_BPLUS(decayLength), + FILL_MAP_BPLUS(decayLengthXY), + FILL_MAP_BPLUS(decayLengthNormalised), + FILL_MAP_BPLUS(decayLengthXYNormalised), + FILL_MAP_BPLUS(cpa), + FILL_MAP_BPLUS(cpaXY), + FILL_MAP_BPLUS(maxNormalisedDeltaIP), + FILL_MAP_BPLUS(ctXY), + // TPC PID variable + FILL_MAP_BPLUS(tpcNSigmaKa1), + // TOF PID variable + FILL_MAP_BPLUS(tofNSigmaKa1), + // Combined PID variable + FILL_MAP_BPLUS(tpcTofNSigmaKa1)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_BPLUS +#undef CHECK_AND_FILL_VEC_BPLUS_FULL +#undef CHECK_AND_FILL_VEC_BPLUS_FUNC +#undef CHECK_AND_FILL_VEC_BPLUS + +#endif // PWGHF_CORE_HFMLRESPONSEBPLUSTOJPSIKREDUCED_H_ diff --git a/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h b/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h new file mode 100644 index 00000000000..71e19567a2b --- /dev/null +++ b/PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h @@ -0,0 +1,201 @@ +// 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 HfMlResponseBsToJpsiPhiReduced.h +/// \brief Class to compute the ML response for Bs0 → J/Psi phi analysis selections in the reduced format +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino + +#ifndef PWGHF_CORE_HFMLRESPONSEBSTOJPSIPHIREDUCED_H_ +#define PWGHF_CORE_HFMLRESPONSEBSTOJPSIPHIREDUCED_H_ + +#include "PWGHF/Core/HfMlResponse.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" + +#include + +// Fill the map of available input features +// the key is the feature's name (std::string) +// the value is the corresponding value in EnumInputFeatures +#define FILL_MAP_BS(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesBsToJpsiPhiReduced::FEATURE) \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the corresponding GETTER from OBJECT +#define CHECK_AND_FILL_VEC_BS_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBsToJpsiPhiReduced::FEATURE): { \ + inputFeatures.emplace_back(OBJECT.GETTER()); \ + break; \ + } + +// Check if the index of mCachedIndices (index associated to a FEATURE) +// matches the entry in EnumInputFeatures associated to this FEATURE +// if so, the inputFeatures vector is filled with the FEATURE's value +// by calling the GETTER function taking OBJECT in argument +#define CHECK_AND_FILL_VEC_BS_FUNC(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBsToJpsiPhiReduced::FEATURE): { \ + inputFeatures.emplace_back(GETTER(OBJECT)); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_BS(GETTER) \ + case static_cast(InputFeaturesBsToJpsiPhiReduced::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BPLUS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER and args are needed +#define CHECK_AND_FILL_VEC_BS_WITH_ARGS(GETTER, ARGS...) \ + case static_cast(InputFeaturesBsToJpsiPhiReduced::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER(ARGS)); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesBsToJpsiPhiReduced : uint8_t { + ptProng0 = 0, + ptProng1, + impactParameter0, + impactParameter1, + impactParameter2, + impactParameter3, + impactParameterProduct, + impactParameterProductJpsi, + impactParameterProductPhi, + chi2PCA, + decayLength, + decayLengthXY, + decayLengthNormalised, + decayLengthXYNormalised, + cpa, + cpaXY, + maxNormalisedDeltaIP, + ctXY, + tpcNSigmaKa0, + tofNSigmaKa0, + tpcTofNSigmaKa0, + tpcNSigmaKa1, + tofNSigmaKa1, + tpcTofNSigmaKa1 +}; + +template +class HfMlResponseBsToJpsiPhiReduced : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseBsToJpsiPhiReduced() = default; + /// Default destructor + virtual ~HfMlResponseBsToJpsiPhiReduced() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the Bs candidate + /// \param prong1 is the candidate's prong1 + /// \return inputFeatures vector + template + std::vector getInputFeatures(T1 const& candidate, + T2 const& prong1, + T3 const& prong2) + { + std::vector inputFeatures; + + for (const auto& idx : MlResponse::mCachedIndices) { + switch (idx) { + CHECK_AND_FILL_VEC_BS(ptProng0); + CHECK_AND_FILL_VEC_BS(ptProng1); + CHECK_AND_FILL_VEC_BS(impactParameter0); + CHECK_AND_FILL_VEC_BS(impactParameter1); + CHECK_AND_FILL_VEC_BS(impactParameter2); + CHECK_AND_FILL_VEC_BS(impactParameter3); + CHECK_AND_FILL_VEC_BS(impactParameterProduct); + CHECK_AND_FILL_VEC_BS(impactParameterProductJpsi); + CHECK_AND_FILL_VEC_BS(impactParameterProductPhi); + CHECK_AND_FILL_VEC_BS(chi2PCA); + CHECK_AND_FILL_VEC_BS(decayLength); + CHECK_AND_FILL_VEC_BS(decayLengthXY); + CHECK_AND_FILL_VEC_BS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BS(cpa); + CHECK_AND_FILL_VEC_BS(cpaXY); + CHECK_AND_FILL_VEC_BS(maxNormalisedDeltaIP); + CHECK_AND_FILL_VEC_BS_WITH_ARGS(ctXY, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); + // TPC PID variable + CHECK_AND_FILL_VEC_BS_FULL(prong1, tpcNSigmaKa0, tpcNSigmaKa); + // TOF PID variable + CHECK_AND_FILL_VEC_BS_FULL(prong1, tofNSigmaKa0, tofNSigmaKa); + // Combined PID variables + CHECK_AND_FILL_VEC_BS_FUNC(prong1, tpcTofNSigmaKa0, o2::pid_tpc_tof_utils::getTpcTofNSigmaKa1); + // TPC PID variable + CHECK_AND_FILL_VEC_BS_FULL(prong2, tpcNSigmaKa1, tpcNSigmaKa); + // TOF PID variable + CHECK_AND_FILL_VEC_BS_FULL(prong2, tofNSigmaKa1, tofNSigmaKa); + // Combined PID variables + CHECK_AND_FILL_VEC_BS_FUNC(prong2, tpcTofNSigmaKa1, o2::pid_tpc_tof_utils::getTpcTofNSigmaKa1); + } + } + + return inputFeatures; + } + + protected: + /// Method to fill the map of available input features + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + FILL_MAP_BS(ptProng0), + FILL_MAP_BS(ptProng1), + FILL_MAP_BS(impactParameter0), + FILL_MAP_BS(impactParameter1), + FILL_MAP_BS(impactParameter2), + FILL_MAP_BS(impactParameter3), + FILL_MAP_BS(impactParameterProduct), + FILL_MAP_BS(impactParameterProductJpsi), + FILL_MAP_BS(impactParameterProductPhi), + FILL_MAP_BS(chi2PCA), + FILL_MAP_BS(decayLength), + FILL_MAP_BS(decayLengthXY), + FILL_MAP_BS(decayLengthNormalised), + FILL_MAP_BS(decayLengthXYNormalised), + FILL_MAP_BS(cpa), + FILL_MAP_BS(cpaXY), + FILL_MAP_BS(maxNormalisedDeltaIP), + FILL_MAP_BS(ctXY), + // TPC PID variable + FILL_MAP_BS(tpcNSigmaKa0), + // TOF PID variable + FILL_MAP_BS(tofNSigmaKa0), + // Combined PID variable + FILL_MAP_BS(tpcTofNSigmaKa0), + // TPC PID variable + FILL_MAP_BS(tpcNSigmaKa1), + // TOF PID variable + FILL_MAP_BS(tofNSigmaKa1), + // Combined PID variable + FILL_MAP_BS(tpcTofNSigmaKa1)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_BS +#undef CHECK_AND_FILL_VEC_BS_FULL +#undef CHECK_AND_FILL_VEC_BS_FUNC +#undef CHECK_AND_FILL_VEC_BS + +#endif // PWGHF_CORE_HFMLRESPONSEBSTOJPSIPHIREDUCED_H_ diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 61e17b16ff1..7fbd324f8c3 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -896,6 +896,53 @@ static const std::vector labelsPt = { static const std::vector labelsCutVar = {"m", "DCA_xy", "DCA_z", "pT El", "chi2PCA"}; } // namespace hf_cuts_jpsi_to_e_e +namespace hf_cuts_jpsi_to_mu_mu +{ +static constexpr int NBinsPt = 9; +static constexpr int NCutVars = 8; +// default values for the pT bin edges (can be used to configure histogram axis) +// offset by 1 from the bin numbers in cuts array +constexpr double BinsPt[NBinsPt + 1] = { + 0, + 0.5, + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 10.0, + 16.0, +}; +auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; + +// default values for the cuts +constexpr double Cuts[NBinsPt][NCutVars] = {{0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 0 < pT < 0.5 */ + {0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 0.5 < pT < 1 */ + {0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 1 < pT < 2 */ + {0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 2 < pT < 3 */ + {0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 3 < pT < 4 */ + {0.6, 1.0, 0.2, 0.2, 0.9, 0.9, 0., 0.}, /* 4 < pT < 5 */ + {0.8, 1.0, 0.3, 0.3, 0.9, 0.9, 0., 0.}, /* 5 < pT < 6 */ + {0.8, 1.0, 0.3, 0.3, 0.9, 0.9, 1., 0.}, /* 6 < pT < 10 */ + {0.8, 1.0, 0.3, 0.3, 0.9, 0.9, 1., 0.}}; /* 10 < pT < 16 */ + +// row labels +static const std::vector labelsPt = { + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6", + "pT bin 7", + "pT bin 8"}; + +// column labels +static const std::vector labelsCutVar = {"m", "pT mu", "decay length", "decay length xy", "cpa", "cpa xy", "d0xd0", "pseudoprop. decay length"}; +} // namespace hf_cuts_jpsi_to_mu_mu + namespace hf_cuts_b0_to_d_pi { static constexpr int NBinsPt = 12; @@ -1003,6 +1050,62 @@ static const std::vector labelsPt = { static const std::vector labelsCutVar = {"m", "CPA", "Chi2PCA", "d0 Ds", "d0 Pi", "pT Ds", "pT Pi", "Bs decLen", "Bs decLenXY", "Imp. Par. Product"}; } // namespace hf_cuts_bs_to_ds_pi +namespace hf_cuts_bs_to_jpsi_phi +{ +static constexpr int NBinsPt = 12; +static constexpr int NCutVars = 13; +// default values for the pT bin edges (can be used to configure histogram axis) +// offset by 1 from the bin numbers in cuts array +constexpr double BinsPt[NBinsPt + 1] = { + 0, + 0.5, + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 7.0, + 10.0, + 13.0, + 16.0, + 20.0, + 24.0}; + +auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; + +// default values for the cuts +// DeltaM CPA d0Jpsi d0K pTJpsi pTK BDecayLength BDecayLengthXY BIPProd DeltaMJpsi JpsiIPProd +constexpr double Cuts[NBinsPt][NCutVars] = {{1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 0 < pt < 0.5 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 0.5 < pt < 1 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 1 < pt < 2 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 2 < pt < 3 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 3 < pt < 4 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 4 < pt < 5 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 5 < pt < 7 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 7 < pt < 10 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 10 < pt < 13 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 13 < pt < 16 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}, /* 16 < pt < 20 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.02, 0.}}; /* 20 < pt < 24 */ +// row labels +static const std::vector labelsPt = { + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6", + "pT bin 7", + "pT bin 8", + "pT bin 9", + "pT bin 10", + "pT bin 11"}; + +// column labels +static const std::vector labelsCutVar = {"m", "CPA", "CPAXY", "d0 J/Psi", "d0 phi", "pT J/Psi", "pT K", "B decLen", "B decLenXY", "B Imp. Par. Product", "DeltaM J/Psi", "DeltaM phi", "B pseudoprop. decLen"}; +} // namespace hf_cuts_bs_to_jpsi_phi + namespace hf_cuts_bplus_to_d0_pi { static constexpr int NBinsPt = 12; @@ -1059,6 +1162,62 @@ static const std::vector labelsPt = { static const std::vector labelsCutVar = {"m", "CPA", "d0 D0", "d0 Pi", "pT D0", "pT Pi", "B decLen", "B decLenXY", "Imp. Par. Product", "DeltaMD0", "Cos ThetaStar"}; } // namespace hf_cuts_bplus_to_d0_pi +namespace hf_cuts_bplus_to_jpsi_k +{ +static constexpr int NBinsPt = 12; +static constexpr int NCutVars = 12; +// default values for the pT bin edges (can be used to configure histogram axis) +// offset by 1 from the bin numbers in cuts array +constexpr double BinsPt[NBinsPt + 1] = { + 0, + 0.5, + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 7.0, + 10.0, + 13.0, + 16.0, + 20.0, + 24.0}; + +auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; + +// default values for the cuts +// DeltaM CPA d0Jpsi d0K pTJpsi pTK BDecayLength BDecayLengthXY BIPProd DeltaMJpsi JpsiIPProd +constexpr double Cuts[NBinsPt][NCutVars] = {{1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 0 < pt < 0.5 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 0.5 < pt < 1 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 1 < pt < 2 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 2 < pt < 3 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 3 < pt < 4 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 4 < pt < 5 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 5 < pt < 7 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 7 < pt < 10 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 10 < pt < 13 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 13 < pt < 16 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}, /* 16 < pt < 20 */ + {1., 0.8, 0.8, 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0., 0.1, 0.}}; /* 20 < pt < 24 */ +// row labels +static const std::vector labelsPt = { + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6", + "pT bin 7", + "pT bin 8", + "pT bin 9", + "pT bin 10", + "pT bin 11"}; + +// column labels +static const std::vector labelsCutVar = {"m", "CPA", "CPAXY", "d0 J/Psi", "d0 K", "pT J/Psi", "pT K", "B decLen", "B decLenXY", "B Imp. Par. Product", "DeltaM J/Psi", "B pseudoprop. decLen"}; +} // namespace hf_cuts_bplus_to_jpsi_k + namespace hf_cuts_lb_to_lc_pi { static constexpr int NBinsPt = 12; diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 092210a22ca..939f0648099 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -19,16 +19,13 @@ /// \author Fabrizio Grosa , CERN /// \author Luca Aglietta , Università degli Studi di Torino (UniTO) /// \author Biao Zhang , Heidelberg University +/// \author Fabrizio Chinu , Università degli Studi di Torino (UniTO) #ifndef PWGHF_D2H_DATAMODEL_REDUCEDDATAMODEL_H_ #define PWGHF_D2H_DATAMODEL_REDUCEDDATAMODEL_H_ -#include -#include - -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsPid.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -37,8 +34,14 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/Qvectors.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsPid.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +#include +#include +#include +#include namespace o2 { @@ -278,6 +281,66 @@ DECLARE_SOA_TABLE(HfRedTracksCov, "AOD", "HFREDTRACKCOV", //! Table with track c soa::Index<>, HFTRACKPARCOV_COLUMNS); +// CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) +// to call DECLARE_SOA_INDEX_COLUMN_FULL later on +DECLARE_SOA_TABLE(HfRedBach0Bases, "AOD", "HFREDBACH0BASE", //! Table with track information for reduced workflow + soa::Index<>, + hf_track_index_reduced::TrackId, + hf_track_index_reduced::HfRedCollisionId, + HFTRACKPAR_COLUMNS, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, + hf_track_vars_reduced::HasTPC, + hf_track_vars_reduced::HasTOF, + pidtpc::TPCNSigmaPi, + pidtof::TOFNSigmaPi, + pidtpc::TPCNSigmaKa, + pidtof::TOFNSigmaKa, + pidtpc::TPCNSigmaPr, + pidtof::TOFNSigmaPr, + hf_track_pid_reduced::TPCTOFNSigmaPi, + hf_track_pid_reduced::TPCTOFNSigmaKa, + hf_track_pid_reduced::TPCTOFNSigmaPr, + aod::track::Px, + aod::track::Py, + aod::track::Pz, + aod::track::PVector); + +DECLARE_SOA_TABLE(HfRedBach0Cov, "AOD", "HFREDBACH0COV", //! Table with track covariance information for reduced workflow + soa::Index<>, + HFTRACKPARCOV_COLUMNS); + +// CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) +// to call DECLARE_SOA_INDEX_COLUMN_FULL later on +DECLARE_SOA_TABLE(HfRedBach1Bases, "AOD", "HFREDBACH1BASE", //! Table with track information for reduced workflow + soa::Index<>, + hf_track_index_reduced::TrackId, + hf_track_index_reduced::HfRedCollisionId, + HFTRACKPAR_COLUMNS, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, + hf_track_vars_reduced::HasTPC, + hf_track_vars_reduced::HasTOF, + pidtpc::TPCNSigmaPi, + pidtof::TOFNSigmaPi, + pidtpc::TPCNSigmaKa, + pidtof::TOFNSigmaKa, + pidtpc::TPCNSigmaPr, + pidtof::TOFNSigmaPr, + hf_track_pid_reduced::TPCTOFNSigmaPi, + hf_track_pid_reduced::TPCTOFNSigmaKa, + hf_track_pid_reduced::TPCTOFNSigmaPr, + aod::track::Px, + aod::track::Py, + aod::track::Pz, + aod::track::PVector); + +DECLARE_SOA_TABLE(HfRedBach1Cov, "AOD", "HFREDBACH1COV", //! Table with track covariance information for reduced workflow + soa::Index<>, + HFTRACKPARCOV_COLUMNS); + // table with all attributes needed to call statusTpcAndTof() in the selector task DECLARE_SOA_TABLE(HfRedTracksPid, "AOD", "HFREDTRACKPID", //! Table with PID track information for reduced workflow o2::soa::Index<>, @@ -289,8 +352,14 @@ DECLARE_SOA_TABLE(HfRedTracksPid, "AOD", "HFREDTRACKPID", //! Table with PID tra DECLARE_SOA_EXTENDED_TABLE_USER(HfRedTracksExt, HfRedTrackBases, "HFREDTRACKEXT", //! Track parameters at collision vertex aod::track::Pt); +DECLARE_SOA_EXTENDED_TABLE_USER(HfRedBach0Ext, HfRedBach0Bases, "HFREDBACH0EXT", //! Track parameters at collision vertex + aod::track::Pt); +DECLARE_SOA_EXTENDED_TABLE_USER(HfRedBach1Ext, HfRedBach1Bases, "HFREDBACH1EXT", //! Track parameters at collision vertex + aod::track::Pt); using HfRedTracks = HfRedTracksExt; +using HfRedBach0Tracks = HfRedBach0Ext; +using HfRedBach1Tracks = HfRedBach1Ext; namespace hf_charm_cand_reduced { @@ -304,6 +373,105 @@ DECLARE_SOA_COLUMN(MlScorePromptMassHypo1, mlScorePromptMassHypo1, float); DECLARE_SOA_COLUMN(MlScoreNonpromptMassHypo1, mlScoreNonpromptMassHypo1, float); //! ML score for non-prompt class (mass hypothesis 1) } // namespace hf_charm_cand_reduced +namespace hf_jpsi_cand_reduced +{ +DECLARE_SOA_COLUMN(ProngPosId, prongPosId, int); //! Original track index +DECLARE_SOA_COLUMN(ProngNegId, prongNegId, int); //! Original track index +DECLARE_SOA_COLUMN(HfRedCollisionId, hfRedCollisionId, int); //! Collision index +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate in GeV/c2 +DECLARE_SOA_COLUMN(XDauPos, xDauPos, float); //! x +DECLARE_SOA_COLUMN(XDauNeg, xDauNeg, float); //! x +DECLARE_SOA_COLUMN(YDauPos, yDauPos, float); //! y +DECLARE_SOA_COLUMN(YDauNeg, yDauNeg, float); //! y +DECLARE_SOA_COLUMN(ZDauPos, zDauPos, float); //! z +DECLARE_SOA_COLUMN(ZDauNeg, zDauNeg, float); //! z +DECLARE_SOA_COLUMN(AlphaDauPos, alphaDauPos, float); //! alpha of the J/Psi positive decay daughter +DECLARE_SOA_COLUMN(AlphaDauNeg, alphaDauNeg, float); //! alpha of the J/Psi negative decay daughter +DECLARE_SOA_COLUMN(SnpDauPos, snpDauPos, float); //! snp of the J/Psi positive decay daughter +DECLARE_SOA_COLUMN(SnpDauNeg, snpDauNeg, float); //! snp of the J/Psi negative decay daughter +DECLARE_SOA_COLUMN(TglDauPos, tglDauPos, float); //! tgl of the J/Psi positive decay daughter +DECLARE_SOA_COLUMN(TglDauNeg, tglDauNeg, float); //! tgl of the J/Psi negative decay daughter +DECLARE_SOA_COLUMN(Signed1PtDauPos, signed1PtDauPos, float); //! signed1Pt of the J/Psi positive decay daughter +DECLARE_SOA_COLUMN(Signed1PtDauNeg, signed1PtDauNeg, float); //! signed1Pt of the J/Psi negative decay daughter + +DECLARE_SOA_DYNAMIC_COLUMN(PxDauPos, pxDauPos, //! Momentum in x-direction in GeV/c + [](float signed1Pt, float snp, float alpha) -> float { + auto pt = 1.f / std::abs(signed1Pt); + // FIXME: GCC & clang should optimize to sincosf + float cs = cosf(alpha), sn = sinf(alpha); + auto r = std::sqrt((1.f - snp) * (1.f + snp)); + return pt * (r * cs - snp * sn); + }); +DECLARE_SOA_DYNAMIC_COLUMN(PyDauPos, pyDauPos, //! Momentum in y-direction in GeV/c + [](float signed1Pt, float snp, float alpha) -> float { + auto pt = 1.f / std::abs(signed1Pt); + // FIXME: GCC & clang should optimize to sincosf + float cs = cosf(alpha), sn = sinf(alpha); + auto r = std::sqrt((1.f - snp) * (1.f + snp)); + return pt * (snp * cs + r * sn); + }); +DECLARE_SOA_DYNAMIC_COLUMN(PzDauPos, pzDauPos, //! Momentum in z-direction in GeV/c + [](float signed1Pt, float tgl) -> float { + auto pt = 1.f / std::abs(signed1Pt); + return pt * tgl; + }); +DECLARE_SOA_DYNAMIC_COLUMN(PxDauNeg, pxDauNeg, //! Momentum in x-direction in GeV/c + [](float signed1Pt, float snp, float alpha) -> float { + auto pt = 1.f / std::abs(signed1Pt); + // FIXME: GCC & clang should optimize to sincosf + float cs = cosf(alpha), sn = sinf(alpha); + auto r = std::sqrt((1.f - snp) * (1.f + snp)); + return pt * (r * cs - snp * sn); + }); +DECLARE_SOA_DYNAMIC_COLUMN(PyDauNeg, pyDauNeg, //! Momentum in y-direction in GeV/c + [](float signed1Pt, float snp, float alpha) -> float { + auto pt = 1.f / std::abs(signed1Pt); + // FIXME: GCC & clang should optimize to sincosf + float cs = cosf(alpha), sn = sinf(alpha); + auto r = std::sqrt((1.f - snp) * (1.f + snp)); + return pt * (snp * cs + r * sn); + }); +DECLARE_SOA_DYNAMIC_COLUMN(PzDauNeg, pzDauNeg, //! Momentum in z-direction in GeV/c + [](float signed1Pt, float tgl) -> float { + auto pt = 1.f / std::abs(signed1Pt); + return pt * tgl; + }); + +// Covariance matrix of the J/Psi positive decay daughter +DECLARE_SOA_COLUMN(CYYDauPos, cYYDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CZYDauPos, cZYDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CZZDauPos, cZZDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpYDauPos, cSnpYDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpZDauPos, cSnpZDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpSnpDauPos, cSnpSnpDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglYDauPos, cTglYDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglZDauPos, cTglZDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglSnpDauPos, cTglSnpDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglTglDauPos, cTglTglDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtYDauPos, c1PtYDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtZDauPos, c1PtZDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtSnpDauPos, c1PtSnpDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtTglDauPos, c1PtTglDauPos, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1Pt21Pt2DauPos, c1Pt21Pt2DauPos, float); //! Covariance matrix + +// Covariance matrix of the J/Psi negative decay daughter +DECLARE_SOA_COLUMN(CYYDauNeg, cYYDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CZYDauNeg, cZYDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CZZDauNeg, cZZDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpYDauNeg, cSnpYDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpZDauNeg, cSnpZDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CSnpSnpDauNeg, cSnpSnpDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglYDauNeg, cTglYDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglZDauNeg, cTglZDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglSnpDauNeg, cTglSnpDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(CTglTglDauNeg, cTglTglDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtYDauNeg, c1PtYDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtZDauNeg, c1PtZDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtSnpDauNeg, c1PtSnpDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1PtTglDauNeg, c1PtTglDauNeg, float); //! Covariance matrix +DECLARE_SOA_COLUMN(C1Pt21Pt2DauNeg, c1Pt21Pt2DauNeg, float); //! Covariance matrix +} // namespace hf_jpsi_cand_reduced + // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on DECLARE_SOA_TABLE(HfRed2Prongs, "AOD", "HFRED2PRONG", //! Table with 2prong candidate information for reduced workflow @@ -370,6 +538,47 @@ DECLARE_SOA_TABLE_VERSIONED(HfRed3ProngsMl_001, "AOD", "HFRED3PRONGML", 1, //! T using HfRed3ProngsMl = HfRed3ProngsMl_001; +// CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) +// to call DECLARE_SOA_INDEX_COLUMN_FULL later on +DECLARE_SOA_TABLE(HfRedJpsis, "AOD", "HFREDJPSI", //! Table with J/Psi candidate information for reduced workflow + o2::soa::Index<>, + hf_jpsi_cand_reduced::ProngPosId, + hf_jpsi_cand_reduced::ProngNegId, + hf_track_index_reduced::HfRedCollisionId, + hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, + hf_jpsi_cand_reduced::M, + hf_jpsi_cand_reduced::XDauPos, hf_jpsi_cand_reduced::XDauNeg, + hf_jpsi_cand_reduced::YDauPos, hf_jpsi_cand_reduced::YDauNeg, + hf_jpsi_cand_reduced::ZDauPos, hf_jpsi_cand_reduced::ZDauNeg, + hf_jpsi_cand_reduced::AlphaDauPos, hf_jpsi_cand_reduced::AlphaDauNeg, + hf_jpsi_cand_reduced::SnpDauPos, hf_jpsi_cand_reduced::SnpDauNeg, + hf_jpsi_cand_reduced::TglDauPos, hf_jpsi_cand_reduced::TglDauNeg, + hf_jpsi_cand_reduced::Signed1PtDauPos, hf_jpsi_cand_reduced::Signed1PtDauNeg, + hf_jpsi_cand_reduced::PxDauPos, + hf_jpsi_cand_reduced::PxDauNeg, + hf_jpsi_cand_reduced::PyDauPos, + hf_jpsi_cand_reduced::PyDauNeg, + hf_jpsi_cand_reduced::PzDauPos, + hf_jpsi_cand_reduced::PzDauNeg); + +DECLARE_SOA_TABLE(HfRedJpsiCov, "AOD", "HFREDJPSICOV", //! Table with J/Psi candidate covariance for reduced workflow + o2::soa::Index<>, + hf_jpsi_cand_reduced::CYYDauPos, hf_jpsi_cand_reduced::CYYDauNeg, + hf_jpsi_cand_reduced::CZYDauPos, hf_jpsi_cand_reduced::CZYDauNeg, + hf_jpsi_cand_reduced::CZZDauPos, hf_jpsi_cand_reduced::CZZDauNeg, + hf_jpsi_cand_reduced::CSnpYDauPos, hf_jpsi_cand_reduced::CSnpYDauNeg, + hf_jpsi_cand_reduced::CSnpZDauPos, hf_jpsi_cand_reduced::CSnpZDauNeg, + hf_jpsi_cand_reduced::CSnpSnpDauPos, hf_jpsi_cand_reduced::CSnpSnpDauNeg, + hf_jpsi_cand_reduced::CTglYDauPos, hf_jpsi_cand_reduced::CTglYDauNeg, + hf_jpsi_cand_reduced::CTglZDauPos, hf_jpsi_cand_reduced::CTglZDauNeg, + hf_jpsi_cand_reduced::CTglSnpDauPos, hf_jpsi_cand_reduced::CTglSnpDauNeg, + hf_jpsi_cand_reduced::CTglTglDauPos, hf_jpsi_cand_reduced::CTglTglDauNeg, + hf_jpsi_cand_reduced::C1PtYDauPos, hf_jpsi_cand_reduced::C1PtYDauNeg, + hf_jpsi_cand_reduced::C1PtZDauPos, hf_jpsi_cand_reduced::C1PtZDauNeg, + hf_jpsi_cand_reduced::C1PtSnpDauPos, hf_jpsi_cand_reduced::C1PtSnpDauNeg, + hf_jpsi_cand_reduced::C1PtTglDauPos, hf_jpsi_cand_reduced::C1PtTglDauNeg, + hf_jpsi_cand_reduced::C1Pt21Pt2DauPos, hf_jpsi_cand_reduced::C1Pt21Pt2DauNeg); + DECLARE_SOA_TABLE(HfRedPidDau0s_000, "AOD", "HFREDPIDDAU0", //! hf_track_pid_reduced::TPCNSigmaPiProng0, hf_track_pid_reduced::TOFNSigmaPiProng0, @@ -474,6 +683,8 @@ namespace hf_cand_bplus_reduced { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed2Prongs, "_0"); //! Prong0 index DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index +DECLARE_SOA_INDEX_COLUMN_FULL(Jpsi, jpsi, int, HfRedJpsis, "_0"); //! J/Psi index +DECLARE_SOA_INDEX_COLUMN_FULL(BachKa, bachKa, int, HfRedBach0Bases, "_0"); //! J/Psi index DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter @@ -482,6 +693,9 @@ DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! N DECLARE_SOA_TABLE(HfRedBplusProngs, "AOD", "HFREDBPPRONG", hf_cand_bplus_reduced::Prong0Id, hf_cand_bplus_reduced::Prong1Id); +DECLARE_SOA_TABLE(HfRedBplus2JpsiDaus, "AOD", "HFREDBP2JPSIDAU", + hf_cand_bplus_reduced::JpsiId, hf_cand_bplus_reduced::BachKaId); + DECLARE_SOA_TABLE(HfRedBplusD0Mls, "AOD", "HFREDBPLUSD0ML", //! Table with ML scores for the D0 daughter hf_cand_bplus_reduced::Prong0MlScoreBkg, hf_cand_bplus_reduced::Prong0MlScorePrompt, @@ -489,19 +703,26 @@ DECLARE_SOA_TABLE(HfRedBplusD0Mls, "AOD", "HFREDBPLUSD0ML", //! Table with ML sc o2::soa::Marker<1>); using HfRedCandBplus = soa::Join; +using HfRedCandBplusToJpsiK = soa::Join; namespace hf_cand_bs_reduced { -DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index -DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index -DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter -DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter -DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index +DECLARE_SOA_INDEX_COLUMN_FULL(Jpsi, jpsi, int, HfRedJpsis, "_0"); //! J/Psi index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0Phi, prong0Phi, int, HfRedBach0Bases, "_0"); //! J/Psi index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1Phi, prong1Phi, int, HfRedBach1Bases, "_0"); //! J/Psi index +DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter } // namespace hf_cand_bs_reduced DECLARE_SOA_TABLE(HfRedBsProngs, "AOD", "HFREDBSPRONG", //! Table with Bs daughter indices hf_cand_bs_reduced::Prong0Id, hf_cand_bs_reduced::Prong1Id); +DECLARE_SOA_TABLE(HfRedBs2JpsiDaus, "AOD", "HFREDBS2JPSIDAU", + hf_cand_bs_reduced::JpsiId, hf_cand_bs_reduced::Prong0PhiId, hf_cand_bs_reduced::Prong1PhiId); + DECLARE_SOA_TABLE(HfRedBsDsMls, "AOD", "HFREDBSDSML", //! Table with ML scores for the Ds daughter hf_cand_bs_reduced::Prong0MlScoreBkg, hf_cand_bs_reduced::Prong0MlScorePrompt, @@ -509,6 +730,7 @@ DECLARE_SOA_TABLE(HfRedBsDsMls, "AOD", "HFREDBSDSML", //! Table with ML scores f o2::soa::Marker<1>); using HfRedCandBs = soa::Join; +using HfRedCandBsToJpsiPhi = soa::Join; namespace hf_cand_lb_reduced { @@ -576,6 +798,7 @@ DECLARE_SOA_TABLE(HfMcCheckDpPis, "AOD", "HFMCCHECKDPPI", //! Table with reconst // Table with same size as HFCANDB0 DECLARE_SOA_TABLE(HfMcRecRedB0s, "AOD", "HFMCRECREDB0", //! Reconstruction-level MC information on B0 candidates for reduced workflow hf_cand_b0::FlagMcMatchRec, + hf_cand_b0::ChannelMcMatchRec, hf_cand_b0::FlagWrongCollision, hf_cand_b0::DebugMcRec, hf_b0_mc::PtMother); @@ -591,6 +814,7 @@ DECLARE_SOA_TABLE(HfMcCheckB0s, "AOD", "HFMCCHECKB0", //! Table with reconstruct DECLARE_SOA_TABLE(HfMcGenRedB0s, "AOD", "HFMCGENREDB0", //! Generation-level MC information on B0 candidates for reduced workflow hf_cand_b0::FlagMcMatchGen, + hf_cand_b0::ChannelMcMatchRec, hf_b0_mc::PtTrack, hf_b0_mc::YTrack, hf_b0_mc::EtaTrack, @@ -644,6 +868,16 @@ DECLARE_SOA_TABLE(HfMcRecRedD0Pis, "AOD", "HFMCRECREDD0PI", //! Table with recon hf_cand_bplus::DebugMcRec, hf_bplus_mc::PtMother); +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfMcRecRedJPKs, "AOD", "HFMCRECREDJPK", //! Table with reconstructed MC information on J/PsiK(<-B+) pairs for reduced workflow + hf_cand_bplus_reduced::JpsiId, + hf_cand_bplus_reduced::Prong1Id, + hf_cand_bplus::FlagMcMatchRec, + hf_cand_bplus::ChannelMcMatchRec, + hf_cand_bplus::FlagWrongCollision, + hf_cand_bplus::DebugMcRec, + hf_bplus_mc::PtMother); + // DECLARE_SOA_EXTENDED_TABLE_USER(ExTable, Tracks, "EXTABLE", DECLARE_SOA_TABLE(HfMcCheckD0Pis, "AOD", "HFMCCHECKD0PI", //! Table with reconstructed MC information on D0Pi(<-B0) pairs for MC checks in reduced workflow hf_bplus_mc::PdgCodeBeautyMother, @@ -656,6 +890,7 @@ DECLARE_SOA_TABLE(HfMcCheckD0Pis, "AOD", "HFMCCHECKD0PI", //! Table with reconst // Table with same size as HFCANDBPLUS DECLARE_SOA_TABLE(HfMcRecRedBps, "AOD", "HFMCRECREDBP", //! Reconstruction-level MC information on B+ candidates for reduced workflow hf_cand_bplus::FlagMcMatchRec, + hf_cand_bplus::ChannelMcMatchRec, hf_cand_bplus::FlagWrongCollision, hf_cand_bplus::DebugMcRec, hf_bplus_mc::PtMother); @@ -670,6 +905,7 @@ DECLARE_SOA_TABLE(HfMcCheckBps, "AOD", "HFMCCHECKBP", //! Table with reconstruct DECLARE_SOA_TABLE(HfMcGenRedBps, "AOD", "HFMCGENREDBP", //! Generation-level MC information on B+ candidates for reduced workflow hf_cand_bplus::FlagMcMatchGen, + hf_cand_bplus::ChannelMcMatchRec, hf_bplus_mc::PtTrack, hf_bplus_mc::YTrack, hf_bplus_mc::EtaTrack, @@ -687,6 +923,7 @@ namespace hf_cand_bplus_config DECLARE_SOA_COLUMN(MySelectionFlagD0, mySelectionFlagD0, int8_t); //! Flag to filter selected D0 mesons DECLARE_SOA_COLUMN(MySelectionFlagD0bar, mySelectionFlagD0bar, int8_t); //! Flag to filter selected D0 mesons DECLARE_SOA_COLUMN(MyInvMassWindowD0Pi, myInvMassWindowD0Pi, float); //! Half-width of the Bplus invariant-mass window in GeV/c2 +DECLARE_SOA_COLUMN(MyInvMassWindowJpsiK, myInvMassWindowJpsiK, float); //! Half-width of the Bplus invariant-mass window in GeV/c2 } // namespace hf_cand_bplus_config DECLARE_SOA_TABLE(HfCandBpConfigs, "AOD", "HFCANDBPCONFIG", //! Table with configurables information for reduced workflow @@ -694,6 +931,9 @@ DECLARE_SOA_TABLE(HfCandBpConfigs, "AOD", "HFCANDBPCONFIG", //! Table with confi hf_cand_bplus_config::MySelectionFlagD0bar, hf_cand_bplus_config::MyInvMassWindowD0Pi); +DECLARE_SOA_TABLE(HfCfgBpToJpsi, "AOD", "HFCFGBPTOJPSI", //! Table with configurables information for reduced workflow + hf_cand_bplus_config::MyInvMassWindowJpsiK); + namespace hf_bs_mc { // MC Rec @@ -726,6 +966,17 @@ DECLARE_SOA_TABLE(HfMcRecRedDsPis, "AOD", "HFMCRECREDDSPI", //! Table with recon hf_cand_bs::DebugMcRec, hf_bs_mc::PtMother); +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfMcRecRedJPPhis, "AOD", "HFMCRECREDJPPHI", //! Table with reconstructed MC information on DsPi(<-Bs) pairs for reduced workflow + hf_cand_bs_reduced::JpsiId, + hf_cand_bs_reduced::Prong0PhiId, + hf_cand_bs_reduced::Prong1PhiId, + hf_cand_bs::FlagMcMatchRec, + hf_cand_bs::ChannelMcMatchRec, + hf_cand_bs::FlagWrongCollision, + hf_cand_bs::DebugMcRec, + hf_bs_mc::PtMother); + // try with extended table ? // DECLARE_SOA_EXTENDED_TABLE_USER(ExTable, Tracks, "EXTABLE", DECLARE_SOA_TABLE(HfMcCheckDsPis, "AOD", "HFMCCHECKDSPI", //! Table with reconstructed MC information on DsPi(<-Bs) pairs for MC checks in reduced workflow @@ -740,6 +991,7 @@ DECLARE_SOA_TABLE(HfMcCheckDsPis, "AOD", "HFMCCHECKDSPI", //! Table with reconst // Table with same size as HFCANDBS DECLARE_SOA_TABLE(HfMcRecRedBss, "AOD", "HFMCRECREDBS", //! Reconstruction-level MC information on Bs candidates for reduced workflow hf_cand_bs::FlagMcMatchRec, + hf_cand_bs::ChannelMcMatchRec, hf_cand_bs::FlagWrongCollision, hf_cand_bs::DebugMcRec, hf_bs_mc::PtMother); @@ -755,6 +1007,7 @@ DECLARE_SOA_TABLE(HfMcCheckBss, "AOD", "HFMCCHECKBS", //! Table with reconstruct DECLARE_SOA_TABLE(HfMcGenRedBss, "AOD", "HFMCGENREDBS", //! Generation-level MC information on Bs candidates for reduced workflow hf_cand_bs::FlagMcMatchGen, + hf_cand_bs::ChannelMcMatchRec, hf_bs_mc::PtTrack, hf_bs_mc::YTrack, hf_bs_mc::EtaTrack, @@ -769,14 +1022,17 @@ DECLARE_SOA_TABLE(HfMcGenRedBss, "AOD", "HFMCGENREDBS", //! Generation-level MC // so we can use them in the Bs part namespace hf_cand_bs_config { -DECLARE_SOA_COLUMN(MySelectionFlagD, mySelectionFlagD, int8_t); //! Flag to filter selected Ds mesons -DECLARE_SOA_COLUMN(MyInvMassWindowDPi, myInvMassWindowDPi, float); //! Half-width of the Bs invariant-mass window in GeV/c2 +DECLARE_SOA_COLUMN(MySelectionFlagD, mySelectionFlagD, int8_t); //! Flag to filter selected Ds mesons +DECLARE_SOA_COLUMN(MyInvMassWindowDPi, myInvMassWindowDPi, float); //! Half-width of the Bs invariant-mass window in GeV/c2 +DECLARE_SOA_COLUMN(MyInvMassWindowJpsiPhi, myInvMassWindowJpsiPhi, float); //! Half-width of the Bs invariant-mass window in GeV/c2 } // namespace hf_cand_bs_config DECLARE_SOA_TABLE(HfCandBsConfigs, "AOD", "HFCANDBSCONFIG", //! Table with configurables information for reduced workflow hf_cand_bs_config::MySelectionFlagD, hf_cand_bs_config::MyInvMassWindowDPi); +DECLARE_SOA_TABLE(HfCfgBsToJpsis, "AOD", "HFCFGBSTOJPSI", //! Table with configurables information for reduced workflow + hf_cand_bs_config::MyInvMassWindowJpsiPhi); namespace hf_lb_mc { // MC Rec @@ -1053,7 +1309,7 @@ DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // deb DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D* DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass at generation level in GeV/c2 -DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! [](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); }); DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //! [](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); }); diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 928359768a9..a60ab1d78ab 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -11,6 +11,11 @@ # Candidate creators +o2physics_add_dpl_workflow(candidate-creator-b-to-jpsi-reduced + SOURCES candidateCreatorBToJpsiReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(candidate-creator-b0-reduced SOURCES candidateCreatorB0Reduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter @@ -70,6 +75,11 @@ o2physics_add_dpl_workflow(data-creator-charm-reso-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced + SOURCES dataCreatorJpsiHadReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) + # Converters o2physics_add_dpl_workflow(converter-reduced-3-prongs-ml diff --git a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx index 89562743ef4..6434b88e024 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx @@ -15,7 +15,13 @@ /// \author Alexandre Bigot , IPHC Strasbourg /// \author Fabrizio Grosa , CERN -#include +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -23,13 +29,7 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include using namespace o2; using namespace o2::aod; @@ -203,7 +203,7 @@ struct HfCandidateCreatorB0Reduced { rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); } } // pi loop - } // D loop + } // D loop } void processData(HfRedCollisionsWithExtras const& collisions, @@ -295,7 +295,7 @@ struct HfCandidateCreatorB0ReducedExpressions { if ((rowDPiMcRec.prong0Id() != candB0.prong0Id()) || (rowDPiMcRec.prong1Id() != candB0.prong1Id())) { continue; } - rowB0McRec(rowDPiMcRec.flagMcMatchRec(), rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); + rowB0McRec(rowDPiMcRec.flagMcMatchRec(), -1 /*channel*/, rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; if constexpr (checkDecayTypeMc) { rowB0McCheck(rowDPiMcRec.pdgCodeBeautyMother(), @@ -308,7 +308,7 @@ struct HfCandidateCreatorB0ReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D-Pi creator - rowB0McRec(0, -1, -1, -1.f); + rowB0McRec(0, -1, -1, -1, -1.f); if constexpr (checkDecayTypeMc) { rowB0McCheck(-1, -1, -1, -1, -1, -1); } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx new file mode 100644 index 00000000000..9fc5d845a04 --- /dev/null +++ b/PWGHF/D2H/TableProducer/candidateCreatorBToJpsiReduced.cxx @@ -0,0 +1,482 @@ +// 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 candidateCreatorBToJpsiReduced.cxx +/// \brief Reconstruction of B->J/Psi hadron candidates +/// +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino +/// \author Fabrizio Grosa , CERN + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.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::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_trkcandsel; + +enum DecayChannel : uint8_t { + B0ToJpsiK0Star = 0, + BplusToJpsiK, + BsToJpsiPhi +}; + +/// Reconstruction of B+ candidates +struct HfCandidateCreatorBToJpsiReduced { + Produces rowCandidateBpBase; // table defined in CandidateReconstructionTables.h + Produces rowCandidateBpProngs; // table defined in ReducedDataModel.h + Produces rowCandidateBsBase; // table defined in CandidateReconstructionTables.h + Produces rowCandidateBsProngs; // table defined in ReducedDataModel.h + + // vertexing + Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; + Configurable useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"}; + Configurable useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; + Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; + Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any B+ is smaller than this"}; + Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"}; + + Configurable runJpsiToee{"runJpsiToee", false, "Run analysis for J/Psi to ee (debug)"}; + // selection + Configurable invMassWindowJpsiHadTolerance{"invMassWindowJpsiHadTolerance", 0.01, "invariant-mass window tolerance for J/Psi K pair preselections (GeV/c2)"}; + + float myInvMassWindowJpsiK{1.}, myInvMassWindowJpsiPhi{1.}; // variable that will store the value of invMassWindowJpsiK (defined in dataCreatorJpsiKReduced.cxx) + double massBplus{0.}, massBs{0.}; + double bz{0.}; + o2::vertexing::DCAFitterN<2> df2; // fitter for B vertex (2-prong vertex fitter) + o2::vertexing::DCAFitterN<3> df3; // fitter for B vertex (3-prong vertex fitter) + o2::vertexing::DCAFitterN<4> df4; // fitter for B vertex (4-prong vertex fitter) + + using HfRedCollisionsWithExtras = soa::Join; + + Preslice> candsJpsiPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> tracksLf0PerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> tracksLf1PerCollision = hf_track_index_reduced::hfRedCollisionId; + + std::shared_ptr hCandidatesB, hCandidatesPhi; + o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + // invariant-mass window cut + massBplus = o2::constants::physics::MassBPlus; + massBs = o2::constants::physics::MassBS; + + // Initialize fitters + df2.setPropagateToPCA(propagateToPCA); + df2.setMaxR(maxR); + df2.setMaxDZIni(maxDZIni); + df2.setMinParamChange(minParamChange); + df2.setMinRelChi2Change(minRelChi2Change); + df2.setUseAbsDCA(useAbsDCA); + df2.setWeightedFinalPCA(useWeightedFinalPCA); + df2.setMatCorrType(noMatCorr); + + df3.setPropagateToPCA(propagateToPCA); + df3.setMaxR(maxR); + df3.setMaxDZIni(maxDZIni); + df3.setMinParamChange(minParamChange); + df3.setMinRelChi2Change(minRelChi2Change); + df3.setUseAbsDCA(useAbsDCA); + df3.setWeightedFinalPCA(useWeightedFinalPCA); + df3.setMatCorrType(noMatCorr); + + df4.setPropagateToPCA(propagateToPCA); + df4.setMaxR(maxR); + df4.setMaxDZIni(maxDZIni); + df4.setMinParamChange(minParamChange); + df4.setMinRelChi2Change(minRelChi2Change); + df4.setUseAbsDCA(useAbsDCA); + df4.setWeightedFinalPCA(useWeightedFinalPCA); + df4.setMatCorrType(noMatCorr); + + // histograms + registry.add("hMassJpsi", "J/Psi mass;#it{M}_{#mu#mu} (GeV/#it{c}^{2});Counts", {HistType::kTH1F, {{600, 2.5, 3.7, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassBplusToJpsiK", "2-prong candidates;inv. mass (B^{+} #rightarrow #overline{D^{0}}#pi^{#plus} #rightarrow #pi^{#minus}K^{#plus}#pi^{#plus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 3., 8.}}}); + registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}}); + registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}}); + registry.add("hEvents", "Events;;entries", HistType::kTH1F, {{1, 0.5, 1.5}}); + + /// candidate monitoring + hCandidatesB = registry.add("hFitCandidatesJpsi", "candidates counter", {HistType::kTH1D, {axisCands}}); + hCandidatesPhi = registry.add("hFitCandidatesPhi", "candidates counter", {HistType::kTH1D, {axisCands}}); + setLabelHistoCands(hCandidatesB); + setLabelHistoCands(hCandidatesPhi); + } + + /// Main function to perform B+ candidate creation + /// \param collision the collision + /// \param candsJpsiThisColl J/Psi candidates in this collision + /// \param tracksLfThisCollisionArr LF tracks in this collision + /// \param invMass2JpsiHadMin minimum B invariant-mass + /// \param invMass2JpsiHadMax maximum B invariant-mass + template + void runCandidateCreation(Coll const& collision, + Cands const& candsJpsiThisColl, + TTracks0 const& tracksLfDau0ThisCollision, + TTracks1 const& tracksLfDau1ThisCollision, + const float invMass2JpsiHadMin, + const float invMass2JpsiHadMax) + { + auto primaryVertex = getPrimaryVertex(collision); + auto covMatrixPV = primaryVertex.getCov(); + + // Set the magnetic field from ccdb + bz = collision.bz(); + df2.setBz(bz); + df3.setBz(bz); + df4.setBz(bz); + + for (const auto& candJpsi : candsJpsiThisColl) { + o2::track::TrackParametrizationWithError trackPosParCov( + candJpsi.xDauPos(), candJpsi.alphaDauPos(), {candJpsi.yDauPos(), candJpsi.zDauPos(), candJpsi.snpDauPos(), candJpsi.tglDauPos(), candJpsi.signed1PtDauPos()}, 1 /*Charge*/, 1 /*Muon*/); + o2::track::TrackParametrizationWithError trackNegParCov( + candJpsi.xDauNeg(), candJpsi.alphaDauNeg(), {candJpsi.yDauNeg(), candJpsi.zDauNeg(), candJpsi.snpDauNeg(), candJpsi.tglDauNeg(), candJpsi.signed1PtDauNeg()}, -1 /*Charge*/, 1 /*Muon*/); + + // --------------------------------- + // reconstruct J/Psi candidate + o2::track::TrackParCov trackParCovJpsi{}; + std::array pVecJpsi{}; + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::BeforeFit); + try { + if (df2.process(trackPosParCov, trackNegParCov) == 0) { + LOG(info) << "DCAFitterN failed to reconstruct J/Psi candidate, skipping the candidate."; + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::Fail); + continue; + } + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::FitOk); + + std::array pVecDauPos{candJpsi.pxDauPos(), candJpsi.pyDauPos(), candJpsi.pzDauPos()}; + std::array pVecDauNeg{candJpsi.pxDauNeg(), candJpsi.pyDauNeg(), candJpsi.pzDauNeg()}; + + df2.getTrack(0).getPxPyPzGlo(pVecDauPos); + df2.getTrack(1).getPxPyPzGlo(pVecDauNeg); + pVecJpsi = RecoDecay::pVec(pVecDauPos, pVecDauNeg); + trackParCovJpsi = df2.createParentTrackParCov(); + trackParCovJpsi.setAbsCharge(0); // to be sure + + float invMassJpsi{0.f}; + if (runJpsiToee) { + invMassJpsi = RecoDecay::m2(std::array{pVecDauPos, pVecDauNeg}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + } else { + invMassJpsi = RecoDecay::m2(std::array{pVecDauPos, pVecDauNeg}, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon}); + } + invMassJpsi = std::sqrt(invMassJpsi); + registry.fill(HIST("hMassJpsi"), invMassJpsi); + + for (const auto& trackLf0 : tracksLfDau0ThisCollision) { + // this track is among daughters + if (trackLf0.trackId() == candJpsi.prongPosId() || trackLf0.trackId() == candJpsi.prongNegId()) { + continue; + } + auto trackParCovLf0 = getTrackParCov(trackLf0); + std::array pVecTrackLf0{}; + if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + // --------------------------------- + // reconstruct the 3-prong B+ vertex + hCandidatesB->Fill(SVFitting::BeforeFit); + try { + if (df3.process(trackPosParCov, trackNegParCov, trackParCovLf0) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + hCandidatesB->Fill(SVFitting::Fail); + continue; + } + hCandidatesB->Fill(SVFitting::FitOk); + // JpsiK passed B+ reconstruction + + // calculate relevant properties + const auto& secondaryVertexBplus = df3.getPCACandidate(); + auto chi2PCA = df3.getChi2AtPCACandidate(); + auto covMatrixPCA = df3.calcPCACovMatrixFlat(); + registry.fill(HIST("hCovSVXX"), covMatrixPCA[0]); + registry.fill(HIST("hCovPVXX"), covMatrixPV[0]); + + // propagate Jpsi daugthers and K to the B+ vertex + df3.propagateTracksToVertex(); + // track.getPxPyPzGlo(pVec) modifies pVec of track + df3.getTrack(0).getPxPyPzGlo(pVecDauPos); // momentum of positive Jpsi daughter at the B+ vertex + df3.getTrack(1).getPxPyPzGlo(pVecDauNeg); // momentum of negative Jpsi daughter at the B+ vertex + df3.getTrack(2).getPxPyPzGlo(pVecTrackLf0); // momentum of K at the B+ vertex + + // compute invariant mass square and apply selection + auto invMass2JpsiK = RecoDecay::m2(std::array{pVecDauPos, pVecDauNeg, pVecTrackLf0}, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}); + if ((invMass2JpsiK < invMass2JpsiHadMin) || (invMass2JpsiK > invMass2JpsiHadMax)) { + continue; + } + registry.fill(HIST("hMassBplusToJpsiK"), std::sqrt(invMass2JpsiK)); + + // compute impact parameters of Jpsi and K + o2::dataformats::DCA dcaDauPos, dcaDauNeg, dcaKaon; + trackPosParCov.propagateToDCA(primaryVertex, bz, &dcaDauPos); + trackNegParCov.propagateToDCA(primaryVertex, bz, &dcaDauNeg); + trackParCovLf0.propagateToDCA(primaryVertex, bz, &dcaKaon); + + // get uncertainty of the decay length + double phi, theta; + // getPointDirection modifies phi and theta + getPointDirection(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertexBplus, phi, theta); + auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); + auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); + + // fill the candidate table for the B+ here: + rowCandidateBpBase(collision.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + secondaryVertexBplus[0], secondaryVertexBplus[1], secondaryVertexBplus[2], + errorDecayLength, errorDecayLengthXY, + chi2PCA, + pVecDauPos[0], pVecDauPos[1], pVecDauPos[2], + pVecDauNeg[0], pVecDauNeg[1], pVecDauNeg[2], + pVecTrackLf0[0], pVecTrackLf0[1], pVecTrackLf0[2], + dcaDauPos.getY(), dcaDauNeg.getY(), dcaKaon.getY(), + std::sqrt(dcaDauPos.getSigmaY2()), std::sqrt(dcaDauNeg.getSigmaY2()), std::sqrt(dcaKaon.getSigmaY2())); + + rowCandidateBpProngs(candJpsi.globalIndex(), trackLf0.globalIndex()); + } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + for (const auto& trackLf1 : tracksLfDau1ThisCollision) { + // this track is among daughters + if (trackLf1.trackId() == candJpsi.prongPosId() || trackLf1.trackId() == candJpsi.prongNegId()) { + continue; + } + auto trackParCovLf1 = getTrackParCov(trackLf1); + std::array pVecTrackLf1 = trackLf1.pVector(); + + // --------------------------------- + // reconstruct the 4-prong Bs vertex + hCandidatesB->Fill(SVFitting::BeforeFit); + try { + if (df4.process(trackPosParCov, trackNegParCov, trackParCovLf0, trackParCovLf1) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + hCandidatesB->Fill(SVFitting::Fail); + continue; + } + hCandidatesB->Fill(SVFitting::FitOk); + // passed Bs reconstruction + + // calculate relevant properties + const auto& secondaryVertexBs = df4.getPCACandidate(); + auto chi2PCA = df4.getChi2AtPCACandidate(); + auto covMatrixPCA = df4.calcPCACovMatrixFlat(); + registry.fill(HIST("hCovSVXX"), covMatrixPCA[0]); + registry.fill(HIST("hCovPVXX"), covMatrixPV[0]); + + // propagate Jpsi and phi to the Bs vertex + df4.propagateTracksToVertex(); + // track.getPxPyPzGlo(pVec) modifies pVec of track + df4.getTrack(0).getPxPyPzGlo(pVecDauPos); // momentum of Jpsi at the B+ vertex + df4.getTrack(1).getPxPyPzGlo(pVecDauNeg); // momentum of Jpsi at the B+ vertex + df4.getTrack(2).getPxPyPzGlo(pVecTrackLf0); // momentum of K at the B+ vertex + df4.getTrack(3).getPxPyPzGlo(pVecTrackLf1); // momentum of K at the B+ vertex + + // compute invariant mass square and apply selection + auto invMass2JpsiPhi = RecoDecay::m2(std::array{pVecDauPos, pVecDauNeg, pVecTrackLf0, pVecTrackLf1}, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); + if ((invMass2JpsiPhi < invMass2JpsiHadMin) || (invMass2JpsiPhi > invMass2JpsiHadMax)) { + continue; + } + registry.fill(HIST("hMassBplusToJpsiK"), std::sqrt(invMass2JpsiPhi)); + + // compute impact parameters of Jpsi and K + o2::dataformats::DCA dcaDauPos, dcaDauNeg, dcaTrackLf0, dcaTrackLf1; + trackPosParCov.propagateToDCA(primaryVertex, bz, &dcaDauPos); + trackNegParCov.propagateToDCA(primaryVertex, bz, &dcaDauNeg); + trackParCovLf0.propagateToDCA(primaryVertex, bz, &dcaTrackLf0); + trackParCovLf1.propagateToDCA(primaryVertex, bz, &dcaTrackLf1); + + // get uncertainty of the decay length + double phi, theta; + // getPointDirection modifies phi and theta + getPointDirection(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertexBs, phi, theta); + auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); + auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); + + // fill the candidate table for the Bs here: + rowCandidateBsBase(collision.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + secondaryVertexBs[0], secondaryVertexBs[1], secondaryVertexBs[2], + errorDecayLength, errorDecayLengthXY, + chi2PCA, + pVecDauPos[0], pVecDauPos[1], pVecDauPos[2], + pVecDauNeg[0], pVecDauNeg[1], pVecDauPos[2], + pVecTrackLf0[0], pVecTrackLf0[1], pVecTrackLf0[2], + pVecTrackLf1[0], pVecTrackLf1[1], pVecTrackLf0[2], + dcaDauPos.getY(), dcaDauNeg.getY(), dcaTrackLf0.getY(), dcaTrackLf1.getY(), + std::sqrt(dcaDauPos.getSigmaY2()), std::sqrt(dcaDauNeg.getSigmaY2()), std::sqrt(dcaTrackLf0.getSigmaY2()), std::sqrt(dcaTrackLf1.getSigmaY2())); + rowCandidateBsProngs(candJpsi.globalIndex(), trackLf0.globalIndex(), trackLf1.globalIndex()); + } + } + } // TrackLf0 loop + } // J/Psi loop + } // end runCandidateCreation + + void processDataBplus(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsJpsi, + soa::Join const& tracksKaon, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCfgBpToJpsi const& configs) + { + // Jpsi K invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowJpsiK = config.myInvMassWindowJpsiK(); + } + // invMassWindowJpsiHadTolerance is used to apply a slightly tighter cut than in JpsiK pair preselection + // to avoid accepting JpsiK pairs that were not formed in JpsiK pair creator + double invMass2JpsiKMin = (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance) * (massBplus - myInvMassWindowJpsiK + invMassWindowJpsiHadTolerance); + double invMass2JpsiKMax = (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance) * (massBplus + myInvMassWindowJpsiK - invMassWindowJpsiHadTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto tracksKaonThisCollision = tracksKaon.sliceBy(tracksLf0PerCollision, thisCollId); + runCandidateCreation(collision, candsJpsiThisColl, tracksKaonThisCollision, tracksKaonThisCollision, invMass2JpsiKMin, invMass2JpsiKMax); + } + } // processDataBplus + PROCESS_SWITCH(HfCandidateCreatorBToJpsiReduced, processDataBplus, "Process data for B+", true); + + void processDataBs(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsJpsi, + soa::Join const& tracksLfDau0, + soa::Join const& tracksLfDau1, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCfgBsToJpsis const& configs) + { + // Jpsi K invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowJpsiPhi = config.myInvMassWindowJpsiPhi(); + } + // invMassWindowJpsiHadTolerance is used to apply a slightly tighter cut than in JpsiK pair preselection + // to avoid accepting JpsiK pairs that were not formed in JpsiK pair creator + double invMass2JpsiKMin = (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance) * (massBs - myInvMassWindowJpsiPhi + invMassWindowJpsiHadTolerance); + double invMass2JpsiKMax = (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance) * (massBs + myInvMassWindowJpsiPhi - invMassWindowJpsiHadTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto tracksLf0ThisCollision = tracksLfDau0.sliceBy(tracksLf0PerCollision, thisCollId); + auto tracksLf1ThisCollision = tracksLfDau1.sliceBy(tracksLf1PerCollision, thisCollId); + runCandidateCreation(collision, candsJpsiThisColl, tracksLf0ThisCollision, tracksLf1ThisCollision, invMass2JpsiKMin, invMass2JpsiKMax); + } + } // processDataBs + PROCESS_SWITCH(HfCandidateCreatorBToJpsiReduced, processDataBs, "Process data for Bs", false); +}; // struct + +/// Extends the table base with expression columns and performs MC matching. +struct HfCandidateCreatorBToJpsiReducedExpressions { + Spawns rowCandidateBPlus; + Spawns rowCandidateBs; + Spawns rowTracksExt0; + Spawns rowTracksExt1; + Produces rowBplusMcRec; + Produces rowBsMcRec; + + /// Fill candidate information at MC reconstruction level + /// \param rowsJpsiHadMcRec MC reco information on Jpsi hadron pairs + /// \param candsBIds prong global indices of B candidates + template + void fillMcRec(McRec const& rowsJpsiHadMcRec, CCands const& candsBIds) + { + for (const auto& candB : candsBIds) { + bool filledMcInfo{false}; + if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + for (const auto& rowJpsiHadMcRec : rowsJpsiHadMcRec) { + if ((rowJpsiHadMcRec.jpsiId() != candB.jpsiId()) || (rowJpsiHadMcRec.prong1Id() != candB.bachKaId())) { + continue; + } + rowBplusMcRec(rowJpsiHadMcRec.flagMcMatchRec(), rowJpsiHadMcRec.channelMcMatchRec(), rowJpsiHadMcRec.flagWrongCollision(), rowJpsiHadMcRec.debugMcRec(), rowJpsiHadMcRec.ptMother()); + filledMcInfo = true; + break; + } + if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the Jpsi-K creator + rowBplusMcRec(0, -1, -1, -1, -1.f); + } + } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + for (const auto& rowJpsiHadMcRec : rowsJpsiHadMcRec) { + if ((rowJpsiHadMcRec.jpsiId() != candB.jpsiId()) || (rowJpsiHadMcRec.prong0PhiId() != candB.prong0PhiId()) || (rowJpsiHadMcRec.prong1PhiId() != candB.prong1PhiId())) { + continue; + } + rowBsMcRec(rowJpsiHadMcRec.flagMcMatchRec(), rowJpsiHadMcRec.channelMcMatchRec(), rowJpsiHadMcRec.flagWrongCollision(), rowJpsiHadMcRec.debugMcRec(), rowJpsiHadMcRec.ptMother()); + filledMcInfo = true; + break; + } + if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the Jpsi-K creator + rowBsMcRec(0, -1, -1, -1, -1.f); + } + } + } + } + + void processMcBPlus(HfMcRecRedJPKs const& rowsJpsiKMcRec, HfRedBplus2JpsiDaus const& candsBplus) + { + fillMcRec(rowsJpsiKMcRec, candsBplus); + } + PROCESS_SWITCH(HfCandidateCreatorBToJpsiReducedExpressions, processMcBPlus, "Process MC", false); + + void processMcBs(HfMcRecRedJPPhis const& rowsJpsiPhiMcRec, HfRedBs2JpsiDaus const& Bs) + { + fillMcRec(rowsJpsiPhiMcRec, Bs); + } + PROCESS_SWITCH(HfCandidateCreatorBToJpsiReducedExpressions, processMcBs, "Process MC", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx index 3cd3e0f571b..bbd8f9df356 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx @@ -14,7 +14,13 @@ /// /// \author Antonio Palasciano , Università degli Studi di Bari -#include +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -23,13 +29,7 @@ #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include using namespace o2; using namespace o2::aod; @@ -293,7 +293,7 @@ struct HfCandidateCreatorBplusReducedExpressions { if ((rowD0PiMcRec.prong0Id() != candBplus.prong0Id()) || (rowD0PiMcRec.prong1Id() != candBplus.prong1Id())) { continue; } - rowBplusMcRec(rowD0PiMcRec.flagMcMatchRec(), rowD0PiMcRec.flagWrongCollision(), rowD0PiMcRec.debugMcRec(), rowD0PiMcRec.ptMother()); + rowBplusMcRec(rowD0PiMcRec.flagMcMatchRec(), -1 /*channel*/, rowD0PiMcRec.flagWrongCollision(), rowD0PiMcRec.debugMcRec(), rowD0PiMcRec.ptMother()); filledMcInfo = true; if constexpr (checkDecayTypeMc) { rowBplusMcCheck(rowD0PiMcRec.pdgCodeBeautyMother(), @@ -305,7 +305,7 @@ struct HfCandidateCreatorBplusReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D0-Pi creator - rowBplusMcRec(0, -1, -1, -1.f); + rowBplusMcRec(0, -1, -1, -1, -1.f); if constexpr (checkDecayTypeMc) { rowBplusMcCheck(-1, -1, -1, -1, -1); } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx index 7198796bc9b..a20adc78f7e 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx @@ -14,7 +14,13 @@ /// /// \author Fabio Catalano , CERN -#include +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -22,13 +28,7 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include using namespace o2; using namespace o2::aod; @@ -292,7 +292,7 @@ struct HfCandidateCreatorBsReducedExpressions { if ((rowDPiMcRec.prong0Id() != candB.prong0Id()) || (rowDPiMcRec.prong1Id() != candB.prong1Id())) { continue; } - rowBsMcRec(rowDPiMcRec.flagMcMatchRec(), rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); + rowBsMcRec(rowDPiMcRec.flagMcMatchRec(), -1 /*channel*/, rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; if constexpr (checkDecayTypeMc) { rowBsMcCheck(rowDPiMcRec.pdgCodeBeautyMother(), @@ -305,7 +305,7 @@ struct HfCandidateCreatorBsReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the DsPi creator - rowBsMcRec(0, -1, -1, -1.f); + rowBsMcRec(0, -1, -1, -1, -1.f); if constexpr (checkDecayTypeMc) { rowBsMcCheck(-1, -1, -1, -1, -1, -1); } diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index d03f8d9eda0..fde8c3b553e 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -18,24 +18,6 @@ /// \author Fabio Catalano , CERN /// \author Biao Zhang , Heidelberg University -#include -#include -#include -#include -#include - -#include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/DCAFitterN.h" -#include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Qvectors.h" - #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/D2H/DataModel/ReducedDataModel.h" @@ -46,6 +28,24 @@ #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Utils/utilsTrkCandHf.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/Qvectors.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::analysis; using namespace o2::aod; @@ -341,7 +341,7 @@ struct HfDataCreatorCharmHadPiReduced { return false; } // minimum pT and eta selection - if (trackParCovPion.getPt() < trackPionConfigurations.ptPionMin || std::abs(trackParCovPion.getEta()) > trackPionConfigurations.etaPionMax || !isSelectedTrackDCA(trackParCovPion, dcaPion)) { + if (trackParCovPion.getPt() < trackPionConfigurations.ptPionMin || std::abs(trackParCovPion.getEta()) > trackPionConfigurations.etaPionMax || !isSelectedTrackDCA(trackParCovPion, dcaPion, trackPionConfigurations.binsPtPion, trackPionConfigurations.cutsTrackPionDCA)) { return false; } // reject pions that are charm-hadron daughters @@ -354,27 +354,6 @@ struct HfDataCreatorCharmHadPiReduced { return true; } - /// Single-track cuts for pions on dcaXY - /// \param trackPar is the track parametrisation - /// \param dca is the 2-D array with track DCAs - /// \return true if track passes all cuts - template - bool isSelectedTrackDCA(const T1& trackPar, const T2& dca) - { - auto pTBinTrack = findBin(trackPionConfigurations.binsPtPion, trackPar.getPt()); - if (pTBinTrack == -1) { - return false; - } - - if (std::abs(dca[0]) < trackPionConfigurations.cutsTrackPionDCA->get(pTBinTrack, "min_dcaxytoprimary")) { - return false; // minimum DCAxy - } - if (std::abs(dca[0]) > trackPionConfigurations.cutsTrackPionDCA->get(pTBinTrack, "max_dcaxytoprimary")) { - return false; // maximum DCAxy - } - return true; - } - /// Calculates the index of the collision with the maximum number of contributions. ///\param collisions are the collisions to search through. ///\return The index of the collision with the maximum number of contributions. @@ -1332,7 +1311,7 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfB0McGenReduced(flag, ptParticle, yParticle, etaParticle, + rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1]); } else if constexpr (decayChannel == DecayChannel::BsToDsminusPi) { @@ -1407,7 +1386,7 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfBsMcGenReduced(flag, ptParticle, yParticle, etaParticle, + rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1]); } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { @@ -1440,7 +1419,7 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfBpMcGenReduced(flag, ptParticle, yParticle, etaParticle, + rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1]); } else if constexpr (decayChannel == DecayChannel::LbToLcplusPi) { diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx new file mode 100644 index 00000000000..3a382d62dcf --- /dev/null +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -0,0 +1,1120 @@ +// 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 dataCreatorJpsiHadReduced.cxx +/// \brief Creation of J/Psi-LF hadron pairs for Beauty hadron analyses +/// +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino +/// \author Fabrizio Grosa , CERN + +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.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 +#include +#include +#include + +using namespace o2; +using namespace o2::analysis; +using namespace o2::aod; +using namespace o2::constants::physics; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_trkcandsel; + +enum Event : uint8_t { // TODO: check if needed + Processed = 0, + NoCharmHadPiSelected, + CharmHadPiSelected, + NEvent +}; + +enum DecayChannel : uint8_t { + B0ToJpsiK0Star = 0, + BplusToJpsiK, + BsToJpsiPhi +}; + +enum WrongCollisionType : uint8_t { + None = 0, + WrongAssociation, + SplitCollision, +}; + +/// Creation of Jpsi-Had pairs for Beauty hadrons +struct HfDataCreatorJpsiHadReduced { + // Produces AOD tables to store track information + // collision related tables + Produces hfReducedCollision; + Produces hfReducedCollCentrality; + Produces hfReducedQvector; + Produces hfReducedCollExtra; + Produces hfCollisionCounter; + // J/Psi related tables + Produces hfJpsi; + Produces hfRedJpsiCov; + // Ka bachelor related tables + Produces hfTrackLfDau0; + Produces hfTrackCovLfDau0; + Produces hfTrackLfDau1; + Produces hfTrackCovLfDau1; + // MC related tables + Produces rowHfJpsiKMcRecReduced; + Produces rowHfJpsiPhiMcRecReduced; + Produces rowHfBpMcGenReduced; + Produces rowHfBsMcGenReduced; + + Produces rowCandidateConfigBplus; + Produces rowCandidateConfigBs; + + Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; + Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; + Configurable useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; + Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; + Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any B0 is smaller than this"}; + Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"}; + + Configurable runJpsiToee{"runJpsiToee", false, "Run analysis for J/Psi to ee (debug)"}; + Configurable ptJpsiMin{"ptJpsiMin", 0., "Lower bound of J/Psi pT"}; + Configurable ptJpsiMax{"ptJpsiMax", 50., "Upper bound of J/Psi pT"}; + Configurable useTrackIsGlobalTrackWoDCA{"useTrackIsGlobalTrackWoDCA", true, "check isGlobalTrackWoDCA status for the bachelor tracks"}; + Configurable ptTrackMin{"ptTrackMin", 0.5, "minimum bachelor track pT threshold (GeV/c)"}; + Configurable absEtaTrackMax{"absEtaTrackMax", 0.8, "maximum bachelor track absolute eta threshold"}; + Configurable> binsPtTrack{"binsPtTrack", std::vector{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for bachelor track DCA XY pT-dependent cut"}; + Configurable> cutsTrackDCA{"cutsTrackDCA", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for bachelor track"}; + // topological/kinematic cuts + Configurable> binsPt{"binsPt", std::vector{hf_cuts_jpsi_to_mu_mu::vecBinsPt}, "J/Psi pT bin limits"}; + Configurable> cuts{"cuts", {hf_cuts_jpsi_to_mu_mu::Cuts[0], hf_cuts_jpsi_to_mu_mu::NBinsPt, hf_cuts_jpsi_to_mu_mu::NCutVars, hf_cuts_jpsi_to_mu_mu::labelsPt, hf_cuts_jpsi_to_mu_mu::labelsCutVar}, "J/Psi candidate selection per pT bin"}; + Configurable invMassWindowJpsiHad{"invMassWindowJpsiHad", 0.3, "invariant-mass window for Jpsi-Had pair preselections (GeV/c2)"}; + Configurable deltaMPhiMax{"deltaMPhiMax", 0.02, "invariant-mass window for phi preselections (GeV/c2) (only for Bs->J/PsiPhi)"}; + Configurable cpaMin{"cpaMin", 0., "Minimum cosine of pointing angle for B candidates"}; + Configurable decLenMin{"decLenMin", 0., "Minimum decay length for B candidates"}; + + // magnetic field setting from CCDB + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; + + HfHelper hfHelper; + + // CCDB service + Service ccdb; + // O2DatabasePDG service + Service pdg; + + using TracksPid = soa::Join; + using TracksPidWithSel = soa::Join; + using TracksSel = soa::Join; + using TracksPidWithSelAndMc = soa::Join; + using CollisionsWCMcLabels = soa::Join; + + Preslice candsJpsiPerCollision = aod::track_association::collisionId; + Preslice trackIndicesPerCollision = aod::track_association::collisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + + o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + int runNumber; + double bz{0.}; + double invMass2JpsiHadMin, invMass2JpsiHadMax; + bool isHfCandBhadConfigFilled = false; + + o2::hf_evsel::HfEventSelection hfEvSel; + o2::vertexing::DCAFitterN<2> df2; + o2::vertexing::DCAFitterN<3> df3; + o2::vertexing::DCAFitterN<4> df4; + + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + std::array doProcess = {doprocessJpsiKData, doprocessJpsiKMc, doprocessJpsiPhiData, doprocessJpsiPhiMc}; + if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { + LOGP(fatal, "One and only one process function can be enabled at a time, please fix your configuration!"); + } + + // Set up the histogram registry + constexpr int kNBinsSelections = 2 + aod::SelectionStep::RecoTopol; + std::string labels[kNBinsSelections]; + labels[0] = "No selection"; + labels[1 + aod::SelectionStep::RecoSkims] = "Skims selection"; + labels[1 + aod::SelectionStep::RecoTopol] = "Skims & Topological selections"; + static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; + registry.add("hSelectionsJpsi", "J/Psi selection;;#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {axisSelections, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { + registry.get(HIST("hSelectionsJpsi"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + + constexpr int kNBinsEvents = NEvent; + std::string labelsEvents[kNBinsEvents]; + labelsEvents[Event::Processed] = "processed"; + labelsEvents[Event::NoCharmHadPiSelected] = "without CharmHad-Pi pairs"; + labelsEvents[Event::CharmHadPiSelected] = "with CharmHad-Pi pairs"; + static const AxisSpec axisEvents = {kNBinsEvents, 0.5, kNBinsEvents + 0.5, ""}; + registry.add("hEvents", "Events;;entries", HistType::kTH1F, {axisEvents}); + for (int iBin = 0; iBin < kNBinsEvents; iBin++) { + registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labelsEvents[iBin].data()); + } + + registry.add("hMassJpsi", "J/Psi mass;#it{M}_{#mu#mu} (GeV/#it{c}^{2});Counts", {HistType::kTH1F, {{600, 2.8, 3.4, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtJpsi", "J/Psi #it{p}_{T};#it{p}_{T} (GeV/#it{c});Counts", {HistType::kTH1F, {{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCpaJpsi", "J/Psi cos#theta_{p};J/Psi cos#theta_{p};Counts", {HistType::kTH1F, {{200, -1., 1, "J/Psi cos#theta_{p}"}}}); + std::shared_ptr hFitCandidatesJpsi = registry.add("hFitCandidatesJpsi", "Jpsi candidate counter", {HistType::kTH1D, {axisCands}}); + std::shared_ptr hFitCandidatesBPlus = registry.add("hFitCandidatesBPlus", "hFitCandidatesBPlus candidate counter", {HistType::kTH1D, {axisCands}}); + std::shared_ptr hFitCandidatesBS = registry.add("hFitCandidatesBS", "hFitCandidatesBS candidate counter", {HistType::kTH1D, {axisCands}}); + setLabelHistoCands(hFitCandidatesJpsi); + setLabelHistoCands(hFitCandidatesBPlus); + setLabelHistoCands(hFitCandidatesBS); + if (doprocessJpsiKData || doprocessJpsiKMc) { + registry.add("hPtKaon", "Kaon #it{p}_{T};#it{p}_{T} (GeV/#it{c});Counts", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("hMassJpsiKaon", "J/Psi Kaon mass;#it{M}_{J/#PsiK} (GeV/#it{c}^{2});Counts", {HistType::kTH1F, {{800, 4.9, 5.7}}}); + } else if (doprocessJpsiPhiData || doprocessJpsiPhiMc) { + registry.add("hPtPhi", "Phi #it{p}_{T};#it{p}_{T} (GeV/#it{c});Counts", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("hMassPhi", "Phi mass;#it{M}_{KK} (GeV/#it{c}^{2});Counts", {HistType::kTH1F, {{200, 0.9, 1.2}}}); + registry.add("hMassJpsiPhi", "J/Psi Phi mass;#it{M}_{J/#Psi#phi} (GeV/#it{c}^{2});Counts", {HistType::kTH1F, {{800, 4.9, 5.7}}}); + std::shared_ptr hFitCandidatesPhi = registry.add("hFitCandidatesPhi", "Phi candidate counter", {HistType::kTH1D, {axisCands}}); + setLabelHistoCands(hFitCandidatesPhi); + } + + df2.setPropagateToPCA(propagateToPCA); + df2.setMaxR(maxR); + df2.setMaxDZIni(maxDZIni); + df2.setMinParamChange(minParamChange); + df2.setMinRelChi2Change(minRelChi2Change); + df2.setUseAbsDCA(useAbsDCA); + df2.setWeightedFinalPCA(useWeightedFinalPCA); + df2.setMatCorrType(noMatCorr); + + df3.setPropagateToPCA(propagateToPCA); + df3.setMaxR(maxR); + df3.setMaxDZIni(maxDZIni); + df3.setMinParamChange(minParamChange); + df3.setMinRelChi2Change(minRelChi2Change); + df3.setUseAbsDCA(useAbsDCA); + df3.setWeightedFinalPCA(useWeightedFinalPCA); + df3.setMatCorrType(noMatCorr); + + df4.setPropagateToPCA(propagateToPCA); + df4.setMaxR(maxR); + df4.setMaxDZIni(maxDZIni); + df4.setMinParamChange(minParamChange); + df4.setMinRelChi2Change(minRelChi2Change); + df4.setUseAbsDCA(useAbsDCA); + df4.setWeightedFinalPCA(useWeightedFinalPCA); + df4.setMatCorrType(noMatCorr); + + // Configure CCDB access + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + runNumber = 0; + + if (doprocessJpsiKData || doprocessJpsiKMc) { + invMass2JpsiHadMin = (MassBPlus - invMassWindowJpsiHad) * (MassBPlus - invMassWindowJpsiHad); + invMass2JpsiHadMax = (MassBPlus + invMassWindowJpsiHad) * (MassBPlus + invMassWindowJpsiHad); + } else if (doprocessJpsiPhiData || doprocessJpsiPhiMc) { + invMass2JpsiHadMin = (MassBS - invMassWindowJpsiHad) * (MassBS - invMassWindowJpsiHad); + invMass2JpsiHadMax = (MassBS + invMassWindowJpsiHad) * (MassBS + invMassWindowJpsiHad); + } + } + + /// Topological cuts + /// \param candidate is candidate + /// \param trackPos is the positive track + /// \param trackNeg is the negative track + /// \return true if candidate passes all cuts + template + bool selectionTopol(const T1& candidate, const T2& trackPos, const T2& trackNeg) + { + auto candpT = candidate.pt(); + auto candInvMass = runJpsiToee ? hfHelper.invMassJpsiToEE(candidate) : hfHelper.invMassJpsiToMuMu(candidate); + auto pseudoPropDecLen = candidate.decayLengthXY() * candInvMass / candpT; + auto pTBin = findBin(binsPt, candpT); + if (pTBin == -1) { + return false; + } + + // check that the candidate pT is within the analysis range + if (candpT < ptJpsiMin || candpT >= ptJpsiMax) { + return false; + } + + // cut on μ+ μ− (e+e−) invariant mass + if (std::abs(candInvMass - o2::constants::physics::MassJPsi) > cuts->get(pTBin, "m")) { + return false; + } + + // cut on daughter pT (same cut used for both channels) + if (trackNeg.pt() < cuts->get(pTBin, "pT mu") || trackPos.pt() < cuts->get(pTBin, "pT mu")) { + return false; + } + + // decay length + if (candidate.decayLength() < cuts->get(pTBin, "decay length")) { + return false; + } + + // decay length in XY plane + if (candidate.decayLengthXY() < cuts->get(pTBin, "decay length xy")) { + return false; + } + + // cosine of pointing angle + if (candidate.cpa() < cuts->get(pTBin, "cpa")) { + return false; + } + + // cosine of pointing angle XY + if (candidate.cpaXY() < cuts->get(pTBin, "cpa xy")) { + return false; + } + + // product of daughter impact parameters + if (candidate.impactParameterProduct() > cuts->get(pTBin, "d0xd0")) { + return false; + } + + // pseudoproper decay length + if (pseudoPropDecLen < cuts->get(pTBin, "pseudoprop. decay length")) { + return false; + } + + return true; + } + + /// Kaon selection (J/Psi K+ <-- B+) + /// \param track is the considered track + /// \param trackParCov is the track parametrisation + /// \param dca is the 2-D array with track DCAs + /// \param jPsiDautracks J/Psi daughter tracks + /// \return true if track passes all cuts + template + bool isTrackSelected(const T1& track, const T2& trackParCov, const T3& dca, const std::vector& jPsiDautracks) + { + // check isGlobalTrackWoDCA status for kaons if wanted + if (useTrackIsGlobalTrackWoDCA && !track.isGlobalTrackWoDCA()) { + return false; + } + // minimum pT, eta, and DCA selection + if (trackParCov.getPt() < ptTrackMin || std::abs(trackParCov.getEta()) > absEtaTrackMax || !isSelectedTrackDCA(trackParCov, dca, binsPtTrack, cutsTrackDCA)) { + return false; + } + // reject kaons that are J/Psi daughters + for (const auto& trackJpsi : jPsiDautracks) { + if (track.globalIndex() == trackJpsi.globalIndex()) { + return false; + } + } + + return true; + } + + /// B meson preselections + /// \param momentum is the B meson momentum + /// \param secondaryVertex is the reconstructed secondary vertex + /// \param collision is the reconstructed collision + template + bool isBSelected(const T1& momentum, const T2& secondaryVertex, const T3& collision) + { + // B candidate CPA + if (RecoDecay::cpa(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertex, momentum) < cpaMin) { + return false; + } + + // B candidate decay length + if (RecoDecay::distance(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertex) < decLenMin) { + return false; + } + + return true; + } + + /// Checks if the B meson is associated with a different collision than the one it was generated in + /// \param particleMother is the mother particle + /// \param collision is the reconstructed collision + /// \param indexCollisionMaxNumContrib is the index of the collision associated with a given MC collision with the largest number of contributors. + /// \param flagWrongCollision is the flag indicating if whether the associated collision is incorrect. + template + void checkWrongCollision(const PParticle& particleMother, + const CColl& collision, + const int64_t& indexCollisionMaxNumContrib, + int8_t& flagWrongCollision) + { + + if (particleMother.mcCollision().globalIndex() != collision.mcCollisionId()) { + flagWrongCollision = WrongCollisionType::WrongAssociation; + } else { + if (collision.globalIndex() != indexCollisionMaxNumContrib) { + flagWrongCollision = WrongCollisionType::SplitCollision; + } + } + } + + /// Function for filling MC reco information in the tables + /// \param particlesMc is the table with MC particles + /// \param vecDaughtersB is the vector with all daughter tracks (Jpsi daughters in first position) + /// \param indexHfCandJpsi is the index of the Jpsi candidate + /// \param selectedTracksBach is the map with the indices of selected bachelor pion tracks + template + void fillMcRecoInfo(const CColl& collision, + const PParticles& particlesMc, + const std::vector& vecDaughtersB, + int& indexHfCandJpsi, + std::array, 2> selectedTracksBach, + const int64_t indexCollisionMaxNumContrib) + { + + // we check the MC matching to be stored + int8_t sign{0}, flag{0}, channel{0}; + int8_t flagWrongCollision{WrongCollisionType::None}; + int8_t debug{0}; + float motherPt{-1.f}; + + if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + // B+ → J/Psi K+ → (µ+µ-) K+ + int indexRec = -1; + if (!runJpsiToee) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{-kMuonMinus, +kMuonMinus, +kKPlus}, true, &sign, 3); + } else { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{-kElectron, +kElectron, +kKPlus}, true, &sign, 3); + } + if (indexRec > -1) { + // J/Psi → µ+µ- + if (!runJpsiToee) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kJPsi, std::array{-kMuonMinus, +kMuonMinus}, true); + } else { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kJPsi, std::array{-kElectron, +kElectron}, true); + } + if (indexRec > -1) { + flag = sign * o2::hf_decay::hf_cand_beauty::BplusToJpsiK; + } else { + debug = 1; + LOGF(debug, "B+ decays in the expected final state but the condition on the intermediate state is not fulfilled"); + } + + auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBPlus, true); + if (indexMother >= 0) { + auto particleMother = particlesMc.rawIteratorAt(indexMother); + motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + } + } + rowHfJpsiKMcRecReduced(indexHfCandJpsi, selectedTracksBach[0][vecDaughtersB.back().globalIndex()], flag, channel, flagWrongCollision, debug, motherPt); + } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + // Bs → J/Psi phi → (µ+µ-) (K+K-) + int indexRec = -1; + if (!runJpsiToee) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kMuonMinus, +kMuonMinus, +kKPlus, -kKPlus}, true, &sign, 4); + } else { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kElectron, +kElectron, +kKPlus, -kKPlus}, true, &sign, 4); + } + if (indexRec > -1) { + // J/Psi → µ+µ- + if (!runJpsiToee) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kJPsi, std::array{-kMuonMinus, +kMuonMinus}, true, &sign, 1); + } else { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kJPsi, std::array{-kElectron, +kElectron}, true, &sign, 1); + } + if (indexRec > -1) { + flag = sign * o2::hf_decay::hf_cand_beauty::BsToJpsiKK; + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kPhi, std::array{-kKPlus, +kKPlus}, true, &sign, 1); + if (indexRec > -1) { + channel = o2::hf_decay::hf_cand_beauty::BsToJpsiPhi; + } else { + debug = 1; + LOGF(debug, "Bs decays in the expected final state but the condition on the phi intermediate state is not fulfilled"); + } + } else { + debug = 1; + LOGF(debug, "Bs decays in the expected final state but the condition on the J/Psi intermediate state is not fulfilled"); + } + + auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBS, true); + if (indexMother >= 0) { + auto particleMother = particlesMc.rawIteratorAt(indexMother); + motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + } + } + rowHfJpsiPhiMcRecReduced(indexHfCandJpsi, selectedTracksBach[0][vecDaughtersB.back().globalIndex()], selectedTracksBach[1][vecDaughtersB.back().globalIndex()], flag, channel, flagWrongCollision, debug, motherPt); + } + } + + /// Calculates the index of the collision with the maximum number of contributions. + ///\param collisions are the collisions to search through. + ///\return The index of the collision with the maximum number of contributions. + template + int64_t getIndexCollisionMaxNumContrib(const CColl& collisions) + { + unsigned maxNumContrib = 0; + int64_t indexCollisionMaxNumContrib = -1; + for (const auto& collision : collisions) { + if (collision.numContrib() > maxNumContrib) { + maxNumContrib = collision.numContrib(); + indexCollisionMaxNumContrib = collision.globalIndex(); + } + } + return indexCollisionMaxNumContrib; + } + + template + void runMcGen(aod::McParticles const& particlesMc) + { + // Match generated particles. + for (const auto& particle : particlesMc) { + int8_t sign{0}, flag{0}, channel{0}; + if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + // B+ → J/Psi K+ → (µ+µ-) K+ + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{static_cast(Pdg::kJPsi), +kKPlus}, true, &sign)) { + // Match J/Psi -> µ+µ- + auto candJpsiMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // Printf("Checking J/Psi -> µ+µ-"); + if (!runJpsiToee) { + if (RecoDecay::isMatchedMCGen(particlesMc, candJpsiMC, static_cast(Pdg::kJPsi), std::array{-kMuonMinus, +kMuonMinus}, true)) { + flag = sign * o2::hf_decay::hf_cand_beauty::BplusToJpsiK; + } + } else { // debug + // Printf("Checking J/Psi -> e+e-"); + if (RecoDecay::isMatchedMCGen(particlesMc, candJpsiMC, static_cast(Pdg::kJPsi), std::array{-kElectron, +kElectron}, true)) { + flag = sign * o2::hf_decay::hf_cand_beauty::BplusToJpsiK; + } + } + } + + // save information for B+ task + if (std::abs(flag) != o2::hf_decay::hf_cand_beauty::BplusToJpsiK) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), MassBPlus); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + for (const auto& daught : particle.daughters_as()) { + ptProngs[counter] = daught.pt(); + etaProngs[counter] = daught.eta(); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); + counter++; + } + rowHfBpMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + // Bs → J/Psi phi → (µ+µ-) (K+K-) + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{static_cast(Pdg::kJPsi), +kKPlus, -kKPlus}, true, &sign, 2)) { + // Match J/Psi -> µ+µ- and phi -> K+K- + auto candJpsiMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + auto candPhiMC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + // Printf("Checking J/Psi -> µ+µ- and phi -> K+K-"); + if (runJpsiToee && RecoDecay::isMatchedMCGen(particlesMc, candJpsiMC, static_cast(Pdg::kJPsi), std::array{-kElectron, +kElectron}, true)) { + flag = sign * o2::hf_decay::hf_cand_beauty::BsToJpsiKK; + } else if (!runJpsiToee && RecoDecay::isMatchedMCGen(particlesMc, candJpsiMC, static_cast(Pdg::kJPsi), std::array{-kMuonMinus, +kMuonMinus}, true)) { + flag = sign * o2::hf_decay::hf_cand_beauty::BsToJpsiKK; + } + // Check phi -> K+K- + if (RecoDecay::isMatchedMCGen(particlesMc, candPhiMC, static_cast(Pdg::kPhi), std::array{-kKPlus, +kKPlus}, true)) { + channel = o2::hf_decay::hf_cand_beauty::BsToJpsiPhi; + } + } + + // save information for Bs task + if (std::abs(flag) != o2::hf_decay::hf_cand_beauty::BsToJpsiKK) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), MassBPlus); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + for (const auto& daught : particle.daughters_as()) { + ptProngs[counter] = daught.pt(); + etaProngs[counter] = daught.eta(); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); + counter++; + } + rowHfBsMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } + } // gen + } + + // Jpsi candidate selection + template + void runDataCreation(Coll const& collision, + JpsiCands const& candsJpsi, + aod::TrackAssoc const& trackIndices, + TTracks const&, + PParticles const& particlesMc, + uint64_t const& indexCollisionMaxNumContrib, + aod::BCsWithTimestamps const&) + { + + // helpers for ReducedTables filling + int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; + // std::map where the key is the track.globalIndex() and + // the value is the track index in the table of the selected tracks + std::map selectedTracksBach; + std::map selectedTracksBach2; // for the second daughter (for B0 and Bs) + + bool fillHfReducedCollision = false; + + auto primaryVertex = getPrimaryVertex(collision); + + // Set the magnetic field from ccdb. + // The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, + // but this is not true when running on Run2 data/MC already converted into AO2Ds. + auto bc = collision.template bc_as(); + if (runNumber != bc.runNumber()) { + LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; + o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); + if (grpo == nullptr) { + LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); + } + o2::base::Propagator::initFieldFromGRP(grpo); + bz = o2::base::Propagator::Instance()->getNominalBz(); + LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; + runNumber = bc.runNumber(); + } + df2.setBz(bz); + df3.setBz(bz); + df4.setBz(bz); + + auto thisCollId = collision.globalIndex(); + // looping over 2-prong candidates + for (const auto& candidate : candsJpsi) { + + // Apply the selections on the J/Psi candidates + registry.fill(HIST("hSelectionsJpsi"), 1, candidate.pt()); + + if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::JpsiToMuMu)) { + continue; + } + registry.fill(HIST("hSelectionsJpsi"), 2 + aod::SelectionStep::RecoSkims, candidate.pt()); + + auto trackPos = candidate.template prong0_as(); // positive daughter + auto trackNeg = candidate.template prong1_as(); // negative daughter + + auto trackPosParCov = getTrackParCov(trackPos); + auto trackNegParCov = getTrackParCov(trackNeg); + + std::vector jPsiDauTracks{trackPos, trackNeg}; + + auto dca0 = o2::dataformats::DCA(jPsiDauTracks[0].dcaXY(), jPsiDauTracks[0].dcaZ(), jPsiDauTracks[0].cYY(), jPsiDauTracks[0].cZY(), jPsiDauTracks[0].cZZ()); + auto dca1 = o2::dataformats::DCA(jPsiDauTracks[1].dcaXY(), jPsiDauTracks[1].dcaZ(), jPsiDauTracks[1].cYY(), jPsiDauTracks[1].cZY(), jPsiDauTracks[1].cZZ()); + + // repropagate tracks to this collision if needed + if (jPsiDauTracks[0].collisionId() != thisCollId) { + trackPosParCov.propagateToDCA(primaryVertex, bz, &dca0); + } + + if (jPsiDauTracks[1].collisionId() != thisCollId) { + trackNegParCov.propagateToDCA(primaryVertex, bz, &dca1); + } + + // --------------------------------- + // reconstruct J/Psi candidate secondary vertex + o2::track::TrackParCov trackParCovJpsi{}; + std::array pVecJpsi{}; + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::BeforeFit); + try { + if (df2.process(trackPosParCov, trackNegParCov) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::Fail); + continue; + } + registry.fill(HIST("hFitCandidatesJpsi"), SVFitting::FitOk); + + // topological selection + if (!selectionTopol(candidate, trackPos, trackNeg)) { + continue; + } + registry.fill(HIST("hSelectionsJpsi"), 2 + aod::SelectionStep::RecoTopol, candidate.pt()); + + int indexHfCandJpsi = hfJpsi.lastIndex() + 1; + float invMassJpsi{0.f}; + if (runJpsiToee) { + invMassJpsi = hfHelper.invMassJpsiToEE(candidate); + } else { + invMassJpsi = hfHelper.invMassJpsiToMuMu(candidate); + } + registry.fill(HIST("hMassJpsi"), invMassJpsi); + registry.fill(HIST("hPtJpsi"), candidate.pt()); + registry.fill(HIST("hCpaJpsi"), candidate.cpa()); + + bool fillHfCandJpsi = false; + + // TODO: add single track information (min eta, min ITS/TPC clusters, etc.) + double invMass2JpsiHad{0.}; + for (const auto& trackId : trackIndices) { + auto trackBach = trackId.template track_as(); + + // apply selections on bachelor tracks + auto trackParCovBach = getTrackParCov(trackBach); + std::array dcaBach{trackBach.dcaXY(), trackBach.dcaZ()}; + std::array pVecBach = trackBach.pVector(); + if (trackBach.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovBach, 2.f, noMatCorr, &dcaBach); + getPxPyPz(trackParCovBach, pVecBach); + } + + // apply selections on bachelor tracks + if (!isTrackSelected(trackBach, trackParCovBach, dcaBach, jPsiDauTracks)) { + continue; + } + + if constexpr (decChannel == DecayChannel::BplusToJpsiK) { + registry.fill(HIST("hPtKaon"), trackParCovBach.getPt()); + // compute invariant mass square and apply selection + invMass2JpsiHad = RecoDecay::m2(std::array{pVecJpsi, pVecBach}, std::array{MassJPsi, MassKPlus}); + if ((invMass2JpsiHad < invMass2JpsiHadMin) || (invMass2JpsiHad > invMass2JpsiHadMax)) { + continue; + } + registry.fill(HIST("hMassJpsiKaon"), std::sqrt(invMass2JpsiHad)); + + registry.fill(HIST("hFitCandidatesBPlus"), SVFitting::BeforeFit); + try { + if (df3.process(trackPosParCov, trackNegParCov, trackParCovBach) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + registry.fill(HIST("hFitCandidatesBPlus"), SVFitting::Fail); + continue; + } + registry.fill(HIST("hFitCandidatesBPlus"), SVFitting::FitOk); + + o2::track::TrackParCov trackParCovBPlus{}; + std::array pVecBPlus{}, pVec0{}, pVec1{}, pVec2{}; + + auto secondaryVertexBPlus = df3.getPCACandidate(); + df3.propagateTracksToVertex(); + df3.getTrack(0).getPxPyPzGlo(pVec0); + df3.getTrack(1).getPxPyPzGlo(pVec1); + df3.getTrack(2).getPxPyPzGlo(pVec2); + pVecBPlus = RecoDecay::pVec(pVec0, pVec1, pVec2); + trackParCovBPlus = df3.createParentTrackParCov(); + trackParCovBPlus.setAbsCharge(0); // to be sure + + if (!isBSelected(pVecBPlus, secondaryVertexBPlus, collision)) { + continue; + } + + // fill Kaon tracks table + // if information on track already stored, go to next track + if (!selectedTracksBach.count(trackBach.globalIndex())) { + hfTrackLfDau0(trackBach.globalIndex(), indexHfReducedCollision, + trackParCovBach.getX(), trackParCovBach.getAlpha(), + trackParCovBach.getY(), trackParCovBach.getZ(), trackParCovBach.getSnp(), + trackParCovBach.getTgl(), trackParCovBach.getQ2Pt(), + trackBach.itsNCls(), trackBach.tpcNClsCrossedRows(), trackBach.tpcChi2NCl(), + trackBach.hasTPC(), trackBach.hasTOF(), + trackBach.tpcNSigmaPi(), trackBach.tofNSigmaPi(), + trackBach.tpcNSigmaKa(), trackBach.tofNSigmaKa(), + trackBach.tpcNSigmaPr(), trackBach.tofNSigmaPr()); + hfTrackCovLfDau0(trackParCovBach.getSigmaY2(), trackParCovBach.getSigmaZY(), trackParCovBach.getSigmaZ2(), + trackParCovBach.getSigmaSnpY(), trackParCovBach.getSigmaSnpZ(), + trackParCovBach.getSigmaSnp2(), trackParCovBach.getSigmaTglY(), trackParCovBach.getSigmaTglZ(), + trackParCovBach.getSigmaTglSnp(), trackParCovBach.getSigmaTgl2(), + trackParCovBach.getSigma1PtY(), trackParCovBach.getSigma1PtZ(), trackParCovBach.getSigma1PtSnp(), + trackParCovBach.getSigma1PtTgl(), trackParCovBach.getSigma1Pt2()); + // add trackBach.globalIndex() to a list + // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another Jpsi candidate + // and keep track of their index in hfTrackLfDau0 for McRec purposes + selectedTracksBach[trackBach.globalIndex()] = hfTrackLfDau0.lastIndex(); + } + + if constexpr (doMc) { + std::vector beautyHadDauTracks{}; + for (const auto& track : jPsiDauTracks) { + beautyHadDauTracks.push_back(track); + } + beautyHadDauTracks.push_back(trackBach); + fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandJpsi, std::array, 2>{selectedTracksBach}, indexCollisionMaxNumContrib); + } + fillHfCandJpsi = true; + } else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) { + for (auto trackBachId2 = trackId + 1; trackBachId2 != trackIndices.end(); ++trackBachId2) { + auto trackBach2 = trackBachId2.template track_as(); + auto trackBach2ParCov = getTrackParCov(trackBach2); + + std::array dcaBach2{trackBach2.dcaXY(), trackBach2.dcaZ()}; + std::array pVecBach2 = trackBach2.pVector(); + if (trackBach2.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackBach2ParCov, 2.f, noMatCorr, &dcaBach2); + getPxPyPz(trackBach2ParCov, pVecBach2); + } + + // apply selections on bachelor tracks + if (!isTrackSelected(trackBach2, trackBach2ParCov, dcaBach2, jPsiDauTracks)) { + continue; + } + std::array pVec2{trackBach.pVector()}, pVec3{trackBach2.pVector()}; + auto invMassPhi = RecoDecay::m(std::array{pVec2, pVec3}, std::array{MassKPlus, MassKPlus}); + + if (std::abs(invMassPhi - MassPhi) > deltaMPhiMax) { + continue; + } + + // --------------------------------- + // reconstruct Bs candidate secondary vertex + + registry.fill(HIST("hFitCandidatesBS"), SVFitting::BeforeFit); + try { + if (df4.process(trackPosParCov, trackNegParCov, trackParCovBach, trackBach2ParCov) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + registry.fill(HIST("hFitCandidatesBS"), SVFitting::Fail); + continue; + } + registry.fill(HIST("hFitCandidatesBS"), SVFitting::FitOk); + + o2::track::TrackParCov trackParCovBS{}; + std::array pVecBS{}, pVec0{}, pVec1{}, pVecPhi{}; + + auto secondaryVertexBS = df4.getPCACandidate(); + df4.propagateTracksToVertex(); + df4.getTrack(0).getPxPyPzGlo(pVec0); + df4.getTrack(1).getPxPyPzGlo(pVec1); + df4.getTrack(2).getPxPyPzGlo(pVec2); + df4.getTrack(3).getPxPyPzGlo(pVec3); + pVecBS = RecoDecay::pVec(pVec0, pVec1, pVec2, pVec3); + pVecPhi = RecoDecay::pVec(pVec2, pVec3); + trackParCovBS = df4.createParentTrackParCov(); + trackParCovBS.setAbsCharge(0); // to be sure + + if (!isBSelected(pVecBS, secondaryVertexBS, collision)) { + continue; + } + + registry.fill(HIST("hPtPhi"), RecoDecay::pt(pVecBach, pVecBach2)); + registry.fill(HIST("hMassPhi"), RecoDecay::m(std::array{pVecBach, pVecBach2}, std::array{MassKPlus, MassKPlus})); + invMass2JpsiHad = RecoDecay::m2(std::array{pVecJpsi, pVecPhi}, std::array{MassJPsi, MassPhi}); + if ((invMass2JpsiHad < invMass2JpsiHadMin) || (invMass2JpsiHad > invMass2JpsiHadMax)) { + continue; + } + registry.fill(HIST("hMassJpsiPhi"), std::sqrt(invMass2JpsiHad)); + + // fill daughter tracks table + // if information on track already stored, go to next track + if (!selectedTracksBach.count(trackBach.globalIndex())) { + hfTrackLfDau0(trackBach.globalIndex(), indexHfReducedCollision, + trackParCovBach.getX(), trackParCovBach.getAlpha(), + trackParCovBach.getY(), trackParCovBach.getZ(), trackParCovBach.getSnp(), + trackParCovBach.getTgl(), trackParCovBach.getQ2Pt(), + trackBach.itsNCls(), trackBach.tpcNClsCrossedRows(), trackBach.tpcChi2NCl(), + trackBach.hasTPC(), trackBach.hasTOF(), + trackBach.tpcNSigmaPi(), trackBach.tofNSigmaPi(), + trackBach.tpcNSigmaKa(), trackBach.tofNSigmaKa(), + trackBach.tpcNSigmaPr(), trackBach.tofNSigmaPr()); + hfTrackCovLfDau0(trackParCovBach.getSigmaY2(), trackParCovBach.getSigmaZY(), trackParCovBach.getSigmaZ2(), + trackParCovBach.getSigmaSnpY(), trackParCovBach.getSigmaSnpZ(), + trackParCovBach.getSigmaSnp2(), trackParCovBach.getSigmaTglY(), trackParCovBach.getSigmaTglZ(), + trackParCovBach.getSigmaTglSnp(), trackParCovBach.getSigmaTgl2(), + trackParCovBach.getSigma1PtY(), trackParCovBach.getSigma1PtZ(), trackParCovBach.getSigma1PtSnp(), + trackParCovBach.getSigma1PtTgl(), trackParCovBach.getSigma1Pt2()); + // add trackBach.globalIndex() to a list + // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another Jpsi candidate + // and keep track of their index in hfTrackLfDau0 for McRec purposes + selectedTracksBach[trackBach.globalIndex()] = hfTrackLfDau0.lastIndex(); + } + + // fill daughter tracks table + // if information on track already stored, go to next track + if (!selectedTracksBach2.count(trackBach2.globalIndex())) { + hfTrackLfDau1(trackBach2.globalIndex(), indexHfReducedCollision, + trackBach2ParCov.getX(), trackBach2ParCov.getAlpha(), + trackBach2ParCov.getY(), trackBach2ParCov.getZ(), trackBach2ParCov.getSnp(), + trackBach2ParCov.getTgl(), trackBach2ParCov.getQ2Pt(), + trackBach2.itsNCls(), trackBach2.tpcNClsCrossedRows(), trackBach2.tpcChi2NCl(), + trackBach2.hasTPC(), trackBach2.hasTOF(), + trackBach2.tpcNSigmaPi(), trackBach2.tofNSigmaPi(), + trackBach2.tpcNSigmaKa(), trackBach2.tofNSigmaKa(), + trackBach2.tpcNSigmaPr(), trackBach2.tofNSigmaPr()); + hfTrackCovLfDau1(trackBach2ParCov.getSigmaY2(), trackBach2ParCov.getSigmaZY(), trackBach2ParCov.getSigmaZ2(), + trackBach2ParCov.getSigmaSnpY(), trackBach2ParCov.getSigmaSnpZ(), + trackBach2ParCov.getSigmaSnp2(), trackBach2ParCov.getSigmaTglY(), trackBach2ParCov.getSigmaTglZ(), + trackBach2ParCov.getSigmaTglSnp(), trackBach2ParCov.getSigmaTgl2(), + trackBach2ParCov.getSigma1PtY(), trackBach2ParCov.getSigma1PtZ(), trackBach2ParCov.getSigma1PtSnp(), + trackBach2ParCov.getSigma1PtTgl(), trackBach2ParCov.getSigma1Pt2()); + // add trackBach2.globalIndex() to a list + // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another Jpsi candidate + // and keep track of their index in hfTrackLfDau1 for McRec purposes + selectedTracksBach2[trackBach2.globalIndex()] = hfTrackLfDau1.lastIndex(); + } + + if constexpr (doMc) { + std::vector beautyHadDauTracks{}; + for (const auto& track : jPsiDauTracks) { + beautyHadDauTracks.push_back(track); + } + beautyHadDauTracks.push_back(trackBach); + fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandJpsi, std::array, 2>{selectedTracksBach, selectedTracksBach2}, indexCollisionMaxNumContrib); + } + fillHfCandJpsi = true; + } + } + } // kaon loop + if (fillHfCandJpsi) { // fill Jpsi table only once per Jpsi candidate + double invMassJpsi{0.}; + if (runJpsiToee) { + invMassJpsi = hfHelper.invMassJpsiToEE(candidate); + } else { + invMassJpsi = hfHelper.invMassJpsiToMuMu(candidate); + } + hfJpsi(trackPos.globalIndex(), trackNeg.globalIndex(), + indexHfReducedCollision, + candidate.xSecondaryVertex(), candidate.ySecondaryVertex(), candidate.zSecondaryVertex(), + invMassJpsi, + trackPosParCov.getX(), trackNegParCov.getX(), + trackPosParCov.getY(), trackNegParCov.getY(), + trackPosParCov.getZ(), trackNegParCov.getZ(), + trackPosParCov.getAlpha(), trackNegParCov.getAlpha(), + trackPosParCov.getSnp(), trackNegParCov.getSnp(), + trackPosParCov.getTgl(), trackNegParCov.getTgl(), + trackPosParCov.getQ2Pt(), trackNegParCov.getQ2Pt()); // Q/pT + hfRedJpsiCov(trackPosParCov.getSigmaY2(), trackNegParCov.getSigmaY2(), + trackPosParCov.getSigmaZY(), trackNegParCov.getSigmaZY(), + trackPosParCov.getSigmaZ2(), trackNegParCov.getSigmaZ2(), + trackPosParCov.getSigmaSnpY(), trackNegParCov.getSigmaSnpY(), + trackPosParCov.getSigmaSnpZ(), trackNegParCov.getSigmaSnpZ(), + trackPosParCov.getSigmaSnp2(), trackNegParCov.getSigmaSnp2(), + trackPosParCov.getSigmaTglY(), trackNegParCov.getSigmaTglY(), + trackPosParCov.getSigmaTglZ(), trackNegParCov.getSigmaTglZ(), + trackPosParCov.getSigmaTglSnp(), trackNegParCov.getSigmaTglSnp(), + trackPosParCov.getSigmaTgl2(), trackNegParCov.getSigmaTgl2(), + trackPosParCov.getSigma1PtY(), trackNegParCov.getSigma1PtY(), + trackPosParCov.getSigma1PtZ(), trackNegParCov.getSigma1PtZ(), + trackPosParCov.getSigma1PtSnp(), trackNegParCov.getSigma1PtSnp(), + trackPosParCov.getSigma1PtTgl(), trackNegParCov.getSigma1PtTgl(), + trackPosParCov.getSigma1Pt2(), trackNegParCov.getSigma1Pt2()); + fillHfReducedCollision = true; + } + } // candsJpsi loop + + registry.fill(HIST("hEvents"), 1 + Event::Processed); + if (!fillHfReducedCollision) { + registry.fill(HIST("hEvents"), 1 + Event::NoCharmHadPiSelected); + return; + } + registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); + float centrality = -1.f; + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + // fill collision table if it contains a J/Psi K pair at minimum + hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); + hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), + collision.covXZ(), collision.covYZ(), collision.covZZ()); + // hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); // TODO: add + // if constexpr (withQvec) { + // hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + // collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + // collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + // collision.qvecTPCposRe(), collision.qvecTPCposIm(), collision.nTrkTPCpos(), + // collision.qvecTPCnegRe(), collision.qvecTPCnegIm(), collision.nTrkTPCneg(), + // collision.qvecTPCallRe(), collision.qvecTPCallIm(), collision.nTrkTPCall()); + // } + } + + void processJpsiKData(soa::Join const& collisions, + aod::HfCand2ProngWPid const& candsJpsi, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBplus(invMassWindowJpsiHad.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiKData, "Process J/Psi K without MC info", true); + + void processJpsiPhiData(soa::Join const& collisions, + aod::HfCand2ProngWPid const& candsJpsi, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(invMassWindowJpsiHad.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiPhiData, "Process J/Psi phi without MC info", false); + + void processJpsiKMc(CollisionsWCMcLabels const& collisions, + aod::HfCand2ProngWPid const& candsJpsi, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs, + McCollisions const&) + { + // store configurables needed for B+ workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBplus(invMassWindowJpsiHad.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + runMcGen(particlesMc); + } + PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiKMc, "Process J/Psi K with MC info", false); + + void processJpsiPhiMc(CollisionsWCMcLabels const& collisions, + aod::HfCand2ProngWPid const& candsJpsi, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs, + McCollisions const&) + { + // store configurables needed for B+ workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(invMassWindowJpsiHad.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsJpsiThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + runMcGen(particlesMc); + } + PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiPhiMc, "Process J/Psi phi with MC info", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 52019c9227e..53b22dfe969 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -29,11 +29,21 @@ o2physics_add_dpl_workflow(task-bplus-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-bplus-to-jpsi-k-reduced + SOURCES taskBplusToJpsiKReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-bs-reduced SOURCES taskBsReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-bs-to-jpsi-phi-reduced + SOURCES taskBsToJpsiPhiReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-bs SOURCES taskBs.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx new file mode 100644 index 00000000000..680d7933c48 --- /dev/null +++ b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx @@ -0,0 +1,535 @@ +// 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 taskBplusToJpsiKReduced.cxx +/// \brief B+ → Jpsi K+ → (µ+ µ-) K+ analysis task +/// +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino +/// \author Fabrizio Grosa , CERN + +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseBplusToJpsiKReduced.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsPid.h" + +#include "Common/Core/TrackSelectorPID.h" + +#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; +using namespace o2::analysis; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::pid_tpc_tof_utils; + +namespace o2::aod +{ +namespace hf_cand_bplustojpsik_lite +{ +DECLARE_SOA_COLUMN(PtJpsi, ptJpsi, float); //! Transverse momentum of Jpsi daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(PtBach, ptBach, float); //! Transverse momentum of bachelor kaon (GeV/c) +// DECLARE_SOA_COLUMN(AbsEtaBach, absEtaBach, float); //! Absolute pseudorapidity of bachelor kaon +// DECLARE_SOA_COLUMN(ItsNClsBach, itsNClsBach, int); //! Number of ITS clusters of bachelor kaon +// DECLARE_SOA_COLUMN(TpcNClsCrossedRowsBach, tpcNClsCrossedRowsBach, int); //! Number of TPC crossed rows of prongs of bachelor kaon +// DECLARE_SOA_COLUMN(TpcChi2NClBach, tpcChi2NClBach, float); //! Maximum TPC chi2 of prongs of Jpsi-meson daughter candidate +// DECLARE_SOA_COLUMN(PtJpsiProngMin, ptJpsiProngMin, float); //! Minimum pT of prongs of Jpsi daughter candidate (GeV/c) +// DECLARE_SOA_COLUMN(AbsEtaJpsiProngMin, absEtaJpsiProngMin, float); //! Minimum absolute pseudorapidity of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(ItsNClsJpsiProngMin, itsNClsJpsiProngMin, int); //! Minimum number of ITS clusters of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(TpcNClsCrossedRowsJpsiProngMin, tpcNClsCrossedRowsJpsiProngMin, int); //! Minimum number of TPC crossed rows of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(TpcChi2NClJpsiProngMax, tpcChi2NClJpsiProngMax, float); //! Maximum TPC chi2 of prongs of Jpsi daughter candidate +DECLARE_SOA_COLUMN(MJpsi, mJpsi, float); //! Invariant mass of Jpsi daughter candidates (GeV/c) +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) +DECLARE_SOA_COLUMN(NSigTpcKaBachelor, nSigTpcKaBachelor, float); //! TPC Nsigma separation for bachelor with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaBachelor, nSigTofKaBachelor, float); //! TOF Nsigma separation for bachelor with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaBachelor, nSigTpcTofKaBachelor, float); //! Combined TPC and TOF Nsigma separation for bachelor with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcMuJpsiDauPos, nSigTpcMuJpsiDauPos, float); //! TPC Nsigma separation for Jpsi DauPos with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofMuJpsiDauPos, nSigTofMuJpsiDauPos, float); //! TOF Nsigma separation for Jpsi DauPos with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofMuJpsiDauPos, nSigTpcTofMuJpsiDauPos, float); //! Combined TPC and TOF Nsigma separation for Jpsi prong0 with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcMuJpsiDauNeg, nSigTpcMuJpsiDauNeg, float); //! TPC Nsigma separation for Jpsi DauNeg with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofMuJpsiDauNeg, nSigTofMuJpsiDauNeg, float); //! TOF Nsigma separation for Jpsi DauNeg with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofMuJpsiDauNeg, nSigTpcTofMuJpsiDauNeg, float); //! Combined TPC and TOF Nsigma separation for Jpsi prong1 with muon mass hypothesis +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate +DECLARE_SOA_COLUMN(CtXY, ctXY, float); //! Pseudo-proper decay length of candidate +DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of B daughters +DECLARE_SOA_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, float); //! Impact parameter product of Jpsi daughters +DECLARE_SOA_COLUMN(ImpactParameterJpsiDauPos, impactParameterJpsiDauPos, float); //! Impact parameter of Jpsi daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterJpsiDauNeg, impactParameterJpsiDauNeg, float); //! Impact parameter of Jpsi daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterLfTrack0, impactParameterLfTrack0, float); //! Impact parameter of Phi daughter candidate +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane +DECLARE_SOA_COLUMN(CpaJpsi, cpaJpsi, float); //! Cosine pointing angle of Jpsi daughter candidate +DECLARE_SOA_COLUMN(CpaXYJpsi, cpaXYJpsi, float); //! Cosine pointing angle in transverse plane of Jpsi daughter candidate +DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs +DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +} // namespace hf_cand_bplustojpsik_lite + +DECLARE_SOA_TABLE(HfRedCandBpLites, "AOD", "HFREDCANDBPLITE", //! Table with some B+ properties + hf_cand_bplustojpsik_lite::M, + hf_cand_bplustojpsik_lite::Pt, + hf_cand_bplustojpsik_lite::Eta, + hf_cand_bplustojpsik_lite::Phi, + hf_cand_bplustojpsik_lite::Y, + hf_cand_bplustojpsik_lite::Cpa, + hf_cand_bplustojpsik_lite::CpaXY, + hf_cand::Chi2PCA, + hf_cand_bplustojpsik_lite::DecayLength, + hf_cand_bplustojpsik_lite::DecayLengthXY, + hf_cand_bplustojpsik_lite::DecayLengthNormalised, + hf_cand_bplustojpsik_lite::DecayLengthXYNormalised, + hf_cand_bplustojpsik_lite::CtXY, + hf_cand_bplustojpsik_lite::ImpactParameterProduct, + hf_cand_bplustojpsik_lite::ImpactParameterProductJpsi, + hf_cand_bplustojpsik_lite::MaxNormalisedDeltaIP, + hf_cand_bplustojpsik_lite::MlScoreSig, + // hf_sel_candidate_bplus::IsSelBplusToJpsiPi, + // Jpsi meson features + hf_cand_bplustojpsik_lite::MJpsi, + hf_cand_bplustojpsik_lite::PtJpsi, + hf_cand_bplustojpsik_lite::ImpactParameterJpsiDauPos, + hf_cand_bplustojpsik_lite::ImpactParameterJpsiDauNeg, + hf_cand_bplustojpsik_lite::ImpactParameterLfTrack0, + // hf_cand_bplustojpsik_lite::PtJpsiProngMin, + // hf_cand_bplustojpsik_lite::AbsEtaJpsiProngMin, + // hf_cand_bplustojpsik_lite::ItsNClsJpsiProngMin, + // hf_cand_bplustojpsik_lite::TpcNClsCrossedRowsJpsiProngMin, + // hf_cand_bplustojpsik_lite::TpcChi2NClJpsiProngMax, + // kaon features + hf_cand_bplustojpsik_lite::PtBach, + // hf_cand_bplustojpsik_lite::AbsEtaBach, + // hf_cand_bplustojpsik_lite::ItsNClsBach, + // hf_cand_bplustojpsik_lite::TpcNClsCrossedRowsBach, + // hf_cand_bplustojpsik_lite::TpcChi2NClBach, + hf_cand_bplustojpsik_lite::NSigTpcKaBachelor, + hf_cand_bplustojpsik_lite::NSigTofKaBachelor, + hf_cand_bplustojpsik_lite::NSigTpcTofKaBachelor, + // MC truth + hf_cand_bplus::FlagMcMatchRec, + hf_cand_bplus::ChannelMcMatchRec, + hf_cand_bplus::OriginMcRec, + hf_cand_bplustojpsik_lite::FlagWrongCollision, + hf_cand_bplustojpsik_lite::PtGen); + +// DECLARE_SOA_TABLE(HfRedBpMcCheck, "AOD", "HFREDBPMCCHECK", //! Table with MC decay type check +// hf_cand_2prong::FlagMcMatchRec, +// hf_cand_bplustojpsik_lite::FlagWrongCollision, +// hf_cand_bplustojpsik_lite::MJpsi, +// hf_cand_bplustojpsik_lite::PtJpsi, +// hf_cand_bplustojpsik_lite::M, +// hf_cand_bplustojpsik_lite::Pt, +// // hf_cand_bplustojpsik_lite::MlScoreSig, +// hf_bplus_mc::PdgCodeBeautyMother, +// hf_bplus_mc::PdgCodeCharmMother, +// hf_bplus_mc::PdgCodeDauPos, +// hf_bplus_mc::PdgCodeDauNeg, +// hf_bplus_mc::PdgCodeProng2); +} // namespace o2::aod + +// string definitions, used for histogram axis labels +const TString stringPt = "#it{p}_{T} (GeV/#it{c})"; +const TString stringPtJpsi = "#it{p}_{T}(Jpsi) (GeV/#it{c});"; +const TString bPlusCandTitle = "B+ candidates;"; +const TString entries = "entries"; +const TString bPlusCandMatch = "B+ candidates (matched);"; +const TString bPlusCandUnmatch = "B+ candidates (unmatched);"; +const TString mcParticleMatched = "MC particles (matched);"; + +/// B+ analysis task +struct HfTaskBplusToJpsiKReduced { + Produces hfRedCandBpLite; + // Produces hfRedBpMcCheck; + + Configurable selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for Bplus"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. track pseudo-rapidity"}; + Configurable ptTrackMin{"ptTrackMin", 0.1, "min. track transverse momentum"}; + Configurable fillBackground{"fillBackground", false, "Flag to enable filling of background histograms/sparses/tree (only MC)"}; + 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"}; + // topological cuts + Configurable> binsPt{"binsPt", std::vector{hf_cuts_bplus_to_jpsi_k::vecBinsPt}, "pT bin limits"}; + Configurable> cuts{"cuts", {hf_cuts_bplus_to_jpsi_k::Cuts[0], hf_cuts_bplus_to_jpsi_k::NBinsPt, hf_cuts_bplus_to_jpsi_k::NCutVars, hf_cuts_bplus_to_jpsi_k::labelsPt, hf_cuts_bplus_to_jpsi_k::labelsCutVar}, "B+ candidate selection per pT bin"}; + // Enable PID + Configurable kaonPidMethod{"kaonPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor kaon (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"}; + Configurable acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"}; + // TPC PID + Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", 5., "Nsigma cut on TPC only"}; + Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; + // TOF PID + Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; + Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; + Configurable nSigmaTofMax{"nSigmaTofMax", 5., "Nsigma cut on TOF only"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; + // B+ ML inference + Configurable> binsPtBpMl{"binsPtBpMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirBpMl{"cutDirBpMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsBpMl{"cutsBpMl", {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"}; + Configurable nClassesBpMl{"nClassesBpMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"path_ccdb/BDT_BPLUS/"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_BPLUSToJPSIK.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + 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"}; + + HfHelper hfHelper; + TrackSelectorKa selectorKaon; + o2::analysis::HfMlResponseBplusToJpsiKReduced hfMlResponse; + o2::ccdb::CcdbApi ccdbApi; + + using TracksKaon = soa::Join; + std::vector outputMl = {}; + + // Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBplusToJpsiPi >= selectionFlagBplus); + + HistogramRegistry registry{"registry"}; + + void init(InitContext&) + { + std::array processFuncData{doprocessData, doprocessDataWithBplusMl}; + if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for data can be enabled at a time."); + } + std::array processFuncMc{doprocessMc, doprocessMcWithBplusMl}; + if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for MC can be enabled at a time."); + } + + if (kaonPidMethod < 0 || kaonPidMethod >= PidMethod::NPidMethods) { + LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)"); + } + + if (kaonPidMethod != PidMethod::NoPid) { + selectorKaon.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); + selectorKaon.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorKaon.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); + selectorKaon.setRangePtTof(ptPidTofMin, ptPidTofMax); + selectorKaon.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorKaon.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); + } + + const AxisSpec axisMassBplus{150, 4.5, 6.0}; + const AxisSpec axisMassJpsi{600, 2.8f, 3.4f}; + const AxisSpec axisPtProng{100, 0., 10.}; + const AxisSpec axisImpactPar{200, -0.05, 0.05}; + const AxisSpec axisPtJpsi{100, 0., 50.}; + const AxisSpec axisRapidity{100, -2., 2.}; + const AxisSpec axisPtB{(std::vector)binsPt, "#it{p}_{T}^{B^{+}} (GeV/#it{c})"}; + const AxisSpec axisPtKa{100, 0.f, 10.f}; + + registry.add("hMass", bPlusCandTitle + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassBplus, axisPtB}}); + registry.add("hMassJpsi", bPlusCandTitle + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hd0K", bPlusCandTitle + "Kaon DCAxy to prim. vertex (cm);" + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + + // histograms processMC + if (doprocessMc || doprocessMcWithBplusMl) { + registry.add("hPtJpsiGen", mcParticleMatched + "J/#Psi #it{p}_{T}^{gen} (GeV/#it{c}); B^{+} " + stringPt, {HistType::kTH2F, {axisPtProng, axisPtB}}); + registry.add("hPtKGen", mcParticleMatched + "Kaon #it{p}_{T}^{gen} (GeV/#it{c}); B^{+} " + stringPt, {HistType::kTH2F, {axisPtProng, axisPtB}}); + registry.add("hYGenWithProngsInAcceptance", mcParticleMatched + "Kaon #it{p}_{T}^{gen} (GeV/#it{c}); B^{+} " + stringPt, {HistType::kTH2F, {axisPtProng, axisRapidity}}); + registry.add("hMassRecSig", bPlusCandMatch + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2}); B^{+} " + stringPt, {HistType::kTH2F, {axisMassBplus, axisPtB}}); + registry.add("hMassJpsiRecSig", bPlusCandMatch + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2}); J/#Psi " + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hd0KRecSig", bPlusCandMatch + "Kaon DCAxy to prim. vertex (cm); K^{+} " + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + registry.add("hMassRecBg", bPlusCandUnmatch + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2}); B^{+} " + stringPt, {HistType::kTH2F, {axisMassBplus, axisPtB}}); + registry.add("hMassJpsiRecBg", bPlusCandUnmatch + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2}); J/#Psi " + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hd0KRecBg", bPlusCandMatch + "Kaon DCAxy to prim. vertex (cm); K^{+} " + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + } + + if (doprocessDataWithBplusMl || doprocessMcWithBplusMl) { + hfMlResponse.configure(binsPtBpMl, cutsBpMl, cutDirBpMl, nClassesBpMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } + } + + /// Selection of B+ daughter in geometrical acceptance + /// \param etaProng is the pseudorapidity of B+ prong + /// \param ptProng is the pT of B+ prong + /// \return true if prong is in geometrical acceptance + template + bool isProngInAcceptance(const T& etaProng, const T& ptProng) + { + return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; + } + + /// Fill candidate information at reconstruction level + /// \param doMc is the flag to enable the filling with MC information + /// \param withBplusMl is the flag to enable the filling with ML scores for the B+ candidate + /// \param candidate is the B+ candidate + /// \param candidatesJpsi is the table with Jpsi candidates + template + void fillCand(Cand const& candidate, + aod::HfRedJpsis const& /*candidatesJpsi*/, + aod::HfRedBach0Tracks const&) + { + auto ptCandBplus = candidate.pt(); + auto invMassBplus = hfHelper.invMassBplusToJpsiK(candidate); + auto candJpsi = candidate.template jpsi_as(); + auto candKa = candidate.template bachKa_as(); + auto ptJpsi = candidate.ptProng0(); + auto invMassJpsi = candJpsi.m(); + uint8_t statusBplus = 0; + + int8_t flagMcMatchRec{0}, channelMcMatchRec{0}, flagWrongCollision{0}; + bool isSignal = false; + if constexpr (doMc) { + flagMcMatchRec = candidate.flagMcMatchRec(); + channelMcMatchRec = candidate.channelMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); + isSignal = std::abs(flagMcMatchRec) == o2::hf_decay::hf_cand_beauty::BplusToJpsiK; + } + + SETBIT(statusBplus, SelectionStep::RecoSkims); + if (hfHelper.selectionBplusToJpsiKTopol(candidate, cuts, binsPt)) { + SETBIT(statusBplus, SelectionStep::RecoTopol); + } else if (selectionFlagBplus >= BIT(SelectionStep::RecoTopol) * 2 - 1) { + return; + } + // track-level PID selection + // auto trackKa = candidate.template prong1_as(); + if (kaonPidMethod == PidMethod::TpcOrTof || kaonPidMethod == PidMethod::TpcAndTof) { + int pidTrackKa{TrackSelectorPID::Status::NotApplicable}; + if (kaonPidMethod == PidMethod::TpcOrTof) { + pidTrackKa = selectorKaon.statusTpcOrTof(candKa); + } else if (kaonPidMethod == PidMethod::TpcAndTof) { + pidTrackKa = selectorKaon.statusTpcAndTof(candKa); + } + if (hfHelper.selectionBplusToJpsiKPid(pidTrackKa, acceptPIDNotApplicable.value)) { + // LOGF(info, "B+ candidate selection failed at PID selection"); + SETBIT(statusBplus, SelectionStep::RecoPID); + } else if (selectionFlagBplus >= BIT(SelectionStep::RecoPID) * 2 - 1) { + return; + } + } + + float candidateMlScoreSig = -1; + if constexpr (withBplusMl) { + // B+ ML selections + std::vector inputFeatures = hfMlResponse.getInputFeatures(candidate, candKa); + if (hfMlResponse.isSelectedMl(inputFeatures, ptCandBplus, outputMl)) { + SETBIT(statusBplus, SelectionStep::RecoMl); + } else if (selectionFlagBplus >= BIT(SelectionStep::RecoMl) * 2 - 1) { + return; + } + candidateMlScoreSig = outputMl[1]; + } + + registry.fill(HIST("hMass"), invMassBplus, ptCandBplus); + registry.fill(HIST("hMassJpsi"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hd0K"), candidate.impactParameter1(), candidate.ptProng1()); + if constexpr (doMc) { + if (isSignal) { + registry.fill(HIST("hMassRecSig"), invMassBplus, ptCandBplus); + registry.fill(HIST("hMassJpsiRecSig"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hd0KRecSig"), candidate.impactParameter1(), candidate.ptProng1()); + } else if (fillBackground) { + registry.fill(HIST("hMassRecBg"), invMassBplus, ptCandBplus); + registry.fill(HIST("hMassJpsiRecBg"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hd0KRecBg"), candidate.impactParameter1(), candidate.ptProng1()); + } + } + + float pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); + if (ptCandBplus >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { + float ptMother = -1.; + if constexpr (doMc) { + ptMother = candidate.ptMother(); + } + + hfRedCandBpLite( + // B+ - meson features + invMassBplus, + ptCandBplus, + candidate.eta(), + candidate.phi(), + hfHelper.yBplus(candidate), + candidate.cpa(), + candidate.cpaXY(), + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ctXY(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}), + candidate.impactParameterProduct(), + candidate.impactParameterProductJpsi(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + // J/Psi features + invMassJpsi, + ptJpsi, + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameter2(), + // candJpsi.ptProngMin(), + // candJpsi.absEtaProngMin(), + // candJpsi.itsNClsProngMin(), + // candJpsi.tpcNClsCrossedRowsProngMin(), + // candJpsi.tpcChi2NClProngMax(), + // kaon features + candidate.ptProng1(), + // std::abs(RecoDecay::eta(candKa.pVector())), + // candKa.itsNCls(), + // candKa.tpcNClsCrossedRows(), + // candKa.tpcChi2NCl(), + candKa.tpcNSigmaKa(), + candKa.tofNSigmaKa(), + candKa.tpcTofNSigmaKa(), + // MC truth + flagMcMatchRec, + channelMcMatchRec, + isSignal, + flagWrongCollision, + ptMother); + } + } + + /// Fill particle histograms (gen MC truth) + void fillCandMcGen(aod::HfMcGenRedBps::iterator const& particle) + { + auto ptParticle = particle.ptTrack(); + auto yParticle = particle.yTrack(); + if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { + return; + } + std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; + std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; + bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + + registry.fill(HIST("hPtJpsiGen"), ptProngs[0], ptParticle); + registry.fill(HIST("hPtKGen"), ptProngs[1], ptParticle); + + // generated B+ with daughters in geometrical acceptance + if (prongsInAcc) { + registry.fill(HIST("hYGenWithProngsInAcceptance"), ptParticle, yParticle); + } + } + + // Process functions + void processData(aod::HfRedCandBplusToJpsiK const& candidates, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaonTracks) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaonTracks); + } // candidate loop + } // processData + PROCESS_SWITCH(HfTaskBplusToJpsiKReduced, processData, "Process data without ML for B+", true); + + void processDataWithBplusMl(aod::HfRedCandBplusToJpsiK const& candidates, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaonTracks) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaonTracks); + } // candidate loop + } // processDataWithBplusMl + PROCESS_SWITCH(HfTaskBplusToJpsiKReduced, processDataWithBplusMl, "Process data with ML for B+", false); + + void processMc(soa::Join const& candidates, + aod::HfMcGenRedBps const& mcParticles, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaonTracks) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaonTracks); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBplusToJpsiKReduced, processMc, "Process MC without ML for B+", false); + + void processMcWithBplusMl(soa::Join const& candidates, + aod::HfMcGenRedBps const& mcParticles, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaonTracks) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaonTracks); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcWithBplusMl + PROCESS_SWITCH(HfTaskBplusToJpsiKReduced, processMcWithBplusMl, "Process MC with ML for B+", false); + +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx new file mode 100644 index 00000000000..90ce04a9cb7 --- /dev/null +++ b/PWGHF/D2H/Tasks/taskBsToJpsiPhiReduced.cxx @@ -0,0 +1,582 @@ +// 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 taskBsToJpsiPhiReduced.cxx +/// \brief Bs → Jpsi phi → (µ+ µ-) (K+K-) analysis task +/// +/// \author Fabrizio Chinu , Università degli Studi and INFN Torino +/// \author Fabrizio Grosa , CERN + +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseBsToJpsiPhiReduced.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsPid.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelectorPID.h" + +#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; +using namespace o2::analysis; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::pid_tpc_tof_utils; + +namespace o2::aod +{ +namespace hf_cand_bstojpsiphi_lite +{ +DECLARE_SOA_COLUMN(PtJpsi, ptJpsi, float); //! Transverse momentum of Jpsi daughter candidate (GeV/c) +DECLARE_SOA_COLUMN(PtBach0, ptBach0, float); //! Transverse momentum of bachelor kaon(<- phi) (GeV/c) +DECLARE_SOA_COLUMN(PtBach1, ptBach1, float); //! Transverse momentum of bachelor kaon(<- phi) (GeV/c) +// DECLARE_SOA_COLUMN(AbsEtaBach, absEtaBach, float); //! Absolute pseudorapidity of bachelor kaon +// DECLARE_SOA_COLUMN(ItsNClsBach, itsNClsBach, int); //! Number of ITS clusters of bachelor kaon +// DECLARE_SOA_COLUMN(TpcNClsCrossedRowsBach, tpcNClsCrossedRowsBach, int); //! Number of TPC crossed rows of prongs of bachelor kaon +// DECLARE_SOA_COLUMN(TpcChi2NClBach, tpcChi2NClBach, float); //! Maximum TPC chi2 of prongs of Jpsi-meson daughter candidate +// DECLARE_SOA_COLUMN(PtJpsiProngMin, ptJpsiProngMin, float); //! Minimum pT of prongs of Jpsi daughter candidate (GeV/c) +// DECLARE_SOA_COLUMN(AbsEtaJpsiProngMin, absEtaJpsiProngMin, float); //! Minimum absolute pseudorapidity of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(ItsNClsJpsiProngMin, itsNClsJpsiProngMin, int); //! Minimum number of ITS clusters of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(TpcNClsCrossedRowsJpsiProngMin, tpcNClsCrossedRowsJpsiProngMin, int); //! Minimum number of TPC crossed rows of prongs of Jpsi daughter candidate +// DECLARE_SOA_COLUMN(TpcChi2NClJpsiProngMax, tpcChi2NClJpsiProngMax, float); //! Maximum TPC chi2 of prongs of Jpsi daughter candidate +DECLARE_SOA_COLUMN(MJpsi, mJpsi, float); //! Invariant mass of Jpsi daughter candidates (GeV/c) +DECLARE_SOA_COLUMN(MPhi, mPhi, float); //! Invariant mass of phi daughter candidates (GeV/c) +DECLARE_SOA_COLUMN(M, m, float); //! Invariant mass of candidate (GeV/c2) +DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(PtGen, ptGen, float); //! Transverse momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(P, p, float); //! Momentum of candidate (GeV/c) +DECLARE_SOA_COLUMN(Y, y, float); //! Rapidity of candidate +DECLARE_SOA_COLUMN(Eta, eta, float); //! Pseudorapidity of candidate +DECLARE_SOA_COLUMN(Phi, phi, float); //! Azimuth angle of candidate +DECLARE_SOA_COLUMN(E, e, float); //! Energy of candidate (GeV) +DECLARE_SOA_COLUMN(NSigTpcKaBachelor0, nSigTpcKaBachelor0, float); //! TPC Nsigma separation for bachelor 0 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaBachelor0, nSigTofKaBachelor0, float); //! TOF Nsigma separation for bachelor 0 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaBachelor0, nSigTpcTofKaBachelor0, float); //! Combined TPC and TOF Nsigma separation for bachelor 0 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcKaBachelor1, nSigTpcKaBachelor1, float); //! TPC Nsigma separation for bachelor 1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofKaBachelor1, nSigTofKaBachelor1, float); //! TOF Nsigma separation for bachelor 1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKaBachelor1, nSigTpcTofKaBachelor1, float); //! Combined TPC and TOF Nsigma separation for bachelor 1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcMuJpsiDauPos, nSigTpcMuJpsiDauPos, float); //! TPC Nsigma separation for Jpsi DauPos with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofMuJpsiDauPos, nSigTofMuJpsiDauPos, float); //! TOF Nsigma separation for Jpsi DauPos with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofMuJpsiDauPos, nSigTpcTofMuJpsiDauPos, float); //! Combined TPC and TOF Nsigma separation for Jpsi prong0 with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcMuJpsiDauNeg, nSigTpcMuJpsiDauNeg, float); //! TPC Nsigma separation for Jpsi DauNeg with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTofMuJpsiDauNeg, nSigTofMuJpsiDauNeg, float); //! TOF Nsigma separation for Jpsi DauNeg with muon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofMuJpsiDauNeg, nSigTpcTofMuJpsiDauNeg, float); //! Combined TPC and TOF Nsigma separation for Jpsi prong1 with muon mass hypothesis +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) +DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate +DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float); //! Normalised transverse decay length of candidate +DECLARE_SOA_COLUMN(CtXY, ctXY, float); //! Pseudo-proper decay length of candidate +DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! Impact parameter product of B daughters +DECLARE_SOA_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, float); //! Impact parameter product of Jpsi daughters +DECLARE_SOA_COLUMN(ImpactParameterProductPhi, impactParameterProductPhi, float); //! Impact parameter product of Phi daughters +DECLARE_SOA_COLUMN(ImpactParameterJpsiDauPos, impactParameterJpsiDauPos, float); //! Impact parameter of Jpsi daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterJpsiDauNeg, impactParameterJpsiDauNeg, float); //! Impact parameter of Jpsi daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterLfTrack0, impactParameterLfTrack0, float); //! Impact parameter of Phi daughter candidate +DECLARE_SOA_COLUMN(ImpactParameterLfTrack1, impactParameterLfTrack1, float); //! Impact parameter of Phi daughter candidate +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate +DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane +DECLARE_SOA_COLUMN(CpaJpsi, cpaJpsi, float); //! Cosine pointing angle of Jpsi daughter candidate +DECLARE_SOA_COLUMN(CpaXYJpsi, cpaXYJpsi, float); //! Cosine pointing angle in transverse plane of Jpsi daughter candidate +DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! Maximum normalized difference between measured and expected impact parameter of candidate prongs +DECLARE_SOA_COLUMN(MlScoreSig, mlScoreSig, float); //! ML score for signal class +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); //! Flag for association with wrong collision +} // namespace hf_cand_bstojpsiphi_lite + +DECLARE_SOA_TABLE(HfRedCandBsLites, "AOD", "HFREDCANDBSLITE", //! Table with some Bs properties + hf_cand_bstojpsiphi_lite::M, + hf_cand_bstojpsiphi_lite::Pt, + hf_cand_bstojpsiphi_lite::Eta, + hf_cand_bstojpsiphi_lite::Phi, + hf_cand_bstojpsiphi_lite::Y, + hf_cand_bstojpsiphi_lite::Cpa, + hf_cand_bstojpsiphi_lite::CpaXY, + hf_cand::Chi2PCA, + hf_cand_bstojpsiphi_lite::DecayLength, + hf_cand_bstojpsiphi_lite::DecayLengthXY, + hf_cand_bstojpsiphi_lite::DecayLengthNormalised, + hf_cand_bstojpsiphi_lite::DecayLengthXYNormalised, + hf_cand_bstojpsiphi_lite::CtXY, + hf_cand_bstojpsiphi_lite::ImpactParameterProduct, + hf_cand_bstojpsiphi_lite::ImpactParameterProductJpsi, + hf_cand_bstojpsiphi_lite::ImpactParameterProductPhi, + hf_cand_bstojpsiphi_lite::MaxNormalisedDeltaIP, + hf_cand_bstojpsiphi_lite::MlScoreSig, + // hf_sel_candidate_bplus::IsSelBsToJpsiPi, + // Jpsi meson features + hf_cand_bstojpsiphi_lite::MJpsi, + hf_cand_bstojpsiphi_lite::PtJpsi, + hf_cand_bstojpsiphi_lite::MPhi, + hf_cand_bstojpsiphi_lite::ImpactParameterJpsiDauPos, + hf_cand_bstojpsiphi_lite::ImpactParameterJpsiDauNeg, + hf_cand_bstojpsiphi_lite::ImpactParameterLfTrack0, + hf_cand_bstojpsiphi_lite::ImpactParameterLfTrack1, + // hf_cand_bstojpsiphi_lite::PtJpsiProngMin, + // hf_cand_bstojpsiphi_lite::AbsEtaJpsiProngMin, + // hf_cand_bstojpsiphi_lite::ItsNClsJpsiProngMin, + // hf_cand_bstojpsiphi_lite::TpcNClsCrossedRowsJpsiProngMin, + // hf_cand_bstojpsiphi_lite::TpcChi2NClJpsiProngMax, + // kaon features + hf_cand_bstojpsiphi_lite::PtBach0, + // hf_cand_bstojpsiphi_lite::AbsEtaBach0, + // hf_cand_bstojpsiphi_lite::ItsNClsBach0, + // hf_cand_bstojpsiphi_lite::TpcNClsCrossedRowsBach0, + // hf_cand_bstojpsiphi_lite::TpcChi2NClBach0, + hf_cand_bstojpsiphi_lite::NSigTpcKaBachelor0, + hf_cand_bstojpsiphi_lite::NSigTofKaBachelor0, + hf_cand_bstojpsiphi_lite::NSigTpcTofKaBachelor0, + hf_cand_bstojpsiphi_lite::PtBach1, + // hf_cand_bstojpsiphi_lite::AbsEtaBach1, + // hf_cand_bstojpsiphi_lite::ItsNClsBach1, + // hf_cand_bstojpsiphi_lite::TpcNClsCrossedRowsBach1, + // hf_cand_bstojpsiphi_lite::TpcChi2NClBach1, + hf_cand_bstojpsiphi_lite::NSigTpcKaBachelor1, + hf_cand_bstojpsiphi_lite::NSigTofKaBachelor1, + hf_cand_bstojpsiphi_lite::NSigTpcTofKaBachelor1, + // MC truth + hf_cand_bs::FlagMcMatchRec, + hf_cand_bs::ChannelMcMatchRec, + hf_cand_bs::OriginMcRec, + hf_cand_bstojpsiphi_lite::FlagWrongCollision, + hf_cand_bstojpsiphi_lite::PtGen); + +// DECLARE_SOA_TABLE(HfRedBsMcCheck, "AOD", "HFREDBPMCCHECK", //! Table with MC decay type check +// hf_cand_2prong::FlagMcMatchRec, +// hf_cand_bstojpsiphi_lite::FlagWrongCollision, +// hf_cand_bstojpsiphi_lite::MJpsi, +// hf_cand_bstojpsiphi_lite::PtJpsi, +// hf_cand_bstojpsiphi_lite::M, +// hf_cand_bstojpsiphi_lite::Pt, +// // hf_cand_bstojpsiphi_lite::MlScoreSig, +// hf_bplus_mc::PdgCodeBeautyMother, +// hf_bplus_mc::PdgCodeCharmMother, +// hf_bplus_mc::PdgCodeDauPos, +// hf_bplus_mc::PdgCodeDauNeg, +// hf_bplus_mc::PdgCodeProng2); +} // namespace o2::aod + +// string definitions, used for histogram axis labels +const TString stringPt = "#it{p}_{T} (GeV/#it{c})"; +const TString stringPtJpsi = "#it{p}_{T}(Jpsi) (GeV/#it{c});"; +const TString bSCandTitle = "B_{s}^{0} candidates;"; +const TString entries = "entries"; +const TString bSCandMatch = "B_{s}^{0} candidates (matched);"; +const TString bSCandUnmatch = "B_{s}^{0} candidates (unmatched);"; +const TString mcParticleMatched = "MC particles (matched);"; + +/// Bs analysis task +struct HfTaskBsToJpsiPhiReduced { + Produces hfRedCandBsLite; + // Produces hfRedBsMcCheck; + + Configurable selectionFlagBs{"selectionFlagBs", 1, "Selection Flag for Bs"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. track pseudo-rapidity"}; + Configurable ptTrackMin{"ptTrackMin", 0.1, "min. track transverse momentum"}; + Configurable fillBackground{"fillBackground", false, "Flag to enable filling of background histograms/sparses/tree (only MC)"}; + 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"}; + // topological cuts + Configurable> binsPt{"binsPt", std::vector{hf_cuts_bs_to_jpsi_phi::vecBinsPt}, "pT bin limits"}; + Configurable> cuts{"cuts", {hf_cuts_bs_to_jpsi_phi::Cuts[0], hf_cuts_bs_to_jpsi_phi::NBinsPt, hf_cuts_bs_to_jpsi_phi::NCutVars, hf_cuts_bs_to_jpsi_phi::labelsPt, hf_cuts_bs_to_jpsi_phi::labelsCutVar}, "Bs candidate selection per pT bin"}; + // Enable PID + Configurable kaonPidMethod{"kaonPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor kaon (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"}; + Configurable acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"}; + // TPC PID + Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", 5., "Nsigma cut on TPC only"}; + Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; + // TOF PID + Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; + Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; + Configurable nSigmaTofMax{"nSigmaTofMax", 5., "Nsigma cut on TOF only"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; + // Bs ML inference + Configurable> binsPtBsMl{"binsPtBsMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; + Configurable> cutDirBsMl{"cutDirBsMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; + Configurable> cutsBsMl{"cutsBsMl", {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"}; + Configurable nClassesBsMl{"nClassesBsMl", static_cast(hf_cuts_ml::NCutScores), "Number of classes in ML model"}; + Configurable> namesInputFeatures{"namesInputFeatures", std::vector{"feature1", "feature2"}, "Names of ML model input features"}; + // CCDB configuration + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"path_ccdb/BDT_BS/"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_BSToJpsiPhi.onnx"}, "ONNX file names for each pT bin (if not from CCDB full path)"}; + 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"}; + + HfHelper hfHelper; + TrackSelectorKa selectorKaon; + o2::analysis::HfMlResponseBsToJpsiPhiReduced hfMlResponse; + o2::ccdb::CcdbApi ccdbApi; + + using TracksKaon = soa::Join; + std::vector outputMl = {}; + + // Filter filterSelectCandidates = (aod::hf_sel_candidate_bplus::isSelBsToJpsiPi >= selectionFlagBs); + + HistogramRegistry registry{"registry"}; + + void init(InitContext&) + { + std::array processFuncData{doprocessData, doprocessDataWithBsMl}; + if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for data can be enabled at a time."); + } + std::array processFuncMc{doprocessMc, doprocessMcWithBsMl}; + if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for MC can be enabled at a time."); + } + + if (kaonPidMethod < 0 || kaonPidMethod >= PidMethod::NPidMethods) { + LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)"); + } + + if (kaonPidMethod != PidMethod::NoPid) { + selectorKaon.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); + selectorKaon.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorKaon.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); + selectorKaon.setRangePtTof(ptPidTofMin, ptPidTofMax); + selectorKaon.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorKaon.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); + } + + const AxisSpec axisMassBs{150, 4.5, 6.0}; + const AxisSpec axisMassJpsi{600, 2.8f, 3.4f}; + const AxisSpec axisMassPhi{200, 0.9f, 1.1f}; + const AxisSpec axisPtProng{100, 0., 10.}; + const AxisSpec axisImpactPar{200, -0.05, 0.05}; + const AxisSpec axisPtJpsi{100, 0., 50.}; + const AxisSpec axisRapidity{100, -2., 2.}; + const AxisSpec axisPtB{(std::vector)binsPt, "#it{p}_{T}^{B_{s}^{0}} (GeV/#it{c})"}; + const AxisSpec axisPtKa{100, 0.f, 10.f}; + const AxisSpec axisPtPhi{100, 0.f, 10.f}; + + registry.add("hMass", bSCandTitle + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassBs, axisPtB}}); + registry.add("hMassJpsi", bSCandTitle + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hMassPhi", bSCandTitle + "inv. mass K^{+}K^{#minus} (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassPhi, axisPtPhi}}); + registry.add("hd0K", bSCandTitle + "Kaon DCAxy to prim. vertex (cm);" + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + + // histograms processMC + if (doprocessMc || doprocessMcWithBsMl) { + registry.add("hPtJpsiGen", mcParticleMatched + "J/#Psi #it{p}_{T}^{gen} (GeV/#it{c}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisPtProng, axisPtB}}); + registry.add("hPtPhiGen", mcParticleMatched + "#phi #it{p}_{T}^{gen} (GeV/#it{c}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisPtProng, axisPtB}}); + registry.add("hPtKGen", mcParticleMatched + "Kaon #it{p}_{T}^{gen} (GeV/#it{c}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisPtProng, axisPtB}}); + registry.add("hYGenWithProngsInAcceptance", mcParticleMatched + "Kaon #it{p}_{T}^{gen} (GeV/#it{c}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisPtProng, axisRapidity}}); + registry.add("hMassRecSig", bSCandMatch + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisMassBs, axisPtB}}); + registry.add("hMassJpsiRecSig", bSCandMatch + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2}); J/#Psi " + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hMassPhiRecSig", bSCandMatch + "inv. mass K^{+}K^{#minus} (GeV/#it{c}^{2}); #phi " + stringPt, {HistType::kTH2F, {axisMassPhi, axisPtPhi}}); + registry.add("hd0KRecSig", bSCandMatch + "Kaon DCAxy to prim. vertex (cm); K^{+} " + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + registry.add("hMassRecBg", bSCandUnmatch + "inv. mass J/#Psi K^{+} (GeV/#it{c}^{2}); B_{s}^{0} " + stringPt, {HistType::kTH2F, {axisMassBs, axisPtB}}); + registry.add("hMassJpsiRecBg", bSCandUnmatch + "inv. mass #mu^{+}#mu^{#minus} (GeV/#it{c}^{2}); J/#Psi " + stringPt, {HistType::kTH2F, {axisMassJpsi, axisPtJpsi}}); + registry.add("hMassPhiRecBg", bSCandMatch + "inv. mass K^{+}K^{#minus} (GeV/#it{c}^{2}); #phi " + stringPt, {HistType::kTH2F, {axisMassPhi, axisPtPhi}}); + registry.add("hd0KRecBg", bSCandMatch + "Kaon DCAxy to prim. vertex (cm); K^{+} " + stringPt, {HistType::kTH2F, {axisImpactPar, axisPtKa}}); + } + + if (doprocessDataWithBsMl || doprocessMcWithBsMl) { + hfMlResponse.configure(binsPtBsMl, cutsBsMl, cutDirBsMl, nClassesBsMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } + } + + /// Selection of Bs daughter in geometrical acceptance + /// \param etaProng is the pseudorapidity of Bs prong + /// \param ptProng is the pT of Bs prong + /// \return true if prong is in geometrical acceptance + template + bool isProngInAcceptance(const T& etaProng, const T& ptProng) + { + return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; + } + + /// Fill candidate information at reconstruction level + /// \param doMc is the flag to enable the filling with MC information + /// \param withBsMl is the flag to enable the filling with ML scores for the Bs candidate + /// \param candidate is the Bs candidate + /// \param candidatesJpsi is the table with Jpsi candidates + template + void fillCand(Cand const& candidate, + aod::HfRedJpsis const& /*candidatesJpsi*/, + aod::HfRedBach0Tracks const&, + aod::HfRedBach1Tracks const&) + { + auto ptCandBs = candidate.pt(); + auto invMassBs = hfHelper.invMassBsToJpsiPhi(candidate); + auto candJpsi = candidate.template jpsi_as(); + auto candKa0 = candidate.template prong0Phi_as(); + auto candKa1 = candidate.template prong1Phi_as(); + std::array pVecKa0 = {candKa0.px(), candKa0.py(), candKa0.pz()}; + std::array pVecKa1 = {candKa1.px(), candKa1.py(), candKa1.pz()}; + auto ptJpsi = candidate.ptProng0(); + auto invMassJpsi = candJpsi.m(); + auto invMassPhi = RecoDecay::m(std::array{pVecKa0, pVecKa1}, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}); + uint8_t statusBs = 0; + + int8_t flagMcMatchRec{0}, channelMcMatchRec{0}, flagWrongCollision{0}; + bool isSignal = false; + if constexpr (doMc) { + flagMcMatchRec = candidate.flagMcMatchRec(); + channelMcMatchRec = candidate.channelMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); + isSignal = flagMcMatchRec == o2::hf_decay::hf_cand_beauty::BsToJpsiKK && + channelMcMatchRec == o2::hf_decay::hf_cand_beauty::BsToJpsiPhi; + } + + SETBIT(statusBs, SelectionStep::RecoSkims); + if (hfHelper.selectionBsToJpsiPhiTopol(candidate, candKa0, candKa1, cuts, binsPt)) { + SETBIT(statusBs, SelectionStep::RecoTopol); + } else if (selectionFlagBs >= BIT(SelectionStep::RecoTopol) * 2 - 1) { + return; + } + // track-level PID selection + // auto trackKa = candidate.template prong1_as(); + if (kaonPidMethod == PidMethod::TpcOrTof || kaonPidMethod == PidMethod::TpcAndTof) { + int pidTrackKa0{TrackSelectorPID::Status::NotApplicable}; + int pidTrackKa1{TrackSelectorPID::Status::NotApplicable}; + if (kaonPidMethod == PidMethod::TpcOrTof) { + pidTrackKa0 = selectorKaon.statusTpcOrTof(candKa0); + pidTrackKa1 = selectorKaon.statusTpcOrTof(candKa1); + } else if (kaonPidMethod == PidMethod::TpcAndTof) { + pidTrackKa0 = selectorKaon.statusTpcAndTof(candKa0); + pidTrackKa1 = selectorKaon.statusTpcAndTof(candKa1); + } + if (hfHelper.selectionBsToJpsiPhiPid(pidTrackKa0, acceptPIDNotApplicable.value) && + hfHelper.selectionBsToJpsiPhiPid(pidTrackKa1, acceptPIDNotApplicable.value)) { + // LOGF(info, "Bs candidate selection failed at PID selection"); + SETBIT(statusBs, SelectionStep::RecoPID); + } else if (selectionFlagBs >= BIT(SelectionStep::RecoPID) * 2 - 1) { + return; + } + } + + float candidateMlScoreSig = -1; + if constexpr (withBsMl) { + // Bs ML selections + std::vector inputFeatures = hfMlResponse.getInputFeatures(candidate, candKa0, candKa1); + if (hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl)) { + SETBIT(statusBs, SelectionStep::RecoMl); + } else if (selectionFlagBs >= BIT(SelectionStep::RecoMl) * 2 - 1) { + return; + } + candidateMlScoreSig = outputMl[1]; + } + + registry.fill(HIST("hMass"), invMassBs, ptCandBs); + registry.fill(HIST("hMassJpsi"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hMassPhi"), invMassPhi, candidate.ptProng0()); + registry.fill(HIST("hd0K"), candidate.impactParameter1(), candidate.ptProng1()); + if constexpr (doMc) { + if (isSignal) { + registry.fill(HIST("hMassRecSig"), invMassBs, ptCandBs); + registry.fill(HIST("hMassJpsiRecSig"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hd0KRecSig"), candidate.impactParameter1(), candidate.ptProng1()); + } else if (fillBackground) { + registry.fill(HIST("hMassRecBg"), invMassBs, ptCandBs); + registry.fill(HIST("hMassJpsiRecBg"), invMassJpsi, candidate.ptProng0()); + registry.fill(HIST("hd0KRecBg"), candidate.impactParameter1(), candidate.ptProng1()); + } + } + + float pseudoRndm = ptJpsi * 1000. - static_cast(ptJpsi * 1000); + if (ptCandBs >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor) { + float ptMother = -1.; + if constexpr (doMc) { + ptMother = candidate.ptMother(); + } + + hfRedCandBsLite( + // Bs - meson features + invMassBs, + ptCandBs, + candidate.eta(), + candidate.phi(), + hfHelper.yBs(candidate), + candidate.cpa(), + candidate.cpaXY(), + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ctXY(std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}), + candidate.impactParameterProduct(), + candidate.impactParameterProductJpsi(), + candidate.impactParameterProductPhi(), + candidate.maxNormalisedDeltaIP(), + candidateMlScoreSig, + // J/Psi features + invMassJpsi, + ptJpsi, + invMassPhi, + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameter2(), + candidate.impactParameter3(), + // candJpsi.ptProngMin(), + // candJpsi.absEtaProngMin(), + // candJpsi.itsNClsProngMin(), + // candJpsi.tpcNClsCrossedRowsProngMin(), + // candJpsi.tpcChi2NClProngMax(), + // kaon features + candKa0.pt(), + // std::abs(RecoDecay::eta(candKa0.pVector())), + // candKa0.itsNCls(), + // candKa0.tpcNClsCrossedRows(), + // candKa0.tpcChi2NCl(), + candKa0.tpcNSigmaKa(), + candKa0.tofNSigmaKa(), + candKa0.tpcTofNSigmaKa(), + candKa1.pt(), + candKa1.tpcNSigmaKa(), + candKa1.tofNSigmaKa(), + candKa1.tpcTofNSigmaKa(), + // MC truth + flagMcMatchRec, + channelMcMatchRec, + isSignal, + flagWrongCollision, + ptMother); + } + } + + /// Fill particle histograms (gen MC truth) + void fillCandMcGen(aod::HfMcGenRedBss::iterator const& particle) + { + auto ptParticle = particle.ptTrack(); + auto yParticle = particle.yTrack(); + if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { + return; + } + std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; + std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; + bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + + registry.fill(HIST("hPtJpsiGen"), ptProngs[0], ptParticle); + registry.fill(HIST("hPtKGen"), ptProngs[1], ptParticle); + + // generated Bs with daughters in geometrical acceptance + if (prongsInAcc) { + registry.fill(HIST("hYGenWithProngsInAcceptance"), ptParticle, yParticle); + } + } + + // Process functions + void processData(aod::HfRedCandBsToJpsiPhi const& candidates, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaon0Tracks, + aod::HfRedBach1Tracks const& kaon1Tracks) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); + } // candidate loop + } // processData + PROCESS_SWITCH(HfTaskBsToJpsiPhiReduced, processData, "Process data without ML for Bs", true); + + void processDataWithBsMl(aod::HfRedCandBsToJpsiPhi const& candidates, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaon0Tracks, + aod::HfRedBach1Tracks const& kaon1Tracks) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); + } // candidate loop + } // processDataWithBsMl + PROCESS_SWITCH(HfTaskBsToJpsiPhiReduced, processDataWithBsMl, "Process data with ML for Bs", false); + + void processMc(soa::Join const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaon0Tracks, + aod::HfRedBach1Tracks const& kaon1Tracks) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBsToJpsiPhiReduced, processMc, "Process MC without ML for Bs", false); + + void processMcWithBsMl(soa::Join const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRedJpsis const& candidatesJpsi, + aod::HfRedBach0Tracks const& kaon0Tracks, + aod::HfRedBach1Tracks const& kaon1Tracks) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesJpsi, kaon0Tracks, kaon1Tracks); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcWithBsMl + PROCESS_SWITCH(HfTaskBsToJpsiPhiReduced, processMcWithBsMl, "Process MC with ML for Bs", false); + +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index a083e9713b2..513f2a998fc 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -16,16 +16,16 @@ #ifndef PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ #define PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ -#include - -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Utils/utilsEvSelHf.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisHelpers.h" #include "Framework/HistogramRegistry.h" -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include + +#include namespace o2::hf_evsel { @@ -81,6 +81,31 @@ float getTpcTofNSigmaPi1(const T1& prong1) } return defaultNSigma; } + +/// Helper function to retrive PID information of bachelor kaon from b-hadron decay +/// \param prong1 kaon track from reduced data format, aod::HfRedBachProng0Tracks +/// \return the combined TPC and TOF n-sigma for kaon +template +float getTpcTofNSigmaKa1(const T1& prong1) +{ + float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + + bool hasTpc = prong1.hasTPC(); + bool hasTof = prong1.hasTOF(); + + if (hasTpc && hasTof) { + float tpcNSigma = prong1.tpcNSigmaKa(); + float tofNSigma = prong1.tofNSigmaKa(); + return std::sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); + } + if (hasTpc) { + return std::abs(prong1.tpcNSigmaKa()); + } + if (hasTof) { + return std::abs(prong1.tofNSigmaKa()); + } + return defaultNSigma; +} } // namespace o2::pid_tpc_tof_utils #endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 014bfa3e32e..a32a88e1d12 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -18,13 +18,9 @@ #ifndef PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ #define PWGHF_DATAMODEL_CANDIDATERECONSTRUCTIONTABLES_H_ -#include -#include -#include - -#include -#include -#include +#include "PWGHF/Core/DecayChannels.h" // FIXME: temporary until propagated where needed +#include "PWGHF/Utils/utilsPid.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "ALICE3/DataModel/ECAL.h" #include "Common/Core/RecoDecay.h" @@ -32,10 +28,13 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include +#include +#include -#include "PWGHF/Utils/utilsPid.h" -#include "PWGHF/Core/DecayChannels.h" // FIXME: temporary until propagated where needed +#include +#include +#include namespace o2::aod { @@ -485,6 +484,23 @@ DECLARE_SOA_COLUMN(ImpactParameterZ2, impactParameterZ2, float); DECLARE_SOA_COLUMN(ErrorImpactParameterZ2, errorImpactParameterZ2, float); //! DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterZNormalised2, impactParameterZNormalised2, //! [](float dca, float err) -> float { return dca / err; }); +DECLARE_SOA_COLUMN(PxProng3, pxProng3, float); //! +DECLARE_SOA_COLUMN(PyProng3, pyProng3, float); //! +DECLARE_SOA_COLUMN(PzProng3, pzProng3, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(PtProng3, ptProng3, //! + [](float px, float py) -> float { return RecoDecay::pt(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pt2Prong3, pt2Prong3, //! + [](float px, float py) -> float { return RecoDecay::pt2(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(PVectorProng3, pVectorProng3, //! + [](float px, float py, float pz) -> std::array { return std::array{px, py, pz}; }); +DECLARE_SOA_COLUMN(ImpactParameter3, impactParameter3, float); //! +DECLARE_SOA_COLUMN(ErrorImpactParameter3, errorImpactParameter3, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterNormalised3, impactParameterNormalised3, //! + [](float dca, float err) -> float { return dca / err; }); +DECLARE_SOA_COLUMN(ImpactParameterZ3, impactParameterZ3, float); //! +DECLARE_SOA_COLUMN(ErrorImpactParameterZ3, errorImpactParameterZ3, float); //! +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterZNormalised3, impactParameterZNormalised3, //! + [](float dca, float err) -> float { return dca / err; }); DECLARE_SOA_COLUMN(NProngsContributorsPV, nProngsContributorsPV, uint8_t); //! number of prongs contributing to the primary-vertex reconstruction DECLARE_SOA_COLUMN(BitmapProngsContributorsPV, bitmapProngsContributorsPV, uint8_t); //! bitmap with booleans indicating prongs contributing to the primary-vertex reconstruction /// prong PID nsigma @@ -618,6 +634,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProngSqSum, impactParameterProngSqSum, [](float impParProng0, float impParProng1) -> float { return RecoDecay::sumOfSquares(impParProng0, impParProng1); }); DECLARE_SOA_DYNAMIC_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, //! [](float xVtxP, float yVtxP, float xVtxS, float yVtxS, float errDlxy, float pxM, float pyM, float ip0, float errIp0, float ip1, float errIp1, float px0, float py0, float px1, float py1) -> float { return RecoDecay::maxNormalisedDeltaIP(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, errDlxy, std::array{pxM, pyM}, std::array{ip0, ip1}, std::array{errIp0, errIp1}, std::array{std::array{px0, py0}, std::array{px1, py1}}); }); +DECLARE_SOA_DYNAMIC_COLUMN(CtXY, ctXY, //! + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float xVtxP, float yVtxP, float xVtxS, float yVtxS, const std::array& m) -> float { return RecoDecay::ctXY(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, m); }); // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level @@ -851,12 +869,17 @@ namespace hf_cand_bplus { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand2Prong, "_0"); // D0 index // MC matching result: -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level -DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(ChannelMcMatchRec, channelMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProduct, impactParameterProduct, // Impact parameter product for B+ -> J/Psi K + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float xVtxP, float yVtxP, float zVtxP, float xVtxS, float yVtxS, float zVtxS, float impParK) -> float { return impParK * RecoDecay::impParXY(std::array{xVtxP, yVtxP, zVtxP}, std::array{xVtxS, yVtxS, zVtxS}, RecoDecay::pVec(std::array{px0, py0, pz0}, std::array{px1, py1, pz1})); }); +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, // J/Psi impact parameter for B+ -> J/Psi K + [](float dcaDauPos, float dcaDauNeg) -> float { return dcaDauPos * dcaDauNeg; }); enum DecayType { BplusToD0Pi = 0 }; @@ -865,6 +888,11 @@ enum DecayTypeMc : uint8_t { BplusToD0PiToKPiPi = 0, PartlyRecoDecay, OtherDecay, NDecayTypeMc }; + +enum class DecayTypeBToJpsiMc : uint8_t { BplusToJpsiKToMuMuK = 0, + PartlyRecoDecay, + OtherDecay, + NDecayTypeMc }; } // namespace hf_cand_bplus // declare dedicated BPlus decay candidate table @@ -898,7 +926,8 @@ DECLARE_SOA_TABLE(HfCandBplusBase, "AOD", "HFCANDBPLUSBASE", hf_cand::Phi, hf_cand::Y, hf_cand::E, - hf_cand::E2); + hf_cand::E2, + hf_cand_2prong::CtXY); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandBplusExt, HfCandBplusBase, "HFCANDBPLUSEXT", @@ -936,6 +965,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProngSqSum, impactParameterProngSqSum, [](float impParProng0, float impParProng1, float impParProng2) -> float { return RecoDecay::sumOfSquares(impParProng0, impParProng1, impParProng2); }); DECLARE_SOA_DYNAMIC_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, //! [](float xVtxP, float yVtxP, float xVtxS, float yVtxS, float errDlxy, float pxM, float pyM, float ip0, float errIp0, float ip1, float errIp1, float ip2, float errIp2, float px0, float py0, float px1, float py1, float px2, float py2) -> float { return RecoDecay::maxNormalisedDeltaIP(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, errDlxy, std::array{pxM, pyM}, std::array{ip0, ip1, ip2}, std::array{errIp0, errIp1, errIp2}, std::array{std::array{px0, py0}, std::array{px1, py1}, std::array{px2, py2}}); }); +DECLARE_SOA_DYNAMIC_COLUMN(CtXY, ctXY, //! + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2, float xVtxP, float yVtxP, float xVtxS, float yVtxS, const std::array& m) -> float { + return RecoDecay::ctXY(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}, std::array{px2, py2, pz2}}, m); + }); // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); //! reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); //! generator level @@ -1077,6 +1110,55 @@ DECLARE_SOA_TABLE(HfCand3ProngMcGen, "AOD", "HFCAND3PMCGEN", //! hf_cand_3prong::FlagMcDecayChanGen, hf_cand::IdxBhadMotherPart); +// declare dedicated BPlus -> J/Psi K decay candidate table +// convention: prongs 0 and 1 should be J/Psi decay products +DECLARE_SOA_TABLE(HfCandBpJPBase, "AOD", "HFCANDBPJPBASE", + // general columns + HFCAND_COLUMNS, + /* prong 2 */ hf_cand::ImpactParameterNormalised2, + hf_cand::PtProng2, + hf_cand::Pt2Prong2, + hf_cand::PVectorProng2, + // 3-prong specific columns + o2::soa::Index<>, + 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::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, + hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, + /* dynamic columns */ + hf_cand_3prong::M, + hf_cand_3prong::M2, + hf_cand_3prong::ImpactParameterProngSqSum, + hf_cand_bplus::ImpactParameterProduct, + hf_cand_bplus::ImpactParameterProductJpsi, + /* dynamic columns that use candidate momentum components */ + hf_cand::Pt, + hf_cand::Pt2, + hf_cand::P, + hf_cand::P2, + hf_cand::PVector, + hf_cand::Cpa, + hf_cand::CpaXY, + hf_cand::Ct, + hf_cand::ImpactParameterXY, + hf_cand_3prong::MaxNormalisedDeltaIP, + hf_cand::Eta, + hf_cand::Phi, + hf_cand::Y, + hf_cand::E, + hf_cand::E2, + hf_cand_3prong::CtXY); + +// extended table with expression columns that can be used as arguments of dynamic columns +DECLARE_SOA_EXTENDED_TABLE_USER(HfCandBpJPExt, HfCandBpJPBase, "HFCANDBPJPEXT", + hf_cand_3prong::Px, hf_cand_3prong::Py, hf_cand_3prong::Pz); + +DECLARE_SOA_TABLE(HfCandBpJPDaus, "AOD", "HFCANDBPJPDAUS", + hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_track_index::Prong2Id); + +using HfCandBplusToJpsi = soa::Join; + namespace hf_cand_casc_lf { // mapping of decay types @@ -1979,6 +2061,7 @@ namespace hf_cand_b0 DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand3Prong, "_0"); // D index // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(ChannelMcMatchRec, channelMcMatchRec, int8_t); // reconstruction level DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level @@ -1986,7 +2069,7 @@ DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level // mapping of decay types -enum DecayType { B0ToDPi }; +enum DecayType { B0ToDPi = 0 }; enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, @@ -2054,15 +2137,26 @@ namespace hf_cand_bs { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand3Prong, "_0"); // Ds index // MC matching result: -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level -DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(ChannelMcMatchRec, channelMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProduct, impactParameterProduct, // Impact parameter product for Bs -> J/Psi phi + [](float pxJpsiDauPos, float pyJpsiDauPos, float pzJpsiDauPos, float pxJpsiDauNeg, float pyJpsiDauNeg, float pzJpsiDauNeg, float pxLfTrack0, float pyLfTrack0, float pzLfTrack0, float pxLfTrack1, float pyLfTrack1, float pzLfTrack1, float xVtxP, float yVtxP, float zVtxP, float xVtxS, float yVtxS, float zVtxS) -> float { + float impParJpsi = RecoDecay::impParXY(std::array{xVtxP, yVtxP, zVtxP}, std::array{xVtxS, yVtxS, zVtxS}, RecoDecay::pVec(std::array{pxJpsiDauPos, pyJpsiDauPos, pzJpsiDauPos}, std::array{pxJpsiDauNeg, pyJpsiDauNeg, pzJpsiDauNeg})); + float impParPhi = RecoDecay::impParXY(std::array{xVtxP, yVtxP, zVtxP}, std::array{xVtxS, yVtxS, zVtxS}, RecoDecay::pVec(std::array{pxLfTrack0, pyLfTrack0, pzLfTrack0}, std::array{pxLfTrack1, pyLfTrack1, pzLfTrack1})); + return impParJpsi * impParPhi; + }); +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, // J/Psi impact parameter for Bs -> J/Psi phi + [](float dcaDauPos, float dcaDauNeg) -> float { return dcaDauPos * dcaDauNeg; }); +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProductPhi, impactParameterProductPhi, // J/Psi impact parameter for Bs -> J/Psi phi + [](float dcaLfTrack0, float dcaLfTrack1) -> float { return dcaLfTrack0 * dcaLfTrack1; }); // mapping of decay types -enum DecayType { BsToDsPi }; +enum DecayType { BsToDsPi = 0 }; enum DecayTypeMc : uint8_t { BsToDsPiToPhiPiPiToKKPiPi = 0, // Bs(bar) → Ds∓ π± → (Phi π∓) π± → (K- K+ π∓) π± BsToDsPiToK0starKPiToKKPiPi, // Bs(bar) → Ds∓ π± → (K0* K∓) π± → (K- K+ π∓) π± @@ -2074,6 +2168,11 @@ enum DecayTypeMc : uint8_t { BsToDsPiToPhiPiPiToKKPiPi = 0, // Bs(bar) → Ds∓ OtherDecay, NDecayTypeMc }; // counter of differentiated MC decay types +enum class DecayTypeBToJpsiMc : uint8_t { BsToJpsiPhiToMuMuKK = 0, // Bs(bar) → J/Psi Phi → (µ+ µ-) (K- K+) + PartlyRecoDecay, // 4 final state particles have another common b-hadron ancestor + OtherDecay, + NDecayTypeMc }; // counter of differentiated MC decay types + } // namespace hf_cand_bs // declare dedicated Bs decay candidate table @@ -2107,6 +2206,7 @@ DECLARE_SOA_TABLE(HfCandBsBase, "AOD", "HFCANDBSBASE", hf_cand::Y, hf_cand::E, hf_cand::E2, + hf_cand_2prong::CtXY, o2::soa::Marker<1>); // extended table with expression columns that can be used as arguments of dynamic columns @@ -2126,6 +2226,82 @@ DECLARE_SOA_TABLE(HfCandBsMcRec, "AOD", "HFCANDBSMCREC", DECLARE_SOA_TABLE(HfCandBsMcGen, "AOD", "HFCANDBSMCGEN", hf_cand_bs::FlagMcMatchGen); +namespace hf_cand_4prong +{ +DECLARE_SOA_EXPRESSION_COLUMN(Px, px, //! + float, 1.f * aod::hf_cand::pxProng0 + 1.f * aod::hf_cand::pxProng1 + 1.f * aod::hf_cand::pxProng2 + 1.f * aod::hf_cand::pxProng3); +DECLARE_SOA_EXPRESSION_COLUMN(Py, py, //! + float, 1.f * aod::hf_cand::pyProng0 + 1.f * aod::hf_cand::pyProng1 + 1.f * aod::hf_cand::pyProng2 + 1.f * aod::hf_cand::pyProng3); +DECLARE_SOA_EXPRESSION_COLUMN(Pz, pz, //! + float, 1.f * aod::hf_cand::pzProng0 + 1.f * aod::hf_cand::pzProng1 + 1.f * aod::hf_cand::pzProng2 + 1.f * aod::hf_cand::pzProng3); +DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2, float px3, float py3, float pz3, const std::array& m) -> float { return RecoDecay::m(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}, std::array{px2, py2, pz2}, std::array{px3, py3, pz3}}, m); }); +DECLARE_SOA_DYNAMIC_COLUMN(M2, m2, //! + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2, float px3, float py3, float pz3, const std::array& m) -> float { return RecoDecay::m2(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}, std::array{px2, py2, pz2}, std::array{px3, py3, pz3}}, m); }); +DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterProngSqSum, impactParameterProngSqSum, //! + [](float impParProng0, float impParProng1, float impParProng2, float impParProng3) -> float { return RecoDecay::sumOfSquares(impParProng0, impParProng1, impParProng2, impParProng3); }); +DECLARE_SOA_DYNAMIC_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, //! + [](float xVtxP, float yVtxP, float xVtxS, float yVtxS, float errDlxy, float pxM, float pyM, float ip0, float errIp0, float ip1, float errIp1, float ip2, float errIp2, float ip3, float errIp3, float px0, float py0, float px1, float py1, float px2, float py2, float px3, float py3) -> float { return RecoDecay::maxNormalisedDeltaIP(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, errDlxy, std::array{pxM, pyM}, std::array{ip0, ip1, ip2, ip3}, std::array{errIp0, errIp1, errIp2, errIp3}, std::array{std::array{px0, py0}, std::array{px1, py1}, std::array{px2, py2}, std::array{px3, py3}}); }); +DECLARE_SOA_DYNAMIC_COLUMN(CtXY, ctXY, //! + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float px2, float py2, float pz2, float px3, float py3, float pz3, float xVtxP, float yVtxP, float xVtxS, float yVtxS, const std::array& m) -> float { return RecoDecay::ctXY(std::array{xVtxP, yVtxP}, std::array{xVtxS, yVtxS}, std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}, std::array{px2, py2, pz2}, std::array{px3, py3, pz3}}, m); }); +} // namespace hf_cand_4prong + +// declare dedicated Bs -> J/Psi phi decay candidate table +// convention: prongs 0 and 1 should be J/Psi decay products, 2 and 3 should be phi decay products +DECLARE_SOA_TABLE(HfCandBsJPBase, "AOD", "HFCANDBSJPBASE", + // general columns + HFCAND_COLUMNS, + /* prong 2 */ hf_cand::ImpactParameterNormalised2, + hf_cand::PtProng2, + hf_cand::Pt2Prong2, + hf_cand::PVectorProng2, + /* prong 3 */ hf_cand::ImpactParameterNormalised3, + hf_cand::PtProng3, + hf_cand::Pt2Prong3, + hf_cand::PVectorProng3, + // 4-prong specific columns + o2::soa::Index<>, + 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::PxProng3, hf_cand::PyProng3, hf_cand::PzProng3, + hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, hf_cand::ImpactParameter3, + hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, hf_cand::ErrorImpactParameter3, + /* dynamic columns */ + hf_cand_4prong::M, + hf_cand_4prong::M2, + hf_cand_4prong::ImpactParameterProngSqSum, + hf_cand_bs::ImpactParameterProduct, + hf_cand_bs::ImpactParameterProductJpsi, + hf_cand_bs::ImpactParameterProductPhi, + /* dynamic columns that use candidate momentum components */ + hf_cand::Pt, + hf_cand::Pt2, + hf_cand::P, + hf_cand::P2, + hf_cand::PVector, + hf_cand::Cpa, + hf_cand::CpaXY, + hf_cand::Ct, + hf_cand::ImpactParameterXY, + hf_cand_4prong::MaxNormalisedDeltaIP, + hf_cand::Eta, + hf_cand::Phi, + hf_cand::Y, + hf_cand::E, + hf_cand::E2, + hf_cand_4prong::CtXY, + o2::soa::Marker<1>); + +// extended table with expression columns that can be used as arguments of dynamic columns +DECLARE_SOA_EXTENDED_TABLE_USER(HfCandBsJPExt, HfCandBsJPBase, "HFCANDBSJPEXT", + hf_cand_4prong::Px, hf_cand_4prong::Py, hf_cand_4prong::Pz); + +DECLARE_SOA_TABLE(HfCandBsJPDaus, "AOD", "HFCANDBSJPDAUS", + hf_cand_bs::Prong0Id, hf_track_index::Prong1Id, hf_track_index::Prong2Id, hf_track_index::Prong3Id); + +using HfCandBsToJpsi = soa::Join; + // specific Σc0,++ candidate properties namespace hf_cand_sigmac { diff --git a/PWGHF/DataModel/CandidateSelectionTables.h b/PWGHF/DataModel/CandidateSelectionTables.h index f693605f635..0ac6ffa1a98 100644 --- a/PWGHF/DataModel/CandidateSelectionTables.h +++ b/PWGHF/DataModel/CandidateSelectionTables.h @@ -250,19 +250,23 @@ DECLARE_SOA_TABLE(HfMlB0ToDPi, "AOD", "HFMLB0", //! namespace hf_sel_candidate_bs { -DECLARE_SOA_COLUMN(IsSelBsToDsPi, isSelBsToDsPi, int); //! -DECLARE_SOA_COLUMN(MlProbBsToDsPi, mlProbBsToDsPi, std::vector); //! +DECLARE_SOA_COLUMN(IsSelBsToDsPi, isSelBsToDsPi, int); //! +DECLARE_SOA_COLUMN(MlProbBsToDsPi, mlProbBsToDsPi, std::vector); //! +DECLARE_SOA_COLUMN(MlProbBsToJpsiPhi, mlProbBsToJpsiPhi, std::vector); //! } // namespace hf_sel_candidate_bs DECLARE_SOA_TABLE(HfSelBsToDsPi, "AOD", "HFSELBS", //! hf_sel_candidate_bs::IsSelBsToDsPi); DECLARE_SOA_TABLE(HfMlBsToDsPi, "AOD", "HFMLBS", //! hf_sel_candidate_bs::MlProbBsToDsPi); +DECLARE_SOA_TABLE(HfMlBsToJpsiPhi, "AOD", "HFMLBSTOJPSIPHI", //! + hf_sel_candidate_bs::MlProbBsToDsPi); namespace hf_sel_candidate_bplus { -DECLARE_SOA_COLUMN(IsSelBplusToD0Pi, isSelBplusToD0Pi, int); //! selection flag on B+ candidate -DECLARE_SOA_COLUMN(MlProbBplusToD0Pi, mlProbBplusToD0Pi, float); //! ML score of B+ candidate for signal class +DECLARE_SOA_COLUMN(IsSelBplusToD0Pi, isSelBplusToD0Pi, int); //! selection flag on B+ candidate +DECLARE_SOA_COLUMN(MlProbBplusToD0Pi, mlProbBplusToD0Pi, float); //! ML score of B+ candidate for signal class +DECLARE_SOA_COLUMN(MlProbBplusToJpsiK, mlProbBplusToJpsiK, float); //! ML score of B+ candidate for signal class } // namespace hf_sel_candidate_bplus DECLARE_SOA_TABLE(HfSelBplusToD0Pi, "AOD", "HFSELBPLUS", //! @@ -271,6 +275,8 @@ DECLARE_SOA_TABLE(HfSelBplusToD0Pi, "AOD", "HFSELBPLUS", //! DECLARE_SOA_TABLE(HfMlBplusToD0Pi, "AOD", "HFMLBPLUS", //! hf_sel_candidate_bplus::MlProbBplusToD0Pi); +DECLARE_SOA_TABLE(HfMlBplusToJpsiK, "AOD", "HFMLBPLUSTOJPSIK", //! + hf_sel_candidate_bplus::MlProbBplusToJpsiK); namespace hf_sel_candidate_lb { DECLARE_SOA_COLUMN(IsSelLbToLcPi, isSelLbToLcPi, int); //! selection flag on Lb candidate diff --git a/PWGHF/Utils/utilsTrkCandHf.h b/PWGHF/Utils/utilsTrkCandHf.h index 94fa2084370..43db7a21e08 100644 --- a/PWGHF/Utils/utilsTrkCandHf.h +++ b/PWGHF/Utils/utilsTrkCandHf.h @@ -16,10 +16,12 @@ #ifndef PWGHF_UTILS_UTILSTRKCANDHF_H_ #define PWGHF_UTILS_UTILSTRKCANDHF_H_ -#include +#include "PWGHF/Utils/utilsAnalysis.h" #include +#include + #include namespace o2::hf_trkcandsel @@ -58,6 +60,29 @@ int countOnesInBinary(uint8_t num) return count; } +/// Single-track cuts on dcaXY +/// \param trackPar is the track parametrisation +/// \param dca is the 2-D array with track DCAs +/// \param binsPtTrack is the array of pt bins for track selection +/// \param cutsTrackDCA are the cuts for track DCA selection +/// \return true if track passes all cuts +template +bool isSelectedTrackDCA(const T1& trackPar, const T2& dca, const C1& binsPtTrack, const C2& cutsTrackDCA) +{ + auto binPtTrack = o2::analysis::findBin(binsPtTrack, trackPar.getPt()); + if (binPtTrack == -1) { + return false; + } + + if (std::abs(dca[0]) < cutsTrackDCA->get(binPtTrack, "min_dcaxytoprimary")) { + return false; // minimum DCAxy + } + if (std::abs(dca[0]) > cutsTrackDCA->get(binPtTrack, "max_dcaxytoprimary")) { + return false; // maximum DCAxy + } + return true; +} + } // namespace o2::hf_trkcandsel #endif // PWGHF_UTILS_UTILSTRKCANDHF_H_ From fa29e45d0e1ef836d6e51fa9b5b5a1d1620102b1 Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Fri, 13 Jun 2025 16:46:08 +0200 Subject: [PATCH 067/116] [PWGLF] fix eta-cut in closure test correlations (#11606) --- PWGLF/Tasks/Strangeness/cascadecorrelations.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index 632d80dd4d1..0d6fd6d67cb 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -1080,7 +1080,7 @@ struct CascadeCorrelations { } // process mixed events Configurable etaGenCascades{"etaGenCascades", 0.8, "min/max of eta for generated cascades"}; - Filter genCascadesFilter = (nabs(aod::mcparticle::pdgCode) == 3312 && nabs(aod::mcparticle::eta) < etaGenCascades); + Filter genCascadesFilter = nabs(aod::mcparticle::pdgCode) == 3312; void processMC(aod::McCollision const&, soa::SmallGroups> const& collisions, soa::Filtered const& genCascades, aod::McParticles const& mcParticles) { @@ -1122,10 +1122,12 @@ struct CascadeCorrelations { auto trigger = *triggerAddress; auto assoc = *assocAddress; - double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -PIHalf); - if (!trigger.isPhysicalPrimary() || !assoc.isPhysicalPrimary()) continue; // require the cascades to be primaries + if (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); if (trigger.pdgCode() < 0) { // anti-trigg --> Plus if (assoc.pdgCode() < 0) { // anti-assoc --> Plus From 36a03b6ffeca41cc1451463f28fb8986e1bb738a Mon Sep 17 00:00:00 2001 From: Debadatta3337 Date: Fri, 13 Jun 2025 21:49:36 +0530 Subject: [PATCH 068/116] [PWGDQ] Updated HistogramLibrary (#11575) Co-authored-by: Debadatta3337 --- PWGDQ/Core/HistogramsLibrary.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 9fdb5b0cae5..7b975b1c2be 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -84,11 +84,11 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h if (subGroupStr.Contains("mult")) { if (subGroupStr.Contains("pp")) { hm->AddHistogram(histClass, "MultTPC", "MultTPC", false, 250, 0.0, 500.0, VarManager::kMultTPC); - hm->AddHistogram(histClass, "MultFV0A", "MultFV0A", false, 250, 0.0, 500.0, VarManager::kMultFV0A); - hm->AddHistogram(histClass, "MultFT0A", "MultFT0A", false, 300, 0.0, 300.0, VarManager::kMultFT0A); - hm->AddHistogram(histClass, "MultFT0C", "MultFT0C", false, 300, 0.0, 300.0, VarManager::kMultFT0C); - hm->AddHistogram(histClass, "MultFDDA", "MultFDDA", false, 300, 0.0, 300.0, VarManager::kMultFDDA); - hm->AddHistogram(histClass, "MultFDDC", "MultFDDC", false, 50, 0.0, 50.0, VarManager::kMultFDDC); + hm->AddHistogram(histClass, "MultFV0A", "MultFV0A", false, 1000, 0.0, 25000.0, VarManager::kMultFV0A); + hm->AddHistogram(histClass, "MultFT0A", "MultFT0A", false, 1000, 0.0, 25000.0, VarManager::kMultFT0A); + hm->AddHistogram(histClass, "MultFT0C", "MultFT0C", false, 1000, 0.0, 25000.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "MultFDDA", "MultFDDA", false, 1000, 0.0, 25000.0, VarManager::kMultFDDA); + hm->AddHistogram(histClass, "MultFDDC", "MultFDDC", false, 1000, 0.0, 25000.0, VarManager::kMultFDDC); hm->AddHistogram(histClass, "MultTracklets", "MultTracklets", false, 250, 0.0, 250.0, VarManager::kMultTracklets); hm->AddHistogram(histClass, "VtxNContribReal", "Vtx n contributors", false, 150, 0.0, 150.0, VarManager::kVtxNcontribReal); hm->AddHistogram(histClass, "VtxNContrib", "Vtx n contributors", false, 100, 0.0, 100.0, VarManager::kVtxNcontrib); @@ -115,6 +115,11 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "VtxZ_VtxNcontribReal", "VtxZ vs VtxNcontribReal", false, 100, -10.0, 10.0, VarManager::kVtxZ, 150, 0, 150.0, VarManager::kVtxNcontribReal); hm->AddHistogram(histClass, "VtxZ_MultNTracksPVeta1", "VtxZ vs MultNTracksPVeta1", false, 100, -10.0, 10.0, VarManager::kVtxZ, 150, 0, 150.0, VarManager::kMultNTracksPVeta1); hm->AddHistogram(histClass, "VtxZ_MultNTracksPVetaHalf", "VtxZ vs MultNTracksPVetaHalf", false, 100, -10.0, 10.0, VarManager::kVtxZ, 150, 0, 150.0, VarManager::kMultNTracksPVetaHalf); + hm->AddHistogram(histClass, "VtxZ_MultFV0A", "VtxZ vs MultFV0A", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFV0A); + hm->AddHistogram(histClass, "VtxZ_MultFT0A", "VtxZ vs MultFT0A", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFT0A); + hm->AddHistogram(histClass, "VtxZ_MultFT0C", "VtxZ vs MultFT0C", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "VtxZ_MultFDDA", "VtxZ vs MultFDDA", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFDDA); + hm->AddHistogram(histClass, "VtxZ_MultFDDC", "VtxZ vs MultFDDC", false, 20, -10.0, 10.0, VarManager::kVtxZ, 200, 0, 25000.0, VarManager::kMultFDDC); } else { hm->AddHistogram(histClass, "MultTPC", "MultTPC", false, 200, 0.0, 50000.0, VarManager::kMultTPC); @@ -944,6 +949,13 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_MultNTracksPVetaHalf", "Mass vs MultNTracksPVetaHalf", false, 200, 2.0, 5.0, VarManager::kMass, 150, 0, 150.0, VarManager::kMultNTracksPVetaHalf); hm->AddHistogram(histClass, "Mass_MultNTracksPVeta1", "Mass vs MultNTracksPVeta1", false, 200, 2.0, 5.0, VarManager::kMass, 150, 0, 150.0, VarManager::kMultNTracksPVeta1); } + if (subGroupStr.Contains("dimuon_fwdmult")) { + hm->AddHistogram(histClass, "Mass_MultFV0A", "Mass vs MultFV0A", false, 200, 2.0, 5.0, VarManager::kMass, 1000, 0, 25000.0, VarManager::kMultFV0A); + hm->AddHistogram(histClass, "Mass_MultFT0A", "Mass vs MultFT0A", false, 200, 2.0, 5.0, VarManager::kMass, 1000, 0, 25000.0, VarManager::kMultFT0A); + hm->AddHistogram(histClass, "Mass_MultFT0C", "Mass vs MultFT0C", false, 200, 2.0, 5.0, VarManager::kMass, 1000, 0, 25000.0, VarManager::kMultFT0C); + hm->AddHistogram(histClass, "Mass_MultFDDA", "Mass vs MultFDDA", false, 200, 2.0, 5.0, VarManager::kMass, 1000, 0, 25000.0, VarManager::kMultFDDA); + hm->AddHistogram(histClass, "Mass_MultFDDC", "Mass vs MultFDDC", false, 200, 2.0, 5.0, VarManager::kMass, 1000, 0, 25000.0, VarManager::kMultFDDC); + } if (subGroupStr.Contains("barrel")) { hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 5.0, VarManager::kMass); hm->AddHistogram(histClass, "Mass_HighRange", "", false, 375, 0.0, 15.0, VarManager::kMass); From acefb1ef9e3a5ea2e75d31edf7ac46f500ef1d35 Mon Sep 17 00:00:00 2001 From: dyx-11 <1260971129@qq.com> Date: Sat, 14 Jun 2025 01:50:28 +0800 Subject: [PATCH 069/116] [PWGUD] nch axis to nsample axis new (#11599) --- PWGUD/Tasks/flowCorrelationsUpc.cxx | 57 ++++++++++++++++------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/PWGUD/Tasks/flowCorrelationsUpc.cxx b/PWGUD/Tasks/flowCorrelationsUpc.cxx index 59aae4d6c86..11f7820a071 100644 --- a/PWGUD/Tasks/flowCorrelationsUpc.cxx +++ b/PWGUD/Tasks/flowCorrelationsUpc.cxx @@ -14,29 +14,31 @@ /// \author Mingrui Zhao (mingrui.zhao@cern.ch, mingrui.zhao@mail.labz0.org) /// copied from Thor Jensen (thor.kjaersgaard.jensen@cern.ch) and Debojit Sarkar (debojit.sarkar@cern.ch) -#include +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/DataModel/UDTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.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/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/RunningWorkflowInfo.h" -#include "CommonConstants/MathConstants.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/Core/RecoDecay.h" +#include "Framework/runDataProcessing.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/SGSelector.h" +#include "TRandom3.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" -#include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" +#include namespace o2::aod { @@ -98,6 +100,7 @@ struct FlowCorrelationsUpc { O2_DEFINE_CONFIGURABLE(cfgMinMixEventNum, int, 5, "Minimum number of events to mix") 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") ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; @@ -114,6 +117,7 @@ struct FlowCorrelationsUpc { 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.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0}, "pt axis for efficiency histograms"}; + ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; // Added UPC Cuts SGSelector sgSelector; @@ -149,11 +153,11 @@ struct FlowCorrelationsUpc { registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); - registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisMultiplicity, axisVertex, axisPtTrigger}}}); + registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); registry.add("eventcount", "bin", {HistType::kTH1F, {{3, 0, 3, "bin"}}}); // histogram to see how many events are in the same and mixed event - std::vector corrAxis = {{axisMultiplicity, "Nch"}, + std::vector corrAxis = {{axisSample, "Sample"}, {axisVertex, "z-vtx (cm)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, {axisPtAssoc, "p_{T} (GeV/c)"}, @@ -190,13 +194,16 @@ struct FlowCorrelationsUpc { } template - void fillCorrelations(TTracks tracks1, TTracks tracks2, float posZ, int system, float Nch) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelations(TTracks tracks1, TTracks tracks2, float posZ, int system) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { + + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + // loop over all tracks for (auto const& track1 : tracks1) { if (system == SameEvent) { - registry.fill(HIST("Trig_hist"), Nch, posZ, track1.pt()); + registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt()); } for (auto const& track2 : tracks2) { @@ -213,10 +220,10 @@ struct FlowCorrelationsUpc { // fill the right sparse and histograms if (system == SameEvent) { - same->getPairHist()->Fill(step, Nch, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta); + same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta); registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta); } else if (system == MixedEvent) { - mixed->getPairHist()->Fill(step, Nch, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta); + mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta); registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta); } } @@ -247,7 +254,7 @@ struct FlowCorrelationsUpc { registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin fillYield(collision, tracks); - fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, tracks.size()); // fill the SE histogram and Sparse + fillCorrelations(tracks, tracks, collision.posZ(), SameEvent); // fill the SE histogram and Sparse } PROCESS_SWITCH(FlowCorrelationsUpc, processSame, "Process same event", true); @@ -265,7 +272,7 @@ struct FlowCorrelationsUpc { for (auto const& [collision1, tracks1, collision2, tracks2] : pairs) { registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin - fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, tracks1.size()); + fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent); } } PROCESS_SWITCH(FlowCorrelationsUpc, processMixed, "Process mixed events", true); From f87f06229d7f3c94c2e7d0d8d0aeedd2fd29763c Mon Sep 17 00:00:00 2001 From: omvazque Date: Fri, 13 Jun 2025 13:15:04 -0500 Subject: [PATCH 070/116] [PWGLF] Using global ccdb and fixed a bug (#11609) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 478c49fae87..02874f91014 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -83,6 +83,7 @@ struct UccZdc { Configurable isZEMcut{"isZEMcut", true, "Use ZEM cut"}; Configurable useMidRapNchSel{"useMidRapNchSel", true, "Use mid-rapidit Nch selection"}; 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"}; // Event selection @@ -165,6 +166,8 @@ struct UccZdc { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; + TH1F* fd = nullptr; + void init(InitContext const&) { // define axes you want to use @@ -299,6 +302,7 @@ struct UccZdc { LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; LOG(info) << "\tapplyEff=" << applyEff.value; + LOG(info) << "\tapplyFD=" << applyFD.value; LOG(info) << "\tcorrectNch=" << correctNch.value; LOG(info) << "\tpaTHEff=" << paTHEff.value; LOG(info) << "\tpaTHFD=" << paTHFD.value; @@ -318,6 +322,11 @@ struct UccZdc { // 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 @@ -697,8 +706,7 @@ struct UccZdc { } auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); - auto fd = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); - if (!efficiency || !fd) { + if (!efficiency) { return; } @@ -756,6 +764,9 @@ struct UccZdc { effValue = efficiency->GetBinContent(efficiency->FindBin(pt)); fdValue = fd->GetBinContent(fd->FindBin(pt)); } + if (applyEff && !applyFD) { + fdValue = 1.0; + } if ((effValue > 0.) && (fdValue > 0.)) { pTs.emplace_back(pt); vecOneOverEff.emplace_back(1. / effValue); @@ -844,8 +855,7 @@ struct UccZdc { // To use run-by-run efficiency const auto& foundBC = collision.foundBC_as(); auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); - auto fd = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); - if (!efficiency || !fd) { + if (!efficiency) { return; } @@ -930,7 +940,7 @@ struct UccZdc { } double nchMC{0}; - nchMult = std::accumulate(vecFullEff.begin(), vecFullEff.end(), 0); + nchMC = std::accumulate(vecFullEff.begin(), vecFullEff.end(), 0); if (nchMC < minNchSel) { continue; } From 713bb40f05743e16f00b22eeec11784c834e9c55 Mon Sep 17 00:00:00 2001 From: Banajit Barman <113376372+BanajitBarman@users.noreply.github.com> Date: Fri, 13 Jun 2025 21:21:35 +0200 Subject: [PATCH 071/116] [PWGLF] added configurable enablePureDCAHistogram for enabling pure DCA histogram based on nsigmaTPCKa cut (#11593) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò Jacazio Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/spectraTOF.cxx | 224 ++++++++++++++++-------------- 1 file changed, 118 insertions(+), 106 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraTOF.cxx b/PWGLF/Tasks/Nuspex/spectraTOF.cxx index e1607610ac6..bff2593257a 100644 --- a/PWGLF/Tasks/Nuspex/spectraTOF.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTOF.cxx @@ -18,6 +18,7 @@ /// // O2 includes + #include #include #include "ReconstructionDataFormats/Track.h" @@ -97,6 +98,7 @@ struct tofSpectra { } trkselOptions; Configurable enableDcaGoodEvents{"enableDcaGoodEvents", true, "Enables the MC plots with the correct match between data and MC"}; + Configurable enablePureDCAHistogram{"enablePureDCAHistogram", false, "Enables the pure DCA histograms"}; Configurable enableTrackCutHistograms{"enableTrackCutHistograms", true, "Enables track cut histograms, before and after the cut"}; Configurable enableDeltaHistograms{"enableDeltaHistograms", true, "Enables the delta TPC and TOF histograms"}; Configurable enableTPCTOFHistograms{"enableTPCTOFHistograms", true, "Enables TPC TOF histograms"}; @@ -1017,7 +1019,6 @@ struct tofSpectra { } } } - if constexpr (fillFullInfo) { if (enableDeltaHistograms) { const auto& deltaTOF = o2::aod::pidutils::tofExpSignalDiff(track); @@ -1036,7 +1037,6 @@ struct tofSpectra { } } } - // Filling DCA info with the TPC+TOF PID bool isDCAPureSample = (std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.f); if (track.pt() <= 0.4) { @@ -1906,130 +1906,138 @@ struct tofSpectra { if (std::abs(mcParticle.y()) > trkselOptions.cfgCutY) { return; } + if (enablePureDCAHistogram) { + const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track); + const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track); - const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track); - const bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma; - - const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track); - const bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma; - - // Filling DCA info with the TPC+TOF PID - bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f); - if (track.pt() <= 0.4) { - isDCAPureSample = (nsigmaTPCKa < 1.f); - } - - if (isDCAPureSample) { - if (enableDCAvsmotherHistograms) { - hDcaXYMC[i]->Fill(track.pt(), track.dcaXY()); - hDcaZMC[i]->Fill(track.pt(), track.dcaZ()); + // Filling DCA info with the TPC+TOF PID + bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f); + if (track.pt() <= 0.4) { + isDCAPureSample = (nsigmaTPCKa < 1.f); } - if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material) - if (mcParticle.getProcess() == 4) { // Particles from decay - if (enableDCAxyzHistograms) { - hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); - } else { - histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY()); - histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ()); - } + if (isDCAPureSample) { + if (enableDCAvsmotherHistograms) { + hDcaXYMC[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMC[i]->Fill(track.pt(), track.dcaZ()); + } - if (mcParticle.has_mothers()) { - for (const auto& mother : mcParticle.template mothers_as()) { - auto daughter0 = mother.template daughters_as().begin(); - double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; - double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; - auto decayLength = RecoDecay::distance(vertexMoth, vertexDau); - hDecayLengthStr[i]->Fill(track.pt(), decayLength); + if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material) + if (mcParticle.getProcess() == 4) { // Particles from decay + if (enableDCAxyzHistograms) { + hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + } else { + histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY()); + histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ()); + } + + if (mcParticle.has_mothers()) { + for (const auto& mother : mcParticle.template mothers_as()) { + auto daughter0 = mother.template daughters_as().begin(); + double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; + auto decayLength = RecoDecay::distance(vertexMoth, vertexDau); + hDecayLengthStr[i]->Fill(track.pt(), decayLength); + } + } + } else { // Particles from the material + if (enableDCAxyzHistograms) { + hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + } else { + histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY()); + histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ()); } } - } else { // Particles from the material + } else { // Primaries if (enableDCAxyzHistograms) { - hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + if (enableDcaGoodEvents.value && collision.has_mcCollision()) { + histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ()); + } } else { - histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY()); - histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ()); + // DCAxy for all primaries + histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY()); + histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ()); } - } - } else { // Primaries - if (enableDCAxyzHistograms) { - hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); if (enableDcaGoodEvents.value && collision.has_mcCollision()) { - histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ()); + histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY()); + histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ()); } - } else { - // DCAxy for all primaries - histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY()); - histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ()); - } - if (enableDcaGoodEvents.value && collision.has_mcCollision()) { - histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY()); - histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ()); - } - if (enableDCAvsmotherHistograms) { - bool IsD0Mother = false; - bool IsCharmMother = false; - bool IsBeautyMother = false; - bool IsNotHFMother = false; - if (mcParticle.has_mothers()) { - const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false); - for (const auto& mother : mcParticle.template mothers_as()) { - const int motherPdgCode = std::abs(mother.pdgCode()); - if (motherPdgCode == 421) { - IsD0Mother = true; - } - if (charmOrigin == RecoDecay::OriginType::NonPrompt) { - IsBeautyMother = true; - } - if (charmOrigin == RecoDecay::OriginType::Prompt) { - IsCharmMother = true; - } - if (charmOrigin == RecoDecay::OriginType::None) { - IsNotHFMother = true; + if (enableDCAvsmotherHistograms) { + bool IsD0Mother = false; + bool IsCharmMother = false; + bool IsBeautyMother = false; + bool IsNotHFMother = false; + if (mcParticle.has_mothers()) { + const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false); + for (const auto& mother : mcParticle.template mothers_as()) { + const int motherPdgCode = std::abs(mother.pdgCode()); + if (motherPdgCode == 421) { + IsD0Mother = true; + } + if (charmOrigin == RecoDecay::OriginType::NonPrompt) { + IsBeautyMother = true; + } + if (charmOrigin == RecoDecay::OriginType::Prompt) { + IsCharmMother = true; + } + if (charmOrigin == RecoDecay::OriginType::None) { + IsNotHFMother = true; + } } } - } - if (IsD0Mother) { - hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY()); - hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ()); - } - if (IsCharmMother) { - hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY()); - hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ()); - } - if (IsBeautyMother) { - hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY()); - hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ()); - } - if (IsNotHFMother) { - hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY()); - hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ()); - } - - if (mcParticle.has_mothers()) { - for (const auto& mother : mcParticle.template mothers_as()) { - auto daughter0 = mother.template daughters_as().begin(); - double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; - double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; - auto decayLength = RecoDecay::distance(vertexMoth, vertexDau); + if (IsD0Mother) { + hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ()); + } + if (IsCharmMother) { + hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY()); + hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ()); + } + if (IsBeautyMother) { + hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ()); + } + if (IsNotHFMother) { + hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ()); + } - if (IsD0Mother) { - hDecayLengthMCD0[i]->Fill(track.pt(), decayLength); - } - if (IsCharmMother) { - hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength); - } - if (IsBeautyMother) { - hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength); - } - if (IsNotHFMother) { - hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength); + if (mcParticle.has_mothers()) { + for (const auto& mother : mcParticle.template mothers_as()) { + auto daughter0 = mother.template daughters_as().begin(); + double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()}; + double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()}; + auto decayLength = RecoDecay::distance(vertexMoth, vertexDau); + + if (IsD0Mother) { + hDecayLengthMCD0[i]->Fill(track.pt(), decayLength); + } + if (IsCharmMother) { + hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength); + } + if (IsBeautyMother) { + hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength); + } + if (IsNotHFMother) { + hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength); + } } } } } } + } else { + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY()); + } else { + histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY()); + } + } else { + histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY()); + } } if ((collision.has_mcCollision() && (mcParticle.mcCollisionId() != collision.mcCollisionId())) || !collision.has_mcCollision()) { @@ -2049,15 +2057,19 @@ struct tofSpectra { } const int pdgCode = mcParticle.pdgCode(); const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track); + const auto& nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3>(track); const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track); const bool isPionTPC = std::abs(nsigmaTPCPi) < trkselOptions.cfgCutNsigma; + const bool isKaonTPC = std::abs(nsigmaTPCKa) < trkselOptions.cfgCutNsigma; const bool isProtonTPC = std::abs(nsigmaTPCPr) < trkselOptions.cfgCutNsigma; const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track); + const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track); const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track); const bool isPionTOF = std::abs(nsigmaTOFPi) < trkselOptions.cfgCutNsigma; + const bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma; const bool isProtonTOF = std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma; if (!mcParticle.isPhysicalPrimary()) { // Is not physical primary From d00c74d91d431b1786b5c93b84e3fce7e3780646 Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Sat, 14 Jun 2025 03:54:47 +0800 Subject: [PATCH 072/116] [PWGCF] Add v3 flow and optimized track selection (#11601) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 946 +++++++++++++++++----------- 1 file changed, 592 insertions(+), 354 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index c4d9d5d0ef7..de63cd2a413 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -14,39 +14,45 @@ /// \since Sep/13/2024 /// \brief This task is to caculate V0s and cascades flow by GenericFramework -#include -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.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 "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "GFWPowerArray.h" #include "GFW.h" #include "GFWCumulant.h" +#include "GFWPowerArray.h" #include "GFWWeights.h" -#include "Common/DataModel/Qvectors.h" -#include "Common/Core/EventPlaneHelper.h" -#include "ReconstructionDataFormats/Track.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/trackUtilities.h" + #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGMM/Mult/DataModel/Index.h" + +#include "Common/Core/EventPlaneHelper.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 "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" +#include + #include "TList.h" -#include -#include #include #include #include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -55,14 +61,19 @@ namespace { std::shared_ptr refc22[10]; std::shared_ptr refc24[10]; +std::shared_ptr refc32[10]; std::shared_ptr k0sc22[10]; std::shared_ptr k0sc24[10]; +std::shared_ptr k0sc32[10]; std::shared_ptr lambdac22[10]; std::shared_ptr lambdac24[10]; +std::shared_ptr lambdac32[10]; std::shared_ptr xic22[10]; std::shared_ptr xic24[10]; +std::shared_ptr xic32[10]; std::shared_ptr omegac22[10]; std::shared_ptr omegac24[10]; +std::shared_ptr omegac32[10]; } // namespace #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; @@ -70,39 +81,64 @@ std::shared_ptr omegac24[10]; struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") - 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(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") - O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "Maximal pT for ref tracks") - O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgMassBins, std::vector, (std::vector{80, 32, 14, 16}), "Number of K0s, Lambda, Xi, Omega mass axis bins for c22") O2_DEFINE_CONFIGURABLE(cfgDeltaPhiLocDen, int, 3, "Number of delta phi for local density, 200 bins in 2 pi") - // topological cut for V0 - O2_DEFINE_CONFIGURABLE(cfgv0_radius, float, 5.0f, "minimum decay radius") - O2_DEFINE_CONFIGURABLE(cfgv0_v0cospa, float, 0.995f, "minimum cosine of pointing angle") - O2_DEFINE_CONFIGURABLE(cfgv0_dcadautopv, float, 0.1f, "minimum daughter DCA to PV") - O2_DEFINE_CONFIGURABLE(cfgv0_dcav0dau, float, 0.5f, "maximum DCA among V0 daughters") - O2_DEFINE_CONFIGURABLE(cfgv0_mk0swindow, float, 0.1f, "Invariant mass window of K0s") - O2_DEFINE_CONFIGURABLE(cfgv0_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") - O2_DEFINE_CONFIGURABLE(cfgv0_ArmPodocut, float, 0.2f, "Armenteros Podolski cut for K0") - // topological cut for cascade - O2_DEFINE_CONFIGURABLE(cfgcasc_radius, float, 0.5f, "minimum decay radius") - O2_DEFINE_CONFIGURABLE(cfgcasc_casccospa, float, 0.999f, "minimum cosine of pointing angle") - O2_DEFINE_CONFIGURABLE(cfgcasc_v0cospa, float, 0.998f, "minimum cosine of pointing angle") - O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0topv, float, 0.01f, "minimum daughter DCA to PV") - O2_DEFINE_CONFIGURABLE(cfgcasc_dcabachtopv, float, 0.01f, "minimum bachelor DCA to PV") - O2_DEFINE_CONFIGURABLE(cfgcasc_dcacascdau, float, 0.3f, "maximum DCA among cascade daughters") - O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0dau, float, 1.0f, "maximum DCA among V0 daughters") - O2_DEFINE_CONFIGURABLE(cfgcasc_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") - // track quality and type selections - O2_DEFINE_CONFIGURABLE(cfgtpcclusters, int, 70, "minimum number of TPC clusters requirement") - O2_DEFINE_CONFIGURABLE(cfgitsclusters, int, 1, "minimum number of ITS clusters requirement") - O2_DEFINE_CONFIGURABLE(cfgtpcclufindable, int, 1, "minimum number of findable TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgtpccrossoverfindable, int, 1, "minimum number of Ratio crossed rows over findable clusters") + + struct : ConfigurableGroup { + std::string prefix = "v0BuilderOpts"; + // topological cut for V0 + O2_DEFINE_CONFIGURABLE(cfgv0_radius, float, 5.0f, "minimum decay radius") + O2_DEFINE_CONFIGURABLE(cfgv0_v0cospa, float, 0.995f, "minimum cosine of pointing angle") + O2_DEFINE_CONFIGURABLE(cfgv0_dcadautopv, float, 0.1f, "minimum daughter DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgv0_dcav0dau, float, 0.5f, "maximum DCA among V0 daughters") + O2_DEFINE_CONFIGURABLE(cfgv0_mk0swindow, float, 0.1f, "Invariant mass window of K0s") + O2_DEFINE_CONFIGURABLE(cfgv0_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") + O2_DEFINE_CONFIGURABLE(cfgv0_ArmPodocut, float, 0.2f, "Armenteros Podolski cut for K0") + } v0BuilderOpts; + + struct : ConfigurableGroup { + std::string prefix = "cascBuilderOpts"; + // topological cut for cascade + O2_DEFINE_CONFIGURABLE(cfgcasc_radius, float, 0.5f, "minimum decay radius") + O2_DEFINE_CONFIGURABLE(cfgcasc_casccospa, float, 0.999f, "minimum cosine of pointing angle") + O2_DEFINE_CONFIGURABLE(cfgcasc_v0cospa, float, 0.998f, "minimum cosine of pointing angle") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0topv, float, 0.01f, "minimum daughter DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcabachtopv, float, 0.01f, "minimum bachelor DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcacascdau, float, 0.3f, "maximum DCA among cascade daughters") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0dau, float, 1.0f, "maximum DCA among V0 daughters") + O2_DEFINE_CONFIGURABLE(cfgcasc_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") + } cascBuilderOpts; + + struct : ConfigurableGroup { + std::string prefix = "trkQualityOpts"; + // track selections + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for 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(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "Maximal pT for ref tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtDauMin, float, 0.2f, "Minimal pT for daughter tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtDauMax, float, 10.0f, "Maximal pT for daughter tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtK0sMin, float, 0.2f, "Minimal pT for K0s") + O2_DEFINE_CONFIGURABLE(cfgCutPtK0sMax, float, 10.0f, "Maximal pT for K0s") + O2_DEFINE_CONFIGURABLE(cfgCutPtLambdaMin, float, 0.2f, "Minimal pT for Lambda") + O2_DEFINE_CONFIGURABLE(cfgCutPtLambdaMax, float, 10.0f, "Maximal pT for Lambda") + O2_DEFINE_CONFIGURABLE(cfgCutPtXiMin, float, 0.2f, "Minimal pT for Xi") + O2_DEFINE_CONFIGURABLE(cfgCutPtXiMax, float, 10.0f, "Maximal pT for Xi") + O2_DEFINE_CONFIGURABLE(cfgCutPtOmegaMin, float, 0.2f, "Minimal pT for Omega") + O2_DEFINE_CONFIGURABLE(cfgCutPtOmegaMax, float, 10.0f, "Maximal pT for Omega") + O2_DEFINE_CONFIGURABLE(cfgCutPtPIDDauMin, float, 0.15f, "Minimal pT for daughter PID") + // track quality selections for daughter track + O2_DEFINE_CONFIGURABLE(cfgCheckITSNCls, bool, false, "check minimum number of ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCheckITSHits, bool, false, "check minimum number of ITS hits") + O2_DEFINE_CONFIGURABLE(cfgCheckITSChi2NDF, bool, false, "check ITS Chi2NDF") + O2_DEFINE_CONFIGURABLE(cfgCheckGlobalTrack, bool, false, "check global track") + } trkQualityOpts; + O2_DEFINE_CONFIGURABLE(cfgCasc_rapidity, float, 0.5, "rapidity") - O2_DEFINE_CONFIGURABLE(cfgNSigmatpctof, std::vector, (std::vector{3, 3, 3, 3, 3, 3}), "tpc and tof NSigma for Pion Proton Kaon") + O2_DEFINE_CONFIGURABLE(cfgNSigmapid, std::vector, (std::vector{9, 9, 9, 3, 3, 3, 3, 3, 3}), "tpc, tof and its NSigma for Pion Proton Kaon") O2_DEFINE_CONFIGURABLE(cfgAcceptancePath, std::vector, (std::vector{"Users/f/fcui/NUA/NUAREFPartical", "Users/f/fcui/NUA/NUAK0s", "Users/f/fcui/NUA/NUALambda", "Users/f/fcui/NUA/NUAXi", "Users/f/fcui/NUA/NUAOmega"}), "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgEfficiencyPath, std::vector, (std::vector{"PathtoRef"}), "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgLocDenParaXi, std::vector, (std::vector{-0.000986187, -3.86861, -0.000912481, -3.29206, -0.000859271, -2.89389, -0.000817039, -2.61201, -0.000788792, -2.39079, -0.000780182, -2.19276, -0.000750457, -2.07205, -0.000720279, -1.96865, -0.00073247, -1.85642, -0.000695091, -1.82625, -0.000693332, -1.72679, -0.000681225, -1.74305, -0.000652818, -1.92608, -0.000618892, -2.31985}), "Local density efficiency function parameter for Xi, exp(Ax + B)") @@ -110,13 +146,14 @@ struct FlowGfwOmegaXi { O2_DEFINE_CONFIGURABLE(cfgLocDenParaK0s, std::vector, (std::vector{-0.00043057, -3.2435, -0.000385085, -2.97687, -0.000350298, -2.81502, -0.000326159, -2.71091, -0.000299563, -2.65448, -0.000294284, -2.60865, -0.000277938, -2.589, -0.000277091, -2.56983, -0.000272783, -2.56825, -0.000252706, -2.58996, -0.000247834, -2.63158, -0.00024379, -2.76976, -0.000286468, -2.92484, -0.000310149, -3.27746}), "Local density efficiency function parameter for K0s, exp(Ax + B)") O2_DEFINE_CONFIGURABLE(cfgLocDenParaLambda, std::vector, (std::vector{-0.000510948, -4.4846, -0.000460629, -4.14465, -0.000433729, -3.94173, -0.000412751, -3.81839, -0.000411211, -3.72502, -0.000401511, -3.68426, -0.000407461, -3.67005, -0.000379371, -3.71153, -0.000392828, -3.73214, -0.000403996, -3.80717, -0.000403376, -3.90917, -0.000354624, -4.34629, -0.000477606, -4.66307, -0.000541139, -4.61364}), "Local density efficiency function parameter for Lambda, exp(Ax + B)") // switch - O2_DEFINE_CONFIGURABLE(cfgcheckDauTPC, bool, true, "check daughter tracks TPC or not") - O2_DEFINE_CONFIGURABLE(cfgcheckDauTOF, bool, false, "check daughter tracks TOF or not") O2_DEFINE_CONFIGURABLE(cfgDoAccEffCorr, bool, false, "do acc and eff corr") O2_DEFINE_CONFIGURABLE(cfgDoLocDenCorr, bool, false, "do local density corr") O2_DEFINE_CONFIGURABLE(cfgDoJackknife, bool, false, "do jackknife") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") O2_DEFINE_CONFIGURABLE(cfgOutputLocDenWeights, bool, false, "Fill and output local density weights") + O2_DEFINE_CONFIGURABLE(cfgDoV0AT0Acut, bool, false, "do V0A-T0A cut") + O2_DEFINE_CONFIGURABLE(cfgOutputQA, bool, false, "do QA") + O2_DEFINE_CONFIGURABLE(cfgMultPVCut, int, 5, "Use apassX MultPVCut function or not") ConfigurableAxis cfgaxisVertex{"cfgaxisVertex", {20, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis cfgaxisPhi{"cfgaxisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"}; @@ -124,7 +161,8 @@ struct FlowGfwOmegaXi { ConfigurableAxis cfgaxisPt{"cfgaxisPt", {VARIABLE_WIDTH, 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.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50, 6.00, 10.0}, "pt (GeV)"}; ConfigurableAxis cfgaxisPtXi{"cfgaxisPtXi", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; ConfigurableAxis cfgaxisPtOmega{"cfgaxisPtOmega", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; - ConfigurableAxis cfgaxisPtV0{"cfgaxisPtV0", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; + ConfigurableAxis cfgaxisPtK0s{"cfgaxisPtK0s", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; + ConfigurableAxis cfgaxisPtLambda{"cfgaxisPtLambda", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; ConfigurableAxis cfgaxisOmegaMassforflow{"cfgaxisOmegaMassforflow", {16, 1.63f, 1.71f}, "Inv. Mass (GeV)"}; ConfigurableAxis cfgaxisXiMassforflow{"cfgaxisXiMassforflow", {14, 1.3f, 1.37f}, "Inv. Mass (GeV)"}; ConfigurableAxis cfgaxisK0sMassforflow{"cfgaxisK0sMassforflow", {40, 0.4f, 0.6f}, "Inv. Mass (GeV)"}; @@ -135,12 +173,12 @@ struct FlowGfwOmegaXi { AxisSpec axisMultiplicity{{0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "Centrality (%)"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + Filter trackFilter = (nabs(aod::track::eta) < trkQualityOpts.cfgCutEta.value) && (aod::track::pt > trkQualityOpts.cfgCutPtPOIMin.value) && (aod::track::pt < trkQualityOpts.cfgCutPtPOIMax.value) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); using TracksPID = soa::Join; - using AodTracks = soa::Filtered>; // tracks filter + using AodTracks = soa::Filtered>; // tracks filter using AodCollisions = soa::Filtered>; // collisions filter - using DaughterTracks = soa::Join; + using DaughterTracks = soa::Join; // Connect to ccdb Service ccdb; @@ -158,10 +196,10 @@ struct FlowGfwOmegaXi { // define global variables GFW* fGFW = new GFW(); // GFW class used from main src std::vector corrconfigs; - std::vector cfgAcceptance = cfgAcceptancePath; - std::vector cfgEfficiency = cfgEfficiencyPath; - std::vector cfgNSigma = cfgNSigmatpctof; - std::vector cfgmassbins = cfgMassBins; + std::vector cfgAcceptance; + std::vector cfgEfficiency; + std::vector cfgNSigma; + std::vector cfgmassbins; std::vector mAcceptance; std::vector mEfficiency; @@ -179,8 +217,14 @@ struct FlowGfwOmegaXi { int nXiPtBins = 0; TAxis* fXiPtAxis = nullptr; - int nV0PtBins = 0; - TAxis* fV0PtAxis = nullptr; + int nOmegaPtBins = 0; + TAxis* fOmegaPtAxis = nullptr; + + int nK0sPtBins = 0; + TAxis* fK0sPtAxis = nullptr; + + int nLambdaPtBins = 0; + TAxis* fLambdaPtAxis = nullptr; TAxis* fMultAxis = nullptr; @@ -198,6 +242,11 @@ struct FlowGfwOmegaXi { ccdb->setCaching(true); ccdb->setCreatedNotAfter(cfgnolaterthan.value); + cfgAcceptance = cfgAcceptancePath; + cfgEfficiency = cfgEfficiencyPath; + cfgNSigma = cfgNSigmapid; + cfgmassbins = cfgMassBins; + // Set the pt, mult and phi Axis; o2::framework::AxisSpec axisPt = cfgaxisPt; nPtBins = axisPt.binEdges.size() - 1; @@ -207,9 +256,17 @@ struct FlowGfwOmegaXi { nXiPtBins = axisXiPt.binEdges.size() - 1; fXiPtAxis = new TAxis(nXiPtBins, &(axisXiPt.binEdges)[0]); - o2::framework::AxisSpec axisV0Pt = cfgaxisPtV0; - nV0PtBins = axisV0Pt.binEdges.size() - 1; - fV0PtAxis = new TAxis(nV0PtBins, &(axisV0Pt.binEdges)[0]); + o2::framework::AxisSpec axisOmegaPt = cfgaxisPtOmega; + nOmegaPtBins = axisOmegaPt.binEdges.size() - 1; + fOmegaPtAxis = new TAxis(nOmegaPtBins, &(axisOmegaPt.binEdges)[0]); + + o2::framework::AxisSpec axisK0sPt = cfgaxisPtK0s; + nK0sPtBins = axisK0sPt.binEdges.size() - 1; + fK0sPtAxis = new TAxis(nK0sPtBins, &(axisK0sPt.binEdges)[0]); + + o2::framework::AxisSpec axisLambdaPt = cfgaxisPtLambda; + nLambdaPtBins = axisLambdaPt.binEdges.size() - 1; + fLambdaPtAxis = new TAxis(nLambdaPtBins, &(axisLambdaPt.binEdges)[0]); o2::framework::AxisSpec axisMult = axisMultiplicity; int nMultBins = axisMult.binEdges.size() - 1; @@ -249,49 +306,58 @@ struct FlowGfwOmegaXi { registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(4, "Omega"); // QA - // V0 QA - registry.add("QAhisto/V0/hqaV0radiusbefore", "", {HistType::kTH1D, {{200, 0, 200}}}); - registry.add("QAhisto/V0/hqaV0radiusafter", "", {HistType::kTH1D, {{200, 0, 200}}}); - registry.add("QAhisto/V0/hqaV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/V0/hqaV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/V0/hqadcaV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/V0/hqadcaV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/V0/hqaarm_podobefore", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); - registry.add("QAhisto/V0/hqaarm_podoafter", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); - registry.add("QAhisto/V0/hqadcapostoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/V0/hqadcapostoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/V0/hqadcanegtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/V0/hqadcanegtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - // Cascade QA - registry.add("QAhisto/Casc/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqaCascV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0toPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascV0toPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascBachtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascBachtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); - registry.add("QAhisto/Casc/hqadcaCascdaubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascdauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); - registry.add("QAhisto/Casc/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + if (cfgOutputQA) { + // V0 QA + registry.add("QAhisto/V0/hqaV0radiusbefore", "", {HistType::kTH1D, {{200, 0, 200}}}); + registry.add("QAhisto/V0/hqaV0radiusafter", "", {HistType::kTH1D, {{200, 0, 200}}}); + registry.add("QAhisto/V0/hqaV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/V0/hqaV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/V0/hqadcaV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/V0/hqadcaV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/V0/hqaarm_podobefore", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); + registry.add("QAhisto/V0/hqaarm_podoafter", "", {HistType::kTH2D, {{100, -1, 1}, {50, 0, 0.3}}}); + registry.add("QAhisto/V0/hqadcapostoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/V0/hqadcapostoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/V0/hqadcanegtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/V0/hqadcanegtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + // Cascade QA + registry.add("QAhisto/Casc/hqaCasccosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Casc/hqaCasccosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Casc/hqaCascV0cosPAbefore", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Casc/hqaCascV0cosPAafter", "", {HistType::kTH1D, {{1000, 0.95, 1}}}); + registry.add("QAhisto/Casc/hqadcaCascV0toPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Casc/hqadcaCascV0toPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Casc/hqadcaCascBachtoPVbefore", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Casc/hqadcaCascBachtoPVafter", "", {HistType::kTH1D, {{1000, -10, 10}}}); + registry.add("QAhisto/Casc/hqadcaCascdaubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Casc/hqadcaCascdauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Casc/hqadcaCascV0daubefore", "", {HistType::kTH1D, {{100, 0, 1}}}); + registry.add("QAhisto/Casc/hqadcaCascV0dauafter", "", {HistType::kTH1D, {{100, 0, 1}}}); + } // cumulant of flow registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("c32", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); registry.add("c24", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); registry.add("K0sc22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); registry.add("Lambdac22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); registry.add("c22dpt", ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); registry.add("c24dpt", ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile2D, {cfgaxisPt, axisMultiplicity}}); // pt-diff cumulant of flow + // v2 registry.add("Xic22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); - registry.add("Omegac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaMassforflow, axisMultiplicity}}); - registry.add("K0sc22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); - registry.add("Lambdac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + registry.add("Omegac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); + registry.add("K0sc22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + registry.add("Lambdac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtLambda, cfgaxisLambdaMassforflow, axisMultiplicity}}); registry.add("Xic24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); - registry.add("Omegac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaMassforflow, axisMultiplicity}}); - registry.add("K0sc24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); - registry.add("Lambdac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + registry.add("Omegac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); + registry.add("K0sc24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + registry.add("Lambdac24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisLambdaMassforflow, 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}}); + registry.add("K0sc32dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + registry.add("Lambdac32dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtLambda, cfgaxisLambdaMassforflow, axisMultiplicity}}); // for Jackknife if (cfgDoJackknife) { int nsubevent = 10; @@ -299,43 +365,48 @@ struct FlowGfwOmegaXi { refc22[i - 1] = registry.add(Form("Jackknife/REF/c22_%d", i), ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); refc24[i - 1] = registry.add(Form("Jackknife/REF/c24_%d", i), ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); xic22[i - 1] = registry.add(Form("Jackknife/Xi/Xic22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); - omegac22[i - 1] = registry.add(Form("Jackknife/Omega/Omegac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaMassforflow, axisMultiplicity}}); - k0sc22[i - 1] = registry.add(Form("Jackknife/K0s/K0sc22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); - lambdac22[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + omegac22[i - 1] = registry.add(Form("Jackknife/Omega/Omegac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); + k0sc22[i - 1] = registry.add(Form("Jackknife/K0s/K0sc22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + lambdac22[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac22dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtLambda, cfgaxisLambdaMassforflow, axisMultiplicity}}); xic24[i - 1] = registry.add(Form("Jackknife/Xi/Xic24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); - omegac24[i - 1] = registry.add(Form("Jackknife/Omega/Omegac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisOmegaMassforflow, axisMultiplicity}}); - k0sc24[i - 1] = registry.add(Form("Jackknife/K0s/K0sc24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); - lambdac24[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + omegac24[i - 1] = registry.add(Form("Jackknife/Omega/Omegac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); + k0sc24[i - 1] = registry.add(Form("Jackknife/K0s/K0sc24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + lambdac24[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac24dpt_%d", i), ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtLambda, cfgaxisLambdaMassforflow, axisMultiplicity}}); + refc32[i - 1] = registry.add(Form("Jackknife/REF/c32_%d", i), ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + xic32[i - 1] = registry.add(Form("Jackknife/Xi/Xic32dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); + omegac32[i - 1] = registry.add(Form("Jackknife/Omega/Omegac32dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); + k0sc32[i - 1] = registry.add(Form("Jackknife/K0s/K0sc32dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtK0s, cfgaxisK0sMassforflow, axisMultiplicity}}); + lambdac32[i - 1] = registry.add(Form("Jackknife/Lambda/Lambdac32dpt_%d", i), ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtLambda, cfgaxisLambdaMassforflow, axisMultiplicity}}); } } // MC True flow registry.add("MC/c22MC", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); registry.add("MC/Xic22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtXi, axisMultiplicity}}); - registry.add("MC/Omegac22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtXi, axisMultiplicity}}); - registry.add("MC/K0sc22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtV0, axisMultiplicity}}); - registry.add("MC/Lambdac22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtV0, axisMultiplicity}}); + registry.add("MC/Omegac22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtOmega, axisMultiplicity}}); + registry.add("MC/K0sc22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtK0s, axisMultiplicity}}); + registry.add("MC/Lambdac22dptMC", ";pt ; C_{2}{2} ", {HistType::kTProfile2D, {cfgaxisPtLambda, axisMultiplicity}}); // InvMass(GeV) of casc and v0 AxisSpec axisOmegaMass = {80, 1.63f, 1.71f, "Inv. Mass (GeV)"}; AxisSpec axisXiMass = {70, 1.3f, 1.37f, "Inv. Mass (GeV)"}; AxisSpec axisK0sMass = {400, 0.4f, 0.6f, "Inv. Mass (GeV)"}; AxisSpec axisLambdaMass = {160, 1.08f, 1.16f, "Inv. Mass (GeV)"}; registry.add("InvMassXi_all", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisXiMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassOmega_all", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisOmegaMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassOmega", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisOmegaMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassOmega_all", "", {HistType::kTHnSparseF, {cfgaxisPtOmega, axisOmegaMass, cfgaxisEta, axisMultiplicity}}); registry.add("InvMassXi", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisXiMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassK0s_all", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisK0sMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassLambda_all", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassK0s", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisK0sMass, cfgaxisEta, axisMultiplicity}}); - registry.add("InvMassLambda", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassOmega", "", {HistType::kTHnSparseF, {cfgaxisPtOmega, axisOmegaMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassK0s_all", "", {HistType::kTHnSparseF, {cfgaxisPtK0s, axisK0sMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassLambda_all", "", {HistType::kTHnSparseF, {cfgaxisPtLambda, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassK0s", "", {HistType::kTHnSparseF, {cfgaxisPtK0s, axisK0sMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassLambda", "", {HistType::kTHnSparseF, {cfgaxisPtLambda, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); // for local density correlation - registry.add("MC/densityMCGenK0s", "", {HistType::kTH3D, {cfgaxisPtV0, cfgaxisNch, cfgaxisLocalDensity}}); - registry.add("MC/densityMCGenLambda", "", {HistType::kTH3D, {cfgaxisPtV0, cfgaxisNch, cfgaxisLocalDensity}}); + registry.add("MC/densityMCGenK0s", "", {HistType::kTH3D, {cfgaxisPtK0s, cfgaxisNch, cfgaxisLocalDensity}}); + registry.add("MC/densityMCGenLambda", "", {HistType::kTH3D, {cfgaxisPtLambda, cfgaxisNch, cfgaxisLocalDensity}}); registry.add("MC/densityMCGenXi", "", {HistType::kTH3D, {cfgaxisPtXi, cfgaxisNch, cfgaxisLocalDensity}}); - registry.add("MC/densityMCGenOmega", "", {HistType::kTH3D, {cfgaxisPtXi, cfgaxisNch, cfgaxisLocalDensity}}); - registry.add("MC/densityMCRecK0s", "", {HistType::kTHnSparseF, {cfgaxisPtV0, cfgaxisNch, cfgaxisLocalDensity, axisK0sMass}}); - registry.add("MC/densityMCRecLambda", "", {HistType::kTHnSparseF, {cfgaxisPtV0, cfgaxisNch, cfgaxisLocalDensity, axisLambdaMass}}); + registry.add("MC/densityMCGenOmega", "", {HistType::kTH3D, {cfgaxisPtOmega, cfgaxisNch, cfgaxisLocalDensity}}); + registry.add("MC/densityMCRecK0s", "", {HistType::kTHnSparseF, {cfgaxisPtK0s, cfgaxisNch, cfgaxisLocalDensity, axisK0sMass}}); + registry.add("MC/densityMCRecLambda", "", {HistType::kTHnSparseF, {cfgaxisPtLambda, cfgaxisNch, cfgaxisLocalDensity, axisLambdaMass}}); registry.add("MC/densityMCRecXi", "", {HistType::kTHnSparseF, {cfgaxisPtXi, cfgaxisNch, cfgaxisLocalDensity, axisXiMass}}); - registry.add("MC/densityMCRecOmega", "", {HistType::kTHnSparseF, {cfgaxisPtXi, cfgaxisNch, cfgaxisLocalDensity, axisOmegaMass}}); + registry.add("MC/densityMCRecOmega", "", {HistType::kTHnSparseF, {cfgaxisPtOmega, cfgaxisNch, cfgaxisLocalDensity, axisOmegaMass}}); // Data fGFW->AddRegion("reffull", -0.8, 0.8, 1, 1); // ("name", etamin, etamax, ptbinnum, bitmask)eta region -0.8 to 0.8 @@ -359,13 +430,13 @@ struct FlowGfwOmegaXi { 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); - int nK0sptMassBins = nV0PtBins * cfgmassbins[0]; + 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 = nV0PtBins * cfgmassbins[1]; + 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); @@ -384,6 +455,7 @@ struct FlowGfwOmegaXi { fGFW->AddRegion("poiLambdaNdptMC", -0.8, -0.4, nLambdaptMassBins, 1024); // pushback // Data + // v2 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiP10dpt {2} refN10 {-2}", "Poi10Gap22dpta", kTRUE)); // 0 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiN10dpt {2} refP10 {-2}", "Poi10Gap22dptb", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poifulldpt reffull | poioldpt {2 2 -2 -2}", "Poi10Gap24dpt", kTRUE)); @@ -401,23 +473,44 @@ struct FlowGfwOmegaXi { corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdafulldpt reffull {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10 {2} refN10 {-2}", "Ref10Gap22a", kFALSE)); // 15 corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffull reffull {2 2 -2 -2}", "Ref10Gap24", kFALSE)); + // v3 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdpt {3} refN10 {-3}", "Xi10Gap32a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiNdpt {3} refP10 {-3}", "Xi10Gap32b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt {3} refN10 {-3}", "Omega10Gap32a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt {3} refP10 {-3}", "Omega10Gap32b", kTRUE)); // 20 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sPdpt {3} refN10 {-3}", "K0short10Gap32a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sNdpt {3} refP10 {-3}", "K0short10Gap32b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaPdpt {3} refN10 {-3}", "Lambda10Gap32a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaNdpt {3} refP10 {-3}", "Lambda10Gap32b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10 {3} refN10 {-3}", "Ref10Gap32a", kFALSE)); // 25 // MC - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdptMC {2} refN10MC {-2}", "MCXi10Gap22a", kTRUE)); // 17 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdptMC {2} refN10MC {-2}", "MCXi10Gap22a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiNdptMC {2} refP10MC {-2}", "MCXi10Gap22b", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdptMC {2} refN10MC {-2}", "MCOmega10Gap22a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdptMC {2} refP10MC {-2}", "MCOmega10Gap22b", kTRUE)); // 20 - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sPdptMC {2} refN10MC {-2}", "MCK0s10Gap22a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdptMC {2} refP10MC {-2}", "MCOmega10Gap22b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sPdptMC {2} refN10MC {-2}", "MCK0s10Gap22a", kTRUE)); // 30 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sNdptMC {2} refP10MC {-2}", "MCK0s10Gap22b", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaPdptMC {2} refN10MC {-2}", "MCLambda10Gap22a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaNdptMC {2} refP10MC {-2}", "MCLambda10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10MC {2} refN10MC {-2}", "MCRef10Gap22a", kFALSE)); // 25 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10MC {2} refN10MC {-2}", "MCRef10Gap22a", kFALSE)); // 33 fGFW->CreateRegions(); // finalize the initialization // used for event selection - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6must ]*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); + int caseapass4 = 4; + int caseapass5 = 5; + if (cfgMultPVCut == caseapass4) { + 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); + } + if (cfgMultPVCut == caseapass5) { + 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(3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05); + 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(3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05); + } + 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); @@ -493,11 +586,11 @@ struct FlowGfwOmegaXi { if (PDGCode == kXiMinus) { fpt = fXiPtAxis; } else if (PDGCode == kOmegaMinus) { - fpt = fXiPtAxis; + fpt = fOmegaPtAxis; } else if (PDGCode == kK0Short) { - fpt = fV0PtAxis; + fpt = fK0sPtAxis; } else if (PDGCode == kLambda0) { - fpt = fV0PtAxis; + fpt = fLambdaPtAxis; } else { LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); return; @@ -529,18 +622,18 @@ struct FlowGfwOmegaXi { fMass = fXiMass; } else if (PDGCode == kOmegaMinus) { nMassBins = cfgmassbins[3]; - nptbins = nXiPtBins; - fpt = fXiPtAxis; + nptbins = nOmegaPtBins; + fpt = fOmegaPtAxis; fMass = fOmegaMass; } else if (PDGCode == kK0Short) { nMassBins = cfgmassbins[0]; - nptbins = nV0PtBins; - fpt = fV0PtAxis; + nptbins = nK0sPtBins; + fpt = fK0sPtAxis; fMass = fK0sMass; } else if (PDGCode == kLambda0) { nMassBins = cfgmassbins[1]; - nptbins = nV0PtBins; - fpt = fV0PtAxis; + nptbins = nLambdaPtBins; + fpt = fLambdaPtAxis; fMass = fLambdaMass; } else { LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); @@ -574,18 +667,18 @@ struct FlowGfwOmegaXi { fMass = fXiMass; } else if (PDGCode == kOmegaMinus) { nMassBins = cfgmassbins[3]; - nptbins = nXiPtBins; - fpt = fXiPtAxis; + nptbins = nOmegaPtBins; + fpt = fOmegaPtAxis; fMass = fOmegaMass; } else if (PDGCode == kK0Short) { nMassBins = cfgmassbins[0]; - nptbins = nV0PtBins; - fpt = fV0PtAxis; + nptbins = nK0sPtBins; + fpt = fK0sPtAxis; fMass = fK0sMass; } else if (PDGCode == kLambda0) { nMassBins = cfgmassbins[1]; - nptbins = nV0PtBins; - fpt = fV0PtAxis; + nptbins = nLambdaPtBins; + fpt = fLambdaPtAxis; fMass = fLambdaMass; } else { LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); @@ -716,23 +809,30 @@ struct FlowGfwOmegaXi { if (std::fabs(vtxz) > cfgCutVertex) return false; - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return false; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return false; + int caseapass4 = 4; + int caseapass5 = 5; + if (cfgMultPVCut == caseapass4 || cfgMultPVCut == caseapass5) { + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return false; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return false; + } if (occupancy > cfgCutOccupancyHigh) return 0; // V0A T0A 5 sigma cut - int nsigma = 5; - if (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > nsigma * fT0AV0ASigma->Eval(collision.multFT0A())) - return 0; + if (cfgDoV0AT0Acut) { + int nsigma = 5; + if (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > nsigma * fT0AV0ASigma->Eval(collision.multFT0A())) + return 0; + } return true; } void processData(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks, aod::CascDataExt const& Cascades, aod::V0Datas const& V0s, DaughterTracks const&) { + o2::aod::ITSResponse itsResponse; int nTot = tracks.size(); int candNumAll[4] = {0, 0, 0, 0}; int candNum[4] = {0, 0, 0, 0}; @@ -775,10 +875,10 @@ struct FlowGfwOmegaXi { registry.fill(HIST("hEtaPhiVtxzREF"), track.phi(), track.eta(), vtxz, wacc); registry.fill(HIST("hPt"), track.pt()); int ptbin = fPtAxis->FindBin(track.pt()) - 1; - if ((track.pt() > cfgCutPtMin) && (track.pt() < cfgCutPtMax)) { + if ((track.pt() > trkQualityOpts.cfgCutPtMin.value) && (track.pt() < trkQualityOpts.cfgCutPtMax.value)) { fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 1); //(eta, ptbin, phi, wacc*weff, bitmask) } - if ((track.pt() > cfgCutPtPOIMin) && (track.pt() < cfgCutPtPOIMax)) { + if ((track.pt() > trkQualityOpts.cfgCutPtPOIMin.value) && (track.pt() < trkQualityOpts.cfgCutPtPOIMax.value)) { fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 32); if (cfgDoLocDenCorr) { hLocalDensity->Fill(track.phi(), wacc * weff); @@ -793,79 +893,107 @@ struct FlowGfwOmegaXi { registry.fill(HIST("hCentvsNch"), cent, nch); } // fill GFW of V0 flow - double lowpt = 0.4; + double lowpt = trkQualityOpts.cfgCutPtPIDDauMin.value; + for (const auto& v0 : V0s) { auto v0posdau = v0.posTrack_as(); auto v0negdau = v0.negTrack_as(); // check tpc bool isK0s = false; bool isLambda = false; + + if (v0posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + if (v0negdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0negdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + // fill QA - registry.fill(HIST("QAhisto/V0/hqaarm_podobefore"), v0.alpha(), v0.qtarm()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaarm_podobefore"), v0.alpha(), v0.qtarm()); + } // check daughter TPC and TOF // K0short - if (v0.qtarm() / std::fabs(v0.alpha()) > cfgv0_ArmPodocut && std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < cfgv0_mk0swindow && - (!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((std::fabs(v0posdau.tofNSigmaPi()) < cfgNSigma[3] || v0posdau.pt() < lowpt) && (std::fabs(v0negdau.tofNSigmaPi()) < cfgNSigma[3] || v0negdau.pt() < lowpt)))) { - registry.fill(HIST("InvMassK0s_all"), v0.pt(), v0.mK0Short(), v0.eta(), cent); - isK0s = true; - candNumAll[0] = candNumAll[0] + 1; - registry.fill(HIST("QAhisto/V0/hqaarm_podoafter"), v0.alpha(), v0.qtarm()); + if (v0.pt() > trkQualityOpts.cfgCutPtK0sMin.value && v0.pt() < trkQualityOpts.cfgCutPtK0sMax.value) { + if (v0.qtarm() / std::fabs(v0.alpha()) > v0BuilderOpts.cfgv0_ArmPodocut.value && + std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0BuilderOpts.cfgv0_mk0swindow.value && + (std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0]) && + ((std::fabs(v0posdau.tofNSigmaPi()) < cfgNSigma[3] || v0posdau.pt() < lowpt) && (std::fabs(v0negdau.tofNSigmaPi()) < cfgNSigma[3] || v0negdau.pt() < lowpt)) && + ((std::fabs(itsResponse.nSigmaITS(v0posdau)) < cfgNSigma[6]) || v0posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(v0negdau)) < cfgNSigma[6]) || v0negdau.pt() < lowpt)) { + registry.fill(HIST("InvMassK0s_all"), v0.pt(), v0.mK0Short(), v0.eta(), cent); + isK0s = true; + candNumAll[0] = candNumAll[0] + 1; + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaarm_podoafter"), v0.alpha(), v0.qtarm()); + } + } } // Lambda and antiLambda - if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < cfgv0_mlambdawindow && - (!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((std::fabs(v0posdau.tofNSigmaPr()) < cfgNSigma[4] || v0posdau.pt() < lowpt) && (std::fabs(v0negdau.tofNSigmaPi()) < cfgNSigma[3] || v0negdau.pt() < lowpt)))) { - registry.fill(HIST("InvMassLambda_all"), v0.pt(), v0.mLambda(), v0.eta(), cent); - isLambda = true; - candNumAll[1] = candNumAll[1] + 1; - } else if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < cfgv0_mlambdawindow && - (!cfgcheckDauTPC || (std::fabs(v0negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((std::fabs(v0negdau.tofNSigmaPr()) < cfgNSigma[4] || v0negdau.pt() < lowpt) && (std::fabs(v0posdau.tofNSigmaPi()) < cfgNSigma[3] || v0posdau.pt() < lowpt)))) { - registry.fill(HIST("InvMassLambda_all"), v0.pt(), v0.mLambda(), v0.eta(), cent); - isLambda = true; - candNumAll[1] = candNumAll[1] + 1; + if (v0.pt() > trkQualityOpts.cfgCutPtLambdaMin.value && v0.pt() < trkQualityOpts.cfgCutPtLambdaMax.value) { + if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < v0BuilderOpts.cfgv0_mlambdawindow.value && + (std::fabs(v0posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0]) && + ((std::fabs(v0posdau.tofNSigmaPr()) < cfgNSigma[4] || v0posdau.pt() < lowpt) && (std::fabs(v0negdau.tofNSigmaPi()) < cfgNSigma[3] || v0negdau.pt() < lowpt)) && + ((std::fabs(itsResponse.nSigmaITS(v0posdau)) < cfgNSigma[7]) || v0posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(v0negdau)) < cfgNSigma[6]) || v0negdau.pt() < lowpt)) { + registry.fill(HIST("InvMassLambda_all"), v0.pt(), v0.mLambda(), v0.eta(), cent); + isLambda = true; + candNumAll[1] = candNumAll[1] + 1; + } else if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < v0BuilderOpts.cfgv0_mlambdawindow.value && + (std::fabs(v0negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0]) && + ((std::fabs(v0negdau.tofNSigmaPr()) < cfgNSigma[4] || v0negdau.pt() < lowpt) && (std::fabs(v0posdau.tofNSigmaPi()) < cfgNSigma[3] || v0posdau.pt() < lowpt)) && + ((std::fabs(itsResponse.nSigmaITS(v0posdau)) < cfgNSigma[7]) || v0posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(v0negdau)) < cfgNSigma[6]) || v0negdau.pt() < lowpt)) { + registry.fill(HIST("InvMassLambda_all"), v0.pt(), v0.mLambda(), v0.eta(), cent); + isLambda = true; + candNumAll[1] = candNumAll[1] + 1; + } } // fill QA before cut - registry.fill(HIST("QAhisto/V0/hqaV0radiusbefore"), v0.v0radius()); - registry.fill(HIST("QAhisto/V0/hqaV0cosPAbefore"), v0.v0cosPA()); - registry.fill(HIST("QAhisto/V0/hqadcaV0daubefore"), v0.dcaV0daughters()); - registry.fill(HIST("QAhisto/V0/hqadcapostoPVbefore"), v0.dcapostopv()); - registry.fill(HIST("QAhisto/V0/hqadcanegtoPVbefore"), v0.dcanegtopv()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaV0radiusbefore"), v0.v0radius()); + registry.fill(HIST("QAhisto/V0/hqaV0cosPAbefore"), v0.v0cosPA()); + registry.fill(HIST("QAhisto/V0/hqadcaV0daubefore"), v0.dcaV0daughters()); + registry.fill(HIST("QAhisto/V0/hqadcapostoPVbefore"), v0.dcapostopv()); + registry.fill(HIST("QAhisto/V0/hqadcanegtoPVbefore"), v0.dcanegtopv()); + } if (!isK0s && !isLambda) continue; // track quality check - if (v0posdau.tpcNClsFound() < cfgtpcclusters) - continue; - if (v0negdau.tpcNClsFound() < cfgtpcclusters) + if (!v0posdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (v0posdau.tpcNClsFindable() < cfgtpcclufindable) + if (!v0negdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (v0negdau.tpcNClsFindable() < cfgtpcclufindable) + if (!v0posdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (v0posdau.tpcCrossedRowsOverFindableCls() < cfgtpccrossoverfindable) + if (!v0negdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (v0posdau.itsNCls() < cfgitsclusters) + if (!v0posdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - if (v0negdau.itsNCls() < cfgitsclusters) + if (!v0negdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - // topological cut - if (v0.v0radius() < cfgv0_radius) + if (trkQualityOpts.cfgCheckGlobalTrack.value) { + if (!v0posdau.hasTPC() || !v0posdau.hasITS()) + continue; + if (!v0negdau.hasTPC() || !v0negdau.hasITS()) + continue; + } + // // topological cut + if (v0.v0radius() < v0BuilderOpts.cfgv0_radius.value) continue; - if (v0.v0cosPA() < cfgv0_v0cospa) + if (v0.v0cosPA() < v0BuilderOpts.cfgv0_v0cospa.value) continue; - if (v0.dcaV0daughters() > cfgv0_dcav0dau) + if (v0.dcaV0daughters() > v0BuilderOpts.cfgv0_dcav0dau.value) continue; - if (std::fabs(v0.dcapostopv()) < cfgv0_dcadautopv) + if (std::fabs(v0.dcapostopv()) < v0BuilderOpts.cfgv0_dcadautopv.value) continue; - if (std::fabs(v0.dcanegtopv()) < cfgv0_dcadautopv) + if (std::fabs(v0.dcanegtopv()) < v0BuilderOpts.cfgv0_dcadautopv.value) continue; + // fill QA after cut - registry.fill(HIST("QAhisto/V0/hqaV0radiusafter"), v0.v0radius()); - registry.fill(HIST("QAhisto/V0/hqaV0cosPAafter"), v0.v0cosPA()); - registry.fill(HIST("QAhisto/V0/hqadcaV0dauafter"), v0.dcaV0daughters()); - registry.fill(HIST("QAhisto/V0/hqadcapostoPVafter"), v0.dcapostopv()); - registry.fill(HIST("QAhisto/V0/hqadcanegtoPVafter"), v0.dcanegtopv()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaV0radiusafter"), v0.v0radius()); + registry.fill(HIST("QAhisto/V0/hqaV0cosPAafter"), v0.v0cosPA()); + registry.fill(HIST("QAhisto/V0/hqadcaV0dauafter"), v0.dcaV0daughters()); + registry.fill(HIST("QAhisto/V0/hqadcapostoPVafter"), v0.dcapostopv()); + registry.fill(HIST("QAhisto/V0/hqadcanegtoPVafter"), v0.dcanegtopv()); + } if (isK0s) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, v0, vtxz, 1); @@ -880,7 +1008,7 @@ struct FlowGfwOmegaXi { candNum[0] = candNum[0] + 1; registry.fill(HIST("InvMassK0s"), v0.pt(), v0.mK0Short(), v0.eta(), cent); registry.fill(HIST("hEtaPhiVtxzPOIK0s"), v0.phi(), v0.eta(), vtxz, wacc); - fGFW->Fill(v0.eta(), fV0PtAxis->FindBin(v0.pt()) - 1 + ((fK0sMass->FindBin(v0.mK0Short()) - 1) * nV0PtBins), v0.phi(), wacc * weff * wloc, 8); + fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fK0sMass->FindBin(v0.mK0Short()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 8); if (cfgOutputNUAWeights) fWeightsK0s->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); } @@ -898,97 +1026,129 @@ struct FlowGfwOmegaXi { candNum[1] = candNum[1] + 1; registry.fill(HIST("InvMassLambda"), v0.pt(), v0.mLambda(), v0.eta(), cent); registry.fill(HIST("hEtaPhiVtxzPOILambda"), v0.phi(), v0.eta(), vtxz, wacc); - fGFW->Fill(v0.eta(), fV0PtAxis->FindBin(v0.pt()) - 1 + ((fLambdaMass->FindBin(v0.mLambda()) - 1) * nV0PtBins), v0.phi(), wacc * weff * wloc, 16); + fGFW->Fill(v0.eta(), fK0sPtAxis->FindBin(v0.pt()) - 1 + ((fLambdaMass->FindBin(v0.mLambda()) - 1) * nK0sPtBins), v0.phi(), wacc * weff * wloc, 16); if (cfgOutputNUAWeights) fWeightsLambda->fill(v0.phi(), v0.eta(), vtxz, v0.pt(), cent, 0); } } + // fill GFW of casc flow for (const auto& casc : Cascades) { auto bachelor = casc.bachelor_as(); auto posdau = casc.posTrack_as(); auto negdau = casc.negTrack_as(); // check TPC - if (cfgcheckDauTPC && (!posdau.hasTPC() || !negdau.hasTPC() || !bachelor.hasTPC())) { - continue; - } bool isOmega = false; bool isXi = false; + + if (bachelor.pt() < trkQualityOpts.cfgCutPtDauMin.value || bachelor.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + if (posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + if (negdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || negdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + // Omega and antiOmega - if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < lowpt)))) { - registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); - isOmega = true; - candNumAll[3] = candNumAll[3] + 1; - } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((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)))) { - registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); - isOmega = true; - candNumAll[3] = candNumAll[3] + 1; + if (casc.pt() > trkQualityOpts.cfgCutPtOmegaMin.value && casc.pt() < trkQualityOpts.cfgCutPtOmegaMax.value) { + if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && + (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && + ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.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; + candNumAll[3] = candNumAll[3] + 1; + } 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; + candNumAll[3] = candNumAll[3] + 1; + } } // Xi and antiXi - if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.pt() < lowpt)))) { - registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); - isXi = true; - candNumAll[2] = candNumAll[2] + 1; - } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) && - (!cfgcheckDauTOF || ((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)))) { - registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); - isXi = true; - candNumAll[2] = candNumAll[2] + 1; + if (casc.pt() > trkQualityOpts.cfgCutPtXiMin.value && casc.pt() < trkQualityOpts.cfgCutPtXiMax.value) { + if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && + (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]) && + ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPr()) < cfgNSigma[4] || posdau.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPi()) < cfgNSigma[3] || negdau.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; + candNumAll[2] = candNumAll[2] + 1; + } 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; + candNumAll[2] = candNumAll[2] + 1; + } } // fill QA - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } if (!isXi && !isOmega) continue; - // topological cut - if (casc.cascradius() < cfgcasc_radius) + // // topological cut + if (casc.cascradius() < cascBuilderOpts.cfgcasc_radius.value) continue; - if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_casccospa) + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascBuilderOpts.cfgcasc_casccospa.value) continue; - if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_v0cospa) + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascBuilderOpts.cfgcasc_v0cospa.value) continue; - if (std::fabs(casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())) < cfgcasc_dcav0topv) + if (std::fabs(casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())) < cascBuilderOpts.cfgcasc_dcav0topv.value) continue; - if (std::fabs(casc.dcabachtopv()) < cfgcasc_dcabachtopv) + if (std::fabs(casc.dcabachtopv()) < cascBuilderOpts.cfgcasc_dcabachtopv.value) continue; - if (casc.dcacascdaughters() > cfgcasc_dcacascdau) + if (casc.dcacascdaughters() > cascBuilderOpts.cfgcasc_dcacascdau.value) continue; - if (casc.dcaV0daughters() > cfgcasc_dcav0dau) + if (casc.dcaV0daughters() > cascBuilderOpts.cfgcasc_dcav0dau.value) continue; - if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cfgcasc_mlambdawindow) + if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cascBuilderOpts.cfgcasc_mlambdawindow.value) continue; - // track quality check - if (bachelor.tpcNClsFound() < cfgtpcclusters) + // // track quality check + if (!bachelor.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (posdau.tpcNClsFound() < cfgtpcclusters) + if (!posdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (negdau.tpcNClsFound() < cfgtpcclusters) + if (!negdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (bachelor.itsNCls() < cfgitsclusters) + if (!bachelor.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (posdau.itsNCls() < cfgitsclusters) + if (!posdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (negdau.itsNCls() < cfgitsclusters) + if (!negdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; + if (!bachelor.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) + continue; + if (!posdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) + continue; + if (!negdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) + continue; + if (trkQualityOpts.cfgCheckGlobalTrack.value) { + if (!bachelor.hasTPC() || !bachelor.hasITS()) + continue; + if (!posdau.hasTPC() || !posdau.hasITS()) + continue; + if (!negdau.hasTPC() || !negdau.hasITS()) + continue; + } // fill QA - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } if (isOmega) { if (cfgDoAccEffCorr) @@ -1004,7 +1164,7 @@ struct FlowGfwOmegaXi { candNum[3] = candNum[3] + 1; 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(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nXiPtBins), casc.phi(), wacc * weff * wloc, 4); + fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), casc.phi(), wacc * weff * wloc, 4); if (cfgOutputNUAWeights) fWeightsOmega->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } @@ -1039,26 +1199,39 @@ struct FlowGfwOmegaXi { // Filling cumulant with ROOT TProfile and loop for all ptBins fillProfile(corrconfigs.at(15), HIST("c22"), cent); fillProfile(corrconfigs.at(16), HIST("c24"), cent); + fillProfile(corrconfigs.at(25), HIST("c32"), cent); for (int i = 1; i <= nPtBins; i++) { fillProfilepT(corrconfigs.at(0), HIST("c22dpt"), i, cent); fillProfilepT(corrconfigs.at(1), HIST("c22dpt"), i, cent); fillProfilepT(corrconfigs.at(2), HIST("c24dpt"), i, cent); } - for (int i = 1; i <= nV0PtBins; i++) { + for (int i = 1; i <= nK0sPtBins; i++) { fillProfilepTMass(corrconfigs.at(9), HIST("K0sc22dpt"), i, kK0Short, cent); fillProfilepTMass(corrconfigs.at(10), HIST("K0sc22dpt"), i, kK0Short, cent); fillProfilepTMass(corrconfigs.at(11), HIST("K0sc24dpt"), i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(21), HIST("K0sc32dpt"), i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(22), HIST("K0sc32dpt"), i, kK0Short, cent); + } + for (int i = 1; i <= nLambdaPtBins; i++) { fillProfilepTMass(corrconfigs.at(12), HIST("Lambdac22dpt"), i, kLambda0, cent); fillProfilepTMass(corrconfigs.at(13), HIST("Lambdac22dpt"), i, kLambda0, cent); fillProfilepTMass(corrconfigs.at(14), HIST("Lambdac24dpt"), i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(23), HIST("Lambdac32dpt"), i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(24), HIST("Lambdac32dpt"), i, kLambda0, cent); } for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(3), HIST("Xic22dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(4), HIST("Xic22dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), HIST("Xic24dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(17), HIST("Xic32dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(18), HIST("Xic32dpt"), i, kXiMinus, cent); + } + for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(6), HIST("Omegac22dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(7), HIST("Omegac22dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(8), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(19), HIST("Omegac32dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(20), HIST("Omegac32dpt"), i, kOmegaMinus, cent); } // Fill subevents flow if (cfgDoJackknife) { @@ -1070,21 +1243,34 @@ struct FlowGfwOmegaXi { continue; fillProfile(corrconfigs.at(15), refc22[j - 1], cent); fillProfile(corrconfigs.at(16), refc24[j - 1], cent); - for (int i = 1; i <= nV0PtBins; i++) { + fillProfile(corrconfigs.at(25), refc32[j - 1], cent); + for (int i = 1; i <= nK0sPtBins; i++) { fillProfilepTMass(corrconfigs.at(9), k0sc22[j - 1], i, kK0Short, cent); fillProfilepTMass(corrconfigs.at(10), k0sc22[j - 1], i, kK0Short, cent); fillProfilepTMass(corrconfigs.at(11), k0sc24[j - 1], i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(21), k0sc32[j - 1], i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(22), k0sc32[j - 1], i, kK0Short, cent); + } + for (int i = 1; i <= nLambdaPtBins; i++) { fillProfilepTMass(corrconfigs.at(12), lambdac22[j - 1], i, kLambda0, cent); fillProfilepTMass(corrconfigs.at(13), lambdac22[j - 1], i, kLambda0, cent); fillProfilepTMass(corrconfigs.at(14), lambdac24[j - 1], i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(23), lambdac32[j - 1], i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(24), lambdac32[j - 1], i, kLambda0, cent); } for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(3), xic22[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(4), xic22[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), xic24[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(17), xic32[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(18), xic32[j - 1], i, kXiMinus, cent); + } + for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(6), omegac22[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(7), omegac22[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(8), omegac24[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(19), omegac32[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(20), omegac32[j - 1], i, kOmegaMinus, cent); } } } @@ -1114,10 +1300,7 @@ struct FlowGfwOmegaXi { if (mcParticle.has_tracks()) { auto const& tracks = mcParticle.tracks_as(); for (const auto& track : tracks) { - if (track.pt() < cfgCutPtPOIMin || track.pt() > cfgCutPtPOIMax) { - continue; - } - if (std::fabs(track.eta()) > cfgCutEta) { + if (std::fabs(track.eta()) > trkQualityOpts.cfgCutEta.value) { continue; } if (!(track.isGlobalTrack())) { @@ -1127,10 +1310,10 @@ struct FlowGfwOmegaXi { continue; } int ptbin = fPtAxis->FindBin(mcParticle.pt()) - 1; - if ((mcParticle.pt() > cfgCutPtMin) && (mcParticle.pt() < cfgCutPtMax)) { + if ((mcParticle.pt() > trkQualityOpts.cfgCutPtMin.value) && (mcParticle.pt() < trkQualityOpts.cfgCutPtMax.value)) { fGFW->Fill(mcParticle.eta(), ptbin, mcParticle.phi(), 1, 64); //(eta, ptbin, phi, wacc*weff, bitmask) } - if ((mcParticle.pt() > cfgCutPtPOIMin) && (mcParticle.pt() < cfgCutPtPOIMax)) { + if ((mcParticle.pt() > trkQualityOpts.cfgCutPtPOIMin.value) && (mcParticle.pt() < trkQualityOpts.cfgCutPtPOIMax.value)) { hLocalDensity->Fill(mcParticle.phi(), 1); hLocalDensity->Fill(RecoDecay::constrainAngle(mcParticle.phi(), -constants::math::TwoPI), 1); nch++; @@ -1146,7 +1329,7 @@ struct FlowGfwOmegaXi { int pdgCode = std::abs(straGen.pdgCode()); if (pdgCode != PDG_t::kXiMinus && pdgCode != PDG_t::kOmegaMinus && pdgCode != PDG_t::kK0Short && pdgCode != PDG_t::kLambda0) continue; - if (std::fabs(straGen.eta()) > cfgCutEta) + if (std::fabs(straGen.eta()) > trkQualityOpts.cfgCutEta.value) continue; if (pdgCode == PDG_t::kXiMinus) { @@ -1161,7 +1344,7 @@ struct FlowGfwOmegaXi { double density = hLocalDensity->Integral(phibin - cfgDeltaPhiLocDen, phibin + cfgDeltaPhiLocDen); if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCGenOmega"), straGen.pt(), nch, density); - fGFW->Fill(straGen.eta(), fXiPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 256); + fGFW->Fill(straGen.eta(), fOmegaPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 256); } if (pdgCode == PDG_t::kK0Short) { @@ -1169,28 +1352,32 @@ struct FlowGfwOmegaXi { double density = hLocalDensity->Integral(phibin - cfgDeltaPhiLocDen, phibin + cfgDeltaPhiLocDen); if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCGenK0s"), straGen.pt(), nch, density); - fGFW->Fill(straGen.eta(), fXiPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 512); + fGFW->Fill(straGen.eta(), fK0sPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 512); } if (pdgCode == PDG_t::kLambda0) { int phibin = hLocalDensity->FindBin(RecoDecay::constrainAngle(straGen.phi(), -constants::math::PI)); double density = hLocalDensity->Integral(phibin - cfgDeltaPhiLocDen, phibin + cfgDeltaPhiLocDen); if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCGenLambda"), straGen.pt(), nch, density); - fGFW->Fill(straGen.eta(), fXiPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 1024); + fGFW->Fill(straGen.eta(), fLambdaPtAxis->FindBin(straGen.pt()) - 1, straGen.phi(), 1, 1024); } } fillProfile(corrconfigs.at(25), HIST("MC/c22MC"), cent); - for (int i = 1; i <= nV0PtBins; i++) { - fillProfilepTMC(corrconfigs.at(21), HIST("MC/K0sc22dptMC"), i, kK0Short, cent); - fillProfilepTMC(corrconfigs.at(22), HIST("MC/K0sc22dptMC"), i, kK0Short, cent); - fillProfilepTMC(corrconfigs.at(23), HIST("MC/Lambdac22dptMC"), i, kLambda0, cent); - fillProfilepTMC(corrconfigs.at(24), HIST("MC/Lambdac22dptMC"), i, kLambda0, cent); + for (int i = 1; i <= nK0sPtBins; i++) { + fillProfilepTMC(corrconfigs.at(30), HIST("MC/K0sc22dptMC"), i, kK0Short, cent); + fillProfilepTMC(corrconfigs.at(31), HIST("MC/K0sc22dptMC"), i, kK0Short, cent); + } + for (int i = 1; i <= nLambdaPtBins; i++) { + fillProfilepTMC(corrconfigs.at(32), HIST("MC/Lambdac22dptMC"), i, kLambda0, cent); + fillProfilepTMC(corrconfigs.at(33), HIST("MC/Lambdac22dptMC"), i, kLambda0, cent); } for (int i = 1; i <= nXiPtBins; i++) { - fillProfilepTMC(corrconfigs.at(17), HIST("MC/Xic22dptMC"), i, kXiMinus, cent); - fillProfilepTMC(corrconfigs.at(18), HIST("MC/Xic22dptMC"), i, kXiMinus, cent); - fillProfilepTMC(corrconfigs.at(19), HIST("MC/Omegac22dptMC"), i, kOmegaMinus, cent); - fillProfilepTMC(corrconfigs.at(20), HIST("MC/Omegac22dptMC"), i, kOmegaMinus, cent); + fillProfilepTMC(corrconfigs.at(26), HIST("MC/Xic22dptMC"), i, kXiMinus, cent); + fillProfilepTMC(corrconfigs.at(27), HIST("MC/Xic22dptMC"), i, kXiMinus, cent); + } + for (int i = 1; i <= nOmegaPtBins; i++) { + fillProfilepTMC(corrconfigs.at(28), HIST("MC/Omegac22dptMC"), i, kOmegaMinus, cent); + fillProfilepTMC(corrconfigs.at(29), HIST("MC/Omegac22dptMC"), i, kOmegaMinus, cent); } delete hLocalDensity; @@ -1218,36 +1405,36 @@ struct FlowGfwOmegaXi { double nch = 0; for (const auto& track : tracks) { - if (!track.has_mcParticle()) + if (track.pt() < trkQualityOpts.cfgCutPtPOIMin.value || track.pt() > trkQualityOpts.cfgCutPtPOIMax.value) continue; - if (track.pt() < cfgCutPtPOIMin || track.pt() > cfgCutPtPOIMax) - continue; - if (std::fabs(track.eta()) > cfgCutEta) + if (std::fabs(track.eta()) > trkQualityOpts.cfgCutEta.value) continue; if (!(track.isGlobalTrack())) continue; if (track.tpcChi2NCl() > cfgCutChi2prTPCcls) continue; - auto mcParticle = track.mcParticle_as(); if (cfgDoAccEffCorr) { if (!setCurrentParticleWeights(weff, wacc, track, vtxz, 0)) continue; } + nch += wacc * weff; + if (!track.has_mcParticle()) + continue; + auto mcParticle = track.mcParticle_as(); registry.fill(HIST("hPhi"), track.phi()); registry.fill(HIST("hPhicorr"), track.phi(), wacc); registry.fill(HIST("hEta"), track.eta()); registry.fill(HIST("hEtaPhiVtxzREF"), track.phi(), track.eta(), vtxz, wacc); registry.fill(HIST("hPt"), track.pt()); int ptbin = fPtAxis->FindBin(track.pt()) - 1; - if ((track.pt() > cfgCutPtMin) && (track.pt() < cfgCutPtMax)) { + if ((track.pt() > trkQualityOpts.cfgCutPtMin.value) && (track.pt() < trkQualityOpts.cfgCutPtMax.value)) { fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 1); //(eta, ptbin, phi, wacc*weff, bitmask) } - if ((track.pt() > cfgCutPtPOIMin) && (track.pt() < cfgCutPtPOIMax)) { + if ((track.pt() > trkQualityOpts.cfgCutPtPOIMin.value) && (track.pt() < trkQualityOpts.cfgCutPtPOIMax.value)) { fGFW->Fill(track.eta(), ptbin, track.phi(), wacc * weff, 32); if (cfgDoLocDenCorr) { hLocalDensity->Fill(mcParticle.phi(), wacc * weff); hLocalDensity->Fill(RecoDecay::constrainAngle(mcParticle.phi(), -constants::math::TwoPI), wacc * weff); - nch += wacc * weff; } } } @@ -1263,50 +1450,74 @@ struct FlowGfwOmegaXi { auto negdau = casc.negTrack_as(); auto posdau = casc.posTrack_as(); auto bachelor = casc.bachelor_as(); + if (bachelor.pt() < trkQualityOpts.cfgCutPtDauMin.value || bachelor.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + if (posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; + if (negdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || negdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) + continue; // fill QA - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Casc/hqaCasccosPAbefore"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAbefore"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVbefore"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVbefore"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascdaubefore"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0daubefore"), casc.dcaV0daughters()); + } // track quality check - if (bachelor.tpcNClsFound() < cfgtpcclusters) + if (!bachelor.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (posdau.tpcNClsFound() < cfgtpcclusters) + if (!posdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (negdau.tpcNClsFound() < cfgtpcclusters) + if (!negdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (bachelor.itsNCls() < cfgitsclusters) + if (!bachelor.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (posdau.itsNCls() < cfgitsclusters) + if (!posdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (negdau.itsNCls() < cfgitsclusters) + if (!negdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - // topological cut - if (casc.cascradius() < cfgcasc_radius) + if (!bachelor.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_casccospa) + if (!posdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_v0cospa) + if (!negdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - if (std::fabs(casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())) < cfgcasc_dcav0topv) + if (trkQualityOpts.cfgCheckGlobalTrack.value) { + if (!bachelor.hasTPC() || !bachelor.hasITS()) + continue; + if (!posdau.hasTPC() || !posdau.hasITS()) + continue; + if (!negdau.hasTPC() || !negdau.hasITS()) + continue; + } + // // topological cut + if (casc.cascradius() < cascBuilderOpts.cfgcasc_radius.value) + continue; + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascBuilderOpts.cfgcasc_casccospa.value) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascBuilderOpts.cfgcasc_v0cospa.value) continue; - if (std::fabs(casc.dcabachtopv()) < cfgcasc_dcabachtopv) + if (std::fabs(casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())) < cascBuilderOpts.cfgcasc_dcav0topv.value) continue; - if (casc.dcacascdaughters() > cfgcasc_dcacascdau) + if (std::fabs(casc.dcabachtopv()) < cascBuilderOpts.cfgcasc_dcabachtopv.value) continue; - if (casc.dcaV0daughters() > cfgcasc_dcav0dau) + if (casc.dcacascdaughters() > cascBuilderOpts.cfgcasc_dcacascdau.value) continue; - if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cfgcasc_mlambdawindow) + if (casc.dcaV0daughters() > cascBuilderOpts.cfgcasc_dcav0dau.value) + continue; + if (std::fabs(casc.mLambda() - o2::constants::physics::MassLambda0) > cascBuilderOpts.cfgcasc_mlambdawindow.value) continue; // fill QA - registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); - registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/Casc/hqaCasccosPAafter"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqaCascV0cosPAafter"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0toPVafter"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + registry.fill(HIST("QAhisto/Casc/hqadcaCascBachtoPVafter"), casc.dcabachtopv()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascdauafter"), casc.dcacascdaughters()); + registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); + } // Omega and antiOmega int pdgCode{cascMC.pdgCode()}; double cascPt{cascMC.pt()}; @@ -1314,7 +1525,7 @@ struct FlowGfwOmegaXi { double cascEta{cascMC.eta()}; if (std::abs(pdgCode) == kOmegaMinus) { if (casc.sign() < 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, casc, vtxz, 4); if (cfgDoLocDenCorr) { @@ -1325,9 +1536,9 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecOmega"), cascPt, nch, density, casc.mOmega()); } - fGFW->Fill(cascEta, fXiPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); + fGFW->Fill(cascEta, fOmegaPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, casc, vtxz, 4); if (cfgDoLocDenCorr) { @@ -1338,13 +1549,13 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecOmega"), cascPt, nch, density, casc.mOmega()); } - fGFW->Fill(cascEta, fXiPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); + fGFW->Fill(cascEta, fOmegaPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 4); } } // Xi and antiXi if (std::abs(pdgCode) == kXiMinus) { if (casc.sign() < 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(negdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, casc, vtxz, 3); if (cfgDoLocDenCorr) { @@ -1357,7 +1568,7 @@ struct FlowGfwOmegaXi { } fGFW->Fill(cascEta, fXiPtAxis->FindBin(cascPt) - 1, cascPhi, wacc * weff * wloc, 2); } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && - (!cfgcheckDauTPC || (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, casc, vtxz, 3); if (cfgDoLocDenCorr) { @@ -1380,45 +1591,58 @@ struct FlowGfwOmegaXi { auto v0negdau = v0.negTrack_as(); auto v0posdau = v0.posTrack_as(); - // fill QA before cut - registry.fill(HIST("QAhisto/V0/hqaV0radiusbefore"), v0.v0radius()); - registry.fill(HIST("QAhisto/V0/hqaV0cosPAbefore"), v0.v0cosPA()); - registry.fill(HIST("QAhisto/V0/hqadcaV0daubefore"), v0.dcaV0daughters()); - registry.fill(HIST("QAhisto/V0/hqadcapostoPVbefore"), v0.dcapostopv()); - registry.fill(HIST("QAhisto/V0/hqadcanegtoPVbefore"), v0.dcanegtopv()); - registry.fill(HIST("QAhisto/V0/hqaarm_podobefore"), v0.alpha(), v0.qtarm()); - // track quality check - if (v0posdau.tpcNClsFound() < cfgtpcclusters) + if (v0posdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0posdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) continue; - if (v0negdau.tpcNClsFound() < cfgtpcclusters) + if (v0negdau.pt() < trkQualityOpts.cfgCutPtDauMin.value || v0negdau.pt() > trkQualityOpts.cfgCutPtDauMax.value) continue; - if (v0posdau.tpcNClsFindable() < cfgtpcclufindable) + + // fill QA before cut + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaV0radiusbefore"), v0.v0radius()); + registry.fill(HIST("QAhisto/V0/hqaV0cosPAbefore"), v0.v0cosPA()); + registry.fill(HIST("QAhisto/V0/hqadcaV0daubefore"), v0.dcaV0daughters()); + registry.fill(HIST("QAhisto/V0/hqadcapostoPVbefore"), v0.dcapostopv()); + registry.fill(HIST("QAhisto/V0/hqadcanegtoPVbefore"), v0.dcanegtopv()); + registry.fill(HIST("QAhisto/V0/hqaarm_podobefore"), v0.alpha(), v0.qtarm()); + } + // // track quality check + if (!v0posdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) + continue; + if (!v0negdau.passedITSNCls() && trkQualityOpts.cfgCheckITSNCls.value) continue; - if (v0negdau.tpcNClsFindable() < cfgtpcclufindable) + if (!v0posdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (v0posdau.tpcCrossedRowsOverFindableCls() < cfgtpccrossoverfindable) + if (!v0negdau.passedITSHits() && trkQualityOpts.cfgCheckITSHits.value) continue; - if (v0posdau.itsNCls() < cfgitsclusters) + if (!v0posdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; - if (v0negdau.itsNCls() < cfgitsclusters) + if (!v0negdau.passedITSChi2NDF() && trkQualityOpts.cfgCheckITSChi2NDF.value) continue; + if (trkQualityOpts.cfgCheckGlobalTrack.value) { + if (!v0posdau.hasTPC() || !v0posdau.hasITS()) + continue; + if (!v0negdau.hasTPC() || !v0negdau.hasITS()) + continue; + } // topological cut - if (v0.v0radius() < cfgv0_radius) + if (v0.v0radius() < v0BuilderOpts.cfgv0_radius.value) continue; - if (v0.v0cosPA() < cfgv0_v0cospa) + if (v0.v0cosPA() < v0BuilderOpts.cfgv0_v0cospa.value) continue; - if (v0.dcaV0daughters() > cfgv0_dcav0dau) + if (v0.dcaV0daughters() > v0BuilderOpts.cfgv0_dcav0dau.value) continue; - if (std::fabs(v0.dcapostopv()) < cfgv0_dcadautopv) + if (std::fabs(v0.dcapostopv()) < v0BuilderOpts.cfgv0_dcadautopv.value) continue; - if (std::fabs(v0.dcanegtopv()) < cfgv0_dcadautopv) + if (std::fabs(v0.dcanegtopv()) < v0BuilderOpts.cfgv0_dcadautopv.value) continue; // fill QA after cut - registry.fill(HIST("QAhisto/V0/hqaV0radiusafter"), v0.v0radius()); - registry.fill(HIST("QAhisto/V0/hqaV0cosPAafter"), v0.v0cosPA()); - registry.fill(HIST("QAhisto/V0/hqadcaV0dauafter"), v0.dcaV0daughters()); - registry.fill(HIST("QAhisto/V0/hqadcapostoPVafter"), v0.dcapostopv()); - registry.fill(HIST("QAhisto/V0/hqadcanegtoPVafter"), v0.dcanegtopv()); + if (cfgOutputQA) { + registry.fill(HIST("QAhisto/V0/hqaV0radiusafter"), v0.v0radius()); + registry.fill(HIST("QAhisto/V0/hqaV0cosPAafter"), v0.v0cosPA()); + registry.fill(HIST("QAhisto/V0/hqadcaV0dauafter"), v0.dcaV0daughters()); + registry.fill(HIST("QAhisto/V0/hqadcapostoPVafter"), v0.dcapostopv()); + registry.fill(HIST("QAhisto/V0/hqadcanegtoPVafter"), v0.dcanegtopv()); + } int pdgCode{v0MC.pdgCode()}; double v0Pt{v0MC.pt()}; @@ -1426,8 +1650,9 @@ struct FlowGfwOmegaXi { double v0Eta{v0MC.eta()}; // K0short if (std::abs(pdgCode) == kK0Short) { - if (v0.qtarm() / std::fabs(v0.alpha()) > cfgv0_ArmPodocut && std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < cfgv0_mk0swindow && - (!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + if (v0.qtarm() / std::fabs(v0.alpha()) > v0BuilderOpts.cfgv0_ArmPodocut.value && + std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0BuilderOpts.cfgv0_mk0swindow.value && + (std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, v0, vtxz, 1); if (cfgDoLocDenCorr) { @@ -1438,12 +1663,12 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecK0s"), v0Pt, nch, density, v0.mK0Short()); } - fGFW->Fill(v0Eta, fV0PtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 8); + fGFW->Fill(v0Eta, fK0sPtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 8); } } // Lambda and antiLambda - if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < cfgv0_mlambdawindow && - (!cfgcheckDauTPC || (std::fabs(v0posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < v0BuilderOpts.cfgv0_mlambdawindow.value && + (std::fabs(v0posdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0negdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (std::abs(pdgCode) == kLambda0) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, v0, vtxz, 2); @@ -1455,10 +1680,10 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecLambda"), v0Pt, nch, density, v0.mLambda()); } - fGFW->Fill(v0Eta, fV0PtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 16); + fGFW->Fill(v0Eta, fLambdaPtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 16); } - } else if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < cfgv0_mlambdawindow && - (!cfgcheckDauTPC || (std::fabs(v0negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0]))) { + } else if (std::fabs(v0.mLambda() - o2::constants::physics::MassLambda) < v0BuilderOpts.cfgv0_mlambdawindow.value && + (std::fabs(v0negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(v0posdau.tpcNSigmaPi()) < cfgNSigma[0])) { if (std::abs(pdgCode) == kLambda0) { if (cfgDoAccEffCorr) setCurrentParticleWeights(weff, wacc, v0, vtxz, 2); @@ -1470,23 +1695,36 @@ struct FlowGfwOmegaXi { if (cfgOutputLocDenWeights) registry.fill(HIST("MC/densityMCRecLambda"), v0Pt, nch, density, v0.mLambda()); } - fGFW->Fill(v0Eta, fV0PtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 16); + fGFW->Fill(v0Eta, fLambdaPtAxis->FindBin(v0Pt) - 1, v0Phi, wacc * weff * wloc, 16); } } } delete hLocalDensity; fillProfile(corrconfigs.at(15), HIST("c22"), cent); - for (int i = 1; i <= nV0PtBins; i++) { + fillProfile(corrconfigs.at(25), HIST("c32"), cent); + for (int i = 1; i <= nK0sPtBins; i++) { fillProfilepTMass(corrconfigs.at(9), HIST("K0sc22dpt"), i, kK0Short, cent); fillProfilepTMass(corrconfigs.at(10), HIST("K0sc22dpt"), i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(21), HIST("K0sc32dpt"), i, kK0Short, cent); + fillProfilepTMass(corrconfigs.at(22), HIST("K0sc32dpt"), i, kK0Short, cent); + } + for (int i = 1; i <= nLambdaPtBins; i++) { fillProfilepTMass(corrconfigs.at(12), HIST("Lambdac22dpt"), i, kLambda0, cent); fillProfilepTMass(corrconfigs.at(13), HIST("Lambdac22dpt"), i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(23), HIST("Lambdac32dpt"), i, kLambda0, cent); + fillProfilepTMass(corrconfigs.at(24), HIST("Lambdac32dpt"), i, kLambda0, cent); } for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(3), HIST("Xic22dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(4), HIST("Xic22dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(17), HIST("Xic32dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(18), HIST("Xic32dpt"), i, kXiMinus, cent); + } + for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(6), HIST("Omegac22dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(7), HIST("Omegac22dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(19), HIST("Omegac32dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(20), HIST("Omegac32dpt"), i, kOmegaMinus, cent); } } PROCESS_SWITCH(FlowGfwOmegaXi, processMCRec, "", true); From fb0827bb8ab57e345d7532f3632ce5ef1f76b203 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 14 Jun 2025 13:14:37 +0530 Subject: [PATCH 073/116] [PWGLF] Added azimuthal angle phi distribution (#11566) Co-authored-by: Sawan Sawan --- .../Tasks/Resonances/higherMassResonances.cxx | 191 +++++++++++------- 1 file changed, 119 insertions(+), 72 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 252fdd6d658..fad39aaf963 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -14,6 +14,29 @@ /// \author Sawan // #include +#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 "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" // +#include "Framework/O2DatabasePDGPlugin.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 "TRandom3.h" #include #include #include @@ -23,33 +46,12 @@ #include #include #include + +#include #include #include #include #include -#include -#include "TF1.h" -#include "TRandom3.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" - -#include "Common/Core/TrackSelection.h" -#include "Common/Core/trackUtilities.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/StepTHn.h" -#include "ReconstructionDataFormats/Track.h" -#include "Framework/O2DatabasePDGPlugin.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/ASoAHelpers.h" -#include "Framework/AnalysisTask.h" // -#include "Framework/runDataProcessing.h" // -#include "PWGLF/DataModel/LFStrangenessTables.h" // using namespace o2; using namespace o2::framework; @@ -74,7 +76,7 @@ struct HigherMassResonances { // Configurable invMass1D{"invMass1D", false, "1D invariant mass histograms"}; Configurable correlation2Dhist{"correlation2Dhist", true, "Lamda K0 mass correlation"}; Configurable cDCAv0topv{"cDCAv0topv", false, "DCA V0 to PV"}; - Configurable armcut{"armcut", false, "arm cut"}; + // Configurable armcut{"armcut", false, "arm cut"}; Configurable globalTracks{"globalTracks", false, "Global tracks"}; Configurable hasTPC{"hasTPC", false, "TPC"}; Configurable selectTWOKsOnly{"selectTWOKsOnly", true, "Select only events with two K0s"}; @@ -82,11 +84,11 @@ struct HigherMassResonances { // Configurables for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cfgETAcut{"cfgETAcut", 0.8f, "Track ETA cut"}; - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; - Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; - Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; + Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; + // Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; + // Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; + // Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; + // Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; // Configurable applyOccupancyCut{"applyOccupancyCut", false, "Apply occupancy cut"}; // Configurable occupancyCut{"occupancyCut", 1000, "Mimimum Occupancy cut"}; @@ -107,7 +109,7 @@ struct HigherMassResonances { Configurable confDaughEta{"confDaughEta", 0.8f, "V0 Daugh sel: max eta"}; Configurable confDaughTPCnclsMin{"confDaughTPCnclsMin", 70.f, "V0 Daugh sel: Min. nCls TPC"}; Configurable confDaughPIDCuts{"confDaughPIDCuts", 5, "PID selections for KS0 daughters"}; - Configurable confarmcut{"confarmcut", 0.2f, "Armenteros cut"}; + // Configurable confarmcut{"confarmcut", 0.2f, "Armenteros cut"}; Configurable confKsrapidity{"confKsrapidity", 0.5f, "Rapidity cut on K0s"}; // Configurable lowmasscutks0{"lowmasscutks0", 0.497 - 4 * 0.005, "Low mass cut on K0s"}; // Configurable highmasscutks0{"highmasscutks0", 0.497 + 4 * 0.005, "High mass cut on K0s"}; @@ -125,6 +127,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"}; std::vector pdgCodes = {10331, 335, 115, 10221, 9030221}; // output THnSparses @@ -138,7 +141,7 @@ struct HigherMassResonances { // Configurable rapidityks{"rapidityks", true, "rapidity cut on K0s"}; Configurable applyCompetingcut{"applyCompetingcut", false, "Competing cascade rejection cut"}; Configurable competingcascrejlambda{"competingcascrejlambda", 0.005, "rejecting competing cascade lambda"}; - Configurable competingcascrejlambdaanti{"competingcascrejlambdaanti", 0.005, "rejecting competing cascade anti-lambda"}; // If one of the pions is misidentified as a proton, then instead of Ks we reconstruct lambda, therefore the competing cascade rejection cut is applied in which if the reconstrcted mass of a pion and proton (which we are assuming to be misidentified as proton) is close to lambda or anti-lambda, then the track is rejected + // Configurable competingcascrejlambdaanti{"competingcascrejlambdaanti", 0.005, "rejecting competing cascade anti-lambda"}; // If one of the pions is misidentified as a proton, then instead of Ks we reconstruct lambda, therefore the competing cascade rejection cut is applied in which if the reconstrcted mass of a pion and proton (which we are assuming to be misidentified as proton) is close to lambda or anti-lambda, then the track is rejected Configurable tpcCrossedrows{"tpcCrossedrows", 70, "TPC crossed rows"}; Configurable tpcCrossedrowsOverfcls{"tpcCrossedrowsOverfcls", 0.8, "TPC crossed rows over findable clusters"}; @@ -154,6 +157,7 @@ struct HigherMassResonances { Configurable ksMassBins{"ksMassBins", 200, "Number of mass bins for K0s"}; Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; ConfigurableAxis configThnAxisPOL{"configThnAxisPOL", {20, -1.0, 1.0}, "Costheta axis"}; + ConfigurableAxis configThnAxisPhi{"configThnAxisPhi", {70, 0.0f, 7.0f}, "Phi axis"}; // 0 to 2pi // 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"}; @@ -169,6 +173,8 @@ struct HigherMassResonances { float theta2; ROOT::Math::PxPyPzMVector daughter1, daughter2, fourVecDau1, fourVecMother, fourVecDauCM; ROOT::Math::XYZVector threeVecDauCM, helicityVec, randomVec, beamVec, normalVec; + ROOT::Math::XYZVector z_beam; // ẑ: beam direction in lab frame + // const double massK0s = o2::constants::physics::MassK0Short; bool isMix = false; @@ -182,6 +188,7 @@ struct HigherMassResonances { // AxisSpec multiplicityAxis = {110, 0.0f, 150.0f, "Multiplicity Axis"}; AxisSpec multiplicityAxis = {config.binsCent, "Multiplicity Axis"}; AxisSpec thnAxisPOL{config.configThnAxisPOL, "Configurabel theta axis"}; + AxisSpec thnAxisPhi = {config.configThnAxisPhi, "Configurabel phi axis"}; // 0 to 2pi // AxisSpec occupancyAxis = {occupancyBins, "Occupancy [-40,100]"}; // THnSparses @@ -216,9 +223,9 @@ struct HigherMassResonances { // rEventSelection.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); } - hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); - hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); - hglue.add("h3glueInvMassRot", "h3glueInvMassRot", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL}, true); + hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); + hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); + hglue.add("h3glueInvMassRot", "h3glueInvMassRot", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis, thnAxisPOL, thnAxisPhi}, true); hglue.add("heventscheck", "heventscheck", kTH1I, {{10, 0, 10}}); hglue.add("htrackscheck_v0", "htrackscheck_v0", kTH1I, {{15, 0, 15}}); hglue.add("htrackscheck_v0_daughters", "htrackscheck_v0_daughters", kTH1I, {{15, 0, 15}}); @@ -324,20 +331,20 @@ struct HigherMassResonances { } hglue.fill(HIST("heventscheck"), 3.5); - if (config.piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return false; - } - hglue.fill(HIST("heventscheck"), 4.5); + // if (config.piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // return false; + // } + // hglue.fill(HIST("heventscheck"), 4.5); - if (config.goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; - } - hglue.fill(HIST("heventscheck"), 5.5); + // if (config.goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // return false; + // } + // hglue.fill(HIST("heventscheck"), 5.5); - if (config.itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return false; - } - hglue.fill(HIST("heventscheck"), 6.5); + // if (config.itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // return false; + // } + // hglue.fill(HIST("heventscheck"), 6.5); return true; } @@ -345,9 +352,9 @@ struct HigherMassResonances { template bool selectionV0(Collision const& collision, V0 const& candidate, float /*multiplicity*/) { - const float qtarm = candidate.qtarm(); - const float alph = candidate.alpha(); - float arm = qtarm / alph; + // const float qtarm = candidate.qtarm(); + // const float alph = candidate.alpha(); + // float arm = qtarm / alph; const float pT = candidate.pt(); const float tranRad = candidate.v0radius(); const float dcaDaughv0 = candidate.dcaV0daughters(); @@ -441,15 +448,15 @@ struct HigherMassResonances { // if (config.correlation2Dhist) // rKzeroShort.fill(HIST("mass_lambda_kshort_after8"), candidate.mK0Short(), candidate.mLambda()); - if (config.armcut && arm < config.confarmcut) { - return false; - } + // if (config.armcut && arm < config.confarmcut) { + // return false; + // } hglue.fill(HIST("htrackscheck_v0"), 9.5); // if (config.correlation2Dhist) // rKzeroShort.fill(HIST("mass_lambda_kshort_after9"), candidate.mK0Short(), candidate.mLambda()); // if (config.applyCompetingcut && (std::abs(candidate.mLambda() - PDGdatabase->Mass(3122)) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - PDGdatabase->Mass(-3122)) <= config.competingcascrejlambdaanti)) - if (config.applyCompetingcut && (std::abs(candidate.mLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambdaanti)) { + if (config.applyCompetingcut && (std::abs(candidate.mLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda || std::abs(candidate.mAntiLambda() - o2::constants::physics::MassLambda0) <= config.competingcascrejlambda)) { return false; } hglue.fill(HIST("htrackscheck_v0"), 10.5); @@ -565,59 +572,99 @@ struct HigherMassResonances { using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; using V0TrackCandidatesMC = soa::Join; + // z_beam direction in lab frame template void fillInvMass(const T2& lv3, const T3& lv5, float multiplicity, const T4& daughter1, bool isMix) { - // polarization calculations + // //polarization calculations + // z_beam = ROOT::Math::XYZVector(0.f, 0.f, 1.f); // ẑ: beam direction in lab frame - fourVecDau1 = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), o2::constants::physics::MassK0Short); // Kaon or Pion + fourVecDau1 = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), o2::constants::physics::MassK0Short); - fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // mass of KshortKshort pair - ROOT::Math::Boost boost{fourVecMother.BoostToCM()}; // boost mother to center of mass frame - fourVecDauCM = boost(fourVecDau1); // boost the frame of daughter same as mother + fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // 4 vector of mother particle + ROOT::Math::Boost boost{fourVecMother.BoostToCM()}; // define the boost to the center of mass frame + fourVecDauCM = boost(fourVecDau1); // 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 + // define y = z_beam x z: Normal to the production plane + // ẑ: mother direction in lab, boosted into mother's rest frame + + // auto motherLabDirection = ROOT::Math::XYZVector(0, 0, fourVecMother.Vect().Z()); // ẑ axis in lab frame + + // // ŷ = z_beam × ẑ + // auto y_axis = z_beam.Cross(motherLabDirection).Unit(); + + // // x̂ = ŷ × ẑ + // auto x_axis = y_axis.Cross(motherLabDirection).Unit(); + + // // Project daughter momentum onto x–y plane + // auto p_proj_x = threeVecDauCM.Dot(x_axis); + // auto p_proj_y = threeVecDauCM.Dot(y_axis); + + // // Calculate φ in [-π, π] + // auto angle_phi = std::atan2(p_proj_y, p_proj_x); // φ in radians + + double BeamMomentum = TMath::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 v1_CM{(boost(fourVecDau1).Vect()).Unit()}; + // ROOT::Math::XYZVectorF v2_CM{(boost(fourVecDau1).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam1_CM{(boost(Beam1).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam2_CM{(boost(Beam2).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 + // Helicity frame + ROOT::Math::XYZVectorF zaxis_HE{(fourVecMother.Vect()).Unit()}; + ROOT::Math::XYZVectorF yaxis_HE{(Beam1_CM.Cross(Beam2_CM)).Unit()}; + ROOT::Math::XYZVectorF xaxis_HE{(yaxis_HE.Cross(zaxis_HE)).Unit()}; + + // CosThetaHE = zaxis_HE.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] + } if (std::abs(lv3.Rapidity()) < 0.5) { if (config.activateTHnSparseCosThStarHelicity) { helicityVec = fourVecMother.Vect(); // 3 vector of mother in COM frame auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); if (!isMix) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.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); - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarHelicity, angle_phi); } } else { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarHelicity, angle_phi); } } else if (config.activateTHnSparseCosThStarProduction) { normalVec = ROOT::Math::XYZVector(lv3.Py(), -lv3.Px(), 0.f); auto cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(normalVec.Mag2())); if (!isMix) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction, angle_phi); for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(0, o2::constants::math::PI); - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarProduction, angle_phi); } } else { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarProduction, angle_phi); } } else if (config.activateTHnSparseCosThStarBeam) { beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); if (!isMix) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam, angle_phi); for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(0, o2::constants::math::PI); - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarBeam, angle_phi); } } else { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam, angle_phi); } } else if (config.activateTHnSparseCosThStarRandom) { @@ -627,13 +674,13 @@ 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(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()); if (!isMix) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom, angle_phi); for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(0, o2::constants::math::PI); - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, lv5.Pt(), lv5.M(), cosThetaStarRandom, angle_phi); } } else { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom); + hglue.fill(HIST("h3glueInvMassME"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarRandom, angle_phi); } } } @@ -979,7 +1026,7 @@ struct HigherMassResonances { // hMChists.fill(HIST("GenPy"), mcParticle.py()); // hMChists.fill(HIST("GenPz"), mcParticle.pz()); - if (std::abs(mcParticle.y()) >= 0.5) { + if (config.apply_rapidityMC && std::abs(mcParticle.y()) >= 0.5) { continue; } hMChists.fill(HIST("events_check"), 6.5); @@ -1159,7 +1206,7 @@ struct HigherMassResonances { } hMChists.fill(HIST("events_checkrec"), 17.5); - if (std::abs(mothertrack1.y()) >= 0.5) { + if (config.apply_rapidityMC && std::abs(mothertrack1.y()) >= 0.5) { continue; } hMChists.fill(HIST("events_checkrec"), 18.5); From d80d8bb7fbcda213cdb09913700fa21899924eee Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:24:22 +0200 Subject: [PATCH 074/116] [PWGCF] FemtoUniverse: Filling 3D histo of qLCMS vs dEta vs dPhi (#11603) --- ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 977342a3939..d0205e6bb8f 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -182,6 +182,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms in multiplicity bins (in multiplicity bins)"}; Configurable cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if cfgProcessMultBins is set false, this will not be processed regardless this Configurable state)"}; Configurable cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and Mult bins"}; + Configurable ConfIsFillAngqLCMS{"ConfIsFillAngqLCMS", true, "Fill qLCMS vs dEta vs dPhi"}; FemtoUniverseSHContainer sameEventCont; FemtoUniverseSHContainer mixedEventCont; @@ -519,12 +520,21 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { double rand; rand = randgen->Rndm(); + std::vector f3d; + double kv; + switch (ContType) { case 2: { if (rand > 0.5) { sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); } else if (rand <= 0.5) { sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + } + if (ConfIsFillAngqLCMS) { + kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); + pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::same, kv); } break; } @@ -532,8 +542,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 3: { if (rand > 0.5) { sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); } else if (rand <= 0.5) { sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + } + if (ConfIsFillAngqLCMS) { + kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); + pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::same, kv); } break; } @@ -657,6 +673,9 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { double rand; rand = randgen->Rndm(); + std::vector f3d; + double kv; + switch (ContType) { case 1: { if (rand > 0.5) { @@ -670,8 +689,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 2: { if (rand > 0.5) { mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); } else { mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + } + if (ConfIsFillAngqLCMS) { + kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); + pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, kv); } break; } @@ -679,8 +704,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { case 3: { if (rand > 0.5) { mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden); } else { mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden); + f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden); + } + if (ConfIsFillAngqLCMS) { + kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]); + pairCloseRejection.ClosePairqLCMS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, kv); } break; } From 1f25a5a0555601b45836a67b1b58f153d9ec3105 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sat, 14 Jun 2025 18:52:19 +0800 Subject: [PATCH 075/116] [PWGCF] add pT-diff correlations (#11617) --- PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index e79c61b3096..13c8b352d9f 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -94,6 +94,7 @@ struct DiHadronCor { 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(cfgUsePtDiff, bool, false, "To enable pt differential vn, one needs to set this to true and set the pt bins accordingly") SliceCache cache; @@ -472,8 +473,10 @@ struct DiHadronCor { associatedWeight = efficiencyAssociatedCache[track2.filteredIndex()]; } - if (track1.pt() <= track2.pt()) - continue; // skip if the trigger pt is less than the associate pt + if (cfgUsePtDiff && track1.globalIndex() == track2.globalIndex()) + continue; // For pt-differential correlations, skip if the trigger and associate are the same track + if (!cfgUsePtDiff && track1.pt() <= track2.pt()) + continue; // Without pt-differential correlations, 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(); @@ -537,8 +540,10 @@ struct DiHadronCor { if (doprocessOntheflyMixed && !genTrackSelected(track2)) continue; - if (track1.pt() <= track2.pt()) - continue; // skip if the trigger pt is less than the associate pt + if (cfgUsePtDiff && track1.globalIndex() == track2.globalIndex()) + continue; // For pt-differential correlations, skip if the trigger and associate are the same track + if (!cfgUsePtDiff && track1.pt() <= track2.pt()) + continue; // Without pt-differential correlations, 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(); From 420d8cb36a586aae68b714d357b6011d6f9d586d Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 14 Jun 2025 15:21:23 +0200 Subject: [PATCH 076/116] [Common] Add hepmc info for O-O cent studies (#11621) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder --- Common/DataModel/Multiplicity.h | 5 +++++ Common/TableProducer/multiplicityTable.cxx | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index ce6aa4ba046..864e2a9cd1c 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -184,9 +184,14 @@ DECLARE_SOA_TABLE_VERSIONED(MultMCExtras_001, "AOD", "MULTMCEXTRA", 1, //! Table mult::IsInelGt1, o2::soa::Marker<1>); +DECLARE_SOA_TABLE(MultHepMCHIs, "AOD", "MULTHEPMCHI", //! complementary table for heavy-ion mc info (subset of HepMCHeavyIons) + o2::soa::Index<>, hepmcheavyion::McCollisionId, hepmcheavyion::NcollHard, hepmcheavyion::NpartProj, hepmcheavyion::NpartTarg, + hepmcheavyion::Ncoll, hepmcheavyion::ImpactParameter); + using MultMCExtras = MultMCExtras_001; using MultMCExtra = MultMCExtras::iterator; using MultsExtraMC = MultMCExtras; // for backwards compatibility with previous naming scheme +using MultHepMCHI = MultHepMCHIs::iterator; // crosslinks namespace mult diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 6deb146daab..eb9648ecf2b 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -100,6 +100,7 @@ struct MultiplicityTable { Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 Produces tableExtraMult2MCExtras; + Produces multHepMCHIs; // Not accounted for, produced using custom process function to avoid dependencies Produces mftMults; // Not accounted for, produced using custom process function to avoid dependencies Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters @@ -734,6 +735,18 @@ struct MultiplicityTable { using Run3Tracks = soa::Join; Partition pvContribGlobalTracksEta1 = (minPtGlobalTrack < aod::track::pt && aod::track::pt < maxPtGlobalTrack) && (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & static_cast(o2::aod::track::PVContributor)) == static_cast(o2::aod::track::PVContributor)) && requireQualityTracksInFilter(); + void processHepMCHeavyIons(aod::HepMCHeavyIons const& hepmchis) + { + for (auto const& hepmchi : hepmchis) { + multHepMCHIs(hepmchi.mcCollisionId(), + hepmchi.ncollHard(), + hepmchi.npartProj(), + hepmchi.npartTarg(), + hepmchi.ncoll(), + hepmchi.impactParameter()); + } + } + void processGlobalTrackingCounters(aod::Collision const& collision, soa::Join const& tracksIU, Run3Tracks const&) { // counter from Igor @@ -808,6 +821,7 @@ struct MultiplicityTable { PROCESS_SWITCH(MultiplicityTable, processGlobalTrackingCounters, "Produce Run 3 global counters", false); PROCESS_SWITCH(MultiplicityTable, processMC, "Produce MC multiplicity tables", false); PROCESS_SWITCH(MultiplicityTable, processMC2Mults, "Produce MC -> Mult map", false); + PROCESS_SWITCH(MultiplicityTable, processHepMCHeavyIons, "Produce MultHepMCHIs tables", false); PROCESS_SWITCH(MultiplicityTable, processRun3MFT, "Produce MFT mult tables", false); }; From 7b5501c19ee3dc18ed694984776f06dbd293751b Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Sat, 14 Jun 2025 15:25:13 +0200 Subject: [PATCH 077/116] [PWGCF] Added ITS PID (#11608) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 119 ++++++++++++++++++------------ 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index 1d979488da3..97fbc3a3661 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -13,48 +13,46 @@ /// \brief PID flow using the generic framework /// \author Preet Bhanjan Pati -#include -#include -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/StepTHn.h" +#include "PWGCF/GenericFramework/Core/FlowContainer.h" +#include "PWGCF/GenericFramework/Core/GFW.h" +#include "PWGCF/GenericFramework/Core/GFWConfig.h" +#include "PWGCF/GenericFramework/Core/GFWCumulant.h" +#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" +#include "PWGCF/GenericFramework/Core/GFWWeights.h" +#include "PWGCF/GenericFramework/Core/GFWWeightsList.h" -#include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.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/Core/trackUtilities.h" -#include "Common/DataModel/Multiplicity.h" -#include "CommonConstants/PhysicsConstants.h" - -#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" -#include "PWGCF/GenericFramework/Core/GFW.h" -#include "PWGCF/GenericFramework/Core/GFWCumulant.h" -#include "PWGCF/GenericFramework/Core/FlowContainer.h" -#include "PWGCF/GenericFramework/Core/GFWWeights.h" -#include "PWGCF/GenericFramework/Core/GFWWeightsList.h" -#include "PWGCF/GenericFramework/Core/GFWConfig.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "ReconstructionDataFormats/Track.h" +#include "CommonConstants/PhysicsConstants.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 "Math/Vector4D.h" +#include #include #include -#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -72,6 +70,7 @@ GFWCorrConfigs configs; using namespace o2::analysis::genericframework; struct FlowPbpbPikp { + o2::aod::ITSResponse itsResponse; Service ccdb; Configurable noLaterThan{"noLaterThan", 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"}; @@ -107,11 +106,12 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC") O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut") O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts"); + O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification"); 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> cfgTofNsigmaCut{"cfgTofNsigmaCut", 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> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector{3, 2.5, 2, 3, 2.5, 2}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> cfgItsNsigmaCut{"cfgItsNsigmaCut", 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> cfgTpcNsigmaCut{"cfgTpcNsigmaCut", 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> cfgUseEventCuts{"cfgUseEventCuts", std::vector{1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0}, "Switch for various event cuts [kNoTimeFrameBorder, kNoITSROFrameBorder, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV, kNoCollInTimeRangeStandard, kIsGoodITSLayersAll, kNoCollInRofStandard, kNoHighMultCollInPrevRof, Occupancy, Multiplicity correlation, T0AV0A 3 sigma cut, kIsVertexITSTPC, kTVXinTRD]"}; @@ -125,6 +125,7 @@ struct FlowPbpbPikp { ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; + ConfigurableAxis axisNsigmaITS{"axisNsigmaITS", {80, -5, 5}, "nsigmaITS axis"}; ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; ConfigurableAxis axisTOFbeta{"axisTOFbeta", {200, 0, 2}, "axis for TOF beta"}; @@ -249,9 +250,14 @@ struct FlowPbpbPikp { histos.add("TofBeta", "", {HistType::kTH2D, {axisPt, axisTOFbeta}}); histos.add("TofTpcNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); - histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); + if (!cfgUseItsPID) + histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); + histos.add("TofItsNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaITS, axisNsigmaTOF, axisPt}}}); + if (cfgUseItsPID) + histos.add("TofItsNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaITS, axisNsigmaTOF, axisPt}}}); + histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, 0, 15}}}); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); histos.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8"); @@ -448,7 +454,10 @@ struct FlowPbpbPikp { histos.fill(HIST("partCount"), pidIndex - 1, collision.centFT0C(), track.pt()); switch (pidIndex) { case 1: - histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt()); + if (!cfgUseItsPID) + histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt()); + if (cfgUseItsPID) + histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS(track), track.tofNSigmaPi(), track.pt()); histos.fill(HIST("hTrackCount"), 7.5); // Pion count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pi_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // pion weights @@ -458,7 +467,10 @@ struct FlowPbpbPikp { histos.fill(HIST("PhiCorrected/hPhiEtaPt_pi_corrd"), track.phi(), track.eta(), track.pt(), wacc); break; case 2: - histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt()); + if (!cfgUseItsPID) + histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt()); + if (cfgUseItsPID) + histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS(track), track.tofNSigmaKa(), track.pt()); histos.fill(HIST("hTrackCount"), 8.5); // Kaon count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_ka_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // kaon weights @@ -468,7 +480,10 @@ struct FlowPbpbPikp { histos.fill(HIST("PhiCorrected/hPhiEtaPt_ka_corrd"), track.phi(), track.eta(), track.pt(), wacc); break; case 3: - histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt()); + if (!cfgUseItsPID) + histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt()); + if (cfgUseItsPID) + histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS(track), track.tofNSigmaPr(), track.pt()); histos.fill(HIST("hTrackCount"), 9.5); // Proton count if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz) histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pr_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // proton weights @@ -512,17 +527,21 @@ struct FlowPbpbPikp { } template - int getNsigmaPIDTpcTofAssymmetric(TTrack track) + int getNsigmaPIDAssymmetric(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 = cfgUseItsPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::vector detectorNsigmaCut = cfgUseItsPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + bool isPion, isKaon, isProton; - bool isTpcPion = nSigmaTPC[0] < tpcNsigmaCut[0] && nSigmaTPC[0] > tpcNsigmaCut[0 + 3]; - bool isTpcKaon = nSigmaTPC[1] < tpcNsigmaCut[1] && nSigmaTPC[1] > tpcNsigmaCut[1 + 3]; - bool isTpcProton = nSigmaTPC[2] < tpcNsigmaCut[2] && nSigmaTPC[2] > tpcNsigmaCut[2 + 3]; + 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]; @@ -531,13 +550,13 @@ struct FlowPbpbPikp { if (track.pt() > cfgTofPtCut && !track.hasTOF()) { return 0; } else if (track.pt() > cfgTofPtCut && track.hasTOF()) { - isPion = isTofPion && isTpcPion; - isKaon = isTofKaon && isTpcKaon; - isProton = isTofProton && isTpcProton; + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; } else { - isPion = isTpcPion; - isKaon = isTpcKaon; - isProton = isTpcProton; + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; } if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { @@ -917,10 +936,14 @@ struct FlowPbpbPikp { histos.fill(HIST("TofTpcNsigma_before"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); histos.fill(HIST("TofTpcNsigma_before"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); + histos.fill(HIST("TofItsNsigma_before"), PIONS, itsResponse.nSigmaITS(track), track.tofNSigmaPi(), pt); + histos.fill(HIST("TofItsNsigma_before"), KAONS, itsResponse.nSigmaITS(track), track.tofNSigmaKa(), pt); + histos.fill(HIST("TofItsNsigma_before"), PROTONS, itsResponse.nSigmaITS(track), track.tofNSigmaPr(), pt); + bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range - pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDTpcTofAssymmetric(track) : getNsigmaPIDTpcTof(track); + pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track); weff = 1; // Initializing weff for each track // NUA weights From 981ff92a0d9dcbe3f5005a72bf5a58c13ecd5d11 Mon Sep 17 00:00:00 2001 From: hernasab Date: Sat, 14 Jun 2025 09:55:43 -0500 Subject: [PATCH 078/116] [PWGCF] remove obsolete variables (#11614) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 250 +++++++++++++------------------ 1 file changed, 100 insertions(+), 150 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 18b92bbfff8..3daec8cf2c7 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -189,10 +189,6 @@ struct FlowZdcTask { { // define axes const AxisSpec axisCounter{1, 0, +1, ""}; - const AxisSpec axisQ{100, -1, 1, "Q"}; - const AxisSpec axisQZNA{100, -1, 1, "Q"}; - const AxisSpec axisREQ{100, -1, 1, "real Q"}; - const AxisSpec axisIMQ{100, -1, 1, "imag Q"}; const AxisSpec axisEvent{18, 0.5, 18.5, ""}; const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; @@ -203,33 +199,15 @@ struct FlowZdcTask { // create histograms histos.add("hEventCounter", "Event counter", kTH1F, {axisEvent}); histos.add("zPos", ";;Entries;", kTH1F, {axisZpos}); - histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); - histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); histos.add("centHistogram", "centHistogram", kTH1F, {axisCent}); histos.add("multHistogram", "multHistogram", kTH1F, {axisMultiplicity}); - histos.add("multvsCent", "centrality vs multiplicity", kTH2F, {axisCent, axisMultiplicity}); histos.add("phiHistogram", "phiHistogram", kTH1F, {axisPhi}); - histos.add("TPCmultiplicity", "TPCmultiplicity", kTH1F, {axisMultTpc}); - - histos.add("REqHistogram", "REqHistogram", kTH1F, {axisQ}); - histos.add("IMqHistogram", "IMqHistogram", kTH1F, {axisQ}); - - histos.add("REqHistogramZNA", "REqHistogramZNA", kTH1F, {axisQZNA}); - histos.add("IMqHistogramZNA", "IMqHistogramZNA", kTH1F, {axisQZNA}); - - histos.add("REqHistogramZNC", "REqHistogramZNC", kTH1F, {axisQZNA}); - histos.add("IMqHistogramZNC", "IMqHistogramZNC", kTH1F, {axisQZNA}); - - histos.add("EnergyZNA", "ZNA Sector Energy", kTH1F, {axisEnergy}); - histos.add("EnergyZNC", "ZNC Sector Energy", kTH1F, {axisEnergy}); - histos.add("hCentFT0C", "FT0C Centrality Distribution", kTH1F, {{100, 0, 105}}); histos.add("hZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", kTH2F, {axisCent, axisZN}); - histos.add("hZPvsFT0Ccent", "ZP Energy vs FT0C Centrality;Centrality [%];ZP Energy", kTH2F, @@ -237,7 +215,6 @@ struct FlowZdcTask { histos.add("hNchvsNPV", ";NPVTracks (|#eta|<1);N_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsNch, -0.5, maxNch}, {nBinsNch, -0.5, maxNch}}}); - histos.add("revsimag", "revsimag", kTH2F, {axisREQ, axisIMQ}); // for q vector recentering histos.add("hYield", "Nch vs pT", kTH2F, {axisMultiplicity, axisPt}); histos.add("hGlobalTracks", "hGlobalTracks", kTH1F, {axisMultiplicity}); // event selection steps @@ -268,17 +245,13 @@ struct FlowZdcTask { if (doprocessZdcCollAssoc) { // Check if the process function for ZDCCollAssoc is enabled histos.add("ZNAcoll", "ZNAcoll; ZNA amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZn}}}); histos.add("ZNCcoll", "ZNCcoll; ZNC amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZn}}}); + histos.add("ZPCcoll", "ZPCcoll; ZPC amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZn}}}); + histos.add("ZPAcoll", "ZPAcoll; ZPA amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZn}}}); histos.add("ZEM1coll", "ZEM1coll; ZEM1 amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZem}}}); histos.add("ZEM2coll", "ZEM2coll; ZEM2 amplitude; Entries", {HistType::kTH1F, {{nBinsAmp, -0.5, maxZem}}}); histos.add("ZNvsZEMcoll", "ZNvsZEMcoll; ZEM; ZNA+ZNC", {HistType::kTH2F, {{{nBinsAmp, -0.5, maxZem}, {nBinsAmp, -0.5, 2. * maxZn}}}}); histos.add("ZNAvsZNCcoll", "ZNAvsZNCcoll; ZNC; ZNA", {HistType::kTH2F, {{{nBinsAmp, -0.5, maxZn}, {nBinsAmp, -0.5, maxZn}}}}); - histos.add("RealQHistogramZNA", "RealQHistogramZNA", kTH1F, {axisQZNA}); - histos.add("ImagQHistogramZNA", "ImagQHistogramZNA", kTH1F, {axisQZNA}); - histos.add("RealQHistogramZNC", "RealQHistogramZNC", kTH1F, {axisQZNA}); - histos.add("ImagQHistogramZNC", "ImagQHistogramZNC", kTH1F, {axisQZNA}); - - histos.add("Acorrelations", "Acorrelations", kTH2F, {{axisQZNA}, {axisQZNA}}); histos.add("SPAngleZNA", "Spectator Plane Angle ZNA;Angle (radians);Entries", {HistType::kTH1F, {{100, -o2::constants::math::PI, o2::constants::math::PI}}}); histos.add("SPAngleZNC", "Spectator Plane Angle ZNC;Angle (radians);Entries", {HistType::kTH1F, {{100, -o2::constants::math::PI, o2::constants::math::PI}}}); @@ -351,15 +324,6 @@ struct FlowZdcTask { 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.}}}); } - LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; - LOG(info) << "\tapplyEff=" << applyEff.value; - LOG(info) << "\tpaTH=" << paTH.value; - LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; - LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; - LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; - LOG(info) << "\tminPt=" << minPt.value; - LOG(info) << "\tmaxPt=" << maxPt.value; - LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value; ccdb->setURL("http://alice-ccdb.cern.ch"); // Enabling object caching, otherwise each call goes to the CCDB server @@ -491,6 +455,17 @@ struct FlowZdcTask { float tZPC{zdc.timeZPC()}; float tZDCdif{tZNC + tZPC - tZNA - tZPA}; float tZDCsum{tZNC + tZPC + tZNA + tZPA}; + const double normT0M{(aT0A + aT0C) / 100.}; + float znA = zdc.amplitudeZNA() / cfgCollisionEnergy; + float znC = zdc.amplitudeZNC() / cfgCollisionEnergy; + float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy; + float zpC = zdc.amplitudeZPC() / cfgCollisionEnergy; + float aZEM1{zdc.amplitudeZEM1()}; + float aZEM2{zdc.amplitudeZEM2()}; + float sumZEMs{aZEM1 + aZEM2}; + float tZEM1{zdc.timeZEM1()}; + float tZEM2{zdc.timeZEM2()}; + float sumZNs{znA + znC}; // TDC cut if (isTDCcut) { @@ -500,10 +475,6 @@ struct FlowZdcTask { histos.fill(HIST("hEventCounter"), EvCutLabel::Tdc); } - float aZEM1{zdc.amplitudeZEM1()}; - float aZEM2{zdc.amplitudeZEM2()}; - float sumZEMs{aZEM1 + aZEM2}; - // ZEM cut if (isZEMcut) { if (sumZEMs < zemCut) { @@ -512,29 +483,22 @@ struct FlowZdcTask { histos.fill(HIST("hEventCounter"), EvCutLabel::Zem); } - const double normT0M{(aT0A + aT0C) / 100.}; - float znA = zdc.amplitudeZNA() / cfgCollisionEnergy; - float znC = zdc.amplitudeZNC() / cfgCollisionEnergy; - float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy; - float zpC = zdc.amplitudeZPC() / cfgCollisionEnergy; - - float tZEM1{zdc.timeZEM1()}; - float tZEM2{zdc.timeZEM2()}; - float sumZNs{znA + znC}; - float sumZNC = (zdc.energySectorZNC())[0] + (zdc.energySectorZNC())[1] + (zdc.energySectorZNC())[2] + (zdc.energySectorZNC())[3]; float sumZNA = (zdc.energySectorZNA())[0] + (zdc.energySectorZNA())[1] + (zdc.energySectorZNA())[2] + (zdc.energySectorZNA())[3]; float sumZPC = (zdc.energySectorZPC())[0] + (zdc.energySectorZPC())[1] + (zdc.energySectorZPC())[2] + (zdc.energySectorZPC())[3]; float sumZPA = (zdc.energySectorZPA())[0] + (zdc.energySectorZPA())[1] + (zdc.energySectorZPA())[2] + (zdc.energySectorZPA())[3]; - int itsTracks = 0, glbTracks = 0; float et = 0., meanpt = 0.; + int itsTracks = 0, glbTracks = 0; for (const auto& track : tracks) { - if (track.hasITS() && track.itsNCls() >= minITSnCls) { + if (track.hasITS()) { itsTracks++; } // Track Selection - if (track.isGlobalTrack()) { + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } glbTracks++; @@ -637,42 +601,6 @@ struct FlowZdcTask { } } - void processQVector(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcsData*/, aod::ZDCMults const& /*zdcMults*/) - { - if (!isEventSelected(collision)) { - return; - } - histos.fill(HIST("eventCounter"), 0.5); - histos.fill(HIST("centHistogram"), collision.centFT0C()); - const auto& tracksGrouped = tracksIUWithTPC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - const int multTPC = tracksGrouped.size(); - const auto cent = collision.centFT0C(); - int globalTracks = tracks.size(); - if (globalTracks < 1) - return; - int nTot{0}; // Tracks are already filtered with GlobalTrack || GlobalTrackSDD - for (const auto& track : tracks) { - nTot++; - histos.fill(HIST("etaHistogram"), track.eta()); - histos.fill(HIST("phiHistogram"), track.phi()); - histos.fill(HIST("ptHistogram"), track.pt()); - } // end track loop 1 - double pT{0}; - for (const auto& track : tracks) { - if (track.tpcNClsCrossedRows() < minTpcNcrossedRows) - continue; - if (std::fabs(track.dcaXY()) > cfgCutDCAxy) - continue; - pT = track.pt(); - pT++; - } // end track loop 2 - histos.fill(HIST("multvsCent"), cent, nTot); - histos.fill(HIST("hYield"), nTot, pT); - histos.fill(HIST("multHistogram"), nTot); - - histos.fill(HIST("TPCmultiplicity"), multTPC); - histos.fill(HIST("hGlobalTracks"), globalTracks); - } void processZdcCollAssoc( AodCollisions::iterator const& collision, AodTracks const& tracks, @@ -683,10 +611,10 @@ struct FlowZdcTask { if (!isEventSelected(collision)) { return; } + const auto& foundBC = collision.foundBC_as(); int nTot = tracks.size(); double ft0aAmp = 0; double ft0cAmp = 0; - const auto& foundBC = collision.foundBC_as(); if (collision.has_foundFT0()) { auto ft0 = collision.foundFT0(); for (const auto& amplitude : ft0.amplitudeA()) { @@ -696,66 +624,89 @@ struct FlowZdcTask { ft0cAmp += amplitude; } } + const double normT0M{(ft0aAmp + ft0aAmp) / 100.}; histos.fill(HIST("hFT0AAmp"), ft0aAmp); - histos.fill(HIST("hFT0CAmp"), ft0cAmp); - double ft0mAmp = ft0aAmp + ft0cAmp; - histos.fill(HIST("hFT0MAmp"), ft0mAmp); - if (foundBC.has_zdc()) { - const auto& zdcread = foundBC.zdc(); - const auto cent = collision.centFT0C(); - - // ZDC data and histogram filling - histos.get(HIST("ZNAcoll"))->Fill(zdcread.amplitudeZNA()); - histos.get(HIST("ZNCcoll"))->Fill(zdcread.amplitudeZNC()); - histos.get(HIST("ZNvsZEMcoll"))->Fill(zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(), zdcread.amplitudeZNA() + zdcread.amplitudeZNC()); - histos.get(HIST("ZNAvsZNCcoll"))->Fill(zdcread.amplitudeZNC(), zdcread.amplitudeZNA()); - - histos.get(HIST("ZEM1coll"))->Fill(zdcread.amplitudeZEM1()); - histos.get(HIST("ZEM2coll"))->Fill(zdcread.amplitudeZEM2()); - - float sumZNC = (zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]; - float sumZNA = (zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]; - float sumZPC = (zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]; - float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; - float sumZDC = sumZPA + sumZPC + sumZNA + sumZNC; - float sumZEM = zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(); - // ZEM cut - if (isZEMcut) { - if (sumZEM < zemCut) { - return; - } + histos.fill(HIST("hFT0CAmp"), ft0aAmp); + histos.fill(HIST("hFT0MAmp"), normT0M); + + if (!foundBC.has_zdc()) { + return; + } + const auto& zdcread = foundBC.zdc(); + const auto cent = collision.centFT0C(); + + // ZDC data and histogram filling + float znA = zdcread.amplitudeZNA(); + float znC = zdcread.amplitudeZNC(); + float zpA = zdcread.amplitudeZPA(); + float zpC = zdcread.amplitudeZPC(); + float tZNA{zdcread.timeZNA()}; + float tZNC{zdcread.timeZNC()}; + float tZPA{zdcread.timeZPA()}; + float tZPC{zdcread.timeZPC()}; + float tZDCdif{tZNC + tZPC - tZNA - tZPA}; + float tZDCsum{tZNC + tZPC + tZNA + tZPA}; + float sumZNC = (zdcread.energySectorZNC())[0] + (zdcread.energySectorZNC())[1] + (zdcread.energySectorZNC())[2] + (zdcread.energySectorZNC())[3]; + float sumZNA = (zdcread.energySectorZNA())[0] + (zdcread.energySectorZNA())[1] + (zdcread.energySectorZNA())[2] + (zdcread.energySectorZNA())[3]; + float sumZPC = (zdcread.energySectorZPC())[0] + (zdcread.energySectorZPC())[1] + (zdcread.energySectorZPC())[2] + (zdcread.energySectorZPC())[3]; + float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3]; + float sumZDC = sumZPA + sumZPC + sumZNA + sumZNC; + float sumZEM = zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(); + znA /= cfgCollisionEnergy; + znC /= cfgCollisionEnergy; + zpA /= cfgCollisionEnergy; + zpC /= cfgCollisionEnergy; + // TDC cut + if (isTDCcut) { + if (std::sqrt(std::pow(tZDCdif, 2.) + std::pow(tZDCsum, 2.)) > tdcCut) { + return; + } + histos.fill(HIST("hEventCounter"), EvCutLabel::Tdc); + } + // ZEM cut + if (isZEMcut) { + if (sumZEM < zemCut) { + return; } - // common energies - float commonSumZnc = (zdcread.energyCommonZNC()); - float commonSumZna = (zdcread.energyCommonZNA()); - float commonSumZpc = (zdcread.energyCommonZPC()); - float commonSumZpa = (zdcread.energyCommonZPA()); - float sumZN = (sumZNC) + (sumZNA); - float sumZP = (sumZPC) + (sumZPA); - - histos.fill(HIST("ZNenergy"), sumZN); - histos.fill(HIST("ZPenergy"), sumZP); - histos.fill(HIST("ZNCenergy"), commonSumZnc); - histos.fill(HIST("ZNAenergy"), commonSumZna); - histos.fill(HIST("ZPAenergy"), commonSumZpa); - histos.fill(HIST("ZPCenergy"), commonSumZpc); - histos.fill(HIST("hZNvsFT0Ccent"), cent, sumZN); - histos.fill(HIST("hZPvsFT0Ccent"), cent, sumZP); - histos.fill(HIST("hZNvsFT0CAmp"), ft0cAmp, sumZN); - histos.fill(HIST("hZPvsFT0CAmp"), ft0cAmp, sumZP); - histos.fill(HIST("hZNvsMult"), nTot, sumZN); - histos.fill(HIST("hZPvsMult"), nTot, sumZP); - histos.fill(HIST("hNchvsNPV"), collision.multNTracksPVeta1(), nTot); - - float ratioZN = sumZNC / sumZNA; - float ratioZP = sumZPC / sumZPA; - pZNratiovscent->Fill(cent, ratioZN); - pZPratiovscent->Fill(cent, ratioZP); - pZNvsFT0Ccent->Fill(cent, sumZN); - pZPvsFT0Ccent->Fill(cent, sumZP); - - histos.get(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC); } + // common energies + float commonSumZnc = (zdcread.energyCommonZNC()); + float commonSumZna = (zdcread.energyCommonZNA()); + float commonSumZpc = (zdcread.energyCommonZPC()); + float commonSumZpa = (zdcread.energyCommonZPA()); + float sumZN = (sumZNC) + (sumZNA); + float sumZP = (sumZPC) + (sumZPA); + histos.fill(HIST("zPos"), collision.posZ()); + histos.fill(HIST("T0Ccent"), collision.centFT0C()); + histos.fill(HIST("ZNAcoll"), znA); + histos.fill(HIST("ZNCcoll"), znC); + histos.fill(HIST("ZPAcoll"), zpA); + histos.fill(HIST("ZPCcoll"), zpC); + histos.get(HIST("ZNvsZEMcoll"))->Fill(zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(), zdcread.amplitudeZNA() + zdcread.amplitudeZNC()); + histos.get(HIST("ZNAvsZNCcoll"))->Fill(zdcread.amplitudeZNC(), zdcread.amplitudeZNA()); + histos.get(HIST("ZEM1coll"))->Fill(zdcread.amplitudeZEM1()); + histos.get(HIST("ZEM2coll"))->Fill(zdcread.amplitudeZEM2()); + histos.fill(HIST("ZNenergy"), sumZN); + histos.fill(HIST("ZPenergy"), sumZP); + histos.fill(HIST("ZNCenergy"), commonSumZnc); + histos.fill(HIST("ZNAenergy"), commonSumZna); + histos.fill(HIST("ZPAenergy"), commonSumZpa); + histos.fill(HIST("ZPCenergy"), commonSumZpc); + histos.fill(HIST("hZNvsFT0Ccent"), cent, sumZN); + histos.fill(HIST("hZPvsFT0Ccent"), cent, sumZP); + histos.fill(HIST("hZNvsFT0CAmp"), ft0cAmp, sumZN); + histos.fill(HIST("hZPvsFT0CAmp"), ft0cAmp, sumZP); + histos.fill(HIST("hZNvsMult"), nTot, sumZN); + histos.fill(HIST("hZPvsMult"), nTot, sumZP); + histos.fill(HIST("hNchvsNPV"), collision.multNTracksPVeta1(), nTot); + + float ratioZN = sumZNC / sumZNA; + float ratioZP = sumZPC / sumZPA; + pZNratiovscent->Fill(cent, ratioZN); + pZPratiovscent->Fill(cent, ratioZP); + pZNvsFT0Ccent->Fill(cent, sumZN); + pZPvsFT0Ccent->Fill(cent, sumZP); + histos.get(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC); } void processCorrelation(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) @@ -779,7 +730,6 @@ struct FlowZdcTask { PROCESS_SWITCH(FlowZdcTask, processZdcCollAssoc, "Processing ZDC w. collision association", true); PROCESS_SWITCH(FlowZdcTask, processQA, "Process QA", true); - PROCESS_SWITCH(FlowZdcTask, processQVector, "Process before recentering", true); PROCESS_SWITCH(FlowZdcTask, processCorrelation, "Process correlations", true); }; // end of struct function From 7ba64f63897987e898d0b42425999c5955036814 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 15 Jun 2025 10:43:27 +0200 Subject: [PATCH 079/116] [Common] Change index column identifier (#11622) --- Common/DataModel/Multiplicity.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 864e2a9cd1c..0ac2a0074c6 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -8,6 +8,11 @@ // 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 Multiplicity.h +/// \brief multiplicity tables +/// \author ALICE + #ifndef COMMON_DATAMODEL_MULTIPLICITY_H_ #define COMMON_DATAMODEL_MULTIPLICITY_H_ @@ -184,14 +189,9 @@ DECLARE_SOA_TABLE_VERSIONED(MultMCExtras_001, "AOD", "MULTMCEXTRA", 1, //! Table mult::IsInelGt1, o2::soa::Marker<1>); -DECLARE_SOA_TABLE(MultHepMCHIs, "AOD", "MULTHEPMCHI", //! complementary table for heavy-ion mc info (subset of HepMCHeavyIons) - o2::soa::Index<>, hepmcheavyion::McCollisionId, hepmcheavyion::NcollHard, hepmcheavyion::NpartProj, hepmcheavyion::NpartTarg, - hepmcheavyion::Ncoll, hepmcheavyion::ImpactParameter); - using MultMCExtras = MultMCExtras_001; using MultMCExtra = MultMCExtras::iterator; using MultsExtraMC = MultMCExtras; // for backwards compatibility with previous naming scheme -using MultHepMCHI = MultHepMCHIs::iterator; // crosslinks namespace mult @@ -202,6 +202,12 @@ DECLARE_SOA_INDEX_COLUMN(MultMCExtra, multMCExtra); DECLARE_SOA_TABLE(Mult2MCExtras, "AOD", "Mult2MCEXTRA", //! Relate reco mult entry to MC extras entry o2::soa::Index<>, mult::MultMCExtraId); +DECLARE_SOA_TABLE(MultHepMCHIs, "AOD", "MULTHEPMCHI", //! complementary table for heavy-ion mc info (subset of HepMCHeavyIons) + o2::soa::Index<>, mult::MultMCExtraId, hepmcheavyion::NcollHard, hepmcheavyion::NpartProj, hepmcheavyion::NpartTarg, + hepmcheavyion::Ncoll, hepmcheavyion::ImpactParameter); + +using MultHepMCHI = MultHepMCHIs::iterator; + namespace multZeq { DECLARE_SOA_COLUMN(MultZeqFV0A, multZeqFV0A, float); //! Multiplicity equalized for the vertex position with the FV0A detector From 1e539435884fccaa13a52317093d3012549d7a69 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Sun, 15 Jun 2025 10:45:20 +0200 Subject: [PATCH 080/116] [PWGLF,Trigger] Omegamult: added toi mask (#11619) --- EventFiltering/Zorro.h | 8 ++++- PWGLF/DataModel/LFNonPromptCascadeTables.h | 13 ++++--- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 38 ++++++++++++++------ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index c818e45ce48..16da5d578ca 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -9,7 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// Zero Obstacles Results Retriever for Offline trigger selections + +/// +/// \file Zorro.h +/// \brief Zero Obstacles Results Retriever for Offline trigger selections +/// \author M Puccio +/// #ifndef EVENTFILTERING_ZORRO_H_ #define EVENTFILTERING_ZORRO_H_ @@ -54,6 +59,7 @@ class Zorro std::vector getTOIcounters() const { return mTOIcounts; } std::vector getTriggerOfInterestResults(uint64_t bcGlobalId, uint64_t tolerance = 100); std::vector getTriggerOfInterestResults() const; + int getNTOIs() const { return mTOIs.size(); } void setCCDBpath(std::string path) { mBaseCCDBPath = path; } void setBaseCCDBPath(std::string path) { mBaseCCDBPath = path; } diff --git a/PWGLF/DataModel/LFNonPromptCascadeTables.h b/PWGLF/DataModel/LFNonPromptCascadeTables.h index 177167d5997..a4e15df33ef 100644 --- a/PWGLF/DataModel/LFNonPromptCascadeTables.h +++ b/PWGLF/DataModel/LFNonPromptCascadeTables.h @@ -119,6 +119,7 @@ DECLARE_SOA_COLUMN(MultFT0M, multFT0M, float); DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); +DECLARE_SOA_COLUMN(ToiMask, toiMask, uint32_t); } // namespace NPCascadeTable DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", @@ -183,7 +184,8 @@ DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE", NPCascadeTable::MultFT0M, NPCascadeTable::CentFT0C, NPCascadeTable::CentFT0A, - NPCascadeTable::CentFT0M) + NPCascadeTable::CentFT0M, + NPCascadeTable::ToiMask) DECLARE_SOA_TABLE(NPCascTableNT, "AOD", "NPCASCTABLENT", NPCascadeTable::MatchingChi2, @@ -247,7 +249,8 @@ DECLARE_SOA_TABLE(NPCascTableNT, "AOD", "NPCASCTABLENT", NPCascadeTable::MultFT0M, NPCascadeTable::CentFT0C, NPCascadeTable::CentFT0A, - NPCascadeTable::CentFT0M) + NPCascadeTable::CentFT0M, + NPCascadeTable::ToiMask) DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::MatchingChi2, @@ -330,7 +333,8 @@ DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::DCAzMC, NPCascadeTable::MCcollisionMatch, NPCascadeTable::HasFakeReassociation, - NPCascadeTable::MotherDecayDaughters) + NPCascadeTable::MotherDecayDaughters, + NPCascadeTable::ToiMask) DECLARE_SOA_TABLE(NPCascTableMCNT, "AOD", "NPCASCTABLEMCNT", NPCascadeTable::MatchingChi2, @@ -413,7 +417,8 @@ DECLARE_SOA_TABLE(NPCascTableMCNT, "AOD", "NPCASCTABLEMCNT", NPCascadeTable::DCAzMC, NPCascadeTable::MCcollisionMatch, NPCascadeTable::HasFakeReassociation, - NPCascadeTable::MotherDecayDaughters) + NPCascadeTable::MotherDecayDaughters, + NPCascadeTable::ToiMask) DECLARE_SOA_TABLE(NPCascTableGen, "AOD", "NPCASCTABLEGen", NPCascadeTable::gPt, diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index c5388c034a2..bb2960e745b 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -125,6 +125,7 @@ struct NPCascCandidate { float centFT0C; float centFT0A; float centFT0M; + uint32_t toiMask; }; std::array isFromHF(auto& particle) { @@ -287,7 +288,7 @@ struct NonPromptCascadeTask { return true; } - void zorroAccounting(const auto& collisions) + void zorroAccounting(const auto& collisions, auto& toiMap) { if (cfgSkimmedProcessing) { int runNumber{-1}; @@ -295,15 +296,26 @@ struct NonPromptCascadeTask { auto bc = coll.template bc_as(); if (runNumber != bc.runNumber()) { mZorro.initCCDB(mCCDB.service, bc.runNumber(), bc.timestamp(), cfgTriggersOfInterest.value); + if (mZorro.getNTOIs() > 32) { + LOG(fatal) << "N TOIs:" << mZorro.getNTOIs() << " Max 32 TOIs possible."; + } mZorro.populateHistRegistry(mRegistry, bc.runNumber()); runNumber = bc.runNumber(); } - mZorro.isSelected(bc.globalBC()); /// Just let Zorro do the accounting + bool sel = mZorro.isSelected(bc.globalBC()); /// Just let Zorro do the accounting + if (sel) { + std::vector toivect = mZorro.getTriggerOfInterestResults(); + uint32_t toiMask = 0; + for (size_t i{0}; i < toivect.size(); i++) { + toiMask += toivect[i] << i; + } + toiMap[bc.globalBC()] = toiMask; + } } } } template - void fillCandidatesVector(CollisionType const&, TrackType const& tracks, auto const& cascades, auto& candidates) + void fillCandidatesVector(CollisionType const&, TrackType const& tracks, auto const& cascades, auto& candidates, std::map toiMap = {}) { const auto& getCascade = [](auto const& candidate) { @@ -507,6 +519,10 @@ struct NonPromptCascadeTask { } else { o2::base::Propagator::Instance()->propagateToDCA(primaryVertex, ntCascadeTrack, mBz, 2.f, matCorr, &motherDCA); } + uint32_t toiMask = 0x0; + if (toiMap.count(bc.globalBC())) { + toiMask = toiMap[bc.globalBC()]; + } candidates.emplace_back(NPCascCandidate{mcParticleID, trackedCascGlobalIndex, itsTrackGlobalIndex, candidate.collisionId(), matchingChi2, deltaPtITSCascade, deltaPtCascade, cascITSclsSize, hasReassociatedClusters, hasFakeReassociation, isGoodMatch, isGoodCascade, pdgCodeMom, itsTrackPDG, fromHF[0], fromHF[1], collision.numContrib(), cascPVContribs, collision.collisionTimeRes(), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), cascadeLvector.pt(), cascadeLvector.eta(), cascadeLvector.phi(), @@ -517,7 +533,7 @@ struct NonPromptCascadeTask { cascITSclusters, protonTrack.itsNCls(), pionTrack.itsNCls(), bachelor.itsNCls(), protonTrack.tpcNClsFound(), pionTrack.tpcNClsFound(), bachelor.tpcNClsFound(), protonTrack.tpcNSigmaPr(), pionTrack.tpcNSigmaPi(), bachelor.tpcNSigmaKa(), bachelor.tpcNSigmaPi(), protonTrack.hasTOF(), pionTrack.hasTOF(), bachelor.hasTOF(), - protonTrack.tofNSigmaPr(), pionTrack.tofNSigmaPi(), bachelor.tofNSigmaKa(), bachelor.tofNSigmaPi(), collision.sel8(), collision.multFT0C(), collision.multFT0A(), collision.multFT0M(), collision.centFT0C(), collision.centFT0A(), collision.centFT0M()}); + protonTrack.tofNSigmaPr(), pionTrack.tofNSigmaPi(), bachelor.tofNSigmaKa(), bachelor.tofNSigmaPi(), collision.sel8(), collision.multFT0C(), collision.multFT0A(), collision.multFT0M(), collision.centFT0C(), collision.centFT0A(), collision.centFT0M(), toiMask}); } } @@ -537,7 +553,7 @@ struct NonPromptCascadeTask { c.protonTPCNSigma, c.pionTPCNSigma, c.bachKaonTPCNSigma, c.bachPionTPCNSigma, c.protonHasTOF, c.pionHasTOF, c.bachHasTOF, c.protonTOFNSigma, c.pionTOFNSigma, c.bachKaonTOFNSigma, c.bachPionTOFNSigma, - c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M); + c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M, c.toiMask); } } @@ -576,7 +592,7 @@ struct NonPromptCascadeTask { c.sel8, c.multFT0C, c.multFT0A, c.multFT0M, c.centFT0C, c.centFT0A, c.centFT0M, particle.pt(), particle.eta(), particle.phi(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), particle.pdgCode(), mcCollision.posX() - particle.vx(), mcCollision.posY() - particle.vy(), - mcCollision.posZ() - particle.vz(), mcCollision.globalIndex() == recCollision.mcCollisionId(), c.hasFakeReassociation, motherDecayDaughters); + mcCollision.posZ() - particle.vz(), mcCollision.globalIndex() == recCollision.mcCollisionId(), c.hasFakeReassociation, motherDecayDaughters, c.toiMask); } } @@ -653,8 +669,9 @@ struct NonPromptCascadeTask { aod::V0s const& /*v0s*/, TracksExtData const& tracks, aod::BCsWithTimestamps const&) { - zorroAccounting(collisions); - fillCandidatesVector(collisions, tracks, trackedCascades, gCandidates); + std::map toiMap; + zorroAccounting(collisions, toiMap); + fillCandidatesVector(collisions, tracks, trackedCascades, gCandidates, toiMap); fillDataTable(gCandidates); } PROCESS_SWITCH(NonPromptCascadeTask, processTrackedCascadesData, "process cascades from strangeness tracking: Data analysis", false); @@ -663,8 +680,9 @@ struct NonPromptCascadeTask { aod::V0s const& /*v0s*/, TracksExtData const& tracks, aod::BCsWithTimestamps const&) { - zorroAccounting(collisions); - fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT); + std::map toiMap; + zorroAccounting(collisions, toiMap); + fillCandidatesVector(collisions, tracks, cascades, gCandidatesNT, toiMap); fillDataTable(gCandidatesNT); } PROCESS_SWITCH(NonPromptCascadeTask, processCascadesData, "process cascades: Data analysis", false); From d2584ac35e03f651dc4ff24625c03aa834ab81fd Mon Sep 17 00:00:00 2001 From: mherzer <96999709+mherzer28@users.noreply.github.com> Date: Sun, 15 Jun 2025 14:22:04 +0200 Subject: [PATCH 081/116] [PWGLF] add tof flag, detector map and cfg for its cluster size cut (#11623) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx | 65 ++++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx index f00fc314870..40378ba6df4 100644 --- a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx @@ -61,6 +61,8 @@ DECLARE_SOA_COLUMN(TTpcChi2NCl, tTpcChi2NCl, float); DECLARE_SOA_COLUMN(TItsChi2NCl, tItsChi2NCl, float); DECLARE_SOA_COLUMN(TRigidity, tRigidity, float); DECLARE_SOA_COLUMN(TItsClusterSize, tItsClusterSize, float); +DECLARE_SOA_COLUMN(THasTof, tHasTof, bool); +DECLARE_SOA_COLUMN(TDetectorMap, tDetectorMap, int8_t); } // namespace h3_data DECLARE_SOA_TABLE(H3Data, "AOD", "h3_data", h3_data::TPt, h3_data::TEta, h3_data::TPhi, h3_data::TCharge, h3_data::TH3DeDx, @@ -69,7 +71,7 @@ DECLARE_SOA_TABLE(H3Data, "AOD", "h3_data", h3_data::TPt, h3_data::TEta, h3_data::TSigmaZ, h3_data::TnTpcCluster, h3_data::TnItsCluster, h3_data::TTpcChi2NCl, h3_data::TItsChi2NCl, h3_data::TRigidity, - h3_data::TItsClusterSize); + h3_data::TItsClusterSize, h3_data::THasTof, h3_data::TDetectorMap); namespace he_data { DECLARE_SOA_COLUMN(TPt, tPt, float); @@ -91,6 +93,8 @@ DECLARE_SOA_COLUMN(TTpcChi2NCl, tTpcChi2NCl, float); DECLARE_SOA_COLUMN(TItsChi2NCl, tItsChi2NCl, float); DECLARE_SOA_COLUMN(TRigidity, tRigidity, float); DECLARE_SOA_COLUMN(TItsClusterSize, tItsClusterSize, float); +DECLARE_SOA_COLUMN(THasTof, tHasTof, bool); +DECLARE_SOA_COLUMN(TDetectorMap, tDetectorMap, int8_t); } // namespace he_data DECLARE_SOA_TABLE(HeData, "AOD", "he_data", he_data::TPt, he_data::TEta, he_data::TPhi, he_data::TCharge, he_data::THeDeDx, @@ -99,7 +103,7 @@ DECLARE_SOA_TABLE(HeData, "AOD", "he_data", he_data::TPt, he_data::TEta, he_data::TSigmaZ, he_data::TnTpcCluster, he_data::TnItsCluster, he_data::TTpcChi2NCl, he_data::TItsChi2NCl, he_data::TRigidity, - he_data::TItsClusterSize); + he_data::TItsClusterSize, he_data::THasTof, he_data::TDetectorMap); } // namespace o2::aod namespace { @@ -189,6 +193,7 @@ 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"}; // 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"}; @@ -387,10 +392,12 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 7); continue; } - if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeH3 || - getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeH3) { - histos.fill(HIST("histogram/cuts"), 12); - continue; + if (cfgEnableItsClusterSizeCut) { + if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeHe || + getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeHe) { + histos.fill(HIST("histogram/cuts"), 12); + continue; + } } if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { histos.fill(HIST("histogram/cuts"), 13); @@ -421,10 +428,12 @@ struct TrHeAnalysis { float tRigidity = getRigidity(track); float tItsClusterSize = getMeanItsClsSize(track) / std::cosh(track.eta()); + bool tHasTof = track.hasTOF(); + int8_t tDetectorMap = track.detectorMap(); h3Data(tPt, tEta, tPhi, tCharge, tH3DeDx, tnSigmaTpc, tTofSignalH3, tDcaXY, tDcaZ, tSigmaYX, tSigmaXYZ, tSigmaZ, tnTpcCluster, tnItsCluster, tTpcChi2NCl, tItsChi2NCl, tRigidity, - tItsClusterSize); + tItsClusterSize, tHasTof, tDetectorMap); } } if (enableHe && heRapCut) { @@ -438,10 +447,12 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 7); continue; } - if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeHe || - getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeHe) { - histos.fill(HIST("histogram/cuts"), 12); - continue; + if (cfgEnableItsClusterSizeCut) { + if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeHe || + getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeHe) { + histos.fill(HIST("histogram/cuts"), 12); + continue; + } } histos.fill(HIST("histogram/He/He-TPCsignVsTPCmomentum"), getRigidity(track) * track.sign(), @@ -468,10 +479,12 @@ struct TrHeAnalysis { float tRigidity = getRigidity(track); float tItsClusterSize = getMeanItsClsSize(track) / std::cosh(track.eta()); + bool tHasTof = track.hasTOF(); + int8_t tDetectorMap = track.detectorMap(); heData(tPt, tEta, tPhi, tCharge, tHeDeDx, tnSigmaTpc, tTofSignalHe, tDcaXY, tDcaZ, tSigmaYX, tSigmaXYZ, tSigmaZ, tnTpcCluster, tnItsCluster, tTpcChi2NCl, tItsChi2NCl, tRigidity, - tItsClusterSize); + tItsClusterSize, tHasTof, tDetectorMap); } } } @@ -542,10 +555,12 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 7); continue; } - if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeH3 || - getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeH3) { - histos.fill(HIST("histogram/cuts"), 12); - continue; + if (cfgEnableItsClusterSizeCut) { + if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeH3 || + getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeH3) { + histos.fill(HIST("histogram/cuts"), 12); + continue; + } } if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { histos.fill(HIST("histogram/cuts"), 13); @@ -576,10 +591,12 @@ struct TrHeAnalysis { float tRigidity = getRigidity(track); float tItsClusterSize = getMeanItsClsSize(track) / std::cosh(track.eta()); + bool tHasTof = track.hasTOF(); + int8_t tDetectorMap = track.detectorMap(); h3Data(tPt, tEta, tPhi, tCharge, tH3DeDx, tnSigmaTpc, tTofSignalH3, tDcaXY, tDcaZ, tSigmaYX, tSigmaXYZ, tSigmaZ, tnTpcCluster, tnItsCluster, tTpcChi2NCl, tItsChi2NCl, tRigidity, - tItsClusterSize); + tItsClusterSize, tHasTof, tDetectorMap); } } if (enableHe && heRapCut) { @@ -592,10 +609,12 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 7); continue; } - if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeHe || - getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeHe) { - histos.fill(HIST("histogram/cuts"), 12); - continue; + if (cfgEnableItsClusterSizeCut) { + if (getMeanItsClsSize(track) / std::cosh(track.eta()) <= cfgCutMinItsClusterSizeHe || + getMeanItsClsSize(track) / std::cosh(track.eta()) >= cfgCutMaxItsClusterSizeHe) { + histos.fill(HIST("histogram/cuts"), 12); + continue; + } } histos.fill(HIST("histogram/He/He-TPCsignVsTPCmomentum"), getRigidity(track) * track.sign(), @@ -622,10 +641,12 @@ struct TrHeAnalysis { float tRigidity = getRigidity(track); float tItsClusterSize = getMeanItsClsSize(track) / std::cosh(track.eta()); + bool tHasTof = track.hasTOF(); + int8_t tDetectorMap = track.detectorMap(); heData(tPt, tEta, tPhi, tCharge, tHeDeDx, tnSigmaTpc, tTofSignalHe, tDcaXY, tDcaZ, tSigmaYX, tSigmaXYZ, tSigmaZ, tnTpcCluster, tnItsCluster, tTpcChi2NCl, tItsChi2NCl, tRigidity, - tItsClusterSize); + tItsClusterSize, tHasTof, tDetectorMap); } } } From 86764b3040f78648821c813f7deb8735896d0836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sun, 15 Jun 2025 20:22:55 +0200 Subject: [PATCH 082/116] [Infrastructure] Configure naming conventions in clang-tidy (#11616) --- .clang-tidy | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index da768906bcc..490b82a880b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,23 @@ CheckOptions: - - key: CheckPathRegex - value: '.*/O2/.*' + - { key: CheckPathRegex, value: ".*/O2/.*" } + # Naming conventions + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.ClassMemberPrefix, value: m } + - { key: readability-identifier-naming.ConceptCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprVariableIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix. + - { key: readability-identifier-naming.EnumCase, value: CamelCase } + - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase } + - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: "^k[A-Z].*$" } # Allow "k" prefix. + - { key: readability-identifier-naming.FunctionCase, value: camelBack } + - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } + - { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: "^[A-Z]+(_[A-Z]+)*_$" } # Allow the trailing underscore in header guards. + - { key: readability-identifier-naming.MemberCase, value: camelBack } + - { key: readability-identifier-naming.NamespaceCase, value: lower_case } + - { key: readability-identifier-naming.ParameterCase, value: camelBack } + - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase } + - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase } + - { key: readability-identifier-naming.TypedefCase, value: CamelCase } + - { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase } + - { key: readability-identifier-naming.VariableCase, value: camelBack } From 64f092eed6629278f7036c9bf0770b8963e770e0 Mon Sep 17 00:00:00 2001 From: Anisa Khatun Date: Sun, 15 Jun 2025 20:52:38 +0200 Subject: [PATCH 083/116] [PWGUD] Fixing partition issue in udQC tasks (#11626) Co-authored-by: akhatun --- PWGUD/AQC/udQC.cxx | 4 +++- PWGUD/AQC/udQCmidRap.cxx | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/PWGUD/AQC/udQC.cxx b/PWGUD/AQC/udQC.cxx index ddaf01338df..3da67d1f683 100644 --- a/PWGUD/AQC/udQC.cxx +++ b/PWGUD/AQC/udQC.cxx @@ -69,6 +69,8 @@ struct UDQC { using ATs = aod::AmbiguousTracks; using AFTs = aod::AmbiguousFwdTracks; + Partition goodTracks = requireGlobalTrackInFilter(); + void init(InitContext& context) { // initialize global variables @@ -220,7 +222,7 @@ struct UDQC { // vertex tracks normally gives PV contributors from collisions registry.get(HIST("collisions/vtxTracks"))->Fill(collision.numContrib()); // global tracks - Partition goodTracks = requireGlobalTrackInFilter(); + // Partition goodTracks = requireGlobalTrackInFilter(); goodTracks.bindTable(tracks); registry.get(HIST("collisions/globalTracks"))->Fill(goodTracks.size()); diff --git a/PWGUD/AQC/udQCmidRap.cxx b/PWGUD/AQC/udQCmidRap.cxx index e7178cfa042..acb35f21f57 100644 --- a/PWGUD/AQC/udQCmidRap.cxx +++ b/PWGUD/AQC/udQCmidRap.cxx @@ -64,6 +64,8 @@ struct UDQCmid { using ATs = aod::AmbiguousTracks; using AFTs = aod::AmbiguousFwdTracks; + Partition goodTracks = requireGlobalTrackInFilter(); + void init(InitContext& context) { // initialize global variables @@ -132,7 +134,7 @@ struct UDQCmid { } } - // ............................................................................................................................................... + //............................................................................................................................................... void processMain(CC const& collision, BCs const& bct0s, TCs const& tracks, FWs const& fwdtracks, ATs const& /*ambtracks*/, AFTs const& /*ambfwdtracks*/, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, @@ -150,7 +152,7 @@ struct UDQCmid { // vertex tracks normally gives PV contributors from collisions registry.get(HIST("collisions/vtxTracks"))->Fill(collision.numContrib()); // global tracks - Partition goodTracks = requireGlobalTrackInFilter(); + goodTracks.bindTable(tracks); registry.get(HIST("collisions/globalTracks"))->Fill(goodTracks.size()); @@ -223,7 +225,7 @@ struct UDQCmid { registry.get(HIST("DG/hMassAll"))->Fill(ivm.M()); } } // coll - } // dgcand + } // dgcand // loop over all tracks float rgtrwTOF = 0.; @@ -322,7 +324,7 @@ struct UDQCmid { if (track.hasTOF()) { registry.get(HIST("DG/dEdxTOF"))->Fill(track.p() / track.sign(), track.beta()); } // fill TOF - } // pv contributor + } // pv contributor } } // Inavariant mass after FIT @@ -489,7 +491,7 @@ struct UDQCmid { // update #PV contributors in collisions with empty FT0 && FV0&& FDCC registry.get(HIST("fpPVC2"))->Fill(collision.numContrib(), 1.); } // fdd - } // fvo + } // fvo } // ft0 } From 5dd26ffca941d1f10b279118a3403f069b7778f9 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Sun, 15 Jun 2025 22:06:58 +0200 Subject: [PATCH 084/116] [Infrastructure] Update LF Codeowners (#11624) Co-authored-by: Francesco Mazzaschi --- CODEOWNERS | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 3891598e0e8..6116f8c8a5b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -41,13 +41,14 @@ /PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy @gluparel # PWG-LF /PWGLF @alibuild @sustripathy @skundu692 -/PWGLF/Tasks/GlobalEventProperties @alibuild @sustripathy @skundu692 @gbencedi @abmodak @omvazque +/PWGLF/DataModel @alibuild @sustripathy @skundu692 @gbencedi @abmodak @fmazzasc @maciacco @dmallick2 @smaff92 @ercolessi @romainschotter +/PWGLF/Tasks/GlobalEventProperties @alibuild @sustripathy @skundu692 @gbencedi @abmodak @omvazque /PWGLF/TableProducer/GlobalEventProperties @alibuild @sustripathy @skundu692 @gbencedi @abmodak @omvazque -/PWGLF/Tasks/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @chiarapinto @maciacco -/PWGLF/TableProducer/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @chiarapinto @maciacco -/PWGLF/Tasks/Resonances @alibuild @sustripathy @skundu692 @dmallick2 @smaff92 +/PWGLF/Tasks/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @maciacco +/PWGLF/TableProducer/Nuspex @alibuild @sustripathy @skundu692 @fmazzasc @maciacco +/PWGLF/Tasks/Resonances @alibuild @sustripathy @skundu692 @dmallick2 @smaff92 /PWGLF/TableProducer/Resonances @alibuild @sustripathy @skundu692 @dmallick2 @smaff92 -/PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter +/PWGLF/Tasks/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter /PWGLF/TableProducer/Strangeness @alibuild @sustripathy @skundu692 @ercolessi @romainschotter # PWG-MM From e56dbdc1e657bd522581b7b91f4d78e389b54065 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 13:00:32 +0200 Subject: [PATCH 085/116] add upc selection into HF framework --- PWGHF/Tasks/taskPidStudies.cxx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index ad3943a7134..5729729eed5 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -197,6 +197,7 @@ struct HfTaskPidStudies { using CollisionsMc = soa::Join; using V0sMcRec = soa::Join; using CascsMcRec = soa::Join; + using BCs = soa::Join; ctpRateFetcher rateFetcher; HfEventSelection hfEvSel; @@ -336,17 +337,17 @@ struct HfTaskPidStudies { return Particle::NotMatched; } - template - bool isCollSelected(const Coll& coll) + template + bool isCollSelected(const Coll& coll, const BCs& bcs) { - auto bc = coll.template bc_as(); + auto bc = coll.template bc_as(); interactionRate = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), ctpFetcherSource.value) * 1.e-3; // convert to kHz if (interactionRate < interactionRateMin || interactionRate > interactionRateMax) { return false; } float cent{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; @@ -503,10 +504,10 @@ struct HfTaskPidStudies { aod::V0MCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const& /*tracks*/, - aod::BCsWithTimestamps const&) + BCs const& bcs) { for (const auto& v0 : V0s) { - if (applyEvSels && !isCollSelected(v0.collision_as())) { + if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { continue; } if (applyTrackSels && !isTrackSelected(v0)) { @@ -524,11 +525,11 @@ struct HfTaskPidStudies { void processV0Data(aod::V0Datas const& V0s, PidTracks const&, - aod::BCsWithTimestamps const&, + BCs const& bcs, CollSels const&) { for (const auto& v0 : V0s) { - if (applyEvSels && !isCollSelected(v0.collision_as())) { + if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { continue; } if (applyTrackSels && !isTrackSelected(v0)) { @@ -546,10 +547,10 @@ struct HfTaskPidStudies { aod::CascMCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const&, - aod::BCsWithTimestamps const&) + BCs const& bcs) { for (const auto& casc : cascades) { - if (applyEvSels && !isCollSelected(casc.collision_as())) { + if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { continue; } if (applyTrackSels && !isTrackSelected(casc)) { @@ -567,11 +568,11 @@ struct HfTaskPidStudies { void processCascData(aod::CascDatas const& cascades, PidTracks const&, - aod::BCsWithTimestamps const&, + BCs const& bcs, CollSels const&) { for (const auto& casc : cascades) { - if (applyEvSels && !isCollSelected(casc.collision_as())) { + if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { continue; } if (applyTrackSels && !isTrackSelected(casc)) { From db06a01ab6f4b8acc19d90c7a35051656c257ef9 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 13:04:10 +0200 Subject: [PATCH 086/116] add upc selection into HF framework --- .../dataCreatorCharmHadPiReduced.cxx | 95 ++++++++++--------- .../dataCreatorCharmResoReduced.cxx | 93 +++++++++--------- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 82 +++++++++------- PWGHF/D2H/Utils/utilsRedDataFormat.h | 4 +- PWGHF/HFC/TableProducer/CMakeLists.txt | 2 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 35 ++++--- PWGHF/TableProducer/CMakeLists.txt | 14 +-- .../TableProducer/candidateCreator2Prong.cxx | 53 ++++++----- .../TableProducer/candidateCreator3Prong.cxx | 54 +++++------ .../TableProducer/candidateCreatorCascade.cxx | 27 +++--- PWGHF/TableProducer/candidateCreatorDstar.cxx | 43 +++++---- .../candidateCreatorXic0Omegac0.cxx | 69 +++++++------- .../candidateCreatorXicToXiPiPi.cxx | 37 ++++---- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 28 ++++-- PWGHF/Tasks/CMakeLists.txt | 4 +- PWGHF/Tasks/taskMcValidation.cxx | 35 +++---- PWGHF/Utils/utilsEvSelHf.h | 73 ++++++++++++-- 18 files changed, 418 insertions(+), 332 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index fde8c3b553e..443709bd98a 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -195,6 +195,7 @@ struct HfDataCreatorCharmHadPiReduced { using CollisionsWCent = soa::Join; using CollisionsWCentAndMcLabels = soa::Join; using CollisionsWCentAndQvectors = soa::Join; + using BCs = soa::Join; Filter filterSelectDplusCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= hfflagConfigurations.selectionFlagDplus); Filter filterSelectDsCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi >= hfflagConfigurations.selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= hfflagConfigurations.selectionFlagDs); @@ -899,7 +900,7 @@ struct HfDataCreatorCharmHadPiReduced { TTracks const&, PParticles const& particlesMc, uint64_t const& indexCollisionMaxNumContrib, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -913,7 +914,7 @@ struct HfDataCreatorCharmHadPiReduced { // Set the magnetic field from ccdb. // The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, // but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); @@ -1258,7 +1259,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), @@ -1466,7 +1467,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1480,7 +1481,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1496,7 +1497,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1510,7 +1511,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1526,7 +1527,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1540,7 +1541,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1556,7 +1557,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1570,7 +1571,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1586,7 +1587,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1600,7 +1601,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1616,7 +1617,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1630,7 +1631,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1646,7 +1647,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1660,7 +1661,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1676,7 +1677,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1690,7 +1691,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1706,7 +1707,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1720,7 +1721,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1736,7 +1737,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1750,7 +1751,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1766,7 +1767,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1780,7 +1781,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1796,7 +1797,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1810,7 +1811,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1826,7 +1827,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1840,7 +1841,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -1856,7 +1857,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1870,7 +1871,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); @@ -1890,7 +1891,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1905,7 +1906,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1925,7 +1926,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1940,7 +1941,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1960,7 +1961,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -1975,7 +1976,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1995,7 +1996,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -2010,7 +2011,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -2030,7 +2031,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2045,7 +2046,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -2065,7 +2066,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2080,7 +2081,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -2100,7 +2101,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2115,7 +2116,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -2135,7 +2136,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, + BCs const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2150,7 +2151,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index a424d95d95b..4097e31653c 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -244,6 +244,7 @@ struct HfDataCreatorCharmResoReduced { using TracksWithPID = soa::Join; using TracksIUWithPID = soa::Join; using TracksIUWithPIDAndMC = soa::Join; + using BCs = soa::Join; Filter filterSelectDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= cfgDmesCuts.selectionFlagDplus); Filter filterSelectedCandDstar = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == cfgDmesCuts.selectionFlagDstarToD0Pi); @@ -811,7 +812,7 @@ struct HfDataCreatorCharmResoReduced { Tr const& tracks, TrIU const&, PParticles const& particlesMc, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -1307,7 +1308,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function @@ -1453,7 +1454,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1461,7 +1462,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1476,7 +1477,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1484,7 +1485,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); @@ -1502,7 +1503,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1510,7 +1511,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1527,7 +1528,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1535,7 +1536,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1550,7 +1551,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1558,7 +1559,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); @@ -1576,7 +1577,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1584,7 +1585,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1601,7 +1602,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1609,7 +1610,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1624,7 +1625,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1632,7 +1633,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); @@ -1650,7 +1651,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1658,7 +1659,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1677,7 +1678,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1685,7 +1686,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1703,7 +1704,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1711,7 +1712,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1732,7 +1733,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1740,7 +1741,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1755,7 +1756,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1763,7 +1764,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); @@ -1781,7 +1782,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1789,7 +1790,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1806,7 +1807,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1814,7 +1815,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1829,7 +1830,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1837,7 +1838,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1855,7 +1856,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1863,7 +1864,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1880,7 +1881,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1888,7 +1889,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1903,7 +1904,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1911,7 +1912,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1929,7 +1930,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1937,7 +1938,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1956,7 +1957,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1964,7 +1965,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1982,7 +1983,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1990,7 +1991,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 53b22dfe969..539b7599750 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 03e475bc7ed..10f6a061e6c 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -96,6 +96,7 @@ struct HfTaskFlowCharmHadrons { using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; + using BCs = soa::Join; Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; @@ -418,11 +419,11 @@ struct HfTaskFlowCharmHadrons { /// \return true if the collision is selected, false otherwise template bool isCollSelected(CollsWithQvecs::iterator const& collision, - aod::BCsWithTimestamps const&, + BCs const& bcs, float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -482,9 +483,10 @@ struct HfTaskFlowCharmHadrons { /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param candidates are the selected candidates - template + template void runFlowAnalysis(CollsWithQvecs::iterator const& collision, - T1 const& candidates) + T1 const& candidates, + BCs const& bcs) { float cent = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (cent < centralityMin || cent > centralityMax) { @@ -495,7 +497,7 @@ struct HfTaskFlowCharmHadrons { if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, bcs); } std::vector qVecs = getQvec(collision); @@ -639,105 +641,115 @@ struct HfTaskFlowCharmHadrons { // Ds with ML void processDsMl(CollsWithQvecs::iterator const& collision, - CandDsDataWMl const&) + CandDsDataWMl const&, + BCs const& bcs) { auto candsDsToKKPiWMl = selectedDsToKKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKKWMl = selectedDsToPiKKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsDsToKKPiWMl); - runFlowAnalysis(collision, candsDsToPiKKWMl); + runFlowAnalysis(collision, candsDsToKKPiWMl, bcs); + runFlowAnalysis(collision, candsDsToPiKKWMl, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDsMl, "Process Ds candidates with ML", false); // Ds with rectangular cuts void processDs(CollsWithQvecs::iterator const& collision, - CandDsData const&) + CandDsData const&, + BCs const& bcs) { auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsDsToKKPi); - runFlowAnalysis(collision, candsDsToPiKK); + runFlowAnalysis(collision, candsDsToKKPi, bcs); + runFlowAnalysis(collision, candsDsToPiKK, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDs, "Process Ds candidates", false); // Dplus with ML void processDplusMl(CollsWithQvecs::iterator const& collision, - CandDplusDataWMl const& candidatesDplus) + CandDplusDataWMl const& candidatesDplus, + BCs const& bcs) { - runFlowAnalysis(collision, candidatesDplus); + runFlowAnalysis(collision, candidatesDplus, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDplusMl, "Process Dplus candidates with ML", false); // Dplus with rectangular cuts void processDplus(CollsWithQvecs::iterator const& collision, - CandDplusData const& candidatesDplus) + CandDplusData const& candidatesDplus, + BCs const& bcs) { - runFlowAnalysis(collision, candidatesDplus); + runFlowAnalysis(collision, candidatesDplus, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDplus, "Process Dplus candidates", true); // D0 with ML void processD0Ml(CollsWithQvecs::iterator const& collision, - CandD0DataWMl const&) + CandD0DataWMl const&, + BCs const& bcs) { auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsD0ToPiKWMl); - runFlowAnalysis(collision, candsD0ToKPiWMl); + runFlowAnalysis(collision, candsD0ToPiKWMl, bcs); + runFlowAnalysis(collision, candsD0ToKPiWMl, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processD0Ml, "Process D0 candidates with ML", false); // D0 with rectangular cuts void processD0(CollsWithQvecs::iterator const& collision, - CandD0Data const&) + CandD0Data const&, + BCs const& bcs) { auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsD0ToPiK); - runFlowAnalysis(collision, candsD0ToKPi); + runFlowAnalysis(collision, candsD0ToPiK, bcs); + runFlowAnalysis(collision, candsD0ToKPi, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processD0, "Process D0 candidates", false); // Lc with ML void processLcMl(CollsWithQvecs::iterator const& collision, - CandLcDataWMl const&) + CandLcDataWMl const&, + BCs const& bcs) { auto candsLcToPKPiWMl = selectedLcToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKPWMl = selectedLcToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsLcToPKPiWMl); - runFlowAnalysis(collision, candsLcToPiKPWMl); + runFlowAnalysis(collision, candsLcToPKPiWMl, bcs); + runFlowAnalysis(collision, candsLcToPiKPWMl, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLcMl, "Process Lc candidates with ML", false); // Lc with rectangular cuts void processLc(CollsWithQvecs::iterator const& collision, - CandLcData const&) + CandLcData const&, + BCs const& bcs) { auto candsLcToPKPi = selectedLcToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKP = selectedLcToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsLcToPKPi); - runFlowAnalysis(collision, candsLcToPiKP); + runFlowAnalysis(collision, candsLcToPKPi, bcs); + runFlowAnalysis(collision, candsLcToPiKP, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLc, "Process Lc candidates", false); // Xic with ML void processXicMl(CollsWithQvecs::iterator const& collision, - CandXicDataWMl const&) + CandXicDataWMl const&, + BCs const& bcs) { auto candsXicToPKPiWMl = selectedXicToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKPWMl = selectedXicToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXicToPKPiWMl); - runFlowAnalysis(collision, candsXicToPiKPWMl); + runFlowAnalysis(collision, candsXicToPKPiWMl, bcs); + runFlowAnalysis(collision, candsXicToPiKPWMl, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXicMl, "Process Xic candidates with ML", false); // Xic with rectangular cuts void processXic(CollsWithQvecs::iterator const& collision, - CandXicData const&) + CandXicData const&, + BCs const& bcs) { auto candsXicToPKPi = selectedXicToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKP = selectedXicToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXicToPKPi); - runFlowAnalysis(collision, candsXicToPiKP); + runFlowAnalysis(collision, candsXicToPKPi, bcs); + runFlowAnalysis(collision, candsXicToPiKP, bcs); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic, "Process Xic candidates", false); @@ -761,7 +773,7 @@ struct HfTaskFlowCharmHadrons { // Resolution void processResolution(CollsWithQvecs::iterator const& collision, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { float centrality{-1.f}; float xQVecFT0a = collision.qvecFT0ARe(); @@ -784,7 +796,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 513f2a998fc..a18d2dd85a7 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -34,10 +34,10 @@ namespace o2::hf_evsel /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria template -void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) +void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, BCs const& bcs) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index 99f2c4fb152..ececa170cae 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -71,5 +71,5 @@ o2physics_add_dpl_workflow(correlator-lc-sc-hadrons o2physics_add_dpl_workflow(femto-dream-producer SOURCES femtoDreamProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore O2Physics::SGCutParHolder COMPONENT_NAME Analysis) diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index ee8ec8aaa26..ed2d55376e1 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -159,9 +159,8 @@ struct HfFemtoDreamProducer { using FemtoHFTrack = FemtoHFTracks::iterator; using FemtoHFMcTracks = soa::Join; using FemtoHFMcTrack = FemtoHFMcTracks::iterator; - using GeneratedMc = soa::Filtered>; - + using BCs = soa::Join; Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -236,7 +235,7 @@ struct HfFemtoDreamProducer { } /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T - void getMagneticFieldTesla(aod::BCsWithTimestamps::iterator bc) + void getMagneticFieldTesla(BCs::iterator bc) { initCCDB(bc, runNumber, ccdb, !isRun3 ? ccdbPathGrp : ccdbPathGrpMag, lut, !isRun3); } @@ -390,8 +389,8 @@ struct HfFemtoDreamProducer { return fIsTrackFilled; } - template - void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates) + template + void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates, BCs const& bcs) { const auto vtxZ = col.posZ(); const auto sizeCand = candidates.size(); @@ -410,7 +409,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, bcs); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); @@ -573,57 +572,57 @@ struct HfFemtoDreamProducer { } void processDataCharmHad(FemtoFullCollision const& col, - aod::BCsWithTimestamps const&, + BCs const& bcs, FemtoHFTracks const& tracks, soa::Filtered const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates, bcs); } PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHad, "Provide experimental data for charm hadron femto", false); void processDataCharmHadWithML(FemtoFullCollision const& col, - aod::BCsWithTimestamps const&, + BCs const& bcs, FemtoHFTracks const& tracks, soa::Filtered> const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates, bcs); } PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHadWithML, "Provide experimental data for charm hadron femto with ml", false); void processMcCharmHad(FemtoFullCollisionMc const& col, - aod::BCsWithTimestamps const&, + BCs const& bcs, FemtoHFMcTracks const& tracks, aod::McParticles const&, CandidateLcMc const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates, bcs); } PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHad, "Provide Mc for charm hadron", false); void processMcCharmHadWithML(FemtoFullCollisionMc const& col, - aod::BCsWithTimestamps const&, + BCs const& bcs, FemtoHFMcTracks const& tracks, aod::McParticles const&, soa::Join const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates, bcs); } PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHadWithML, "Provide Mc for charm hadron with ml", false); diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 2ec33b5d134..ee119699809 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -13,7 +13,7 @@ o2physics_add_dpl_workflow(track-index-skim-creator SOURCES trackIndexSkimCreator.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2::DCAFitter O2Physics::AnalysisCCDB O2Physics::MLCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2::DCAFitter O2Physics::AnalysisCCDB O2Physics::MLCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) # Helpers @@ -37,12 +37,12 @@ o2physics_add_dpl_workflow(mc-pid-tof o2physics_add_dpl_workflow(candidate-creator-2prong SOURCES candidateCreator2Prong.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-3prong SOURCES candidateCreator3Prong.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-b0 @@ -62,12 +62,12 @@ o2physics_add_dpl_workflow(candidate-creator-bs o2physics_add_dpl_workflow(candidate-creator-cascade SOURCES candidateCreatorCascade.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-dstar SOURCES candidateCreatorDstar.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-lb @@ -87,12 +87,12 @@ o2physics_add_dpl_workflow(candidate-creator-sigmac0plusplus-cascade o2physics_add_dpl_workflow(candidate-creator-xic0-omegac0 SOURCES candidateCreatorXic0Omegac0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xic-to-xi-pi-pi SOURCES candidateCreatorXicToXiPiPi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xicc diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index d551922b7d5..afb9ce7edf0 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -95,6 +95,7 @@ struct HfCandidateCreator2Prong { Service ccdb; using TracksWCovExtraPidPiKa = soa::Join; + using BCs = soa::Join; int runNumber{0}; float toMicrometers = 10000.; // from cm to µm @@ -182,11 +183,11 @@ struct HfCandidateCreator2Prong { setLabelHistoCands(hCandidates); } - template + template void runCreator2ProngWithDCAFitterN(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { // loop over pairs of track indices for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -194,7 +195,7 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -208,7 +209,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -330,11 +331,11 @@ struct HfCandidateCreator2Prong { } } - template + template void runCreator2ProngWithKFParticle(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -342,7 +343,7 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -354,7 +355,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -492,7 +493,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -502,7 +503,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -512,7 +513,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -522,7 +523,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -538,7 +539,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -548,7 +549,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -558,7 +559,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -568,7 +569,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -584,7 +585,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -594,7 +595,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -604,7 +605,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -614,7 +615,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -627,7 +628,7 @@ struct HfCandidateCreator2Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -635,7 +636,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -645,7 +646,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -653,7 +654,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -663,7 +664,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -671,7 +672,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 145e84513db..bc30edb188e 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -126,7 +126,7 @@ struct HfCandidateCreator3Prong { using FilteredHf3Prongs = soa::Filtered; using FilteredPvRefitHf3Prongs = soa::Filtered>; using TracksWCovExtraPidPiKaPr = soa::Join; - + using BCs = soa::Join; // filter candidates Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi))) != static_cast(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi))) != static_cast(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast(0)); @@ -235,11 +235,11 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { @@ -247,7 +247,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -263,7 +263,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -403,17 +403,17 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -426,7 +426,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -651,7 +651,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -661,7 +661,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -671,7 +671,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -681,7 +681,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -697,7 +697,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -707,7 +707,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -717,7 +717,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -727,7 +727,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -743,7 +743,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -753,7 +753,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -763,7 +763,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -773,7 +773,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -786,7 +786,7 @@ struct HfCandidateCreator3Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -794,7 +794,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -804,7 +804,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -812,7 +812,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -822,7 +822,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -830,7 +830,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 04faa873da7..c22545bdbaf 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -72,6 +72,9 @@ struct HfCandidateCreatorCascade { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; + using BCs = soa::Join; + + HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter Service ccdb; @@ -156,7 +159,7 @@ struct HfCandidateCreatorCascade { V0full const&, V0fCfull const&, aod::TracksWCov const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { // loop over pairs of track indices @@ -165,7 +168,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -251,7 +254,7 @@ struct HfCandidateCreatorCascade { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); @@ -350,7 +353,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -363,7 +366,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -376,7 +379,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -389,14 +392,14 @@ struct HfCandidateCreatorCascade { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -406,14 +409,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -423,14 +426,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index f25a09dbbb3..98edf3dfa8f 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -95,6 +95,7 @@ struct HfCandidateCreatorDstar { double massPi, massK, massD0; using TracksWCovExtraPidPiKa = soa::Join; + using BCs = soa::Join; AxisSpec ptAxis = {100, 0., 2.0, "#it{p}_{T} (GeV/#it{c}"}; AxisSpec dcaAxis = {200, -500., 500., "#it{d}_{xy,z} (#mum)"}; @@ -186,12 +187,12 @@ struct HfCandidateCreatorDstar { /// @param rowsTrackIndexD0 D0 table object from trackIndexSkimCreator.cxx /// @param tracks track table with Cov object /// @param bcWithTimeStamps Bunch Crossing with timestamps - template + template void runCreatorDstar(Coll const&, CandsDstar const& rowsTrackIndexDstar, aod::Hf2Prongs const&, TracksWCovExtraPidPiKa const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCs const& bcs) { // LOG(info) << "runCreatorDstar function called"; // LOG(info) << "candidate loop starts"; @@ -201,7 +202,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -391,9 +392,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefit, " Run candidate creator with PV refit and w/o centrality selections", false); @@ -402,9 +403,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefit, " Run candidate creator without PV refit and w/o centrality selections", true); @@ -419,9 +420,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0C, " Run candidate creator with PV refit nad w/ centrality selection on FT0C", false); @@ -430,9 +431,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefitCentFT0C, " Run candidate creator without PV refit and w centrality selection on FT0C", false); @@ -447,9 +448,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0M, " Run candidate creator with PV refit nad w/ centrality selection on FT0M", false); @@ -458,9 +459,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + BCs const& bcs) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefitCentFT0M, " Run candidate creator without PV refit and w/ centrality selection on FT0M", false); @@ -471,14 +472,14 @@ struct HfCandidateCreatorDstar { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -488,14 +489,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -505,14 +506,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 754272af541..e1eae6ff469 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -142,6 +142,7 @@ struct HfCandidateCreatorXic0Omegac0 { using MyKfTracks = soa::Join; using MyKfCascTable = soa::Join; using KFCascadesLinked = soa::Join; + using BCs = soa::Join; std::shared_ptr hInvMassCharmBaryonToXiPi, hInvMassCharmBaryonToOmegaPi, hInvMassCharmBaryonToOmegaK, hFitterStatusToXiPi, hFitterStatusToOmegaPi, hFitterStatusToOmegaK, hCandidateCounterToXiPi, hCandidateCounterToOmegaPi, hCandidateCounterToOmegaK, hCascadesCounterToXiPi, hCascadesCounterToOmegaPi, hCascadesCounterToOmegaK; @@ -369,9 +370,9 @@ struct HfCandidateCreatorXic0Omegac0 { runNumber = 0; } - template + template void runXic0Omegac0Creator(Coll const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, + BCs const& bcs, MyLFTracksWCov const& lfTracks, TracksWCovDca const& tracks, TCascTable const&, TCascLinkTable const&, @@ -408,14 +409,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -726,9 +727,9 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function - template + template void runKfOmegac0CreatorWithKFParticle(Coll const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, + BCs const& bcs, MyKfTracks const&, MyKfCascTable const&, KFCascadesLinked const&, aod::HfCascLf2Prongs const& candidates, @@ -742,14 +743,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -1203,9 +1204,9 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function //========================================================== - template + template void runKfXic0CreatorWithKFParticle(Coll const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, + BCs const& bcs, MyKfTracks const&, MyKfCascTable const&, KFCascadesLinked const&, aod::HfCascLf2Prongs const& candidates, @@ -1220,14 +1221,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -1657,7 +1658,7 @@ struct HfCandidateCreatorXic0Omegac0 { } /// @brief process function w/o centrality selections void processNoCentToXiPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1669,7 +1670,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPi, "Run candidate creator w/o centrality selections for xi pi decay channel", true); void processNoCentToXiPiTraCasc(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyTraCascTable const& traCascades, @@ -1681,7 +1682,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPiTraCasc, "Run candidate creator w/o centrality selections for xi pi decay channel with tracked cascades", false); void processNoCentToOmegaPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1693,7 +1694,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToOmegaPi, "Run candidate creator w/o centrality selections for omega pi decay channel", false); void processNoCentOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1704,7 +1705,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processNoCentXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1715,7 +1716,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentXicToXiPiWithKFParticle, "Run candidate creator w/o centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processNoCentToOmegaK(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1728,7 +1729,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0C centrality selections void processCentFT0CToXiPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1740,7 +1741,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToXiPi, "Run candidate creator w/ centrality selection on FT0C for xi pi channel", false); void processCentFT0CToOmegaPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1752,7 +1753,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToOmegaPi, "Run candidate creator w/ centrality selection on FT0C for omega pi channel", false); void processCentFT0COmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1763,7 +1764,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0COmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0CXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1774,7 +1775,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CXicToXiPiWithKFParticle, "Run candidate creator w FT0C centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0CToOmegaK(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1787,7 +1788,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0M centrality selections void processCentFT0MToXiPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1799,7 +1800,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToXiPi, "Run candidate creator w/ centrality selection on FT0M for xi pi channel", false); void processCentFT0MToOmegaPi(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1811,7 +1812,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToOmegaPi, "Run candidate creator w/ centrality selection on FT0M for omega pi channel", false); void processCentFT0MOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1822,7 +1823,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0MXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1833,7 +1834,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MXicToXiPiWithKFParticle, "Run candidate creator w FT0M centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0MToOmegaK(soa::Join const& collisions, - aod::BCsWithTimestamps const& bcWithTimeStamps, + BCs const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1851,14 +1852,14 @@ struct HfCandidateCreatorXic0Omegac0 { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1868,14 +1869,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1885,14 +1886,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 69fea11d5c9..92a6c81b211 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -116,6 +116,7 @@ struct HfCandidateCreatorXicToXiPiPi { using KFCascFull = soa::Join; using TracksWCovDcaPidPrPi = soa::Join; using TracksWCovExtraPidPrPi = soa::Join; + using BCs = soa::Join; HistogramRegistry registry{"registry"}; @@ -182,7 +183,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const&, CascFull const&, TracksWCovDcaPidPrPi const&, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -193,7 +194,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -227,7 +228,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb--------------------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -423,7 +424,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const&, KFCascFull const&, TracksWCovExtraPidPrPi const&, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -434,7 +435,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -468,7 +469,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb----------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -727,7 +728,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -738,7 +739,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -749,7 +750,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -766,7 +767,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -777,7 +778,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -788,7 +789,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCsWithTimestamps const& bcs) + BCs const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -800,7 +801,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// /// /////////////////////////////////////////////////////////// - void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const&) + void processCollisions(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -808,7 +809,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -817,7 +818,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisions, "Collision monitoring - no centrality", false); - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const&) + void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -825,7 +826,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -834,7 +835,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const&) + void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -842,7 +843,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 0f98525ceb1..21b1911e33e 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -102,13 +102,14 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { Configurable triggerClassName{"triggerClassName", "kINT7", "Run 2 trigger class, only for Run 2 converted data"}; HfEventSelection hfEvSel; // event selection and monitoring Service ccdb; // needed for evSelection + using BCs = soa::Join; // QA histos HistogramRegistry registry{"registry"}; void init(InitContext const&) { - std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel}; + std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function for collision selection can be enabled at a time!"); } @@ -133,10 +134,10 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with template - void selectCollision(const Col& collision, const BCs&) + void selectCollision(const Col& collision, const BCs& bcs) { float centrality = -1.; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (fillHistograms) { hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -155,46 +156,55 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { } /// Event selection with trigger and FT0A centrality selection - void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, BCs const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0ASel, "Use trigger and centrality selection with FT0A", false); /// Event selection with trigger and FT0C centrality selection - void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, BCs const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0CSel, "Use trigger and centrality selection with FT0C", false); /// Event selection with trigger and FT0M centrality selection - void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, BCs const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0MSel, "Use trigger and centrality selection with FT0M", false); /// Event selection with trigger and FV0A centrality selection - void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, BCs const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFV0ASel, "Use trigger and centrality selection with FV0A", false); /// Event selection with trigger selection - void processTrigSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigSel(soa::Join::iterator const& collision, BCs const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigSel, "Use trigger selection", false); /// Event selection without trigger selection - void processNoTrigSel(aod::Collision const& collision, aod::BCsWithTimestamps const& bcs) + void processNoTrigSel(aod::Collision const& collision, BCs const& bcs) { + LOGF(info, " in processNoTrigSel xxxxxxxxxxxxxxxx"); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); + + /// Event selection with UPC + void processUpcSel(soa::Join::iterator const& collision, BCs const& bcs, aod::FT0s& /*ft0s*/, aod::FV0As& /*fv0as*/, aod::FDDs& /*fdds*/, aod::Zdcs& /*zdcs*/) + { + selectCollision(collision, bcs); + } + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processUpcSel, "Use upc selection", false); }; /// Track selection diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index b212b705b23..bacdd693e73 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -36,7 +36,7 @@ o2physics_add_dpl_workflow(task-mc-gen-pt-rap-shapes o2physics_add_dpl_workflow(task-mc-validation SOURCES taskMcValidation.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation @@ -46,7 +46,7 @@ o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation o2physics_add_dpl_workflow(task-pid-studies SOURCES taskPidStudies.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB O2Physics::SGCutParHolder COMPONENT_NAME Analysis) # o2physics_add_dpl_workflow(task-sel-optimisation diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 269cd7b21ea..de74c52ba9f 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -625,6 +625,7 @@ struct HfTaskMcValidationRec { using CollisionsWithMCLabelsAndCentFT0C = soa::Join; using CollisionsWithMCLabelsAndCentFT0M = soa::Join; using TracksWithSel = soa::Join; + using BCsInfo = soa::Join; Partition tracksFilteredGlobalTrackWoDCA = requireGlobalTrackWoDCAInFilter(); Partition tracksInAcc = requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks); @@ -807,10 +808,10 @@ struct HfTaskMcValidationRec { ccdb->setLocalObjectValidityChecking(); } - template + template void checkCollisions(Coll const& collision, aod::McCollisions const&, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // apply event selection if (!collision.has_mcCollision()) { @@ -818,7 +819,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -836,19 +837,19 @@ struct HfTaskMcValidationRec { registry.fill(HIST("histDeltaZvtx"), collision.numContrib(), collision.posZ() - mcCollision.posZ()); } - template + template void checkCollisionAssociation(Colls const& collisions, TracksWithSel const&, aod::McParticles const& mcParticles, aod::McCollisions const&, - aod::BCsWithTimestamps const&) + BCs const& bcs) { // loop over collisions for (const auto& collision : collisions) { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -981,7 +982,7 @@ struct HfTaskMcValidationRec { void processColl(CollisionsWithMCLabels::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -989,7 +990,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOC(CollisionsWithMCLabelsAndCentFT0C::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -997,7 +998,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOM(CollisionsWithMCLabelsAndCentFT0M::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -1007,7 +1008,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1017,7 +1018,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1027,19 +1028,19 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs) + BCsInfo const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskMcValidationRec, processCollAssocWithCentFTOM, "Process collision-association information with centrality selection with FT0M, requires extra table from TrackToCollisionAssociation task (fillTableOfCollIdsPerTrack=true)", false); - template + template void processEff(HfCand2ProngWithMCRec const& cand2Prongs, HfCand3ProngWithMCRec const& cand3Prongs, aod::TracksWMc const&, aod::McParticles const& mcParticles, aod::McCollisions const&, - aod::BCsWithTimestamps const&, + BCs const& bcs, Coll const& collisions, Preslice cand2ProngsPerCollision, Preslice cand3ProngsPerCollision) @@ -1049,7 +1050,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } @@ -1155,7 +1156,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs, + BCsInfo const& bcs, CollisionsWithMCLabels const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); @@ -1167,7 +1168,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCsWithTimestamps const& bcs, + BCsInfo const& bcs, CollisionsWithMCLabelsAndCentFT0C const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 5d57ffb5eff..a31fbb433f8 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -41,6 +41,7 @@ #include "EventFiltering/ZorroSummary.h" #include "PWGHF/Core/CentralityEstimation.h" +#include "PWGUD/Core/SGSelector.h" namespace o2::hf_occupancy { @@ -108,10 +109,20 @@ enum EventRejection { NoCollInTimeRangeNarrow, NoCollInTimeRangeStandard, NoCollInRofStandard, + UpcEventCut, NEventRejection }; +// upc event type +enum UPCEvent { + SingleGapA = 0, + SingleGapC = 1, + DoubleGap = 2, + NUPCEventRejection +}; + o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; +o2::framework::AxisSpec axisUPCEvents = {UPCEvent::NUPCEventRejection, -0.5f, +UPCEvent::NUPCEventRejection - 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram @@ -137,6 +148,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeNarrow + 1, "No coll timerange narrow"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeStandard + 1, "No coll timerange strict"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInRofStandard + 1, "No coll in ROF std"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event selection"); } struct HfEventSelection : o2::framework::ConfigurableGroup { @@ -145,6 +157,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; o2::framework::Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; + o2::framework::Configurable useUpcTrigger{"useUpcTrigger", true, "Apply the upc event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; o2::framework::Configurable useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"}; o2::framework::Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "Apply TF border cut"}; @@ -172,6 +185,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"}; o2::framework::Configurable rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"}; + // SG selector + SGSelector sgSelector; + SGCutParHolder sgCuts = SGCutParHolder(); + // histogram names static constexpr char NameHistCollisions[] = "hCollisions"; static constexpr char NameHistSelCollisionsCent[] = "hSelCollisionsCent"; @@ -181,8 +198,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistPosYAfterEvSel[] = "hPosYAfterEvSel"; static constexpr char NameHistNumPvContributorsAfterSel[] = "hNumPvContributorsAfterSel"; static constexpr char NameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; + static constexpr char NameHistUPC[] = "hUPCollisions"; - std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel; + std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; // util to retrieve the RCT info from CCDB @@ -193,6 +211,23 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::OutputObj zorroSummary{"zorroSummary"}; int currentRun{-1}; + /// Set standard preselection gap trigger (values taken from UD group) + void setSGCutsFromUD(SGCutParHolder& sgCuts) + { + sgCuts.SetNDtcoll(1); // Number of sigma + sgCuts.SetMinNBCs(2); // Minimum number of BCs + sgCuts.SetNTracks(2, 1000); // Min and max number of PV contributors + sgCuts.SetMaxFITtime(34.f); // Max FIT time in ns + + sgCuts.SetFITAmpLimits({ + -1.f, // FV0 + 150.f, // FT0A + 50.f, // FT0C + -1.f, // FDDA + -1.f // FDDC + }); + } + /// \brief Adds collision monitoring histograms in the histogram registry. /// \param registry reference to the histogram registry void addHistograms(o2::framework::HistogramRegistry& registry) @@ -205,7 +240,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hPosYAfterEvSel = registry.add(NameHistPosYAfterEvSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{200, -0.5, 0.5}}}); hNumPvContributorsAfterSel = registry.add(NameHistNumPvContributorsAfterSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{500, -0.5, 499.5}}}); setEventRejectionLabels(hCollisions, softwareTrigger); - + hUPCollisions = registry.add(NameHistUPC, "HF upc counter;;# of upc events", {o2::framework::HistType::kTH1D, {axisUPCEvents}}); const o2::framework::AxisSpec th2AxisCent{th2ConfigAxisCent, "Centrality"}; const o2::framework::AxisSpec th2AxisOccupancy{th2ConfigAxisOccupancy, "Occupancy"}; hCollisionsCentOcc = registry.add(NameHistCollisionsCentOcc, "selected events;Centrality; Occupancy", {o2::framework::HistType::kTH2D, {th2AxisCent, th2AxisOccupancy}}); @@ -238,10 +273,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision template - uint16_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCs& bcs) { - uint16_t rejectionMask{0}; // 16 bits, in case new ev. selections will be added - + uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (centrality < centralityMin || centrality > centralityMax) { @@ -297,6 +331,26 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SETBIT(rejectionMask, EventRejection::Occupancy); } } + + /// upc selection + if (useUpcTrigger) { + setSGCutsFromUD(sgCuts); + auto bc = collision.template foundBC_as(); + auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); + auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + int issgevent = isSGEvent.value; + if (issgevent > 2) { + SETBIT(rejectionMask, EventRejection::UpcEventCut); + } else { + if (issgevent == UPCEvent::SingleGapA) { + hUPCollisions->Fill(UPCEvent::SingleGapA); + } else if (issgevent == UPCEvent::SingleGapC) { + hUPCollisions->Fill(UPCEvent::SingleGapC); + } else if (issgevent == UPCEvent::DoubleGap) { + hUPCollisions->Fill(UPCEvent::DoubleGap); + } + } + } } /// number of PV contributors @@ -345,7 +399,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision template - void fillHistograms(Coll const& collision, const uint16_t rejectionMask, float& centrality, float occupancy = -1) + void fillHistograms(Coll const& collision, const uint32_t rejectionMask, float& centrality, float occupancy = -1) { hCollisions->Fill(EventRejection::None); const float posZ = collision.posZ(); @@ -355,6 +409,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { if (TESTBIT(rejectionMask, reason)) { return; } + hCollisions->Fill(reason); } @@ -464,9 +519,9 @@ struct HfEventSelectionMc { /// \param centrality centrality variable to be set in this function /// \return a bitmask with the event selections not satisfied by the analysed collision template - uint16_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision, CCs const& collSlice, float& centrality) + uint32_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision, CCs const& collSlice, float& centrality) { - uint16_t rejectionMask{0}; + uint32_t rejectionMask{0}; float zPv = mcCollision.posZ(); auto bc = mcCollision.template bc_as(); @@ -515,7 +570,7 @@ struct HfEventSelectionMc { /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision template - void fillHistograms(Coll const& mcCollision, const uint16_t rejectionMask, int nSplitColl = 0) + void fillHistograms(Coll const& mcCollision, const uint32_t rejectionMask, int nSplitColl = 0) { hParticles->Fill(EventRejection::None); From 200a17304209f6314905fc8b3b4090f72c3ee2be Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 13:46:40 +0200 Subject: [PATCH 087/116] fix magic number warning --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 2 +- PWGHF/Utils/utilsEvSelHf.h | 36 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 21b1911e33e..92209894196 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -200,7 +200,7 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); /// Event selection with UPC - void processUpcSel(soa::Join::iterator const& collision, BCs const& bcs, aod::FT0s& /*ft0s*/, aod::FV0As& /*fv0as*/, aod::FDDs& /*fdds*/, aod::Zdcs& /*zdcs*/) + void processUpcSel(soa::Join::iterator const& collision, BCs const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) { selectCollision(collision, bcs); } diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index a31fbb433f8..a26e7db7acf 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -200,6 +200,18 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; static constexpr char NameHistUPC[] = "hUPCollisions"; + // upc preselection + constexpr int MinNdtcoll = 1; // Default number of sigma (NDtcoll) + constexpr int MinNBCs = 2; // Minimum number of bunch crossings (NBCs) + constexpr int MinNTracks = 2; // Minimum number of PV contributors + constexpr int MaxNTracks = 1000; // Maximum number of PV contributors + constexpr float MaxFITtime = 34.f; // Maximum FIT time in ns + constexpr float FITAmpFV0 = -1.f; // FV0 amplitude + constexpr float FITAmpFT0A = 150.f; // Max FT0A amplitude + constexpr float FITAmpFT0C = 50.f; // Max FT0C amplitude + constexpr float FITAmpFDDA = -1.f; // FDDA amplitude + constexpr float FITAmpFDDC = -1.f; // FDDC amplitude + std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; @@ -214,18 +226,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// Set standard preselection gap trigger (values taken from UD group) void setSGCutsFromUD(SGCutParHolder& sgCuts) { - sgCuts.SetNDtcoll(1); // Number of sigma - sgCuts.SetMinNBCs(2); // Minimum number of BCs - sgCuts.SetNTracks(2, 1000); // Min and max number of PV contributors - sgCuts.SetMaxFITtime(34.f); // Max FIT time in ns - - sgCuts.SetFITAmpLimits({ - -1.f, // FV0 - 150.f, // FT0A - 50.f, // FT0C - -1.f, // FDDA - -1.f // FDDC - }); + sgCuts.SetNDtcoll(MinNdtcoll); + sgCuts.SetMinNBCs(MinNBCs); + sgCuts.SetNTracks(MinNTracks, MaxNTracks); + sgCuts.SetMaxFITtime(MaxFITtime); + + sgCuts.SetFITAmpLimits({FITAmpFV0, + FITAmpFT0A, + FITAmpFT0C, + FITAmpFDDA, + FITAmpFDDC}); } /// \brief Adds collision monitoring histograms in the histogram registry. @@ -339,7 +349,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); int issgevent = isSGEvent.value; - if (issgevent > 2) { + if (issgevent > UPCEvent::DoubleGap) { SETBIT(rejectionMask, EventRejection::UpcEventCut); } else { if (issgevent == UPCEvent::SingleGapA) { From bb6e9275abcbee619550a28209545c4d4501f898 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 13:52:26 +0200 Subject: [PATCH 088/116] fix magic number warning --- PWGHF/Utils/utilsEvSelHf.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index a26e7db7acf..cbb041ee99e 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -201,16 +201,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistUPC[] = "hUPCollisions"; // upc preselection - constexpr int MinNdtcoll = 1; // Default number of sigma (NDtcoll) - constexpr int MinNBCs = 2; // Minimum number of bunch crossings (NBCs) - constexpr int MinNTracks = 2; // Minimum number of PV contributors - constexpr int MaxNTracks = 1000; // Maximum number of PV contributors - constexpr float MaxFITtime = 34.f; // Maximum FIT time in ns - constexpr float FITAmpFV0 = -1.f; // FV0 amplitude - constexpr float FITAmpFT0A = 150.f; // Max FT0A amplitude - constexpr float FITAmpFT0C = 50.f; // Max FT0C amplitude - constexpr float FITAmpFDDA = -1.f; // FDDA amplitude - constexpr float FITAmpFDDC = -1.f; // FDDC amplitude + static constexpr int MinNdtcoll = 1; // Default number of sigma (NDtcoll) + static constexpr int MinNBCs = 2; // Minimum number of bunch crossings (NBCs) + static constexpr int MinNTracks = 2; // Minimum number of PV contributors + static constexpr int MaxNTracks = 1000; // Maximum number of PV contributors + static constexpr float MaxFITtime = 34.f; // Maximum FIT time in ns + static constexpr float FITAmpFV0 = -1.f; // FV0 amplitude + static constexpr float FITAmpFT0A = 150.f; // Max FT0A amplitude + static constexpr float FITAmpFT0C = 50.f; // Max FT0C amplitude + static constexpr float FITAmpFDDA = -1.f; // FDDA amplitude + static constexpr float FITAmpFDDC = -1.f; // FDDC amplitude std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; From f1355300fcb072e09a14d71df6ebfc7fc4633ced Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 17:59:41 +0200 Subject: [PATCH 089/116] add the missed SGCutParHolder into Cmake file --- PWGHF/D2H/TableProducer/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index a60ab1d78ab..fa67ec17b7a 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -67,12 +67,12 @@ o2physics_add_dpl_workflow(candidate-selector-lb-to-lc-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced SOURCES dataCreatorCharmHadPiReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced From c217c9eb536ad5b94c4841f131e7618869f26b48 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 22:46:27 +0200 Subject: [PATCH 090/116] fix some comments from vit and mattia --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 2 - PWGHF/Utils/utilsEvSelHf.h | 40 +++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 92209894196..7ff184af5eb 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -193,8 +193,6 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Event selection without trigger selection void processNoTrigSel(aod::Collision const& collision, BCs const& bcs) { - LOGF(info, " in processNoTrigSel xxxxxxxxxxxxxxxx"); - selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index cbb041ee99e..87c1da2ec1d 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -114,15 +114,15 @@ enum EventRejection { }; // upc event type -enum UPCEvent { - SingleGapA = 0, - SingleGapC = 1, - DoubleGap = 2, - NUPCEventRejection +enum UPCEventType { + kSingleGapA, + kSingleGapC, + kDoubleGap, + kNEventTypes }; o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; -o2::framework::AxisSpec axisUPCEvents = {UPCEvent::NUPCEventRejection, -0.5f, +UPCEvent::NUPCEventRejection - 0.5f, ""}; +o2::framework::AxisSpec axisUPCEvents = {UPCEvent::kNEventTypes, -0.5f, +UPCEvent::kNEventTypes - 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram @@ -157,7 +157,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; o2::framework::Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; - o2::framework::Configurable useUpcTrigger{"useUpcTrigger", true, "Apply the upc event selection"}; + o2::framework::Configurable useUpcTrigger{"useUpcTrigger", false, "Apply the upc event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; o2::framework::Configurable useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"}; o2::framework::Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "Apply TF border cut"}; @@ -200,17 +200,17 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; static constexpr char NameHistUPC[] = "hUPCollisions"; - // upc preselection - static constexpr int MinNdtcoll = 1; // Default number of sigma (NDtcoll) - static constexpr int MinNBCs = 2; // Minimum number of bunch crossings (NBCs) - static constexpr int MinNTracks = 2; // Minimum number of PV contributors - static constexpr int MaxNTracks = 1000; // Maximum number of PV contributors - static constexpr float MaxFITtime = 34.f; // Maximum FIT time in ns - static constexpr float FITAmpFV0 = -1.f; // FV0 amplitude - static constexpr float FITAmpFT0A = 150.f; // Max FT0A amplitude - static constexpr float FITAmpFT0C = 50.f; // Max FT0C amplitude - static constexpr float FITAmpFDDA = -1.f; // FDDA amplitude - static constexpr float FITAmpFDDC = -1.f; // FDDC amplitude + // UPC preselection + static constexpr int kMinNDtColl{1}; // Miminimum number of bunch crossings around the collision of interest + static constexpr int kMinNBCs{2}; // Minimum number of bunch crossings + static constexpr int kMinNTracks{2}; // Minimum number of PV contributors + static constexpr int kMaxNTracks{1000}; // Maximum number of PV contributors + static constexpr float kMaxFITTimeNs{34.f}; // Maximum FIT time in ns + static constexpr float kFITAmpFV0{-1.f}; // FV0 amplitude threshold + static constexpr float kFITAmpFT0A{150.f}; // Maximum FT0A amplitude + static constexpr float kFITAmpFT0C{50.f}; // Maximum FT0C amplitude + static constexpr float kFITAmpFDDA{-1.f}; // FDDA amplitude threshold + static constexpr float kFITAmpFDDC{-1.f}; // FDDC amplitude threshold std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; @@ -224,7 +224,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { int currentRun{-1}; /// Set standard preselection gap trigger (values taken from UD group) - void setSGCutsFromUD(SGCutParHolder& sgCuts) + void setSGPreselection(SGCutParHolder& sgCuts) { sgCuts.SetNDtcoll(MinNdtcoll); sgCuts.SetMinNBCs(MinNBCs); @@ -344,7 +344,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// upc selection if (useUpcTrigger) { - setSGCutsFromUD(sgCuts); + setSGPreselection(sgCuts); auto bc = collision.template foundBC_as(); auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); From e9f97e241f46a23dd57ee50e87f36558dfaee5a7 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 9 Jun 2025 22:49:41 +0200 Subject: [PATCH 091/116] fix some comments from vit and mattia --- PWGHF/Utils/utilsEvSelHf.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 87c1da2ec1d..084158e9bc8 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -226,16 +226,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// Set standard preselection gap trigger (values taken from UD group) void setSGPreselection(SGCutParHolder& sgCuts) { - sgCuts.SetNDtcoll(MinNdtcoll); - sgCuts.SetMinNBCs(MinNBCs); - sgCuts.SetNTracks(MinNTracks, MaxNTracks); - sgCuts.SetMaxFITtime(MaxFITtime); - - sgCuts.SetFITAmpLimits({FITAmpFV0, - FITAmpFT0A, - FITAmpFT0C, - FITAmpFDDA, - FITAmpFDDC}); + sgCuts.SetNDtcoll(kMinNDtColl); + sgCuts.SetMinNBCs(kMinNBCs); + sgCuts.SetNTracks(kMinNTracks, kMaxNTracks); + sgCuts.SetMaxFITtime(kMaxFITTimeNs); + + sgCuts.SetFITAmpLimits({kFITAmpFV0, + kFITAmpFT0A, + kFITAmpFT0C, + kFITAmpFDDA, + kFITAmpFDDC}); } /// \brief Adds collision monitoring histograms in the histogram registry. From 611620460339bceb28285e790448c8d518ccfef5 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Wed, 11 Jun 2025 11:47:32 +0200 Subject: [PATCH 092/116] fix comments from vit and mattia --- .../dataCreatorCharmHadPiReduced.cxx | 95 +++++++++---------- .../dataCreatorCharmResoReduced.cxx | 93 +++++++++--------- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 29 +++--- .../DataModel/CandidateReconstructionTables.h | 4 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 19 ++-- .../TableProducer/candidateCreator2Prong.cxx | 37 ++++---- .../TableProducer/candidateCreator3Prong.cxx | 52 +++++----- .../TableProducer/candidateCreatorCascade.cxx | 42 ++++---- PWGHF/TableProducer/candidateCreatorDstar.cxx | 40 ++++---- .../candidateCreatorXic0Omegac0.cxx | 84 ++++++++-------- .../candidateCreatorXicToXiPiPi.cxx | 52 +++++----- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 21 ++-- PWGHF/Tasks/taskMcValidation.cxx | 32 +++---- PWGHF/Tasks/taskPidStudies.cxx | 10 +- PWGHF/Utils/utilsEvSelHf.h | 68 ++++++------- 15 files changed, 330 insertions(+), 348 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 443709bd98a..f97f9d8224d 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -195,7 +195,6 @@ struct HfDataCreatorCharmHadPiReduced { using CollisionsWCent = soa::Join; using CollisionsWCentAndMcLabels = soa::Join; using CollisionsWCentAndQvectors = soa::Join; - using BCs = soa::Join; Filter filterSelectDplusCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= hfflagConfigurations.selectionFlagDplus); Filter filterSelectDsCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi >= hfflagConfigurations.selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= hfflagConfigurations.selectionFlagDs); @@ -900,7 +899,7 @@ struct HfDataCreatorCharmHadPiReduced { TTracks const&, PParticles const& particlesMc, uint64_t const& indexCollisionMaxNumContrib, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -914,7 +913,7 @@ struct HfDataCreatorCharmHadPiReduced { // Set the magnetic field from ccdb. // The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, // but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); @@ -1259,7 +1258,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), @@ -1467,7 +1466,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1481,7 +1480,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1497,7 +1496,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1511,7 +1510,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1527,7 +1526,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1541,7 +1540,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1557,7 +1556,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1571,7 +1570,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1587,7 +1586,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1601,7 +1600,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1617,7 +1616,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1631,7 +1630,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1647,7 +1646,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1661,7 +1660,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1677,7 +1676,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1691,7 +1690,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1707,7 +1706,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1721,7 +1720,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1737,7 +1736,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1751,7 +1750,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1767,7 +1766,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1781,7 +1780,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1797,7 +1796,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1811,7 +1810,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1827,7 +1826,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1841,7 +1840,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -1857,7 +1856,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1871,7 +1870,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); @@ -1891,7 +1890,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1906,7 +1905,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1926,7 +1925,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1941,7 +1940,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1961,7 +1960,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -1976,7 +1975,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1996,7 +1995,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -2011,7 +2010,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -2031,7 +2030,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2046,7 +2045,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -2066,7 +2065,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2081,7 +2080,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -2101,7 +2100,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2116,7 +2115,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -2136,7 +2135,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - BCs const& bcs, + aod::BCFullInfos const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2151,7 +2150,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 4097e31653c..cf3371513f7 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -244,7 +244,6 @@ struct HfDataCreatorCharmResoReduced { using TracksWithPID = soa::Join; using TracksIUWithPID = soa::Join; using TracksIUWithPIDAndMC = soa::Join; - using BCs = soa::Join; Filter filterSelectDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= cfgDmesCuts.selectionFlagDplus); Filter filterSelectedCandDstar = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == cfgDmesCuts.selectionFlagDstarToD0Pi); @@ -812,7 +811,7 @@ struct HfDataCreatorCharmResoReduced { Tr const& tracks, TrIU const&, PParticles const& particlesMc, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -1308,7 +1307,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function @@ -1454,7 +1453,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1462,7 +1461,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1477,7 +1476,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1485,7 +1484,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); @@ -1503,7 +1502,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1511,7 +1510,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1528,7 +1527,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1536,7 +1535,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1551,7 +1550,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1559,7 +1558,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); @@ -1577,7 +1576,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1585,7 +1584,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1602,7 +1601,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1610,7 +1609,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1625,7 +1624,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1633,7 +1632,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); @@ -1651,7 +1650,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1659,7 +1658,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1678,7 +1677,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1686,7 +1685,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1704,7 +1703,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1712,7 +1711,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1733,7 +1732,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1741,7 +1740,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1756,7 +1755,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1764,7 +1763,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); @@ -1782,7 +1781,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1790,7 +1789,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1807,7 +1806,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1815,7 +1814,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1830,7 +1829,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1838,7 +1837,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1856,7 +1855,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1864,7 +1863,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1881,7 +1880,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1889,7 +1888,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1904,7 +1903,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1912,7 +1911,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1930,7 +1929,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1938,7 +1937,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1957,7 +1956,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1965,7 +1964,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1983,7 +1982,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - BCs const& bcs) + aod::BCFullInfos const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1991,7 +1990,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 10f6a061e6c..7165889d434 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -96,7 +96,6 @@ struct HfTaskFlowCharmHadrons { using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; - using BCs = soa::Join; Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; @@ -419,11 +418,11 @@ struct HfTaskFlowCharmHadrons { /// \return true if the collision is selected, false otherwise template bool isCollSelected(CollsWithQvecs::iterator const& collision, - BCs const& bcs, + aod::BCFullInfos const& bcs, float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -642,7 +641,7 @@ struct HfTaskFlowCharmHadrons { // Ds with ML void processDsMl(CollsWithQvecs::iterator const& collision, CandDsDataWMl const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsDsToKKPiWMl = selectedDsToKKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKKWMl = selectedDsToPiKKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -654,7 +653,7 @@ struct HfTaskFlowCharmHadrons { // Ds with rectangular cuts void processDs(CollsWithQvecs::iterator const& collision, CandDsData const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -666,7 +665,7 @@ struct HfTaskFlowCharmHadrons { // Dplus with ML void processDplusMl(CollsWithQvecs::iterator const& collision, CandDplusDataWMl const& candidatesDplus, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runFlowAnalysis(collision, candidatesDplus, bcs); } @@ -675,7 +674,7 @@ struct HfTaskFlowCharmHadrons { // Dplus with rectangular cuts void processDplus(CollsWithQvecs::iterator const& collision, CandDplusData const& candidatesDplus, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runFlowAnalysis(collision, candidatesDplus, bcs); } @@ -684,7 +683,7 @@ struct HfTaskFlowCharmHadrons { // D0 with ML void processD0Ml(CollsWithQvecs::iterator const& collision, CandD0DataWMl const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -696,7 +695,7 @@ struct HfTaskFlowCharmHadrons { // D0 with rectangular cuts void processD0(CollsWithQvecs::iterator const& collision, CandD0Data const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -708,7 +707,7 @@ struct HfTaskFlowCharmHadrons { // Lc with ML void processLcMl(CollsWithQvecs::iterator const& collision, CandLcDataWMl const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsLcToPKPiWMl = selectedLcToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKPWMl = selectedLcToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -720,7 +719,7 @@ struct HfTaskFlowCharmHadrons { // Lc with rectangular cuts void processLc(CollsWithQvecs::iterator const& collision, CandLcData const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsLcToPKPi = selectedLcToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKP = selectedLcToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -732,7 +731,7 @@ struct HfTaskFlowCharmHadrons { // Xic with ML void processXicMl(CollsWithQvecs::iterator const& collision, CandXicDataWMl const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsXicToPKPiWMl = selectedXicToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKPWMl = selectedXicToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -744,7 +743,7 @@ struct HfTaskFlowCharmHadrons { // Xic with rectangular cuts void processXic(CollsWithQvecs::iterator const& collision, CandXicData const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { auto candsXicToPKPi = selectedXicToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKP = selectedXicToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); @@ -773,7 +772,7 @@ struct HfTaskFlowCharmHadrons { // Resolution void processResolution(CollsWithQvecs::iterator const& collision, - BCs const& bcs) + aod::BCFullInfos const& bcs) { float centrality{-1.f}; float xQVecFT0a = collision.qvecFT0ARe(); @@ -796,7 +795,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index a32a88e1d12..52d8c2b2d6c 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -40,6 +40,8 @@ namespace o2::aod { // Table aliases +using BCFullInfos = soa::Join; + using TracksWCov = soa::Join; using TracksWDca = soa::Join; using TracksWExtra = soa::Join; @@ -191,7 +193,7 @@ DECLARE_SOA_TABLE(PidTpcTofTinyPr, "AOD", "PIDTPCTOFTINYPR", //! Table of the TP namespace hf_sel_collision { -DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, uint16_t); //! +DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, uint32_t); //! } // namespace hf_sel_collision DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index ed2d55376e1..fa9d0247c96 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -160,7 +160,6 @@ struct HfFemtoDreamProducer { using FemtoHFMcTracks = soa::Join; using FemtoHFMcTrack = FemtoHFMcTracks::iterator; using GeneratedMc = soa::Filtered>; - using BCs = soa::Join; Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -235,7 +234,7 @@ struct HfFemtoDreamProducer { } /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T - void getMagneticFieldTesla(BCs::iterator bc) + void getMagneticFieldTesla(aod::BCFullInfos::iterator bc) { initCCDB(bc, runNumber, ccdb, !isRun3 ? ccdbPathGrp : ccdbPathGrpMag, lut, !isRun3); } @@ -572,12 +571,12 @@ struct HfFemtoDreamProducer { } void processDataCharmHad(FemtoFullCollision const& col, - BCs const& bcs, + aod::BCFullInfos const& bcs, FemtoHFTracks const& tracks, soa::Filtered const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); fillCharmHadronTable(col, tracks, candidates, bcs); } @@ -585,14 +584,14 @@ struct HfFemtoDreamProducer { "Provide experimental data for charm hadron femto", false); void processDataCharmHadWithML(FemtoFullCollision const& col, - BCs const& bcs, + aod::BCFullInfos const& bcs, FemtoHFTracks const& tracks, soa::Filtered> const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); fillCharmHadronTable(col, tracks, candidates, bcs); } @@ -600,27 +599,27 @@ struct HfFemtoDreamProducer { "Provide experimental data for charm hadron femto with ml", false); void processMcCharmHad(FemtoFullCollisionMc const& col, - BCs const& bcs, + aod::BCFullInfos const& bcs, FemtoHFMcTracks const& tracks, aod::McParticles const&, CandidateLcMc const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); fillCharmHadronTable(col, tracks, candidates, bcs); } PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHad, "Provide Mc for charm hadron", false); void processMcCharmHadWithML(FemtoFullCollisionMc const& col, - BCs const& bcs, + aod::BCFullInfos const& bcs, FemtoHFMcTracks const& tracks, aod::McParticles const&, soa::Join const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); fillCharmHadronTable(col, tracks, candidates, bcs); } diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index afb9ce7edf0..46f233d3606 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -95,7 +95,6 @@ struct HfCandidateCreator2Prong { Service ccdb; using TracksWCovExtraPidPiKa = soa::Join; - using BCs = soa::Join; int runNumber{0}; float toMicrometers = 10000.; // from cm to µm @@ -493,7 +492,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -503,7 +502,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -513,7 +512,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -523,7 +522,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -539,7 +538,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -549,7 +548,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -559,7 +558,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -569,7 +568,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -585,7 +584,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -595,7 +594,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -605,7 +604,7 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -615,7 +614,7 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } @@ -628,7 +627,7 @@ struct HfCandidateCreator2Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -636,7 +635,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -646,7 +645,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -654,7 +653,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -664,7 +663,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -672,7 +671,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index bc30edb188e..efdb1111e2a 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -126,7 +126,6 @@ struct HfCandidateCreator3Prong { using FilteredHf3Prongs = soa::Filtered; using FilteredPvRefitHf3Prongs = soa::Filtered>; using TracksWCovExtraPidPiKaPr = soa::Join; - using BCs = soa::Join; // filter candidates Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi))) != static_cast(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi))) != static_cast(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast(0)); @@ -651,7 +650,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -661,7 +660,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -671,7 +670,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -681,7 +680,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -697,7 +696,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -707,7 +706,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -717,7 +716,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -727,7 +726,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -743,7 +742,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -753,7 +752,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -763,7 +762,7 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -773,7 +772,7 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - BCs const& bcWithTimeStamps) + aod::BCFullInfos const& bcWithTimeStamps) { runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -786,7 +785,7 @@ struct HfCandidateCreator3Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -794,7 +793,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -804,7 +803,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -812,7 +811,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -822,7 +821,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -830,7 +829,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -855,7 +854,6 @@ struct HfCandidateCreator3ProngExpressions { HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring - using BCsInfo = soa::Join; using McCollisionsNoCents = soa::Join; using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; @@ -892,7 +890,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - BCsInfo const&) + aod::BCFullInfos const&) { rowCandidateProng3->bindExternalIndices(&tracks); @@ -1091,14 +1089,14 @@ struct HfCandidateCreator3ProngExpressions { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -1116,7 +1114,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -1126,7 +1124,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -1136,7 +1134,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index c22545bdbaf..f59a83504f7 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -72,9 +72,6 @@ struct HfCandidateCreatorCascade { Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - using BCs = soa::Join; - - HfEventSelection hfEvSel; // event selection and monitoring o2::vertexing::DCAFitterN<2> df; // 2-prong vertex fitter Service ccdb; @@ -159,7 +156,7 @@ struct HfCandidateCreatorCascade { V0full const&, V0fCfull const&, aod::TracksWCov const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // loop over pairs of track indices @@ -168,7 +165,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -254,7 +251,7 @@ struct HfCandidateCreatorCascade { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); @@ -353,7 +350,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -366,7 +363,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -379,7 +376,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -392,14 +389,14 @@ struct HfCandidateCreatorCascade { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -409,14 +406,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -426,14 +423,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -455,7 +452,6 @@ struct HfCandidateCreatorCascadeMc { HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring using MyTracksWMc = soa::Join; - using BCsInfo = soa::Join; using McCollisionsNoCents = soa::Join; using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; @@ -491,7 +487,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - BCsInfo const&) + aod::BCFullInfos const&) { // Match reconstructed candidates. rowCandidateCasc->bindExternalIndices(&tracks); @@ -556,14 +552,14 @@ struct HfCandidateCreatorCascadeMc { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -626,7 +622,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -636,7 +632,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -646,7 +642,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 98edf3dfa8f..02b19edb1d7 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -95,7 +95,6 @@ struct HfCandidateCreatorDstar { double massPi, massK, massD0; using TracksWCovExtraPidPiKa = soa::Join; - using BCs = soa::Join; AxisSpec ptAxis = {100, 0., 2.0, "#it{p}_{T} (GeV/#it{c}"}; AxisSpec dcaAxis = {200, -500., 500., "#it{d}_{xy,z} (#mum)"}; @@ -392,7 +391,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -403,7 +402,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -420,7 +419,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -431,7 +430,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -448,7 +447,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -459,7 +458,7 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); } @@ -472,14 +471,14 @@ struct HfCandidateCreatorDstar { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -489,14 +488,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -506,14 +505,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -538,7 +537,6 @@ struct HfCandidateCreatorDstarExpressions { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; - using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -572,7 +570,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - BCsInfo const&) + aod::BCFullInfos const&) { rowsCandidateD0->bindExternalIndices(&tracks); rowsCandidateDstar->bindExternalIndices(&tracks); @@ -719,14 +717,14 @@ struct HfCandidateCreatorDstarExpressions { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -791,7 +789,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -801,7 +799,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -811,7 +809,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - BCsInfo const& BCsInfo) + aod::BCFullInfos const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index e1eae6ff469..bc3d290029e 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -142,7 +142,6 @@ struct HfCandidateCreatorXic0Omegac0 { using MyKfTracks = soa::Join; using MyKfCascTable = soa::Join; using KFCascadesLinked = soa::Join; - using BCs = soa::Join; std::shared_ptr hInvMassCharmBaryonToXiPi, hInvMassCharmBaryonToOmegaPi, hInvMassCharmBaryonToOmegaK, hFitterStatusToXiPi, hFitterStatusToOmegaPi, hFitterStatusToOmegaK, hCandidateCounterToXiPi, hCandidateCounterToOmegaPi, hCandidateCounterToOmegaK, hCascadesCounterToXiPi, hCascadesCounterToOmegaPi, hCascadesCounterToOmegaK; @@ -1658,7 +1657,7 @@ struct HfCandidateCreatorXic0Omegac0 { } /// @brief process function w/o centrality selections void processNoCentToXiPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1670,7 +1669,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPi, "Run candidate creator w/o centrality selections for xi pi decay channel", true); void processNoCentToXiPiTraCasc(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyTraCascTable const& traCascades, @@ -1682,7 +1681,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPiTraCasc, "Run candidate creator w/o centrality selections for xi pi decay channel with tracked cascades", false); void processNoCentToOmegaPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1694,7 +1693,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToOmegaPi, "Run candidate creator w/o centrality selections for omega pi decay channel", false); void processNoCentOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1705,7 +1704,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processNoCentXicToXiPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1716,7 +1715,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentXicToXiPiWithKFParticle, "Run candidate creator w/o centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processNoCentToOmegaK(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1729,7 +1728,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0C centrality selections void processCentFT0CToXiPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1741,7 +1740,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToXiPi, "Run candidate creator w/ centrality selection on FT0C for xi pi channel", false); void processCentFT0CToOmegaPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1753,7 +1752,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToOmegaPi, "Run candidate creator w/ centrality selection on FT0C for omega pi channel", false); void processCentFT0COmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1764,7 +1763,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0COmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0CXicToXiPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1775,7 +1774,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CXicToXiPiWithKFParticle, "Run candidate creator w FT0C centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0CToOmegaK(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1788,7 +1787,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0M centrality selections void processCentFT0MToXiPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1800,7 +1799,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToXiPi, "Run candidate creator w/ centrality selection on FT0M for xi pi channel", false); void processCentFT0MToOmegaPi(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1812,7 +1811,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToOmegaPi, "Run candidate creator w/ centrality selection on FT0M for omega pi channel", false); void processCentFT0MOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1823,7 +1822,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0MXicToXiPiWithKFParticle(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1834,7 +1833,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MXicToXiPiWithKFParticle, "Run candidate creator w FT0M centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0MToOmegaK(soa::Join const& collisions, - BCs const& bcWithTimeStamps, + aod::BCFullInfos const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1852,14 +1851,14 @@ struct HfCandidateCreatorXic0Omegac0 { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1869,14 +1868,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1886,14 +1885,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1924,7 +1923,6 @@ struct HfCandidateCreatorXic0Omegac0Mc { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; - using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -2120,7 +2118,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, Colls const& collsWithMcLabels, McCollisions const& mcCollisions, - BCsInfo const&) + aod::BCFullInfos const&) { float ptCharmBaryonGen = -999.; float rapidityCharmBaryonGen = -999.; @@ -2379,13 +2377,13 @@ struct HfCandidateCreatorXic0Omegac0Mc { uint16_t rejectionMask{0}; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask); if (rejectionMask != 0) { @@ -2608,7 +2606,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { void runXic0Omegac0McQa(TMyRecoCand const& candidates, MyTracksWMc const&, aod::McParticles const& mcParticles, - BCsInfo const&) + aod::BCFullInfos const&) { int indexRec = -1; int8_t sign = -9; @@ -2845,7 +2843,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2856,7 +2854,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2865,7 +2863,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { void processMcXicToXiPiKfQa(aod::HfCandToXiPiKfQa const& candidates, MyTracksWMc const& tracks, aod::McParticles const& mcParticles, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0McQa(candidates, tracks, mcParticles, bcs); } @@ -2876,7 +2874,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2887,7 +2885,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2898,7 +2896,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2909,7 +2907,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2920,7 +2918,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2931,7 +2929,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2942,7 +2940,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2953,7 +2951,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2964,7 +2962,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2975,7 +2973,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2986,7 +2984,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 92a6c81b211..01089539ca6 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -116,7 +116,6 @@ struct HfCandidateCreatorXicToXiPiPi { using KFCascFull = soa::Join; using TracksWCovDcaPidPrPi = soa::Join; using TracksWCovExtraPidPrPi = soa::Join; - using BCs = soa::Join; HistogramRegistry registry{"registry"}; @@ -183,7 +182,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const&, CascFull const&, TracksWCovDcaPidPrPi const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -194,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -228,7 +227,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb--------------------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -424,7 +423,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const&, KFCascFull const&, TracksWCovExtraPidPrPi const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -435,7 +434,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -469,7 +468,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb----------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -728,7 +727,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -739,7 +738,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -750,7 +749,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -767,7 +766,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -778,7 +777,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -789,7 +788,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - BCs const& bcs) + aod::BCFullInfos const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -801,7 +800,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// /// /////////////////////////////////////////////////////////// - void processCollisions(soa::Join const& collisions, BCs const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -809,7 +808,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -818,7 +817,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisions, "Collision monitoring - no centrality", false); - void processCollisionsCentFT0C(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -826,7 +825,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -835,7 +834,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); - void processCollisionsCentFT0M(soa::Join const& collisions, BCs const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) { /// loop over collisions for (const auto& collision : collisions) { @@ -843,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -874,7 +873,6 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; - using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -911,7 +909,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, McCollisions const& mcCollisions, CollInfos const& collInfos, - BCsInfo const&) + aod::BCFullInfos const&) { rowCandidateXic->bindExternalIndices(&tracks); @@ -1037,14 +1035,14 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { int nSplitColl = 0; if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -1112,7 +1110,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, McCollisionsNoCents const& mcCollisionsNoCents, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runMcMatching(tracks, mcParticles, mcCollisions, mcCollisionsNoCents, bcs); } @@ -1122,7 +1120,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, McCollisionsFT0Cs const& mcCollisionsFT0Cs, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runMcMatching(tracks, mcParticles, mcCollisions, mcCollisionsFT0Cs, bcs); } @@ -1132,7 +1130,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcCollisionsCentFT0Ms, McCollisionsFT0Ms const& mcCollisionsFT0Ms, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { runMcMatching(tracks, mcParticles, mcCollisionsCentFT0Ms, mcCollisionsFT0Ms, bcs); } diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 7ff184af5eb..1db42db0642 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -102,7 +102,6 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { Configurable triggerClassName{"triggerClassName", "kINT7", "Run 2 trigger class, only for Run 2 converted data"}; HfEventSelection hfEvSel; // event selection and monitoring Service ccdb; // needed for evSelection - using BCs = soa::Join; // QA histos HistogramRegistry registry{"registry"}; @@ -156,49 +155,49 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { } /// Event selection with trigger and FT0A centrality selection - void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, BCs const& bcs) + void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0ASel, "Use trigger and centrality selection with FT0A", false); /// Event selection with trigger and FT0C centrality selection - void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, BCs const& bcs) + void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0CSel, "Use trigger and centrality selection with FT0C", false); /// Event selection with trigger and FT0M centrality selection - void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, BCs const& bcs) + void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0MSel, "Use trigger and centrality selection with FT0M", false); /// Event selection with trigger and FV0A centrality selection - void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, BCs const& bcs) + void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFV0ASel, "Use trigger and centrality selection with FV0A", false); /// Event selection with trigger selection - void processTrigSel(soa::Join::iterator const& collision, BCs const& bcs) + void processTrigSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigSel, "Use trigger selection", false); /// Event selection without trigger selection - void processNoTrigSel(aod::Collision const& collision, BCs const& bcs) + void processNoTrigSel(aod::Collision const& collision, aod::BCFullInfos const& bcs) { selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); /// Event selection with UPC - void processUpcSel(soa::Join::iterator const& collision, BCs const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + void processUpcSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) { selectCollision(collision, bcs); } @@ -1254,7 +1253,7 @@ struct HfTrackIndexSkimCreator { using FilteredTrackAssocSel = soa::Filtered>; // filter collisions - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); // filter track indices Filter filterSelectTrackIds = ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); @@ -3066,7 +3065,7 @@ struct HfTrackIndexSkimCreatorCascades { using SelectedCollisions = soa::Filtered>; using FilteredTrackAssocSel = soa::Filtered>; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u && (config.applyProtonPid == false || (aod::hf_sel_track::isIdentifiedPid & static_cast(BIT(ChannelsProtonPid::LcToPK0S))) != 0u); Preslice trackIndicesPerCollision = aod::track_association::collisionId; @@ -3345,7 +3344,7 @@ struct HfTrackIndexSkimCreatorLfCascades { using CascFull = soa::Join; using V0Full = soa::Join; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandCascadeBachelor))) != 0u; Preslice tracksPerCollision = aod::track::collisionId; // needed for PV refit diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index de74c52ba9f..a16f31c1c66 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -110,7 +110,6 @@ static constexpr std::string_view originNames[nOriginTypes] = {"Prompt", "NonPro /// - Momentum Conservation for these particles struct HfTaskMcValidationGen { - using BCsInfo = soa::Join; using CollisionsNoCents = soa::Join; using CollisionsFT0Cs = soa::Join; using CollisionsFT0Ms = soa::Join; @@ -248,7 +247,7 @@ struct HfTaskMcValidationGen { } template - void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, BCsInfo const&, std::array& counterPrompt, std::array& counterNonPrompt) + void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, aod::BCFullInfos const&, std::array& counterPrompt, std::array& counterNonPrompt) { if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { return; @@ -263,11 +262,11 @@ struct HfTaskMcValidationGen { } uint16_t rejectionMask{0}; if constexpr (centEstimator == CentralityEstimator::FT0C) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask); if (rejectionMask != 0) { @@ -517,7 +516,7 @@ struct HfTaskMcValidationGen { void processNoCentSel(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, CollisionsNoCents const& recoCollisions, - BCsInfo const& bcInfo) + aod::BCFullInfos const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); @@ -545,7 +544,7 @@ struct HfTaskMcValidationGen { void processCentFT0C(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, CollisionsFT0Cs const& recoCollisions, - BCsInfo const& bcInfo) + aod::BCFullInfos const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); @@ -573,7 +572,7 @@ struct HfTaskMcValidationGen { void processCentFT0M(McCollisionsCentFT0Ms const& mcCollisions, aod::McParticles const& mcParticles, CollisionsFT0Ms const& recoCollisions, - BCsInfo const& bcInfo) + aod::BCFullInfos const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); @@ -625,7 +624,6 @@ struct HfTaskMcValidationRec { using CollisionsWithMCLabelsAndCentFT0C = soa::Join; using CollisionsWithMCLabelsAndCentFT0M = soa::Join; using TracksWithSel = soa::Join; - using BCsInfo = soa::Join; Partition tracksFilteredGlobalTrackWoDCA = requireGlobalTrackWoDCAInFilter(); Partition tracksInAcc = requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks); @@ -982,7 +980,7 @@ struct HfTaskMcValidationRec { void processColl(CollisionsWithMCLabels::iterator const& collision, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -990,7 +988,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOC(CollisionsWithMCLabelsAndCentFT0C::iterator const& collision, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -998,7 +996,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOM(CollisionsWithMCLabelsAndCentFT0M::iterator const& collision, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -1008,7 +1006,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1018,7 +1016,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1028,7 +1026,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs) + aod::BCFullInfos const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1156,7 +1154,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs, + aod::BCFullInfos const& bcs, CollisionsWithMCLabels const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); @@ -1168,7 +1166,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - BCsInfo const& bcs, + aod::BCFullInfos const& bcs, CollisionsWithMCLabelsAndCentFT0C const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 5729729eed5..de9699cc964 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -35,6 +35,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Core/CentralityEstimation.h" @@ -197,7 +198,6 @@ struct HfTaskPidStudies { using CollisionsMc = soa::Join; using V0sMcRec = soa::Join; using CascsMcRec = soa::Join; - using BCs = soa::Join; ctpRateFetcher rateFetcher; HfEventSelection hfEvSel; @@ -504,7 +504,7 @@ struct HfTaskPidStudies { aod::V0MCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const& /*tracks*/, - BCs const& bcs) + aod::BCFullInfos const& bcs) { for (const auto& v0 : V0s) { if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { @@ -525,7 +525,7 @@ struct HfTaskPidStudies { void processV0Data(aod::V0Datas const& V0s, PidTracks const&, - BCs const& bcs, + aod::BCFullInfos const& bcs, CollSels const&) { for (const auto& v0 : V0s) { @@ -547,7 +547,7 @@ struct HfTaskPidStudies { aod::CascMCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const&, - BCs const& bcs) + aod::BCFullInfos const& bcs) { for (const auto& casc : cascades) { if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { @@ -568,7 +568,7 @@ struct HfTaskPidStudies { void processCascData(aod::CascDatas const& cascades, PidTracks const&, - BCs const& bcs, + aod::BCFullInfos const& bcs, CollSels const&) { for (const auto& casc : cascades) { diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 084158e9bc8..c7c29c4af3b 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -114,15 +114,15 @@ enum EventRejection { }; // upc event type -enum UPCEventType { - kSingleGapA, - kSingleGapC, - kDoubleGap, - kNEventTypes +enum EventTypeUpc { + SingleGapA, + SingleGapC, + DoubleGap, + NEventTypes }; o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; -o2::framework::AxisSpec axisUPCEvents = {UPCEvent::kNEventTypes, -0.5f, +UPCEvent::kNEventTypes - 0.5f, ""}; +o2::framework::AxisSpec axisUPCEvents = {EventTypeUpc::NEventTypes, -0.5f, +EventTypeUpc::NEventTypes - 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram @@ -148,7 +148,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeNarrow + 1, "No coll timerange narrow"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeStandard + 1, "No coll timerange strict"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInRofStandard + 1, "No coll in ROF std"); - hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event selection"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event"); } struct HfEventSelection : o2::framework::ConfigurableGroup { @@ -201,16 +201,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistUPC[] = "hUPCollisions"; // UPC preselection - static constexpr int kMinNDtColl{1}; // Miminimum number of bunch crossings around the collision of interest - static constexpr int kMinNBCs{2}; // Minimum number of bunch crossings - static constexpr int kMinNTracks{2}; // Minimum number of PV contributors - static constexpr int kMaxNTracks{1000}; // Maximum number of PV contributors - static constexpr float kMaxFITTimeNs{34.f}; // Maximum FIT time in ns - static constexpr float kFITAmpFV0{-1.f}; // FV0 amplitude threshold - static constexpr float kFITAmpFT0A{150.f}; // Maximum FT0A amplitude - static constexpr float kFITAmpFT0C{50.f}; // Maximum FT0C amplitude - static constexpr float kFITAmpFDDA{-1.f}; // FDDA amplitude threshold - static constexpr float kFITAmpFDDC{-1.f}; // FDDC amplitude threshold + static constexpr int MinNDtColl{1}; // Miminimum number of bunch crossings around the collision of interest + static constexpr int MinNBCs{2}; // Minimum number of bunch crossings + static constexpr int MinNTracks{2}; // Minimum number of PV contributors + static constexpr int MaxNTracks{1000}; // Maximum number of PV contributors + static constexpr float MaxFITTimeNs{34.f}; // Maximum FIT time in ns + static constexpr float FITAmpFV0{-1.f}; // FV0 amplitude threshold + static constexpr float FITAmpFT0A{150.f}; // Maximum FT0A amplitude + static constexpr float FITAmpFT0C{50.f}; // Maximum FT0C amplitude + static constexpr float FITAmpFDDA{-1.f}; // FDDA amplitude threshold + static constexpr float FITAmpFDDC{-1.f}; // FDDC amplitude threshold std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; @@ -226,16 +226,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// Set standard preselection gap trigger (values taken from UD group) void setSGPreselection(SGCutParHolder& sgCuts) { - sgCuts.SetNDtcoll(kMinNDtColl); - sgCuts.SetMinNBCs(kMinNBCs); - sgCuts.SetNTracks(kMinNTracks, kMaxNTracks); - sgCuts.SetMaxFITtime(kMaxFITTimeNs); - - sgCuts.SetFITAmpLimits({kFITAmpFV0, - kFITAmpFT0A, - kFITAmpFT0C, - kFITAmpFDDA, - kFITAmpFDDC}); + sgCuts.SetNDtcoll(MinNDtColl); + sgCuts.SetMinNBCs(MinNBCs); + sgCuts.SetNTracks(MinNTracks, MaxNTracks); + sgCuts.SetMaxFITtime(MaxFITTimeNs); + + sgCuts.SetFITAmpLimits({FITAmpFV0, + FITAmpFT0A, + FITAmpFT0C, + FITAmpFDDA, + FITAmpFDDC}); } /// \brief Adds collision monitoring histograms in the histogram registry. @@ -349,15 +349,15 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); int issgevent = isSGEvent.value; - if (issgevent > UPCEvent::DoubleGap) { + if (issgevent > EventTypeUpc::DoubleGap) { SETBIT(rejectionMask, EventRejection::UpcEventCut); } else { - if (issgevent == UPCEvent::SingleGapA) { - hUPCollisions->Fill(UPCEvent::SingleGapA); - } else if (issgevent == UPCEvent::SingleGapC) { - hUPCollisions->Fill(UPCEvent::SingleGapC); - } else if (issgevent == UPCEvent::DoubleGap) { - hUPCollisions->Fill(UPCEvent::DoubleGap); + if (issgevent == EventTypeUpc::SingleGapA) { + hUPCollisions->Fill(EventTypeUpc::SingleGapA); + } else if (issgevent == EventTypeUpc::SingleGapC) { + hUPCollisions->Fill(EventTypeUpc::SingleGapC); + } else if (issgevent == EventTypeUpc::DoubleGap) { + hUPCollisions->Fill(EventTypeUpc::DoubleGap); } } } From 7f73952ab4eaa405d886eb1f445bbfc72a9c9f25 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Wed, 11 Jun 2025 13:14:34 +0200 Subject: [PATCH 093/116] fix comments from fabrizio --- PWGHF/Utils/utilsEvSelHf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index c7c29c4af3b..bbe0ae2afba 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -100,6 +100,7 @@ enum EventRejection { TvxTrigger, TimeFrameBorderCut, ItsRofBorderCut, + UpcEventCut, IsGoodZvtxFT0vsPV, NoSameBunchPileup, Occupancy, @@ -109,7 +110,6 @@ enum EventRejection { NoCollInTimeRangeNarrow, NoCollInTimeRangeStandard, NoCollInRofStandard, - UpcEventCut, NEventRejection }; @@ -139,6 +139,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::TvxTrigger + 1, "TVX Trigger"); hRejection->GetXaxis()->SetBinLabel(EventRejection::TimeFrameBorderCut + 1, "TF border"); hRejection->GetXaxis()->SetBinLabel(EventRejection::ItsRofBorderCut + 1, "ITS ROF border"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event"); hRejection->GetXaxis()->SetBinLabel(EventRejection::IsGoodZvtxFT0vsPV + 1, "PV #it{z} consistency FT0 timing"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoSameBunchPileup + 1, "No same-bunch pile-up"); // POTENTIALLY BAD FOR BEAUTY ANALYSES hRejection->GetXaxis()->SetBinLabel(EventRejection::Occupancy + 1, "Occupancy"); @@ -148,7 +149,6 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeNarrow + 1, "No coll timerange narrow"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeStandard + 1, "No coll timerange strict"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInRofStandard + 1, "No coll in ROF std"); - hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event"); } struct HfEventSelection : o2::framework::ConfigurableGroup { From 600446eb90267f367bb71597fdda242f406938b9 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 12 Jun 2025 16:00:11 +0200 Subject: [PATCH 094/116] adjust the sequesence in the hCollision and add a template function --- PWGHF/D2H/TableProducer/CMakeLists.txt | 4 +- .../dataCreatorCharmHadPiReduced.cxx | 94 +++++++------- .../dataCreatorCharmResoReduced.cxx | 92 +++++++------- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 81 +++++------- PWGHF/D2H/Utils/utilsRedDataFormat.h | 5 +- PWGHF/HFC/TableProducer/CMakeLists.txt | 2 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 34 ++--- PWGHF/TableProducer/CMakeLists.txt | 4 +- .../candidateCreatorXic0Omegac0.cxx | 108 ++++++++-------- .../candidateCreatorXicToXiPiPi.cxx | 52 ++++---- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 29 +++-- PWGHF/Tasks/taskMcValidation.cxx | 49 +++---- PWGHF/Tasks/taskPidStudies.cxx | 10 +- PWGHF/Utils/utilsEvSelHf.h | 120 +++++++++++++++++- 15 files changed, 402 insertions(+), 284 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index fa67ec17b7a..7f7a419792b 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -67,12 +67,12 @@ o2physics_add_dpl_workflow(candidate-selector-lb-to-lc-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced SOURCES dataCreatorCharmHadPiReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index f97f9d8224d..fde8c3b553e 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -899,7 +899,7 @@ struct HfDataCreatorCharmHadPiReduced { TTracks const&, PParticles const& particlesMc, uint64_t const& indexCollisionMaxNumContrib, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const&) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -913,7 +913,7 @@ struct HfDataCreatorCharmHadPiReduced { // Set the magnetic field from ccdb. // The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, // but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); @@ -1258,7 +1258,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), @@ -1466,7 +1466,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1480,7 +1480,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1496,7 +1496,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1510,7 +1510,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1526,7 +1526,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1540,7 +1540,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1556,7 +1556,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -1570,7 +1570,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1586,7 +1586,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1600,7 +1600,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1616,7 +1616,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1630,7 +1630,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1646,7 +1646,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1660,7 +1660,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1676,7 +1676,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsDsFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { @@ -1690,7 +1690,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1706,7 +1706,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1720,7 +1720,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1736,7 +1736,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1750,7 +1750,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1766,7 +1766,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1780,7 +1780,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1796,7 +1796,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1810,7 +1810,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1826,7 +1826,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1840,7 +1840,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -1856,7 +1856,7 @@ struct HfDataCreatorCharmHadPiReduced { CandsLcFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSel const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { @@ -1870,7 +1870,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); @@ -1890,7 +1890,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1905,7 +1905,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1925,7 +1925,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for B0 workflow @@ -1940,7 +1940,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1960,7 +1960,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -1975,7 +1975,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1995,7 +1995,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for Bs workflow @@ -2010,7 +2010,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -2030,7 +2030,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2045,7 +2045,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -2065,7 +2065,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for B+ workflow @@ -2080,7 +2080,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -2100,7 +2100,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2115,7 +2115,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -2135,7 +2135,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, McCollisions const&) { // store configurables needed for Lb workflow @@ -2150,7 +2150,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index cf3371513f7..a424d95d95b 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -811,7 +811,7 @@ struct HfDataCreatorCharmResoReduced { Tr const& tracks, TrIU const&, PParticles const& particlesMc, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const&) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; @@ -1307,7 +1307,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function @@ -1453,7 +1453,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1461,7 +1461,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1476,7 +1476,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFiltered const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1484,7 +1484,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); @@ -1502,7 +1502,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1510,7 +1510,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1527,7 +1527,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1535,7 +1535,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1550,7 +1550,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFiltered const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1558,7 +1558,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); @@ -1576,7 +1576,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1584,7 +1584,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1601,7 +1601,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1609,7 +1609,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1624,7 +1624,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0Filtered const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1632,7 +1632,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); @@ -1650,7 +1650,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1658,7 +1658,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1677,7 +1677,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1685,7 +1685,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1703,7 +1703,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1711,7 +1711,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1732,7 +1732,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1740,7 +1740,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1755,7 +1755,7 @@ struct HfDataCreatorCharmResoReduced { CandsDstarFilteredWithMl const& candsDstar, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1763,7 +1763,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); @@ -1781,7 +1781,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1789,7 +1789,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1806,7 +1806,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1814,7 +1814,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1829,7 +1829,7 @@ struct HfDataCreatorCharmResoReduced { CandsDplusFilteredWithMl const& candsDplus, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1837,7 +1837,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1855,7 +1855,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1863,7 +1863,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1880,7 +1880,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::V0s const& v0s, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1888,7 +1888,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1903,7 +1903,7 @@ struct HfDataCreatorCharmResoReduced { CandsD0FilteredWithMl const& candsD0, aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1911,7 +1911,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1929,7 +1929,7 @@ struct HfDataCreatorCharmResoReduced { aod::TrackAssoc const& trackIndices, TracksWithPID const& tracks, TracksIUWithPID const& tracksIU, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1937,7 +1937,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1956,7 +1956,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1964,7 +1964,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1982,7 +1982,7 @@ struct HfDataCreatorCharmResoReduced { aod::V0s const& v0s, TracksIUWithPIDAndMC const& tracksIU, aod::McParticles const& particlesMc, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { int zvtxColl{0}; int sel8Coll{0}; @@ -1990,7 +1990,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry, bcs); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 539b7599750..5e7a63e93f5 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 7165889d434..03e475bc7ed 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -418,11 +418,11 @@ struct HfTaskFlowCharmHadrons { /// \return true if the collision is selected, false otherwise template bool isCollSelected(CollsWithQvecs::iterator const& collision, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const&, float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -482,10 +482,9 @@ struct HfTaskFlowCharmHadrons { /// Compute the scalar product /// \param collision is the collision with the Q vector information and event plane /// \param candidates are the selected candidates - template + template void runFlowAnalysis(CollsWithQvecs::iterator const& collision, - T1 const& candidates, - BCs const& bcs) + T1 const& candidates) { float cent = o2::hf_centrality::getCentralityColl(collision, centEstimator); if (cent < centralityMin || cent > centralityMax) { @@ -496,7 +495,7 @@ struct HfTaskFlowCharmHadrons { if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, bcs); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); } std::vector qVecs = getQvec(collision); @@ -640,115 +639,105 @@ struct HfTaskFlowCharmHadrons { // Ds with ML void processDsMl(CollsWithQvecs::iterator const& collision, - CandDsDataWMl const&, - aod::BCFullInfos const& bcs) + CandDsDataWMl const&) { auto candsDsToKKPiWMl = selectedDsToKKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKKWMl = selectedDsToPiKKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsDsToKKPiWMl, bcs); - runFlowAnalysis(collision, candsDsToPiKKWMl, bcs); + runFlowAnalysis(collision, candsDsToKKPiWMl); + runFlowAnalysis(collision, candsDsToPiKKWMl); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDsMl, "Process Ds candidates with ML", false); // Ds with rectangular cuts void processDs(CollsWithQvecs::iterator const& collision, - CandDsData const&, - aod::BCFullInfos const& bcs) + CandDsData const&) { auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsDsToKKPi, bcs); - runFlowAnalysis(collision, candsDsToPiKK, bcs); + runFlowAnalysis(collision, candsDsToKKPi); + runFlowAnalysis(collision, candsDsToPiKK); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDs, "Process Ds candidates", false); // Dplus with ML void processDplusMl(CollsWithQvecs::iterator const& collision, - CandDplusDataWMl const& candidatesDplus, - aod::BCFullInfos const& bcs) + CandDplusDataWMl const& candidatesDplus) { - runFlowAnalysis(collision, candidatesDplus, bcs); + runFlowAnalysis(collision, candidatesDplus); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDplusMl, "Process Dplus candidates with ML", false); // Dplus with rectangular cuts void processDplus(CollsWithQvecs::iterator const& collision, - CandDplusData const& candidatesDplus, - aod::BCFullInfos const& bcs) + CandDplusData const& candidatesDplus) { - runFlowAnalysis(collision, candidatesDplus, bcs); + runFlowAnalysis(collision, candidatesDplus); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processDplus, "Process Dplus candidates", true); // D0 with ML void processD0Ml(CollsWithQvecs::iterator const& collision, - CandD0DataWMl const&, - aod::BCFullInfos const& bcs) + CandD0DataWMl const&) { auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsD0ToPiKWMl, bcs); - runFlowAnalysis(collision, candsD0ToKPiWMl, bcs); + runFlowAnalysis(collision, candsD0ToPiKWMl); + runFlowAnalysis(collision, candsD0ToKPiWMl); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processD0Ml, "Process D0 candidates with ML", false); // D0 with rectangular cuts void processD0(CollsWithQvecs::iterator const& collision, - CandD0Data const&, - aod::BCFullInfos const& bcs) + CandD0Data const&) { auto candsD0ToPiK = selectedD0ToPiK->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsD0ToKPi = selectedD0ToKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsD0ToPiK, bcs); - runFlowAnalysis(collision, candsD0ToKPi, bcs); + runFlowAnalysis(collision, candsD0ToPiK); + runFlowAnalysis(collision, candsD0ToKPi); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processD0, "Process D0 candidates", false); // Lc with ML void processLcMl(CollsWithQvecs::iterator const& collision, - CandLcDataWMl const&, - aod::BCFullInfos const& bcs) + CandLcDataWMl const&) { auto candsLcToPKPiWMl = selectedLcToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKPWMl = selectedLcToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsLcToPKPiWMl, bcs); - runFlowAnalysis(collision, candsLcToPiKPWMl, bcs); + runFlowAnalysis(collision, candsLcToPKPiWMl); + runFlowAnalysis(collision, candsLcToPiKPWMl); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLcMl, "Process Lc candidates with ML", false); // Lc with rectangular cuts void processLc(CollsWithQvecs::iterator const& collision, - CandLcData const&, - aod::BCFullInfos const& bcs) + CandLcData const&) { auto candsLcToPKPi = selectedLcToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsLcToPiKP = selectedLcToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsLcToPKPi, bcs); - runFlowAnalysis(collision, candsLcToPiKP, bcs); + runFlowAnalysis(collision, candsLcToPKPi); + runFlowAnalysis(collision, candsLcToPiKP); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLc, "Process Lc candidates", false); // Xic with ML void processXicMl(CollsWithQvecs::iterator const& collision, - CandXicDataWMl const&, - aod::BCFullInfos const& bcs) + CandXicDataWMl const&) { auto candsXicToPKPiWMl = selectedXicToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKPWMl = selectedXicToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXicToPKPiWMl, bcs); - runFlowAnalysis(collision, candsXicToPiKPWMl, bcs); + runFlowAnalysis(collision, candsXicToPKPiWMl); + runFlowAnalysis(collision, candsXicToPiKPWMl); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXicMl, "Process Xic candidates with ML", false); // Xic with rectangular cuts void processXic(CollsWithQvecs::iterator const& collision, - CandXicData const&, - aod::BCFullInfos const& bcs) + CandXicData const&) { auto candsXicToPKPi = selectedXicToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); auto candsXicToPiKP = selectedXicToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXicToPKPi, bcs); - runFlowAnalysis(collision, candsXicToPiKP, bcs); + runFlowAnalysis(collision, candsXicToPKPi); + runFlowAnalysis(collision, candsXicToPiKP); } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic, "Process Xic candidates", false); @@ -772,7 +761,7 @@ struct HfTaskFlowCharmHadrons { // Resolution void processResolution(CollsWithQvecs::iterator const& collision, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { float centrality{-1.f}; float xQVecFT0a = collision.qvecFT0ARe(); @@ -795,7 +784,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index a18d2dd85a7..12d70b92fc8 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -34,10 +34,10 @@ namespace o2::hf_evsel /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria template -void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, BCs const& bcs) +void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, int& zvtxColl, int& sel8Coll, int& zvtxAndSel8Coll, int& zvtxAndSel8CollAndSoftTrig, int& allSelColl, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } @@ -109,3 +109,4 @@ float getTpcTofNSigmaKa1(const T1& prong1) } // namespace o2::pid_tpc_tof_utils #endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ + diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index ececa170cae..99f2c4fb152 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -71,5 +71,5 @@ o2physics_add_dpl_workflow(correlator-lc-sc-hadrons o2physics_add_dpl_workflow(femto-dream-producer SOURCES femtoDreamProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore COMPONENT_NAME Analysis) diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index fa9d0247c96..ee8ec8aaa26 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -159,7 +159,9 @@ struct HfFemtoDreamProducer { using FemtoHFTrack = FemtoHFTracks::iterator; using FemtoHFMcTracks = soa::Join; using FemtoHFMcTrack = FemtoHFMcTracks::iterator; + using GeneratedMc = soa::Filtered>; + Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -234,7 +236,7 @@ struct HfFemtoDreamProducer { } /// Function to retrieve the nominal magnetic field in kG (0.1T) and convert it directly to T - void getMagneticFieldTesla(aod::BCFullInfos::iterator bc) + void getMagneticFieldTesla(aod::BCsWithTimestamps::iterator bc) { initCCDB(bc, runNumber, ccdb, !isRun3 ? ccdbPathGrp : ccdbPathGrpMag, lut, !isRun3); } @@ -388,8 +390,8 @@ struct HfFemtoDreamProducer { return fIsTrackFilled; } - template - void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates, BCs const& bcs) + template + void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates) { const auto vtxZ = col.posZ(); const auto sizeCand = candidates.size(); @@ -408,7 +410,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); @@ -571,57 +573,57 @@ struct HfFemtoDreamProducer { } void processDataCharmHad(FemtoFullCollision const& col, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const&, FemtoHFTracks const& tracks, soa::Filtered const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates, bcs); + fillCharmHadronTable(col, tracks, candidates); } PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHad, "Provide experimental data for charm hadron femto", false); void processDataCharmHadWithML(FemtoFullCollision const& col, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const&, FemtoHFTracks const& tracks, soa::Filtered> const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates, bcs); + fillCharmHadronTable(col, tracks, candidates); } PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHadWithML, "Provide experimental data for charm hadron femto with ml", false); void processMcCharmHad(FemtoFullCollisionMc const& col, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const&, FemtoHFMcTracks const& tracks, aod::McParticles const&, CandidateLcMc const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates, bcs); + fillCharmHadronTable(col, tracks, candidates); } PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHad, "Provide Mc for charm hadron", false); void processMcCharmHadWithML(FemtoFullCollisionMc const& col, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const&, FemtoHFMcTracks const& tracks, aod::McParticles const&, soa::Join const& candidates) { // get magnetic field for run - getMagneticFieldTesla(col.bc_as()); + getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates, bcs); + fillCharmHadronTable(col, tracks, candidates); } PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHadWithML, "Provide Mc for charm hadron with ml", false); diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index ee119699809..d1eb8f707b5 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -87,12 +87,12 @@ o2physics_add_dpl_workflow(candidate-creator-sigmac0plusplus-cascade o2physics_add_dpl_workflow(candidate-creator-xic0-omegac0 SOURCES candidateCreatorXic0Omegac0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xic-to-xi-pi-pi SOURCES candidateCreatorXicToXiPiPi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xicc diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index bc3d290029e..93685a45197 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -369,9 +369,9 @@ struct HfCandidateCreatorXic0Omegac0 { runNumber = 0; } - template + template void runXic0Omegac0Creator(Coll const&, - BCs const& bcs, + aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyLFTracksWCov const& lfTracks, TracksWCovDca const& tracks, TCascTable const&, TCascLinkTable const&, @@ -408,14 +408,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -726,9 +726,9 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function - template + template void runKfOmegac0CreatorWithKFParticle(Coll const&, - BCs const& bcs, + aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyKfTracks const&, MyKfCascTable const&, KFCascadesLinked const&, aod::HfCascLf2Prongs const& candidates, @@ -742,14 +742,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -1203,9 +1203,9 @@ struct HfCandidateCreatorXic0Omegac0 { } // loop over LF Cascade-bachelor candidates } // end of run function //========================================================== - template + template void runKfXic0CreatorWithKFParticle(Coll const&, - BCs const& bcs, + aod::BCsWithTimestamps const& /*bcWithTimeStamps*/, MyKfTracks const&, MyKfCascTable const&, KFCascadesLinked const&, aod::HfCascLf2Prongs const& candidates, @@ -1220,14 +1220,14 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; } // set the magnetic field from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -1657,7 +1657,7 @@ struct HfCandidateCreatorXic0Omegac0 { } /// @brief process function w/o centrality selections void processNoCentToXiPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1669,7 +1669,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPi, "Run candidate creator w/o centrality selections for xi pi decay channel", true); void processNoCentToXiPiTraCasc(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyTraCascTable const& traCascades, @@ -1681,7 +1681,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToXiPiTraCasc, "Run candidate creator w/o centrality selections for xi pi decay channel with tracked cascades", false); void processNoCentToOmegaPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1693,7 +1693,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentToOmegaPi, "Run candidate creator w/o centrality selections for omega pi decay channel", false); void processNoCentOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1704,7 +1704,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processNoCentXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1715,7 +1715,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processNoCentXicToXiPiWithKFParticle, "Run candidate creator w/o centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processNoCentToOmegaK(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1728,7 +1728,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0C centrality selections void processCentFT0CToXiPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1740,7 +1740,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToXiPi, "Run candidate creator w/ centrality selection on FT0C for xi pi channel", false); void processCentFT0CToOmegaPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1752,7 +1752,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CToOmegaPi, "Run candidate creator w/ centrality selection on FT0C for omega pi channel", false); void processCentFT0COmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1763,7 +1763,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0COmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0CXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1774,7 +1774,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0CXicToXiPiWithKFParticle, "Run candidate creator w FT0C centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0CToOmegaK(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1787,7 +1787,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// @brief process function w/ FT0M centrality selections void processCentFT0MToXiPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1799,7 +1799,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToXiPi, "Run candidate creator w/ centrality selection on FT0M for xi pi channel", false); void processCentFT0MToOmegaPi(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1811,7 +1811,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MToOmegaPi, "Run candidate creator w/ centrality selection on FT0M for omega pi channel", false); void processCentFT0MOmegacToOmegaPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1822,7 +1822,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MOmegacToOmegaPiWithKFParticle, "Run candidate creator w/o centrality selections for Omegac0 To omega pi decay channel using KFParticle", false); void processCentFT0MXicToXiPiWithKFParticle(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, MyKfTracks const& tracks, MyKfCascTable const& cascades, KFCascadesLinked const& cascadeLinks, @@ -1833,7 +1833,7 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCentFT0MXicToXiPiWithKFParticle, "Run candidate creator w FT0M centrality selections for Xic0 To Xi pi decay channel using KFParticle", false); void processCentFT0MToOmegaK(soa::Join const& collisions, - aod::BCFullInfos const& bcWithTimeStamps, + aod::BCsWithTimestamps const& bcWithTimeStamps, TracksWCovDca const& tracks, MyLFTracksWCov const& lfTracks, MyCascTable const& cascades, @@ -1851,14 +1851,14 @@ struct HfCandidateCreatorXic0Omegac0 { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1868,14 +1868,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1885,14 +1885,14 @@ struct HfCandidateCreatorXic0Omegac0 { PROCESS_SWITCH(HfCandidateCreatorXic0Omegac0, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1923,6 +1923,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; + using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -2118,7 +2119,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, Colls const& collsWithMcLabels, McCollisions const& mcCollisions, - aod::BCFullInfos const&) + BCsInfo const&) { float ptCharmBaryonGen = -999.; float rapidityCharmBaryonGen = -999.; @@ -2377,13 +2378,13 @@ struct HfCandidateCreatorXic0Omegac0Mc { uint16_t rejectionMask{0}; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask); if (rejectionMask != 0) { @@ -2606,7 +2607,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { void runXic0Omegac0McQa(TMyRecoCand const& candidates, MyTracksWMc const&, aod::McParticles const& mcParticles, - aod::BCFullInfos const&) + BCsInfo const&) { int indexRec = -1; int8_t sign = -9; @@ -2843,7 +2844,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2854,7 +2855,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2863,7 +2864,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { void processMcXicToXiPiKfQa(aod::HfCandToXiPiKfQa const& candidates, MyTracksWMc const& tracks, aod::McParticles const& mcParticles, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0McQa(candidates, tracks, mcParticles, bcs); } @@ -2874,7 +2875,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2885,7 +2886,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2896,7 +2897,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2907,7 +2908,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2918,7 +2919,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2929,7 +2930,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2940,7 +2941,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2951,7 +2952,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2962,7 +2963,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsNoCents const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2973,7 +2974,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcColls, McCollisionsFT0Ms const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2984,7 +2985,7 @@ struct HfCandidateCreatorXic0Omegac0Mc { aod::McParticles const& mcParticles, aod::McCollisions const& mcColls, McCollisionsFT0Cs const& collsWithMcLabels, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runXic0Omegac0Mc(candidates, tracks, mcParticles, collsWithMcLabels, mcColls, bcs); } @@ -2998,3 +2999,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } + diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 01089539ca6..f7c5a5b1fea 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -182,7 +182,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const&, CascFull const&, TracksWCovDcaPidPrPi const&, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const&) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -193,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -227,7 +227,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb--------------------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -423,7 +423,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const&, KFCascFull const&, TracksWCovExtraPidPrPi const&, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const&) { // loop over triplets of track indices for (const auto& rowTrackIndexXicPlus : rowsTrackIndexXicPlus) { @@ -434,7 +434,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -468,7 +468,7 @@ struct HfCandidateCreatorXicToXiPiPi { //----------------------Set the magnetic field from ccdb----------------------------- /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -727,7 +727,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -738,7 +738,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -749,7 +749,7 @@ struct HfCandidateCreatorXicToXiPiPi { CascadesLinked const& cascadesLinked, CascFull const& cascadesFull, TracksWCovDcaPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithDcaFitter(collisions, rowsTrackIndexXicPlus, cascadesLinked, cascadesFull, tracks, bcs); } @@ -766,7 +766,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -777,7 +777,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -788,7 +788,7 @@ struct HfCandidateCreatorXicToXiPiPi { KFCascadesLinked const& kfCascadesLinked, KFCascFull const& kfCascadesFull, TracksWCovExtraPidPrPi const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runXicplusCreatorWithKFParticle(collisions, rowsTrackIndexXicPlus, kfCascadesLinked, kfCascadesFull, tracks, bcs); } @@ -800,7 +800,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// /// /////////////////////////////////////////////////////////// - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const&) { /// loop over collisions for (const auto& collision : collisions) { @@ -808,7 +808,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -817,7 +817,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisions, "Collision monitoring - no centrality", false); - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const&) { /// loop over collisions for (const auto& collision : collisions) { @@ -825,7 +825,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -834,7 +834,7 @@ struct HfCandidateCreatorXicToXiPiPi { } PROCESS_SWITCH(HfCandidateCreatorXicToXiPiPi, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const&) { /// loop over collisions for (const auto& collision : collisions) { @@ -842,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -873,6 +873,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; + using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -909,7 +910,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, McCollisions const& mcCollisions, CollInfos const& collInfos, - aod::BCFullInfos const&) + BCsInfo const&) { rowCandidateXic->bindExternalIndices(&tracks); @@ -1035,14 +1036,14 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { int nSplitColl = 0; if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -1110,7 +1111,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, McCollisionsNoCents const& mcCollisionsNoCents, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runMcMatching(tracks, mcParticles, mcCollisions, mcCollisionsNoCents, bcs); } @@ -1120,7 +1121,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, McCollisionsFT0Cs const& mcCollisionsFT0Cs, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runMcMatching(tracks, mcParticles, mcCollisions, mcCollisionsFT0Cs, bcs); } @@ -1130,7 +1131,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions { aod::McParticles const& mcParticles, McCollisionsCentFT0Ms const& mcCollisionsCentFT0Ms, McCollisionsFT0Ms const& mcCollisionsFT0Ms, - aod::BCFullInfos const& bcs) + BCsInfo const& bcs) { runMcMatching(tracks, mcParticles, mcCollisionsCentFT0Ms, mcCollisionsFT0Ms, bcs); } @@ -1143,3 +1144,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } + diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 1db42db0642..6540c97dd93 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -132,11 +132,19 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with - template + template void selectCollision(const Col& collision, const BCs& bcs) { float centrality = -1.; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + uint32_t rejectionMask; + + if (applyUPCSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMask( + collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask( + collision, centrality, ccdb, registry); + } if (fillHistograms) { hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -155,51 +163,52 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { } /// Event selection with trigger and FT0A centrality selection - void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) + void + processTrigAndCentFT0ASel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0ASel, "Use trigger and centrality selection with FT0A", false); /// Event selection with trigger and FT0C centrality selection void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0CSel, "Use trigger and centrality selection with FT0C", false); /// Event selection with trigger and FT0M centrality selection void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0MSel, "Use trigger and centrality selection with FT0M", false); /// Event selection with trigger and FV0A centrality selection void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFV0ASel, "Use trigger and centrality selection with FV0A", false); /// Event selection with trigger selection void processTrigSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigSel, "Use trigger selection", false); /// Event selection without trigger selection void processNoTrigSel(aod::Collision const& collision, aod::BCFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); /// Event selection with UPC void processUpcSel(soa::Join::iterator const& collision, aod::BCFullInfos const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processUpcSel, "Use upc selection", false); }; diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index a16f31c1c66..269cd7b21ea 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -110,6 +110,7 @@ static constexpr std::string_view originNames[nOriginTypes] = {"Prompt", "NonPro /// - Momentum Conservation for these particles struct HfTaskMcValidationGen { + using BCsInfo = soa::Join; using CollisionsNoCents = soa::Join; using CollisionsFT0Cs = soa::Join; using CollisionsFT0Ms = soa::Join; @@ -247,7 +248,7 @@ struct HfTaskMcValidationGen { } template - void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, aod::BCFullInfos const&, std::array& counterPrompt, std::array& counterNonPrompt) + void runCheckGenParticles(GenColl const& mcCollision, Particles const& mcParticles, RecoColls const& recoCollisions, BCsInfo const&, std::array& counterPrompt, std::array& counterNonPrompt) { if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { return; @@ -262,11 +263,11 @@ struct HfTaskMcValidationGen { } uint16_t rejectionMask{0}; if constexpr (centEstimator == CentralityEstimator::FT0C) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, recoCollisions, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask); if (rejectionMask != 0) { @@ -516,7 +517,7 @@ struct HfTaskMcValidationGen { void processNoCentSel(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, CollisionsNoCents const& recoCollisions, - aod::BCFullInfos const& bcInfo) + BCsInfo const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); @@ -544,7 +545,7 @@ struct HfTaskMcValidationGen { void processCentFT0C(aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles, CollisionsFT0Cs const& recoCollisions, - aod::BCFullInfos const& bcInfo) + BCsInfo const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); @@ -572,7 +573,7 @@ struct HfTaskMcValidationGen { void processCentFT0M(McCollisionsCentFT0Ms const& mcCollisions, aod::McParticles const& mcParticles, CollisionsFT0Ms const& recoCollisions, - aod::BCFullInfos const& bcInfo) + BCsInfo const& bcInfo) { for (const auto& mcCollision : mcCollisions) { const auto recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); @@ -806,10 +807,10 @@ struct HfTaskMcValidationRec { ccdb->setLocalObjectValidityChecking(); } - template + template void checkCollisions(Coll const& collision, aod::McCollisions const&, - BCs const& bcs) + aod::BCsWithTimestamps const&) { // apply event selection if (!collision.has_mcCollision()) { @@ -817,7 +818,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -835,19 +836,19 @@ struct HfTaskMcValidationRec { registry.fill(HIST("histDeltaZvtx"), collision.numContrib(), collision.posZ() - mcCollision.posZ()); } - template + template void checkCollisionAssociation(Colls const& collisions, TracksWithSel const&, aod::McParticles const& mcParticles, aod::McCollisions const&, - BCs const& bcs) + aod::BCsWithTimestamps const&) { // loop over collisions for (const auto& collision : collisions) { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -980,7 +981,7 @@ struct HfTaskMcValidationRec { void processColl(CollisionsWithMCLabels::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -988,7 +989,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOC(CollisionsWithMCLabelsAndCentFT0C::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -996,7 +997,7 @@ struct HfTaskMcValidationRec { void processCollWithCentFTOM(CollisionsWithMCLabelsAndCentFT0M::iterator const& collision, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisions(collision, mcCollisions, bcs); } // end process @@ -1006,7 +1007,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1016,7 +1017,7 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } @@ -1026,19 +1027,19 @@ struct HfTaskMcValidationRec { TracksWithSel const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { checkCollisionAssociation(collisions, tracks, mcParticles, mcCollisions, bcs); } PROCESS_SWITCH(HfTaskMcValidationRec, processCollAssocWithCentFTOM, "Process collision-association information with centrality selection with FT0M, requires extra table from TrackToCollisionAssociation task (fillTableOfCollIdsPerTrack=true)", false); - template + template void processEff(HfCand2ProngWithMCRec const& cand2Prongs, HfCand3ProngWithMCRec const& cand3Prongs, aod::TracksWMc const&, aod::McParticles const& mcParticles, aod::McCollisions const&, - BCs const& bcs, + aod::BCsWithTimestamps const&, Coll const& collisions, Preslice cand2ProngsPerCollision, Preslice cand3ProngsPerCollision) @@ -1048,7 +1049,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } @@ -1154,7 +1155,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, CollisionsWithMCLabels const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); @@ -1166,7 +1167,7 @@ struct HfTaskMcValidationRec { aod::TracksWMc const& mcTracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& bcs, + aod::BCsWithTimestamps const& bcs, CollisionsWithMCLabelsAndCentFT0C const& collsWithLabels) { processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index de9699cc964..5729729eed5 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -35,7 +35,6 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Core/CentralityEstimation.h" @@ -198,6 +197,7 @@ struct HfTaskPidStudies { using CollisionsMc = soa::Join; using V0sMcRec = soa::Join; using CascsMcRec = soa::Join; + using BCs = soa::Join; ctpRateFetcher rateFetcher; HfEventSelection hfEvSel; @@ -504,7 +504,7 @@ struct HfTaskPidStudies { aod::V0MCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const& /*tracks*/, - aod::BCFullInfos const& bcs) + BCs const& bcs) { for (const auto& v0 : V0s) { if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { @@ -525,7 +525,7 @@ struct HfTaskPidStudies { void processV0Data(aod::V0Datas const& V0s, PidTracks const&, - aod::BCFullInfos const& bcs, + BCs const& bcs, CollSels const&) { for (const auto& v0 : V0s) { @@ -547,7 +547,7 @@ struct HfTaskPidStudies { aod::CascMCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const&, - aod::BCFullInfos const& bcs) + BCs const& bcs) { for (const auto& casc : cascades) { if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { @@ -568,7 +568,7 @@ struct HfTaskPidStudies { void processCascData(aod::CascDatas const& cascades, PidTracks const&, - aod::BCFullInfos const& bcs, + BCs const& bcs, CollSels const&) { for (const auto& casc : cascades) { diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index bbe0ae2afba..c155e8d79ab 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -100,16 +100,16 @@ enum EventRejection { TvxTrigger, TimeFrameBorderCut, ItsRofBorderCut, - UpcEventCut, IsGoodZvtxFT0vsPV, NoSameBunchPileup, Occupancy, NContrib, - Chi2, - PositionZ, NoCollInTimeRangeNarrow, NoCollInTimeRangeStandard, NoCollInRofStandard, + UpcEventCut, + Chi2, + PositionZ, NEventRejection }; @@ -274,7 +274,119 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { addHistograms(registry); } - /// \brief Applies event selection. + /// \brief Applies event selection without upc flag and bc para + /// \tparam useEvSel use information from the EvSel table + /// \tparam centEstimator centrality estimator + /// \param collision collision to test against the selection criteria + /// \param centrality collision centrality variable to be set in this function + /// \param ccdb ccdb service needed to retrieve the needed info for zorro + /// \param registry reference to the histogram registry needed for zorro + /// \return bitmask with the event selection criteria not satisfied by the collision + template + uint16_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + { + uint16_t rejectionMask{0}; // 16 bits, in case new ev. selections will be added + + if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { + centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); + if (centrality < centralityMin || centrality > centralityMax) { + SETBIT(rejectionMask, EventRejection::Centrality); + } + } + + if constexpr (useEvSel) { + /// RCT condition + if (requireGoodRct && !rctChecker.checkTable(collision)) { + SETBIT(rejectionMask, EventRejection::Rct); + } + /// trigger condition + if ((useSel8Trigger && !collision.sel8()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit(triggerClass))) { + SETBIT(rejectionMask, EventRejection::Trigger); + } + /// TVX trigger selection + if (useTvxTrigger && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + SETBIT(rejectionMask, EventRejection::TvxTrigger); + } + /// time frame border cut + if (useTimeFrameBorderCut && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + SETBIT(rejectionMask, EventRejection::TimeFrameBorderCut); + } + /// ITS rof border cut + if (useItsRofBorderCut && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + SETBIT(rejectionMask, EventRejection::ItsRofBorderCut); + } + /// PVz consistency tracking - FT0 timing + if (useIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + SETBIT(rejectionMask, EventRejection::IsGoodZvtxFT0vsPV); + } + /// remove collisions in bunches with more than 1 reco collision + /// POTENTIALLY BAD FOR BEAUTY ANALYSES + if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + SETBIT(rejectionMask, EventRejection::NoSameBunchPileup); + } + /// No collisions in time range narrow + if (useNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeNarrow); + } + /// No collisions in time range strict + if (useNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeStandard); + } + /// No collisions in ROF standard + if (useNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + SETBIT(rejectionMask, EventRejection::NoCollInRofStandard); + } + if (useOccupancyCut) { + float occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); + if (occupancy < occupancyMin || occupancy > occupancyMax) { + SETBIT(rejectionMask, EventRejection::Occupancy); + } + } + } + + /// number of PV contributors + if (collision.numContrib() < nPvContributorsMin) { + SETBIT(rejectionMask, EventRejection::NContrib); + } + + /// max PV chi2 + if (chi2PvMax > 0. && collision.chi2() > chi2PvMax) { + SETBIT(rejectionMask, EventRejection::Chi2); + } + + /// primary vertex z + if (collision.posZ() < zPvPosMin || collision.posZ() > zPvPosMax) { + SETBIT(rejectionMask, EventRejection::PositionZ); + } + + if (softwareTrigger.value != "") { + // we might have to update it from CCDB + auto bc = collision.template bc_as(); + + int runNumber = bc.runNumber(); + if (runNumber != currentRun) { // We might need to update Zorro from CCDB if the run number changes + zorro.setCCDBpath(ccdbPathSoftwareTrigger); + zorro.setBCtolerance(bcMarginForSoftwareTrigger); + zorro.initCCDB(ccdb.service, runNumber, bc.timestamp(), softwareTrigger.value); + currentRun = runNumber; + } + zorro.populateHistRegistry(registry, runNumber); + + if (softwareTrigger.value != "None") { + if (!zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { /// Just let Zorro do the accounting + SETBIT(rejectionMask, EventRejection::SoftwareTrigger); + } + } else { + if (!zorro.isNotSelectedByAny(bc.globalBC(), bcMarginForSoftwareTrigger)) { /// Just let Zorro do the accounting of not selected BCs + SETBIT(rejectionMask, EventRejection::SoftwareTrigger); + } + } + } + + return rejectionMask; + } + + /// \brief Applies event selection with upc flag and bc para /// \tparam useEvSel use information from the EvSel table /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria From 64b16d5edd53d2e06a1a35e0e1610838105b1f98 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 12 Jun 2025 16:08:12 +0200 Subject: [PATCH 095/116] fix typo --- PWGHF/D2H/Utils/utilsRedDataFormat.h | 1 - .../candidateCreatorXic0Omegac0.cxx | 1 - .../candidateCreatorXicToXiPiPi.cxx | 1 - PWGHF/Tasks/taskPidStudies.cxx | 25 +++++++++---------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 12d70b92fc8..513f2a998fc 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -109,4 +109,3 @@ float getTpcTofNSigmaKa1(const T1& prong1) } // namespace o2::pid_tpc_tof_utils #endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ - diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 93685a45197..754272af541 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -2999,4 +2999,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } - diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index f7c5a5b1fea..69fea11d5c9 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -1144,4 +1144,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } - diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 5729729eed5..ad3943a7134 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -197,7 +197,6 @@ struct HfTaskPidStudies { using CollisionsMc = soa::Join; using V0sMcRec = soa::Join; using CascsMcRec = soa::Join; - using BCs = soa::Join; ctpRateFetcher rateFetcher; HfEventSelection hfEvSel; @@ -337,17 +336,17 @@ struct HfTaskPidStudies { return Particle::NotMatched; } - template - bool isCollSelected(const Coll& coll, const BCs& bcs) + template + bool isCollSelected(const Coll& coll) { - auto bc = coll.template bc_as(); + auto bc = coll.template bc_as(); interactionRate = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), ctpFetcherSource.value) * 1.e-3; // convert to kHz if (interactionRate < interactionRateMin || interactionRate > interactionRateMax) { return false; } float cent{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; @@ -504,10 +503,10 @@ struct HfTaskPidStudies { aod::V0MCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const& /*tracks*/, - BCs const& bcs) + aod::BCsWithTimestamps const&) { for (const auto& v0 : V0s) { - if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { + if (applyEvSels && !isCollSelected(v0.collision_as())) { continue; } if (applyTrackSels && !isTrackSelected(v0)) { @@ -525,11 +524,11 @@ struct HfTaskPidStudies { void processV0Data(aod::V0Datas const& V0s, PidTracks const&, - BCs const& bcs, + aod::BCsWithTimestamps const&, CollSels const&) { for (const auto& v0 : V0s) { - if (applyEvSels && !isCollSelected(v0.collision_as(), bcs)) { + if (applyEvSels && !isCollSelected(v0.collision_as())) { continue; } if (applyTrackSels && !isTrackSelected(v0)) { @@ -547,10 +546,10 @@ struct HfTaskPidStudies { aod::CascMCCores const&, aod::McParticles const& /*particlesMc*/, PidTracks const&, - BCs const& bcs) + aod::BCsWithTimestamps const&) { for (const auto& casc : cascades) { - if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { + if (applyEvSels && !isCollSelected(casc.collision_as())) { continue; } if (applyTrackSels && !isTrackSelected(casc)) { @@ -568,11 +567,11 @@ struct HfTaskPidStudies { void processCascData(aod::CascDatas const& cascades, PidTracks const&, - BCs const& bcs, + aod::BCsWithTimestamps const&, CollSels const&) { for (const auto& casc : cascades) { - if (applyEvSels && !isCollSelected(casc.collision_as(), bcs)) { + if (applyEvSels && !isCollSelected(casc.collision_as())) { continue; } if (applyTrackSels && !isTrackSelected(casc)) { From cb52fb4506e8c68900d75ba52a851c237a04d047 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 12 Jun 2025 16:10:27 +0200 Subject: [PATCH 096/116] fix typo --- PWGHF/D2H/TableProducer/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 7f7a419792b..a60ab1d78ab 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -72,7 +72,7 @@ o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 5e7a63e93f5..53b22dfe969 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb From 288c6b9f48d06e9dc98e3b4064b0d0621c077c57 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 12 Jun 2025 16:13:37 +0200 Subject: [PATCH 097/116] fix typo --- PWGHF/Utils/utilsEvSelHf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index c155e8d79ab..7c2e914091a 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -283,9 +283,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision template - uint16_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) { - uint16_t rejectionMask{0}; // 16 bits, in case new ev. selections will be added + uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); From 9bfb28ae75ce524f51f43f05a3be41007c4f4971 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 12 Jun 2025 16:15:13 +0200 Subject: [PATCH 098/116] fix miatake --- PWGHF/Tasks/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index bacdd693e73..b212b705b23 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -36,7 +36,7 @@ o2physics_add_dpl_workflow(task-mc-gen-pt-rap-shapes o2physics_add_dpl_workflow(task-mc-validation SOURCES taskMcValidation.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation @@ -46,7 +46,7 @@ o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation o2physics_add_dpl_workflow(task-pid-studies SOURCES taskPidStudies.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) # o2physics_add_dpl_workflow(task-sel-optimisation From 606f72f6e200528f80199970d70818d3f32da93c Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Fri, 13 Jun 2025 14:38:04 +0200 Subject: [PATCH 099/116] commit for fabrizio's comments --- PWGHF/Utils/utilsEvSelHf.h | 99 ++------------------------------------ 1 file changed, 3 insertions(+), 96 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 7c2e914091a..0b8674a242f 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -397,64 +397,11 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { template uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCs& bcs) { - uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added - if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { - centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); - if (centrality < centralityMin || centrality > centralityMax) { - SETBIT(rejectionMask, EventRejection::Centrality); - } - } - if constexpr (useEvSel) { - /// RCT condition - if (requireGoodRct && !rctChecker.checkTable(collision)) { - SETBIT(rejectionMask, EventRejection::Rct); - } - /// trigger condition - if ((useSel8Trigger && !collision.sel8()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit(triggerClass))) { - SETBIT(rejectionMask, EventRejection::Trigger); - } - /// TVX trigger selection - if (useTvxTrigger && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - SETBIT(rejectionMask, EventRejection::TvxTrigger); - } - /// time frame border cut - if (useTimeFrameBorderCut && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - SETBIT(rejectionMask, EventRejection::TimeFrameBorderCut); - } - /// ITS rof border cut - if (useItsRofBorderCut && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - SETBIT(rejectionMask, EventRejection::ItsRofBorderCut); - } - /// PVz consistency tracking - FT0 timing - if (useIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - SETBIT(rejectionMask, EventRejection::IsGoodZvtxFT0vsPV); - } - /// remove collisions in bunches with more than 1 reco collision - /// POTENTIALLY BAD FOR BEAUTY ANALYSES - if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - SETBIT(rejectionMask, EventRejection::NoSameBunchPileup); - } - /// No collisions in time range narrow - if (useNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { - SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeNarrow); - } - /// No collisions in time range strict - if (useNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeStandard); - } - /// No collisions in ROF standard - if (useNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { - SETBIT(rejectionMask, EventRejection::NoCollInRofStandard); - } - if (useOccupancyCut) { - float occupancy = o2::hf_occupancy::getOccupancyColl(collision, occEstimator); - if (occupancy < occupancyMin || occupancy > occupancyMax) { - SETBIT(rejectionMask, EventRejection::Occupancy); - } - } + auto rejectionMask = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); - /// upc selection + /// upc selection + if constexpr (useEvSel) { if (useUpcTrigger) { setSGPreselection(sgCuts); auto bc = collision.template foundBC_as(); @@ -474,46 +421,6 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { } } } - - /// number of PV contributors - if (collision.numContrib() < nPvContributorsMin) { - SETBIT(rejectionMask, EventRejection::NContrib); - } - - /// max PV chi2 - if (chi2PvMax > 0. && collision.chi2() > chi2PvMax) { - SETBIT(rejectionMask, EventRejection::Chi2); - } - - /// primary vertex z - if (collision.posZ() < zPvPosMin || collision.posZ() > zPvPosMax) { - SETBIT(rejectionMask, EventRejection::PositionZ); - } - - if (softwareTrigger.value != "") { - // we might have to update it from CCDB - auto bc = collision.template bc_as(); - - int runNumber = bc.runNumber(); - if (runNumber != currentRun) { // We might need to update Zorro from CCDB if the run number changes - zorro.setCCDBpath(ccdbPathSoftwareTrigger); - zorro.setBCtolerance(bcMarginForSoftwareTrigger); - zorro.initCCDB(ccdb.service, runNumber, bc.timestamp(), softwareTrigger.value); - currentRun = runNumber; - } - zorro.populateHistRegistry(registry, runNumber); - - if (softwareTrigger.value != "None") { - if (!zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { /// Just let Zorro do the accounting - SETBIT(rejectionMask, EventRejection::SoftwareTrigger); - } - } else { - if (!zorro.isNotSelectedByAny(bc.globalBC(), bcMarginForSoftwareTrigger)) { /// Just let Zorro do the accounting of not selected BCs - SETBIT(rejectionMask, EventRejection::SoftwareTrigger); - } - } - } - return rejectionMask; } From f584352959bc87e25f81b294b266b5e385e488ce Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Fri, 13 Jun 2025 14:45:15 +0200 Subject: [PATCH 100/116] commit for fabrizio's comments --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 6540c97dd93..532153cc742 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -138,7 +138,7 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { float centrality = -1.; uint32_t rejectionMask; - if (applyUPCSel) { + if constexpr (applyUPCSel) { rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry, bcs); } else { From 2cfadca7ad1002d01d2e969d39370447b5168876 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Fri, 13 Jun 2025 16:03:58 +0200 Subject: [PATCH 101/116] commit for vit's comments --- PWGHF/Utils/utilsEvSelHf.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 0b8674a242f..2c105636386 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -187,7 +187,6 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { // SG selector SGSelector sgSelector; - SGCutParHolder sgCuts = SGCutParHolder(); // histogram names static constexpr char NameHistCollisions[] = "hCollisions"; @@ -224,18 +223,19 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { int currentRun{-1}; /// Set standard preselection gap trigger (values taken from UD group) - void setSGPreselection(SGCutParHolder& sgCuts) + SGCutParHolder setSGPreselection() { + SGCutParHolder sgCuts; sgCuts.SetNDtcoll(MinNDtColl); sgCuts.SetMinNBCs(MinNBCs); sgCuts.SetNTracks(MinNTracks, MaxNTracks); sgCuts.SetMaxFITtime(MaxFITTimeNs); - sgCuts.SetFITAmpLimits({FITAmpFV0, FITAmpFT0A, FITAmpFT0C, FITAmpFDDA, FITAmpFDDC}); + return sgCuts; } /// \brief Adds collision monitoring histograms in the histogram registry. @@ -403,7 +403,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// upc selection if constexpr (useEvSel) { if (useUpcTrigger) { - setSGPreselection(sgCuts); + SGCutParHolder sgCuts = setSGPreselection(); auto bc = collision.template foundBC_as(); auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); From 915ecffdd8349694df21507e13a73860d5c6f0e3 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Sun, 15 Jun 2025 22:22:50 +0200 Subject: [PATCH 102/116] commit for using one template function --- PWGHF/D2H/DataModel/ReducedDataModel.h | 2 +- .../dataCreatorCharmHadPiReduced.cxx | 46 ++++++------- .../dataCreatorCharmResoReduced.cxx | 46 ++++++------- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 6 +- PWGHF/D2H/Utils/utilsRedDataFormat.h | 2 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 2 +- .../TableProducer/candidateCreator2Prong.cxx | 10 +-- .../TableProducer/candidateCreator3Prong.cxx | 10 +-- .../TableProducer/candidateCreatorCascade.cxx | 8 +-- PWGHF/TableProducer/candidateCreatorDstar.cxx | 8 +-- .../candidateCreatorXic0Omegac0.cxx | 12 ++-- .../candidateCreatorXicToXiPiPi.cxx | 10 +-- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 8 +-- PWGHF/Tasks/taskMcValidation.cxx | 6 +- PWGHF/Tasks/taskPidStudies.cxx | 3 +- PWGHF/Utils/utilsEvSelHf.h | 65 +++++++------------ 16 files changed, 114 insertions(+), 130 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 939f0648099..ca9d543d706 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -50,7 +50,7 @@ namespace aod namespace hf_reduced_collision { DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction -DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint16_t); //! Bitmask with failed selection criteria +DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint32_t); //! Bitmask with failed selection criteria // keep track of the number of studied events (for normalization purposes) DECLARE_SOA_COLUMN(OriginalCollisionCount, originalCollisionCount, int); //! Size of COLLISION table processed DECLARE_SOA_COLUMN(ZvtxSelectedCollisionCount, zvtxSelectedCollisionCount, int); //! Number of COLLISIONS with |zvtx| < zvtxMax diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index fde8c3b553e..5646b6ed833 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1258,7 +1258,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), @@ -1480,7 +1480,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1510,7 +1510,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1540,7 +1540,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1570,7 +1570,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1600,7 +1600,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1630,7 +1630,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1660,7 +1660,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1690,7 +1690,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1720,7 +1720,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1750,7 +1750,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1780,7 +1780,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -1810,7 +1810,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1840,7 +1840,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -1870,7 +1870,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); @@ -1905,7 +1905,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -1940,7 +1940,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1975,7 +1975,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); @@ -2010,7 +2010,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -2045,7 +2045,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); @@ -2080,7 +2080,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -2115,7 +2115,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); @@ -2150,7 +2150,7 @@ struct HfDataCreatorCharmHadPiReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index a424d95d95b..da6ee8600f5 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -1307,7 +1307,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function @@ -1461,7 +1461,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1484,7 +1484,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); @@ -1510,7 +1510,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1535,7 +1535,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1558,7 +1558,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); @@ -1584,7 +1584,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1609,7 +1609,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1632,7 +1632,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); @@ -1658,7 +1658,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1685,7 +1685,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1711,7 +1711,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1740,7 +1740,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1763,7 +1763,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); @@ -1789,7 +1789,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1814,7 +1814,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1837,7 +1837,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1863,7 +1863,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1888,7 +1888,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1911,7 +1911,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1937,7 +1937,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1964,7 +1964,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1990,7 +1990,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 03e475bc7ed..2f16132ab40 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -422,7 +422,7 @@ struct HfTaskFlowCharmHadrons { float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -495,7 +495,7 @@ struct HfTaskFlowCharmHadrons { if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, nullptr); } std::vector qVecs = getQvec(collision); @@ -784,7 +784,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 513f2a998fc..f8634251285 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -37,7 +37,7 @@ template const& ccdb, o2::framework::HistogramRegistry& registry) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index ee8ec8aaa26..bdaff113b52 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -410,7 +410,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 46f233d3606..3424ef45803 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -194,7 +194,7 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -342,7 +342,7 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -635,7 +635,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -653,7 +653,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -671,7 +671,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index efdb1111e2a..0f1e0ce49f2 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -246,7 +246,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -412,7 +412,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -793,7 +793,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -811,7 +811,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -829,7 +829,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index f59a83504f7..ce3ff1254f6 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -165,7 +165,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -396,7 +396,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -413,7 +413,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -430,7 +430,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 02b19edb1d7..749c773727f 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -201,7 +201,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -478,7 +478,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -495,7 +495,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -512,7 +512,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 754272af541..29acbc331df 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -408,7 +408,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -742,7 +742,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1220,7 +1220,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1858,7 +1858,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1875,7 +1875,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1892,7 +1892,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 69fea11d5c9..f030d02c6bd 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -193,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -434,7 +434,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -808,7 +808,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -825,7 +825,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -842,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 532153cc742..d30929d1efc 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -139,11 +139,11 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { uint32_t rejectionMask; if constexpr (applyUPCSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( - collision, centrality, ccdb, registry, bcs); + rejectionMask = hfEvSel.getHfCollisionRejectionMask( + collision, centrality, ccdb, registry, &bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( - collision, centrality, ccdb, registry); + rejectionMask = hfEvSel.getHfCollisionRejectionMask( + collision, centrality, ccdb, registry, nullptr); } if (fillHistograms) { diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 269cd7b21ea..75d65859ed0 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -818,7 +818,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -848,7 +848,7 @@ struct HfTaskMcValidationRec { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1049,7 +1049,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index ad3943a7134..6f9ce1c0270 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -37,7 +37,6 @@ #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" #include "PWGHF/Core/CentralityEstimation.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -346,7 +345,7 @@ struct HfTaskPidStudies { } float cent{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask>(coll, cent, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 2c105636386..0bf607fd06a 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -282,8 +282,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param ccdb ccdb service needed to retrieve the needed info for zorro /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision - template - uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + template + uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, + const BCs* bcs = nullptr) { uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added @@ -342,6 +343,28 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SETBIT(rejectionMask, EventRejection::Occupancy); } } + + if (useUpcTrigger) { + if (!bcs) { + throw std::runtime_error("UPC selection requested but no BC table provided!"); + } + SGCutParHolder sgCuts = setSGPreselection(); + auto bc = collision.template foundBC_as(); + auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), *bcs, sgCuts.minNBCs()); + auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + int issgevent = isSGEvent.value; + if (issgevent > EventTypeUpc::DoubleGap) { + SETBIT(rejectionMask, EventRejection::UpcEventCut); + } else { + if (issgevent == EventTypeUpc::SingleGapA) { + hUPCollisions->Fill(EventTypeUpc::SingleGapA); + } else if (issgevent == EventTypeUpc::SingleGapC) { + hUPCollisions->Fill(EventTypeUpc::SingleGapC); + } else if (issgevent == EventTypeUpc::DoubleGap) { + hUPCollisions->Fill(EventTypeUpc::DoubleGap); + } + } + } } /// number of PV contributors @@ -386,44 +409,6 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } - /// \brief Applies event selection with upc flag and bc para - /// \tparam useEvSel use information from the EvSel table - /// \tparam centEstimator centrality estimator - /// \param collision collision to test against the selection criteria - /// \param centrality collision centrality variable to be set in this function - /// \param ccdb ccdb service needed to retrieve the needed info for zorro - /// \param registry reference to the histogram registry needed for zorro - /// \return bitmask with the event selection criteria not satisfied by the collision - template - uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCs& bcs) - { - - auto rejectionMask = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); - - /// upc selection - if constexpr (useEvSel) { - if (useUpcTrigger) { - SGCutParHolder sgCuts = setSGPreselection(); - auto bc = collision.template foundBC_as(); - auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); - auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); - int issgevent = isSGEvent.value; - if (issgevent > EventTypeUpc::DoubleGap) { - SETBIT(rejectionMask, EventRejection::UpcEventCut); - } else { - if (issgevent == EventTypeUpc::SingleGapA) { - hUPCollisions->Fill(EventTypeUpc::SingleGapA); - } else if (issgevent == EventTypeUpc::SingleGapC) { - hUPCollisions->Fill(EventTypeUpc::SingleGapC); - } else if (issgevent == EventTypeUpc::DoubleGap) { - hUPCollisions->Fill(EventTypeUpc::DoubleGap); - } - } - } - } - return rejectionMask; - } - /// \brief Fills histograms for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision From ed84c083b507d11ad794f13211ee6e30ed12de51 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Sun, 15 Jun 2025 22:28:13 +0200 Subject: [PATCH 103/116] fix typo --- PWGHF/Utils/utilsEvSelHf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 0bf607fd06a..3dbf4710705 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -274,8 +274,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { addHistograms(registry); } - /// \brief Applies event selection without upc flag and bc para + /// \brief Applies event selection /// \tparam useEvSel use information from the EvSel table + /// \tparam useUpcTrigger add upc event selection /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria /// \param centrality collision centrality variable to be set in this function From 933ecbba3450b2732928eb42436fcf3af53da7a8 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Sun, 15 Jun 2025 23:22:05 +0200 Subject: [PATCH 104/116] fix vit's comment --- PWGHF/D2H/TableProducer/CMakeLists.txt | 4 ++-- .../TableProducer/dataCreatorCharmHadPiReduced.cxx | 2 +- .../TableProducer/dataCreatorCharmResoReduced.cxx | 2 +- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 6 +++--- PWGHF/D2H/Utils/utilsRedDataFormat.h | 2 +- PWGHF/HFC/TableProducer/CMakeLists.txt | 2 +- PWGHF/HFC/TableProducer/femtoDreamProducer.cxx | 2 +- PWGHF/TableProducer/CMakeLists.txt | 4 ++-- PWGHF/TableProducer/candidateCreator2Prong.cxx | 10 +++++----- PWGHF/TableProducer/candidateCreator3Prong.cxx | 10 +++++----- PWGHF/TableProducer/candidateCreatorCascade.cxx | 8 ++++---- PWGHF/TableProducer/candidateCreatorDstar.cxx | 8 ++++---- PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx | 12 ++++++------ PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx | 10 +++++----- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 4 ++-- PWGHF/Tasks/CMakeLists.txt | 4 ++-- PWGHF/Tasks/taskMcValidation.cxx | 6 +++--- PWGHF/Tasks/taskPidStudies.cxx | 2 +- PWGHF/Utils/utilsEvSelHf.h | 3 +-- 20 files changed, 51 insertions(+), 52 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index a60ab1d78ab..cdfc53299ff 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -67,12 +67,12 @@ o2physics_add_dpl_workflow(candidate-selector-lb-to-lc-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced SOURCES dataCreatorCharmHadPiReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 5646b6ed833..59f4d75238c 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1258,7 +1258,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index da6ee8600f5..ddc180c0b38 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -1307,7 +1307,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 53b22dfe969..3619c660443 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 2f16132ab40..1e062dd8d47 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -422,7 +422,7 @@ struct HfTaskFlowCharmHadrons { float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -495,7 +495,7 @@ struct HfTaskFlowCharmHadrons { if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, nullptr); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, nullptr); } std::vector qVecs = getQvec(collision); @@ -784,7 +784,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index f8634251285..805243c34e2 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -37,7 +37,7 @@ template const& ccdb, o2::framework::HistogramRegistry& registry) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index 99f2c4fb152..ececa170cae 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -71,5 +71,5 @@ o2physics_add_dpl_workflow(correlator-lc-sc-hadrons o2physics_add_dpl_workflow(femto-dream-producer SOURCES femtoDreamProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore O2Physics::SGCutParHolder COMPONENT_NAME Analysis) diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index bdaff113b52..a5a3eb02ad8 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -410,7 +410,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index d1eb8f707b5..ee119699809 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -87,12 +87,12 @@ o2physics_add_dpl_workflow(candidate-creator-sigmac0plusplus-cascade o2physics_add_dpl_workflow(candidate-creator-xic0-omegac0 SOURCES candidateCreatorXic0Omegac0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xic-to-xi-pi-pi SOURCES candidateCreatorXicToXiPiPi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xicc diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 3424ef45803..5f7565e6b68 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -194,7 +194,7 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -342,7 +342,7 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -635,7 +635,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -653,7 +653,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -671,7 +671,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 0f1e0ce49f2..c5343123881 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -246,7 +246,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -412,7 +412,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -793,7 +793,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -811,7 +811,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -829,7 +829,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index ce3ff1254f6..664b544d29c 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -165,7 +165,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -396,7 +396,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -413,7 +413,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -430,7 +430,7 @@ struct HfCandidateCreatorCascade { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 749c773727f..bbd7b419f19 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -201,7 +201,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -478,7 +478,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -495,7 +495,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -512,7 +512,7 @@ struct HfCandidateCreatorDstar { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 29acbc331df..eaffaa13c88 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -408,7 +408,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -742,7 +742,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1220,7 +1220,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1858,7 +1858,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1875,7 +1875,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1892,7 +1892,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index f030d02c6bd..4e4cfaa5925 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -193,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -434,7 +434,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -808,7 +808,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -825,7 +825,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -842,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index d30929d1efc..3e2d4396b0e 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -139,10 +139,10 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { uint32_t rejectionMask; if constexpr (applyUPCSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( + rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry, &bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( + rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry, nullptr); } diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index b212b705b23..bacdd693e73 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -36,7 +36,7 @@ o2physics_add_dpl_workflow(task-mc-gen-pt-rap-shapes o2physics_add_dpl_workflow(task-mc-validation SOURCES taskMcValidation.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation @@ -46,7 +46,7 @@ o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation o2physics_add_dpl_workflow(task-pid-studies SOURCES taskPidStudies.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB O2Physics::SGCutParHolder COMPONENT_NAME Analysis) # o2physics_add_dpl_workflow(task-sel-optimisation diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index 75d65859ed0..a8689400cea 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -818,7 +818,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -848,7 +848,7 @@ struct HfTaskMcValidationRec { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1049,7 +1049,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 6f9ce1c0270..2930b03de54 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -345,7 +345,7 @@ struct HfTaskPidStudies { } float cent{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask>(coll, cent, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask>(coll, cent, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 3dbf4710705..4b01e0a1d7e 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -276,14 +276,13 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \brief Applies event selection /// \tparam useEvSel use information from the EvSel table - /// \tparam useUpcTrigger add upc event selection /// \tparam centEstimator centrality estimator /// \param collision collision to test against the selection criteria /// \param centrality collision centrality variable to be set in this function /// \param ccdb ccdb service needed to retrieve the needed info for zorro /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision - template + template uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCs* bcs = nullptr) { From a2f60705e7ad6766e615dd5ee97e3d03f182be1d Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Sun, 15 Jun 2025 23:26:29 +0200 Subject: [PATCH 105/116] fix clang format --- PWGHF/D2H/TableProducer/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index cdfc53299ff..fa67ec17b7a 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -72,7 +72,7 @@ o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 3619c660443..539b7599750 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb From 0b761e525c220f422c81d5162fdb46437e802fff Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 16 Jun 2025 09:16:25 +0200 Subject: [PATCH 106/116] fix missed changes for jpsihadron --- PWGHF/D2H/TableProducer/CMakeLists.txt | 2 +- PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index fa67ec17b7a..20875d8fd41 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -77,7 +77,7 @@ o2physics_add_dpl_workflow(data-creator-charm-reso-reduced o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced SOURCES dataCreatorJpsiHadReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) # Converters diff --git a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx index 3a382d62dcf..8e6d4b2dce6 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx @@ -967,7 +967,7 @@ struct HfDataCreatorJpsiHadReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // fill collision table if it contains a J/Psi K pair at minimum hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), @@ -1001,7 +1001,7 @@ struct HfDataCreatorJpsiHadReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); @@ -1031,7 +1031,7 @@ struct HfDataCreatorJpsiHadReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); @@ -1063,7 +1063,7 @@ struct HfDataCreatorJpsiHadReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); @@ -1098,7 +1098,7 @@ struct HfDataCreatorJpsiHadReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsJpsiThisColl = candsJpsi.sliceBy(candsJpsiPerCollision, thisCollId); From 33968b437650be5fb256aecf3b1021f52b66e796 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Mon, 16 Jun 2025 17:40:00 +0200 Subject: [PATCH 107/116] fix vit's comments --- PWGHF/Utils/utilsEvSelHf.h | 41 +++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 4b01e0a1d7e..108300626be 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -18,11 +18,13 @@ #ifndef PWGHF_UTILS_UTILSEVSELHF_H_ #define PWGHF_UTILS_UTILSEVSELHF_H_ -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGUD/Core/SGSelector.h" -#include -#include -#include +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include #include @@ -30,19 +32,18 @@ #include #include -#include +#include +#include + +#include + +#include + #include +#include #include // std::shared_ptr #include // std::string -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" - -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGUD/Core/SGSelector.h" - namespace o2::hf_occupancy { // centrality selection estimators @@ -115,7 +116,7 @@ enum EventRejection { // upc event type enum EventTypeUpc { - SingleGapA, + SingleGapA = 0, SingleGapC, DoubleGap, NEventTypes @@ -351,18 +352,12 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SGCutParHolder sgCuts = setSGPreselection(); auto bc = collision.template foundBC_as(); auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), *bcs, sgCuts.minNBCs()); - auto isSGEvent = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); - int issgevent = isSGEvent.value; + auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + int issgevent = sgSelectionResult.value; if (issgevent > EventTypeUpc::DoubleGap) { SETBIT(rejectionMask, EventRejection::UpcEventCut); } else { - if (issgevent == EventTypeUpc::SingleGapA) { - hUPCollisions->Fill(EventTypeUpc::SingleGapA); - } else if (issgevent == EventTypeUpc::SingleGapC) { - hUPCollisions->Fill(EventTypeUpc::SingleGapC); - } else if (issgevent == EventTypeUpc::DoubleGap) { - hUPCollisions->Fill(EventTypeUpc::DoubleGap); - } + hUPCollisions->Fill(issgevent); } } } From 16f9b7d44be45ed177a3f1fbde6b179468187c91 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Wed, 18 Jun 2025 18:16:36 +0200 Subject: [PATCH 108/116] fix vit's comments --- 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 108300626be..a739fb2f773 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -114,11 +114,11 @@ enum EventRejection { NEventRejection }; -// upc event type +// upc event type, refer from https://github.com/AliceO2Group/O2Physics/blob/master/PWGUD/Core/SGSelector.h enum EventTypeUpc { SingleGapA = 0, - SingleGapC, - DoubleGap, + SingleGapC = 1, + DoubleGap = 2, NEventTypes }; @@ -353,11 +353,11 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { auto bc = collision.template foundBC_as(); auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), *bcs, sgCuts.minNBCs()); auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); - int issgevent = sgSelectionResult.value; - if (issgevent > EventTypeUpc::DoubleGap) { + int upcEventType = sgSelectionResult.value; + if (upcEventType > EventTypeUpc::DoubleGap) { SETBIT(rejectionMask, EventRejection::UpcEventCut); } else { - hUPCollisions->Fill(issgevent); + hUPCollisions->Fill(upcEventType); } } } From fe45c7a69161b959d0e996cceae44f87c4a18254 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Wed, 18 Jun 2025 22:40:23 +0200 Subject: [PATCH 109/116] fix vit's comments --- PWGHF/Utils/utilsEvSelHf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index a739fb2f773..ecdbfded792 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -114,12 +114,12 @@ enum EventRejection { NEventRejection }; -// upc event type, refer from https://github.com/AliceO2Group/O2Physics/blob/master/PWGUD/Core/SGSelector.h +// upc event type, refer from PWGUD/Core/SGSelector.h enum EventTypeUpc { SingleGapA = 0, SingleGapC = 1, DoubleGap = 2, - NEventTypes + NEventTypes = 3 }; o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; From 6c10ef90a1ea77f3f35d7dba191261ad58d02d5e Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 12:52:51 +0200 Subject: [PATCH 110/116] fix vit's comments --- PWGHF/Utils/utilsEvSelHf.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index ecdbfded792..e5c67721eac 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -201,16 +201,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistUPC[] = "hUPCollisions"; // UPC preselection - static constexpr int MinNDtColl{1}; // Miminimum number of bunch crossings around the collision of interest - static constexpr int MinNBCs{2}; // Minimum number of bunch crossings - static constexpr int MinNTracks{2}; // Minimum number of PV contributors - static constexpr int MaxNTracks{1000}; // Maximum number of PV contributors - static constexpr float MaxFITTimeNs{34.f}; // Maximum FIT time in ns - static constexpr float FITAmpFV0{-1.f}; // FV0 amplitude threshold - static constexpr float FITAmpFT0A{150.f}; // Maximum FT0A amplitude - static constexpr float FITAmpFT0C{50.f}; // Maximum FT0C amplitude - static constexpr float FITAmpFDDA{-1.f}; // FDDA amplitude threshold - static constexpr float FITAmpFDDC{-1.f}; // FDDC amplitude threshold + static constexpr int dtCollNMin{1}; // Minimum number of sigma around the collision + static constexpr int bcsNMin{2}; // Minimum number of bunch crossings (BCs) + static constexpr int trackNMin{2}; // Minimum number of PV contributors + static constexpr int trackNMax{1000}; // Maximum number of PV contributors + static constexpr float fitTimeNsMax{34.f}; // Maximum FIT time in ns + static constexpr float ampFV0Threshold{-1.f}; // FV0 amplitude threshold (-1 = no requirement) + static constexpr float ampFT0AThreshold{150.f}; // FT0A amplitude threshold + static constexpr float ampFT0CThreshold{50.f}; // FT0C amplitude threshold + static constexpr float ampFDDAThreshold{-1.f}; // FDDA amplitude threshold + static constexpr float ampFDDCThreshold{-1.f}; // FDDC amplitude threshold std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; @@ -227,15 +227,15 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SGCutParHolder setSGPreselection() { SGCutParHolder sgCuts; - sgCuts.SetNDtcoll(MinNDtColl); - sgCuts.SetMinNBCs(MinNBCs); - sgCuts.SetNTracks(MinNTracks, MaxNTracks); - sgCuts.SetMaxFITtime(MaxFITTimeNs); - sgCuts.SetFITAmpLimits({FITAmpFV0, - FITAmpFT0A, - FITAmpFT0C, - FITAmpFDDA, - FITAmpFDDC}); + sgCuts.SetNDtcoll(dtCollNMin); + sgCuts.SetMinNBCs(bcsNMin); + sgCuts.SetNTracks(trackNMin, trackNMax); + sgCuts.SetMaxFITtime(fitTimeNsMax); + sgCuts.SetFITAmpLimits({ampFV0Threshold, + ampFT0AThreshold, + ampFT0CThreshold, + ampFDDAThreshold, + ampFDDCThreshold}); return sgCuts; } From 3a14853c35e780e70407ff32f58143b102f9ce00 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 14:08:11 +0200 Subject: [PATCH 111/116] fix vit's comments --- .../TableProducer/candidateCreator2Prong.cxx | 63 +++++++++---------- .../TableProducer/candidateCreator3Prong.cxx | 62 +++++++++--------- .../TableProducer/candidateCreatorCascade.cxx | 29 +++++---- PWGHF/TableProducer/candidateCreatorDstar.cxx | 10 +-- .../candidateCreatorXic0Omegac0.cxx | 49 +++++++-------- .../candidateCreatorXicToXiPiPi.cxx | 39 ++++++------ 6 files changed, 124 insertions(+), 128 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 5f7565e6b68..bff41fee008 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -20,39 +20,38 @@ #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) #endif -#include -#include -#include - -#include -#include -#include -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsMcGen.h" +#include "PWGHF/Utils/utilsPid.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" +#include "PWGLF/DataModel/mcCentrality.h" -#include +#include "Common/Core/trackUtilities.h" +#include "Tools/KFparticle/KFUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Tools/KFparticle/KFUtilities.h" +#include -#include "PWGLF/DataModel/mcCentrality.h" +#include +#include +#include +#include +#include -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsMcGen.h" -#include "PWGHF/Utils/utilsPid.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include +#include +#include using namespace o2; using namespace o2::analysis; @@ -182,11 +181,11 @@ struct HfCandidateCreator2Prong { setLabelHistoCands(hCandidates); } - template + template void runCreator2ProngWithDCAFitterN(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - BCs const& bcs) + BCsType const& bcs) { // loop over pairs of track indices for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -194,7 +193,7 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -208,7 +207,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -330,11 +329,11 @@ struct HfCandidateCreator2Prong { } } - template + template void runCreator2ProngWithKFParticle(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - BCs const& bcs) + BCsType const& bcs) { for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -342,7 +341,7 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -354,7 +353,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -653,7 +652,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -671,7 +670,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index c5343123881..c37a3e94d56 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -19,40 +19,39 @@ #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) #endif -#include -#include -#include -#include - -#include -#include -#include -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsMcGen.h" +#include "PWGHF/Utils/utilsPid.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" +#include "PWGLF/DataModel/mcCentrality.h" -#include +#include "Common/Core/trackUtilities.h" +#include "Tools/KFparticle/KFUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Tools/KFparticle/KFUtilities.h" +#include -#include "PWGLF/DataModel/mcCentrality.h" +#include +#include +#include +#include +#include -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/DecayChannels.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsMcGen.h" -#include "PWGHF/Utils/utilsPid.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include +#include +#include +#include using namespace o2; using namespace o2::hf_evsel; @@ -126,6 +125,7 @@ struct HfCandidateCreator3Prong { using FilteredHf3Prongs = soa::Filtered; using FilteredPvRefitHf3Prongs = soa::Filtered>; using TracksWCovExtraPidPiKaPr = soa::Join; + // filter candidates Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi))) != static_cast(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi))) != static_cast(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast(0)); @@ -234,11 +234,11 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - BCs const& bcs) + BCsType const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { @@ -246,7 +246,7 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -262,7 +262,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -402,17 +402,17 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - BCs const& bcs) + BCsType const& bcs) { for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -425,7 +425,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 664b544d29c..1f2000022bd 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -15,32 +15,31 @@ /// \author Chiara Zampolli, , CERN /// Paul Buehler, , Vienna -#include -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" -#include +#include "Common/Core/trackUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" - -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" +#include +#include +#include using namespace o2; using namespace o2::analysis; diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index bbd7b419f19..ecf0ef506e6 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -27,8 +27,8 @@ #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" // O2Physics #include "Common/Core/trackUtilities.h" // PWGLF @@ -186,12 +186,12 @@ struct HfCandidateCreatorDstar { /// @param rowsTrackIndexD0 D0 table object from trackIndexSkimCreator.cxx /// @param tracks track table with Cov object /// @param bcWithTimeStamps Bunch Crossing with timestamps - template + template void runCreatorDstar(Coll const&, CandsDstar const& rowsTrackIndexDstar, aod::Hf2Prongs const&, TracksWCovExtraPidPiKa const&, - BCs const& bcs) + BCsType const& bcs) { // LOG(info) << "runCreatorDstar function called"; // LOG(info) << "candidate loop starts"; @@ -201,7 +201,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -228,7 +228,7 @@ struct HfCandidateCreatorDstar { //..................................................Doubt: Should I apply a condition of (collisionPiId == collisionD0Id) /// Set the magnetic field from ccdb. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { // LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index eaffaa13c88..05de60b3f6c 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -27,42 +27,41 @@ #include /// includes KFParticle -#include "KFParticle.h" -#include "KFParticleBase.h" -#include "KFPTrack.h" -#include "KFPVertex.h" -#include "KFVertex.h" +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Tools/KFparticle/KFUtilities.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" -#include "DCAFitter/DCAFitterN.h" #include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/Track.h" #include "ReconstructionDataFormats/V0.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Tools/KFparticle/KFUtilities.h" - -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" - -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include "KFPTrack.h" +#include "KFPVertex.h" +#include "KFParticle.h" +#include "KFParticleBase.h" +#include "KFVertex.h" using namespace o2; using namespace o2::track; @@ -1875,7 +1874,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1892,7 +1891,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 4e4cfaa5925..5dcb3a01f55 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -21,37 +21,36 @@ #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) #endif -#include -#include -#include -#include - -#include -#include -#include -#include -#include +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" -#include +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Tools/KFparticle/KFUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Tools/KFparticle/KFUtilities.h" +#include -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include +#include +#include +#include +#include -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include +#include +#include +#include using namespace o2; using namespace o2::constants::physics; From 409ff585951b617434ad85a73188973acc0acee3 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 14:16:37 +0200 Subject: [PATCH 112/116] fix a typo --- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 1e062dd8d47..ad85ac61fb8 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -16,22 +16,22 @@ /// \author Wu Chuntai, CUG, China /// \author Ran Tu, Fudan University, China -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "Common/Core/EventPlaneHelper.h" +#include "Common/DataModel/Qvectors.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/Qvectors.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include +#include using namespace o2; using namespace o2::aod; @@ -422,7 +422,7 @@ struct HfTaskFlowCharmHadrons { float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections From 06e38b5d2ed42aaff1daf644429784c739f5e038 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 14:36:08 +0200 Subject: [PATCH 113/116] fix format --- .../dataCreatorCharmResoReduced.cxx | 36 ++++++------ .../HFC/TableProducer/femtoDreamProducer.cxx | 37 ++++++------- .../candidateCreatorXic0Omegac0.cxx | 6 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 55 +++++++++---------- PWGHF/Tasks/taskMcValidation.cxx | 33 ++++++----- PWGHF/Tasks/taskPidStudies.cxx | 29 +++++----- 6 files changed, 95 insertions(+), 101 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index ddc180c0b38..7283dd41855 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -15,11 +15,18 @@ /// \author Luca Aglietta , UniTO Turin /// \author Fabrizio Grosa , CERN -#include -#include -#include -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -29,20 +36,11 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGLF/DataModel/LFStrangenessTables.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" - -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::analysis; diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index a5a3eb02ad8..7c4560a663b 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -14,39 +14,36 @@ /// \author Ravindra Singh, GSI, ravindra.singh@cern.ch /// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch -#include -#include - -#include "TMCProcess.h" - -#include "CCDB/BasicCCDBManager.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseLcToPKPi.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.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 "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/Propagator.h" - #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "TMCProcess.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/HfMlResponseLcToPKPi.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" +#include +#include using namespace o2; using namespace o2::framework; @@ -410,7 +407,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 05de60b3f6c..204b46e7588 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -407,7 +407,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -741,7 +741,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1219,7 +1219,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 3e2d4396b0e..925dd224744 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -21,23 +21,13 @@ /// \author Federica Zanone , Heidelberg University /// \author Ruiqi Yin , Fudan University -#include // std::find -#include // std::distance -#include // std::string -#include // std::vector - -#include "CommonConstants/PhysicsConstants.h" -#include "CCDB/BasicCCDBManager.h" // for PV refit -#include "DataFormatsParameters/GRPMagField.h" // for PV refit -#include "DataFormatsParameters/GRPObject.h" // for PV refit -#include "DCAFitter/DCAFitterN.h" -#include "DetectorsBase/Propagator.h" // for PV refit -#include "DetectorsVertexing/PVertexer.h" // for PV refit -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/V0.h" -#include "ReconstructionDataFormats/Vertex.h" // for PV refit +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsAnalysis.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/TrackSelectorPID.h" #include "Common/Core/trackUtilities.h" @@ -47,14 +37,23 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Tools/ML/MlResponse.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "CCDB/BasicCCDBManager.h" // for PV refit +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" // for PV refit +#include "DataFormatsParameters/GRPObject.h" // for PV refit +#include "DetectorsBase/Propagator.h" // for PV refit +#include "DetectorsVertexing/PVertexer.h" // for PV refit +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/V0.h" +#include "ReconstructionDataFormats/Vertex.h" // for PV refit -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsAnalysis.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include // std::find +#include // std::distance +#include // std::string +#include // std::vector using namespace o2; using namespace o2::analysis; @@ -132,17 +131,17 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with - template - void selectCollision(const Col& collision, const BCs& bcs) + template + void selectCollision(const Col& collision, const BCsType& bcs) { float centrality = -1.; uint32_t rejectionMask; if constexpr (applyUPCSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( + rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry, &bcs); } else { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( + rejectionMask = hfEvSel.getHfCollisionRejectionMask( collision, centrality, ccdb, registry, nullptr); } diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index a8689400cea..d62c83ac4ee 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -18,27 +18,26 @@ /// \author Fabrizio Grosa , CERN /// \author Fabio Catalano , CERN -#include -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/mcCentrality.h" + +#include "Common/DataModel/CollisionAssociationTables.h" +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "PWGLF/DataModel/mcCentrality.h" - -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include +#include +#include using namespace o2; using namespace o2::analysis; @@ -818,7 +817,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -848,7 +847,7 @@ struct HfTaskMcValidationRec { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1049,7 +1048,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 2930b03de54..9233e22c0d3 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -17,26 +17,27 @@ /// \author Marcello Di Costanzo , Politecnico and INFN Torino /// \author Luca Aglietta , Università and INFN Torino -#include -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "TPDGCode.h" +#include "Common/CCDB/ctpRateFetcher.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 "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" -#include "Common/CCDB/ctpRateFetcher.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Core/CentralityEstimation.h" +#include "TPDGCode.h" + +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; From bcd892185a350673e7b7b4805ebebbec4e8bf104 Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 15:15:23 +0200 Subject: [PATCH 114/116] directly setting the preselection values --- PWGHF/Utils/utilsEvSelHf.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index e5c67721eac..c12c0b67f56 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -200,18 +200,6 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; static constexpr char NameHistUPC[] = "hUPCollisions"; - // UPC preselection - static constexpr int dtCollNMin{1}; // Minimum number of sigma around the collision - static constexpr int bcsNMin{2}; // Minimum number of bunch crossings (BCs) - static constexpr int trackNMin{2}; // Minimum number of PV contributors - static constexpr int trackNMax{1000}; // Maximum number of PV contributors - static constexpr float fitTimeNsMax{34.f}; // Maximum FIT time in ns - static constexpr float ampFV0Threshold{-1.f}; // FV0 amplitude threshold (-1 = no requirement) - static constexpr float ampFT0AThreshold{150.f}; // FT0A amplitude threshold - static constexpr float ampFT0CThreshold{50.f}; // FT0C amplitude threshold - static constexpr float ampFDDAThreshold{-1.f}; // FDDA amplitude threshold - static constexpr float ampFDDCThreshold{-1.f}; // FDDC amplitude threshold - std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUPCollisions; std::shared_ptr hCollisionsCentOcc; @@ -227,15 +215,14 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SGCutParHolder setSGPreselection() { SGCutParHolder sgCuts; - sgCuts.SetNDtcoll(dtCollNMin); - sgCuts.SetMinNBCs(bcsNMin); - sgCuts.SetNTracks(trackNMin, trackNMax); - sgCuts.SetMaxFITtime(fitTimeNsMax); - sgCuts.SetFITAmpLimits({ampFV0Threshold, - ampFT0AThreshold, - ampFT0CThreshold, - ampFDDAThreshold, - ampFDDCThreshold}); + sgCuts.SetNDtColl(1); // Minimum number of sigma around the collision + sgCuts.SetMinNBCs(2); // Minimum number of bunch crossings + sgCuts.SetNTracks(2, 1000); // Minimum and maximum number of PV contributors + sgCuts.SetMaxFitTime(34.f); // Maximum FIT time in ns + + // Set FIT amplitudes: FV0, FT0A, FT0C, FDDA, FDDC + sgCuts.SetFitAmpLimits({-1.f, 150.f, 50.f, -1.f, -1.f}); + return sgCuts; } From 70dcaa62974baf447b028ca1f2928d1595b4dced Mon Sep 17 00:00:00 2001 From: BiaoZhang Date: Thu, 19 Jun 2025 20:45:44 +0200 Subject: [PATCH 115/116] add a rejection function for UPC and avoid run2 case --- PWGHF/D2H/TableProducer/CMakeLists.txt | 6 +- .../dataCreatorCharmHadPiReduced.cxx | 3133 ++++++++--------- .../dataCreatorCharmResoReduced.cxx | 84 +- PWGHF/D2H/Tasks/CMakeLists.txt | 2 +- PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx | 184 +- PWGHF/D2H/Utils/utilsRedDataFormat.h | 37 +- PWGHF/HFC/TableProducer/CMakeLists.txt | 2 +- .../HFC/TableProducer/femtoDreamProducer.cxx | 37 +- PWGHF/TableProducer/CMakeLists.txt | 8 +- .../TableProducer/candidateCreator2Prong.cxx | 157 +- .../TableProducer/candidateCreator3Prong.cxx | 183 +- .../TableProducer/candidateCreatorCascade.cxx | 68 +- PWGHF/TableProducer/candidateCreatorDstar.cxx | 61 +- .../candidateCreatorXic0Omegac0.cxx | 57 +- .../candidateCreatorXicToXiPiPi.cxx | 49 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 6 +- PWGHF/Tasks/CMakeLists.txt | 4 +- PWGHF/Tasks/taskMcValidation.cxx | 33 +- PWGHF/Tasks/taskPidStudies.cxx | 30 +- PWGHF/Utils/utilsEvSelHf.h | 48 +- 20 files changed, 2049 insertions(+), 2140 deletions(-) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 20875d8fd41..a60ab1d78ab 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -67,17 +67,17 @@ o2physics_add_dpl_workflow(candidate-selector-lb-to-lc-pi-reduced o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced SOURCES dataCreatorCharmHadPiReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-charm-reso-reduced SOURCES dataCreatorCharmResoReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(data-creator-jpsi-had-reduced SOURCES dataCreatorJpsiHadReduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) # Converters diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 59f4d75238c..ea8e77a7eaa 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -9,42 +9,40 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file dataCreatorCharmHadPiReduced.cxx -/// \brief Creation of CharmHadron-Pi pairs for Beauty hadron analyses +/// \file dataCreatorCharmResoReduced.cxx +/// \brief Creation of D-V0 pairs /// -/// \author Alexandre Bigot , IPHC Strasbourg -/// \author Antonio Palasciano , Università degli Studi di Bari +/// \author Luca Aglietta , UniTO Turin /// \author Fabrizio Grosa , CERN -/// \author Fabio Catalano , CERN -/// \author Biao Zhang , Heidelberg University -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/Qvectors.h" +#include +#include +#include +#include +#include #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" +#include "DetectorsBase/Propagator.h" #include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include -#include -#include -#include -#include +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" using namespace o2; using namespace o2::analysis; @@ -52,1044 +50,867 @@ using namespace o2::aod; using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; -using namespace o2::hf_trkcandsel; +// event types enum Event : uint8_t { Processed = 0, - NoCharmHadPiSelected, - CharmHadPiSelected, + NoDV0Selected, + DV0Selected, kNEvent }; enum DecayChannel : uint8_t { - B0ToDminusPi = 0, - BplusToD0barPi, - BsToDsminusPi, - LbToLcplusPi + DstarV0 = 0, + DplusV0, + DstarTrack }; -enum WrongCollisionType : uint8_t { - None = 0, - WrongAssociation, - SplitCollision, +enum BachelorType : uint8_t { + K0s = 0, + Lambda, + AntiLambda, + Track }; -/// Creation of CharmHad-Pi pairs for Beauty hadrons -struct HfDataCreatorCharmHadPiReduced { - // Produces AOD tables to store track information - // collision related tables - Produces hfReducedCollision; - Produces hfReducedCollCentrality; - Produces hfReducedQvector; - Produces hfReducedCollExtra; - Produces hfCollisionCounter; - // Pi bachelor related tables - Produces hfTrackPion; - Produces hfTrackCovPion; - Produces hfTrackPidPion; - // charm hadron related tables - Produces hfCand2Prong; - Produces hfCand2ProngCov; - Produces hfCand2ProngMl; - Produces hfCand3Prong; - Produces hfCand3ProngCov; - Produces hfCand3ProngMl; - // PID tables for charm-hadron candidate daughter tracks - Produces hfCandPidProng0; - Produces hfCandPidProng1; - Produces hfCandPidProng2; - - // B-hadron config and MC related tables - Produces rowCandidateConfigB0; - Produces rowHfDPiMcRecReduced; - Produces rowHfDPiMcCheckReduced; - Produces rowHfB0McGenReduced; - - Produces rowCandidateConfigBplus; - Produces rowHfD0PiMcRecReduced; - Produces rowHfD0PiMcCheckReduced; - Produces rowHfBpMcGenReduced; - - Produces rowCandidateConfigBs; - Produces rowHfDsPiMcRecReduced; - Produces rowHfDsPiMcCheckReduced; - Produces rowHfBsMcGenReduced; - - Produces rowCandidateConfigLb; - Produces rowHfLcPiMcRecReduced; - Produces rowHfLcPiMcCheckReduced; - Produces rowHfLbMcGenReduced; - - // vertexing - struct : o2::framework::ConfigurableGroup { - // Configurable bz{"bz", 5., "magnetic field"}; - Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; - Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; - Configurable useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; - Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; - Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; - Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any B0 is smaller than this"}; - Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"}; - } vertexConfigurations; - // selection - struct : o2::framework::ConfigurableGroup { - Configurable usePionIsGlobalTrackWoDCA{"usePionIsGlobalTrackWoDCA", true, "check isGlobalTrackWoDCA status for pions, for Run3 studies"}; - Configurable ptPionMin{"ptPionMin", 0.5, "minimum pion pT threshold (GeV/c)"}; - Configurable etaPionMax{"etaPionMax", 0.8, "maximum pion absolute eta threshold"}; - Configurable> binsPtPion{"binsPtPion", std::vector{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for pion DCA XY pT-dependent cut"}; - Configurable> cutsTrackPionDCA{"cutsTrackPionDCA", {hf_cuts_single_track::CutsTrack[0], hf_cuts_single_track::NBinsPtTrack, hf_cuts_single_track::NCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for pions"}; - } trackPionConfigurations; - Configurable invMassWindowCharmHadPi{"invMassWindowCharmHadPi", 0.3, "invariant-mass window for CharmHad-Pi pair preselections (GeV/c2)"}; - - struct : o2::framework::ConfigurableGroup { - Configurable selectionFlagDplus{"selectionFlagDplus", 7, "Selection Flag for D+"}; - Configurable selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds"}; +enum DType : uint8_t { + Dplus = 1, + Dstar, + D0 +}; + +enum PairingType : uint8_t { + V0Only, + TrackOnly, + V0AndTrack +}; + +enum D0Sel : uint8_t { + selectedD0 = 0, + selectedD0Bar +}; + +enum DecayTypeMc : uint8_t { + Ds1ToDstarK0ToD0PiK0s = 1, + Ds2StarToDplusK0sToPiKaPiPiPi, + Ds1ToDstarK0ToDplusPi0K0s, + Ds1ToDstarK0ToD0PiK0sPart, + Ds1ToDstarK0ToD0NoPiK0sPart, + Ds1ToDstarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu +}; + +enum PartialMatchMc : uint8_t { + K0Matched = 0, + D0Matched, + DstarMatched, + DplusMatched, + K0MuMatched, + DstarMuMatched +}; + +/// Creation of D-V0 pairs +struct HfDataCreatorCharmResoReduced { + + // Produces AOD tables to store collision information + Produces hfReducedCollision; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + Produces hfCollisionCounter; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + // tracks, V0 and D candidates reduced tables + Produces hfCandV0; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + Produces hfTrackNoParam; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + Produces hfCandD3Pr; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + Produces hfCandD2Pr; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + // ML optional Tables + Produces hfCandD3PrMl; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + Produces hfCandD2PrMl; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + // MC Tables + Produces rowHfDV0McRecReduced; + Produces rowHfResoMcGenReduced; + + // selection D + struct : ConfigurableGroup { + std::string prefix = "dmesons"; + Configurable selectionFlagDplus{"selectionFlagDplus", 7, "Selection Flag for D"}; + Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 & Pi"}; Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; - } hfflagConfigurations; - // magnetic field setting from CCDB + Configurable selectionFlagD0Bar{"selectionFlagD0Bar", 1, "Selection Flag for D0bar"}; + } cfgDmesCuts; + + // selection V0 + struct : ConfigurableGroup { + std::string prefix = "v0s"; + Configurable deltaMassK0s{"deltaMassK0s", 0.02, "delta mass cut for K0S"}; + Configurable deltaMassLambda{"deltaMassLambda", 0.01, "delta mass cut for Lambda"}; + Configurable etaMax{"etaMax", 0.8f, "maximum eta"}; + Configurable etaMaxDau{"etaMaxDau", 5.f, "maximum eta V0 daughters"}; + Configurable trackNclusItsCut{"trackNclusItsCut", 0, "Minimum number of ITS clusters for V0 daughter"}; + Configurable trackNCrossedRowsTpc{"trackNCrossedRowsTpc", 50, "Minimum TPC crossed rows"}; + Configurable trackNsharedClusTpc{"trackNsharedClusTpc", 1000, "Maximum number of shared TPC clusters for V0 daughter"}; + Configurable trackFracMaxindableTpcCls{"trackFracMaxindableTpcCls", 0.8f, "Maximum fraction of findable TPC clusters for V0 daughter"}; + Configurable dcaDau{"dcaDau", 1.f, "DCA V0 daughters"}; + Configurable dcaMaxDauToPv{"dcaMaxDauToPv", 0.1f, "Maximum daughter's DCA to PV"}; + Configurable dcaPv{"dcaPv", 1.f, "DCA V0 to PV"}; + Configurable cosPa{"cosPa", 0.99f, "V0 CosPA"}; + Configurable radiusMin{"radiusMin", 0.9f, "Minimum v0 radius accepted"}; + Configurable nSigmaTpc{"nSigmaTpc", 4.f, "Nsigmatpc"}; + Configurable nSigmaTofPr{"nSigmaTofPr", 4.f, "N sigma TOF for protons only"}; + } cfgV0Cuts; + + // selection single tracks + struct : ConfigurableGroup { + std::string prefix = "single_tracks"; + 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"}; + Configurable maxNsigmaTpcPi{"maxNsigmaTpcPi", -1., "maximum pion NSigma in TPC for single tracks to be paired with D mesons; set negative to reject"}; + Configurable maxNsigmaTpcKa{"maxNsigmaTpcKa", -1., "maximum kaon NSigma in TPC for single tracks to be paired with D mesons; set negative to reject"}; + Configurable maxNsigmaTpcPr{"maxNsigmaTpcPr", 3., "maximum proton NSigma in TPC for single tracks to be paired with D mesons; set negative to reject"}; + } cfgSingleTrackCuts; + + // QA histograms + struct : ConfigurableGroup { + 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"}; + Configurable cutMassDMin{"cutMassDMin", 1.83, "minimum mass for D0 and Dplus candidates"}; + Configurable cutMassDMax{"cutMassDMax", 1.92, "maximum mass for D0 and Dplus candidates"}; + Configurable cutMassK0sMin{"cutMassK0sMin", 0.485, "minimum mass for K0s candidates"}; + Configurable cutMassK0sMax{"cutMassK0sMax", 0.509, "maximum mass for K0s candidates"}; + Configurable cutMassLambdaMin{"cutMassLambdaMin", 1.11, "minimum mass for Lambda candidates"}; + Configurable cutMassLambdaMax{"cutMassLambdaMax", 1.12, "maximum mass for Lambda candidates"}; + } cfgQaPlots; + // other configurables Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - - // MC extra - Configurable checkDecayTypeMc{"checkDecayTypeMc", false, "flag to enable MC checks on decay type"}; + Configurable propagateV0toPV{"propagateV0toPV", false, "Enable or disable V0 propagation to V0"}; + Configurable doMcRecQa{"doMcRecQa", true, "Fill QA histograms for Mc matching"}; + Configurable rejectPairsWithCommonDaughter{"rejectPairsWithCommonDaughter", true, "flag to reject already at this stage the pairs that share a daughter track"}; HfHelper hfHelper; o2::hf_evsel::HfEventSelection hfEvSel; // CCDB service + o2::ccdb::CcdbApi ccdbApi; Service ccdb; - o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - int runNumber; - - // O2DatabasePDG service - Service pdg; - - double massPi{0.}; - double massC{0.}; - double massB{0.}; - double invMass2ChHadPiMin{0.}; - double invMass2ChHadPiMax{0.}; double bz{0.}; - static constexpr std::size_t NDaughtersDs{2u}; - bool isHfCandBhadConfigFilled = false; + int runNumber{0}; // needed to detect if the run changed and trigger update of calibrations etc. - // Fitter to redo D-vertex to get extrapolated daughter tracks (2/3-prong vertex filter) - o2::vertexing::DCAFitterN<3> df3; - o2::vertexing::DCAFitterN<2> df2; + // material correction for track propagation + o2::base::MatLayerCylSet* lut; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - using TracksPid = soa::Join; // TODO: revert to pion only once the Nsigma variables for the charm-hadron candidate daughters are in the candidate table for 3 prongs too - using TracksPidWithSel = soa::Join; - using TracksPidWithSelAndMc = soa::Join; + // O2DatabasePDG service + Service pdg; - using CandsDplusFiltered = soa::Filtered>; - using CandsDplusFilteredWithMl = soa::Filtered>; - using CandsDsFiltered = soa::Filtered>; - using CandsDsFilteredWithMl = soa::Filtered>; + // vertex fitter + o2::vertexing::DCAFitterN<2> fitter; + + // Helper struct to pass V0 informations + struct { + std::array pos; + std::array mom; + std::array momPos; + std::array momNeg; + float pT; + float cosPA; + float dcaV0ToPv; + float dcaDau; + float alpha; + float eta; + float radius; + float mK0Short; + float mLambda; + uint8_t v0Type; + } candidateV0; + + struct { + float invMassD; + float ptD; + float invMassD0; + float invMassD0Bar; + float invMassReso; + float ptReso; + int8_t signD; + std::array pVectorProng0; + std::array pVectorProng1; + std::array pVectorProng2; + } varUtils; + + using CandsDplusFiltered = soa::Filtered>; + using CandsDplusFilteredWithMl = soa::Filtered>; + using CandsDstarFiltered = soa::Filtered>; + using CandsDstarFilteredWithMl = soa::Filtered>; using CandsD0Filtered = soa::Filtered>; using CandsD0FilteredWithMl = soa::Filtered>; - using CandsLcFiltered = soa::Filtered>; - using CandsLcFilteredWithMl = soa::Filtered>; - - using CollisionsWCent = soa::Join; - using CollisionsWCentAndMcLabels = soa::Join; - using CollisionsWCentAndQvectors = soa::Join; - - Filter filterSelectDplusCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= hfflagConfigurations.selectionFlagDplus); - Filter filterSelectDsCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi >= hfflagConfigurations.selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= hfflagConfigurations.selectionFlagDs); - Filter filterSelectDzeroCandidates = (aod::hf_sel_candidate_d0::isSelD0 >= hfflagConfigurations.selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= hfflagConfigurations.selectionFlagD0bar); - Filter filterSelectLcCandidates = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= hfflagConfigurations.selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= hfflagConfigurations.selectionFlagLc); - - Preslice candsDplusPerCollision = aod::track_association::collisionId; - Preslice candsDplusPerCollisionWithMl = aod::track_association::collisionId; - Preslice candsDsPerCollision = aod::track_association::collisionId; - Preslice candsDsPerCollisionWithMl = aod::track_association::collisionId; - Preslice candsD0PerCollision = aod::track_association::collisionId; - Preslice candsD0PerCollisionWithMl = aod::track_association::collisionId; - Preslice candsLcPerCollision = aod::track_association::collisionId; - Preslice candsLcPerCollisionWithMl = aod::track_association::collisionId; + using TracksWithPID = soa::Join; + using TracksIUWithPID = soa::Join; + using TracksIUWithPIDAndMC = soa::Join; + + Filter filterSelectDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= cfgDmesCuts.selectionFlagDplus); + Filter filterSelectedCandDstar = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == cfgDmesCuts.selectionFlagDstarToD0Pi); + Filter filterSelectD0Candidates = (aod::hf_sel_candidate_d0::isSelD0 >= cfgDmesCuts.selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= cfgDmesCuts.selectionFlagD0Bar); + + Preslice candsDplusPerCollision = aod::hf_cand::collisionId; + Preslice candsDplusPerCollisionWithMl = aod::hf_cand::collisionId; + Preslice candsDstarPerCollision = aod::hf_cand::collisionId; + Preslice candsDstarPerCollisionWithMl = aod::hf_cand::collisionId; + Preslice candsD0PerCollision = aod::hf_cand::collisionId; + Preslice candsD0PerCollisionWithMl = aod::hf_cand::collisionId; + Preslice candsV0PerCollision = aod::v0::collisionId; Preslice trackIndicesPerCollision = aod::track_association::collisionId; - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc; HistogramRegistry registry{"registry"}; - std::array arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± - std::array arrPDGResonantDKstarK = {kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± - void init(InitContext const&) { - std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, - doprocessDsPiData, doprocessDsPiDataWithMl, doprocessDsPiMc, doprocessDsPiMcWithMl, - doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiMc, doprocessD0PiMcWithMl, - doprocessLcPiData, doprocessLcPiDataWithMl, doprocessLcPiMc, doprocessLcPiMcWithMl}; - if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { - LOGP(fatal, "One and only one process function can be enabled at a time, please fix your configuration!"); - } - - // invariant-mass window cut - massPi = MassPiPlus; - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { - massC = MassDMinus; - massB = MassB0; - } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { - massC = MassDS; - massB = MassBS; - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { - massC = MassD0; - massB = MassBPlus; - } else if (doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { - massC = MassLambdaCPlus; - massB = MassLambdaB0; - } - invMass2ChHadPiMin = (massB - invMassWindowCharmHadPi) * (massB - invMassWindowCharmHadPi); - invMass2ChHadPiMax = (massB + invMassWindowCharmHadPi) * (massB + invMassWindowCharmHadPi); - - // Initialize fitter - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl || - doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl || doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { - df3.setPropagateToPCA(vertexConfigurations.propagateToPCA); - df3.setMaxR(vertexConfigurations.maxR); - df3.setMaxDZIni(vertexConfigurations.maxDZIni); - df3.setMinParamChange(vertexConfigurations.minParamChange); - df3.setMinRelChi2Change(vertexConfigurations.minRelChi2Change); - df3.setUseAbsDCA(vertexConfigurations.useAbsDCA); - df3.setWeightedFinalPCA(vertexConfigurations.useWeightedFinalPCA); - df3.setMatCorrType(noMatCorr); - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { - df2.setPropagateToPCA(vertexConfigurations.propagateToPCA); - df2.setMaxR(vertexConfigurations.maxR); - df2.setMaxDZIni(vertexConfigurations.maxDZIni); - df2.setMinParamChange(vertexConfigurations.minParamChange); - df2.setMinRelChi2Change(vertexConfigurations.minRelChi2Change); - df2.setUseAbsDCA(vertexConfigurations.useAbsDCA); - df2.setWeightedFinalPCA(vertexConfigurations.useWeightedFinalPCA); - df2.setMatCorrType(noMatCorr); - } - - // Configure CCDB access - ccdb->setURL(ccdbUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - runNumber = 0; - // histograms constexpr int kNBinsEvents = kNEvent; std::string labels[kNBinsEvents]; labels[Event::Processed] = "processed"; - labels[Event::NoCharmHadPiSelected] = "without CharmHad-Pi pairs"; - labels[Event::CharmHadPiSelected] = "with CharmHad-Pi pairs"; + labels[Event::NoDV0Selected] = "without DV0 pairs"; + labels[Event::DV0Selected] = "with DV0 pairs"; static const AxisSpec axisEvents = {kNBinsEvents, 0.5, kNBinsEvents + 0.5, ""}; - registry.add("hEvents", "Events;;entries", HistType::kTH1F, {axisEvents}); + registry.add("hEvents", "Events;;entries", HistType::kTH1D, {axisEvents}); for (int iBin = 0; iBin < kNBinsEvents; iBin++) { registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - std::string charmHadTitle = ""; - std::string histMassTitle = ""; - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { - charmHadTitle = "D^{#plus}"; - histMassTitle = "Dplus"; - registry.add("hMassDplus", "D^{#plus} candidates; #it{M}(K#pi#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { - charmHadTitle = "D_{s}^{#plus}"; - histMassTitle = "Ds"; - registry.add("hMassDsToKKPi", "D_{s}^{#plus} to KKpi candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - registry.add("hMassDsToPiKK", "D_{s}^{#plus} to piKK candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { - charmHadTitle = "D^{0}"; - histMassTitle = "D0"; - registry.add("hMassD0", "D^{0} candidates; #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - registry.add("hMassD0bar", "#overline{D}^{0} candidates; #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { - charmHadTitle = "#Lambda_{c}^{+}"; - histMassTitle = "Lc"; - registry.add("hMassLc", "#Lambda_{c}^{+} candidates; #it{M}(pK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); + const AxisSpec axisPt{50, 0.f, 50.f, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisP{100, 0.f, 10.f, "#it{p} (GeV/#it{c})"}; + const AxisSpec axisDeDx{500, 0.f, 1000.f, ""}; + const AxisSpec axisMassD0{200, 1.7f, 2.1f, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisMassDplus{200, 1.7f, 2.1f, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisMassDstar{200, 0.139f, 0.179f, "delta inv. mass (GeV/#it{c}^{2})"}; // o2-linter: disable=pdg/explicit-mass (false positive) + const AxisSpec axisMassLambda{100, 1.05f, 1.35f, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisMassKzero{100, 0.35f, 0.65f, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisDeltaMassToK{500, 0.49, 1.49, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisDeltaMassToPi{500, 0.13, 1.13, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisDeltaMassToPr{500, 0.93, 1.93, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisDeltaMassToLambda{500, 1.05, 2.05, "inv. mass (GeV/#it{c}^{2})"}; + const AxisSpec axisMassDsj{400, 0.49f, 0.89f, ""}; // Ds1 and Ds2Star legacy + registry.add("hMassVsPtDplusAll", "Dplus candidates (all, regardless the pairing with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarAll", "Dstar candidates (all, regardless the pairing with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtD0All", "D0 candidates (all, regardless the pairing with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassD0}}); + registry.add("hMassVsPtDplusPaired", "Dplus candidates (paired with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarPaired", "Dstar candidates (paired with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtD0Paired", "D0 candidates (paired with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassD0}}); + registry.add("hMassVsPtD0BarPaired", "D0 candidates (paired with V0s);#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassD0}}); + registry.add("hMassVsPtK0s", "K0^{s} candidates;#it{p}_{T} (GeV/#it{c});inv. mass (#pi^{#plus}#pi^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassKzero}}); + registry.add("hMassVsPtLambda", "Lambda candidates;#it{p}_{T} (GeV/#it{c});inv. mass (p #pi^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassLambda}}); + registry.add("hdEdxVsP", "Tracks;#it{p} (GeV/#it{c});d#it{E}/d#it{x};entries", {HistType::kTH2D, {axisP, axisDeDx}}); + registry.add("hDType", "D selection flag", {HistType::kTH1D, {{5, -2.5, 2.5}}}); + + // QA reso invariant mass histograms + registry.add("hMassD0Pi", "D0Pi candidates; m_{D^{0}#pi^{+}} - m_{D^{0}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPi}}); + registry.add("hMassD0K", "D0Kplus candidates; m_{D^{0}K^{+}} - m_{D^{0} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToK}}); + registry.add("hMassD0Proton", "D0Proton candidates; m_{D^{0}p} - m_{D^{0} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPr}}); + registry.add("hMassD0Lambda", "D0Lambda candidates; m_{D^{0}#Lambda} - m_{D^{0} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToLambda}}); + registry.add("hMassDstarPi", "DstarPi candidates; m_{D^{*+}#pi^{-}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPi}}); + registry.add("hMassDstarK", "DstarK candidates; m_{D^{*+}#pi^{-}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToK}}); + registry.add("hMassDstarProton", "DstarProton candidates; m_{D^{*}p} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPr}}); + registry.add("hMassDstarK0s", "DstarK0s candidates; m_{D^{*}K^{0}_{S}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToK}}); + registry.add("hMassDstarLambda", "DstarLambda candidates; m_{D^{*}#Lambda} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToLambda}}); + registry.add("hMassDplusK0s", "DplusK0s candidates; m_{D^{+}K^{0}_{S}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToK}}); + registry.add("hMassDplusPi", "DplusPi candidates; m_{D^{+}#pi^{-}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPi}}); + registry.add("hMassDplusK", "DplusK candidates; m_{D^{+}#pi^{-}} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToK}}); + registry.add("hMassDplusProton", "DplusProton candidates; m_{D^{+}p} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToPr}}); + registry.add("hMassDplusLambda", "DplusLambda candidates; m_{D^{+}#Lambda} (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisDeltaMassToLambda}}); + // MC Rec + registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1D, {{17, -8.5, 8.5}}}); + registry.add("hMCRecDebug", "Debug of MC Reco", {HistType::kTH1D, {{16, -0.5, 15.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}}}); + // MC Gen + registry.add("hMCGenCounter", "Number of Generated particles; Decay Channel Flag; pT [GeV/c]", {HistType::kTH2D, {{17, -8.5, 8.5}, {100, 0, 50}}}); + registry.add("hMCSignCounter", "Sign of Generated particles", {HistType::kTH1D, {{3, -1.5, 1.5}}}); + registry.add("hMCGenOrigin", "Origin of Generated particles", {HistType::kTH1D, {{3, -0.5, 2.5}}}); + registry.add("hMCOriginCounterWrongDecay", "Origin of Generated particles in Wrong decay", {HistType::kTH1D, {{3, -0.5, 2.5}}}); + + if (doMcRecQa) { + registry.add("hMassVsPtK0Matched", "K0s candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassKzero}}); + registry.add("hMassVsPtD0Matched", "D0 candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatched", "Dstar candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatched", "Dplus candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1Matched", "Ds1 candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatched", "Ds2Star candidates Matched ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtK0MatchedPiToMu", "K0s candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassKzero}}); + registry.add("hMassVsPtD0MatchedPiToMu", "D0 candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatchedPiToMu", "Dstar candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatchedPiToMu", "Dplus candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1MatchedPiToMu", "Ds1 candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatchedPiToMu", "Ds2Star candidates Matched with PiToMu decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtD0MatchedKaToPi", "D0 candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDstarMatchedKaToPi", "Dstar candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDstar}}); + registry.add("hMassVsPtDplusMatchedKaToPi", "Dplus candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDplus}}); + registry.add("hMassVsPtDs1MatchedKaToPi", "Ds1 candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); + registry.add("hMassVsPtDs2StarMatchedKaToPi", "Ds2Star candidates Matched with KaToPi decay ;#it{p}_{T} (GeV/#it{c});inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH2D, {axisPt, axisMassDsj}}); } - registry.add(Form("hPt%s", histMassTitle.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1D, {{100, 0., 10.}}}); - registry.add("hPtPion", "#pi^{#plus} candidates;#pi^{#plus} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{100, 0., 10.}}}); - registry.add(Form("hCpa%s", histMassTitle.data()), Form("%s candidates;%s cosine of pointing angle;entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1D, {{110, -1.1, 1.1}}}); - - /// candidate monitoring - hCandidatesD0 = registry.add("hCandidatesD0", "D0 candidate counter", {HistType::kTH1D, {axisCands}}); - hCandidatesDPlus = registry.add("hCandidatesDPlus", "Dplus candidate counter", {HistType::kTH1D, {axisCands}}); - hCandidatesDs = registry.add("hCandidatesDs", "Ds candidate counter", {HistType::kTH1D, {axisCands}}); - hCandidatesLc = registry.add("hCandidatesLc", "Lc candidate counter", {HistType::kTH1D, {axisCands}}); - - setLabelHistoCands(hCandidatesD0); - setLabelHistoCands(hCandidatesDPlus); - setLabelHistoCands(hCandidatesDs); - setLabelHistoCands(hCandidatesLc); + // Configure CCDB access + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init(ccdbUrl); + runNumber = 0; + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); + + // Configure DCA fitter + fitter.setPropagateToPCA(true); + fitter.setMaxR(200.); + fitter.setMinParamChange(1e-3); + fitter.setMinRelChi2Change(0.9); + fitter.setMaxDZIni(1e9); + fitter.setMaxDXYIni(4); + fitter.setMaxChi2(1e9); + fitter.setUseAbsDCA(true); + fitter.setWeightedFinalPCA(false); // init HF event selection helper hfEvSel.init(registry); } - /// Pion selection (D Pi <-- B0) - /// \param trackPion is a track with the pion hypothesis - /// \param trackParCovPion is the track parametrisation of the pion - /// \param dcaPion is the 2-D array with track DCAs of the pion - /// \param charmDautracks charm-hadron daughter tracks - /// \return true if trackPion passes all cuts - template - bool isPionSelected(const T1& trackPion, const T2& trackParCovPion, const T3& dcaPion, const std::vector& charmDautracks) + /// Basic track quality selections for V0 daughters + /// \param Tr is a track + /// \param dDaughtersIds are the IDs of the D meson daughter tracks + template + bool selectV0Daughter(Tr const& track, const std::array& dDaughtersIds) { - // check isGlobalTrackWoDCA status for pions if wanted - if (trackPionConfigurations.usePionIsGlobalTrackWoDCA && !trackPion.isGlobalTrackWoDCA()) { + // acceptance selection + if (std::abs(track.eta()) > cfgV0Cuts.etaMaxDau) { return false; } - // minimum pT and eta selection - if (trackParCovPion.getPt() < trackPionConfigurations.ptPionMin || std::abs(trackParCovPion.getEta()) > trackPionConfigurations.etaPionMax || !isSelectedTrackDCA(trackParCovPion, dcaPion, trackPionConfigurations.binsPtPion, trackPionConfigurations.cutsTrackPionDCA)) { + // Tpc Refit + if (!(track.hasTPC())) { return false; } - // reject pions that are charm-hadron daughters - for (const auto& track : charmDautracks) { - if (trackPion.globalIndex() == track.globalIndex()) { - return false; - } + // track quality selection + if (track.itsNCls() < cfgV0Cuts.trackNclusItsCut || + track.tpcNClsFound() < cfgV0Cuts.trackNCrossedRowsTpc || + track.tpcNClsCrossedRows() < cfgV0Cuts.trackNCrossedRowsTpc || + track.tpcNClsCrossedRows() < cfgV0Cuts.trackFracMaxindableTpcCls * track.tpcNClsFindable() || + track.tpcNClsShared() > cfgV0Cuts.trackNsharedClusTpc) { + return false; + } + // rejection of tracks that share a daughter with the D meson + if (rejectPairsWithCommonDaughter && std::find(dDaughtersIds.begin(), dDaughtersIds.end(), track.globalIndex()) != dDaughtersIds.end()) { + return false; } - return true; } - /// Calculates the index of the collision with the maximum number of contributions. - ///\param collisions are the collisions to search through. - ///\return The index of the collision with the maximum number of contributions. - template - int64_t getIndexCollisionMaxNumContrib(const CColl& collisions) + // Utility to find which v0 daughter carries the largest fraction of the mother longitudinal momentum + float alphaAP(std::array const& momA, std::array const& momB, std::array const& momC) { - unsigned maxNumContrib = 0; - int64_t indexCollisionMaxNumContrib = -1; - for (const auto& collision : collisions) { - if (collision.numContrib() > maxNumContrib) { - maxNumContrib = collision.numContrib(); - indexCollisionMaxNumContrib = collision.globalIndex(); - } + float momTot = std::sqrt(std::pow(momA[0], 2.) + std::pow(momA[1], 2.) + std::pow(momA[2], 2.)); + float lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot; + float lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot; + return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); + } + // Utility to find DCA of V0 to Primary vertex + float calculateDCAStraightToPV(float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) + { + return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz)); + } + /// Basic selection of V0 candidates + /// \param collision is the current collision + /// \param dauTracks are the v0 daughter tracks + /// \param dDaughtersIds are the IDs of the D meson daughter tracks + /// \return a bitmap with mass hypotesis if passes all cuts + template + bool buildAndSelectV0(const Coll& collision, const std::array& dDaughtersIds, const std::array& dauTracks) + { + auto trackPos = dauTracks[0]; + auto trackNeg = dauTracks[1]; + + // single-tracks selection + if (!selectV0Daughter(trackPos, dDaughtersIds) || !selectV0Daughter(trackNeg, dDaughtersIds)) + return false; + // daughters DCA to V0's collision primary vertex + std::array dcaInfo; + auto trackPosPar = getTrackPar(trackPos); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPosPar, 2.f, fitter.getMatCorrType(), &dcaInfo); + auto trackPosDcaXY = dcaInfo[0]; + auto trackNegPar = getTrackPar(trackNeg); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackNegPar, 2.f, fitter.getMatCorrType(), &dcaInfo); + auto trackNegDcaXY = dcaInfo[0]; + if (std::fabs(trackPosDcaXY) < cfgV0Cuts.dcaMaxDauToPv || std::fabs(trackNegDcaXY) < cfgV0Cuts.dcaMaxDauToPv) { + return false; + } + // vertex reconstruction + auto trackPosCov = getTrackParCov(trackPos); + auto trackNegCov = getTrackParCov(trackNeg); + int nCand = 0; + try { + nCand = fitter.process(trackPosCov, trackNegCov); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return false; + } + if (nCand == 0) { + return false; + } + // compute candidate momentum from tracks propagated to decay vertex + auto& trackPosProp = fitter.getTrack(0); + auto& trackNegProp = fitter.getTrack(1); + trackPosProp.getPxPyPzGlo(candidateV0.momPos); + trackNegProp.getPxPyPzGlo(candidateV0.momNeg); + for (int i = 0; i < 3; ++i) { // o2-linter: disable=magic-number (loop on xyz) + candidateV0.mom[i] = candidateV0.momPos[i] + candidateV0.momNeg[i]; + } + candidateV0.pT = std::hypot(candidateV0.mom[0], candidateV0.mom[1]); + // topological selections: + // v0 eta + candidateV0.eta = RecoDecay::eta(candidateV0.mom); + if (std::abs(candidateV0.eta) > cfgV0Cuts.etaMax) { + return false; + } + // daughters DCA + candidateV0.dcaDau = std::sqrt(fitter.getChi2AtPCACandidate()); + if (candidateV0.dcaDau > cfgV0Cuts.dcaDau) { + return false; + } + // v0 radius + const auto& vtx = fitter.getPCACandidate(); + candidateV0.radius = std::hypot(vtx[0], vtx[1]); + if (candidateV0.radius < cfgV0Cuts.radiusMin) { + return false; + } + for (int i = 0; i < 3; i++) { // o2-linter: disable=magic-number (loop on xyz) + candidateV0.pos[i] = vtx[i]; + } + // v0 DCA to primary vertex + candidateV0.dcaV0ToPv = calculateDCAStraightToPV( + vtx[0], vtx[1], vtx[2], + candidateV0.momPos[0] + candidateV0.momNeg[0], + candidateV0.momPos[1] + candidateV0.momNeg[1], + candidateV0.momPos[2] + candidateV0.momNeg[2], + collision.posX(), collision.posY(), collision.posZ()); + if (std::abs(candidateV0.dcaV0ToPv) > cfgV0Cuts.dcaPv) { + return false; + } + // v0 cosine of pointing angle + std::array primVtx = {collision.posX(), collision.posY(), collision.posZ()}; + candidateV0.cosPA = RecoDecay::cpa(primVtx, vtx, candidateV0.mom); + if (candidateV0.cosPA < cfgV0Cuts.cosPa) { + return false; + } + + // distinguish between K0s, and Lambda hypotesys + candidateV0.v0Type = {BIT(K0s) | BIT(Lambda) | BIT(AntiLambda)}; + // for lambda hypotesys define if its lambda or anti-lambda + candidateV0.alpha = alphaAP(candidateV0.mom, candidateV0.momPos, candidateV0.momNeg); + bool matter = candidateV0.alpha > 0; + CLRBIT(candidateV0.v0Type, matter ? AntiLambda : Lambda); + auto massPos = matter ? o2::constants::physics::MassProton : o2::constants::physics::MassPionCharged; + auto massNeg = matter ? o2::constants::physics::MassPionCharged : o2::constants::physics::MassProton; + // mass hypotesis + candidateV0.mLambda = RecoDecay::m(std::array{candidateV0.momPos, candidateV0.momNeg}, std::array{massPos, massNeg}); + candidateV0.mK0Short = RecoDecay::m(std::array{candidateV0.momPos, candidateV0.momNeg}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + if (std::fabs(candidateV0.mK0Short - MassK0) > cfgV0Cuts.deltaMassK0s) { + CLRBIT(candidateV0.v0Type, K0s); + } + if (std::fabs(candidateV0.mLambda - MassLambda0) > cfgV0Cuts.deltaMassLambda) { + CLRBIT(candidateV0.v0Type, Lambda); + CLRBIT(candidateV0.v0Type, AntiLambda); + } + // PID + if (TESTBIT(candidateV0.v0Type, K0s)) { + if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc) || + (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) + CLRBIT(candidateV0.v0Type, K0s); + } + if (TESTBIT(candidateV0.v0Type, Lambda)) { + if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPr()) > cfgV0Cuts.nSigmaTpc) || + (trackPos.hasTOF() && std::fabs(trackPos.tofNSigmaPr()) > cfgV0Cuts.nSigmaTofPr) || + (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc)) + CLRBIT(candidateV0.v0Type, Lambda); } - return indexCollisionMaxNumContrib; + if (TESTBIT(candidateV0.v0Type, AntiLambda)) { + if ((trackPos.hasTPC() && std::fabs(trackPos.tpcNSigmaPi()) > cfgV0Cuts.nSigmaTpc) || + (trackNeg.hasTPC() && std::fabs(trackNeg.tpcNSigmaPr()) > cfgV0Cuts.nSigmaTpc) || + (trackNeg.hasTOF() && std::fabs(trackNeg.tofNSigmaPr()) > cfgV0Cuts.nSigmaTofPr)) + CLRBIT(candidateV0.v0Type, AntiLambda); + } + if (candidateV0.v0Type == 0) { + return false; + } + return true; } - /// Checks if the B meson is associated with a different collision than the one it was generated in - /// \param particleMother is the mother particle - /// \param collision is the reconstructed collision - /// \param indexCollisionMaxNumContrib is the index of the collision associated with a given MC collision with the largest number of contributors. - /// \param flagWrongCollision is the flag indicating if whether the associated collision is incorrect. - template - void checkWrongCollision(const PParticle& particleMother, - const CColl& collision, - const int64_t& indexCollisionMaxNumContrib, - int8_t& flagWrongCollision) + /// Basic selection of tracks + /// \param track is the track + /// \param dDaughtersIds are the IDs of the D meson daughter tracks + /// \return true if passes all cuts + template + bool isTrackSelected(const Tr& track, const std::array& dDaughtersIds) { - if (particleMother.mcCollision().globalIndex() != collision.mcCollisionId()) { - flagWrongCollision = WrongCollisionType::WrongAssociation; - } else { - if (collision.globalIndex() != indexCollisionMaxNumContrib) { - flagWrongCollision = WrongCollisionType::SplitCollision; - } + if (rejectPairsWithCommonDaughter && std::find(dDaughtersIds.begin(), dDaughtersIds.end(), track.globalIndex()) != dDaughtersIds.end()) { + return false; + } + + switch (cfgSingleTrackCuts.setTrackSelections) { + case 1: + if (!track.isGlobalTrackWoDCA()) { + return false; + } + break; + case 2: + if (!track.isGlobalTrack()) { + return false; + } + break; + case 3: + if (!track.isQualityTrackITS()) { + return false; + } + break; + } + + if (track.pt() < cfgSingleTrackCuts.minPt) { + return false; + } + + if (std::abs(track.eta()) > cfgSingleTrackCuts.maxEta) { + return false; + } + + if (!track.hasTPC()) { + return false; + } + + bool isPion = std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi; + bool isKaon = std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa; + bool isProton = std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr; + + if (!isPion && !isKaon && !isProton) { // we keep the track if is it compatible with at least one of the PID hypotheses selected + return false; } + + return true; } /// Function for filling MC reco information in the tables /// \param particlesMc is the table with MC particles - /// \param vecDaughtersB is the vector with all daughter tracks (bachelor pion in last position) - /// \param indexHfCandCharm is the index of the charm-hadron candidate - /// \param selectedTracksPion is the map with the indices of selected bachelor pion tracks - template - void fillMcRecoInfo(const CColl& collision, - const PParticles& particlesMc, - const std::vector& vecDaughtersB, + /// \param vecDaughtersReso is the vector with all daughter tracks (bachelor pion in last position) + /// \param indexHfCandCharm is the index of the charm-hadron bachelor in the reduced table + /// \param indexCandV0 is the index of the v0 bachelor in the reduced table + template + void fillMcRecoInfo(const PParticles& particlesMc, + const std::vector& vecDaughtersReso, int& indexHfCandCharm, - std::map selectedTracksPion, - const int64_t indexCollisionMaxNumContrib) + int& indexCandV0) { - // we check the MC matching to be stored int8_t sign{0}; + int8_t signDstar{0}; + int8_t signDplus{0}; + int8_t signD0{0}; + int8_t signV0{0}; int8_t flag{0}; - int8_t flagWrongCollision{WrongCollisionType::None}; int8_t debug{0}; - int pdgCodeBeautyMother{-1}; - int pdgCodeCharmMother{-1}; - int pdgCodeProng0{0}; - int pdgCodeProng1{0}; - int pdgCodeProng2{0}; - int pdgCodeProng3{0}; + int8_t origin{0}; + int8_t nPiToMuReso{0}, nPiToMuV0, nPiToMuD0{0}, nPiToMuDstar{0}, nPiToMuDplus{0}; + int8_t nKaToPiReso{0}, nKaToPiV0, nKaToPiD0{0}, nKaToPiDstar{0}, nKaToPiDplus{0}; + std::vector idxBhadMothers{}; float motherPt{-1.f}; - - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - // B0 → D- π+ → (π- K+ π-) π+ - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // D- → π- K+ π- - // Printf("Checking D- → π- K+ π-"); - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kDMinus, std::array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi); - } else { - debug = 1; - LOGF(debug, "B0 decays in the expected final state but the condition on the intermediate state is not fulfilled"); - } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kB0, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + float invMassGen{-1.f}; + int indexRecReso{-1}, indexRecDstar{-1}, indexRecDplus{-1}, indexRecD0{-1}, indexRecK0{-1}, indexRecResoPartReco{-1}; + + if constexpr (dType == DType::Dstar) { + // Ds1 → D* K0 → (D0 π+) K0s → ((K-π+) π+)(π+π-) + indexRecD0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 1, &nPiToMuD0, &nKaToPiD0); + indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2, &nPiToMuV0, &nKaToPiV0); + if (indexRecD0 > -1) { + indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDstar, 2, &nPiToMuDstar, &nKaToPiDstar); + } + if (indexRecD0 > -1 && indexRecDstar > -1 && indexRecK0 > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3, &nPiToMuReso, &nKaToPiReso); + if (indexRecReso > -1 && nPiToMuReso == 0 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds1ToDstarK0ToD0PiK0s; + } else if (indexRecReso > -1 && nPiToMuReso >= 1 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds1ToDstarK0ToD0PiK0sOneMu; } } - // additional checks for correlated backgrounds - if (checkDecayTypeMc) { - // B0 → Ds- π+ → (K- K+ π-) π+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // Ds- → K- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDsPiToKKPiPi); - } - } - } - // Bs → Ds- π+ → (K- K+ π-) π+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // Ds- → K- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayTypeMc::BsToDsPiToKKPiPi); - } - } - } - // B0 → D- K+ → (π- K+ π-) K+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kPiPlus, +kKPlus, -kPiPlus, +kKPlus}, true, &sign, 3); - if (indexRec > -1) { - // D- → π- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kDMinus, std::array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDplusKToPiKPiK); - } - } - } - // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor - // convention: final state particles are prong0,1,2,3 - if (!flag) { - auto particleProng0 = vecDaughtersB[0].mcParticle(); - auto particleProng1 = vecDaughtersB[1].mcParticle(); - auto particleProng2 = vecDaughtersB[2].mcParticle(); - auto particleProng3 = vecDaughtersB[3].mcParticle(); - // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; - // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; - - for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); - - // look for common b-hadron ancestor - if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { - if (index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { - flag = BIT(hf_cand_b0::DecayTypeMc::PartlyRecoDecay); - pdgCodeBeautyMother = particlesMc.rawIteratorAt(index0Mother).pdgCode(); - pdgCodeCharmMother = 0; - pdgCodeProng0 = particleProng0.pdgCode(); - pdgCodeProng1 = particleProng1.pdgCode(); - pdgCodeProng2 = particleProng2.pdgCode(); - pdgCodeProng3 = particleProng3.pdgCode(); - // look for common c-hadron mother among prongs 0, 1 and 2 - for (const auto& cHadronMotherHypo : cHadronMotherHypos) { - int8_t depthMax = 2; - if (cHadronMotherHypo == Pdg::kDStar) { // to include D* -> D π0/γ and D* -> D0 π - depthMax += 1; - } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); - if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { - if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { - // pdgCodeCharmMother = - // Pdg::kDPlus (if D+ is the mother and does not come from D*+) - // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) - // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) - // Pdg::kDS (if Ds is the mother) - // Pdg::kLambdaCPlus (if Λc+ is the mother) - pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); - } - } + // Ds1+ not matched: we check if it is partially reco + if (indexRecReso < 0) { + indexRecResoPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDplus, 2); + if (indexRecResoPartReco > -1) { // we look for decays of D* or D0 with more daughters + if (indexRecDstar < 0 && indexRecK0 > -1) { + auto indexRecDstarPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDstar, 3); + if (indexRecDstarPartReco > -1) { + if (indexRecDplus > -1) { // Ds1 -> D* K0s -> D+ π0 K0s + flag = sign * DecayTypeMc::Ds1ToDstarK0ToDplusPi0K0s; + } else { + auto indexRecD0PartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD0, 2); + if (indexRecD0PartReco > -1) { // Ds1 -> D* K0s -> D0 π+ K0s -> K- π+ π0 π+ K0s + flag = sign * DecayTypeMc::Ds1ToDstarK0ToD0PiK0sPart; } - break; } } } - } - rowHfDPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); - } - rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - // Bs → Ds- π+ → (K- K+ π-) π+ - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // Ds- → K- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; - RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); - if (arrDaughDsIndex.size() == NDaughtersDs) { - for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { - auto daughI = particlesMc.rawIteratorAt(arrDaughDsIndex[iProng]); - arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); - } - // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- - if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); - } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi); + } else { // we look for D* not matched, but all the other ones yes, we check if we only lost the soft pion + if (indexRecD0 > -1 && indexRecK0 > -1 && indexRecDstar < 0) { + indexRecResoPartReco = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + if (indexRecResoPartReco > -1) { + flag = sign * DecayTypeMc::Ds1ToDstarK0ToD0NoPiK0sPart; } } - } else { - debug = 1; - LOGF(debug, "Bs decays in the expected final state but the condition on the intermediate state is not fulfilled"); } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBS, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + } + if (flag != 0) { + int indexParticle{-1}; + if (indexRecReso > -1) { + indexParticle = indexRecReso; + } else if (indexRecResoPartReco > -1) { + indexParticle = indexRecResoPartReco; } + auto particleReso = particlesMc.iteratorAt(indexParticle); + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particleReso, false, &idxBhadMothers); + motherPt = particleReso.pt(); + invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); } - - // additional checks for correlated backgrounds - if (checkDecayTypeMc) { - // B0 → Ds- π+ → (K- K+ π-) π+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // Ds- → K- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; - RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); - if (arrDaughDsIndex.size() == NDaughtersDs) { - for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { - auto daughI = particlesMc.rawIteratorAt(arrDaughDsIndex[iProng]); - arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); - } - // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- - if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); - } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi); - } - } - } + if (doMcRecQa) { + if (indexRecReso > -1) { + if (nPiToMuReso == 0 && nKaToPiReso == 0) { + registry.fill(HIST("hMassVsPtDs1Matched"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); } - } - // Bs → Ds- K+ → (K- K+ π-) K+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kKPlus}, true, &sign, 3); - if (indexRec > -1) { - // Ds- → K- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; - RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); - if (arrDaughDsIndex.size() == NDaughtersDs) { - for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { - auto daughI = particlesMc.rawIteratorAt(arrDaughDsIndex[iProng]); - arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); - } - // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- - if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsKToPhiPiKToKKPiK); - } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsKToK0starKKToKKPiK); - } - } - } else { - debug = 1; - LOGF(debug, "Bs decays in the expected final state but the condition on the intermediate state is not fulfilled"); - } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBS, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); - } + if (nPiToMuReso >= 1) { + registry.fill(HIST("hMassVsPtDs1MatchedPiToMu"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); } - } - // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor - // convention: final state particles are prong0,1,2,3 - if (!flag) { - auto particleProng0 = vecDaughtersB[0].mcParticle(); - auto particleProng1 = vecDaughtersB[1].mcParticle(); - auto particleProng2 = vecDaughtersB[2].mcParticle(); - auto particleProng3 = vecDaughtersB[3].mcParticle(); - // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; - // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kDSStar, Pdg::kLambdaCPlus}; - - for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); - - // look for common b-hadron ancestor - if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { - if (index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { - flag = BIT(hf_cand_bs::DecayTypeMc::PartlyRecoDecay); - pdgCodeBeautyMother = particlesMc.rawIteratorAt(index0Mother).pdgCode(); - pdgCodeCharmMother = 0; - pdgCodeProng0 = particleProng0.pdgCode(); - pdgCodeProng1 = particleProng1.pdgCode(); - pdgCodeProng2 = particleProng2.pdgCode(); - pdgCodeProng3 = particleProng3.pdgCode(); - // look for common c-hadron mother among prongs 0, 1 and 2 - for (const auto& cHadronMotherHypo : cHadronMotherHypos) { - int8_t depthMax = 2; - if (cHadronMotherHypo == Pdg::kDStar || cHadronMotherHypo == Pdg::kDSStar) { // to include D* -> D π0/γ, D* -> D0 π, and Ds* -> Ds π0/γ - depthMax += 1; - } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); - if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { - if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { - // pdgCodeCharmMother = - // Pdg::kDPlus (if D+ is the mother and does not come from D*+) - // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) - // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) - // Pdg::kDS (if Ds is the mother and does not come from Ds*) - // Pdg::kDS + Pdg::kDSStar (if Ds is the mother and Ds* -> Ds π0/γ) - // Pdg::kLambdaCPlus (if Λc+ is the mother) - pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); - } - } - } - break; - } - } + if (nKaToPiReso >= 1) { + registry.fill(HIST("hMassVsPtDs1MatchedKaToPi"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); } } - rowHfDsPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); - } - rowHfDsPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { - // B+ → D0(bar) π+ → (K+ π-) π+ - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{+kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - // D0(bar) → K+ π-; - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 1); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_bplus::DecayTypeMc::BplusToD0PiToKPiPi); - } else { - debug = 1; - LOGF(debug, "B+ decays in the expected final state but the condition on the intermediate state is not fulfilled"); + if (indexRecD0 > -1) { + if (nPiToMuD0 == 0 && nKaToPiD0 == 0) { + registry.fill(HIST("hMassVsPtD0Matched"), varUtils.ptD, varUtils.invMassD0); + } + if (nPiToMuD0 >= 1) { + registry.fill(HIST("hMassVsPtD0MatchedPiToMu"), varUtils.ptD, varUtils.invMassD0); + } + if (nKaToPiD0 >= 1) { + registry.fill(HIST("hMassVsPtD0MatchedKaToPi"), varUtils.ptD, varUtils.invMassD0); + } } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBPlus, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + if (indexRecDstar > -1) { + if (nPiToMuDstar == 0 && nKaToPiDstar == 0) { + registry.fill(HIST("hMassVsPtDstarMatched"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); + } + if (nPiToMuDstar >= 1) { + registry.fill(HIST("hMassVsPtDstarMatchedPiToMu"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); + } + if (nKaToPiDstar >= 1) { + registry.fill(HIST("hMassVsPtDstarMatchedKaToPi"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); + } } - } - // additional checks for correlated backgrounds - if (checkDecayTypeMc) { - if (!flag) { - // B+ → D0(bar) K+ → (K+ π-) K+ - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{+kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - // D0(bar) → K+ π-; - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 1); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_bplus::DecayTypeMc::BplusToD0KToKPiK); - } else { - debug = 1; - LOGF(debug, "B+ decays in the expected final state but the condition on the intermediate state is not fulfilled"); - } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBPlus, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); - } + if (indexRecK0 > -1) { + if (nPiToMuV0 == 0 && nKaToPiV0 == 0) { + registry.fill(HIST("hMassVsPtK0Matched"), candidateV0.pT, candidateV0.mK0Short); + } + if (nPiToMuV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedPiToMu"), candidateV0.pT, candidateV0.mK0Short); + } + if (nKaToPiV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedKaToPi"), candidateV0.pT, candidateV0.mK0Short); } } - // Partly reconstructed decays, i.e. the 3 prongs have a common b-hadron ancestor - // convention: final state particles are prong0,1,2 - if (!flag) { - auto particleProng0 = vecDaughtersB[0].mcParticle(); - auto particleProng1 = vecDaughtersB[1].mcParticle(); - auto particleProng2 = vecDaughtersB[2].mcParticle(); - // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kBPlus, Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; - // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kD0, Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, 423, Pdg::kDSStar, Pdg::kLambdaCPlus}; - - for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - - // look for common b-hadron ancestor - if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1) { - if (index0Mother == index1Mother && index1Mother == index2Mother) { - flag = BIT(hf_cand_bplus::DecayTypeMc::PartlyRecoDecay); - pdgCodeBeautyMother = particlesMc.rawIteratorAt(index0Mother).pdgCode(); - pdgCodeCharmMother = 0; - pdgCodeProng0 = particleProng0.pdgCode(); - pdgCodeProng1 = particleProng1.pdgCode(); - pdgCodeProng2 = particleProng2.pdgCode(); - // look for common c-hadron mother among prongs 0, 1 and 2 - for (const auto& cHadronMotherHypo : cHadronMotherHypos) { - int8_t depthMax = 2; - if (cHadronMotherHypo == Pdg::kDStar || cHadronMotherHypo == Pdg::kDStar0 || cHadronMotherHypo == Pdg::kDSStar) { // to include D* -> D π0/γ, D* -> D0 π, and Ds* -> Ds π0/γ - depthMax += 1; - } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - if (index0CharmMother > -1 && index1CharmMother > -1) { - if (index0CharmMother == index1CharmMother) { - // pdgCodeCharmMother = - // Pdg::kDPlus (if D+ is the mother and does not come from D*+) - // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) - // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) - // Pdg::kDS (if Ds is the mother and does not come from Ds*) - // Pdg::kDS + Pdg::kDSStar (if Ds is the mother and Ds* -> Ds π0/γ) - // Pdg::kLambdaCPlus (if Λc+ is the mother) - pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); - } - } - } - break; - } + } + } else if constexpr (dType == DType::Dplus) { + // Ds2Star → D+ K0 → (π+K-π+) K0s → (π+K-π+)(π+π-) + indexRecK0 = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2, &nPiToMuV0, &nKaToPiV0); + indexRecDplus = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDplus, 2, &nPiToMuDplus, &nKaToPiDplus); + if (indexRecK0 > -1 && indexRecDplus > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS2Star, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3, &nPiToMuReso, &nKaToPiReso); + if (indexRecReso > -1 && nPiToMuReso == 0 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi; + } else if (indexRecReso > -1 && nPiToMuReso >= 1 && nKaToPiReso == 0) { + flag = sign * DecayTypeMc::Ds2StarToDplusK0sOneMu; + } else if (indexRecReso < 0) { + // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s + indexRecDstar = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2]}, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDstar, 2); + if (indexRecDstar > -1) { + indexRecReso = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}, Pdg::kDS1, std::array{+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + if (indexRecReso > -1) { + flag = sign * DecayTypeMc::Ds1ToDstarK0ToDplusPi0K0s; } } } - rowHfD0PiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2); } - rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - // Lb → Lc+ π- → (p K- π+) π- - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kLambdaB0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // Lc+ → p K- π+ - // Printf("Checking Lc+ → p K- π+"); - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_lb::DecayTypeMc::LbToLcPiToPKPiPi); - } else { - debug = 1; - LOGF(debug, "Lb decays in the expected final state but the condition on the intermediate state is not fulfilled"); - } - - auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kLambdaB0, true); - if (indexMother >= 0) { - auto particleMother = particlesMc.rawIteratorAt(indexMother); - motherPt = particleMother.pt(); - checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); - } + if (flag != 0) { + auto particleReso = particlesMc.iteratorAt(indexRecReso); + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particleReso, false, &idxBhadMothers); + motherPt = particleReso.pt(); + invMassGen = RecoDecay::m(particleReso.p(), particleReso.e()); } - - // additional checks for correlated backgrounds - if (checkDecayTypeMc) { - // Lb → Lc+ K- → (p K- π+) K- - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kLambdaB0, std::array{+kProton, -kKPlus, +kPiPlus, -kKPlus}, true, &sign, 3); - if (indexRec > -1) { - // Lc+ → p K- π+ - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_lb::DecayTypeMc::LbToLcKToPKPiK); - } + if (doMcRecQa) { + if (indexRecReso > -1) { + if (nPiToMuReso == 0 && nKaToPiReso == 0) { + registry.fill(HIST("hMassVsPtDs2StarMatched"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); + } + if (nPiToMuReso >= 1) { + registry.fill(HIST("hMassVsPtDs2StarMatchedPiToMu"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); + } + if (nKaToPiReso >= 1) { + registry.fill(HIST("hMassVsPtDs2StarMatchedKaToPi"), varUtils.ptD, varUtils.invMassReso - varUtils.invMassD); } } - // B0 → D- π+ → (π- K+ π-) π+ - if (!flag) { - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kPiPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); - if (indexRec > -1) { - // D- → (π- K+ π- - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDMinus, std::array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); - if (indexRec > -1) { - flag = sign * BIT(hf_cand_lb::DecayTypeMc::B0ToDplusPiToPiKPiPi); - } + if (indexRecDplus > -1) { + if (nPiToMuDplus == 0 && nKaToPiDplus == 0) { + registry.fill(HIST("hMassVsPtDplusMatched"), varUtils.ptD, varUtils.invMassD); + } + if (nPiToMuDplus >= 1) { + registry.fill(HIST("hMassVsPtDplusMatchedPiToMu"), varUtils.ptD, varUtils.invMassD); + } + if (nKaToPiDplus >= 1) { + registry.fill(HIST("hMassVsPtDplusMatchedKaToPi"), varUtils.ptD, varUtils.invMassD); } } - - // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor - // convention: final state particles are prong0,1,2,3 - if (!flag) { - auto particleProng0 = vecDaughtersB[0].mcParticle(); - auto particleProng1 = vecDaughtersB[1].mcParticle(); - auto particleProng2 = vecDaughtersB[2].mcParticle(); - auto particleProng3 = vecDaughtersB[3].mcParticle(); - // b-hadron hypothesis - std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; - // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; - - for (const auto& bHadronMotherHypo : bHadronMotherHypos) { - int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); - int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); - int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); - int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); - - // look for common b-hadron ancestor - if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { - if (index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { - flag = BIT(hf_cand_b0::DecayTypeMc::PartlyRecoDecay); - pdgCodeBeautyMother = particlesMc.rawIteratorAt(index0Mother).pdgCode(); - pdgCodeCharmMother = 0; - pdgCodeProng0 = particleProng0.pdgCode(); - pdgCodeProng1 = particleProng1.pdgCode(); - pdgCodeProng2 = particleProng2.pdgCode(); - pdgCodeProng3 = particleProng3.pdgCode(); - // look for common c-hadron mother among prongs 0, 1 and 2 - for (const auto& cHadronMotherHypo : cHadronMotherHypos) { - int8_t depthMax = 2; - if (cHadronMotherHypo == Pdg::kDStar) { // to include D* -> D π0/γ and D* -> D0 π - depthMax += 1; - } - int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); - int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); - int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); - if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { - if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { - // pdgCodeCharmMother = - // Pdg::kDPlus (if D+ is the mother and does not come from D*+) - // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) - // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) - // Pdg::kDS (if Ds is the mother) - // Pdg::kLambdaCPlus (if Λc+ is the mother) - pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); - } - } - } - break; // Early exit: found a valid decay chain with common b-hadron mother - } - } + if (indexRecK0 > -1) { + if (nPiToMuV0 == 0 && nKaToPiV0 == 0) { + registry.fill(HIST("hMassVsPtK0Matched"), candidateV0.pT, candidateV0.mK0Short); + } + if (nPiToMuV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedPiToMu"), candidateV0.pT, candidateV0.mK0Short); + } + if (nKaToPiV0 >= 1) { + registry.fill(HIST("hMassVsPtK0MatchedKaToPi"), candidateV0.pT, candidateV0.mK0Short); } } - rowHfLcPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } - rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + } // DecayChannel::DplusV0 + if (flag != 0) { + registry.fill(HIST("hMCRecCounter"), flag); + registry.fill(HIST("hMCRecOrigin"), origin); + registry.fill(HIST("hMCRecMassGen"), invMassGen); + } else { + if (indexRecK0 > -1) { + SETBIT(debug, PartialMatchMc::K0Matched); + } + if (indexRecD0 > -1) { + SETBIT(debug, PartialMatchMc::D0Matched); + } + if (indexRecDstar > -1) { + SETBIT(debug, PartialMatchMc::DstarMatched); + } + if (indexRecDplus > -1) { + SETBIT(debug, PartialMatchMc::DplusMatched); + } + registry.fill(HIST("hMCRecDebug"), debug); } + rowHfDV0McRecReduced(indexHfCandCharm, indexCandV0, flag, debug, origin, signD0, motherPt, invMassGen); } - template + template void runDataCreation(Coll const& collision, - CCharmCands const& candsC, - aod::TrackAssoc const& trackIndices, - TTracks const&, + CCands const& candsD, + BBachV0s const& bachelorV0s, + BBachTracks const& bachelorTrks, + Tr const& tracks, + TrIU const&, PParticles const& particlesMc, - uint64_t const& indexCollisionMaxNumContrib, aod::BCsWithTimestamps const&) { // helpers for ReducedTables filling int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; - // std::map where the key is the track.globalIndex() and - // the value is the track index in the table of the selected pions - std::map selectedTracksPion; + // std::map where the key is the V0.globalIndex() and + // the value is the V0 index in the table of the selected v0s + std::map selectedV0s; + std::map selectedTracks; bool fillHfReducedCollision = false; - - auto primaryVertex = getPrimaryVertex(collision); - - // Set the magnetic field from ccdb. - // The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, - // but this is not true when running on Run2 data/MC already converted into AO2Ds. + const bool doTracks = pairingType == PairingType::TrackOnly || pairingType == PairingType::V0AndTrack; + const bool doV0s = pairingType == PairingType::V0Only || pairingType == PairingType::V0AndTrack; auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); - if (grpo == nullptr) { - LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); - } - o2::base::Propagator::initFieldFromGRP(grpo); + initCCDB(bc, runNumber, ccdb, ccdbPathGrpMag, lut, false); bz = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz; - runNumber = bc.runNumber(); } - df3.setBz(bz); - - auto thisCollId = collision.globalIndex(); - for (const auto& candC : candsC) { - int indexHfCandCharm{-1}; - float invMassC0{-1.f}, invMassC1{-1.f}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; - invMassC0 = hfHelper.invMassDplusToPiKPi(candC); - registry.fill(HIST("hMassDplus"), invMassC0); - registry.fill(HIST("hPtDplus"), candC.pt()); - registry.fill(HIST("hCpaDplus"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; - if (candC.isSelDsToKKPi() >= hfflagConfigurations.selectionFlagDs) { - invMassC0 = hfHelper.invMassDsToKKPi(candC); - registry.fill(HIST("hMassDsToKKPi"), invMassC0); - } - if (candC.isSelDsToPiKK() >= hfflagConfigurations.selectionFlagDs) { - invMassC1 = hfHelper.invMassDsToPiKK(candC); - registry.fill(HIST("hMassDsToPiKK"), invMassC1); - } - registry.fill(HIST("hPtDs"), candC.pt()); - registry.fill(HIST("hCpaDs"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { - indexHfCandCharm = hfCand2Prong.lastIndex() + 1; - if (candC.isSelD0() >= hfflagConfigurations.selectionFlagD0) { - invMassC0 = hfHelper.invMassD0ToPiK(candC); - registry.fill(HIST("hMassD0"), invMassC0); - } - if (candC.isSelD0bar() >= hfflagConfigurations.selectionFlagD0bar) { - invMassC1 = hfHelper.invMassD0barToKPi(candC); - registry.fill(HIST("hMassD0bar"), invMassC1); - } - registry.fill(HIST("hPtD0"), candC.pt()); - registry.fill(HIST("hCpaD0"), candC.cpa()); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; - if (candC.isSelLcToPKPi() >= hfflagConfigurations.selectionFlagLc) { - invMassC0 = hfHelper.invMassLcToPKPi(candC); - registry.fill(HIST("hMassLcToPKPi"), invMassC0); - } - if (candC.isSelLcToPiKP() >= hfflagConfigurations.selectionFlagLc) { - invMassC1 = hfHelper.invMassLcToPiKP(candC); - registry.fill(HIST("hMassLcToPiKP"), invMassC1); - } - registry.fill(HIST("hPtLc"), candC.pt()); - registry.fill(HIST("hCpaLc"), candC.cpa()); - } - - bool fillHfCandCharm = false; - - std::vector charmHadDauTracks{candC.template prong0_as(), candC.template prong1_as()}; - o2::track::TrackParCov trackParCov0 = getTrackParCov(charmHadDauTracks[0]); - o2::track::TrackParCov trackParCov1 = getTrackParCov(charmHadDauTracks[1]); - o2::track::TrackParCov trackParCov2{}; - - std::array pVec0 = charmHadDauTracks[0].pVector(); - std::array pVec1 = charmHadDauTracks[1].pVector(); - std::array pVec2{}; - - auto dca0 = o2::dataformats::DCA(charmHadDauTracks[0].dcaXY(), charmHadDauTracks[0].dcaZ(), charmHadDauTracks[0].cYY(), charmHadDauTracks[0].cZY(), charmHadDauTracks[0].cZZ()); - auto dca1 = o2::dataformats::DCA(charmHadDauTracks[1].dcaXY(), charmHadDauTracks[1].dcaZ(), charmHadDauTracks[1].cYY(), charmHadDauTracks[1].cZY(), charmHadDauTracks[1].cZZ()); - - // repropagate tracks to this collision if needed - if (charmHadDauTracks[0].collisionId() != thisCollId) { - trackParCov0.propagateToDCA(primaryVertex, bz, &dca0); - } - - if (charmHadDauTracks[1].collisionId() != thisCollId) { - trackParCov1.propagateToDCA(primaryVertex, bz, &dca1); - } - - // third track, if it's a 3-prong - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { - charmHadDauTracks.push_back(candC.template prong2_as()); - trackParCov2 = getTrackParCov(charmHadDauTracks[2]); - pVec2 = charmHadDauTracks[2].pVector(); - auto dca2 = o2::dataformats::DCA(charmHadDauTracks[2].dcaXY(), charmHadDauTracks[2].dcaZ(), charmHadDauTracks[2].cYY(), charmHadDauTracks[2].cZY(), charmHadDauTracks[2].cZZ()); - - if (charmHadDauTracks[2].collisionId() != thisCollId) { - trackParCov2.propagateToDCA(primaryVertex, bz, &dca2); + fitter.setBz(bz); + // loop on D candidates + for (const auto& candD : candsD) { + // initialize variables depending on D meson type + bool fillHfCandD = false; + std::array secondaryVertexD; + std::array prongIdsD; + int8_t dtype{0}; + std::array bdtScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; + std::vector charmHadDauTracks{}; + varUtils.ptD = candD.pt(); + if constexpr (dType == DType::Dstar) { + varUtils.signD = candD.signSoftPi(); + if (varUtils.signD > 0) { + varUtils.invMassD = candD.invMassDstar(); + varUtils.invMassD0 = candD.invMassD0(); + } else { + varUtils.invMassD = candD.invMassAntiDstar(); + varUtils.invMassD0 = candD.invMassD0Bar(); } - } - - // --------------------------------- - // reconstruct charm candidate secondary vertex - o2::track::TrackParCov trackParCovCharmHad{}; - std::array pVecCharm{}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ - - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - hCandidatesDPlus->Fill(SVFitting::BeforeFit); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - hCandidatesDs->Fill(SVFitting::BeforeFit); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - hCandidatesLc->Fill(SVFitting::BeforeFit); + secondaryVertexD[0] = candD.xSecondaryVertexD0(); + secondaryVertexD[1] = candD.ySecondaryVertexD0(); + secondaryVertexD[2] = candD.zSecondaryVertexD0(); + prongIdsD[0] = candD.prong0Id(); + prongIdsD[1] = candD.prong1Id(); + prongIdsD[2] = candD.prongPiId(); + std::copy(candD.pVectorProng0().begin(), candD.pVectorProng0().end(), varUtils.pVectorProng0.begin()); + std::copy(candD.pVectorProng1().begin(), candD.pVectorProng1().end(), varUtils.pVectorProng1.begin()); + std::copy(candD.pVecSoftPi().begin(), candD.pVecSoftPi().end(), varUtils.pVectorProng2.begin()); + charmHadDauTracks.push_back(candD.template prong0_as()); + charmHadDauTracks.push_back(candD.template prong1_as()); + charmHadDauTracks.push_back(candD.template prongPi_as()); + dtype = varUtils.signD * DType::Dstar; + if constexpr (withMl) { + std::copy(candD.mlProbDstarToD0Pi().begin(), candD.mlProbDstarToD0Pi().end(), bdtScores.begin()); } - - try { - if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) { - continue; - } - } catch (const std::runtime_error& error) { - LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - hCandidatesDPlus->Fill(SVFitting::Fail); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - hCandidatesDs->Fill(SVFitting::Fail); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - hCandidatesLc->Fill(SVFitting::Fail); - } - continue; + registry.fill(HIST("hMassVsPtDstarAll"), varUtils.ptD, varUtils.invMassD - varUtils.invMassD0); + } else if constexpr (dType == DType::Dplus) { + auto prong0 = candD.template prong0_as(); + varUtils.invMassD = hfHelper.invMassDplusToPiKPi(candD); + secondaryVertexD[0] = candD.xSecondaryVertex(); + secondaryVertexD[1] = candD.ySecondaryVertex(); + secondaryVertexD[2] = candD.zSecondaryVertex(); + prongIdsD[0] = candD.prong0Id(); + prongIdsD[1] = candD.prong1Id(); + prongIdsD[2] = candD.prong2Id(); + varUtils.signD = prong0.sign(); + std::copy(candD.pVectorProng0().begin(), candD.pVectorProng0().end(), varUtils.pVectorProng0.begin()); + std::copy(candD.pVectorProng1().begin(), candD.pVectorProng1().end(), varUtils.pVectorProng1.begin()); + std::copy(candD.pVectorProng2().begin(), candD.pVectorProng2().end(), varUtils.pVectorProng2.begin()); + dtype = static_cast(varUtils.signD * DType::Dplus); + charmHadDauTracks.push_back(candD.template prong0_as()); + charmHadDauTracks.push_back(candD.template prong1_as()); + charmHadDauTracks.push_back(candD.template prong2_as()); + if constexpr (withMl) { + std::copy(candD.mlProbDplusToPiKPi().begin(), candD.mlProbDplusToPiKPi().end(), bdtScores.begin()); } - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - hCandidatesDPlus->Fill(SVFitting::FitOk); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - hCandidatesDs->Fill(SVFitting::FitOk); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - hCandidatesLc->Fill(SVFitting::FitOk); + registry.fill(HIST("hMassVsPtDplusAll"), varUtils.ptD, varUtils.invMassD0); + } else if constexpr (dType == DType::D0) { + varUtils.invMassD0 = hfHelper.invMassD0ToPiK(candD); + varUtils.invMassD0Bar = hfHelper.invMassD0barToKPi(candD); + secondaryVertexD[0] = candD.xSecondaryVertex(); + secondaryVertexD[1] = candD.ySecondaryVertex(); + secondaryVertexD[2] = candD.zSecondaryVertex(); + prongIdsD[0] = candD.prong0Id(); + prongIdsD[1] = candD.prong1Id(); + prongIdsD[2] = -1; // D0 does not have a third prong + charmHadDauTracks.push_back(candD.template prong0_as()); + charmHadDauTracks.push_back(candD.template prong1_as()); + std::copy(candD.pVectorProng0().begin(), candD.pVectorProng0().end(), varUtils.pVectorProng0.begin()); + std::copy(candD.pVectorProng1().begin(), candD.pVectorProng1().end(), varUtils.pVectorProng1.begin()); + varUtils.pVectorProng2 = {0.f, 0.f, 0.f}; // D0 does not have a third prong + if constexpr (withMl) { + std::copy(candD.mlProbD0().begin(), candD.mlProbD0().end(), bdtScores.begin()); + std::copy(candD.mlProbD0bar().begin(), candD.mlProbD0bar().end(), bdtScores.begin() + 3); } + } // end of dType switch - auto secondaryVertexCharm = df3.getPCACandidate(); - trackParCov0.propagateTo(secondaryVertexCharm[0], bz); - trackParCov1.propagateTo(secondaryVertexCharm[0], bz); - trackParCov2.propagateTo(secondaryVertexCharm[0], bz); - df3.getTrack(0).getPxPyPzGlo(pVec0); - df3.getTrack(1).getPxPyPzGlo(pVec1); - df3.getTrack(2).getPxPyPzGlo(pVec2); - pVecCharm = RecoDecay::pVec(pVec0, pVec1, pVec2); - trackParCovCharmHad = df3.createParentTrackParCov(); - trackParCovCharmHad.setAbsCharge(charmHadDauTracks[1].sign()); // to be sure - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ - - hCandidatesD0->Fill(SVFitting::BeforeFit); - try { - if (df2.process(trackParCov0, trackParCov1) == 0) { - continue; - } - } catch (const std::runtime_error& error) { - LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; - hCandidatesD0->Fill(SVFitting::Fail); - continue; - } - hCandidatesD0->Fill(SVFitting::FitOk); - - auto secondaryVertexCharm = df2.getPCACandidate(); - trackParCov0.propagateTo(secondaryVertexCharm[0], bz); - trackParCov1.propagateTo(secondaryVertexCharm[0], bz); - df2.getTrack(0).getPxPyPzGlo(pVec0); - df2.getTrack(1).getPxPyPzGlo(pVec1); - pVecCharm = RecoDecay::pVec(pVec0, pVec1); - trackParCovCharmHad = df2.createParentTrackParCov(); - trackParCovCharmHad.setAbsCharge(0); // to be sure - } - - float ptDauMin = 1.e6, etaDauMin = 999.f, chi2TpcDauMax = -1.f; + // Get single track variables + float chi2TpcDauMax = -1.f; int nItsClsDauMin = 8, nTpcCrossRowsDauMin = 200; for (const auto& charmHadTrack : charmHadDauTracks) { - if (charmHadTrack.pt() < ptDauMin) { - ptDauMin = charmHadTrack.pt(); - } - if (std::abs(charmHadTrack.eta()) < etaDauMin) { - etaDauMin = std::abs(charmHadTrack.eta()); - } if (charmHadTrack.itsNCls() < nItsClsDauMin) { nItsClsDauMin = charmHadTrack.itsNCls(); } @@ -1101,179 +922,397 @@ struct HfDataCreatorCharmHadPiReduced { } } - for (const auto& trackId : trackIndices) { - auto trackPion = trackId.template track_as(); - - // apply selections on pion tracks - auto trackParCovPion = getTrackParCov(trackPion); - std::array dcaPion{trackPion.dcaXY(), trackPion.dcaZ()}; - std::array pVecPion = trackPion.pVector(); - if (trackPion.collisionId() != thisCollId) { - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovPion, 2.f, noMatCorr, &dcaPion); - getPxPyPz(trackParCovPion, pVecPion); - } - - // reject pi D with same sign as D - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ - if (trackPion.sign() * charmHadDauTracks[0].sign() > 0) { + // Loop on the bachelor V0s + if constexpr (doV0s) { + for (const auto& v0 : bachelorV0s) { + auto trackPos = v0.template posTrack_as(); + auto trackNeg = v0.template negTrack_as(); + // Apply selsection + auto v0DauTracks = std::array{trackPos, trackNeg}; + if (!buildAndSelectV0(collision, prongIdsD, v0DauTracks)) { continue; } - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ - if (!((candC.isSelD0() >= hfflagConfigurations.selectionFlagD0 && trackPion.sign() < 0) || (candC.isSelD0bar() >= hfflagConfigurations.selectionFlagD0bar && trackPion.sign() > 0))) { - continue; + // Get single track variables + float chi2TpcDauV0Max = -1.f; + int nItsClsDauV0Min = 8, nTpcCrossRowsDauV0Min = 200; + for (const auto& v0Track : v0DauTracks) { + if (v0Track.itsNCls() < nItsClsDauV0Min) { + nItsClsDauV0Min = v0Track.itsNCls(); + } + if (v0Track.tpcNClsCrossedRows() < nTpcCrossRowsDauV0Min) { + nTpcCrossRowsDauV0Min = v0Track.tpcNClsCrossedRows(); + } + if (v0Track.tpcChi2NCl() > chi2TpcDauV0Max) { + chi2TpcDauV0Max = v0Track.tpcChi2NCl(); + } } - } - - // apply selections on pion tracks - if (!isPionSelected(trackPion, trackParCovPion, dcaPion, charmHadDauTracks)) { - continue; - } - - registry.fill(HIST("hPtPion"), trackParCovPion.getPt()); - // compute invariant mass square and apply selection - auto invMass2DPi = RecoDecay::m2(std::array{pVecCharm, pVecPion}, std::array{massC, massPi}); - if ((invMass2DPi < invMass2ChHadPiMin) || (invMass2DPi > invMass2ChHadPiMax)) { - continue; - } - - // fill Pion tracks table - // if information on track already stored, go to next track - if (!selectedTracksPion.count(trackPion.globalIndex())) { - hfTrackPion(trackPion.globalIndex(), indexHfReducedCollision, - trackParCovPion.getX(), trackParCovPion.getAlpha(), - trackParCovPion.getY(), trackParCovPion.getZ(), trackParCovPion.getSnp(), - trackParCovPion.getTgl(), trackParCovPion.getQ2Pt(), - trackPion.itsNCls(), trackPion.tpcNClsCrossedRows(), trackPion.tpcChi2NCl()); - hfTrackCovPion(trackParCovPion.getSigmaY2(), trackParCovPion.getSigmaZY(), trackParCovPion.getSigmaZ2(), - trackParCovPion.getSigmaSnpY(), trackParCovPion.getSigmaSnpZ(), - trackParCovPion.getSigmaSnp2(), trackParCovPion.getSigmaTglY(), trackParCovPion.getSigmaTglZ(), - trackParCovPion.getSigmaTglSnp(), trackParCovPion.getSigmaTgl2(), - trackParCovPion.getSigma1PtY(), trackParCovPion.getSigma1PtZ(), trackParCovPion.getSigma1PtSnp(), - trackParCovPion.getSigma1PtTgl(), trackParCovPion.getSigma1Pt2()); - hfTrackPidPion(trackPion.hasTPC(), trackPion.hasTOF(), - trackPion.tpcNSigmaPi(), trackPion.tofNSigmaPi()); - // add trackPion.globalIndex() to a list - // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another D candidate - // and keep track of their index in hfTrackPion for McRec purposes - selectedTracksPion[trackPion.globalIndex()] = hfTrackPion.lastIndex(); - } - - if constexpr (doMc) { - std::vector beautyHadDauTracks{}; - for (const auto& track : charmHadDauTracks) { - beautyHadDauTracks.push_back(track); + // propagate V0 to primary vertex (if enabled) + if (propagateV0toPV) { + std::array pVecV0Orig = {candidateV0.mom[0], candidateV0.mom[1], candidateV0.mom[2]}; + std::array dcaInfo; + auto trackParK0 = o2::track::TrackPar(candidateV0.pos, pVecV0Orig, 0, true); + trackParK0.setPID(o2::track::PID::K0); + trackParK0.setAbsCharge(0); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParK0, 2.f, matCorr, &dcaInfo); + getPxPyPz(trackParK0, candidateV0.mom); } - beautyHadDauTracks.push_back(trackPion); - fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandCharm, selectedTracksPion, indexCollisionMaxNumContrib); - } - fillHfCandCharm = true; - } // pion loop - if (fillHfCandCharm) { // fill candCplus table only once per D candidate - constexpr std::size_t NSizeMLScore{3u}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ - hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), - indexHfReducedCollision, - trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), - trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), - trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, - ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); - hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), - trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), - trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), - trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), - trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), - trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); - float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; - float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; - if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - /// assign non-dummy values only for Lb->LcPi analysis - nSigmaTpcPr0 = candC.nSigTpcPr0(); - nSigmaTpcPr1 = candC.nSigTpcPr1(); - nSigmaTpcPr2 = candC.nSigTpcPr2(); - nSigmaTofPr0 = candC.nSigTofPr0(); - nSigmaTofPr1 = candC.nSigTofPr1(); - nSigmaTofPr2 = candC.nSigTofPr2(); + // compute resonance invariant mass and filling of QA histograms + if (TESTBIT(candidateV0.v0Type, K0s)) { + registry.fill(HIST("hMassVsPtK0s"), candidateV0.pT, candidateV0.mK0Short); + switch (dType) { + case DType::Dstar: + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); + if (varUtils.signD > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + } + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD - varUtils.invMassD0 > cfgQaPlots.cutMassDstarMin && + varUtils.invMassD - varUtils.invMassD0 < cfgQaPlots.cutMassDstarMax && + candidateV0.mK0Short > cfgQaPlots.cutMassK0sMin && + candidateV0.mK0Short < cfgQaPlots.cutMassK0sMax)) { + registry.fill(HIST("hMassDstarK0s"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + break; + case DType::Dplus: + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassK0}); + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD > cfgQaPlots.cutMassDMin && + varUtils.invMassD < cfgQaPlots.cutMassDMax && + candidateV0.mK0Short > cfgQaPlots.cutMassK0sMin && + candidateV0.mK0Short < cfgQaPlots.cutMassK0sMax)) { + registry.fill(HIST("hMassDplusK0s"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + break; + default: + break; // no other D meson types expected + } // end of dType switch + } // matched with K0s + bool isLambda = TESTBIT(candidateV0.v0Type, Lambda); + bool isAntiLambda = TESTBIT(candidateV0.v0Type, AntiLambda); + if (isLambda || isAntiLambda) { + registry.fill(HIST("hMassVsPtLambda"), candidateV0.pT, candidateV0.mLambda); + switch (dType) { + case DType::Dstar: + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); + if (varUtils.signD > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}); + } + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD - varUtils.invMassD0 > cfgQaPlots.cutMassDstarMin && + varUtils.invMassD - varUtils.invMassD0 < cfgQaPlots.cutMassDstarMax && + candidateV0.mLambda > cfgQaPlots.cutMassLambdaMin && + candidateV0.mLambda < cfgQaPlots.cutMassLambdaMax)) { + registry.fill(HIST("hMassDstarLambda"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + break; + case DType::Dplus: + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassLambda}); + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, candidateV0.mom)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD > cfgQaPlots.cutMassDMin && + varUtils.invMassD < cfgQaPlots.cutMassDMax && + candidateV0.mLambda > cfgQaPlots.cutMassLambdaMin && + candidateV0.mLambda < cfgQaPlots.cutMassLambdaMax)) { + registry.fill(HIST("hMassDplusLambda"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + break; + case DType::D0: + if (isLambda) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassLambda}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, candidateV0.mom}, std::array{MassPiPlus, MassKPlus, MassLambda}); + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, candidateV0.mom)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD0 > cfgQaPlots.cutMassDMin && + varUtils.invMassD0 < cfgQaPlots.cutMassDMax && + candidateV0.mLambda > cfgQaPlots.cutMassLambdaMin && + candidateV0.mLambda < cfgQaPlots.cutMassLambdaMax)) { + if (isLambda) { + registry.fill(HIST("hMassD0Lambda"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0); + } else { + registry.fill(HIST("hMassD0Lambda"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0Bar); + } + } + break; + default: + break; + } // end of dType switch + } // matched with Lambda or AntiLambda + + // fill V0 table + // if information on V0 already stored, go to next V0 + if (!selectedV0s.count(v0.globalIndex())) { + hfCandV0(trackPos.globalIndex(), trackNeg.globalIndex(), + indexHfReducedCollision, + candidateV0.pos[0], candidateV0.pos[1], candidateV0.pos[2], + candidateV0.momPos[0], candidateV0.momPos[1], candidateV0.momPos[2], + candidateV0.momNeg[0], candidateV0.momNeg[1], candidateV0.momNeg[2], + candidateV0.cosPA, + candidateV0.dcaV0ToPv, + nItsClsDauV0Min, nTpcCrossRowsDauV0Min, chi2TpcDauV0Max, + candidateV0.v0Type); + selectedV0s[v0.globalIndex()] = hfCandV0.lastIndex(); } - hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); - hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); - hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); - if constexpr (withMl) { - std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); - } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - if (candC.mlProbDsToKKPi().size() == NSizeMLScore) { - std::copy(candC.mlProbDsToKKPi().begin(), candC.mlProbDsToKKPi().end(), mlScores.begin()); + fillHfCandD = true; + // Optional filling of MC Rec table, for now only implemented for Ds1->D*K0s and Ds2*->D+K0s + if constexpr (doMc && (dType == DType::Dstar || dType == DType::Dplus)) { + std::vector charmResoDauTracks{}; + for (const auto& track : charmHadDauTracks) { + charmResoDauTracks.push_back(track); + } + charmResoDauTracks.push_back(trackPos); + charmResoDauTracks.push_back(trackNeg); + int indexHfCandCharm = hfCandD3Pr.lastIndex() + 1; + int indexHfCandV0 = hfCandV0.lastIndex(); + fillMcRecoInfo(particlesMc, charmResoDauTracks, indexHfCandCharm, indexHfCandV0); + } + } // end of loop on V0 candidates + } // end of do V0s + // Loop on the bachelor tracks + if constexpr (doTracks) { + for (const auto& trackIndex : bachelorTrks) { + auto track = tracks.rawIteratorAt(trackIndex.trackId()); + if (!isTrackSelected(track, prongIdsD)) { + continue; + } + // if the track has been reassociated, re-propagate it to PV (minor difference) + auto trackParCovTrack = getTrackParCov(track); + std::array dcaTrack{track.dcaXY(), track.dcaZ()}; + std::array pVecTrack = track.pVector(); + if (track.collisionId() != collision.globalIndex()) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovTrack, 2.f, matCorr, &dcaTrack); + getPxPyPz(trackParCovTrack, pVecTrack); + } + registry.fill(HIST("hdEdxVsP"), track.p(), track.tpcSignal()); + // compute invariant mass and filling of QA histograms + switch (dType) { + case DType::Dstar: + // D* pi + if (std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi) { + if (varUtils.signD > 0 && track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}); + } else if (varUtils.signD < 0 && track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD - varUtils.invMassD0 > cfgQaPlots.cutMassDstarMin && + varUtils.invMassD - varUtils.invMassD0 < cfgQaPlots.cutMassDstarMax)) { + registry.fill(HIST("hMassDstarPi"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } } - if (candC.mlProbDsToPiKK().size() == NSizeMLScore) { - std::copy(candC.mlProbDsToPiKK().begin(), candC.mlProbDsToPiKK().end(), mlScores.begin() + 3); + if (std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa) { + if (varUtils.signD > 0 && track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}); + } else if (varUtils.signD < 0 && track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD - varUtils.invMassD0 > cfgQaPlots.cutMassDstarMin && + varUtils.invMassD - varUtils.invMassD0 < cfgQaPlots.cutMassDstarMax)) { + registry.fill(HIST("hMassDstarK"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } } - hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); - } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - if (candC.mlProbLcToPKPi().size() == NSizeMLScore) { - std::copy(candC.mlProbLcToPKPi().begin(), candC.mlProbLcToPKPi().end(), mlScores.begin()); + // D* p + if (std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr) { + if (varUtils.signD > 0 && track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); + } else if (varUtils.signD < 0 && track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD - varUtils.invMassD0 > cfgQaPlots.cutMassDstarMin && + varUtils.invMassD - varUtils.invMassD0 < cfgQaPlots.cutMassDstarMax)) { + registry.fill(HIST("hMassDstarProton"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } } - if (candC.mlProbLcToPiKP().size() == NSizeMLScore) { - std::copy(candC.mlProbLcToPiKP().begin(), candC.mlProbLcToPiKP().end(), mlScores.begin() + 3); + break; + case DType::Dplus: + // D+ pi + if (std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi) { + if (varUtils.signD * track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassPiPlus}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD > cfgQaPlots.cutMassDMin && + varUtils.invMassD < cfgQaPlots.cutMassDMax)) { + registry.fill(HIST("hMassDplusPi"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } } - hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); - } + // D+ K + if (std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa) { + if (varUtils.signD * track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassKPlus}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD > cfgQaPlots.cutMassDMin && + varUtils.invMassD < cfgQaPlots.cutMassDMax)) { + registry.fill(HIST("hMassDplusK"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + } + // D+ pr + if (std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr) { + if (varUtils.signD * track.sign() < 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus, MassProton}); + } else { + varUtils.invMassReso = -1.f; // invalid case + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, varUtils.pVectorProng2, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD > cfgQaPlots.cutMassDMin && + varUtils.invMassD < cfgQaPlots.cutMassDMax)) { + registry.fill(HIST("hMassDplusProton"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD); + } + } + break; + case DType::D0: + // D0 pi + if (std::abs(track.tpcNSigmaPi()) < cfgSingleTrackCuts.maxNsigmaTpcPi) { + if (track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassPiPlus}); + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD0 > cfgQaPlots.cutMassDMin && + varUtils.invMassD0 < cfgQaPlots.cutMassDMax)) { + if (track.sign() > 0) { + registry.fill(HIST("hMassD0Pi"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0); + } else { + registry.fill(HIST("hMassD0Pi"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0Bar); + } + } + } + // D0 K + if (std::abs(track.tpcNSigmaKa()) < cfgSingleTrackCuts.maxNsigmaTpcKa) { + if (track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassKPlus}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, pVecTrack}, std::array{MassPiPlus, MassKPlus, MassKPlus}); + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD0 > cfgQaPlots.cutMassDMin && + varUtils.invMassD0 < cfgQaPlots.cutMassDMax)) { + if (track.sign() > 0) { + registry.fill(HIST("hMassD0K"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0); + } else { + registry.fill(HIST("hMassD0K"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0Bar); + } + } + } + // D0 p + if (std::abs(track.tpcNSigmaPr()) < cfgSingleTrackCuts.maxNsigmaTpcPr) { + if (track.sign() > 0) { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack}, std::array{MassProton, MassKPlus, MassProton}); + } else { + varUtils.invMassReso = RecoDecay::m(std::array{varUtils.pVectorProng1, varUtils.pVectorProng0, pVecTrack}, std::array{MassProton, MassKPlus, MassProton}); + } + varUtils.ptReso = RecoDecay::pt(RecoDecay::sumOfVec(varUtils.pVectorProng0, varUtils.pVectorProng1, pVecTrack)); + if (!cfgQaPlots.applyCutsForQaHistograms || + (varUtils.invMassD0 > cfgQaPlots.cutMassDMin && + varUtils.invMassD0 < cfgQaPlots.cutMassDMax)) { + if (track.sign() > 0) { + registry.fill(HIST("hMassD0Proton"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0); + } else { + registry.fill(HIST("hMassD0Proton"), varUtils.ptReso, varUtils.invMassReso - varUtils.invMassD0Bar); + } + } + } + break; + default: + break; // no other D meson types expected + } // end of DType switch + // fill track table + if (!selectedTracks.count(track.globalIndex())) { + hfTrackNoParam(indexHfReducedCollision, + track.px(), track.py(), track.pz(), track.sign(), + track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), + track.hasTOF(), track.hasTPC(), track.itsNCls(), track.tpcNClsCrossedRows(), track.tpcChi2NCl()); + selectedTracks[track.globalIndex()] = hfTrackNoParam.lastIndex(); } - } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ - hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), - indexHfReducedCollision, - trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), - trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), - trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, - ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); - hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), - trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), - trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), - trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), - trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), - trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); - hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), 0., 0., charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); - hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), 0., 0., charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); + fillHfCandD = true; + } // end of loop on bachelor tracks + } // end of do tracks + // fill D candidate table + if (fillHfCandD) { // fill candDplus table only once per D candidate, only if at least one V0 is found + if constexpr (dType == DType::Dstar || dType == DType::Dplus) { + hfCandD3Pr(prongIdsD[0], prongIdsD[1], prongIdsD[2], + indexHfReducedCollision, + secondaryVertexD[0], secondaryVertexD[1], secondaryVertexD[2], + candD.pxProng0(), candD.pyProng0(), candD.pzProng0(), + candD.pxProng1(), candD.pyProng1(), candD.pzProng1(), + varUtils.pVectorProng2[0], varUtils.pVectorProng2[1], varUtils.pVectorProng2[2], + nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, dtype); if constexpr (withMl) { - std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; - if (candC.mlProbD0().size() == NSizeMLScore) { - std::copy(candC.mlProbD0().begin(), candC.mlProbD0().end(), mlScores.begin()); - } - if (candC.mlProbD0bar().size() == NSizeMLScore) { - std::copy(candC.mlProbD0bar().begin(), candC.mlProbD0bar().end(), mlScores.begin() + 3); - } - hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + hfCandD3PrMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); + } + } else if constexpr (dType == DType::D0) { + uint8_t selFlagD0 = {BIT(D0Sel::selectedD0) | BIT(D0Sel::selectedD0Bar)}; + if (candD.isSelD0() < cfgDmesCuts.selectionFlagD0) { + CLRBIT(selFlagD0, D0Sel::selectedD0); + } + if (candD.isSelD0bar() < cfgDmesCuts.selectionFlagD0Bar) { + CLRBIT(selFlagD0, D0Sel::selectedD0Bar); + } + hfCandD2Pr(prongIdsD[0], prongIdsD[1], + indexHfReducedCollision, + secondaryVertexD[0], secondaryVertexD[1], secondaryVertexD[2], + candD.pxProng0(), candD.pyProng0(), candD.pzProng0(), + candD.pxProng1(), candD.pyProng1(), candD.pzProng1(), + nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax, + selFlagD0); + if constexpr (withMl) { + hfCandD2PrMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); } } fillHfReducedCollision = true; + if constexpr (dType == DType::Dstar) { + registry.fill(HIST("hMassVsPtDstarPaired"), candD.pt(), varUtils.invMassD - varUtils.invMassD0); + } else if constexpr (dType == DType::Dplus) { + registry.fill(HIST("hMassVsPtDplusPaired"), candD.pt(), varUtils.invMassD); + } else if constexpr (dType == DType::D0) { + registry.fill(HIST("hMassVsPtD0Paired"), candD.pt(), varUtils.invMassD0); + registry.fill(HIST("hMassVsPtD0BarPaired"), candD.pt(), varUtils.invMassD0Bar); + } + registry.fill(HIST("hDType"), dtype); } - } // candsC loop - + } // candsD loop registry.fill(HIST("hEvents"), 1 + Event::Processed); if (!fillHfReducedCollision) { - registry.fill(HIST("hEvents"), 1 + Event::NoCharmHadPiSelected); + registry.fill(HIST("hEvents"), 1 + Event::NoDV0Selected); return; } - registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); + registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); - hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), - collision.covXZ(), collision.covYZ(), collision.covZZ()); - hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - if constexpr (withQvec) { - hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), - collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), - collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), - collision.qvecTPCposRe(), collision.qvecTPCposIm(), collision.nTrkTPCpos(), - collision.qvecTPCnegRe(), collision.qvecTPCnegIm(), collision.nTrkTPCneg(), - collision.qvecTPCallRe(), collision.qvecTPCallIm(), collision.nTrkTPCall()); - } - } + } // end of runDataCreation function + // to be modified in the future to allow for different decay channels template void runMcGen(aod::McParticles const& particlesMc) { @@ -1281,99 +1320,53 @@ struct HfDataCreatorCharmHadPiReduced { for (const auto& particle : particlesMc) { int8_t sign{0}; int8_t flag{0}; - if constexpr (decayChannel == DecayChannel::B0ToDminusPi) { - // B0 → D- π+ - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDPlus), +kPiPlus}, true)) { - // Match D- -> π- K+ π- - auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); - // Printf("Checking D- -> π- K+ π-"); - if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDPlus), std::array{-kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { - flag = sign * BIT(hf_cand_b0::DecayType::B0ToDPi); - } - } - - // save information for B0 task - if (!TESTBIT(std::abs(flag), hf_cand_b0::DecayType::B0ToDPi)) { - continue; - } - - auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(particle.pVector(), massB); - auto etaParticle = particle.eta(); - - std::array ptProngs; - std::array yProngs; - std::array etaProngs; - int counter = 0; - for (const auto& daught : particle.daughters_as()) { - ptProngs[counter] = daught.pt(); - etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); - counter++; - } - rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1]); - } else if constexpr (decayChannel == DecayChannel::BsToDsminusPi) { - // Bs → Ds- π+ - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { - // Match Ds- -> π- K+ π- - auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); - if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; - RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); - if (arrDaughDsIndex.size() == NDaughtersDs) { - for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { - auto daughJ = particlesMc.rawIteratorAt(arrDaughDsIndex[jProng]); - arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); - } - // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- - if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); - } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi); + int8_t signDstar{0}; + int8_t signDplus{0}; + int8_t signV0{0}; + int8_t origin = 0; + std::vector idxBhadMothers{}; + + if constexpr (decayChannel == DecayChannel::DstarV0) { + // Ds1 → D* K0 + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS1, std::array{static_cast(Pdg::kDStar), +kK0}, true, &sign, 1)) { + registry.fill(HIST("hMCSignCounter"), sign); + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCGenOrigin"), origin); + auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + auto candDstarMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // K0 -> K0s -> π+π- + if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { + // D* -> D0 π+ -> K-π+π+ + if (RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kD0), +static_cast(kPiPlus)}, true, &signDstar, 1)) { + auto candD0MC = particlesMc.rawIteratorAt(candDstarMC.daughtersIds().front()); + if (RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signDstar, 2)) { + flag = signDstar * DecayTypeMc::Ds1ToDstarK0ToD0PiK0s; + } else if (RecoDecay::isMatchedMCGen(particlesMc, candD0MC, Pdg::kD0, std::array{-kKPlus, +kPiPlus, +kPiPlus, +kPi0}, true, &signDstar, 2) || + RecoDecay::isMatchedMCGen(particlesMc, candD0MC, Pdg::kD0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPi0}, true, &signDstar, 2)) { + flag = signDstar * DecayTypeMc::Ds1ToDstarK0ToD0PiK0sPart; } + } else if (RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kGamma)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kGamma)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kPi0)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kPi0)}, true, &signDstar, 1)) { + auto candDplusMC = particlesMc.rawIteratorAt(candDstarMC.daughtersIds().front()); + if (RecoDecay::isMatchedMCGen(particlesMc, candDplusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDplus, 2)) + flag = sign * DecayTypeMc::Ds1ToDstarK0ToDplusPi0K0s; } } - } - - // additional checks for correlated backgrounds - if (checkDecayTypeMc) { - // B0 → Ds- π+ - if (!flag) { - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { - // Match Ds- -> π- K+ π- - auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); - if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { - std::vector arrDaughDsIndex; - std::array arrPDGDaughDs; - RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); - if (arrDaughDsIndex.size() == NDaughtersDs) { - for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { - auto daughJ = particlesMc.rawIteratorAt(arrDaughDsIndex[jProng]); - arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); - } - // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- - if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); - } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi); - } - } - } - } + } else { + if (std::abs(particle.pdgCode()) == Pdg::kDS1) { + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCOriginCounterWrongDecay"), origin); } } - - // save information for Bs task - if (!TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi) && !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi) && - !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi) && !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi)) { + // save information for task + if (flag == 0) { continue; } auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(particle.pVector(), massB); + auto yParticle = RecoDecay::y(particle.pVector(), MassDS1); auto etaParticle = particle.eta(); std::array ptProngs; @@ -1386,60 +1379,52 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1]); - } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { - // B+ → D0bar π+ - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{-static_cast(Pdg::kD0), +kPiPlus}, true)) { - // Match D0bar -> π- K+ - auto candD0MC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); - // Printf("Checking D0bar -> π- K+"); - if (RecoDecay::isMatchedMCGen(particlesMc, candD0MC, static_cast(Pdg::kD0), std::array{+kPiPlus, -kKPlus}, true, &sign)) { - flag = sign * BIT(hf_cand_bplus::DecayType::BplusToD0Pi); + registry.fill(HIST("hMCGenCounter"), flag, ptParticle); + rowHfResoMcGenReduced(flag, origin, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } else if constexpr (decayChannel == DecayChannel::DplusV0) { // Ds2Star → D+ K0 + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS2Star, std::array{static_cast(Pdg::kDPlus), +kK0}, true, &sign, 1)) { + registry.fill(HIST("hMCSignCounter"), sign); + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCGenOrigin"), origin); + auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + auto candDplusMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // K0 -> K0s -> π+π- + if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { + // D* -> D0 π+ -> K-π+π+ + if (RecoDecay::isMatchedMCGen(particlesMc, candDplusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDplus, 2)) { + flag = sign * DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi; + } } - } - - // save information for B+ task - if (!TESTBIT(std::abs(flag), hf_cand_bplus::DecayType::BplusToD0Pi)) { - continue; - } - - auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(particle.pVector(), massB); - auto etaParticle = particle.eta(); - - std::array ptProngs; - std::array yProngs; - std::array etaProngs; - int counter = 0; - for (const auto& daught : particle.daughters_as()) { - ptProngs[counter] = daught.pt(); - etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); - counter++; - } - rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1]); - } else if constexpr (decayChannel == DecayChannel::LbToLcplusPi) { - // Lb → Lc+ π- - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kLambdaB0, std::array{static_cast(Pdg::kLambdaCPlus), -kPiPlus}, true)) { - // Match Lc+ → p K- π+ - auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); - // Printf("Checking Lc+ → p K- π+"); - if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, static_cast(Pdg::kLambdaCPlus), std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2)) { - flag = sign * BIT(hf_cand_lb::DecayType::LbToLcPi); + } else if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS1, std::array{static_cast(Pdg::kDStar), +kK0}, true, &sign, 1)) { + auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + // K0 -> K0s -> π+π- + if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { + auto candDstarMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // D* -> D+ π0/γ ->π+K-π+ π0/γ + if (RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kGamma)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kGamma)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kPi0)}, true, &signDstar, 1) || + RecoDecay::isMatchedMCGen(particlesMc, candDstarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), -static_cast(kPi0)}, true, &signDstar, 1)) { + auto candDplusMC = particlesMc.rawIteratorAt(candDstarMC.daughtersIds().front()); + if (RecoDecay::isMatchedMCGen(particlesMc, candDplusMC, Pdg::kDPlus, std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &signDplus, 2)) + flag = sign * DecayTypeMc::Ds1ToDstarK0ToDplusPi0K0s; + } + } + } else { + if (std::abs(particle.pdgCode()) == Pdg::kDS2Star) { + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCOriginCounterWrongDecay"), origin); } } - - // save information for Lc task - if (!TESTBIT(std::abs(flag), hf_cand_lb::DecayType::LbToLcPi)) { + // save information for task + if (flag == 0) { continue; } auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(particle.pVector(), massB); + auto yParticle = RecoDecay::y(particle.pVector(), MassDS2Star); auto etaParticle = particle.eta(); std::array ptProngs; @@ -1452,722 +1437,576 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfLbMcGenReduced(flag, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1]); - } - } // gen - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - // PROCESS FUNCTIONS FOR DATA - - void processDplusPiData(CollisionsWCent const& collisions, - CandsDplusFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + registry.fill(HIST("hMCGenCounter"), flag, ptParticle); + rowHfResoMcGenReduced(flag, origin, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } // Dplus V0 + } // for loop + } // gen + + // Process functions + // No ML + // Data + // D* + void processDstarV0(soa::Join const& collisions, + CandsDstarFiltered const& candsDstar, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiData, "Process DplusPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0, "Process Dstar candidates paired with V0s", true); - void processDplusPiDataWithMl(CollisionsWCent const& collisions, - CandsDplusFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDstarTrack(soa::Join const& collisions, + CandsDstarFiltered const& candsDstar, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithMl, "Process DplusPi without MC info and with ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarTrack, "Process Dstar candidates paired with Tracks", false); - void processDplusPiDataWithQvec(CollisionsWCentAndQvectors const& collisions, - CandsDplusFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDstarV0AndTrack(soa::Join const& collisions, + CandsDstarFiltered const& candsDstar, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithQvec, "Process DplusPi without MC info, without ML info and with Q-vectors", true); - - void processDplusPiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, - CandsDplusFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0AndTrack, "Process Dstar candidates paired with V0s and Tracks", false); + + // Dplus + void processDplusV0(soa::Join const& collisions, + CandsDplusFiltered const& candsDplus, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithMlAndQvec, "Process DplusPi without MC info, with ML info and with Q-vectors", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0, "Process Dplus candidates paired with V0s", false); - void processDsPiData(CollisionsWCent const& collisions, - CandsDsFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDplusTrack(soa::Join const& collisions, + CandsDplusFiltered const& candsDplus, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiData, "Process DsPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusTrack, "Process Dplus candidates paired with Tracks", false); - void processDsPiDataWithMl(CollisionsWCent const& collisions, - CandsDsFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDplusV0AndTrack(soa::Join const& collisions, + CandsDplusFiltered const& candsDplus, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithMl, "Process DsPi without MC info and with ML info", false); - - void processDsPiDataWithQvec(CollisionsWCentAndQvectors const& collisions, - CandsDsFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0AndTrack, "Process Dplus candidates paired with V0s and Tracks", false); + + // D0 + void processD0V0(soa::Join const& collisions, + CandsD0Filtered const& candsD0, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithQvec, "Process DsPi without MC info, without ML info and with Q-vectors", true); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0V0, "Process D0 candidates paired with V0s", false); - void processDsPiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, - CandsDsFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processD0Track(soa::Join const& collisions, + CandsD0Filtered const& candsD0, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithMlAndQvec, "Process DsPi without MC info, with ML info and Q-vectors", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0Track, "Process D0 candidates paired with Tracks", false); - void processD0PiData(CollisionsWCent const& collisions, - CandsD0Filtered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processD0V0AndTrack(soa::Join const& collisions, + CandsD0Filtered const& candsD0, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiData, "Process D0Pi without MC info and without ML info", false); - - void processD0PiDataWithMl(CollisionsWCent const& collisions, - CandsD0FilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0V0AndTrack, "Process D0 candidates paired with V0s and Tracks", false); + + // MC + // D* + void processDstarV0MC(soa::Join const& collisions, + CandsDstarFiltered const& candsDstar, + aod::V0s const& v0s, + TracksIUWithPIDAndMC const& tracksIU, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, particlesMc, bcs); } + runMcGen(particlesMc); // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithMl, "Process D0Pi without MC info and with ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0MC, "Process Dstar candidates paired with V0s with MC matching", false); - void processD0PiDataWithQvec(CollisionsWCentAndQvectors const& collisions, - CandsD0Filtered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + // Dplus + void processDplusV0MC(soa::Join const& collisions, + CandsDplusFiltered const& candsDplus, + aod::V0s const& v0s, + TracksIUWithPIDAndMC const& tracksIU, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, particlesMc, bcs); } + runMcGen(particlesMc); // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithQvec, "Process D0Pi without MC info, without ML info, and with Q-vectors", false); - - void processD0PiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, - CandsD0FilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0MC, "Process Dstar candidates paired with V0s with MC matching", false); + // D0 + // Not implemented yet + + // ML + // Data + // D* + void processDstarV0WithMl(soa::Join const& collisions, + CandsDstarFilteredWithMl const& candsDstar, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithMlAndQvec, "Process D0Pi without MC info, with ML info, and with Q-vectors", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0WithMl, "Process Dstar candidates paired with V0s with ML info", false); - void processLcPiData(CollisionsWCent const& collisions, - CandsLcFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDstarTrackWithMl(soa::Join const& collisions, + CandsDstarFilteredWithMl const& candsDstar, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Lb workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiData, "Process LcPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarTrackWithMl, "Process Dstar candidates paired with Tracks with ML info", false); - void processLcPiDataWithMl(CollisionsWCent const& collisions, - CandsLcFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSel const& tracks, - aod::BCsWithTimestamps const& bcs) + void processDstarV0AndTrackWithMl(soa::Join const& collisions, + CandsDstarFilteredWithMl const& candsDstar, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Lb workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiDataWithMl, "Process LcPi without MC info and with ML info", false); - - //////////////////////////////////////////////////////////////////////////////////////////////////// - // PROCESS FUNCTIONS FOR MC - - void processDplusPiMc(CollisionsWCentAndMcLabels const& collisions, - CandsDplusFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0AndTrackWithMl, "Process Dstar candidates paired with V0s and Tracks with ML info", false); + + // Dplus + void processDplusV0WithMl(soa::Join const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiMc, "Process DplusPi with MC info and without ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0WithMl, "Process Dplus candidates paired with V0s with ML info", false); - void processDplusPiMcWithMl(CollisionsWCentAndMcLabels const& collisions, - CandsDplusFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + void processDplusTrackWithMl(soa::Join const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B0 workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiMcWithMl, "Process DplusPi with MC info and with ML info", false); - - void processDsPiMc(CollisionsWCentAndMcLabels const& collisions, - CandsDsFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) - { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusTrackWithMl, "Process Dplus candidates paired with Tracks with ML info", false); + void processDplusV0AndTrackWithMl(soa::Join const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) + { int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiMc, "Process DsPi with MC info and without ML info", false); - - void processDsPiMcWithMl(CollisionsWCentAndMcLabels const& collisions, - CandsDsFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0AndTrackWithMl, "Process Dplus candidates paired with V0s and Tracks with ML info", false); + + // D0 + void processD0V0WithMl(soa::Join const& collisions, + CandsD0FilteredWithMl const& candsD0, + aod::V0s const& v0s, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Bs workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, tracksIU, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiMcWithMl, "Process DsPi with MC info and with ML info", false); - - void processD0PiMc(CollisionsWCentAndMcLabels const& collisions, - CandsD0Filtered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) - { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0V0WithMl, "Process D0 candidates paired with V0s with ML info", false); + void processD0TrackWithMl(soa::Join const& collisions, + CandsD0FilteredWithMl const& candsD0, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + aod::BCsWithTimestamps const& bcs) + { int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, trackIdsThisColl, tracks, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiMc, "Process D0Pi with MC info and without ML info", false); - - void processD0PiMcWithMl(CollisionsWCentAndMcLabels const& collisions, - CandsD0FilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0TrackWithMl, "Process D0 candidates paired with Tracks with ML info", false); + + void processD0V0AndTrackWithMl(soa::Join const& collisions, + CandsD0FilteredWithMl const& candsD0, + aod::V0s const& v0s, + aod::TrackAssoc const& trackIndices, + TracksWithPID const& tracks, + TracksIUWithPID const& tracksIU, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for B+ workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, trackIdsThisColl, tracks, tracksIU, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiMcWithMl, "Process D0Pi with MC info and with ML info", false); - - void processLcPiMc(CollisionsWCentAndMcLabels const& collisions, - CandsLcFiltered const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processD0V0AndTrackWithMl, "Process D0 candidates paired with V0s and Tracks with ML info", false); + + // MC + // D* + void processDstarV0MCWithMl(soa::Join const& collisions, + CandsDstarFilteredWithMl const& candsDstar, + aod::V0s const& v0s, + TracksIUWithPIDAndMC const& tracksIU, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Lb workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagDplus.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, particlesMc, bcs); } + runMcGen(particlesMc); // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiMc, "Process LcPi with MC info and without ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0MCWithMl, "Process Dstar candidates paired with V0s with MC matching and with ML info", false); - void processLcPiMcWithMl(CollisionsWCentAndMcLabels const& collisions, - CandsLcFilteredWithMl const& candsC, - aod::TrackAssoc const& trackIndices, - TracksPidWithSelAndMc const& tracks, - aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs, - McCollisions const&) + // Dplus + void processDplusV0MCWithMl(soa::Join const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::V0s const& v0s, + TracksIUWithPIDAndMC const& tracksIU, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) { - // store configurables needed for Lb workflow - if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, invMassWindowCharmHadPi.value); - isHfCandBhadConfigFilled = true; - } - int zvtxColl{0}; int sel8Coll{0}; int zvtxAndSel8Coll{0}; int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); - + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); - int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, v0sThisColl, v0sThisColl, tracksIU, tracksIU, particlesMc, bcs); } + runMcGen(particlesMc); // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); - runMcGen(particlesMc); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiMcWithMl, "Process LcPi with MC info and with ML info", false); - + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0MCWithMl, "Process Dplus candidates paired with V0s with MC matching and with ML info", false); + // D0 + // Not implemented yet }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } + diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 7283dd41855..1bd9fa9151c 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -1,3 +1,4 @@ + // 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. @@ -15,18 +16,11 @@ /// \author Luca Aglietta , UniTO Turin /// \author Fabrizio Grosa , CERN -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include +#include +#include +#include +#include #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -36,11 +30,20 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include -#include -#include -#include -#include +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" using namespace o2; using namespace o2::analysis; @@ -1305,7 +1308,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function @@ -1459,7 +1462,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1482,7 +1485,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); @@ -1508,7 +1511,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1533,7 +1536,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1556,7 +1559,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); @@ -1582,7 +1585,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1607,7 +1610,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1630,7 +1633,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); @@ -1656,7 +1659,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1683,7 +1686,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1709,7 +1712,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1738,7 +1741,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1761,7 +1764,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); @@ -1787,7 +1790,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1812,7 +1815,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1835,7 +1838,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); @@ -1861,7 +1864,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1886,7 +1889,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1909,7 +1912,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); @@ -1935,7 +1938,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsD0.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1962,7 +1965,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -1988,7 +1991,7 @@ struct HfDataCreatorCharmResoReduced { int zvtxAndSel8CollAndSoftTrig{0}; int allSelColl{0}; for (const auto& collision : collisions) { - o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto v0sThisColl = v0s.sliceBy(candsV0PerCollision, thisCollId); @@ -2007,3 +2010,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } + diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 539b7599750..53b22dfe969 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -86,7 +86,7 @@ o2physics_add_dpl_workflow(task-dstar-to-d0-pi o2physics_add_dpl_workflow(task-flow-charm-hadrons SOURCES taskFlowCharmHadrons.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-lb diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index ad85ac61fb8..862b4910c72 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -14,24 +14,23 @@ /// /// \author S. Politanò, INFN Torino, Italy /// \author Wu Chuntai, CUG, China -/// \author Ran Tu, Fudan University, China -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" - -#include "Common/Core/EventPlaneHelper.h" -#include "Common/DataModel/Qvectors.h" +#include +#include #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include -#include +#include "Common/Core/EventPlaneHelper.h" +#include "Common/DataModel/Qvectors.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::aod; @@ -49,8 +48,7 @@ enum DecayChannel { DplusToPiKPi = 0, LcToPKPi, LcToPiKP, XicToPKPi, - XicToPiKP, - Xic0ToXiPi + XicToPiKP }; enum QvecEstimator { FV0A = 0, @@ -77,11 +75,25 @@ struct HfTaskFlowCharmHadrons { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> classMl{"classMl", {0, 2}, "Indexes of BDT scores to be stored. Two indexes max."}; - HfHelper hfHelper; - EventPlaneHelper epHelper; - HfEventSelection hfEvSel; // event selection and monitoring - o2::framework::Service ccdb; - SliceCache cache; + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""}; + ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisPsi{"thnConfigAxisPsi", {6000, 2. * TMath::Pi(), 2. * TMath::Pi()}, ""}; + ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisOccupancyITS{"thnConfigAxisOccupancyITS", {14, 0, 14000}, ""}; + ConfigurableAxis thnConfigAxisOccupancyFT0C{"thnConfigAxisOccupancyFT0C", {14, 0, 140000}, ""}; + ConfigurableAxis thnConfigAxisNoSameBunchPileup{"thnConfigAxisNoSameBunchPileup", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{"thnConfigAxisNoCollInTimeRangeNarrow", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{"thnConfigAxisNoCollInTimeRangeStandard", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisNoCollInRofStandard{"thnConfigAxisNoCollInRofStandard", {2, 0, 2}, ""}; + ConfigurableAxis thnConfigAxisResoFT0cFV0a{"thnConfigAxisResoFT0cFV0a", {160, -8, 8}, ""}; + ConfigurableAxis thnConfigAxisResoFT0cTPCtot{"thnConfigAxisResoFT0cTPCtot", {160, -8, 8}, ""}; + ConfigurableAxis thnConfigAxisResoFV0aTPCtot{"thnConfigAxisResoFV0aTPCtot", {160, -8, 8}, ""}; using CandDsDataWMl = soa::Filtered>; using CandDsData = soa::Filtered>; @@ -91,8 +103,6 @@ struct HfTaskFlowCharmHadrons { using CandLcDataWMl = soa::Filtered>; using CandXicData = soa::Filtered>; using CandXicDataWMl = soa::Filtered>; - using CandXic0Data = soa::Filtered>; - using CandXic0DataWMl = soa::Filtered>; using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; @@ -102,7 +112,6 @@ struct HfTaskFlowCharmHadrons { Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; Filter filterSelectLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag; Filter filterSelectXicCandidates = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag || aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; - Filter filterSelectXic0Candidates = aod::hf_sel_toxipi::resultSelections >= selectionFlag; Partition selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; Partition selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; @@ -120,28 +129,12 @@ struct HfTaskFlowCharmHadrons { Partition selectedXicToPiKP = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; Partition selectedXicToPKPiWMl = aod::hf_sel_candidate_xic::isSelXicToPKPi >= selectionFlag; Partition selectedXicToPiKPWMl = aod::hf_sel_candidate_xic::isSelXicToPiKP >= selectionFlag; - Partition selectedXic0 = aod::hf_sel_toxipi::resultSelections >= selectionFlag; - Partition selectedXic0WMl = aod::hf_sel_toxipi::resultSelections >= selectionFlag; - ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {100, 1.78, 2.05}, ""}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {10, 0., 10.}, ""}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {10000, 0., 100.}, ""}; - ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisPsi{"thnConfigAxisPsi", {6000, 0, constants::math::TwoPI}, ""}; - ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; - ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisMlOne{"thnConfigAxisMlOne", {1000, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisMlTwo{"thnConfigAxisMlTwo", {1000, 0., 1.}, ""}; - ConfigurableAxis thnConfigAxisOccupancyITS{"thnConfigAxisOccupancyITS", {14, 0, 14000}, ""}; - ConfigurableAxis thnConfigAxisOccupancyFT0C{"thnConfigAxisOccupancyFT0C", {14, 0, 140000}, ""}; - ConfigurableAxis thnConfigAxisNoSameBunchPileup{"thnConfigAxisNoSameBunchPileup", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{"thnConfigAxisNoCollInTimeRangeNarrow", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{"thnConfigAxisNoCollInTimeRangeStandard", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisNoCollInRofStandard{"thnConfigAxisNoCollInRofStandard", {2, 0, 2}, ""}; - ConfigurableAxis thnConfigAxisResoFT0cFV0a{"thnConfigAxisResoFT0cFV0a", {160, -8, 8}, ""}; - ConfigurableAxis thnConfigAxisResoFT0cTPCtot{"thnConfigAxisResoFT0cTPCtot", {160, -8, 8}, ""}; - ConfigurableAxis thnConfigAxisResoFV0aTPCtot{"thnConfigAxisResoFV0aTPCtot", {160, -8, 8}, ""}; + SliceCache cache; + HfHelper hfHelper; + EventPlaneHelper epHelper; + HfEventSelection hfEvSel; // event selection and monitoring + o2::framework::Service ccdb; HistogramRegistry registry{"registry", {}}; @@ -238,15 +231,15 @@ struct HfTaskFlowCharmHadrons { } if (storeResoOccu) { - std::vector axesReso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot}; + std::vector axes_reso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot}; if (occEstimator == 1) { - axesReso.insert(axesReso.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy, - thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + axes_reso.insert(axes_reso.end(), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); } else { - axesReso.insert(axesReso.end(), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy, - thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); + axes_reso.insert(axes_reso.end(), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy, + thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard}); } - registry.add("spReso/hSparseReso", "THn for resolution with occupancy", HistType::kTHnSparseF, axesReso); + registry.add("spReso/hSparseReso", "THn for resolution with occupancy", HistType::kTHnSparseF, axes_reso); } hfEvSel.addHistograms(registry); // collision monitoring @@ -292,44 +285,6 @@ struct HfTaskFlowCharmHadrons { } } - /// Compute the Q vector for the candidate's tracks - /// \param cand is the candidate - /// \param tracksQx is the X component of the Q vector for the tracks - /// \param tracksQy is the Y component of the Q vector for the tracks - /// \param channel is the decay channel - template - void getQvecXic0Tracks(const T1& cand, - std::vector& tracksQx, - std::vector& tracksQy, - float ampl) - { - // add possibility to consider different weights for the tracks, at the moment only pT is considered; - float pXTrack0 = cand.pxPosV0Dau(); - float pYTrack0 = cand.pyPosV0Dau(); - float pTTrack0 = std::hypot(pXTrack0, pYTrack0); - float phiTrack0 = std::atan2(pXTrack0, pYTrack0); - float pXTrack1 = cand.pxNegV0Dau(); - float pYTrack1 = cand.pyNegV0Dau(); - float pTTrack1 = std::hypot(pXTrack1, pYTrack1); - float phiTrack1 = std::atan2(pXTrack1, pYTrack1); - float pYTrack2 = cand.pxBachFromCasc(); - float pXTrack2 = cand.pyBachFromCasc(); - float pTTrack2 = std::hypot(pXTrack2, pYTrack2); - float phiTrack2 = std::atan2(pXTrack2, pYTrack2); - float pXTrack3 = cand.pxBachFromCharmBaryon(); - float pYTrack3 = cand.pyBachFromCharmBaryon(); - float pTTrack3 = std::hypot(pXTrack3, pYTrack3); - float phiTrack3 = std::atan2(pXTrack3, pYTrack3); - - tracksQx.push_back(std::cos(harmonic * phiTrack0) * pTTrack0 / ampl); - tracksQy.push_back(std::sin(harmonic * phiTrack0) * pTTrack0 / ampl); - tracksQx.push_back(std::cos(harmonic * phiTrack1) * pTTrack1 / ampl); - tracksQy.push_back(std::sin(harmonic * phiTrack1) * pTTrack1 / ampl); - tracksQx.push_back(std::cos(harmonic * phiTrack2) * pTTrack2 / ampl); - tracksQy.push_back(std::sin(harmonic * phiTrack2) * pTTrack2 / ampl); - tracksQx.push_back(std::cos(harmonic * phiTrack3) * pTTrack3 / ampl); - tracksQy.push_back(std::sin(harmonic * phiTrack3) * pTTrack3 / ampl); - } /// Compute the delta psi in the range [0, pi/harmonic] /// \param psi1 is the first angle /// \param psi2 is the second angle @@ -337,7 +292,12 @@ struct HfTaskFlowCharmHadrons { float getDeltaPsiInRange(float psi1, float psi2) { float deltaPsi = psi1 - psi2; - deltaPsi = RecoDecay::constrainAngle(deltaPsi, -o2::constants::math::PI / harmonic, harmonic); + if (std::abs(deltaPsi) > constants::math::PI / harmonic) { + if (deltaPsi > 0.) + deltaPsi -= constants::math::TwoPI / harmonic; + else + deltaPsi += constants::math::TwoPI / harmonic; + } return deltaPsi; } @@ -422,7 +382,7 @@ struct HfTaskFlowCharmHadrons { float& centrality) { float occupancy = getOccupancyColl(collision, occEstimator); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); /// monitor the satisfied event selections @@ -495,7 +455,7 @@ struct HfTaskFlowCharmHadrons { if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry, nullptr); + hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, cent, ccdb, registry); } std::vector qVecs = getQvec(collision); @@ -592,36 +552,18 @@ struct HfTaskFlowCharmHadrons { default: break; } - } else if constexpr (std::is_same_v || std::is_same_v) { - massCand = candidate.invMassCharmBaryon(); - if constexpr (std::is_same_v) { - for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) - outputMl[iclass] = candidate.mlProbToXiPi()[classMl->at(iclass)]; - } } - float ptCand = 0.; - float phiCand = 0.; - - if constexpr (std::is_same_v || std::is_same_v) { - ptCand = candidate.kfptXic(); - phiCand = std::atan2(candidate.pxCharmBaryon(), candidate.pyCharmBaryon()); - } else { - ptCand = candidate.pt(); - phiCand = candidate.phi(); - } + float ptCand = candidate.pt(); + float phiCand = candidate.phi(); // If TPC is used for the SP estimation, the tracks of the hadron candidate must be removed from the TPC Q vector to avoid double counting if (qvecDetector == QvecEstimator::TPCNeg || qvecDetector == QvecEstimator::TPCPos) { float ampl = amplQVec - static_cast(nProngs); std::vector tracksQx = {}; std::vector tracksQy = {}; - if constexpr (std::is_same_v || std::is_same_v) { - // std::cout<(candidate, tracksQx, tracksQy, ampl); - } + + getQvecDtracks(candidate, tracksQx, tracksQy, ampl); for (auto iTrack{0u}; iTrack < tracksQx.size(); ++iTrack) { xQVec -= tracksQx[iTrack]; yQVec -= tracksQy[iTrack]; @@ -741,24 +683,6 @@ struct HfTaskFlowCharmHadrons { } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic, "Process Xic candidates", false); - // Xic0 with ML - void processXic0Ml(CollsWithQvecs::iterator const& collision, - CandXic0DataWMl const&) - { - auto candsXic0WMl = selectedXic0WMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXic0WMl); - } - PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic0Ml, "Process Xic0 candidates with ML", false); - - // Xic0 - void processXic0(CollsWithQvecs::iterator const& collision, - CandXic0Data const&) - { - auto candsXic0 = selectedXic0->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - runFlowAnalysis(collision, candsXic0); - } - PROCESS_SWITCH(HfTaskFlowCharmHadrons, processXic0, "Process Xic0 candidates", false); - // Resolution void processResolution(CollsWithQvecs::iterator const& collision, aod::BCsWithTimestamps const& bcs) @@ -784,7 +708,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 805243c34e2..a083e9713b2 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -16,16 +16,16 @@ #ifndef PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ #define PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include + +#include #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisHelpers.h" #include "Framework/HistogramRegistry.h" -#include - -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Utils/utilsEvSelHf.h" namespace o2::hf_evsel { @@ -37,7 +37,7 @@ template const& ccdb, o2::framework::HistogramRegistry& registry) { float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (!TESTBIT(rejectionMask, o2::hf_evsel::EventRejection::Trigger)) { sel8Coll++; } @@ -81,31 +81,6 @@ float getTpcTofNSigmaPi1(const T1& prong1) } return defaultNSigma; } - -/// Helper function to retrive PID information of bachelor kaon from b-hadron decay -/// \param prong1 kaon track from reduced data format, aod::HfRedBachProng0Tracks -/// \return the combined TPC and TOF n-sigma for kaon -template -float getTpcTofNSigmaKa1(const T1& prong1) -{ - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - - bool hasTpc = prong1.hasTPC(); - bool hasTof = prong1.hasTOF(); - - if (hasTpc && hasTof) { - float tpcNSigma = prong1.tpcNSigmaKa(); - float tofNSigma = prong1.tofNSigmaKa(); - return std::sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); - } - if (hasTpc) { - return std::abs(prong1.tpcNSigmaKa()); - } - if (hasTof) { - return std::abs(prong1.tofNSigmaKa()); - } - return defaultNSigma; -} } // namespace o2::pid_tpc_tof_utils #endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ diff --git a/PWGHF/HFC/TableProducer/CMakeLists.txt b/PWGHF/HFC/TableProducer/CMakeLists.txt index ececa170cae..99f2c4fb152 100644 --- a/PWGHF/HFC/TableProducer/CMakeLists.txt +++ b/PWGHF/HFC/TableProducer/CMakeLists.txt @@ -71,5 +71,5 @@ o2physics_add_dpl_workflow(correlator-lc-sc-hadrons o2physics_add_dpl_workflow(femto-dream-producer SOURCES femtoDreamProducer.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::MLCore COMPONENT_NAME Analysis) diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 7c4560a663b..ee8ec8aaa26 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -14,36 +14,39 @@ /// \author Ravindra Singh, GSI, ravindra.singh@cern.ch /// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch -#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/HfMlResponseLcToPKPi.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include +#include + +#include "TMCProcess.h" + +#include "CCDB/BasicCCDBManager.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 "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/Propagator.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "TMCProcess.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseLcToPKPi.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" using namespace o2; using namespace o2::framework; @@ -407,7 +410,7 @@ struct HfFemtoDreamProducer { multNtr = col.multTracklets(); } - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(col, mult, ccdb, qaRegistry); qaRegistry.fill(HIST("hEventQA"), 1 + Event::All); diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index ee119699809..aa94cea8c22 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -62,12 +62,12 @@ o2physics_add_dpl_workflow(candidate-creator-bs o2physics_add_dpl_workflow(candidate-creator-cascade SOURCES candidateCreatorCascade.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-dstar SOURCES candidateCreatorDstar.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-lb @@ -87,12 +87,12 @@ o2physics_add_dpl_workflow(candidate-creator-sigmac0plusplus-cascade o2physics_add_dpl_workflow(candidate-creator-xic0-omegac0 SOURCES candidateCreatorXic0Omegac0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils KFParticle::KFParticle COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xic-to-xi-pi-pi SOURCES candidateCreatorXicToXiPiPi.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-xicc diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index bff41fee008..58c811bddb9 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -108,18 +108,20 @@ struct HfCandidateCreator2Prong { void init(InitContext const&) { - std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, + std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C, - doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M}; - std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, + doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUPC, doprocessNoPvRefitWithDCAFitterNUPC}; + std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C, - doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M}; + doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUPC, doprocessNoPvRefitWithKFParticleUPC}; if ((std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) + std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0)) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } - std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M}; + std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUPC}; const int nProcessesCollisions = std::accumulate(processesCollisions.begin(), processesCollisions.end(), 0); + std::array processesCollisionsUPC = {doprocessPvRefitWithDCAFitterNUPC, doprocessNoPvRefitWithDCAFitterNUPC, doprocessPvRefitWithKFParticleUPC, doprocessNoPvRefitWithKFParticleUPC, doprocessCollisionsUPC}; + const int nProcessesCollisionsUPC = std::accumulate(processesCollisionsUPC.begin(), processesCollisionsUPC.end(), 0); if (nProcessesCollisions > 1) { LOGP(fatal, "At most one process function for collision monitoring can be enabled at a time."); } @@ -134,6 +136,9 @@ struct HfCandidateCreator2Prong { LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsCentFT0M\"?"); } } + if (nProcessesCollisionsUPC > 1 && isRun2) { + LOGP(fatal, "Process function for UPC is only available in Run 3!"); + } // histograms registry.add("hMass2", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 1.6, 2.1}}}); @@ -181,7 +186,7 @@ struct HfCandidateCreator2Prong { setLabelHistoCands(hCandidates); } - template + template void runCreator2ProngWithDCAFitterN(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, @@ -193,7 +198,12 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + uint32_t rejectionMask{0}; + if constexpr (useUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -329,7 +339,7 @@ struct HfCandidateCreator2Prong { } } - template + template void runCreator2ProngWithKFParticle(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, @@ -341,7 +351,12 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + uint32_t rejectionMask{0}; + if constexpr (useUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -491,9 +506,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/ PV refit and w/o centrality selections", false); @@ -501,9 +516,9 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/o PV refit and w/o centrality selections", true); @@ -511,9 +526,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticle, "Run candidate creator using KFParticle package w/ PV refit and w/o centrality selections", false); @@ -521,9 +536,9 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticle, "Run candidate creator using KFParticle package w/o PV refit and w/o centrality selections", false); @@ -537,9 +552,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0C", false); @@ -547,9 +562,9 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0C", false); @@ -557,9 +572,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0C", false); @@ -567,9 +582,9 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on FT0C", false); @@ -583,9 +598,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0M", false); @@ -593,9 +608,9 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0M", false); @@ -603,9 +618,9 @@ struct HfCandidateCreator2Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0M", false); @@ -613,12 +628,58 @@ struct HfCandidateCreator2Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on FT0M", false); + ///////////////////////////////////////////// + /// /// + /// with centrality selection on UPC /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithDCAFitterNUPC(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNUPC, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on UltraPeripheral Collision", false); + + /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection UPC + void processNoPvRefitWithDCAFitterNUPC(soa::Join const& collisions, + aod::Hf2Prongs const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNUPC, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection UltraPeripheral Collision", false); + + /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithKFParticleUPC(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleUPC, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on UltraPeripheral Collision", false); + + /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections on UPC + void processNoPvRefitWithKFParticleUPC(soa::Join const& collisions, + aod::Hf2Prongs const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleUPC, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on UltraPeripheral Collision", false); + /////////////////////////////////////////////////////////// /// /// /// Process functions only for collision monitoring /// @@ -626,7 +687,7 @@ struct HfCandidateCreator2Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -634,7 +695,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -644,7 +705,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -652,7 +713,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -662,7 +723,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -670,7 +731,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -678,6 +739,24 @@ struct HfCandidateCreator2Prong { } /// end loop over collisions } PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsCentFT0M, "Collision monitoring - FT0M centrality", false); + + /// @brief process function to monitor collisions - UPC collision + void processCollisionsUPC(soa::Join const& collisions, aod::BCFullInfos const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + /// loop over collisions + for (const auto& collision : collisions) { + + /// bitmask with event. selection info + float centrality{-1.f}; + float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + + /// monitor the satisfied event selections + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); + + } /// end loop over collisions + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsUPC, "Collision monitoring - UPC", false); }; /// Extends the base table with expression columns. diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index c37a3e94d56..d4641775ecf 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -134,18 +134,21 @@ struct HfCandidateCreator3Prong { void init(InitContext const&) { - std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, + std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C, - doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M}; - std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, + doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUPC, doprocessNoPvRefitWithDCAFitterNUPC}; + std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C, - doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M}; + doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUPC, doprocessNoPvRefitWithKFParticleUPC}; if ((std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) + std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0)) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } - - std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M}; + std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUPC}; const int nProcessesCollisions = std::accumulate(processesCollisions.begin(), processesCollisions.end(), 0); + + std::array processesCollisionsUPC = {doprocessPvRefitWithDCAFitterNUPC, doprocessNoPvRefitWithDCAFitterNUPC, doprocessPvRefitWithKFParticleUPC, doprocessNoPvRefitWithKFParticleUPC, doprocessCollisionsUPC}; + const int nProcessesCollisionsUPC = std::accumulate(processesCollisionsUPC.begin(), processesCollisionsUPC.end(), 0); + if (nProcessesCollisions > 1) { LOGP(fatal, "At most one process function for collision monitoring can be enabled at a time."); } @@ -160,7 +163,9 @@ struct HfCandidateCreator3Prong { LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsCentFT0M\"?"); } } - + if (nProcessesCollisionsUPC > 1 && isRun2) { + LOGP(fatal, "Process function for UPC is only available in Run 3!"); + } std::array creationFlags = {createDplus, createDs, createLc, createXic}; if (std::accumulate(creationFlags.begin(), creationFlags.end(), 0) == 0) { LOGP(fatal, "At least one particle specie should be enabled for the creation."); @@ -234,11 +239,8 @@ struct HfCandidateCreator3Prong { } } - template - void runCreator3ProngWithDCAFitterN(Coll const&, - Cand const& rowsTrackIndexProng3, - TracksWCovExtraPidPiKaPr const&, - BCsType const& bcs) + template + void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, BCsType const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { @@ -246,7 +248,12 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + uint32_t rejectionMask{0}; + if constexpr (useUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -402,7 +409,7 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, @@ -412,7 +419,12 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + uint32_t rejectionMask{0}; + if constexpr (useUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -425,7 +437,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -650,9 +662,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter with PV refit and w/o centrality selections", false); @@ -660,9 +672,9 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter without PV refit and w/o centrality selections", true); @@ -670,9 +682,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticle(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticle, "Run candidate creator using KFParticle package with PV refit and w/o centrality selections", false); @@ -680,9 +692,9 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticle(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticle, "Run candidate creator using KFParticle package without PV refit and w/o centrality selections", false); @@ -696,9 +708,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on FT0C", false); @@ -706,9 +718,9 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on FT0C", false); @@ -716,9 +728,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on FT0C", false); @@ -726,9 +738,9 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on FT0C", false); @@ -742,9 +754,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on FT0M", false); @@ -752,9 +764,9 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on FT0M", false); @@ -762,9 +774,9 @@ struct HfCandidateCreator3Prong { void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on FT0M", false); @@ -772,12 +784,58 @@ struct HfCandidateCreator3Prong { void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const& tracks, - aod::BCFullInfos const& bcWithTimeStamps) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on FT0M", false); + ///////////////////////////////////////////// + /// /// + /// with centrality selection on UPC /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithDCAFitterNUPC(soa::Join const& collisions, + FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNUPC, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection on UPC + void processNoPvRefitWithDCAFitterNUPC(soa::Join const& collisions, + FilteredHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNUPC, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithKFParticleUPC(soa::Join const& collisions, + FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleUPC, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using KFParticle package w/o PV refit and w/ centrality selection on UPC + void processNoPvRefitWithKFParticleUPC(soa::Join const& collisions, + FilteredHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BCFullInfos const& bcWithTimeStamps, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleUPC, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on UPC", false); + /////////////////////////////////////////////////////////// /// /// /// Process functions only for collision monitoring /// @@ -785,7 +843,7 @@ struct HfCandidateCreator3Prong { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -793,7 +851,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -803,7 +861,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -811,7 +869,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -821,7 +879,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { @@ -829,7 +887,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -837,6 +895,24 @@ struct HfCandidateCreator3Prong { } /// end loop over collisions } PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsCentFT0M, "Collision monitoring - FT0M centrality", false); + + /// @brief process function to monitor collisions - UPC + void processCollisionsUPC(soa::Join const& collisions, aod::BCFullInfos const& bcs, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, aod::Zdcs const& /*zdcs*/) + { + /// loop over collisions + for (const auto& collision : collisions) { + + /// bitmask with event. selection info + float centrality{-1.f}; + float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC(collision, centrality, ccdb, registry, bcs); + + /// monitor the satisfied event selections + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); + + } /// end loop over collisions + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsUPC, "Collision monitoring - UPC", false); }; /// Extends the base table with expression columns. @@ -854,6 +930,7 @@ struct HfCandidateCreator3ProngExpressions { HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring + using BCsInfo = soa::Join; using McCollisionsNoCents = soa::Join; using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; @@ -890,7 +967,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - aod::BCFullInfos const&) + BCsInfo const&) { rowCandidateProng3->bindExternalIndices(&tracks); @@ -1089,14 +1166,14 @@ struct HfCandidateCreator3ProngExpressions { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -1114,7 +1191,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -1124,7 +1201,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -1134,7 +1211,7 @@ struct HfCandidateCreator3ProngExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreator3ProngMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 1f2000022bd..04faa873da7 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -15,31 +15,32 @@ /// \author Chiara Zampolli, , CERN /// Paul Buehler, , Vienna -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGHF/Utils/utilsTrkCandHf.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include +#include +#include -#include "Common/Core/trackUtilities.h" +#include #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include +#include "Common/Core/trackUtilities.h" -#include -#include -#include +#include "PWGLF/DataModel/mcCentrality.h" + +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" using namespace o2; using namespace o2::analysis; @@ -155,7 +156,7 @@ struct HfCandidateCreatorCascade { V0full const&, V0fCfull const&, aod::TracksWCov const&, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { // loop over pairs of track indices @@ -164,7 +165,7 @@ struct HfCandidateCreatorCascade { auto collision = casc.template collision_as(); /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -250,7 +251,7 @@ struct HfCandidateCreatorCascade { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); bz = o2::base::Propagator::Instance()->getNominalBz(); @@ -349,7 +350,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -362,7 +363,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -375,7 +376,7 @@ struct HfCandidateCreatorCascade { V0full const& v0Full, V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcs) { runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } @@ -388,14 +389,14 @@ struct HfCandidateCreatorCascade { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -405,14 +406,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -422,14 +423,14 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -451,6 +452,7 @@ struct HfCandidateCreatorCascadeMc { HfEventSelectionMc hfEvSelMc; // mc event selection and monitoring using MyTracksWMc = soa::Join; + using BCsInfo = soa::Join; using McCollisionsNoCents = soa::Join; using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; @@ -486,7 +488,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - aod::BCFullInfos const&) + BCsInfo const&) { // Match reconstructed candidates. rowCandidateCasc->bindExternalIndices(&tracks); @@ -551,14 +553,14 @@ struct HfCandidateCreatorCascadeMc { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -621,7 +623,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -631,7 +633,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -641,7 +643,7 @@ struct HfCandidateCreatorCascadeMc { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorCascMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index ecf0ef506e6..f25a09dbbb3 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -27,8 +27,8 @@ #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" // O2Physics #include "Common/Core/trackUtilities.h" // PWGLF @@ -186,12 +186,12 @@ struct HfCandidateCreatorDstar { /// @param rowsTrackIndexD0 D0 table object from trackIndexSkimCreator.cxx /// @param tracks track table with Cov object /// @param bcWithTimeStamps Bunch Crossing with timestamps - template + template void runCreatorDstar(Coll const&, CandsDstar const& rowsTrackIndexDstar, aod::Hf2Prongs const&, TracksWCovExtraPidPiKa const&, - BCsType const& bcs) + aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { // LOG(info) << "runCreatorDstar function called"; // LOG(info) << "candidate loop starts"; @@ -201,7 +201,7 @@ struct HfCandidateCreatorDstar { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexDstar.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -228,7 +228,7 @@ struct HfCandidateCreatorDstar { //..................................................Doubt: Should I apply a condition of (collisionPiId == collisionD0Id) /// Set the magnetic field from ccdb. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { // LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); @@ -391,9 +391,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefit, " Run candidate creator with PV refit and w/o centrality selections", false); @@ -402,9 +402,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefit, " Run candidate creator without PV refit and w/o centrality selections", true); @@ -419,9 +419,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0C, " Run candidate creator with PV refit nad w/ centrality selection on FT0C", false); @@ -430,9 +430,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefitCentFT0C, " Run candidate creator without PV refit and w centrality selection on FT0C", false); @@ -447,9 +447,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0M, " Run candidate creator with PV refit nad w/ centrality selection on FT0M", false); @@ -458,9 +458,9 @@ struct HfCandidateCreatorDstar { aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, TracksWCovExtraPidPiKa const& tracks, - aod::BCFullInfos const& bcs) + aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcs); + runCreatorDstar(collisions, rowsTrackIndexDstar, rowsTrackIndexD0, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreatorDstar, processNoPvRefitCentFT0M, " Run candidate creator without PV refit and w/ centrality selection on FT0M", false); @@ -471,14 +471,14 @@ struct HfCandidateCreatorDstar { /////////////////////////////////////////////////////////// /// @brief process function to monitor collisions - no centrality - void processCollisions(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisions(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -488,14 +488,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisions, "Collision monitoring - no centrality", true); /// @brief process function to monitor collisions - FT0C centrality - void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0C(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -505,14 +505,14 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processCollisionsCentFT0C, "Collision monitoring - FT0C centrality", false); /// @brief process function to monitor collisions - FT0M centrality - void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCFullInfos const& bcs) + void processCollisionsCentFT0M(soa::Join const& collisions, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { /// loop over collisions for (const auto& collision : collisions) { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, &bcs); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -537,6 +537,7 @@ struct HfCandidateCreatorDstarExpressions { using McCollisionsFT0Cs = soa::Join; using McCollisionsFT0Ms = soa::Join; using McCollisionsCentFT0Ms = soa::Join; + using BCsInfo = soa::Join; Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -570,7 +571,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, CCs const& collInfos, McCollisions const& mcCollisions, - aod::BCFullInfos const&) + BCsInfo const&) { rowsCandidateD0->bindExternalIndices(&tracks); rowsCandidateDstar->bindExternalIndices(&tracks); @@ -717,14 +718,14 @@ struct HfCandidateCreatorDstarExpressions { int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); nSplitColl = collSlice.size(); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex()); - rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); } hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { @@ -789,7 +790,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsNoCents const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -799,7 +800,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Cs const& collInfos, aod::McCollisions const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } @@ -809,7 +810,7 @@ struct HfCandidateCreatorDstarExpressions { aod::McParticles const& mcParticles, McCollisionsFT0Ms const& collInfos, McCollisionsCentFT0Ms const& mcCollisions, - aod::BCFullInfos const& BCsInfo) + BCsInfo const& BCsInfo) { runCreatorDstarMc(tracks, mcParticles, collInfos, mcCollisions, BCsInfo); } diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 204b46e7588..754272af541 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -27,41 +27,42 @@ #include /// includes KFParticle -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" - -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Tools/KFparticle/KFUtilities.h" +#include "KFParticle.h" +#include "KFParticleBase.h" +#include "KFPTrack.h" +#include "KFPVertex.h" +#include "KFVertex.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" -#include "DCAFitter/DCAFitterN.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" +#include "DCAFitter/DCAFitterN.h" #include "DetectorsBase/Propagator.h" -#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/RunningWorkflowInfo.h" +#include "Framework/ASoAHelpers.h" #include "Framework/runDataProcessing.h" +#include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/Track.h" #include "ReconstructionDataFormats/V0.h" -#include "KFPTrack.h" -#include "KFPVertex.h" -#include "KFParticle.h" -#include "KFParticleBase.h" -#include "KFVertex.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Tools/KFparticle/KFUtilities.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" + +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::track; @@ -407,7 +408,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -741,7 +742,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1219,7 +1220,7 @@ struct HfCandidateCreatorXic0Omegac0 { auto collision = cand.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1857,7 +1858,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1874,7 +1875,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -1891,7 +1892,7 @@ struct HfCandidateCreatorXic0Omegac0 { /// bitmask with event. selection info float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality); diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 5dcb3a01f55..69fea11d5c9 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -21,36 +21,37 @@ #define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle) #endif -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include +#include +#include +#include -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Tools/KFparticle/KFUtilities.h" +#include +#include +#include +#include +#include + +#include #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" +#include "Framework/RunningWorkflowInfo.h" -#include +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Tools/KFparticle/KFUtilities.h" -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" -#include -#include -#include -#include +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::constants::physics; @@ -192,7 +193,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -433,7 +434,7 @@ struct HfCandidateCreatorXicToXiPiPi { // check if the event is selected auto collision = rowTrackIndexXicPlus.collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -807,7 +808,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -824,7 +825,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); @@ -841,7 +842,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 925dd224744..5d15d1a83bf 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -138,11 +138,11 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { uint32_t rejectionMask; if constexpr (applyUPCSel) { - rejectionMask = hfEvSel.getHfCollisionRejectionMask( - collision, centrality, ccdb, registry, &bcs); + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUPC( + collision, centrality, ccdb, registry, bcs); } else { rejectionMask = hfEvSel.getHfCollisionRejectionMask( - collision, centrality, ccdb, registry, nullptr); + collision, centrality, ccdb, registry); } if (fillHistograms) { diff --git a/PWGHF/Tasks/CMakeLists.txt b/PWGHF/Tasks/CMakeLists.txt index bacdd693e73..b212b705b23 100644 --- a/PWGHF/Tasks/CMakeLists.txt +++ b/PWGHF/Tasks/CMakeLists.txt @@ -36,7 +36,7 @@ o2physics_add_dpl_workflow(task-mc-gen-pt-rap-shapes o2physics_add_dpl_workflow(task-mc-validation SOURCES taskMcValidation.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation @@ -46,7 +46,7 @@ o2physics_add_dpl_workflow(task-multiplicity-estimator-correlation o2physics_add_dpl_workflow(task-pid-studies SOURCES taskPidStudies.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB O2Physics::SGCutParHolder + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::AnalysisCCDB COMPONENT_NAME Analysis) # o2physics_add_dpl_workflow(task-sel-optimisation diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index d62c83ac4ee..269cd7b21ea 100644 --- a/PWGHF/Tasks/taskMcValidation.cxx +++ b/PWGHF/Tasks/taskMcValidation.cxx @@ -18,26 +18,27 @@ /// \author Fabrizio Grosa , CERN /// \author Fabio Catalano , CERN -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGLF/DataModel/mcCentrality.h" - -#include "Common/DataModel/CollisionAssociationTables.h" +#include +#include +#include -#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StaticFor.h" -#include "Framework/runDataProcessing.h" -#include -#include -#include +#include "CCDB/BasicCCDBManager.h" +#include "Common/DataModel/CollisionAssociationTables.h" + +#include "PWGLF/DataModel/mcCentrality.h" + +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::analysis; @@ -817,7 +818,7 @@ struct HfTaskMcValidationRec { } float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate return; @@ -847,7 +848,7 @@ struct HfTaskMcValidationRec { // check that collision is selected by hf-track-index-skim-creator-tag-sel-collisions float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -1048,7 +1049,7 @@ struct HfTaskMcValidationRec { // apply event selection float centrality{105.f}; int occupancy = collision.trackOccupancyInTimeRange(); - hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry, nullptr); // only needed to update centrality, no bitmask selection applied + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied if (!collision.has_mcCollision()) { return; } diff --git a/PWGHF/Tasks/taskPidStudies.cxx b/PWGHF/Tasks/taskPidStudies.cxx index 9233e22c0d3..ad3943a7134 100644 --- a/PWGHF/Tasks/taskPidStudies.cxx +++ b/PWGHF/Tasks/taskPidStudies.cxx @@ -17,27 +17,27 @@ /// \author Marcello Di Costanzo , Politecnico and INFN Torino /// \author Luca Aglietta , Università and INFN Torino -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Utils/utilsEvSelHf.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +#include +#include -#include "Common/CCDB/ctpRateFetcher.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 "TPDGCode.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "Framework/HistogramRegistry.h" -#include "TPDGCode.h" +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Core/CentralityEstimation.h" -#include -#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -346,7 +346,7 @@ struct HfTaskPidStudies { } float cent{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask>(coll, cent, ccdb, registry, nullptr); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, registry); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); return rejectionMask == 0; diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index c12c0b67f56..9697ade5efa 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -158,7 +158,6 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; o2::framework::Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; o2::framework::Configurable useSel8Trigger{"useSel8Trigger", true, "Apply the sel8 event selection"}; - o2::framework::Configurable useUpcTrigger{"useUpcTrigger", false, "Apply the upc event selection"}; o2::framework::Configurable triggerClass{"triggerClass", -1, "Trigger class different from sel8 (e.g. kINT7 for Run2) used only if useSel8Trigger is false"}; o2::framework::Configurable useTvxTrigger{"useTvxTrigger", true, "Apply TVX trigger sel"}; o2::framework::Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "Apply TF border cut"}; @@ -215,13 +214,13 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SGCutParHolder setSGPreselection() { SGCutParHolder sgCuts; - sgCuts.SetNDtColl(1); // Minimum number of sigma around the collision + sgCuts.SetNDtcoll(1); // Minimum number of sigma around the collision sgCuts.SetMinNBCs(2); // Minimum number of bunch crossings sgCuts.SetNTracks(2, 1000); // Minimum and maximum number of PV contributors - sgCuts.SetMaxFitTime(34.f); // Maximum FIT time in ns + sgCuts.SetMaxFITtime(34.f); // Maximum FIT time in ns // Set FIT amplitudes: FV0, FT0A, FT0C, FDDA, FDDC - sgCuts.SetFitAmpLimits({-1.f, 150.f, 50.f, -1.f, -1.f}); + sgCuts.SetFITAmpLimits({-1.f, 150.f, 50.f, -1.f, -1.f}); return sgCuts; } @@ -271,8 +270,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision template - uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, - const BCs* bcs = nullptr) + uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) { uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added @@ -331,24 +329,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { SETBIT(rejectionMask, EventRejection::Occupancy); } } - - if (useUpcTrigger) { - if (!bcs) { - throw std::runtime_error("UPC selection requested but no BC table provided!"); - } - SGCutParHolder sgCuts = setSGPreselection(); - auto bc = collision.template foundBC_as(); - auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), *bcs, sgCuts.minNBCs()); - auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); - int upcEventType = sgSelectionResult.value; - if (upcEventType > EventTypeUpc::DoubleGap) { - SETBIT(rejectionMask, EventRejection::UpcEventCut); - } else { - hUPCollisions->Fill(upcEventType); - } - } } - /// number of PV contributors if (collision.numContrib() < nPvContributorsMin) { SETBIT(rejectionMask, EventRejection::NContrib); @@ -391,6 +372,27 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } + template + uint32_t getHfCollisionRejectionMaskWithUPC(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCsType& bcs) + { + auto rejectionMaskWithUPC = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + + if (useEvSel) { + SGCutParHolder sgCuts = setSGPreselection(); + auto bc = collision.template foundBC_as(); + auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); + auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + int upcEventType = sgSelectionResult.value; + if (upcEventType > EventTypeUpc::DoubleGap) { + SETBIT(rejectionMaskWithUPC, EventRejection::UpcEventCut); + } else { + hUPCollisions->Fill(upcEventType); + } + } + + return rejectionMaskWithUPC; + } + /// \brief Fills histograms for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision From 4e5bed15d19b64b9f4d455c99edde424355beeac Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 19 Jun 2025 18:46:17 +0000 Subject: [PATCH 116/116] Please consider the following formatting changes --- .../dataCreatorCharmHadPiReduced.cxx | 37 +++++++++---------- .../dataCreatorCharmResoReduced.cxx | 1 - PWGHF/D2H/Utils/utilsRedDataFormat.h | 10 ++--- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index ea8e77a7eaa..5238f04c737 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -15,11 +15,18 @@ /// \author Luca Aglietta , UniTO Turin /// \author Fabrizio Grosa , CERN -#include -#include -#include -#include -#include +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/DCAFitterN.h" @@ -29,20 +36,11 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGLF/DataModel/LFStrangenessTables.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsEvSelHf.h" - -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" -#include "PWGHF/D2H/Utils/utilsRedDataFormat.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::analysis; @@ -2009,4 +2007,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } - diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 1bd9fa9151c..73c62213c8c 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -2010,4 +2010,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } - diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index a083e9713b2..b5cd1e07e27 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -16,16 +16,16 @@ #ifndef PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ #define PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ -#include - -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Utils/utilsEvSelHf.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/AnalysisHelpers.h" #include "Framework/HistogramRegistry.h" -#include "PWGHF/Core/CentralityEstimation.h" -#include "PWGHF/Utils/utilsEvSelHf.h" +#include + +#include namespace o2::hf_evsel {