From 39043de9e55f0e21d4d280fc7910719dbad38266 Mon Sep 17 00:00:00 2001 From: jesgum Date: Wed, 1 Jul 2026 11:00:58 +0200 Subject: [PATCH 1/2] Don't copy trackparcov when computing tracklengths --- ALICE3/Core/TrackUtilities.cxx | 4 ++-- ALICE3/Core/TrackUtilities.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ALICE3/Core/TrackUtilities.cxx b/ALICE3/Core/TrackUtilities.cxx index 86b41e6245c..79405c4e0ee 100644 --- a/ALICE3/Core/TrackUtilities.cxx +++ b/ALICE3/Core/TrackUtilities.cxx @@ -48,14 +48,14 @@ 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; diff --git a/ALICE3/Core/TrackUtilities.h b/ALICE3/Core/TrackUtilities.h index 0cdcc5da92b..4c2e288d883 100644 --- a/ALICE3/Core/TrackUtilities.h +++ b/ALICE3/Core/TrackUtilities.h @@ -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 From a4f205702636809eabb1ed83d0b5e7c76a6bdb20 Mon Sep 17 00:00:00 2001 From: jesgum Date: Wed, 1 Jul 2026 11:26:32 +0200 Subject: [PATCH 2/2] More const --- ALICE3/Core/TrackUtilities.cxx | 4 ++-- ALICE3/Core/TrackUtilities.h | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ALICE3/Core/TrackUtilities.cxx b/ALICE3/Core/TrackUtilities.cxx index 79405c4e0ee..3e52e4367af 100644 --- a/ALICE3/Core/TrackUtilities.cxx +++ b/ALICE3/Core/TrackUtilities.cxx @@ -29,8 +29,8 @@ #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; diff --git a/ALICE3/Core/TrackUtilities.h b/ALICE3/Core/TrackUtilities.h index 4c2e288d883..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;