diff --git a/ALICE3/Core/TrackUtilities.cxx b/ALICE3/Core/TrackUtilities.cxx index 86b41e6245c..0b4d1dc08f7 100644 --- a/ALICE3/Core/TrackUtilities.cxx +++ b/ALICE3/Core/TrackUtilities.cxx @@ -29,13 +29,13 @@ #include void o2::upgrade::convertTLorentzVectorToO2Track(const int charge, - const TLorentzVector particle, - const std::vector productionVertex, + const TLorentzVector& particle, + const std::vector& productionVertex, o2::track::TrackParCov& o2track) { - std::array params; + std::array params = {0.}; std::array covm = {0.}; - float s, c, x; + float s{}, c{}, x{}; o2::math_utils::sincos(static_cast(particle.Phi()), s, c); o2::math_utils::rotateZInv(static_cast(productionVertex[0]), static_cast(productionVertex[1]), x, params[0], s, c); params[1] = static_cast(productionVertex[2]); @@ -48,20 +48,20 @@ void o2::upgrade::convertTLorentzVectorToO2Track(const int charge, new (&o2track)(o2::track::TrackParCov)(x, particle.Phi(), params, covm); } -float o2::upgrade::computeParticleVelocity(float momentum, float mass) +float o2::upgrade::computeParticleVelocity(const float momentum, const float mass) { const float a = momentum / mass; // uses light speed in cm/ps so output is in those units return o2::constants::physics::LightSpeedCm2PS * a / std::sqrt((1.f + a * a)); } -float o2::upgrade::computeTrackLength(o2::track::TrackParCov track, float radius, float magneticField) +float o2::upgrade::computeTrackLength(const o2::track::TrackParCov& track, const float radius, const float magneticField) { // don't make use of the track parametrization float length = -100; o2::math_utils::CircleXYf_t trcCircle; - float sna, csa; + float sna{}, csa{}; track.getCircleParams(magneticField, trcCircle, sna, csa); // distance between circle centers (one circle is at origin -> easy) @@ -69,8 +69,6 @@ float o2::upgrade::computeTrackLength(o2::track::TrackParCov track, float radius // condition of circles touching - if not satisfied returned length will be -100 if (centerDistance < trcCircle.rC + radius && centerDistance > std::fabs(trcCircle.rC - radius)) { - length = 0.0f; - // base radical direction const float ux = trcCircle.xC / centerDistance; const float uy = trcCircle.yC / centerDistance; @@ -87,17 +85,17 @@ float o2::upgrade::computeTrackLength(o2::track::TrackParCov track, float radius (centerDistance + trcCircle.rC + radius)); // possible intercept points of track and TOF layer in 2D plane - const float point1[2] = {radical * ux + displace * vx, radical * uy + displace * vy}; - const float point2[2] = {radical * ux - displace * vx, radical * uy - displace * vy}; + const std::array point1 = {radical * ux + displace * vx, radical * uy + displace * vy}; + const std::array point2 = {radical * ux - displace * vx, radical * uy - displace * vy}; // decide on correct intercept point - std::array mom; + std::array mom{}; track.getPxPyPzGlo(mom); const float scalarProduct1 = point1[0] * mom[0] + point1[1] * mom[1]; const float scalarProduct2 = point2[0] * mom[0] + point2[1] * mom[1]; // get start point - std::array startPoint; + std::array startPoint{}; track.getXYZGlo(startPoint); float cosAngle = -1000, modulus = -1000; diff --git a/ALICE3/Core/TrackUtilities.h b/ALICE3/Core/TrackUtilities.h index 0cdcc5da92b..f591cd05d0f 100644 --- a/ALICE3/Core/TrackUtilities.h +++ b/ALICE3/Core/TrackUtilities.h @@ -36,8 +36,8 @@ namespace o2::upgrade /// \param productionVertex where the particle was produced /// \param o2track the address of the resulting TrackParCov void convertTLorentzVectorToO2Track(const int charge, - const TLorentzVector particle, - const std::vector productionVertex, + const TLorentzVector& particle, + const std::vector& productionVertex, o2::track::TrackParCov& o2track); /// Function to convert a TLorentzVector into a perfect Track @@ -47,9 +47,9 @@ void convertTLorentzVectorToO2Track(const int charge, /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service template -void convertTLorentzVectorToO2Track(int pdgCode, - TLorentzVector particle, - std::vector productionVertex, +void convertTLorentzVectorToO2Track(const int pdgCode, + const TLorentzVector& particle, + const std::vector& productionVertex, o2::track::TrackParCov& o2track, const PdgService& pdg) { @@ -80,7 +80,7 @@ void convertOTFParticleToO2Track(const OTFParticle& particle, /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service template -void convertMCParticleToO2Track(McParticleType& particle, +void convertMCParticleToO2Track(const McParticleType& particle, o2::track::TrackParCov& o2track, const PdgService& pdg) { @@ -94,7 +94,7 @@ void convertMCParticleToO2Track(McParticleType& particle, /// \param o2track the address of the resulting TrackParCov /// \param pdg the pdg service template -o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle, +o2::track::TrackParCov convertMCParticleToO2Track(const McParticleType& particle, const PdgService& pdg) { o2::track::TrackParCov o2track; @@ -105,13 +105,13 @@ o2::track::TrackParCov convertMCParticleToO2Track(McParticleType& particle, /// returns velocity in centimeters per picoseconds /// \param momentum the momentum of the track /// \param mass the mass of the particle -float computeParticleVelocity(float momentum, float mass); +float computeParticleVelocity(const float momentum, const float mass); /// function to calculate track length of this track up to a certain radius /// \param track the input track (TrackParCov) /// \param radius the radius of the layer you're calculating the length to /// \param magneticField the magnetic field to use when propagating -float computeTrackLength(o2::track::TrackParCov track, float radius, float magneticField); +float computeTrackLength(const o2::track::TrackParCov& track, const float radius, const float magneticField); } // namespace o2::upgrade