@@ -383,17 +383,17 @@ struct OnTheFlyTofPid {
383383 }
384384 const float mass = pdgInfo->Mass ();
385385 const float mass2 = mass * mass;
386- const float tof = track.mInnerTOFTime .first ; // [ps]
387- const float etof = track.mInnerTOFTime .second ; // [ps]
388- const float L = track.mTrackLengthInnerTOF .first ; // [cm]
389- float p = track.mMomentum .first ; // [GeV/c]
390- p *= std::abs (pdgInfo->Charge ()) / 3 .; // Total momentum
391- const float ep = track.mMomentum .second ; // [GeV/c]
386+ const float tof = track.mInnerTOFTime .first ; // [ps]
387+ const float etof = track.mInnerTOFTime .second ; // [ps]
388+ const float length = track.mTrackLengthInnerTOF .first ; // [cm]
389+ float p = track.mMomentum .first ; // [GeV/c]
390+ p *= std::abs (pdgInfo->Charge ()) / 3 .; // Total momentum
391+ const float ep = track.mMomentum .second ; // [GeV/c]
392392 const float p2 = p * p;
393- const float Lc = L * o2::constants::physics::invLightSpeedCm2PS;
394- const float texp = Lc / p * std::sqrt (mass2 + p2);
393+ const float lengthOverC = length * o2::constants::physics::invLightSpeedCm2PS;
394+ const float texp = lengthOverC / p * std::sqrt (mass2 + p2);
395395 // LOG(info) << "TOF: " << tof << " " << etof << " vs " << texp;
396- const float etexp = Lc * mass2 / p2 / std::sqrt (mass2 + p2) * ep;
396+ const float etexp = lengthOverC * mass2 / p2 / std::sqrt (mass2 + p2) * ep;
397397 const float sigma = std::sqrt (etexp * etexp + etof * etof);
398398 const float deltat = tof - texp;
399399
@@ -417,28 +417,28 @@ struct OnTheFlyTofPid {
417417 // / returns track time resolution
418418 // / \param pt the transverse momentum of the tarck
419419 // / \param eta the pseudorapidity of the tarck
420- // / \param track_pt_resolution the absolute resolution on pt
421- // / \param track_pt_resolution the absolute resolution on eta
420+ // / \param trackPtResolution the absolute resolution on pt
421+ // / \param trackEtaResolution the absolute resolution on eta
422422 // / \param mass the mass of the particle
423- // / \param det_radius the radius of the cylindrical layer
423+ // / \param detRadius the radius of the cylindrical layer
424424 // / \param magneticField the magnetic field (along Z)
425- double calculate_track_time_resolution_advanced (float pt,
425+ double calculateTrackTimeResolutionAdvanced (float pt,
426426 float eta,
427- float track_pt_resolution ,
428- float track_eta_resolution ,
427+ float trackPtResolution ,
428+ float trackEtaResolution ,
429429 float mass,
430- float det_radius ,
430+ float detRadius ,
431431 float magneticField)
432432 {
433433 // Compute tracking contribution to timing using the error propagation formula
434434 // Uses light speed in m/ps, magnetic field in T (*0.1 for conversion kGauss -> T)
435435 double a0 = mass * mass;
436436 double a1 = 0.299792458 * (0.1 * magneticField) * (0.01 * o2::constants::physics::LightSpeedCm2NS / 1e+3 );
437- double a2 = (det_radius * 0.01 ) * (det_radius * 0.01 ) * (0.299792458 ) * (0.299792458 ) * (0.1 * magneticField) * (0.1 * magneticField) / 2.0 ;
438- double dtof_on_dpt = (std::pow (pt, 4 ) * std::pow (std::cosh (eta), 2 ) * std::acos (1.0 - a2 / std::pow (pt, 2 )) - 2.0 * a2 * std::pow (pt, 2 ) * (a0 + std::pow (pt * std::cosh (eta), 2 )) / std::sqrt (a2 * (2.0 * std::pow (pt, 2 ) - a2))) / (a1 * std::pow (pt, 3 ) * std::sqrt (a0 + std::pow (pt * std::cosh (eta), 2 )));
439- double dtof_on_deta = std::pow (pt, 2 ) * std::sinh (eta) * std::cosh (eta) * std::acos (1.0 - a2 / std::pow (pt, 2 )) / (a1 * std::sqrt (a0 + std::pow (pt * std::cosh (eta), 2 )));
440- double track_time_resolution = std::hypot (std::fabs (dtof_on_dpt ) * track_pt_resolution , std::fabs (dtof_on_deta ) * track_eta_resolution );
441- return track_time_resolution ;
437+ double a2 = (detRadius * 0.01 ) * (detRadius * 0.01 ) * (0.299792458 ) * (0.299792458 ) * (0.1 * magneticField) * (0.1 * magneticField) / 2.0 ;
438+ double dtofOndPt = (std::pow (pt, 4 ) * std::pow (std::cosh (eta), 2 ) * std::acos (1.0 - a2 / std::pow (pt, 2 )) - 2.0 * a2 * std::pow (pt, 2 ) * (a0 + std::pow (pt * std::cosh (eta), 2 )) / std::sqrt (a2 * (2.0 * std::pow (pt, 2 ) - a2))) / (a1 * std::pow (pt, 3 ) * std::sqrt (a0 + std::pow (pt * std::cosh (eta), 2 )));
439+ double dtofOndEta = std::pow (pt, 2 ) * std::sinh (eta) * std::cosh (eta) * std::acos (1.0 - a2 / std::pow (pt, 2 )) / (a1 * std::sqrt (a0 + std::pow (pt * std::cosh (eta), 2 )));
440+ double trackTimeResolution = std::hypot (std::fabs (dtofOndPt ) * trackPtResolution , std::fabs (dtofOndEta ) * trackEtaResolution );
441+ return trackTimeResolution ;
442442 }
443443
444444 void process (soa::Join<aod::Collisions, aod::McCollisionLabels>::iterator const & collision,
@@ -498,11 +498,11 @@ struct OnTheFlyTofPid {
498498 o2::track::TrackParCov o2track = convertMCParticleToO2Track (mcParticle);
499499
500500 float xPv = -100 , trackLengthInnerTOF = -1 , trackLengthOuterTOF = -1 ;
501- static constexpr float xThreshold = -99 .f ; // Threshold to consider a good propagation of the track
501+ static constexpr float kTrkXThreshold = -99 .f ; // Threshold to consider a good propagation of the track
502502 if (o2track.propagateToDCA (mcPvVtx, simConfig.dBz )) {
503503 xPv = o2track.getX ();
504504 }
505- if (xPv > xThreshold ) {
505+ if (xPv > kTrkXThreshold ) {
506506 trackLengthInnerTOF = trackLength (o2track, simConfig.innerTOFRadius , simConfig.dBz );
507507 trackLengthOuterTOF = trackLength (o2track, simConfig.outerTOFRadius , simConfig.dBz );
508508 }
@@ -528,7 +528,7 @@ struct OnTheFlyTofPid {
528528 if (recoTrack.propagateToDCA (pvVtx, simConfig.dBz )) {
529529 xPv = recoTrack.getX ();
530530 }
531- if (xPv > xThreshold ) {
531+ if (xPv > kTrkXThreshold ) {
532532 trackLengthRecoInnerTOF = trackLength (recoTrack, simConfig.innerTOFRadius , simConfig.dBz );
533533 trackLengthRecoOuterTOF = trackLength (recoTrack, simConfig.outerTOFRadius , simConfig.dBz );
534534 }
@@ -622,14 +622,14 @@ struct OnTheFlyTofPid {
622622 float innerTotalTimeReso = simConfig.innerTOFTimeReso ;
623623 float outerTotalTimeReso = simConfig.outerTOFTimeReso ;
624624 if (simConfig.flagIncludeTrackTimeRes ) {
625- double pt_resolution = std::pow (momentum / std::cosh (pseudorapidity), 2 ) * std::sqrt (trkWithTime.mMomentum .second );
626- double eta_resolution = std::fabs (std::sin (2.0 * std::atan (std::exp (-pseudorapidity)))) * std::sqrt (trkWithTime.mPseudorapidity .second );
625+ double ptResolution = std::pow (momentum / std::cosh (pseudorapidity), 2 ) * std::sqrt (trkWithTime.mMomentum .second );
626+ double etaResolution = std::fabs (std::sin (2.0 * std::atan (std::exp (-pseudorapidity)))) * std::sqrt (trkWithTime.mPseudorapidity .second );
627627 if (simConfig.flagTOFLoadDelphesLUTs ) {
628- pt_resolution = mSmearer .getAbsPtRes (pdgInfoThis->PdgCode (), dNdEta, pseudorapidity, momentum / std::cosh (pseudorapidity));
629- eta_resolution = mSmearer .getAbsEtaRes (pdgInfoThis->PdgCode (), dNdEta, pseudorapidity, momentum / std::cosh (pseudorapidity));
628+ ptResolution = mSmearer .getAbsPtRes (pdgInfoThis->PdgCode (), dNdEta, pseudorapidity, momentum / std::cosh (pseudorapidity));
629+ etaResolution = mSmearer .getAbsEtaRes (pdgInfoThis->PdgCode (), dNdEta, pseudorapidity, momentum / std::cosh (pseudorapidity));
630630 }
631- float innerTrackTimeReso = calculate_track_time_resolution_advanced (momentum / std::cosh (pseudorapidity), pseudorapidity, pt_resolution, eta_resolution , masses[ii], simConfig.innerTOFRadius , simConfig.dBz );
632- float outerTrackTimeReso = calculate_track_time_resolution_advanced (momentum / std::cosh (pseudorapidity), pseudorapidity, pt_resolution, eta_resolution , masses[ii], simConfig.outerTOFRadius , simConfig.dBz );
631+ float innerTrackTimeReso = calculateTrackTimeResolutionAdvanced (momentum / std::cosh (pseudorapidity), pseudorapidity, ptResolution, etaResolution , masses[ii], simConfig.innerTOFRadius , simConfig.dBz );
632+ float outerTrackTimeReso = calculateTrackTimeResolutionAdvanced (momentum / std::cosh (pseudorapidity), pseudorapidity, ptResolution, etaResolution , masses[ii], simConfig.outerTOFRadius , simConfig.dBz );
633633 innerTotalTimeReso = std::hypot (simConfig.innerTOFTimeReso , innerTrackTimeReso);
634634 outerTotalTimeReso = std::hypot (simConfig.outerTOFTimeReso , outerTrackTimeReso);
635635
@@ -640,12 +640,12 @@ struct OnTheFlyTofPid {
640640 h2dInnerTimeResTotal[ii]->Fill (momentum, innerTotalTimeReso);
641641 }
642642 if (trackLengthRecoOuterTOF > 0 ) {
643- const float transverse_momentum = momentum / std::cosh (pseudorapidity);
643+ const float transverseMomentum = momentum / std::cosh (pseudorapidity);
644644 h2dOuterTimeResTrack[ii]->Fill (momentum, outerTrackTimeReso);
645645 h2dOuterTimeResTotal[ii]->Fill (momentum, outerTotalTimeReso);
646646 if (ii == kPion ) {
647- histos.fill (HIST (" h2dRelativePtResolution" ), transverse_momentum , 100.0 * pt_resolution / transverse_momentum );
648- histos.fill (HIST (" h2dRelativeEtaResolution" ), pseudorapidity, 100.0 * eta_resolution / (std::fabs (pseudorapidity) + 1e-6 ));
647+ histos.fill (HIST (" h2dRelativePtResolution" ), transverseMomentum , 100.0 * ptResolution / transverseMomentum );
648+ histos.fill (HIST (" h2dRelativeEtaResolution" ), pseudorapidity, 100.0 * etaResolution / (std::fabs (pseudorapidity) + 1e-6 ));
649649 }
650650 }
651651 }
0 commit comments