From 5c69a1c8de635dbd1af737c1c76f08d60b26b608 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 28 Mar 2024 15:58:59 +0100 Subject: [PATCH 1/3] PWGLF: TOF PID checking hasTOF --- PWGLF/TableProducer/lambdakzeropid.cxx | 44 ++++++++++++++++++++------ 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/PWGLF/TableProducer/lambdakzeropid.cxx b/PWGLF/TableProducer/lambdakzeropid.cxx index 0f07d7c5687..9465063766d 100644 --- a/PWGLF/TableProducer/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/lambdakzeropid.cxx @@ -116,6 +116,11 @@ struct lambdakzeropid { float maxSnp; // max sine phi for propagation float maxStep; // max step size (cm) for propagation + // enum to keep track of the TOF-related properties for V0s + enum tofEnum { kLength = 0, + kHasTOF, + kNEnums }; + /// function to calculate track length of this track up to a certain segment of a detector /// to be used internally in another funcrtion that calculates length until it finds the proper one /// warning: this could be optimised further for speed @@ -289,6 +294,9 @@ struct lambdakzeropid { histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); + histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisPt, {4,-0.5,3.5f}}}); + histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisPt, {4,-0.5,3.5f}}}); + if (doQANSigma) { // standard NSigma values histos.add("h2dNSigmaPositiveLambdaPi", "h2dNSigmaPositiveLambdaPi", {HistType::kTH2F, {axisPt, axisNSigma}}); @@ -411,6 +419,9 @@ struct lambdakzeropid { o2::track::TrackPar posTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxpos(), v0.pypos(), v0.pzpos()}, +1); o2::track::TrackPar negTrack = o2::track::TrackPar({v0.x(), v0.y(), v0.z()}, {v0.pxneg(), v0.pyneg(), v0.pzneg()}, -1); + auto pTra = v0.posTrackExtra_as(); + auto nTra = v0.negTrackExtra_as(); + float deltaTimePositiveLambdaPi = -1e+6; float deltaTimeNegativeLambdaPi = -1e+6; float deltaTimePositiveLambdaPr = -1e+6; @@ -437,20 +448,38 @@ struct lambdakzeropid { float timeNegativePr = lengthNegative / velocityNegativePr; float timeNegativePi = lengthNegative / velocityNegativePi; - if (v0.posTOFSignal() > 0 && v0.posTOFEventTime() > 0 && lengthPositive > 0) { + if (pTra.hasTOF() && lengthPositive > 0) { deltaTimePositiveLambdaPr = (v0.posTOFSignal() - v0.posTOFEventTime()) - (timeLambda + timePositivePr); deltaTimePositiveLambdaPi = (v0.posTOFSignal() - v0.posTOFEventTime()) - (timeLambda + timePositivePi); deltaTimePositiveK0ShortPi = (v0.posTOFSignal() - v0.posTOFEventTime()) - (timeK0Short + timePositivePi); } - if (v0.negTOFSignal() > 0 && v0.negTOFEventTime() > 0 && lengthNegative > 0) { + if (nTra.hasTOF() && lengthNegative > 0) { deltaTimeNegativeLambdaPr = (v0.negTOFSignal() - v0.negTOFEventTime()) - (timeLambda + timeNegativePr); deltaTimeNegativeLambdaPi = (v0.negTOFSignal() - v0.negTOFEventTime()) - (timeLambda + timeNegativePi); deltaTimeNegativeK0ShortPi = (v0.negTOFSignal() - v0.negTOFEventTime()) - (timeK0Short + timeNegativePi); } + + if(doQA){ + // calculate and pack properties for QA purposes + int posProperties = 0; + if(lengthPositive>0) + posProperties = posProperties | (int(1) << kLength); + if(pTra.hasTOF()) + posProperties = posProperties | (int(1) << kHasTOF); + int negProperties = 0; + if(lengthNegative>0) + negProperties = negProperties | (int(1) << kLength); + if(nTra.hasTOF()) + negProperties = negProperties | (int(1) << kHasTOF); + + histos.fill(HIST("h2dPositiveTOFProperties"), v0.pt(), posProperties); + histos.fill(HIST("h2dNegativeTOFProperties"), v0.pt(), negProperties); + } + float deltaDecayTimeLambda = -10e+4; float deltaDecayTimeAntiLambda = -10e+4; float deltaDecayTimeK0Short = -10e+4; - if (v0.posTOFSignal() > 0 && v0.negTOFSignal() > 0 && lengthPositive > 0 && lengthNegative > 0) { // does not depend on event time + if (nTra.hasTOF() && pTra.hasTOF() > 0 && lengthPositive > 0 && lengthNegative > 0) { // does not depend on event time deltaDecayTimeLambda = (v0.posTOFSignal() - timePositivePr) - (v0.negTOFSignal() - timeNegativePi); deltaDecayTimeAntiLambda = (v0.posTOFSignal() - timePositivePi) - (v0.negTOFSignal() - timeNegativePr); deltaDecayTimeK0Short = (v0.posTOFSignal() - timePositivePi) - (v0.negTOFSignal() - timeNegativePi); @@ -467,7 +496,7 @@ struct lambdakzeropid { float betaAntiLambda = -1e+6; float betaK0Short = -1e+6; - if (v0.posTOFSignal() > 0 && v0.negTOFSignal() > 0 && v0.posTOFEventTime() > 0 && v0.negTOFEventTime() > 0) { + if (nTra.hasTOF() && pTra.hasTOF()) { betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458; betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / 0.0299792458; betaK0Short = (lengthV0 / decayTimeK0Short) / 0.0299792458; @@ -505,10 +534,7 @@ struct lambdakzeropid { } if (doQA) { - auto pTra = v0.posTrackExtra_as(); - auto nTra = v0.negTrackExtra_as(); - - if (v0.posTOFSignal() > 0 && v0.posTOFEventTime() > 0) { + if (pTra.hasTOF()) { histos.fill(HIST("h2dProtonMeasuredVsExpected"), (timeLambda + timePositivePr), (v0.posTOFSignal() - v0.posTOFEventTime())); @@ -531,7 +557,7 @@ struct lambdakzeropid { } } - if (v0.negTOFSignal() > 0 && v0.negTOFEventTime() > 0) { + if (nTra.hasTOF()) { histos.fill(HIST("h2dPionMeasuredVsExpected"), (timeLambda + timeNegativePi), (v0.negTOFSignal() - v0.negTOFEventTime())); From 2f7957aa0a932f9fe7bbfbfbc3867487e70ab14a Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Thu, 28 Mar 2024 16:01:03 +0100 Subject: [PATCH 2/3] Please consider the following formatting changes (#272) --- PWGLF/TableProducer/lambdakzeropid.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGLF/TableProducer/lambdakzeropid.cxx b/PWGLF/TableProducer/lambdakzeropid.cxx index 9465063766d..29a847013da 100644 --- a/PWGLF/TableProducer/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/lambdakzeropid.cxx @@ -294,8 +294,8 @@ struct lambdakzeropid { histos.add("h2dDeltaTimePositiveK0ShortPi", "h2dDeltaTimePositiveK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); histos.add("h2dDeltaTimeNegativeK0ShortPi", "h2dDeltaTimeNegativeK0ShortPi", {HistType::kTH3F, {axisPt, axisEta, axisDeltaTime}}); - histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisPt, {4,-0.5,3.5f}}}); - histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisPt, {4,-0.5,3.5f}}}); + histos.add("h2dPositiveTOFProperties", "h2dPositiveTOFProperties", {HistType::kTH2F, {axisPt, {4, -0.5, 3.5f}}}); + histos.add("h2dNegativeTOFProperties", "h2dNegativeTOFProperties", {HistType::kTH2F, {axisPt, {4, -0.5, 3.5f}}}); if (doQANSigma) { // standard NSigma values @@ -459,17 +459,17 @@ struct lambdakzeropid { deltaTimeNegativeK0ShortPi = (v0.negTOFSignal() - v0.negTOFEventTime()) - (timeK0Short + timeNegativePi); } - if(doQA){ + if (doQA) { // calculate and pack properties for QA purposes - int posProperties = 0; - if(lengthPositive>0) + int posProperties = 0; + if (lengthPositive > 0) posProperties = posProperties | (int(1) << kLength); - if(pTra.hasTOF()) + if (pTra.hasTOF()) posProperties = posProperties | (int(1) << kHasTOF); - int negProperties = 0; - if(lengthNegative>0) + int negProperties = 0; + if (lengthNegative > 0) negProperties = negProperties | (int(1) << kLength); - if(nTra.hasTOF()) + if (nTra.hasTOF()) negProperties = negProperties | (int(1) << kHasTOF); histos.fill(HIST("h2dPositiveTOFProperties"), v0.pt(), posProperties); From bdb419dd269455cdf37a992b73e960fd9a5ef3a6 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 28 Mar 2024 16:12:01 +0100 Subject: [PATCH 3/3] Change to hasTOF also for cascadePID --- PWGLF/TableProducer/cascadepid.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGLF/TableProducer/cascadepid.cxx b/PWGLF/TableProducer/cascadepid.cxx index 842685e49aa..9aa2be45384 100644 --- a/PWGLF/TableProducer/cascadepid.cxx +++ b/PWGLF/TableProducer/cascadepid.cxx @@ -383,19 +383,23 @@ struct cascadepid { float negDeltaTimeAsOmPi = -1e+6, negDeltaTimeAsOmPr = -1e+6; float bachDeltaTimeAsOmKa = -1e+6; - if (cascade.posTOFSignal() > 0 && cascade.posTOFEventTime() > 0) { + auto pTra = cascade.posTrackExtra_as(); + auto nTra = cascade.negTrackExtra_as(); + auto bTra = cascade.negTrackExtra_as(); + + if (pTra.hasTOF()) { posDeltaTimeAsXiPi = (cascade.posTOFSignal() - cascade.posTOFEventTime()) - (xiFlight + lambdaFlight + posFlightPi); posDeltaTimeAsXiPr = (cascade.posTOFSignal() - cascade.posTOFEventTime()) - (xiFlight + lambdaFlight + posFlightPr); posDeltaTimeAsOmPi = (cascade.posTOFSignal() - cascade.posTOFEventTime()) - (omFlight + lambdaFlight + posFlightPi); posDeltaTimeAsOmPr = (cascade.posTOFSignal() - cascade.posTOFEventTime()) - (omFlight + lambdaFlight + posFlightPr); } - if (cascade.negTOFSignal() > 0 && cascade.negTOFEventTime() > 0) { + if (nTra.hasTOF()) { negDeltaTimeAsXiPi = (cascade.negTOFSignal() - cascade.negTOFEventTime()) - (xiFlight + lambdaFlight + negFlightPi); negDeltaTimeAsXiPr = (cascade.negTOFSignal() - cascade.negTOFEventTime()) - (xiFlight + lambdaFlight + negFlightPr); negDeltaTimeAsOmPi = (cascade.negTOFSignal() - cascade.negTOFEventTime()) - (omFlight + lambdaFlight + negFlightPi); negDeltaTimeAsOmPr = (cascade.negTOFSignal() - cascade.negTOFEventTime()) - (omFlight + lambdaFlight + negFlightPr); } - if (cascade.bachTOFSignal() > 0 && cascade.bachTOFEventTime() > 0) { + if (bTra.hasTOF()) { bachDeltaTimeAsXiPi = (cascade.bachTOFSignal() - cascade.bachTOFEventTime()) - (xiFlight + bachFlightPi); bachDeltaTimeAsOmKa = (cascade.bachTOFSignal() - cascade.bachTOFEventTime()) - (omFlight + bachFlightKa); } @@ -407,10 +411,6 @@ struct cascadepid { ); if (doQA) { - auto pTra = cascade.posTrackExtra_as(); - auto nTra = cascade.negTrackExtra_as(); - auto bTra = cascade.negTrackExtra_as(); - // fill QA histograms for cross-checking histos.fill(HIST("hArcDebug"), cascade.pt(), lengthCascade - d3d); // for debugging purposes