diff --git a/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx b/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx index 1fe7bb0217cf69ce939344454b155c5dc13b7f4d..2d5bec44c43505ac7cb809fa71171c63b9020072 100644 --- a/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx +++ b/Tracking/TrkEvent/TrkCaloClusterROI/src/CaloClusterROI.cxx @@ -5,6 +5,10 @@ // CaloClusterROI.cxx // Trk +#include <memory> + + + #include "TrkCaloClusterROI/CaloClusterROI.h" #include "TrkEventPrimitives/LocalParameters.h" #include "TrkSurfaces/Surface.h" @@ -55,7 +59,7 @@ Trk::CaloClusterROI::operator=(const Trk::CaloClusterROI& cot) { if (&cot != this) { SurfacePtrHolder::operator=(cot); - m_localParams.reset(new Trk::LocalParameters(*cot.m_localParams)); + m_localParams = std::make_unique<Trk::LocalParameters>(*cot.m_localParams); m_energy = cot.m_energy; m_phiWidth = cot.m_phiWidth; m_etaWidth = cot.m_etaWidth; diff --git a/Tracking/TrkEvent/TrkParametersBase/test/ParametersBase_test.cxx b/Tracking/TrkEvent/TrkParametersBase/test/ParametersBase_test.cxx index b812155c4a046db272096672ab06eb30841b5e78..7dec302733beb82ca786e101ef4a15f7bcccd8f0 100644 --- a/Tracking/TrkEvent/TrkParametersBase/test/ParametersBase_test.cxx +++ b/Tracking/TrkEvent/TrkParametersBase/test/ParametersBase_test.cxx @@ -21,8 +21,10 @@ #include "../TrkParametersBase/ParametersBase.h" #include "TrkParametersBase/Charged.h" #include "TrkParametersBase/Neutral.h" -#include <string> #include <ostream> +#include <string> +#include <utility> + //Tests run by typing 'ctest' in the build directory (-v for verbose) //or can run the executable directly, e.g @@ -39,13 +41,13 @@ namespace Trk{ class Surface{ public: static constexpr unsigned int id{12345}; - std::string str() const{ + static std::string str() { return std::string("TestSurface"); } }; - std::ostream & operator<< (std::ostream & out, const Surface & s){ - out<<s.str(); + std::ostream & operator<< (std::ostream & out, const Surface & /*s*/){ + out<<Trk::Surface::str(); return out; } } @@ -53,20 +55,20 @@ namespace Trk{ class ChargedParametersStub final : public Trk::ParametersBase<DIM,T>{ public: //access base class Constructors - ChargedParametersStub(const AmgVector(DIM) parameters, + ChargedParametersStub(const AmgVector(DIM)& parameters, std::optional<AmgSymMatrix(DIM)> covariance, const T chargeDef): - Trk::ParametersBase<DIM,T>(parameters, covariance,chargeDef){ + Trk::ParametersBase<DIM,T>(parameters, std::move(covariance),chargeDef){ //nop } ChargedParametersStub(std::optional<AmgSymMatrix(DIM)> covariance): - ParametersBase(covariance){ + ParametersBase(std::move(covariance)){ //nop } ChargedParametersStub(const AmgVector(DIM) & parameters, std::optional<AmgSymMatrix(DIM)> covariance = std::nullopt): - ParametersBase(parameters,covariance){ + ParametersBase(parameters,std::move(covariance)){ //nop } @@ -119,7 +121,7 @@ BOOST_AUTO_TEST_SUITE(ParametersBaseTest) BOOST_AUTO_TEST_CASE(Constructors){ //constructors are 'tested' just by seeing whether the following //compiles for each instantiation, but I put the 'NO_THROW' check around them - typedef Trk::ParametersBase<DIM,T> ChargedParams_t; + using ChargedParams_t = Trk::ParametersBase<DIM, T>; //ChargedParams_t x; <-constructors are protected, this won't compile //Instantiate a derived class using default c'tor . Never do this! //The default c'tor is only for use by POOL @@ -228,7 +230,7 @@ BOOST_AUTO_TEST_SUITE(ParametersBaseTest) BOOST_TEST(!(u == x),"Two differently constructed objects are not equal"); u=x; BOOST_TEST(u == x,"After assignment, the objects are equal"); - const auto p = x.clone(); + auto *const p = x.clone(); BOOST_TEST(*p == x,"Cloning an object results in a similar object"); std::unique_ptr<Trk::ParametersBase<DIM, T>> uniquePtr{x.uniqueClone()}; BOOST_TEST(*uniquePtr == x,"Cloning to unique_ptr gives identical results"); diff --git a/Tracking/TrkEvent/TrkSegment/src/Segment.cxx b/Tracking/TrkEvent/TrkSegment/src/Segment.cxx index 2eb5fef075bddd34a8347d566bc7e99ebdad830f..71b779b7481a207712f016f80366a742123f56ba 100755 --- a/Tracking/TrkEvent/TrkSegment/src/Segment.cxx +++ b/Tracking/TrkEvent/TrkSegment/src/Segment.cxx @@ -6,6 +6,10 @@ // Segment.cxx, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// +#include <memory> + + + #include "TrkSegment/Segment.h" #include "TrkEventPrimitives/FitQuality.h" @@ -86,7 +90,7 @@ Trk::Segment::operator=(const Trk::Segment& seg) if (seg.m_containedMeasBases) { if (!m_containedMeasBases) { - m_containedMeasBases.reset(new DataVector<const Trk::MeasurementBase>); + m_containedMeasBases = std::make_unique<DataVector<const Trk::MeasurementBase>>(); } else { m_containedMeasBases->clear(); } @@ -111,7 +115,7 @@ Trk::Segment::operator=(Trk::Segment&& seg) noexcept Trk::MeasurementBase::operator=(seg); m_fitQuality = std::move(seg.m_fitQuality); m_containedMeasBases = std::move(seg.m_containedMeasBases); - m_author = std::move(seg.m_author); + m_author = seg.m_author; } return (*this); } diff --git a/Tracking/TrkEvent/VxJetVertex/VxJetVertex/TwoTrackVerticesInJet.h b/Tracking/TrkEvent/VxJetVertex/VxJetVertex/TwoTrackVerticesInJet.h index 425705433810e907292a6b256303a7e6aebee2a7..b3cd4a342ba0d6f003f91a20a02676b10f72ee9a 100644 --- a/Tracking/TrkEvent/VxJetVertex/VxJetVertex/TwoTrackVerticesInJet.h +++ b/Tracking/TrkEvent/VxJetVertex/VxJetVertex/TwoTrackVerticesInJet.h @@ -104,8 +104,8 @@ namespace Trk private: - void deleteAll(std::vector<const TrackParticleBase*> & neutralTrackOfVertex) noexcept; - void deleteAll(std::vector<const xAOD::Vertex*> & twoTrackVertices) noexcept; + static void deleteAll(std::vector<const TrackParticleBase*> & neutralTrackOfVertex) noexcept; + static void deleteAll(std::vector<const xAOD::Vertex*> & twoTrackVertices) noexcept; std::vector<const xAOD::Vertex*> m_twoTrackVertices; std::vector<const TrackParticleBase*> m_neutralTrackOfVertex; diff --git a/Tracking/TrkFitter/TrkFitterUtils/src/ProtoMaterialEffects.cxx b/Tracking/TrkFitter/TrkFitterUtils/src/ProtoMaterialEffects.cxx index 981d9d3eb12ac2d40f1847f65324e3000912b39a..f0a710a8e8e10f6e072feab08cf62a80d8e8d3f4 100644 --- a/Tracking/TrkFitter/TrkFitterUtils/src/ProtoMaterialEffects.cxx +++ b/Tracking/TrkFitter/TrkFitterUtils/src/ProtoMaterialEffects.cxx @@ -287,7 +287,7 @@ MaterialEffectsBase *ProtoMaterialEffects::makeMEOT() const { } else neweloss=new Trk::EnergyLoss(m_deltae,m_sigmadeltae,m_sigmadeltaeneg,m_sigmadeltaepos); } - MaterialEffectsOnTrack *meot=new MaterialEffectsOnTrack(m_x0,std::move(scatangles),neweloss,*m_surf,typePattern); + MaterialEffectsOnTrack *meot=new MaterialEffectsOnTrack(m_x0,scatangles,neweloss,*m_surf,typePattern); const_cast<bool&>(m_owneloss)=false; //Non MT safe function //m_eloss=0; return meot; diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFMaterialEffects.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFMaterialEffects.cxx index d54a519998b10298c86b7067de792e87414ed7e3..0dd0ea6aa77c273ef81c0ad30b9749fc40ef4699 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFMaterialEffects.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFMaterialEffects.cxx @@ -253,7 +253,7 @@ namespace Trk { } return std::make_unique<MaterialEffectsOnTrack>( - m_x0, std::move(scatangles), neweloss.release(), *m_surf, typePattern); + m_x0, scatangles, neweloss.release(), *m_surf, typePattern); } const Trk::MaterialProperties * GXFMaterialEffects::materialProperties() const { diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 289af1dd020e6192078d6efc03bd35f7fd02436c..fc13abfc44482714c6af8a0c3896cfe5acd9f5ad 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -2644,7 +2644,7 @@ namespace Trk { Trk::MaterialEffectsOnTrack newmeot( meff->thicknessInX0(), - std::move(newsa), + newsa, nullptr, tsos->surface() );