From d6a09b663bde0cf8018d1a4586aaca4939645da9 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 21 Oct 2025 10:24:24 +0200 Subject: [PATCH 1/4] Implement BC start time shift --- .../Strangeness/strangederivedbuilder.cxx | 2 + .../Strangeness/strangenesstofpid.cxx | 406 +++++++++++++----- 2 files changed, 290 insertions(+), 118 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index 5a563a10a3d..c3e7914997b 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -389,6 +389,7 @@ struct strangederivedbuilder { } histos.add("h2dNVerticesVsCentrality", "h2dNVerticesVsCentrality", kTH2D, {axisCentrality, axisNVertices}); + histos.add("h2dCollisionTimesVsNTracks", "h2dCollisionTimesVsNTracks", kTH2D, {{100,-0.5f,99.5}, {2000, -1000.0f, 1000.0f}}); // for QA and test purposes auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1F, {axisRawCentrality}); @@ -602,6 +603,7 @@ struct strangederivedbuilder { } else { collisionEventTime[collision.globalIndex()] = -1e+6; // undefined } + histos.fill(HIST("h2dCollisionTimesVsNTracks"), collisionNtracks[collision.globalIndex()], collisionEventTime[collision.globalIndex()]); products.straEvTimes(collisionEventTime[collision.globalIndex()]); } } diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 15e2b439344..fb638cddc77 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -102,6 +102,7 @@ struct strangenesstofpid { Configurable calculateV0s{"calculateV0s", -1, "calculate V0-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable reassociateTracks{"reassociateTracks", true, "if true, reassociate tracks to the collision the V0 or cascade belongs to. Relevant especially at high IR"}; + Configurable doBCshift{"doBCshift", true, "if true, perform time shift for collisions in different BCs when reassigning"}; // auxiliary / debug tables as desired Configurable calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"}; @@ -139,7 +140,6 @@ struct strangenesstofpid { Configurable qaTPCNSigma{"qaTPCNSigma", 5, "TPC N-sigma to apply for qa plots"}; } cascadeGroup; - // CCDB options // CCDB options struct : ConfigurableGroup { std::string prefix = "ccdb"; @@ -155,20 +155,30 @@ struct strangenesstofpid { Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; - ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; - ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; - ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; - ConfigurableAxis axisDeltaTimeVsPrimaryCalculation{"axisDeltaTimeVsPrimaryCalculation", {500, -500.0f, +500.0f}, "delta-time (ps)"}; - ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; - ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; - ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; - ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; - - // master p axis - ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; - - // for zooming in at low values only (e-loss studies and effective correction) - ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; + struct : ConfigurableGroup { + ConfigurableAxis axisPosition{"axisPosition", {400, -400.f, +400.f}, "position (cm)"}; + ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; + ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; + ConfigurableAxis axisDeltaTimeVsPrimaryCalculation{"axisDeltaTimeVsPrimaryCalculation", {500, -500.0f, +500.0f}, "delta-time (ps)"}; + ConfigurableAxis axisTime{"axisTime", {400, 10000.0f, +50000.0f}, "T (ps)"}; + ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; + ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; + ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; + + // master p axis + ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; + + // for zooming in at low values only (e-loss studies and effective correction) + ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; + + // for BC shift QA plots + // binning to actually match BC shifts but show in picoseconds + const double bcShiftValuePS = o2::constants::lhc::LHCBunchSpacingNS*1000.0f; + ConfigurableAxis axisBCshift{"axisBCshift", {130, -120.5f*bcShiftValuePS, 9.5f*bcShiftValuePS}, "time shift (ps)"}; + + // very broad time axis + ConfigurableAxis axisTimeLong{"axisTimeLong", {3000, -1500000.0f, 1500000.0f}, "time (ps)"}; + } axes; // aggregate axes fo simplicity of navigation in HY // for n-sigma calibration bool nSigmaCalibLoaded; @@ -412,6 +422,20 @@ struct strangenesstofpid { // per event histos.add("hCandidateCounter", "hCandidateCounter", kTH1F, {{500, -0.5f, 499.5f}}); + histos.add("hV0PositiveBCShift", "hV0PositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hV0NegativeBCShift", "hV0NegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadePositiveBCShift", "hCascadePositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeNegativeBCShift", "hCascadeNegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeBachelorBCShift", "hCascadeBachelorBCShift", kTH1F, {axes.axisBCshift}); + + histos.add("hTOFSignalPositive", "hTOFSignalPositive", kTH1F, {axes.axisTimeLong}); + histos.add("hTOFSignalNegative", "hTOFSignalNegative", kTH1F, {axes.axisTimeLong}); + + histos.add("h2dTOFSignalPositive", "h2dTOFSignalPositive", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + histos.add("h2dTOFSignalNegative", "h2dTOFSignalNegative", kTH2F, {axes.axisTimeLong, axes.axisBCshift}); + + histos.add("hCollisionTimes", "hCollisionTimes", kTH1F, {{2000, -1000.0f, 1000.0f}}); + // measured vs expected total time QA if (doQA) { // if in mode 1, bookkeep the failures of propagation @@ -421,95 +445,95 @@ struct strangenesstofpid { // standard deltaTime values if (calculateV0s.value > 0) { - histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveLambdaPi", "h2dDeltaTimePositiveLambdaPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPi", "h2dDeltaTimeNegativeLambdaPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveLambdaPr", "h2dDeltaTimePositiveLambdaPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeLambdaPr", "h2dDeltaTimeNegativeLambdaPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); // delta time with respect to primary-like calculation - histos.add("h2dDiffFromPrimCalcPositiveLambdaPi", "h2dDiffFromPrimCalcPositiveLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeLambdaPi", "h2dDiffFromPrimCalcNegativeLambdaPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcPositiveLambdaPr", "h2dDiffFromPrimCalcPositiveLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeLambdaPr", "h2dDiffFromPrimCalcNegativeLambdaPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcPositiveK0ShortPi", "h2dDiffFromPrimCalcPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dDiffFromPrimCalcNegativeK0ShortPi", "h2dDiffFromPrimCalcNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveLambdaPi", "h2dDiffFromPrimCalcPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPi", "h2dDiffFromPrimCalcNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveLambdaPr", "h2dDiffFromPrimCalcPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeLambdaPr", "h2dDiffFromPrimCalcNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcPositiveK0ShortPi", "h2dDiffFromPrimCalcPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dDiffFromPrimCalcNegativeK0ShortPi", "h2dDiffFromPrimCalcNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); // QA collision reassociation fraction (from track -> V0/cascade coll index) - histos.add("h2dCorrectAssocPositiveLambdaPi", "h2dCorrectAssocPositiveLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeLambdaPi", "h2dCorrectAssocNegativeLambdaPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocPositiveLambdaPr", "h2dCorrectAssocPositiveLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeLambdaPr", "h2dCorrectAssocNegativeLambdaPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocPositiveK0ShortPi", "h2dCorrectAssocPositiveK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dCorrectAssocNegativeK0ShortPi", "h2dCorrectAssocNegativeK0ShortPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveLambdaPi", "h2dCorrectAssocPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPi", "h2dCorrectAssocNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveLambdaPr", "h2dCorrectAssocPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeLambdaPr", "h2dCorrectAssocNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocPositiveK0ShortPi", "h2dCorrectAssocPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dCorrectAssocNegativeK0ShortPi", "h2dCorrectAssocNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); } if (calculateCascades.value > 0) { - histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - - histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); - histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axisP, axisEta, axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsXiPi", "h2dposDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsXiPr", "h2dposDeltaTimeAsXiPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPi", "h2dnegDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsXiPr", "h2dnegDeltaTimeAsXiPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsXiPi", "h2dbachDeltaTimeAsXiPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + + histos.add("h2dposDeltaTimeAsOmPi", "h2dposDeltaTimeAsOmPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dposDeltaTimeAsOmPr", "h2dposDeltaTimeAsOmPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPi", "h2dnegDeltaTimeAsOmPi", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dnegDeltaTimeAsOmPr", "h2dnegDeltaTimeAsOmPr", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); + histos.add("h2dbachDeltaTimeAsOmKa", "h2dbachDeltaTimeAsOmKa", {HistType::kTH3F, {axes.axisP, axes.axisEta, axes.axisDeltaTime}}); // delta time with respect to primary-like calculation - histos.add("h2dposDiffFromPrimCalcAsXiPi", "h2dposDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dposDiffFromPrimCalcAsXiPr", "h2dposDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsXiPi", "h2dnegDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsXiPr", "h2dnegDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dbachDiffFromPrimCalcAsXiPi", "h2dbachDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - - histos.add("h2dposDiffFromPrimCalcAsOmPi", "h2dposDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dposDiffFromPrimCalcAsOmPr", "h2dposDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsOmPi", "h2dnegDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dnegDiffFromPrimCalcAsOmPr", "h2dnegDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); - histos.add("h2dbachDiffFromPrimCalcAsOmKa", "h2dbachDiffFromPrimCalcAsOmKa", {HistType::kTH2F, {axisP, axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsXiPi", "h2dposDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsXiPr", "h2dposDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPi", "h2dnegDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsXiPr", "h2dnegDiffFromPrimCalcAsXiPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsXiPi", "h2dbachDiffFromPrimCalcAsXiPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + + histos.add("h2dposDiffFromPrimCalcAsOmPi", "h2dposDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dposDiffFromPrimCalcAsOmPr", "h2dposDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPi", "h2dnegDiffFromPrimCalcAsOmPi", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dnegDiffFromPrimCalcAsOmPr", "h2dnegDiffFromPrimCalcAsOmPr", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); + histos.add("h2dbachDiffFromPrimCalcAsOmKa", "h2dbachDiffFromPrimCalcAsOmKa", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTimeVsPrimaryCalculation}}); // QA collision reassociation fraction (from track -> V0/cascade coll index) - histos.add("h2dposCorrectAssocAsXiPi", "h2dposCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dposCorrectAssocAsXiPr", "h2dposCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsXiPi", "h2dnegCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsXiPr", "h2dnegCorrectAssocAsXiPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dbachCorrectAssocAsXiPi", "h2dbachCorrectAssocAsXiPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - - histos.add("h2dposCorrectAssocAsOmPi", "h2dposCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dposCorrectAssocAsOmPr", "h2dposCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsOmPi", "h2dnegCorrectAssocAsOmPi", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dnegCorrectAssocAsOmPr", "h2dnegCorrectAssocAsOmPr", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); - histos.add("h2dbachCorrectAssocAsOmKa", "h2dbachCorrectAssocAsOmKa", {HistType::kTH2F, {axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsXiPi", "h2dposCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsXiPr", "h2dposCorrectAssocAsXiPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPi", "h2dnegCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsXiPr", "h2dnegCorrectAssocAsXiPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsXiPi", "h2dbachCorrectAssocAsXiPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + + histos.add("h2dposCorrectAssocAsOmPi", "h2dposCorrectAssocAsOmPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dposCorrectAssocAsOmPr", "h2dposCorrectAssocAsOmPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPi", "h2dnegCorrectAssocAsOmPi", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dnegCorrectAssocAsOmPr", "h2dnegCorrectAssocAsOmPr", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); + histos.add("h2dbachCorrectAssocAsOmKa", "h2dbachCorrectAssocAsOmKa", {HistType::kTH2F, {axes.axisP, {2, -0.5f, 1.5f}}}); } - histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); - histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisP, {4, -0.5, 3.5f}}}); + histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axes.axisP, {4, -0.5, 3.5f}}}); + histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axes.axisP, {4, -0.5, 3.5f}}}); if (doQANSigma) { if (calculateV0s.value > 0) { - histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPi", "h2dNSigmaNegativeLambdaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaPositiveLambdaPr", "h2dNSigmaPositiveLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeLambdaPr", "h2dNSigmaNegativeLambdaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaPositiveK0ShortPi", "h2dNSigmaPositiveK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaNegativeK0ShortPi", "h2dNSigmaNegativeK0ShortPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); } if (calculateCascades.value > 0) { - histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axisP, axisNSigma}}); - histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axisP, axisNSigma}}); + histos.add("h2dNSigmaXiLaPi", "h2dNSigmaXiLaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaXiLaPr", "h2dNSigmaXiLaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaXiPi", "h2dNSigmaXiPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmLaPi", "h2dNSigmaOmLaPi", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmLaPr", "h2dNSigmaOmLaPr", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); + histos.add("h2dNSigmaOmKa", "h2dNSigmaOmKa", {HistType::kTH2F, {axes.axisP, axes.axisNSigma}}); } } // delta lambda decay time - histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axisP, axisDeltaTime}}); + histos.add("h2dLambdaDeltaDecayTime", "h2dLambdaDeltaDecayTime", {HistType::kTH2F, {axes.axisP, axes.axisDeltaTime}}); } } @@ -769,9 +793,10 @@ struct strangenesstofpid { //_____________________________________________________________________________________________ // Actual calculation - if (pTof.hasTOF && pTof.hasITS) { - float velocityPositivePr, velocityPositivePi, lengthPositive; - velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + float velocityPositivePr, velocityPositivePi, lengthPositive; + velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; + + if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); @@ -845,9 +870,9 @@ struct strangenesstofpid { } } } - if (nTof.hasTOF && nTof.hasITS) { - float velocityNegativePr, velocityNegativePi, lengthNegative; - velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + float velocityNegativePr, velocityNegativePi, lengthNegative; + velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; + if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); @@ -921,6 +946,23 @@ struct strangenesstofpid { } } + // temporarily commented out + // bool compatibleK0Short = true; + // int incompatibilityReason = 0; + // if (std::abs(v0tof.nSigmaPositiveK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaPositiveK0ShortPi) > 4) { + // compatibleK0Short = false; // reject only if info present and incompatible + // incompatibilityReason += 1; + // } + // if (std::abs(v0tof.nSigmaNegativeK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaNegativeK0ShortPi) > 4) { + // compatibleK0Short = false; // reject only if info present and incompatible + // incompatibilityReason += 2; + // } + + // if(!compatibleK0Short && passesQAcuts && k0ShortCandidate){ + // histos.fill(HIST("hIncompatibilityReason"), incompatibilityReason); + // // LOGF(info, "Incompatible K0, sigmas = (%.2f %.2f), lengths = (%.2f %.2f) tofSignals = (%.2f %.2f) evtimes = (%.2f %.2f)", v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi, lengthPositive, lengthNegative, pTof.tofSignal, nTof.tofSignal, pTof.tofEvTime, nTof.tofEvTime); + // } + // calculation of delta-decay-time (no reliance on event time) if (nTof.hasTOF && pTof.hasTOF > 0) { // does not depend on event time v0tof.deltaDecayTimeLambda = (pTof.tofSignal - v0tof.timePositivePr) - (nTof.tofSignal - v0tof.timeNegativePi); @@ -1289,7 +1331,7 @@ struct strangenesstofpid { return casctof; } - void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const& tracks, aod::BCsWithTimestamps const& /*bcs*/) + void processStandardData(aod::BCs const& bcs, aod::Collisions const& collisions, V0OriginalDatas const& V0s, CascOriginalDatas const& cascades, TracksWithAllExtras const& tracks, aod::BCsWithTimestamps const& /*bcs*/) { // Fire up CCDB with first collision in record. If no collisions, bypass if (useCustomRunNumber || collisions.size() < 1) { @@ -1316,6 +1358,7 @@ struct strangenesstofpid { } else { collisionEventTime[collision.globalIndex()] = -1e+6; // undefined } + histos.fill(HIST("hCollisionTimes"), collisionEventTime[collision.globalIndex()]); } if (calculateV0s.value) { @@ -1324,6 +1367,37 @@ struct strangenesstofpid { auto pTra = V0.posTrack_as(); auto nTra = V0.negTrack_as(); + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; + + auto collisionV0 = collisions.rawIteratorAt(V0.collisionId()); + auto bcV0 = bcs.rawIteratorAt(collisionV0.bcId()); + + if(pTra.collisionId()>=0){ + auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); + auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); + const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS*deltaBcPos*1000.0f; + histos.fill(HIST("hV0PositiveBCShift"), deltaTimePos); + } + + if(nTra.collisionId()>=0){ + auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); + auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); + const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS*deltaBcNeg*1000.0f; + histos.fill(HIST("hV0NegativeBCShift"), deltaTimeNeg); + } + + if(pTof.hasTOF){ + histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); + histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimePos); + } + + if(nTof.hasTOF){ + histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); + histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeNeg); + } pTof.collisionId = pTra.collisionId(); pTof.hasITS = pTra.hasITS(); @@ -1331,7 +1405,7 @@ struct strangenesstofpid { pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); pTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : pTra.tofEvTime(); - pTof.tofSignal = pTra.tofSignal(); + pTof.tofSignal = pTra.tofSignal() + (doBCshift ? deltaTimePos : 0.0f); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); @@ -1342,7 +1416,7 @@ struct strangenesstofpid { nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); nTof.tofEvTime = reassociateTracks ? collisionEventTime[V0.collisionId()] : nTra.tofEvTime(); - nTof.tofSignal = nTra.tofSignal(); + nTof.tofSignal = nTra.tofSignal() + (doBCshift ? deltaTimeNeg : 0.0f); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); @@ -1380,13 +1454,44 @@ struct strangenesstofpid { auto nTra = cascade.negTrack_as(); auto bTra = cascade.bachelor_as(); + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; + double deltaTimeBach = 0.0f; + + auto collisionCascade = collisions.rawIteratorAt(cascade.collisionId()); + auto bcV0 = bcs.rawIteratorAt(collisionCascade.bcId()); + + if(pTra.collisionId()>=0){ + auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); + auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); + const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS*deltaBcPos*1000.0f; + histos.fill(HIST("hCascadePositiveBCShift"), deltaTimePos); + } + + if(nTra.collisionId()>=0){ + auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); + auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); + const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS*deltaBcNeg*1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeNeg); + } + + if(bTra.collisionId()>=0){ + auto collisionBach = collisions.rawIteratorAt(bTra.collisionId()); + auto bcBach = bcs.rawIteratorAt(collisionBach.bcId()); + const int64_t deltaBcBach = bcBach.globalBC() - bcV0.globalBC(); + deltaTimeBach = o2::constants::lhc::LHCBunchSpacingNS*deltaBcBach*1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBach); + } + pTof.collisionId = pTra.collisionId(); pTof.hasITS = pTra.hasITS(); pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); pTof.tofExpMom = pTra.tofExpMom(); pTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : pTra.tofEvTime(); - pTof.tofSignal = pTra.tofSignal(); + pTof.tofSignal = pTra.tofSignal() + (doBCshift ? deltaTimePos : 0.0f); pTof.length = pTra.length(); pTof.tpcNSigmaPi = pTra.tpcNSigmaPi(); pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); @@ -1397,7 +1502,7 @@ struct strangenesstofpid { nTof.hasTOF = nTra.hasTOF(); nTof.tofExpMom = nTra.tofExpMom(); nTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : nTra.tofEvTime(); - nTof.tofSignal = nTra.tofSignal(); + nTof.tofSignal = nTra.tofSignal() + (doBCshift ? deltaTimeNeg : 0.0f); nTof.length = nTra.length(); nTof.tpcNSigmaPi = nTra.tpcNSigmaPi(); nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); @@ -1408,7 +1513,7 @@ struct strangenesstofpid { bTof.hasTOF = bTra.hasTOF(); bTof.tofExpMom = bTra.tofExpMom(); bTof.tofEvTime = reassociateTracks ? collisionEventTime[cascade.collisionId()] : bTra.tofEvTime(); - bTof.tofSignal = bTra.tofSignal(); + bTof.tofSignal = bTra.tofSignal() + (doBCshift ? deltaTimeBach : 0.0f); bTof.length = bTra.length(); bTof.tpcNSigmaPi = bTra.tpcNSigmaPi(); bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); @@ -1435,6 +1540,10 @@ struct strangenesstofpid { { bool isNewTOFFormat = true; // can only happen for new format + for (const auto& collision : collisions) { + histos.fill(HIST("hCollisionTimes"), collision.eventTime()); + } + // auto-determine if using old format if (dauTrackTOFPIDs.size() != 0) { auto firstTOFPID = dauTrackTOFPIDs.rawIteratorAt(0); @@ -1474,6 +1583,9 @@ struct strangenesstofpid { auto pTra = V0.posTrackExtra_as(); auto nTra = V0.negTrackExtra_as(); + double deltaTimeBcPos = 1e+6; + double deltaTimeBcNeg = 1e+6; + pTof.hasITS = pTra.hasITS(); pTof.hasTPC = pTra.hasTPC(); pTof.hasTOF = pTra.hasTOF(); @@ -1481,11 +1593,22 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); - pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofSignal = pTofExt.tofSignal(); - pTof.length = pTofExt.length(); + + if(pTofExt.straCollisionId()>=0){ + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); + deltaTimeBcPos = deltaTimeBc; + + // assign variables + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); + } } nTof.hasITS = nTra.hasITS(); @@ -1495,11 +1618,31 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); - nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofSignal = nTofExt.tofSignal(); - nTof.length = nTofExt.length(); + + if(nTofExt.straCollisionId()>=0){ + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); + deltaTimeBcNeg = deltaTimeBc; + + // assign variables + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); + } + } + if(pTof.hasTOF){ + histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); + histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimeBcPos); + } + + if(nTof.hasTOF){ + histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); + histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeBcNeg); } v0TofInfo v0tof = calculateTofInfoV0(collisions, V0.straCollisionId(), V0, pTof, nTof); @@ -1543,11 +1686,20 @@ struct strangenesstofpid { pTof.tpcNSigmaPr = pTra.tpcNSigmaPr(); if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); - pTof.collisionId = pTofExt.straCollisionId(); - pTof.tofExpMom = pTofExt.tofExpMom(); - pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); - pTof.tofSignal = pTofExt.tofSignal(); - pTof.length = pTofExt.length(); + + if(pTofExt.straCollisionId()>=0){ + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); + + pTof.collisionId = pTofExt.straCollisionId(); + pTof.tofExpMom = pTofExt.tofExpMom(); + pTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : pTofExt.tofEvTime(); + pTof.tofSignal = pTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + pTof.length = pTofExt.length(); + } } nTof.hasITS = nTra.hasITS(); @@ -1557,11 +1709,20 @@ struct strangenesstofpid { nTof.tpcNSigmaPr = nTra.tpcNSigmaPr(); if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); - nTof.collisionId = nTofExt.straCollisionId(); - nTof.tofExpMom = nTofExt.tofExpMom(); - nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); - nTof.tofSignal = nTofExt.tofSignal(); - nTof.length = nTofExt.length(); + + if(nTofExt.straCollisionId()>=0){ + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); + + nTof.collisionId = nTofExt.straCollisionId(); + nTof.tofExpMom = nTofExt.tofExpMom(); + nTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : nTofExt.tofEvTime(); + nTof.tofSignal = nTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + nTof.length = nTofExt.length(); + } } bTof.hasITS = bTra.hasITS(); @@ -1571,11 +1732,20 @@ struct strangenesstofpid { bTof.tpcNSigmaKa = bTra.tpcNSigmaKa(); if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); - bTof.collisionId = bTofExt.straCollisionId(); - bTof.tofExpMom = bTofExt.tofExpMom(); - bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); - bTof.tofSignal = bTofExt.tofSignal(); - bTof.length = bTofExt.length(); + + if(bTofExt.straCollisionId()>=0){ + // extract BC for BC time shift + auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); + const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); + + bTof.collisionId = bTofExt.straCollisionId(); + bTof.tofExpMom = bTofExt.tofExpMom(); + bTof.tofEvTime = reassociateTracks.value ? collision.eventTime() : bTofExt.tofEvTime(); + bTof.tofSignal = bTofExt.tofSignal() + (doBCshift.value ? deltaTimeBc : 0.0f); + bTof.length = bTofExt.length(); + } } cascTofInfo casctof = calculateTofInfoCascade(collisions, cascade.straCollisionId(), cascade, pTof, nTof, bTof); From 642561a06a9b15e9fac096fc0de77003c3c4f280 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Tue, 21 Oct 2025 10:37:44 +0200 Subject: [PATCH 2/4] Please consider the following formatting changes (#490) --- .../Strangeness/strangederivedbuilder.cxx | 2 +- .../Strangeness/strangenesstofpid.cxx | 96 +++++++++---------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index c3e7914997b..4c7129dd583 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -389,7 +389,7 @@ struct strangederivedbuilder { } histos.add("h2dNVerticesVsCentrality", "h2dNVerticesVsCentrality", kTH2D, {axisCentrality, axisNVertices}); - histos.add("h2dCollisionTimesVsNTracks", "h2dCollisionTimesVsNTracks", kTH2D, {{100,-0.5f,99.5}, {2000, -1000.0f, 1000.0f}}); + histos.add("h2dCollisionTimesVsNTracks", "h2dCollisionTimesVsNTracks", kTH2D, {{100, -0.5f, 99.5}, {2000, -1000.0f, 1000.0f}}); // for QA and test purposes auto hRawCentrality = histos.add("hRawCentrality", "hRawCentrality", kTH1F, {axisRawCentrality}); diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index fb638cddc77..d4d6d455656 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -164,17 +164,17 @@ struct strangenesstofpid { ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; ConfigurableAxis axisRatioMethods{"axisRatioMethods", {400, 0.9f, 1.9f}, "T_{method 1}/T_{method 0}"}; ConfigurableAxis axisSnp{"axisSnp", {220, -1.1f, 1.1f}, "snp"}; - + // master p axis ConfigurableAxis axisP{"axisP", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"}; // for zooming in at low values only (e-loss studies and effective correction) ConfigurableAxis axisSmallP{"axisSmallP", {250, 0.0f, 2.5f}, "p_{T} (GeV/c)"}; - // for BC shift QA plots + // for BC shift QA plots // binning to actually match BC shifts but show in picoseconds - const double bcShiftValuePS = o2::constants::lhc::LHCBunchSpacingNS*1000.0f; - ConfigurableAxis axisBCshift{"axisBCshift", {130, -120.5f*bcShiftValuePS, 9.5f*bcShiftValuePS}, "time shift (ps)"}; + const double bcShiftValuePS = o2::constants::lhc::LHCBunchSpacingNS * 1000.0f; + ConfigurableAxis axisBCshift{"axisBCshift", {130, -120.5f * bcShiftValuePS, 9.5f * bcShiftValuePS}, "time shift (ps)"}; // very broad time axis ConfigurableAxis axisTimeLong{"axisTimeLong", {3000, -1500000.0f, 1500000.0f}, "time (ps)"}; @@ -422,11 +422,11 @@ struct strangenesstofpid { // per event histos.add("hCandidateCounter", "hCandidateCounter", kTH1F, {{500, -0.5f, 499.5f}}); - histos.add("hV0PositiveBCShift", "hV0PositiveBCShift", kTH1F, {axes.axisBCshift}); - histos.add("hV0NegativeBCShift", "hV0NegativeBCShift", kTH1F, {axes.axisBCshift}); - histos.add("hCascadePositiveBCShift", "hCascadePositiveBCShift", kTH1F, {axes.axisBCshift}); - histos.add("hCascadeNegativeBCShift", "hCascadeNegativeBCShift", kTH1F, {axes.axisBCshift}); - histos.add("hCascadeBachelorBCShift", "hCascadeBachelorBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hV0PositiveBCShift", "hV0PositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hV0NegativeBCShift", "hV0NegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadePositiveBCShift", "hCascadePositiveBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeNegativeBCShift", "hCascadeNegativeBCShift", kTH1F, {axes.axisBCshift}); + histos.add("hCascadeBachelorBCShift", "hCascadeBachelorBCShift", kTH1F, {axes.axisBCshift}); histos.add("hTOFSignalPositive", "hTOFSignalPositive", kTH1F, {axes.axisTimeLong}); histos.add("hTOFSignalNegative", "hTOFSignalNegative", kTH1F, {axes.axisTimeLong}); @@ -951,14 +951,14 @@ struct strangenesstofpid { // int incompatibilityReason = 0; // if (std::abs(v0tof.nSigmaPositiveK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaPositiveK0ShortPi) > 4) { // compatibleK0Short = false; // reject only if info present and incompatible - // incompatibilityReason += 1; + // incompatibilityReason += 1; // } // if (std::abs(v0tof.nSigmaNegativeK0ShortPi - o2::aod::v0data::kNoTOFValue) > o2::aod::v0data::kEpsilon && std::abs(v0tof.nSigmaNegativeK0ShortPi) > 4) { // compatibleK0Short = false; // reject only if info present and incompatible - // incompatibilityReason += 2; + // incompatibilityReason += 2; // } - // if(!compatibleK0Short && passesQAcuts && k0ShortCandidate){ + // if(!compatibleK0Short && passesQAcuts && k0ShortCandidate){ // histos.fill(HIST("hIncompatibilityReason"), incompatibilityReason); // // LOGF(info, "Incompatible K0, sigmas = (%.2f %.2f), lengths = (%.2f %.2f) tofSignals = (%.2f %.2f) evtimes = (%.2f %.2f)", v0tof.nSigmaPositiveK0ShortPi, v0tof.nSigmaNegativeK0ShortPi, lengthPositive, lengthNegative, pTof.tofSignal, nTof.tofSignal, pTof.tofEvTime, nTof.tofEvTime); // } @@ -1367,34 +1367,34 @@ struct strangenesstofpid { auto pTra = V0.posTrack_as(); auto nTra = V0.negTrack_as(); - double deltaTimePos = 0.0f; - double deltaTimeNeg = 0.0f; + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; auto collisionV0 = collisions.rawIteratorAt(V0.collisionId()); auto bcV0 = bcs.rawIteratorAt(collisionV0.bcId()); - if(pTra.collisionId()>=0){ + if (pTra.collisionId() >= 0) { auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); - deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS*deltaBcPos*1000.0f; + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS * deltaBcPos * 1000.0f; histos.fill(HIST("hV0PositiveBCShift"), deltaTimePos); } - if(nTra.collisionId()>=0){ + if (nTra.collisionId() >= 0) { auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); - deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS*deltaBcNeg*1000.0f; + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS * deltaBcNeg * 1000.0f; histos.fill(HIST("hV0NegativeBCShift"), deltaTimeNeg); } - if(pTof.hasTOF){ + if (pTof.hasTOF) { histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimePos); } - - if(nTof.hasTOF){ + + if (nTof.hasTOF) { histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeNeg); } @@ -1454,34 +1454,34 @@ struct strangenesstofpid { auto nTra = cascade.negTrack_as(); auto bTra = cascade.bachelor_as(); - double deltaTimePos = 0.0f; - double deltaTimeNeg = 0.0f; - double deltaTimeBach = 0.0f; + double deltaTimePos = 0.0f; + double deltaTimeNeg = 0.0f; + double deltaTimeBach = 0.0f; auto collisionCascade = collisions.rawIteratorAt(cascade.collisionId()); auto bcV0 = bcs.rawIteratorAt(collisionCascade.bcId()); - if(pTra.collisionId()>=0){ + if (pTra.collisionId() >= 0) { auto collisionPos = collisions.rawIteratorAt(pTra.collisionId()); auto bcPos = bcs.rawIteratorAt(collisionPos.bcId()); const int64_t deltaBcPos = bcPos.globalBC() - bcV0.globalBC(); - deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS*deltaBcPos*1000.0f; + deltaTimePos = o2::constants::lhc::LHCBunchSpacingNS * deltaBcPos * 1000.0f; histos.fill(HIST("hCascadePositiveBCShift"), deltaTimePos); } - if(nTra.collisionId()>=0){ + if (nTra.collisionId() >= 0) { auto collisionNeg = collisions.rawIteratorAt(nTra.collisionId()); auto bcNeg = bcs.rawIteratorAt(collisionNeg.bcId()); const int64_t deltaBcNeg = bcNeg.globalBC() - bcV0.globalBC(); - deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS*deltaBcNeg*1000.0f; + deltaTimeNeg = o2::constants::lhc::LHCBunchSpacingNS * deltaBcNeg * 1000.0f; histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeNeg); } - if(bTra.collisionId()>=0){ + if (bTra.collisionId() >= 0) { auto collisionBach = collisions.rawIteratorAt(bTra.collisionId()); auto bcBach = bcs.rawIteratorAt(collisionBach.bcId()); const int64_t deltaBcBach = bcBach.globalBC() - bcV0.globalBC(); - deltaTimeBach = o2::constants::lhc::LHCBunchSpacingNS*deltaBcBach*1000.0f; + deltaTimeBach = o2::constants::lhc::LHCBunchSpacingNS * deltaBcBach * 1000.0f; histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBach); } @@ -1594,11 +1594,11 @@ struct strangenesstofpid { if (tofIndices[V0.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.posTrackExtraId()]); - if(pTofExt.straCollisionId()>=0){ - // extract BC for BC time shift + if (pTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hV0PositiveBCShift"), deltaTimeBc); deltaTimeBcPos = deltaTimeBc; @@ -1619,11 +1619,11 @@ struct strangenesstofpid { if (tofIndices[V0.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[V0.negTrackExtraId()]); - if(nTofExt.straCollisionId()>=0){ - // extract BC for BC time shift + if (nTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hV0NegativeBCShift"), deltaTimeBc); deltaTimeBcNeg = deltaTimeBc; @@ -1635,12 +1635,12 @@ struct strangenesstofpid { nTof.length = nTofExt.length(); } } - if(pTof.hasTOF){ + if (pTof.hasTOF) { histos.fill(HIST("hTOFSignalPositive"), pTof.tofSignal); histos.fill(HIST("h2dTOFSignalPositive"), pTof.tofSignal, deltaTimeBcPos); } - - if(nTof.hasTOF){ + + if (nTof.hasTOF) { histos.fill(HIST("hTOFSignalNegative"), nTof.tofSignal); histos.fill(HIST("h2dTOFSignalNegative"), nTof.tofSignal, deltaTimeBcNeg); } @@ -1687,11 +1687,11 @@ struct strangenesstofpid { if (tofIndices[cascade.posTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto pTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.posTrackExtraId()]); - if(pTofExt.straCollisionId()>=0){ - // extract BC for BC time shift + if (pTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift auto collisionTrack = collisions.rawIteratorAt(pTofExt.straCollisionId()); const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadePositiveBCShift"), deltaTimeBc); pTof.collisionId = pTofExt.straCollisionId(); @@ -1710,11 +1710,11 @@ struct strangenesstofpid { if (tofIndices[cascade.negTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto nTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.negTrackExtraId()]); - if(nTofExt.straCollisionId()>=0){ - // extract BC for BC time shift + if (nTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift auto collisionTrack = collisions.rawIteratorAt(nTofExt.straCollisionId()); const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeNegativeBCShift"), deltaTimeBc); nTof.collisionId = nTofExt.straCollisionId(); @@ -1733,11 +1733,11 @@ struct strangenesstofpid { if (tofIndices[cascade.bachTrackExtraId()] >= 0 && collision.eventTime() > -1e+5) { auto bTofExt = dauTrackTOFPIDs.rawIteratorAt(tofIndices[cascade.bachTrackExtraId()]); - if(bTofExt.straCollisionId()>=0){ - // extract BC for BC time shift + if (bTofExt.straCollisionId() >= 0) { + // extract BC for BC time shift auto collisionTrack = collisions.rawIteratorAt(bTofExt.straCollisionId()); const int64_t deltaBc = collisionTrack.globalBC() - collision.globalBC(); - const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS*deltaBc*1000.0f; + const double deltaTimeBc = o2::constants::lhc::LHCBunchSpacingNS * deltaBc * 1000.0f; histos.fill(HIST("hCascadeBachelorBCShift"), deltaTimeBc); bTof.collisionId = bTofExt.straCollisionId(); From f8c1c94f6f2d78cf1b7aa424bbb7a124b7d9f0a4 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 21 Oct 2025 13:14:20 +0200 Subject: [PATCH 3/4] Add extra safety for invalid TOF values --- .../Strangeness/strangenesstofpid.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index d4d6d455656..749af94607e 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -103,6 +103,7 @@ struct strangenesstofpid { Configurable calculateCascades{"calculateCascades", -1, "calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)"}; Configurable reassociateTracks{"reassociateTracks", true, "if true, reassociate tracks to the collision the V0 or cascade belongs to. Relevant especially at high IR"}; Configurable doBCshift{"doBCshift", true, "if true, perform time shift for collisions in different BCs when reassigning"}; + Configurable rejectUndefinedTof{"rejectUndefinedTof", true, "if true, reject tracks with TOF signal 0.000f for safety"}; // auxiliary / debug tables as desired Configurable calculateV0TOFPIDs{"calculateV0TOFPIDs", -1, "calculate V0TOFPIDs table (0: no, 1: yes, -1: auto)"}; @@ -791,12 +792,15 @@ struct strangenesstofpid { std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma && std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + //_____________________________________________________________________________________________ // Actual calculation float velocityPositivePr, velocityPositivePi, lengthPositive; velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; - if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5) { + if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityPositivePr = velocity(posTrack.getP(), o2::constants::physics::MassProton); @@ -872,7 +876,7 @@ struct strangenesstofpid { } float velocityNegativePr, velocityNegativePi, lengthNegative; velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; - if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5) { + if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) { // method 0: legacy standalone without use of primary particle TOF if (calculationMethod.value == 0) { velocityNegativePr = velocity(negTrack.getP(), o2::constants::physics::MassProton); @@ -1058,9 +1062,13 @@ struct strangenesstofpid { std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + bool bValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(bTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + //_____________________________________________________________________________________________ // Actual calculation - if (pTof.hasTOF && pTof.hasITS) { + if (pTof.hasTOF && pTof.hasITS && pTof.tofEvTime > -1e+5 && pValidTOF) { float velocityPositivePr, velocityPositivePi, lengthPositive; velocityPositivePr = velocityPositivePi = lengthPositive = o2::aod::v0data::kNoTOFValue; if (calculationMethod.value == 0) { @@ -1149,7 +1157,7 @@ struct strangenesstofpid { } } // end positive - if (nTof.hasTOF && nTof.hasITS) { + if (nTof.hasTOF && nTof.hasITS && nTof.tofEvTime > -1e+5 && nValidTOF) { float velocityNegativePr, velocityNegativePi, lengthNegative; velocityNegativePr = velocityNegativePi = lengthNegative = o2::aod::v0data::kNoTOFValue; // method 0: legacy standalone without use of primary particle TOF @@ -1239,7 +1247,7 @@ struct strangenesstofpid { } } // end negative - if (bTof.hasTOF && bTof.hasITS) { + if (bTof.hasTOF && bTof.hasITS && bTof.tofEvTime > -1e+5 && bValidTOF) { float velocityBachelorKa, velocityBachelorPi, lengthBachelor; velocityBachelorKa = velocityBachelorPi = lengthBachelor = o2::aod::v0data::kNoTOFValue; // method 0: legacy standalone without use of primary particle TOF From e59b88125b5b76f37a0e3fb7c2175e267be78372 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Tue, 21 Oct 2025 13:21:08 +0200 Subject: [PATCH 4/4] Please consider the following formatting changes (#491) --- PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 749af94607e..dd49afb136c 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -792,8 +792,8 @@ struct strangenesstofpid { std::abs(pTof.tpcNSigmaPi) < v0Group.qaTPCNSigma && std::abs(nTof.tpcNSigmaPi) < v0Group.qaTPCNSigma; - bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; - bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; //_____________________________________________________________________________________________ // Actual calculation @@ -1062,9 +1062,9 @@ struct strangenesstofpid { std::abs(nTof.tpcNSigmaPr) < cascadeGroup.qaTPCNSigma && std::abs(bTof.tpcNSigmaKa) < cascadeGroup.qaTPCNSigma; - bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; - bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; - bool bValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(bTof.tofSignal)>o2::aod::v0data::kEpsilon) : true; + bool pValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(pTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool nValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(nTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; + bool bValidTOF = rejectUndefinedTof.value ? static_cast(std::fabs(bTof.tofSignal) > o2::aod::v0data::kEpsilon) : true; //_____________________________________________________________________________________________ // Actual calculation