From 27e53810a13974a7b7b0e7c621d095bd4cc7fcee Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 9 Dec 2019 13:06:56 +0100 Subject: [PATCH 1/5] remove clang compiler warnings by adding override keyword --- .../TRT_TrackExtensionToolCosmics.h | 8 ++++---- .../TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h index 4f6b1724e87a..06c7fca722f8 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h @@ -62,8 +62,8 @@ namespace InDet { TRT_TrackExtensionToolCosmics (const std::string&,const std::string&,const IInterface*); virtual ~TRT_TrackExtensionToolCosmics(); - virtual StatusCode initialize(); - virtual StatusCode finalize (); + virtual StatusCode initialize() override; + virtual StatusCode finalize () override; /////////////////////////////////////////////////////////////////// // Main methods for track extension to TRT @@ -91,8 +91,8 @@ namespace InDet { // Print internal tool parameters and status /////////////////////////////////////////////////////////////////// - MsgStream& dump(MsgStream& out) const; - std::ostream& dump(std::ostream& out) const; + MsgStream& dump(MsgStream& out) const override; + std::ostream& dump(std::ostream& out) const override; protected: diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h index 2849c62c8758..dae951d0749a 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h @@ -59,8 +59,8 @@ namespace InDet{ TRT_TrackExtensionTool_xk (const std::string&,const std::string&,const IInterface*); virtual ~TRT_TrackExtensionTool_xk(); - virtual StatusCode initialize(); - virtual StatusCode finalize (); + virtual StatusCode initialize() override; + virtual StatusCode finalize () override; /////////////////////////////////////////////////////////////////// // Main methods for track extension to TRT @@ -80,8 +80,8 @@ namespace InDet{ // Print internal tool parameters and status /////////////////////////////////////////////////////////////////// - MsgStream& dump(MsgStream& out) const; - std::ostream& dump(std::ostream& out) const; + MsgStream& dump(MsgStream& out) const override; + std::ostream& dump(std::ostream& out) const override; protected: -- GitLab From 60642d5704eea2a6cb6bcf77a02c217a997fae5e Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 9 Dec 2019 13:33:43 +0100 Subject: [PATCH 2/5] tidy up header includes --- .../TRT_TrackExtensionToolCosmics.h | 6 ++++-- .../TRT_TrackExtensionTool_xk.h | 5 ++++- .../src/TRT_TrackExtensionToolCosmics.cxx | 10 ++++++---- .../src/TRT_TrackExtensionTool_xk.cxx | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h index 06c7fca722f8..801914e9e2ae 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h @@ -15,20 +15,22 @@ #ifndef TRT_TrackExtensionToolCosmics_H #define TRT_TrackExtensionToolCosmics_H -#include <vector> + #include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthAlgTool.h" #include "InDetRecToolInterfaces/ITRT_TrackExtensionTool.h" #include "InDetPrepRawData/TRT_DriftCircleContainer.h" -#include "TrkEventPrimitives/PropDirection.h" #include "TrkEventUtils/EventDataBase.h" #include "StoreGate/ReadHandleKey.h" +#include <iosfwd> +#include <vector> class MsgStream; class TRT_ID; class AtlasDetectorID; +class PropDirection; namespace Trk{ diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h index dae951d0749a..95b6055dcac8 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h @@ -15,7 +15,7 @@ #ifndef TRT_TrackExtensionTool_xk_H #define TRT_TrackExtensionTool_xk_H -#include <vector> + #include "GaudiKernel/ServiceHandle.h" #include "MagFieldInterfaces/IMagFieldSvc.h" @@ -26,8 +26,11 @@ #include "TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.h" #include "InDetPrepRawData/TRT_DriftCircleContainer.h" #include "StoreGate/ReadHandleKey.h" +#include <iosfwd> +#include <vector> class MsgStream; +class TRT_ID; namespace InDet{ diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx index 5ad82d2b5e34..61cf26727cb0 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx @@ -10,18 +10,20 @@ /////////////////////////////////////////////////////////////////// -#include <iostream> -#include <iomanip> -#include <utility> + #include "TrkToolInterfaces/IRIO_OnTrackCreator.h" #include "TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h" -#include "InDetReadoutGeometry/TRT_DetectorManager.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkSurfaces/CylinderSurface.h" #include "TrkSurfaces/DiscSurface.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" +// +#include "TrkEventPrimitives/PropDirection.h" + #include "InDetIdentifier/TRT_ID.h" +#include <iostream> +#include <utility> /////////////////////////////////////////////////////////////////// // Constructor diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx index 4df42c76f61a..ffd821271591 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx @@ -11,13 +11,14 @@ // Version 1.0 21/04/2004 I.Gavrilenko /////////////////////////////////////////////////////////////////// -#include <list> + #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "InDetRecToolInterfaces/ITRT_DetElementsRoadMaker.h" #include "TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h" #include "InDetRecToolInterfaces/ITrtDriftCircleCutTool.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "InDetPrepRawData/SCT_Cluster.h" +#include <list> /////////////////////////////////////////////////////////////////// // Constructor -- GitLab From 88400dbe1ecc95580274b251063e31b774bc0ccc Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 9 Dec 2019 13:37:07 +0100 Subject: [PATCH 3/5] remove commented code --- .../TRT_TrackExtensionToolCosmics.h | 1 - .../TRT_TrackExtensionTool_xk.h | 1 - .../src/TRT_TrackExtensionToolCosmics.cxx | 21 --------------- .../src/TRT_TrackExtensionTool_xk.cxx | 26 +------------------ 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h index 801914e9e2ae..b65e9051d4f7 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionToolCosmics.h @@ -115,7 +115,6 @@ namespace InDet { bool m_searchNeighbour; // Also search neighbouring detector elements? bool m_boundarycheck ; // Do a boundary check in the extrapolation? std::string m_trtmanager ; // Name of TRT det. manager - //std::string m_trtname ; // Name container with TRT clusters SG::ReadHandleKey<TRT_DriftCircleContainer> m_trtname {this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircles"}; diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h index 95b6055dcac8..0e84322a3376 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h @@ -138,7 +138,6 @@ namespace InDet{ double m_scale_error ; // Scalefactor for hit uncertainty std::string m_fieldmode ; // Mode of magnetic field std::string m_trtmanager ; // Name of TRT det. manager - //std::string m_trtname ; // Name container with TRT clusters Trk::MagneticFieldProperties m_fieldprop ; // Magnetic field properties SG::ReadHandleKey<TRT_DriftCircleContainer> m_trtname {this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircleContainer"}; diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx index 61cf26727cb0..333da9b9b2b4 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx @@ -356,8 +356,6 @@ void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars(const std::vector<const if(distance<maxdist){ maxdist=distance; circ=(*driftCircleIterator); - //}else{ - // msg(MSG::DEBUG)<<"Driftcircle "<<m_trtid->show_to_string((*driftCircleIterator)->identify())<<" has a distance of "<<distance<<endmsg; } } } @@ -372,7 +370,6 @@ void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars(const std::vector<const Trk::AtaStraightLine atasl((**parameterIter).position(),(**parameterIter).parameters()[Trk::phi],(**parameterIter).parameters()[Trk::theta],(**parameterIter).parameters()[Trk::qOverP],*slsurf); const Trk::MeasurementBase *newmeas=m_riontrackN->correct(*circ,atasl); event_data.m_measurement.push_back(newmeas); - //std::cout << "param pos: " << (**parameterIter).position() << " meas pos: " << newmeas->globalPosition() << std::endl; } } @@ -428,7 +425,6 @@ InDet::TRT_DriftCircleContainer::const_iterator if ((**w).empty()) continue; const Trk::Surface &surf=(**(**w).begin()).detectorElement()->surface(); Amg::Vector3D pos=intersect(&surf,per); - //std::cout << "pos: " << pos << " surf: " << surf << std::endl; Amg::Vector3D locintersec = (surf.transform().inverse())*pos; Amg::Vector2D locpos(locintersec.x(), locintersec.y()); if (pos.perp()<500. || !surf.insideBounds(locpos,50.,50.)) continue; @@ -440,7 +436,6 @@ InDet::TRT_DriftCircleContainer::const_iterator Trk::TrackParameters *newpar=0; if (plsurf) newpar=new Trk::AtaPlane(pos2,per->parameters()[Trk::phi],per->parameters()[Trk::theta],per->parameters()[Trk::qOverP],*plsurf); else newpar=new Trk::AtaDisc(pos2,per->parameters()[Trk::phi],per->parameters()[Trk::theta],per->parameters()[Trk::qOverP],*discsurf); - //std::cout << "pos: " << pos << " pos2: " << pos2 << " param pos: " << newpar->position() << std::endl; vecTP.push_back(newpar); } tpars_down=new std::vector<const Trk::TrackParameters* >; @@ -458,20 +453,11 @@ InDet::TRT_DriftCircleContainer::const_iterator } if (!tpars_up->empty()) std::reverse(tpars_up->begin(),tpars_up->end()); -/* Trk::Surface *boundary_surface=findBoundarySurface(par,Trk::alongMomentum, event_data); - if(boundary_surface) - tpars_down=m_extrapolator->extrapolateStepwise(*m_propagator, par, *boundary_surface, Trk::alongMomentum, m_boundarycheck, Trk::muon); - boundary_surface=findBoundarySurface(par,Trk::oppositeMomentum, event_data); - if(boundary_surface) - tpars_up =m_extrapolator->extrapolateStepwise(*m_propagator, par, *boundary_surface, Trk::oppositeMomentum, m_boundarycheck, Trk::muon); -*/ if(tpars_down){ - //std::cout << "analyze_tpars(tpars_down)" << std::endl; analyze_tpars(tpars_down,event_data); } if(tpars_up){ - //std::cout << "analyze_tpars(tpars_up)" << std::endl; analyze_tpars(tpars_up, event_data); } @@ -543,7 +529,6 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface double r= (std::abs(per->parameters()[Trk::qOverP]) > 1e-10) ? -sinTheta/(per->parameters()[Trk::qOverP]*0.6) : 1e6; double xc=per->position().x()-r*sin(per->parameters()[2]); double yc=per->position().y()+r*cos(per->parameters()[2]); - //double signdeltaphi= (r<0) ? -1.: 1.; double phi0=atan2(per->position().y()-yc,per->position().x()-xc); double theta=per->parameters()[Trk::theta]; double z0=per->position().z(); @@ -553,7 +538,6 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface double delta_phi=delta_s*sin(theta)/r; double x=xc+fabs(r)*cos(phi0+delta_phi); double y=yc+fabs(r)*sin(phi0+delta_phi); - //std::cout << "deltaphi: " << delta_phi << " delta_s: " << delta_s << " r: " << r << "intersect: " << x << " " << y << " " << surf->center().z() << std::endl; return Amg::Vector3D(x,y,surf->center().z()); @@ -568,7 +552,6 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface double b=2*( (x2 - x1)*(x1 - xc) + (y2 - y1)*(y1 - yc)); double c=xc*xc + yc*yc + x1*x1 + y1*y1 - 2*(xc*x1 + yc*y1) - r*r; double discr=b*b-4*a*c; - //std::cout << "discr: " << discr << std::endl; if (discr<0) return Amg::Vector3D(0,0,0); double u1=(-b-sqrt(discr))/(2*a); double u2=(-b+sqrt(discr))/(2*a); @@ -576,7 +559,6 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface double x=x1+u*(x2-x1); double y=y1+u*(y2-y1); double phi=atan2(y-yc,x-xc); - // std::cout << "phi1: " << phi1 << " phi: " << phi << std::endl; double delta_phi=phi-phi0; if (fabs(fabs(delta_phi)-2*M_PI)<fabs(delta_phi)){ if (delta_phi<0) delta_phi+=2*M_PI; @@ -584,11 +566,8 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface } double delta_z=r*delta_phi/tan(theta); - //if (theta>M_PI/2) delta_z=-delta_z; - //if (fabs(surf.center().x()-107)<60 && fabs(surf.center().y()+290)<60 && fabs(surf.center().z()-700)<60) std::cout << "signdeltaphi: " << signdeltaphi << " delta_phi: " << delta_phi << " phi0: " << phi0 << " phi: " << phi << " z0: " << z0 << " deltaz: " << delta_z << std::endl; double z=z0+delta_z; - //std::cout << "phi0: " << phi0 << " phi: " << phi << " delta phi: " << delta_phi << " z0: " << z0 << " delta z: " << delta_z << " theta: " << theta << " intersect barrel: " << x << " " << y << " " << z << std::endl; return Amg::Vector3D(x,y,z); } } diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx index ffd821271591..03d9e48ad9b6 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx @@ -166,14 +166,7 @@ StatusCode InDet::TRT_TrackExtensionTool_xk::initialize() msg(MSG::INFO) << "Retrieved tool " << m_selectortool << endmsg; } - // Get TRT Detector Manager - /* - const InDetDD::TRT_DetectorManager* trtmanager; - sc = detStore()->retrieve(trtmanager,m_trtmanager); - if (sc.isFailure()) { - msg(MSG::FATAL)<<"Could not get TRT_DetectorManager"<<endmsg; return sc; - } - */ + // TRT if (detStore()->retrieve(m_trtid,"TRT_ID").isFailure()) { @@ -181,23 +174,6 @@ StatusCode InDet::TRT_TrackExtensionTool_xk::initialize() return StatusCode::FAILURE; } - // Setup callback for magnetic field - // - // std::string folder( "/EXT/DCS/MAGNETS/SENSORDATA" ); - // if (detStore()->contains<CondAttrListCollection>(folder)){ - // const DataHandle<CondAttrListCollection> currentHandle; - // sc = detStore()->regFcn(&InDet::TRT_TrackExtensionTool_xk::magneticFieldInit,this,currentHandle,folder); - - // if(sc==StatusCode::SUCCESS) { - // msg(MSG::INFO) << "Registered callback from MagneticFieldSvc for " << name() << endmsg; - // } else { - // msg(MSG::ERROR) << "Could not book callback from MagneticFieldSvc for " << name () << endmsg; - // return StatusCode::FAILURE; - // } - // } else { - // magneticFieldInit(); - // ATH_MSG_INFO("Folder " << folder << " not present, magnetic field callback not set up. Not a problem if AtlasFieldSvc.useDCS=False"); - // } //Initialize container ATH_CHECK(m_trtname.initialize()); -- GitLab From cfd8d2fe821d2805b6b690a4006d56ae8233c948 Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 9 Dec 2019 13:40:50 +0100 Subject: [PATCH 4/5] ensure cmath functions used in TRT_TrackExtensionToolCosmics --- .../src/TRT_TrackExtensionToolCosmics.cxx | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx index 333da9b9b2b4..802d2c4bb348 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx @@ -24,6 +24,7 @@ #include "InDetIdentifier/TRT_ID.h" #include <iostream> #include <utility> +#include <cmath> /////////////////////////////////////////////////////////////////// // Constructor @@ -338,10 +339,10 @@ void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars(const std::vector<const double distance=m_roadwidth+1; if(lpos){ - distance = fabs(lpos->x()); + distance = std::abs(lpos->x()); msg(MSG::DEBUG)<<"Hit "<<m_trtid->show_to_string((*driftCircleIterator)->identify())<<" has a distance of "<<distance<<endmsg; - double dist_locz=fabs(lpos->y()); + double dist_locz=std::abs(lpos->y()); if(distance<m_roadwidth+1){ if(!dc_surface.insideBounds(*lpos,m_roadwidth,m_roadwidth_locz)){ msg(MSG::DEBUG)<<"Hit not inside surface bounds! "<<distance<<" , "<<dist_locz<<endmsg; @@ -364,7 +365,7 @@ void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars(const std::vector<const if(circ){ msg(MSG::DEBUG)<<"Found Driftcircle! Adding it to list ..."<<m_trtid->show_to_string(circ->identify())<<endmsg; if (lastz<-9999) lastz=(**parameterIter).position().z(); - if (fabs(lastz-(**parameterIter).position().z())>500.) return; + if (std::abs(lastz-(**parameterIter).position().z())>500.) return; lastz=(**parameterIter).position().z(); const Trk::StraightLineSurface *slsurf=dynamic_cast<const Trk::StraightLineSurface *>(&circ->detectorElement()->surface(circ->identify())); if(!slsurf) continue; Trk::AtaStraightLine atasl((**parameterIter).position(),(**parameterIter).parameters()[Trk::phi],(**parameterIter).parameters()[Trk::theta],(**parameterIter).parameters()[Trk::qOverP],*slsurf); @@ -381,7 +382,7 @@ class tp_sort_cosmics{ public: tp_sort_cosmics(double theta){m_theta=theta;} bool operator()(const Trk::TrackParameters *par1,const Trk::TrackParameters *par2){ - if (m_theta>M_PI/2) return (par1->position().z()>par2->position().z()); + if (m_theta>M_PI_2) return (par1->position().z()>par2->position().z()); else return (par1->position().z()<par2->position().z()); } private: @@ -525,19 +526,19 @@ InDet::TRT_TrackExtensionToolCosmics::findBoundarySurface(const Trk::TrackParame Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface *surf,const Trk::Perigee *per) { // Calculate intersection of helix with silicon module. Assume barrel modules parallel to z-axis, endcap modules perpendicular to z-axis - double sinTheta = sin(per->parameters()[3]); + double sinTheta = std::sin(per->parameters()[3]); double r= (std::abs(per->parameters()[Trk::qOverP]) > 1e-10) ? -sinTheta/(per->parameters()[Trk::qOverP]*0.6) : 1e6; - double xc=per->position().x()-r*sin(per->parameters()[2]); - double yc=per->position().y()+r*cos(per->parameters()[2]); - double phi0=atan2(per->position().y()-yc,per->position().x()-xc); + double xc=per->position().x()-r*std::sin(per->parameters()[2]); + double yc=per->position().y()+r*std::cos(per->parameters()[2]); + double phi0=std::atan2(per->position().y()-yc,per->position().x()-xc); double theta=per->parameters()[Trk::theta]; double z0=per->position().z(); - if (fabs(surf->normal().z())>0.5){ // endcap module + if (std::abs(surf->normal().z())>0.5){ // endcap module double delta_s=(surf->center().z()-z0)/cos(theta); - double delta_phi=delta_s*sin(theta)/r; - double x=xc+fabs(r)*cos(phi0+delta_phi); - double y=yc+fabs(r)*sin(phi0+delta_phi); + double delta_phi=delta_s*std::sin(theta)/r; + double x=xc+std::abs(r)*std::cos(phi0+delta_phi); + double y=yc+std::abs(r)*std::sin(phi0+delta_phi); return Amg::Vector3D(x,y,surf->center().z()); @@ -553,19 +554,19 @@ Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect(const Trk::Surface double c=xc*xc + yc*yc + x1*x1 + y1*y1 - 2*(xc*x1 + yc*y1) - r*r; double discr=b*b-4*a*c; if (discr<0) return Amg::Vector3D(0,0,0); - double u1=(-b-sqrt(discr))/(2*a); - double u2=(-b+sqrt(discr))/(2*a); - double u=(fabs(u1)<fabs(u2)) ? u1 : u2; + double u1=(-b-std::sqrt(discr))/(2*a); + double u2=(-b+std::sqrt(discr))/(2*a); + double u=(std::abs(u1)<std::abs(u2)) ? u1 : u2; double x=x1+u*(x2-x1); double y=y1+u*(y2-y1); - double phi=atan2(y-yc,x-xc); + double phi=std::atan2(y-yc,x-xc); double delta_phi=phi-phi0; - if (fabs(fabs(delta_phi)-2*M_PI)<fabs(delta_phi)){ + if (std::abs(std::abs(delta_phi)-2*M_PI)<std::abs(delta_phi)){ if (delta_phi<0) delta_phi+=2*M_PI; else delta_phi-=2*M_PI; } - double delta_z=r*delta_phi/tan(theta); + double delta_z=r*delta_phi/std::tan(theta); double z=z0+delta_z; return Amg::Vector3D(x,y,z); -- GitLab From 70cd3a51f59f3d22706844e68ef0df082a9ea55a Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 9 Dec 2019 13:45:30 +0100 Subject: [PATCH 5/5] add missing header --- .../TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx index 03d9e48ad9b6..3e22684ef0de 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx @@ -19,6 +19,7 @@ #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "InDetPrepRawData/SCT_Cluster.h" #include <list> +#include <iostream> /////////////////////////////////////////////////////////////////// // Constructor -- GitLab