@@ -116,6 +116,11 @@ struct lambdakzeropid {
116116 float maxSnp; // max sine phi for propagation
117117 float maxStep; // max step size (cm) for propagation
118118
119+ // enum to keep track of the TOF-related properties for V0s
120+ enum tofEnum { kLength = 0 ,
121+ kHasTOF ,
122+ kNEnums };
123+
119124 // / function to calculate track length of this track up to a certain segment of a detector
120125 // / to be used internally in another funcrtion that calculates length until it finds the proper one
121126 // / warning: this could be optimised further for speed
@@ -289,6 +294,9 @@ struct lambdakzeropid {
289294 histos.add (" h2dDeltaTimePositiveK0ShortPi" , " h2dDeltaTimePositiveK0ShortPi" , {HistType::kTH3F , {axisPt, axisEta, axisDeltaTime}});
290295 histos.add (" h2dDeltaTimeNegativeK0ShortPi" , " h2dDeltaTimeNegativeK0ShortPi" , {HistType::kTH3F , {axisPt, axisEta, axisDeltaTime}});
291296
297+ histos.add (" h2dPositiveTOFProperties" , " h2dPositiveTOFProperties" , {HistType::kTH2F , {axisPt, {4 , -0.5 , 3 .5f }}});
298+ histos.add (" h2dNegativeTOFProperties" , " h2dNegativeTOFProperties" , {HistType::kTH2F , {axisPt, {4 , -0.5 , 3 .5f }}});
299+
292300 if (doQANSigma) {
293301 // standard NSigma values
294302 histos.add (" h2dNSigmaPositiveLambdaPi" , " h2dNSigmaPositiveLambdaPi" , {HistType::kTH2F , {axisPt, axisNSigma}});
@@ -411,6 +419,9 @@ struct lambdakzeropid {
411419 o2::track::TrackPar posTrack = o2::track::TrackPar ({v0.x (), v0.y (), v0.z ()}, {v0.pxpos (), v0.pypos (), v0.pzpos ()}, +1 );
412420 o2::track::TrackPar negTrack = o2::track::TrackPar ({v0.x (), v0.y (), v0.z ()}, {v0.pxneg (), v0.pyneg (), v0.pzneg ()}, -1 );
413421
422+ auto pTra = v0.posTrackExtra_as <dauTracks>();
423+ auto nTra = v0.negTrackExtra_as <dauTracks>();
424+
414425 float deltaTimePositiveLambdaPi = -1e+6 ;
415426 float deltaTimeNegativeLambdaPi = -1e+6 ;
416427 float deltaTimePositiveLambdaPr = -1e+6 ;
@@ -437,20 +448,38 @@ struct lambdakzeropid {
437448 float timeNegativePr = lengthNegative / velocityNegativePr;
438449 float timeNegativePi = lengthNegative / velocityNegativePi;
439450
440- if (v0. posTOFSignal () > 0 && v0. posTOFEventTime () > 0 && lengthPositive > 0 ) {
451+ if (pTra. hasTOF () && lengthPositive > 0 ) {
441452 deltaTimePositiveLambdaPr = (v0.posTOFSignal () - v0.posTOFEventTime ()) - (timeLambda + timePositivePr);
442453 deltaTimePositiveLambdaPi = (v0.posTOFSignal () - v0.posTOFEventTime ()) - (timeLambda + timePositivePi);
443454 deltaTimePositiveK0ShortPi = (v0.posTOFSignal () - v0.posTOFEventTime ()) - (timeK0Short + timePositivePi);
444455 }
445- if (v0. negTOFSignal () > 0 && v0. negTOFEventTime () > 0 && lengthNegative > 0 ) {
456+ if (nTra. hasTOF () && lengthNegative > 0 ) {
446457 deltaTimeNegativeLambdaPr = (v0.negTOFSignal () - v0.negTOFEventTime ()) - (timeLambda + timeNegativePr);
447458 deltaTimeNegativeLambdaPi = (v0.negTOFSignal () - v0.negTOFEventTime ()) - (timeLambda + timeNegativePi);
448459 deltaTimeNegativeK0ShortPi = (v0.negTOFSignal () - v0.negTOFEventTime ()) - (timeK0Short + timeNegativePi);
449460 }
461+
462+ if (doQA) {
463+ // calculate and pack properties for QA purposes
464+ int posProperties = 0 ;
465+ if (lengthPositive > 0 )
466+ posProperties = posProperties | (int (1 ) << kLength );
467+ if (pTra.hasTOF ())
468+ posProperties = posProperties | (int (1 ) << kHasTOF );
469+ int negProperties = 0 ;
470+ if (lengthNegative > 0 )
471+ negProperties = negProperties | (int (1 ) << kLength );
472+ if (nTra.hasTOF ())
473+ negProperties = negProperties | (int (1 ) << kHasTOF );
474+
475+ histos.fill (HIST (" h2dPositiveTOFProperties" ), v0.pt (), posProperties);
476+ histos.fill (HIST (" h2dNegativeTOFProperties" ), v0.pt (), negProperties);
477+ }
478+
450479 float deltaDecayTimeLambda = -10e+4 ;
451480 float deltaDecayTimeAntiLambda = -10e+4 ;
452481 float deltaDecayTimeK0Short = -10e+4 ;
453- if (v0. posTOFSignal () > 0 && v0. negTOFSignal () > 0 && lengthPositive > 0 && lengthNegative > 0 ) { // does not depend on event time
482+ if (nTra. hasTOF () && pTra. hasTOF () > 0 && lengthPositive > 0 && lengthNegative > 0 ) { // does not depend on event time
454483 deltaDecayTimeLambda = (v0.posTOFSignal () - timePositivePr) - (v0.negTOFSignal () - timeNegativePi);
455484 deltaDecayTimeAntiLambda = (v0.posTOFSignal () - timePositivePi) - (v0.negTOFSignal () - timeNegativePr);
456485 deltaDecayTimeK0Short = (v0.posTOFSignal () - timePositivePi) - (v0.negTOFSignal () - timeNegativePi);
@@ -467,7 +496,7 @@ struct lambdakzeropid {
467496 float betaAntiLambda = -1e+6 ;
468497 float betaK0Short = -1e+6 ;
469498
470- if (v0. posTOFSignal () > 0 && v0. negTOFSignal () > 0 && v0. posTOFEventTime () > 0 && v0. negTOFEventTime () > 0 ) {
499+ if (nTra. hasTOF () && pTra. hasTOF () ) {
471500 betaLambda = (lengthV0 / decayTimeLambda) / 0.0299792458 ;
472501 betaAntiLambda = (lengthV0 / decayTimeAntiLambda) / 0.0299792458 ;
473502 betaK0Short = (lengthV0 / decayTimeK0Short) / 0.0299792458 ;
@@ -505,10 +534,7 @@ struct lambdakzeropid {
505534 }
506535
507536 if (doQA) {
508- auto pTra = v0.posTrackExtra_as <dauTracks>();
509- auto nTra = v0.negTrackExtra_as <dauTracks>();
510-
511- if (v0.posTOFSignal () > 0 && v0.posTOFEventTime () > 0 ) {
537+ if (pTra.hasTOF ()) {
512538 histos.fill (HIST (" h2dProtonMeasuredVsExpected" ),
513539 (timeLambda + timePositivePr),
514540 (v0.posTOFSignal () - v0.posTOFEventTime ()));
@@ -531,7 +557,7 @@ struct lambdakzeropid {
531557 }
532558 }
533559
534- if (v0. negTOFSignal () > 0 && v0. negTOFEventTime () > 0 ) {
560+ if (nTra. hasTOF () ) {
535561 histos.fill (HIST (" h2dPionMeasuredVsExpected" ),
536562 (timeLambda + timeNegativePi),
537563 (v0.negTOFSignal () - v0.negTOFEventTime ()));
0 commit comments