diff --git a/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..af414f9c3843c75fd163e18de6302499f1fd9120 --- /dev/null +++ b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkEvent/TrkCaloCluster_OnTrack diff --git a/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h index d8c0a590bef265e37cf8c09651da7f896540b092..471a035feb16499c36a37e069b28a04b61f67643 100644 --- a/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h +++ b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h @@ -10,8 +10,7 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" - -#include <ostream> +#include <iosfwd> class MsgStream; namespace Trk { @@ -58,7 +57,6 @@ namespace Trk { - interface from MeasurementBase */ virtual const Amg::Vector3D& globalPosition() const; - /** Extended method to get the EnergyLoss */ virtual const Trk::EnergyLoss* energyLoss() const; @@ -71,13 +69,13 @@ namespace Trk { protected: /** Surface associated to the measurement*/ - mutable const Surface* m_surface; + const Surface* m_surface; /** global position of the cluster hit*/ - mutable const Amg::Vector3D* m_globalpos; + const Amg::Vector3D* m_globalpos; /** Energy Loss */ - mutable const Trk::EnergyLoss* m_eloss; + const Trk::EnergyLoss* m_eloss; };//End of Class diff --git a/Tracking/TrkEvent/TrkCaloCluster_OnTrack/src/CaloCluster_OnTrack.cxx b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/src/CaloCluster_OnTrack.cxx index d8ce6f501f78085c32aa1f68861a2e52bfa7fa9c..a184e15380fafd615c7905c9e62570dcd6fa648e 100644 --- a/Tracking/TrkEvent/TrkCaloCluster_OnTrack/src/CaloCluster_OnTrack.cxx +++ b/Tracking/TrkEvent/TrkCaloCluster_OnTrack/src/CaloCluster_OnTrack.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//CaloCluster_OnTrack.cxx + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + */ //Trk @@ -14,6 +12,7 @@ #include "GaudiKernel/MsgStream.h" #include <string> #include <limits> +#include <ostream> static const double NaN(std::numeric_limits<double>::quiet_NaN()); static const Amg::Vector3D INVALID_VECTOR3D(NaN, NaN, NaN); @@ -23,37 +22,37 @@ Trk::CaloCluster_OnTrack::CaloCluster_OnTrack( const Trk::LocalParameters& locp const Amg::MatrixX& locerr, const Trk::Surface& surface, const Trk::EnergyLoss* eloss) - : MeasurementBase(locpars,locerr), - m_globalpos(0), - m_eloss(eloss) +: MeasurementBase(locpars,locerr) { + m_eloss = eloss; m_surface = surface.isFree() ? surface.clone() : &surface; - this->globalPosition(); + m_globalpos = surface.localToGlobal(m_localParams); } // Destructor: Trk::CaloCluster_OnTrack::~CaloCluster_OnTrack() { - if (m_globalpos) delete m_globalpos; - if (m_surface && m_surface->isFree()) delete m_surface; // Don't delete surfaces belonging to DEs! - if (m_eloss) delete m_eloss; + if (m_globalpos) {delete m_globalpos;} + // Don't delete surfaces belonging to DEs! + if (m_surface && m_surface->isFree()) {delete m_surface;} + if (m_eloss) {delete m_eloss;} } // default constructor: Trk::CaloCluster_OnTrack::CaloCluster_OnTrack() : - m_surface(0), - m_globalpos(0), - m_eloss(0) + m_surface{nullptr}, + m_globalpos{nullptr}, + m_eloss{nullptr} { } // copy constructor: Trk::CaloCluster_OnTrack::CaloCluster_OnTrack( const Trk::CaloCluster_OnTrack& cot) : - Trk::MeasurementBase(cot), - m_globalpos( 0 ){ - m_surface= cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : 0; - this->globalPosition(); - m_eloss= cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) : 0 ; + Trk::MeasurementBase(cot) +{ + m_surface= cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : nullptr; + m_globalpos = cot.m_globalpos ? new Amg::Vector3D(*cot.m_globalpos) : nullptr; + m_eloss= cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) : nullptr ; } Trk::CaloCluster_OnTrack* Trk::CaloCluster_OnTrack::clone() const @@ -61,39 +60,34 @@ Trk::CaloCluster_OnTrack* Trk::CaloCluster_OnTrack::clone() const return new Trk::CaloCluster_OnTrack ( *this ); } - // assignment operator: Trk::CaloCluster_OnTrack& Trk::CaloCluster_OnTrack::operator=(const Trk::CaloCluster_OnTrack& cot) { if ( &cot != this) { - delete m_surface; - delete m_globalpos; - if(m_eloss) delete m_eloss; + if (m_surface && m_surface->isFree()) {delete m_surface;} + if (m_globalpos) delete m_globalpos; + if (m_eloss) delete m_eloss; Trk::MeasurementBase::operator=(cot); - m_surface = (cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : 0); - m_globalpos = new Amg::Vector3D(*cot.m_globalpos); - m_eloss = cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) :0; + m_surface = cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : nullptr; + m_globalpos = cot.m_globalpos ? new Amg::Vector3D(*cot.m_globalpos) : nullptr; + m_eloss= cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) : nullptr ; } return *this; } const Amg::Vector3D& Trk::CaloCluster_OnTrack::globalPosition() const { - if((!m_globalpos) and m_surface){ - m_globalpos = m_surface->localToGlobal(m_localParams); - } - if (not m_globalpos) return INVALID_VECTOR3D; + if (!m_globalpos) {return INVALID_VECTOR3D;} return *m_globalpos; } - MsgStream& Trk::CaloCluster_OnTrack::dump( MsgStream& sl ) const { sl << "Trk::CaloCluster_OnTrack { "<<"\n"; sl << "\t surface = "<< associatedSurface()<<"\n"; sl << "\t position = (" - << localParameters() - << endmsg; + << localParameters() + << endmsg; sl << "\t has Error Matrix: "<<"\n"; sl<<localCovariance()<<"}"<<"\n"; @@ -104,8 +98,8 @@ std::ostream& Trk::CaloCluster_OnTrack::dump( std::ostream& sl ) const { sl << "\t surface = "<< associatedSurface()<<"\n"; sl << "\t position = (" - << localParameters() - << "\n"; + << localParameters() + << "\n"; sl << "\t has Error Matrix: "<<"\n"; sl<<localCovariance()<<"}"<<"\n"; return sl;