@@ -336,7 +336,7 @@ struct strangenesstofpid {
336336 static constexpr float MAX_SIN_PHI = 0 .85f ;
337337 static constexpr float MAX_STEP = 2 .0f ;
338338 static constexpr float MAX_STEP_FINAL_STAGE = 0 .5f ;
339- static constexpr float MAX_EXTRA_X = 20 .0f ; // maximum extra X on top of TOF X for correcting value
339+ static constexpr float MAX_FINAL_X = 390 .0f ; // maximum extra X on top of TOF X for correcting value
340340
341341 bool trackOK = track.getXatLabR (tofPosition, trackX, d_bz);
342342 if (trackOK){
@@ -354,10 +354,15 @@ struct strangenesstofpid {
354354
355355 // correct for TOF segmentation
356356 float trackXextra = trackX;
357- while (trackXextra < trackX + MAX_EXTRA_X){
357+ bool trackOKextra = true ;
358+ while (trackXextra < MAX_FINAL_X){
358359 // propagate one step further
359360 trackXextra += MAX_STEP_FINAL_STAGE;
360- o2::base::Propagator::Instance ()->propagateToX (track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral);
361+ trackOKextra = o2::base::Propagator::Instance ()->propagateToX (track, trackXextra, d_bz, MAX_SIN_PHI, MAX_STEP, o2::base::Propagator::MatCorrType::USEMatCorrLUT, <Integral);
362+ if (!trackOKextra){
363+ timePion = timeKaon = timeProton = -1e+6 ;
364+ return ; // propagation failed, skip, won't look reasonable
365+ }
361366
362367 // re-evaluate - did we cross? if yes break
363368 float previousX = xyz[0 ], previousY = xyz[1 ];
@@ -681,8 +686,12 @@ struct strangenesstofpid {
681686 if (calculationMethod.value ==1 ){
682687 // method to calculate the time and length via Propagator TrackLTIntegral
683688 float timeKaon; // will go unused
684- calculateTOF (posTrack, timePositivePi, timeKaon, timePositivePr);
685- calculateTOF (negTrack, timeNegativePi, timeKaon, timeNegativePr);
689+ if (pTra.hasTOF ()){ // calculate if signal at all present, otherwise skip
690+ calculateTOF (posTrack, timePositivePi, timeKaon, timePositivePr);
691+ }
692+ if (nTra.hasTOF ()){ // calculate if signal at all present, otherwise skip
693+ calculateTOF (negTrack, timeNegativePi, timeKaon, timeNegativePr);
694+ }
686695 }
687696
688697 if (pTra.hasTOF () && timePositivePr > 0 ) {
0 commit comments