diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/test/RungeKuttaIntersector_test.cxx b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/test/RungeKuttaIntersector_test.cxx index 27ebdcb3e8d3e0cae2eacc8b8fe3661b7dec3de6..692fdac1f24299bdadbfcb52384543030089e04a 100644 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/test/RungeKuttaIntersector_test.cxx +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/test/RungeKuttaIntersector_test.cxx @@ -279,7 +279,7 @@ void test_perigee (Trk::IIntersector& tool) } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx index d5fc579ba68324b2b278c77c6b8021e3a1d4459d..e6bcfae97a26a8583d2e0add7aa34908217a5e9e 100755 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx @@ -722,8 +722,8 @@ Trk::STEP_Propagator::intersectSurface(const EventContext& ctx, ParticleHypothesis particle) const { - Amg::Vector3D origin = trackIntersection->position(); - Amg::Vector3D direction = trackIntersection->direction(); + const Amg::Vector3D& origin = trackIntersection->position(); + const Amg::Vector3D& direction = trackIntersection->direction(); PerigeeSurface* perigeeSurface = new PerigeeSurface(origin); const Trk::TrackParameters* trackParameters = perigeeSurface->createTrackParameters(0.,0., @@ -2719,7 +2719,7 @@ Trk::STEP_Propagator::propagateNeutral(const Trk::TrackParameters& parm, std::vector<std::pair<unsigned int,double> >::iterator oIter = currentDist.begin(); std::vector<DestSurf >::iterator sBeg = targetSurfaces.begin(); - Amg::Vector3D position(parm.position()); + const Amg::Vector3D& position(parm.position()); Amg::Vector3D direction(parm.momentum().normalized()); for (; sIter!=targetSurfaces.end(); sIter++) { diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/src/SolenoidalIntersector.cxx b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/src/SolenoidalIntersector.cxx index c90004957b84012fb1afabdd4a3ad877237116d0..a16fc7b52090d259df8392983554f3c9b3d37c99 100755 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/src/SolenoidalIntersector.cxx +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/src/SolenoidalIntersector.cxx @@ -94,7 +94,7 @@ SolenoidalIntersector::intersectSurface(const Surface& surface, (*perigee, trackIntersection, qOverP); ATH_MSG_WARNING( " unrecognized Surface" ); - return 0; + return nullptr; } /**IIntersector interface method for specific Surface type : PerigeeSurface */ @@ -134,7 +134,7 @@ SolenoidalIntersector::intersectCylinderSurface(const CylinderSurface& surface, double radius2 = isect->position().perp2(); if (std::abs(endRadius - sqrt(radius2)) > m_surfaceTolerance - && ! extrapolateToR(*isect, radius2, *com, endRadius)) return 0; + && ! extrapolateToR(*isect, radius2, *com, endRadius)) return nullptr; return intersection(std::move(isect), *com, surface); } @@ -163,7 +163,7 @@ SolenoidalIntersector::intersectDiscSurface (const DiscSurface& surface, if (std::abs(endZ -trackIntersection->position().z()) > m_surfaceTolerance && ! extrapolateToZ(*isect, *com, endZ)) { - return 0; + return nullptr; } return intersection(std::move(isect), *com, surface); @@ -207,18 +207,18 @@ SolenoidalIntersector::intersectPlaneSurface(const PlaneSurface& surface, while (std::abs(offset) > m_surfaceTolerance*std::abs(dot)) { // take care if grazing incidence - quit if looper - if (std::abs(dot) < 0.0001) return 0; + if (std::abs(dot) < 0.0001) return nullptr; double distance = offset/dot; // extrapolate if (com->m_sinTheta < 0.9) { - if (! extrapolateToZ(*isect, *com, pos.z()+distance*dir.z())) return 0; + if (! extrapolateToZ(*isect, *com, pos.z()+distance*dir.z())) return nullptr; radius2 = pos.perp2(); } else { - if (! extrapolateToR(*isect, radius2, *com, (pos+distance*dir).perp())) return 0; + if (! extrapolateToR(*isect, radius2, *com, (pos+distance*dir).perp())) return nullptr; } // check we are getting closer to the plane, switch to RK in case of difficulty @@ -247,17 +247,13 @@ SolenoidalIntersector::isValid (Amg::Vector3D startPosition, getSolenoidParametrization(); // check cylinder bounds for valid parametrization - if (solenoidParametrization && + return solenoidParametrization && + std::abs(endPosition.z()) < solenoidParametrization->maximumZ() + && endPosition.perp() < solenoidParametrization->maximumR() - && getSolenoidParametrization()->validOrigin(startPosition)) - { - - return true; - } - - - return false; + + && getSolenoidParametrization()->validOrigin(startPosition); } /** tabulate parametrization details */ diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidParametrization_test.cxx b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidParametrization_test.cxx index 1c409cc93566679ebb425edf71e44d1a94272562..d20b85f0e2046c460324139d3d82e209bb46298e 100644 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidParametrization_test.cxx +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidParametrization_test.cxx @@ -61,7 +61,7 @@ void test1 (Trk::SolenoidParametrization& sol, const AtlasFieldCacheCondObj &fie assert( Athena_test::isEqual (secondIntegral, -296.768) ); } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidalIntersector_test.cxx b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidalIntersector_test.cxx index d2b1d588dafedf55c9d9cdf8725f02d677473eba..e660eff150f272d1195e1beacab87c403d4be6c4 100644 --- a/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidalIntersector_test.cxx +++ b/Tracking/TrkExtrapolation/TrkExSolenoidalIntersector/test/SolenoidalIntersector_test.cxx @@ -295,7 +295,7 @@ void test_perigee (Trk::IIntersector& tool) } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/src/StraightLineIntersector.cxx b/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/src/StraightLineIntersector.cxx index 46a7d9b53618895d626046e23326b1d5bbf503a1..a0865085d256749f50aed63efc064b7f80a4cdd7 100755 --- a/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/src/StraightLineIntersector.cxx +++ b/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/src/StraightLineIntersector.cxx @@ -78,7 +78,7 @@ StraightLineIntersector::intersectSurface(const Surface& surface, if (perigee) return approachPerigeeSurface(*perigee,trackIntersection,qOverP); ATH_MSG_WARNING( " unrecognized Surface" ); - return 0; + return nullptr; } /**IIntersector interface method for specific Surface type : PerigeeSurface */ diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx index d43e5c95ceb1106813bddfe62af95c84a197f757..361dc3b0aedab8f80f1d88e7e2e7ca14abbf644b 100644 --- a/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/TimedExtrapolator.cxx @@ -343,7 +343,7 @@ Trk::TimedExtrapolator::extrapolateWithPathLimit( std::map<const Trk::TrackParameters *, bool>::iterator garbageEnd = cache.m_garbageBin.end(); for (; garbageIter != garbageEnd; ++garbageIter) if (garbageIter->first) { if(garbageIter->first == returnParms) { - auto ret=returnParms->clone(); + auto *ret=returnParms->clone(); ATH_MSG_DEBUG(" [+] garbage - at " << positionOutput(garbageIter->first->position())<<" parm="<<garbageIter->first<<" is the return param. Cloning to"<<ret); returnParms=ret; } @@ -1393,7 +1393,7 @@ Trk::TimedExtrapolator::transportNeutralsWithPathLimit(const Trk::TrackParameter std::map<const Trk::TrackParameters *, bool>::iterator garbageEnd = cache.m_garbageBin.end(); for (; garbageIter != garbageEnd; ++garbageIter) if (garbageIter->first) { if(garbageIter->first == returnParms) { - auto ret=returnParms->clone(); + auto *ret=returnParms->clone(); ATH_MSG_DEBUG(" [+] garbage - at " << positionOutput(garbageIter->first->position())<<" parm="<<garbageIter->first<<" is the return param. Cloning to"<<ret); returnParms=ret; } diff --git a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx index 0704ab2ffda553a83c24e62ead2bc0bdd0ba62f0..b32151c3f1fa03d0de0c42e346402ee91a64e368 100755 --- a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx @@ -173,7 +173,7 @@ namespace Trk } } - for (auto ptr : measuredPerigees_delete){ delete ptr; } + for (const auto *ptr : measuredPerigees_delete){ delete ptr; } return fittedVxCandidate; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/Propagator.h b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/Propagator.h index f82cac8ba370376d55bde68dd2ab47fea7f63a9d..ba8b7077bd2b0f1dd6e4fe6c04152eb7bb5d4de9 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/Propagator.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/Propagator.h @@ -54,7 +54,7 @@ class IVKalState; class vkalPropagator { public: vkalPropagator(); - ~vkalPropagator(); + ~vkalPropagator() = default; void Propagate(long int TrkID, long int Charge, diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/VKalVrtBMag.h b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/VKalVrtBMag.h index ffe195e408455056995d8e8cdadb2be68c58f66f..8abd7c98117cea66703cbbbc46fdebae61c9270d 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/VKalVrtBMag.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/VKalVrtBMag.h @@ -1,59 +1,59 @@ /* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -/* General magnetic field in any point access */ +*/ +/* General magnetic field in any point access */ /* If external magnetic field handler is provided as */ /* either an object inherited from the baseMagFld class */ /* or a function addrMagHandler - the vkalMagFld class */ /* will use it, otherwise the vkalMagFld returns */ /* the constant magnetic field. */ /* */ -/* Thread-safe implementation */ -/*---------------------------------------------------------*/ -#ifndef TRKVKALVRTCORE_VKALVRTBMAG_H -#define TRKVKALVRTCORE_VKALVRTBMAG_H +/* Thread-safe implementation */ +/*---------------------------------------------------------*/ +#ifndef TRKVKALVRTCORE_VKALVRTBMAG_H +#define TRKVKALVRTCORE_VKALVRTBMAG_H -namespace Trk { +namespace Trk { class VKalVrtControlBase; - - typedef void (*addrMagHandler)(double,double,double, double& ,double& , double& ); + + typedef void (*addrMagHandler)(double,double,double, double& ,double& , double& ); // // Base class for concrete megnetic field implementations (e.g. Athena tool) to be called by vkalMagFld -// - class baseMagFld { - public: - baseMagFld(); - virtual ~baseMagFld(); - virtual void getMagFld(const double,const double,const double,double&,double&,double&) const =0; - }; - +// + class baseMagFld { + public: + baseMagFld(); + virtual ~baseMagFld(); + virtual void getMagFld(const double,const double,const double,double&,double&,double&) const =0; + }; + // // Main magnetic field implememtation in VKalVrtCore package. // Depending on VKalVrtControlBase it either calls external magnetic field // or uses default fixed magnetic field. -// - class vkalMagFld { - public: - vkalMagFld(); - ~vkalMagFld(); - - void getMagFld(const double,const double,const double,double&,double&,double&, const VKalVrtControlBase*) const; +// + class vkalMagFld { + public: + vkalMagFld(); + ~vkalMagFld() = default; + + void getMagFld(const double,const double,const double,double&,double&,double&, const VKalVrtControlBase*) const; double getMagFld(const double xyz[3], const VKalVrtControlBase* FitControl) const; - double getCnvCst() const; - - private: - const double m_cnstBMAG; - const double m_vkalCnvMagFld; - double m_saveXpos; - double m_saveYpos; - double m_saveZpos; - double m_saveBX; - double m_saveBY; - double m_saveBZ; - }; - -} -#endif + double getCnvCst() const; + + private: + const double m_cnstBMAG; + const double m_vkalCnvMagFld; + double m_saveXpos; + double m_saveYpos; + double m_saveZpos; + double m_saveBX; + double m_saveBY; + double m_saveBZ; + }; + +} +#endif diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx index 5048ff8506510dc979e182793a42dadc5c0efa1c..530160e29efa042db35e62e1bde2372f5223d8ef 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx @@ -23,7 +23,7 @@ int initCascadeEngine(CascadeEvent &); VKVertex* startCascade( std::unique_ptr<VKVertex> vk) { - auto ptr = vk.get(); + auto *ptr = vk.get(); ptr->vk_fitterControl->getCascadeEvent()->cascadeNV=1; ptr->vk_fitterControl->getCascadeEvent()->nearPrmVertex=0; ptr->vk_fitterControl->getCascadeEvent()->cascadeVertexList.clear(); @@ -33,7 +33,7 @@ VKVertex* startCascade( std::unique_ptr<VKVertex> vk) VKVertex* addCascadeEntry( std::unique_ptr<VKVertex> vk) { - auto ptr = vk.get(); + auto *ptr = vk.get(); ptr->vk_fitterControl->getCascadeEvent()->cascadeNV++; ptr->vk_fitterControl->getCascadeEvent()->cascadeVertexList.push_back(std::move(vk)); return ptr->vk_fitterControl->getCascadeEvent()->cascadeVertexList.back().get(); @@ -48,7 +48,7 @@ VKVertex* addCascadeEntry( std::unique_ptr<VKVertex> vk, const std::vector<int> vk->includedVrt.push_back(predecessor); } // - auto ptr = vk.get(); + auto *ptr = vk.get(); ptr->vk_fitterControl->getCascadeEvent()->cascadeNV++; ptr->vk_fitterControl->getCascadeEvent()->cascadeVertexList.push_back(std::move(vk)); return ptr->vk_fitterControl->getCascadeEvent()->cascadeVertexList.back().get(); @@ -135,7 +135,7 @@ int makeCascade(VKalVrtControl & FitCONTROL, long int NTRK, long int *ich, doubl if(!includeNV) { // no predecessors addCascadeEntry( std::move(VRT) ); }else{ - auto vrttemp = addCascadeEntry( std::move(VRT), cascadeDefinition[iv]); + auto *vrttemp = addCascadeEntry( std::move(VRT), cascadeDefinition[iv]); for (it=0; it<includeNV ; it++) { // tracks created out of predecessing vertices vrttemp->TrackList.emplace_back(new VKTrack(-999, tmp, tmp , vrttemp, 0.)); vrttemp->tmpArr.emplace_back(new TWRK()); @@ -147,7 +147,7 @@ int makeCascade(VKalVrtControl & FitCONTROL, long int NTRK, long int *ich, doubl if(vEstimDone){ IERR = translateToFittedPos(*(FitCONTROL.getCascadeEvent()),1.); if(IERR)return IERR; for( iv=0; iv<FitCONTROL.getCascadeEvent()->cascadeNV; iv++){ - auto VRT=FitCONTROL.getCascadeEvent()->cascadeVertexList[iv].get(); + auto *VRT=FitCONTROL.getCascadeEvent()->cascadeVertexList[iv].get(); int NTv = VRT->TrackList.size(); // Number of tracks at vertex for(it=0; it<NTv; it++){ trk=VRT->TrackList[it].get(); diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx index db66cb3a9790d45e8e0725554a70094262a0b234..94c5c0964822374129cf24af937566f4e3285c2f 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx @@ -31,7 +31,7 @@ vkalMagFld::vkalMagFld(): m_saveBZ=0.; } -vkalMagFld::~vkalMagFld() = default; + baseMagFld::baseMagFld() = default; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx index 5efe0060c1979c84f7954d75a6e744237459fbf2..d549ae2b7f01e9b8272f0c2035363192de9e41eb 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx @@ -131,7 +131,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const // Propagator object // vkalPropagator::vkalPropagator()= default; - vkalPropagator::~vkalPropagator() = default; + basePropagator::basePropagator() = default; basePropagator::~basePropagator() = default; diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx index 7b8596274acf4db71c4235e13aada9ecb45d1841..a0c3f0a231e5d7a0821e04542cdbcd476288a2d5 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx @@ -20,6 +20,8 @@ namespace Trk double GaussianTrackDensity::globalMaximum (const std::vector<const Track*>& vectorTrk) const { std::vector<const TrackParameters*> perigeeList; + perigeeList.reserve(vectorTrk.size()); + for (const Track* itrk : vectorTrk) { perigeeList.push_back(itrk->perigeeParameters()); @@ -39,6 +41,8 @@ namespace Trk std::unique_ptr<ITrackDensity>& density) const { std::vector<const TrackParameters*> perigeeList; + perigeeList.reserve(vectorTrk.size()); + for (const Track* itrk : vectorTrk) { perigeeList.push_back(itrk->perigeeParameters());