diff --git a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/SiNoise_bt.h b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/SiNoise_bt.h index c05db9fa72745f9f12d2ea0f6c6f9d3807b03252..949d13887dcd6075829c1a21f446528cf797956a 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/SiNoise_bt.h +++ b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/SiNoise_bt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -16,94 +16,29 @@ #define SiNoise_bt_H #include "TrkParameters/TrackParameters.h" -#include "TrkSurfaces/Surface.h" -//class Trk::TrackParameters; namespace InDet{ - class SiNoise_bt - { - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// + class SiNoise_bt{ public: - - SiNoise_bt(); - SiNoise_bt(const SiNoise_bt&); - ~SiNoise_bt(); - SiNoise_bt& operator = (const SiNoise_bt&); - - /////////////////////////////////////////////////////////////////// - // Main methods - /////////////////////////////////////////////////////////////////// - - const int& model () const {return m_model ;} + const int& model () const {return m_model ;} const double& covarianceAzim() const {return m_covarianceAzim;} const double& covariancePola() const {return m_covariancePola;} const double& covarianceIMom() const {return m_covarianceIMom;} const double& correctionIMom() const {return m_correctionIMom;} + void reset(); + void production(int direction,int model,const Trk::TrackParameters& tp); - void initiate(); - void production(int,int,const Trk::TrackParameters&); - - protected: - - /////////////////////////////////////////////////////////////////// - // Protected Data - /////////////////////////////////////////////////////////////////// - - int m_model ; - double m_covarianceAzim; - double m_covariancePola; - double m_covarianceIMom; - double m_correctionIMom; - - /////////////////////////////////////////////////////////////////// - // Methods - /////////////////////////////////////////////////////////////////// + private: + int m_model{} ; + double m_covarianceAzim{}; + double m_covariancePola{}; + double m_covarianceIMom{}; + double m_correctionIMom{1.0}; }; - - ///////////////////////////////////////////////////////////////////////////////// - // Inline methods - ///////////////////////////////////////////////////////////////////////////////// - - inline SiNoise_bt::SiNoise_bt() - { - initiate(); - } - - inline SiNoise_bt::SiNoise_bt(const SiNoise_bt& N) - { - m_model = N.m_model ; - m_covarianceAzim = N.m_covarianceAzim; - m_covariancePola = N.m_covariancePola; - m_covarianceIMom = N.m_covarianceIMom; - m_correctionIMom = N.m_correctionIMom; - } - - inline SiNoise_bt& SiNoise_bt::operator = (const SiNoise_bt& N) - { - m_model = N.m_model ; - m_covarianceAzim = N.m_covarianceAzim; - m_covariancePola = N.m_covariancePola; - m_covarianceIMom = N.m_covarianceIMom; - m_correctionIMom = N.m_correctionIMom; - return(*this); - } - - inline SiNoise_bt::~SiNoise_bt() {} - - inline void SiNoise_bt::initiate() - { - m_model = 0 ; - m_covarianceAzim = 0.; - m_covariancePola = 0.; - m_covarianceIMom = 0.; - m_correctionIMom = 1.; - } } // end of name space diff --git a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/TRT_SeededTrackFinder_ATL.h b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/TRT_SeededTrackFinder_ATL.h index f5c3433883a7b4c7a54fdb1f4d9d533e5612cec9..88b5bd642aa053a2b4e858d4d8ac48a167bcb42b 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/TRT_SeededTrackFinder_ATL.h +++ b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/TRT_SeededTrackFinderTool/TRT_SeededTrackFinder_ATL.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -16,10 +16,6 @@ #include "AthenaBaseComps/AthAlgTool.h" -#include <list> -#include <vector> -#include <map> - //Tool Handler // #include "GaudiKernel/ToolHandle.h" @@ -53,6 +49,11 @@ // #include "StoreGate/ReadHandleKey.h" +#include <list> +#include <vector> +#include <map> +#include <iosfwd> + class MsgStream; class TRT_ID ; @@ -74,22 +75,15 @@ namespace InDet{ @author Thomas.Koffas@cern.ch */ - class TRT_SeededTrackFinder_ATL : - - virtual public ITRT_SeededTrackFinder, public AthAlgTool - { - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - + class TRT_SeededTrackFinder_ATL :virtual public ITRT_SeededTrackFinder, public AthAlgTool{ + public: /////////////////////////////////////////////////////////////////// /** Standard tool methods */ /////////////////////////////////////////////////////////////////// - TRT_SeededTrackFinder_ATL - (const std::string&,const std::string&,const IInterface*); + TRT_SeededTrackFinder_ATL(const std::string&,const std::string&,const IInterface*); virtual ~TRT_SeededTrackFinder_ATL(); virtual StatusCode initialize() override; virtual StatusCode finalize () override; @@ -99,17 +93,19 @@ namespace InDet{ /////////////////////////////////////////////////////////////////// /** Main method. Calls private methods and returns a list of Si tracks */ - virtual std::list<Trk::Track*> getTrack (const EventContext& ctx, InDet::ITRT_SeededTrackFinder::IEventData &event_data, - const Trk::TrackSegment&) const override; + virtual std::list<Trk::Track*> + getTrack (const EventContext& ctx, InDet::ITRT_SeededTrackFinder::IEventData &event_data, + const Trk::TrackSegment&) const override; /** New event initialization */ virtual std::unique_ptr<InDet::ITRT_SeededTrackFinder::IEventData> - newEvent(const EventContext& ctx, SiCombinatorialTrackFinderData_xk& combinatorialData) const override; + newEvent(const EventContext& ctx, SiCombinatorialTrackFinderData_xk& combinatorialData) const override; /** New region intialization */ virtual std::unique_ptr<InDet::ITRT_SeededTrackFinder::IEventData> newRegion(const EventContext& ctx, SiCombinatorialTrackFinderData_xk& combinatorialData, const std::vector<IdentifierHash>&,const std::vector<IdentifierHash>&) const override; /** End of event tasks */ - virtual void endEvent(InDet::ITRT_SeededTrackFinder::IEventData &event_data) const override; + virtual void + endEvent(InDet::ITRT_SeededTrackFinder::IEventData &event_data) const override; /////////////////////////////////////////////////////////////////// /** Print internal tool parameters and status */ @@ -176,7 +172,7 @@ namespace InDet{ "fieldCondObj", "Name of the Magnetic Field conditions object key"}; /**ID TRT helper*/ - const TRT_ID* m_trtId; + const TRT_ID* m_trtId{}; /** Track quality cuts to be passed to the combinatorial track finder */ double m_xi2max ; /** max Xi2 for updators */ @@ -218,8 +214,6 @@ namespace InDet{ /** Add material effects */ const Trk::TrackParameters* addNoise(double,double,double,double,const Trk::TrackParameters*,int) const; - /** Get better track theta initial estimate using the SPs from the seed */ - static double getNewTheta(std::vector<const Trk::SpacePoint*>&) ; /** Check consistency of seed and TRT track segment */ bool checkSeed(std::vector<const Trk::SpacePoint*>&,const Trk::TrackSegment&,const Trk::TrackParameters*) const; @@ -252,8 +246,8 @@ namespace InDet{ /** aalonso: Only propagete to the Si if the TRT segment is compatible with a calo measurement */ bool isCaloCompatible(const Trk::TrackParameters&, const InDet::TRT_SeededTrackFinder_ATL::EventData &event_data) const; - double m_phiWidth ; - double m_etaWidth ; + double m_phiWidth{} ; + double m_etaWidth{} ; MsgStream& dumpconditions(MsgStream& out) const; diff --git a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/SiNoise_bt.cxx b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/SiNoise_bt.cxx index d0e9e7910748861824f583a1a259d215d785d61f..d9d73defd4248934496642a293da7845aa5150a0 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/SiNoise_bt.cxx +++ b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/SiNoise_bt.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "TRT_SeededTrackFinderTool/SiNoise_bt.h" +#include <cmath> /////////////////////////////////////////////////////////////////// // Noise production @@ -10,6 +11,16 @@ // Model = 1 - muon, 2 - electron /////////////////////////////////////////////////////////////////// +void +InDet::SiNoise_bt::reset(){ + m_model = 0 ; + m_covarianceAzim = 0.; + m_covariancePola = 0.; + m_covarianceIMom = 0.; + m_correctionIMom = 1.; + } + + void InDet::SiNoise_bt::production (int Dir,int Model,const Trk::TrackParameters& Tp) { @@ -21,18 +32,16 @@ void InDet::SiNoise_bt::production m_covarianceIMom = 0; m_correctionIMom = 1.; - //const HepGeom::Transform3D& T = Tp.associatedSurface().transform(); - //const CLHEP::HepVector& Vp = Tp.parameters(); const Amg::Transform3D& T = Tp.associatedSurface().transform(); const AmgVector(5)& Vp = Tp.parameters(); - double q = fabs(Vp[4]); - double cosp = cos(Vp[3]) ; + double q = std::abs(Vp[4]); + double cosp = std::cos(Vp[3]) ; double sinp2 = (1.-cosp)*(1.+cosp) ; if(sinp2==0) sinp2 = 0.000001; double s = - fabs(sqrt(sinp2)*(cos(Vp[2])*T(0,2)+sin(Vp[2]*T(1,2)))+cosp*T(2,2)); + std::abs(std::sqrt(sinp2)*(std::cos(Vp[2])*T(0,2)+std::sin(Vp[2]*T(1,2)))+cosp*T(2,2)); s < .05 ? s = 20. : s = 1./s; m_covariancePola = 134.*s*radlength*q*q; diff --git a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/TRT_SeededTrackFinder_ATL.cxx b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/TRT_SeededTrackFinder_ATL.cxx index b7f27fb92c1b6205cfaa4a2f4cecc220c2142212..af9abc15eef70dfb52bc7750fe63fed37f68084e 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/TRT_SeededTrackFinder_ATL.cxx +++ b/InnerDetector/InDetRecTools/TRT_SeededTrackFinderTool/src/TRT_SeededTrackFinder_ATL.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -11,9 +11,7 @@ // Version 10 04/12/2006 Thomas Koffas /////////////////////////////////////////////////////////////////// -#include <iostream> -#include <iomanip> -#include <utility> + #include "GaudiKernel/MsgStream.h" #include "CLHEP/Vector/ThreeVector.h" @@ -58,7 +56,29 @@ //ReadHandle #include "StoreGate/ReadHandle.h" -using namespace std; +#include <cmath> +#include <iostream> +#include <iomanip> +#include <utility> + +namespace{ + double + getRadius(const Trk::SpacePoint* pPoint){ + return pPoint->globalPosition().perp(); + } + double + getZ(const Trk::SpacePoint* pPoint){ + return pPoint->globalPosition().z(); + } + + double + thetaFromSpacePoints(const Trk::SpacePoint* pPoint0, const Trk::SpacePoint* pPoint1 ){ + const double deltaR = getRadius(pPoint1) - getRadius(pPoint0); + const double deltaZ = getZ(pPoint1) - getZ(pPoint0); + return std::atan2(deltaR,deltaZ); + } + +} /////////////////////////////////////////////////////////////////// // Constructor @@ -85,11 +105,7 @@ InDet::TRT_SeededTrackFinder_ATL::TRT_SeededTrackFinder_ATL m_bremCorrect = false ; //Repeat seed search after brem correction m_propR = false ; //Clean-up seeds by propagating to the first endcap hit m_useassoTool = false ; //Use prd-track association tool during combinatorial track finding - m_errorScale.push_back(1.) ; //Error scaling vector - m_errorScale.push_back(1.) ; - m_errorScale.push_back(1.) ; - m_errorScale.push_back(1.) ; - m_errorScale.push_back(1.) ; + m_errorScale = {1., 1., 1., 1., 1.}; m_outlierCut = 25. ; m_searchInCaloROI = false ; m_phiWidth = .3 ; @@ -496,7 +512,7 @@ std::list<Trk::Track*> InDet::TRT_SeededTrackFinder_ATL::findTrack std::list<Trk::Track*> aTracks ; // List of tracks found per seed std::list<Trk::Track*> cTracks ; // List of cleaned tracks found per seed - event_data.noise().initiate(); //Initiate the noise production tool at the beginning of each seed + event_data.noise().reset(); //Initiate the noise production tool at the beginning of each seed // // --------------- filter SP to improve prediction, scale errors @@ -543,7 +559,7 @@ std::list<Trk::Track*> InDet::TRT_SeededTrackFinder_ATL::findTrack // ----------------Get new better track parameters using the SP seed // if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Get better track parameters using the seed" << endmsg; - double newTheta = getNewTheta(SpVec); + double newTheta = thetaFromSpacePoints(SpVec[0], SpVec[1]); const AmgVector(5)& iv = initTP->parameters(); @@ -785,7 +801,7 @@ InDet::TRT_SeededTrackFinder_ATL::getTP(MagField::AtlasFieldCache& fieldCache, c //Keep as a measurement only if fit chi2 less than 25.Otherwise outlier float outlierCut = m_outlierCut; if(!fieldCache.solenoidOn()) outlierCut = 1000000.; // Increase the outlier chi2 cut if solenoid field is OFF - if( sct_fitChi2->chiSquared() < outlierCut && fabs(uTP->parameters()[Trk::theta]) > 0.17 ){ + if( sct_fitChi2->chiSquared() < outlierCut && std::abs(uTP->parameters()[Trk::theta]) > 0.17 ){ if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<<"Update worked, will update return track parameters, chi2: "<<(sct_fitChi2->chiSquared())<<endmsg; event_data.noise().production(-1,1,*uTP); double covAzim=event_data.noise().covarianceAzim(); @@ -794,7 +810,7 @@ InDet::TRT_SeededTrackFinder_ATL::getTP(MagField::AtlasFieldCache& fieldCache, c double corIMom=event_data.noise().correctionIMom(); iTP = addNoise(covAzim,covPola,covIMom,corIMom,uTP,0); }else{ - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<<"Outlier, did not satisfy cuts, chi2: "<<(sct_fitChi2->chiSquared())<<" "<<fabs(uTP->parameters()[Trk::theta])<<endmsg; + if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<<"Outlier, did not satisfy cuts, chi2: "<<(sct_fitChi2->chiSquared())<<" "<<std::abs(uTP->parameters()[Trk::theta])<<endmsg; event_data.noise().production(-1,1,*eTP); double covAzim=event_data.noise().covarianceAzim(); double covPola=event_data.noise().covariancePola(); @@ -852,32 +868,7 @@ const Trk::TrackParameters* InDet::TRT_SeededTrackFinder_ATL::addNoise return noiseTP; } -/////////////////////////////////////////////////////////////////// -// Get new theta estimate using the SPs from the seed -/////////////////////////////////////////////////////////////////// -double -InDet::TRT_SeededTrackFinder_ATL::getNewTheta(std::vector<const Trk::SpacePoint*>& vsp) -{ - double theta = 0.; - std::vector<double> rad; - std::vector<double> zl; - - std::vector<const Trk::SpacePoint*>::const_iterator isp=vsp.begin(), ispe=vsp.end(); - const std::size_t ispMax=std::distance(isp,ispe); - rad.reserve(ispMax); - zl.reserve(ispMax); - for(; isp!=ispe; ++isp){ - double r = (*isp)->globalPosition().perp(); - rad.push_back(r); - double z = (*isp)->globalPosition().z(); - zl.push_back(z); - } - - theta = atan2((rad[1]-rad[0]),(zl[1]-zl[0])); - - return theta; -} /////////////////////////////////////////////////////////////////// // Get new theta estimate using the SPs from the seed @@ -893,7 +884,7 @@ bool InDet::TRT_SeededTrackFinder_ATL::checkSeed const AmgVector(5)& pTS=tP->parameters(); ///Process only if endcap-transition region - if(fabs(log(tan(pTS[3]/2.)))>0.8){ + if(std::abs(std::log(std::tan(pTS[3]/2.)))>0.8){ ///Find the global z position of first endcap hit on TRT segment for(int it=0; it<int(tS.numberOfMeasurementBases()); it++){ @@ -910,29 +901,14 @@ bool InDet::TRT_SeededTrackFinder_ATL::checkSeed } } } - - ///Get theta from the space points of the seed - double theta = 0.; - std::vector<double> rad; - std::vector<double> zl; - std::vector<const Trk::SpacePoint*>::const_iterator isp=vsp.begin(), ispe=vsp.end(); - const std::size_t ispMax=std::distance(isp,ispe); - rad.reserve(ispMax); - zl.reserve(ispMax); - for(; isp!=ispe; ++isp){ - double r = (*isp)->globalPosition().perp(); - rad.push_back(r); - double z = (*isp)->globalPosition().z(); - zl.push_back(z); - } - theta = atan2((rad[1]-rad[0]),(zl[1]-zl[0])); + double tanTheta = std::tan(thetaFromSpacePoints(vsp[0], vsp[1])); ///Propagate at the z position of 1st endcap hit on TRT segment - double propR = rad[1] + (gz-zl[1])*tan(theta); + double propR = getRadius(vsp[1]) + (gz-getZ(vsp[1]))*tanTheta; if(propR<620. || propR>1010.) isGood=false; - double zIn = gz-propR/tan(theta); + double zIn = gz-propR/tanTheta; if(zIn>300.) isGood = false; } @@ -957,7 +933,7 @@ InDet::TRT_SeededTrackFinder_ATL::modifyTrackParameters(const Trk::TrackParamete double ip[5] = {pV[0], pV[1], pV[2], pV[3], pV[4]}; ///Correct inverse momentum and covariance. Inverse momentum halfed, i.e. momentum doubled - double q = fabs(ip[4]); + double q = std::abs(ip[4]); correctionIMom = .5; covarianceIMom = (correctionIMom-1.)*(correctionIMom-1.)*q*q; ip[4] *= correctionIMom;