@@ -497,9 +497,10 @@ struct OnTheFlyTofPid {
497497 o2::track::TrackParCov o2track = convertMCParticleToO2Track (mcParticle);
498498
499499 float xPv = -100 , trackLengthInnerTOF = -1 , trackLengthOuterTOF = -1 ;
500- if (o2track.propagateToDCA (mcPvVtx, simConfig.dBz ))
501- xPv = o2track.getX ();
502- if (xPv > -99 .) {
500+ static constexpr float xThreshold = -99 .f ; // Threshold to consider a good propagation of the track
501+ if (o2track.propagateToDCA (mcPvVtx, simConfig.dBz )){
502+ xPv = o2track.getX ();}
503+ if (xPv > xThreshold) {
503504 trackLengthInnerTOF = trackLength (o2track, simConfig.innerTOFRadius , simConfig.dBz );
504505 trackLengthOuterTOF = trackLength (o2track, simConfig.outerTOFRadius , simConfig.dBz );
505506 }
@@ -522,9 +523,9 @@ struct OnTheFlyTofPid {
522523 // and the (imperfect!) reconstructed track parametrizations
523524 float trackLengthRecoInnerTOF = -1 , trackLengthRecoOuterTOF = -1 ;
524525 auto recoTrack = getTrackParCov (track);
525- if (recoTrack.propagateToDCA (pvVtx, simConfig.dBz ))
526- xPv = recoTrack.getX ();
527- if (xPv > - 99 . ) {
526+ if (recoTrack.propagateToDCA (pvVtx, simConfig.dBz )){
527+ xPv = recoTrack.getX ();}
528+ if (xPv > xThreshold ) {
528529 trackLengthRecoInnerTOF = trackLength (recoTrack, simConfig.innerTOFRadius , simConfig.dBz );
529530 trackLengthRecoOuterTOF = trackLength (recoTrack, simConfig.outerTOFRadius , simConfig.dBz );
530531 }
@@ -600,7 +601,7 @@ struct OnTheFlyTofPid {
600601 }
601602 }
602603
603- for (int ii = 0 ; ii < 5 ; ii++) {
604+ for (int ii = 0 ; ii < kParticles ; ii++) {
604605 nSigmaInnerTOF[ii] = -100 ;
605606 nSigmaOuterTOF[ii] = -100 ;
606607
@@ -636,10 +637,10 @@ struct OnTheFlyTofPid {
636637 h2dInnerTimeResTotal[ii]->Fill (momentum, innerTotalTimeReso);
637638 }
638639 if (trackLengthRecoOuterTOF > 0 ) {
639- float transverse_momentum = momentum / std::cosh (pseudorapidity);
640+ const float transverse_momentum = momentum / std::cosh (pseudorapidity);
640641 h2dOuterTimeResTrack[ii]->Fill (momentum, outerTrackTimeReso);
641642 h2dOuterTimeResTotal[ii]->Fill (momentum, outerTotalTimeReso);
642- if (ii == 2 ) {
643+ if (ii == kPion ) {
643644 histos.fill (HIST (" h2dRelativePtResolution" ), transverse_momentum, 100.0 * pt_resolution / transverse_momentum);
644645 histos.fill (HIST (" h2dRelativeEtaResolution" ), pseudorapidity, 100.0 * eta_resolution / (std::fabs (pseudorapidity) + 1e-6 ));
645646 }
@@ -658,18 +659,18 @@ struct OnTheFlyTofPid {
658659 }
659660
660661 if (plotsConfig.doQAplots ) {
661- for (int ii = 0 ; ii < 5 ; ii++) {
662+ for (int ii = 0 ; ii < kParticles ; ii++) {
662663 if (std::fabs (mcParticle.pdgCode ()) != pdg->GetParticle (pdgArray[ii])->PdgCode ()) {
663664 continue ;
664665 }
665666 if (trackLengthRecoInnerTOF > 0 ) {
666- for (int iii = 0 ; iii < 5 ; iii++) {
667+ for (int iii = 0 ; iii < kParticles ; iii++) {
667668 h2dInnerNsigmaTrue[ii][iii]->Fill (momentum, nSigmaInnerTOF[iii]);
668669 h2dInnerDeltaTrue[ii][iii]->Fill (momentum, deltaTimeInnerTOF[iii]);
669670 }
670671 }
671672 if (trackLengthRecoOuterTOF > 0 ) {
672- for (int iii = 0 ; iii < 5 ; iii++) {
673+ for (int iii = 0 ; iii < kParticles ; iii++) {
673674 h2dOuterNsigmaTrue[ii][iii]->Fill (momentum, nSigmaOuterTOF[iii]);
674675 h2dOuterDeltaTrue[ii][iii]->Fill (momentum, deltaTimeOuterTOF[iii]);
675676 }
0 commit comments