@@ -94,7 +94,7 @@ struct strangenesstofpid {
9494 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
9595
9696 // master switches
97- Configurable<int > calculationMethod{" calculationMethod" , 0 , " algorithm for TOF calculation. 0: fast analytical withouot eloss, 1: O2 Propagator/ + trackLTIntegral" };
97+ Configurable<int > calculationMethod{" calculationMethod" , 0 , " algorithm for TOF calculation. 0: fast analytical withouot eloss, 1: O2 Propagator + trackLTIntegral (slow), 2: both methods and do comparison studies (slow) " };
9898 Configurable<int > calculateV0s{" calculateV0s" , -1 , " calculate V0-related TOF PID (0: no, 1: yes, -1: auto)" };
9999 Configurable<int > calculateCascades{" calculateCascades" , -1 , " calculate cascade-related TOF PID (0: no, 1: yes, -1: auto)" };
100100
@@ -326,9 +326,10 @@ struct strangenesstofpid {
326326
327327 // / function to calculate track length of this track up to a certain segmented detector
328328 // / \param track the input track
329- void calculateTOF (o2::track::TrackPar track, float & timePion, float & timeKaon, float & timeProton)
329+ // / \param time returned time (with PID given by track PID)
330+ void calculateTOF (o2::track::TrackPar track, float & time)
330331 {
331- timePion = timeKaon = timeProton = -1e+6 ;
332+ time = -1e+6 ;
332333
333334 o2::track::TrackLTIntegral ltIntegral;
334335
@@ -347,10 +348,10 @@ struct strangenesstofpid {
347348 std::array<float , 3 > xyz;
348349 track.getXYZGlo (xyz);
349350 float segmentedR = segmentedRadius (xyz[0 ], xyz[1 ]);
350- float currentTimeProton = ltIntegral.getTOF (o2:: track::PID::Proton);
351- float currentTimeKaon = ltIntegral. getTOF (o2::track::PID::Kaon);
352- float currentTimePion = ltIntegral. getTOF (o2::track::PID::Pion);
353- histos. fill ( HIST ( " hTOFPosition " ), xyz[ 0 ], xyz[ 1 ]); // for debugging purposes
351+ float currentTime = ltIntegral.getTOF (track. getPID ());
352+ if (calculationMethod. value == 2 ){
353+ histos. fill ( HIST ( " hTOFPosition " ), xyz[ 0 ], xyz[ 1 ]); // for debugging purposes
354+ }
354355
355356 // correct for TOF segmentation
356357 float trackXextra = trackX;
@@ -360,7 +361,7 @@ struct strangenesstofpid {
360361 trackXextra += MAX_STEP_FINAL_STAGE;
361362 trackOKextra = o2::base::Propagator::Instance ()->propagateToX (track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral);
362363 if (!trackOKextra){
363- timePion = timeKaon = timeProton = -1e+6 ;
364+ time = -1e+6 ;
364365 return ; // propagation failed, skip, won't look reasonable
365366 }
366367
@@ -370,22 +371,18 @@ struct strangenesstofpid {
370371 if (segmentedRadius (xyz[0 ], xyz[1 ]) > tofPosition){
371372 // crossed boundary -> do proportional scaling with how much we actually crossed the boundary
372373 float segmentedRFinal = segmentedRadius (xyz[0 ], xyz[1 ]);
373- float timeProtonFinal = ltIntegral.getTOF (o2::track::PID::Proton);
374- float timeKaonFinal = ltIntegral.getTOF (o2::track::PID::Kaon);
375- float timePionFinal = ltIntegral.getTOF (o2::track::PID::Pion);
374+ float timeFinal = ltIntegral.getTOF (track.getPID ());
376375 float fraction = (tofPosition - segmentedR)/(segmentedRFinal-segmentedR+1e-6 ); // proportional fraction
377- timeProton = currentTimeProton + (timeProtonFinal-currentTimeProton )*fraction;
378- timeKaon = currentTimeKaon + (timeKaonFinal-currentTimeKaon)*fraction;
379- timePion = currentTimePion + (timePionFinal-currentTimePion)* fraction;
380- histos. fill ( HIST ( " hTOFPositionFinal " ), previousX+fraction*(xyz[ 0 ]-previousX), previousY+fraction*(xyz[ 1 ]-previousY)); // for debugging purposes
376+ time = currentTime + (timeFinal-currentTime )*fraction;
377+ if (calculationMethod. value == 2 ){
378+ histos. fill ( HIST ( " hTOFPositionFinal " ), previousX+fraction*(xyz[ 0 ]-previousX), previousY+ fraction*(xyz[ 1 ]-previousY)); // for debugging purposes
379+ }
381380 return ; // get out of the entire function and return (don't just break)
382381 }
383382
384383 // prepare for next step by setting current position and desired variables
385384 segmentedR = segmentedRadius (xyz[0 ], xyz[1 ]);
386- currentTimeProton = ltIntegral.getTOF (o2::track::PID::Proton);
387- currentTimeKaon = ltIntegral.getTOF (o2::track::PID::Kaon);
388- currentTimePion = ltIntegral.getTOF (o2::track::PID::Pion);
385+ currentTime = ltIntegral.getTOF (track.getPID ());
389386 }
390387 }
391388 }
@@ -443,10 +440,6 @@ struct strangenesstofpid {
443440 histos.add (" h2dProtonMeasuredVsExpected" , " h2dProtonMeasuredVsExpected" , {HistType::kTH3F , {axisSmallP, axisExpectedOverMeasured, axisEta}});
444441 histos.add (" h2dPionMeasuredVsExpected" , " h2dPionMeasuredVsExpected" , {HistType::kTH3F , {axisSmallP, axisExpectedOverMeasured, axisEta}});
445442
446- histos.add (" hArcDebug" , " hArcDebug" , kTH2F , {axisTime, axisTime});
447- histos.add (" hTOFPosition" , " hTOFPosition" , kTH2F , {axisPosition, axisPosition});
448- histos.add (" hTOFPositionFinal" , " hTOFPositionFinal" , kTH2F , {axisPosition, axisPosition});
449-
450443 // standard deltaTime values
451444 if (calculateV0s.value > 0 ) {
452445 histos.add (" h2dDeltaTimePositiveLambdaPi" , " h2dDeltaTimePositiveLambdaPi" , {HistType::kTH3F , {axisP, axisEta, axisDeltaTime}});
@@ -497,6 +490,36 @@ struct strangenesstofpid {
497490 // delta lambda decay time
498491 histos.add (" h2dLambdaDeltaDecayTime" , " h2dLambdaDeltaDecayTime" , {HistType::kTH2F , {axisP, axisDeltaTime}});
499492 }
493+
494+ if (calculationMethod.value ==2 ){
495+ // _____________________________________________________________________
496+ // special mode in which comparison histograms are required
497+
498+ // base ArcDebug: comparison between times of arrival in different methods
499+ histos.add (" hArcDebug" , " hArcDebug" , kTH2F , {axisTime, axisTime});
500+
501+ // Position of TrackLTIntegral method: intermediate (getXatLabR) and final (reach segmented detector)
502+ histos.add (" hTOFPosition" , " hTOFPosition" , kTH2F , {axisPosition, axisPosition});
503+ histos.add (" hTOFPositionFinal" , " hTOFPositionFinal" , kTH2F , {axisPosition, axisPosition});
504+
505+ // Delta-times of each method for the various species
506+ histos.add (" hDeltaTimeMethodsVsP_posPr" , " hDeltaTimeMethodsVsP_posPr" , kTH3F , {axisP, axisEta, axisDeltaTime});
507+ histos.add (" hDeltaTimeMethodsVsP_posPi" , " hDeltaTimeMethodsVsP_posPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
508+ histos.add (" hDeltaTimeMethodsVsP_negPr" , " hDeltaTimeMethodsVsP_negPr" , kTH3F , {axisP, axisEta, axisDeltaTime});
509+ histos.add (" hDeltaTimeMethodsVsP_negPi" , " hDeltaTimeMethodsVsP_negPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
510+
511+ histos.add (" hDeltaTimeMethodsVsP_posPi" , " hDeltaTimeMethodsVsP_posPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
512+ histos.add (" hDeltaTimeMethodsVsP_posPr" , " hDeltaTimeMethodsVsP_posPr" , kTH3F , {axisP, axisEta, axisDeltaTime});
513+ histos.add (" hDeltaTimeMethodsVsP_negPi" , " hDeltaTimeMethodsVsP_negPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
514+ histos.add (" hDeltaTimeMethodsVsP_negPr" , " hDeltaTimeMethodsVsP_negPr" , kTH3F , {axisP, axisEta, axisDeltaTime});
515+ histos.add (" hDeltaTimeMethodsVsP_bachXiPi" , " hDeltaTimeMethodsVsP_bachXiPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
516+ histos.add (" hDeltaTimeMethodsVsP_bachOmPi" , " hDeltaTimeMethodsVsP_bachOmPi" , kTH3F , {axisP, axisEta, axisDeltaTime});
517+ }
518+
519+ // list memory consumption at start if running in modes with more output
520+ if (calculationMethod.value ==2 || doQA){
521+ histos.print ();
522+ }
500523 }
501524
502525 void initCCDB (int runNumber)
@@ -645,6 +668,10 @@ struct strangenesstofpid {
645668 o2::track::TrackPar posTrack = o2::track::TrackPar ({v0.x (), v0.y (), v0.z ()}, {v0.pxpos (), v0.pypos (), v0.pzpos ()}, +1 );
646669 o2::track::TrackPar negTrack = o2::track::TrackPar ({v0.x (), v0.y (), v0.z ()}, {v0.pxneg (), v0.pyneg (), v0.pzneg ()}, -1 );
647670
671+ // at minimum
672+ float positiveP = std::hypot (v0.pxpos (), v0.pypos (), v0.pzpos ());
673+ float negativeP = std::hypot (v0.pxneg (), v0.pyneg (), v0.pzneg ());
674+
648675 float deltaTimePositiveLambdaPi = o2::aod::v0data::kNoTOFValue ;
649676 float deltaTimeNegativeLambdaPi = o2::aod::v0data::kNoTOFValue ;
650677 float deltaTimePositiveLambdaPr = o2::aod::v0data::kNoTOFValue ;
@@ -664,7 +691,7 @@ struct strangenesstofpid {
664691 float timeNegativePr = -1e+6 ;
665692 float timeNegativePi = -1e+6 ;
666693
667- if (calculationMethod.value ==0 ){
694+ if (calculationMethod.value ==0 || calculationMethod. value == 2 ){
668695 float velocityPositivePr = velocity (posTrack.getP (), o2::constants::physics::MassProton);
669696 float velocityPositivePi = velocity (posTrack.getP (), o2::constants::physics::MassPionCharged);
670697 float velocityNegativePr = velocity (negTrack.getP (), o2::constants::physics::MassProton);
@@ -683,15 +710,38 @@ struct strangenesstofpid {
683710 }
684711 }
685712
686- if (calculationMethod.value == 1 ){
713+ if (calculationMethod.value > 0 ){
687714 // method to calculate the time and length via Propagator TrackLTIntegral
688- float timeKaon; // will go unused
689- if (pTra.hasTOF ()){ // calculate if signal at all present, otherwise skip
690- posTrack.setPID (o2::track::PID::Proton); // force test
691- calculateTOF (posTrack, timePositivePi, timeKaon, timePositivePr);
715+ float tPosPi, tPosPr, tNegPi, tNegPr;
716+ if (pTra.hasTOF ()){ // calculate if signal present, otherwise skip
717+ o2::track::TrackPar posTrackAsProton (posTrack);
718+ posTrackAsProton.setPID (o2::track::PID::Proton);
719+ calculateTOF (posTrackAsProton, tPosPr);
720+
721+ o2::track::TrackPar posTrackAsPion (posTrack);
722+ posTrackAsPion.setPID (o2::track::PID::Pion);
723+ calculateTOF (posTrackAsPion, tPosPi);
724+
725+ if (calculationMethod.value ==2 ){
726+ // fill comparison histograms
727+ histos.fill (HIST (" hDeltaTimeMethodsVsP_posPr" ), positiveP, v0.positiveeta (), timePositivePr - tPosPr);
728+ histos.fill (HIST (" hDeltaTimeMethodsVsP_posPi" ), positiveP, v0.positiveeta (), timePositivePi - tPosPi);
729+ }
692730 }
693- if (nTra.hasTOF ()){ // calculate if signal at all present, otherwise skip
694- calculateTOF (negTrack, timeNegativePi, timeKaon, timeNegativePr);
731+ if (nTra.hasTOF ()){ // calculate if signal present, otherwise skip
732+ o2::track::TrackPar negTrackAsProton (negTrack);
733+ negTrackAsProton.setPID (o2::track::PID::Proton);
734+ calculateTOF (negTrackAsProton, tNegPr);
735+
736+ o2::track::TrackPar negTrackAsPion (negTrack);
737+ negTrackAsPion.setPID (o2::track::PID::Pion);
738+ calculateTOF (negTrackAsPion, tNegPi);
739+
740+ if (calculationMethod.value ==2 ){
741+ // fill comparison histograms
742+ histos.fill (HIST (" hDeltaTimeMethodsVsP_negPr" ), negativeP, v0.negativeeta (), timeNegativePr - tNegPr);
743+ histos.fill (HIST (" hDeltaTimeMethodsVsP_negPi" ), negativeP, v0.negativeeta (), timeNegativePi - tNegPi);
744+ }
695745 }
696746 }
697747
@@ -779,9 +829,6 @@ struct strangenesstofpid {
779829 nSigmaPositiveK0ShortPi, nSigmaNegativeK0ShortPi);
780830 }
781831
782- float positiveP = std::hypot (v0.pxpos (), v0.pypos (), v0.pzpos ());
783- float negativeP = std::hypot (v0.pxneg (), v0.pyneg (), v0.pzneg ());
784-
785832 if (doQA) {
786833 if (pTra.hasTOF ()) {
787834 if (v0.v0cosPA () > v0Group.qaCosPA && v0.dcaV0daughters () < v0Group.qaDCADau ) {
@@ -926,17 +973,11 @@ struct strangenesstofpid {
926973 posDeltaTimeAsOmPi, posDeltaTimeAsOmPr, negDeltaTimeAsOmPi, negDeltaTimeAsOmPr, bachDeltaTimeAsOmKa);
927974
928975 float nSigmaXiLaPr = o2::aod::cascdata::kNoTOFValue ;
929- ;
930976 float nSigmaXiLaPi = o2::aod::cascdata::kNoTOFValue ;
931- ;
932977 float nSigmaXiPi = o2::aod::cascdata::kNoTOFValue ;
933- ;
934978 float nSigmaOmLaPr = o2::aod::cascdata::kNoTOFValue ;
935- ;
936979 float nSigmaOmLaPi = o2::aod::cascdata::kNoTOFValue ;
937- ;
938980 float nSigmaOmKa = o2::aod::cascdata::kNoTOFValue ;
939- ;
940981
941982 // go for Nsigma values if requested
942983 if (doNSigmas && nSigmaCalibLoaded) {
0 commit comments