From fbb47bfef1fd20de9cc417a6f58ee1bb4c88f156 Mon Sep 17 00:00:00 2001 From: Christos Anastopoulos <christos.anastopoulos@cern.ch> Date: Tue, 28 Jan 2020 13:18:30 +0000 Subject: [PATCH] TrkGeometry : Add ATLAS_CHECK_THREAD_SAFETY, remove mutable, mark all not thread safe methods explicitly ,provide non-const overload where applicable --- .../src/MuonTrackingGeometryBuilder.cxx | 2 +- .../TrkGeometry/ATLAS_CHECK_THREAD_SAFETY | 1 + .../TrkGeometry/TrkGeometry/ConeLayer.h | 6 +- .../TrkGeometry/TrkGeometry/CylinderLayer.h | 8 +- .../TrkGeometry/DetachedTrackingVolume.h | 33 +++-- .../TrkGeometry/TrkGeometry/DiscLayer.h | 8 +- .../TrkGeometry/GlueVolumesDescriptor.h | 4 +- .../TrkGeometry/TrkGeometry/Layer.h | 26 ++-- .../TrkGeometry/TrkGeometry/Layer.icc | 20 +-- .../TrkGeometry/TrkGeometry/MaterialLayer.h | 6 +- .../TrkGeometry/TrkGeometry/NavigationLayer.h | 8 +- .../TrkGeometry/TrkGeometry/PlaneLayer.h | 8 +- .../TrkGeometry/SubtractedCylinderLayer.h | 6 +- .../TrkGeometry/SubtractedPlaneLayer.h | 6 +- .../TrkGeometry/TrackingGeometry.h | 42 +++--- .../TrkGeometry/TrkGeometry/TrackingVolume.h | 139 +++++++++--------- .../TrkGeometry/TrackingVolumeManipulator.h | 54 +++---- .../src/AlignableTrackingVolume.cxx | 12 +- .../src/DetachedTrackingVolume.cxx | 16 +- .../TrkGeometry/src/TrackingGeometry.cxx | 28 ++-- .../TrkGeometry/src/TrackingVolume.cxx | 97 ++++++------ .../src/TrackingVolumeManipulator.cxx | 56 +++---- 22 files changed, 291 insertions(+), 295 deletions(-) create mode 100644 Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ATLAS_CHECK_THREAD_SAFETY diff --git a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx index cf2c0448215e..0ddf8c15ac4f 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/src/MuonTrackingGeometryBuilder.cxx @@ -2591,7 +2591,7 @@ void Muon::MuonTrackingGeometryBuilder::blendMaterial(LocalVariablesContainer& a //std::map<const Trk::DetachedTrackingVolume*,std::vector<const Trk::TrackingVolume*>* >::iterator mIter = m_blendMap.begin(); std::vector<const Trk::DetachedTrackingVolume*>::iterator viter = aLVC.m_blendVols.begin(); - std::vector<std::pair<const Trk::Volume*,float> >* cs = 0; + const std::vector<std::pair<const Trk::Volume*,float> >* cs = 0; // for ( ; mIter!= m_blendMap.end(); mIter++) { // cs = (*mIter).first->constituents(); diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..39ca26f14b01 --- /dev/null +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkDetDescr/TrkGeometry diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ConeLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ConeLayer.h index bd28f0eef66b..cd2a4406054a 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ConeLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/ConeLayer.h @@ -100,7 +100,7 @@ namespace Trk { virtual void moveLayer(Amg::Transform3D& shift) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE (Amg::Transform3D& shift) const override{ + virtual void moveLayer ATLAS_NOT_THREAD_SAFE (Amg::Transform3D& shift) const override{ const_cast<ConeLayer*>(this)->moveLayer(shift); }; @@ -113,8 +113,8 @@ namespace Trk { /** Resize the layer to the tracking volume - not supported since this an entry layer method*/ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, - const Amg::Vector3D&, double) const override {} + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, + const Amg::Vector3D&, double) const override {} }; diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/CylinderLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/CylinderLayer.h index 7941de3f2486..4739fc0518a3 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/CylinderLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/CylinderLayer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -140,7 +140,7 @@ class IApproachDescriptor; virtual void moveLayer ( Amg::Transform3D& shift ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ const_cast<CylinderLayer*>(this)->moveLayer(shift); } @@ -149,7 +149,7 @@ class IApproachDescriptor; virtual void resizeLayer(const VolumeBounds& vBounds, double envelope) override; /** Resize the layer to the tracking volume - only works for CylinderVolumeBouns */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds& vBounds, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds& vBounds, double envelope) const override { const_cast<CylinderLayer*>(this)->resizeLayer(vBounds,envelope); @@ -162,7 +162,7 @@ class IApproachDescriptor; /** Resize the layer to the tracking volume */ virtual void resizeAndRepositionLayer - ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds& vBounds, + ATLAS_NOT_THREAD_SAFE(const VolumeBounds& vBounds, const Amg::Vector3D& cCenter, double envelope) const override { diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DetachedTrackingVolume.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DetachedTrackingVolume.h index 26dd905b96ef..0b905add9220 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DetachedTrackingVolume.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DetachedTrackingVolume.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -67,10 +67,10 @@ namespace Trk { const std::string name() const; /** moving object around */ - void move( Amg::Transform3D& shift) const; + void move ATLAS_NOT_THREAD_SAFE( Amg::Transform3D& shift) const; /** clone with transform*/ - const DetachedTrackingVolume* clone( std::string name, Amg::Transform3D& shift) const; + const DetachedTrackingVolume* clone ATLAS_NOT_THREAD_SAFE( std::string name, Amg::Transform3D& shift) const; /** returns layer representation */ const Layer* layerRepresentation() const; @@ -79,7 +79,7 @@ namespace Trk { const std::vector<const Layer*>* multilayerRepresentation() const; /** sign the volume - the geometry builder has to do that */ - void sign(GeometrySignature signat, GeometryType geotype) const; + void sign ATLAS_NOT_THREAD_SAFE(GeometrySignature signat, GeometryType geotype) const; /** return the Signature */ GeometrySignature geometrySignature() const; @@ -88,28 +88,28 @@ namespace Trk { GeometryType geometryType() const; /** set the simplified calculable components */ - void saveConstituents(std::vector<std::pair<const Trk::Volume*,float> >* ); - void saveConstituents ATLAS_NOT_CONST_THREAD_SAFE (std::vector<std::pair<const Trk::Volume*,float> >* ) const; + void saveConstituents(const std::vector<std::pair<const Trk::Volume*,float> >* ); + void saveConstituents ATLAS_NOT_THREAD_SAFE (const std::vector<std::pair<const Trk::Volume*,float> >* ) const; /** get the simplified calculable components */ - std::vector<std::pair<const Trk::Volume*,float> >* constituents() const; + const std::vector<std::pair<const Trk::Volume*,float> >* constituents() const; /** alignment methods: set base transform / default argument to current transform */ void setBaseTransform( Amg::Transform3D* transf=0 ); - void setBaseTransform ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D* transf=0 ) const; + void setBaseTransform ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D* transf=0 ) const; /** alignment methods: realign / default argument to base transform */ - void realign( Amg::Transform3D* transf=0 ) const; + void realign ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D* transf=0 ) const; private: /** Compactify -- set TG as owner to surfaces */ - void compactify(size_t& cSurfaces, size_t& tSurfaces) const; + void compactify ATLAS_NOT_THREAD_SAFE (size_t& cSurfaces, size_t& tSurfaces) const; const TrackingVolume* m_trkVolume; const std::string m_name; const Layer* m_layerRepresentation; const std::vector<const Layer*>* m_multilayerRepresentation; Amg::Transform3D* m_baseTransform; // optional use (for alignment purpose) - std::vector<std::pair<const Trk::Volume*,float> >* m_constituents; + const std::vector<std::pair<const Trk::Volume*,float> >* m_constituents; }; @@ -122,19 +122,20 @@ inline const Layer* DetachedTrackingVolume::layerRepresentation() const { return inline const std::vector<const Layer*>* DetachedTrackingVolume::multilayerRepresentation() const { return (m_multilayerRepresentation); } -inline void DetachedTrackingVolume::saveConstituents(std::vector<std::pair<const Trk::Volume *, float>> *constituents) { +inline void DetachedTrackingVolume::saveConstituents(const std::vector<std::pair<const Trk::Volume *, float>> *constituents) { m_constituents = constituents; } -inline void DetachedTrackingVolume::saveConstituents -ATLAS_NOT_CONST_THREAD_SAFE(std::vector<std::pair<const Trk::Volume *, float>> *constituents) const { +inline void DetachedTrackingVolume::saveConstituents ATLAS_NOT_THREAD_SAFE( + const std::vector<std::pair<const Trk::Volume *, float>> *constituents) const { + const_cast<DetachedTrackingVolume *>(this)->saveConstituents(constituents); } -inline std::vector<std::pair<const Trk::Volume *, float>> *DetachedTrackingVolume::constituents() const { +inline const std::vector<std::pair<const Trk::Volume *, float>> *DetachedTrackingVolume::constituents() const { return m_constituents; } -inline void DetachedTrackingVolume::setBaseTransform ATLAS_NOT_CONST_THREAD_SAFE(Amg::Transform3D *transf) const { +inline void DetachedTrackingVolume::setBaseTransform ATLAS_NOT_THREAD_SAFE(Amg::Transform3D *transf) const { const_cast<DetachedTrackingVolume *>(this)->setBaseTransform(transf); } diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DiscLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DiscLayer.h index f6e1839004c2..0edfe205f50d 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DiscLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/DiscLayer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -116,7 +116,7 @@ namespace Trk { virtual void moveLayer( Amg::Transform3D& shift ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ const_cast<DiscLayer*> (this)->moveLayer(shift); } @@ -124,7 +124,7 @@ namespace Trk { /** Resize the layer to the tracking volume - only works for CylinderVolumeBouns */ virtual void resizeLayer(const VolumeBounds& vBounds, double envelope) override; /** Resize the layer to the tracking volume - only works for CylinderVolumeBouns */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds& vBounds, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds& vBounds, double envelope) const override { const_cast<DiscLayer*> (this)->resizeLayer(vBounds,envelope); @@ -136,7 +136,7 @@ namespace Trk { double envelop) override; /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE (const VolumeBounds& vBounds, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE (const VolumeBounds& vBounds, const Amg::Vector3D& cCenter, double envelop) const override{ const_cast<DiscLayer*> (this)->resizeAndRepositionLayer(vBounds,cCenter,envelop); diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/GlueVolumesDescriptor.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/GlueVolumesDescriptor.h index 460cfb959b68..f33a05f8a674 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/GlueVolumesDescriptor.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/GlueVolumesDescriptor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ namespace Trk { /** register the volumes */ void registerGlueVolumes(BoundarySurfaceFace, std::vector<const TrackingVolume*>&); - void registerGlueVolumes ATLAS_NOT_CONST_THREAD_SAFE (BoundarySurfaceFace, std::vector<const TrackingVolume*>&) const; + void registerGlueVolumes ATLAS_NOT_THREAD_SAFE (BoundarySurfaceFace, std::vector<const TrackingVolume*>&) const; /** retrieve them again */ const std::vector<const TrackingVolume*>& glueVolumes(BoundarySurfaceFace) const; diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.h index 999b60b857a9..d7e904c37655 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.h @@ -154,7 +154,7 @@ namespace Trk { /** set the previous Layer*/ void setPreviousLayer(const Layer*); /** set the previous Layer const not const thread safe*/ - void setPreviousLayer ATLAS_NOT_CONST_THREAD_SAFE(const Layer*) const ; + void setPreviousLayer ATLAS_NOT_THREAD_SAFE(const Layer*) const ; /** getting the next/previous Layer if registered - unit for direction vector required */ const Layer* nextLayer(const Amg::Vector3D& gp, const Amg::Vector3D& udir) const; @@ -163,14 +163,14 @@ namespace Trk { /** set the next Layer*/ void setNextLayer(const Layer*); /** set the next Layer const not const thread safe*/ - void setNextLayer ATLAS_NOT_CONST_THREAD_SAFE(const Layer*) const ; + void setNextLayer ATLAS_NOT_THREAD_SAFE(const Layer*) const ; /** access the BinUtility*/ const BinUtility* binUtility() const ; /** set the BinUtility*/ void setBinUtility(const BinUtility*); /** set the BinUtility const not const thread safe*/ - void setBinUtility ATLAS_NOT_CONST_THREAD_SAFE(const BinUtility*) const ; + void setBinUtility ATLAS_NOT_THREAD_SAFE(const BinUtility*) const ; /** Surface seen on approach - if not defined differently, it is the surfaceRepresentation() */ virtual const Surface& surfaceOnApproach(const Amg::Vector3D& pos, @@ -222,7 +222,7 @@ namespace Trk { void setLayerType(int identifier); /** set the Layer coding */ - void setLayerType ATLAS_NOT_CONST_THREAD_SAFE (int identifier) const; + void setLayerType ATLAS_NOT_THREAD_SAFE (int identifier) const; /** boolean method to check if the layer needs a LayerMaterialProperties */ @@ -231,20 +231,20 @@ namespace Trk { /** assignMaterialPropeties */ void assignMaterialProperties(const LayerMaterialProperties&, double scale = 1.0); - void assignMaterialProperties ATLAS_NOT_CONST_THREAD_SAFE(const LayerMaterialProperties&, + void assignMaterialProperties ATLAS_NOT_THREAD_SAFE(const LayerMaterialProperties&, double scale = 1.0) const; /** move the Layer */ virtual void moveLayer( Amg::Transform3D& ) {}; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& ) const {}; + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& ) const {}; /**register Volume associated to the layer */ void registerRepresentingVolume(const Volume *theVol); /**register Volume associated to the layer */ - void registerRepresentingVolume ATLAS_NOT_CONST_THREAD_SAFE (const Volume *theVol) const; + void registerRepresentingVolume ATLAS_NOT_THREAD_SAFE (const Volume *theVol) const; /** get the Volume associated to the layer */ const Volume* representingVolume() const; @@ -253,17 +253,17 @@ namespace Trk { void setRef(double ); /** set the reference measure */ - void setRef ATLAS_NOT_CONST_THREAD_SAFE (double ) const; + void setRef ATLAS_NOT_THREAD_SAFE (double ) const; /** get the reference measure */ double getRef() const; void encloseTrackingVolume (const TrackingVolume& tvol) ; - void encloseTrackingVolume ATLAS_NOT_CONST_THREAD_SAFE (const TrackingVolume& tvol) const; + void encloseTrackingVolume ATLAS_NOT_THREAD_SAFE (const TrackingVolume& tvol) const; //!< private method to set the enclosed detached TV void encloseDetachedTrackingVolume(const DetachedTrackingVolume& tvol) ; - void encloseDetachedTrackingVolume ATLAS_NOT_CONST_THREAD_SAFE (const DetachedTrackingVolume& tvol) const; + void encloseDetachedTrackingVolume ATLAS_NOT_THREAD_SAFE (const DetachedTrackingVolume& tvol) const; /** get compatible surfaces starting from charged parameters */ template <class T> size_t getCompatibleSurfaces(std::vector<SurfaceIntersection>& cSurfaces, @@ -279,7 +279,7 @@ namespace Trk { //!< register layer index for material map registration void registerLayerIndex(const LayerIndex& lIdx); - void registerLayerIndex ATLAS_NOT_CONST_THREAD_SAFE(const LayerIndex& lIdx) const; + void registerLayerIndex ATLAS_NOT_THREAD_SAFE(const LayerIndex& lIdx) const; /** private method to set enclosing TrackingVolume, called by friend class only optionally, the layer can be resized to the dimensions of the TrackingVolume @@ -292,7 +292,7 @@ namespace Trk { virtual void resizeLayer (const VolumeBounds&, double) {} /** resize layer to the TrackingVolume dimensions const not thread safe */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE (const VolumeBounds&, double) const {} + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE (const VolumeBounds&, double) const {} /** resize and reposition layer : dedicated for entry layers */ virtual void resizeAndRepositionLayer (const VolumeBounds& vBounds, @@ -300,7 +300,7 @@ namespace Trk { double envelope=1.) = 0; /** resize and reposition layer : dedicated for entry layers */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE (const VolumeBounds& vBounds, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE (const VolumeBounds& vBounds, const Amg::Vector3D& vCenter, double envelope=1.) const = 0; diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.icc b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.icc index 5f0758166d93..d0064859fe88 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.icc +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/Layer.icc @@ -151,7 +151,7 @@ inline const OverlapDescriptor *Layer::overlapDescriptor() const { inline void Layer::setPreviousLayer(const Layer *in) { m_previousLayer = in; } /** set the previous Layer const not const thread safe*/ inline void Layer::setPreviousLayer -ATLAS_NOT_CONST_THREAD_SAFE(const Layer * in) const { +ATLAS_NOT_THREAD_SAFE(const Layer * in) const { const_cast<Layer *>(this)->setPreviousLayer(in); } @@ -159,7 +159,7 @@ ATLAS_NOT_CONST_THREAD_SAFE(const Layer * in) const { inline void Layer::setNextLayer(const Layer *in) { m_nextLayer = in; } /** set the next Layer const not const thread safe*/ inline void Layer::setNextLayer -ATLAS_NOT_CONST_THREAD_SAFE(const Layer *in) const { +ATLAS_NOT_THREAD_SAFE(const Layer *in) const { const_cast<Layer *>(this)->setNextLayer(in); } @@ -169,7 +169,7 @@ inline const BinUtility *Layer::binUtility() const { return m_binUtility; } inline void Layer::setBinUtility(const BinUtility *in) { m_binUtility = in; } /** set the BinUtility const not const thread safe*/ inline void Layer::setBinUtility -ATLAS_NOT_CONST_THREAD_SAFE(const BinUtility *in) const { +ATLAS_NOT_THREAD_SAFE(const BinUtility *in) const { const_cast<Layer *>(this)->setBinUtility(in); } @@ -180,7 +180,7 @@ inline void Layer::encloseTrackingVolume(const TrackingVolume &tvol) { m_enclosingTrackingVolume = &(tvol); } inline void Layer::encloseTrackingVolume -ATLAS_NOT_CONST_THREAD_SAFE(const TrackingVolume &tvol) const { +ATLAS_NOT_THREAD_SAFE(const TrackingVolume &tvol) const { const_cast<Layer *>(this)->encloseTrackingVolume(tvol); } @@ -193,7 +193,7 @@ Layer::encloseDetachedTrackingVolume(const DetachedTrackingVolume &tvol) { m_enclosingDetachedTrackingVolume = &(tvol); } inline void Layer::encloseDetachedTrackingVolume -ATLAS_NOT_CONST_THREAD_SAFE(const DetachedTrackingVolume &tvol) const { +ATLAS_NOT_THREAD_SAFE(const DetachedTrackingVolume &tvol) const { const_cast<Layer *>(this)->encloseDetachedTrackingVolume(tvol); } @@ -201,12 +201,12 @@ inline const LayerIndex &Layer::layerIndex() const { return m_index; } inline int Layer::layerType() const { return m_layerType; } inline void Layer::setLayerType(int id) { m_layerType = id; } -inline void Layer::setLayerType ATLAS_NOT_CONST_THREAD_SAFE(int id) const { +inline void Layer::setLayerType ATLAS_NOT_THREAD_SAFE(int id) const { const_cast<Layer *>(this)->setLayerType(id); } inline void Layer::assignMaterialProperties -ATLAS_NOT_CONST_THREAD_SAFE(const LayerMaterialProperties &layerMaterialProp, +ATLAS_NOT_THREAD_SAFE(const LayerMaterialProperties &layerMaterialProp, double scale) const { const_cast<Layer *>(this)->assignMaterialProperties(layerMaterialProp, scale); } @@ -218,7 +218,7 @@ inline void Layer::registerRepresentingVolume(const Volume *theVol) { m_representingVolume = theVol; } inline void Layer::registerRepresentingVolume -ATLAS_NOT_CONST_THREAD_SAFE(const Volume *theVol) const { +ATLAS_NOT_THREAD_SAFE(const Volume *theVol) const { const_cast<Layer *>(this)->registerRepresentingVolume(theVol); } @@ -226,13 +226,13 @@ inline void Layer::registerLayerIndex(const LayerIndex &lIdx) { m_index = lIdx; } inline void Layer::registerLayerIndex -ATLAS_NOT_CONST_THREAD_SAFE(const LayerIndex &lIdx) const { +ATLAS_NOT_THREAD_SAFE(const LayerIndex &lIdx) const { const_cast<Layer *>(this)->registerLayerIndex(lIdx); } inline double Layer::getRef() const { return m_ref; } inline void Layer::setRef(double x) { m_ref = x; } -inline void Layer::setRef ATLAS_NOT_CONST_THREAD_SAFE(double x) const { +inline void Layer::setRef ATLAS_NOT_THREAD_SAFE(double x) const { const_cast<Layer *>(this)->setRef(x); } diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialLayer.h index 52e12c0bc4db..41d9168ede95 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialLayer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ namespace Trk { /** Resize the layer to the tracking volume - not implemented */ virtual void resizeLayer(const VolumeBounds&, double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, double) const override {} @@ -71,7 +71,7 @@ namespace Trk { double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, const Amg::Vector3D&, double) const override {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/NavigationLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/NavigationLayer.h index 6309460bacbc..a1df41042c89 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/NavigationLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/NavigationLayer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -82,12 +82,12 @@ namespace Trk { /** move the Layer */ virtual void moveLayer( Amg::Transform3D& ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& ) const override; + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& ) const override; protected: /** Resize the layer to the tracking volume - not implemented */ virtual void resizeLayer(const VolumeBounds&, double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, double) const override {} @@ -97,7 +97,7 @@ namespace Trk { double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, const Amg::Vector3D&, double) const override {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/PlaneLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/PlaneLayer.h index 86d9d10febec..7f644b72122e 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/PlaneLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/PlaneLayer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -190,7 +190,7 @@ class LayerMaterialProperties; /** move the Layer */ virtual void moveLayer( Amg::Transform3D& shift ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE(Amg::Transform3D& shift) const override + virtual void moveLayer ATLAS_NOT_THREAD_SAFE(Amg::Transform3D& shift) const override { const_cast<PlaneLayer*>(this)->moveLayer(shift); } @@ -199,14 +199,14 @@ class LayerMaterialProperties; /** Resize the layer to the tracking volume - not implemented */ virtual void resizeLayer(const VolumeBounds&, double) override{} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, double) const override {} /** Resize the layer to the tracking volume - not implemented */ virtual void resizeAndRepositionLayer(const VolumeBounds&, const Amg::Vector3D&, double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, const Amg::Vector3D&, double) const override {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedCylinderLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedCylinderLayer.h index be1bff3d62a7..ef50343a968d 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedCylinderLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedCylinderLayer.h @@ -74,7 +74,7 @@ class OverlapDescriptor; virtual void moveLayer( Amg::Transform3D& shift ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ const_cast<SubtractedCylinderLayer*> (this)->moveLayer(shift); } @@ -83,13 +83,13 @@ class OverlapDescriptor; /** Resize the layer to the tracking volume - not implemented*/ virtual void resizeLayer(const VolumeBounds&, double) override {} /** Resize the layer to the tracking volume - not implemented*/ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE (const VolumeBounds&, double) const override {} + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE (const VolumeBounds&, double) const override {} /** Resize the layer to the tracking volume - not implemented */ virtual void resizeAndRepositionLayer(const VolumeBounds&, const Amg::Vector3D&, double) override {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, const Amg::Vector3D&, double) const override {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedPlaneLayer.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedPlaneLayer.h index 998d3d2c667e..3556cdb67ca1 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedPlaneLayer.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/SubtractedPlaneLayer.h @@ -69,7 +69,7 @@ namespace Trk { virtual void moveLayer( Amg::Transform3D& shift ) override; /** move the Layer */ - virtual void moveLayer ATLAS_NOT_CONST_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ + virtual void moveLayer ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& shift ) const override{ const_cast<SubtractedPlaneLayer*> (this)->moveLayer(shift); } @@ -77,7 +77,7 @@ namespace Trk { /** Resize the layer to the tracking volume - not implemented*/ virtual void resizeLayer(const VolumeBounds&, double) override {} /** Resize the layer to the tracking volume - not implemented*/ - virtual void resizeLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, double) const override {} @@ -88,7 +88,7 @@ namespace Trk { {} /** Resize the layer to the tracking volume - not implemented */ - virtual void resizeAndRepositionLayer ATLAS_NOT_CONST_THREAD_SAFE(const VolumeBounds&, + virtual void resizeAndRepositionLayer ATLAS_NOT_THREAD_SAFE(const VolumeBounds&, const Amg::Vector3D&, double) const override {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingGeometry.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingGeometry.h index 965a66b9fdbc..44b96dafe58c 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingGeometry.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingGeometry.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -110,7 +110,7 @@ namespace Trk { void printVolumeHierarchy(MsgStream& msgstream) const; /** indexLayers : method to re-set the index of the layers, depending on geometrySignature */ - void indexStaticLayers(GeometrySignature geosit, int offset = 0) const; + void indexStaticLayers ATLAS_NOT_THREAD_SAFE (GeometrySignature geosit, int offset = 0) const; private: /** Geometry Builder busineess: @@ -120,7 +120,7 @@ namespace Trk { /** Geometry Builder busineess: set all contained surfaces TG owned - this should save memory and avoid surface copying - prints compactification statistics */ - void compactify(MsgStream& msgstream, const TrackingVolume* vol=0) const; + void compactify ATLAS_NOT_THREAD_SAFE (MsgStream& msgstream, const TrackingVolume* vol=0) const; /** Geometry Builder busineess: synchronize all layers to enclosed volume dimensions */ @@ -128,40 +128,32 @@ namespace Trk { /** private method the Navigation Level */ - void registerNavigationLevel(NavigationLevel navlevel) const; + void registerNavigationLevel(NavigationLevel navlevel); + void registerNavigationLevel ATLAS_NOT_THREAD_SAFE (NavigationLevel navlevel) const; /** private method to register recursively the tracking volumes */ - void registerTrackingVolumes(const TrackingVolume& tvol, const TrackingVolume* mvol = 0, int lvl = 0); + void registerTrackingVolumes ATLAS_NOT_THREAD_SAFE (const TrackingVolume& tvol, const TrackingVolume* mvol = 0, int lvl = 0); /** private method to be called from GeometryBuilder: return the world with ownership */ - const TrackingVolume* checkoutHighestTrackingVolume() const; + const TrackingVolume* checkoutHighestTrackingVolume(); + const TrackingVolume* checkoutHighestTrackingVolume ATLAS_NOT_THREAD_SAFE() const; /** print VolumeInformation with Level */ void printVolumeInformation(MsgStream& msgstream, const TrackingVolume& tvol, int lvl) const; /** The known world - and the beam */ - mutable const TrackingVolume* m_world; - mutable const PerigeeSurface* m_beam; + const TrackingVolume* m_world; + const PerigeeSurface* m_beam; /** The unique boundary Layers */ - mutable std::map<const Layer*,int> m_boundaryLayers; + std::map<const Layer*,int> m_boundaryLayers; /** The Volumes in a map for later finding */ std::map<const std::string, const TrackingVolume*> m_trackingVolumes; /** The Navigation level for identification */ - mutable NavigationLevel m_navigationLevel; + NavigationLevel m_navigationLevel; - public: - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg.get() << lvl ; } - - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - - private: - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; }; @@ -171,11 +163,15 @@ namespace Trk { inline NavigationLevel TrackingGeometry::navigationLevel() const { return m_navigationLevel; } - inline void TrackingGeometry::registerNavigationLevel(NavigationLevel navLevel) const + inline void TrackingGeometry::registerNavigationLevel(NavigationLevel navLevel) { m_navigationLevel = navLevel; } - inline void TrackingGeometry::sign(GeometrySignature geosit, GeometryType geotype) const - { m_world->sign(geosit, geotype); } + inline void TrackingGeometry::registerNavigationLevel ATLAS_NOT_THREAD_SAFE (NavigationLevel navLevel) const + { const_cast<TrackingGeometry*> (this)->registerNavigationLevel(navLevel); } + + + inline void TrackingGeometry::sign ATLAS_NOT_THREAD_SAFE (GeometrySignature geosit, GeometryType geotype) const + { const_cast<TrackingVolume*> (m_world)->sign(geosit, geotype); } inline const TrackingVolume* TrackingGeometry::trackingVolume(const std::string& name) const { diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolume.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolume.h index 6ad17b444172..e12270266035 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolume.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolume.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -103,28 +103,28 @@ namespace Trk { /** Constructor for a full equipped Tracking Volume - explicitely ======> 1 a) static confinement */ - TrackingVolume(Amg::Transform3D* htrans, - VolumeBounds* volbounds, - const LayerArray* subLayers=0, - const TrackingVolumeArray* subVolumes=0, - const std::string& volumeName="undefined"); + TrackingVolume (Amg::Transform3D* htrans, + VolumeBounds* volbounds, + const LayerArray* subLayers=0, + const TrackingVolumeArray* subVolumes=0, + const std::string& volumeName="undefined"); /** Constructor for a full equipped Tracking Volume - full by inheritance ======> 2 a) static confinement */ - TrackingVolume(const Volume& volume, - const Material& matprop, - const LayerArray* subLayers=0, - const TrackingVolumeArray* subVolumes=0, - const std::string& volumeName="undefined"); + TrackingVolume (const Volume& volume, + const Material& matprop, + const LayerArray* subLayers=0, + const TrackingVolumeArray* subVolumes=0, + const std::string& volumeName="undefined"); /** Constructor for a full equipped Tracking Volume - mixed ======> 3 a) static confinement */ - TrackingVolume(Amg::Transform3D* htrans, - VolumeBounds* volbounds, - const Material& matprop, - const LayerArray* subLayers=0, - const TrackingVolumeArray* subVolumes=0, - const std::string& volumeName="undefined"); + TrackingVolume (Amg::Transform3D* htrans, + VolumeBounds* volbounds, + const Material& matprop, + const LayerArray* subLayers=0, + const TrackingVolumeArray* subVolumes=0, + const std::string& volumeName="undefined"); /** Constructor for a full equipped Tracking Volume with detached subvolumes @@ -296,17 +296,15 @@ namespace Trk { - positiveFaceXY */ - void registerOutsideGlueVolumes(GlueVolumesDescriptor* gvd) const; - /** Register the outside glue volumes - - ordering is in the TrackingVolume Frame: - - negativeFaceXY - - (faces YZ, ZY, radial faces) - - positiveFaceXY - */ - const GlueVolumesDescriptor& glueVolumesDescriptor() const; + void registerOutsideGlueVolumes(GlueVolumesDescriptor* gvd); + void registerOutsideGlueVolumes ATLAS_NOT_THREAD_SAFE (GlueVolumesDescriptor* gvd) const; + + const GlueVolumesDescriptor& glueVolumesDescriptor(); + const GlueVolumesDescriptor& glueVolumesDescriptor ATLAS_NOT_THREAD_SAFE() const; /** the sensitive area */ - void registerSensitiveVolume(const AbstractVolume* svol) const; + void registerSensitiveVolume(const AbstractVolume* svol); + void registerSensitiveVolume ATLAS_NOT_THREAD_SAFE (const AbstractVolume* svol) const; /** return the sensitive volume */ const AbstractVolume* sensitiveVolume() const; @@ -315,7 +313,7 @@ namespace Trk { const AbstractVolume* checkoutSensitiveVolume() const; /** sign the volume - the geometry builder has to do that */ - void sign(GeometrySignature signat, GeometryType gtype = Static) const; + void sign ATLAS_NOT_THREAD_SAFE(GeometrySignature signat, GeometryType gtype = Static) const; /** return the Signature */ GeometrySignature geometrySignature() const; @@ -324,13 +322,15 @@ namespace Trk { GeometryType geometryType() const; /** Register the color code */ - void registerColorCode(unsigned int icolor) const; + void registerColorCode(unsigned int icolor); + void registerColorCode ATLAS_NOT_THREAD_SAFE (unsigned int icolor) const; /** Get the color code */ unsigned int colorCode() const; /** force a navigation check */ - void forceNavigationCheck() const; + void forceNavigationCheck(); + void forceNavigationCheck ATLAS_NOT_THREAD_SAFE() const; /** Boolean, if true navigation needs to be redone when hitting this volume */ bool redoNavigation() const; @@ -339,37 +339,37 @@ namespace Trk { const TrackingVolume* getMotherVolume() const; /** Return the MotherVolume - if it exists */ - void setMotherVolume(const TrackingVolume* mvol) const; + void setMotherVolume(const TrackingVolume* mvol); + void setMotherVolume ATLAS_NOT_THREAD_SAFE (const TrackingVolume* mvol) const; /** move Volume */ - void moveVolume( Amg::Transform3D& shift ) const; + void moveVolume ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D& shift ) const; /** add Material */ void addMaterial( const Material& mat, float fact=1. ); - void addMaterial ATLAS_NOT_CONST_THREAD_SAFE (const Material& mat, float fact=1.) const ; + void addMaterial ATLAS_NOT_THREAD_SAFE (const Material& mat, float fact=1.) const ; /** remove content */ void clear(); - /** dump to screen */ void screenDump(MsgStream& msg) const; protected: /** clone at new position */ - const TrackingVolume* cloneTV(Amg::Transform3D& transform) const; + const TrackingVolume* cloneTV ATLAS_NOT_THREAD_SAFE(Amg::Transform3D& transform) const; private: /** reIndex the static layers of the TrackingVolume */ - void indexContainedStaticLayers(GeometrySignature geoSig, int& offset) const; + void indexContainedStaticLayers ATLAS_NOT_THREAD_SAFE(GeometrySignature geoSig, int& offset) const; /** reIndex the material layers of the TrackingVolume */ - void indexContainedMaterialLayers(GeometrySignature geoSig, int& offset) const; + void indexContainedMaterialLayers ATLAS_NOT_THREAD_SAFE (GeometrySignature geoSig, int& offset) const; /** propagate material properties to subvolumes */ - void propagateMaterialProperties(const Material& mprop); - void propagateMaterialProperties ATLAS_NOT_CONST_THREAD_SAFE (const Material& mprop) const; + void propagateMaterialProperties ATLAS_NOT_THREAD_SAFE (const Material& mprop); + void propagateMaterialProperties ATLAS_NOT_THREAD_SAFE (const Material& mprop) const; /** Create Boundary Surface */ void createBoundarySurfaces(); @@ -380,7 +380,7 @@ namespace Trk { /** compactify the memory usage in the event by setting ownership to TackingGeometry the referenced types are the number of registered surfaces & total surfaces */ - void compactify(size_t& rSurfaces, size_t& tSurfaces) const; + void compactify ATLAS_NOT_THREAD_SAFE (size_t& rSurfaces, size_t& tSurfaces) const; /** method to synchronize the layers with potentially updated volume bounds: - adapts the layer dimensions to the new volumebounds + envelope @@ -389,7 +389,7 @@ namespace Trk { void synchronizeLayers(MsgStream& msgstream, double envelope = 1.) const; /** Register Next - Previous for Layers, set volumelink */ - void interlinkLayers(); + void interlinkLayers ATLAS_NOT_THREAD_SAFE(); /** Helper method - find closest of two layers */ const Layer* closest(const Amg::Vector3D& pos, @@ -399,7 +399,7 @@ namespace Trk { /** move the Tracking Volume*/ - void moveTV(Amg::Transform3D& transform) const; + void moveTV ATLAS_NOT_THREAD_SAFE(Amg::Transform3D& transform) const; /** Forbidden copy constructor */ TrackingVolume(const TrackingVolume&): Volume(), Material() {} @@ -407,11 +407,11 @@ namespace Trk { /** Forbid assignment. */ TrackingVolume &operator=(const TrackingVolume&) { return *this; } - mutable const TrackingVolume* m_motherVolume; //!< mother volume of this volume + const TrackingVolume* m_motherVolume; //!< mother volume of this volume std::vector< SharedObject<const BoundarySurface<TrackingVolume> > >* m_boundarySurfaces; //!< boundary Surfaces //(a) - mutable const LayerArray* m_confinedLayers; //!< Array of Layers inside the Volume + const LayerArray* m_confinedLayers; //!< Array of Layers inside the Volume const TrackingVolumeArray* m_confinedVolumes; //!< Array of Volumes inside the Volume //(b) const std::vector<const DetachedTrackingVolume*>* m_confinedDetachedVolumes; //!< Detached subvolumes @@ -420,28 +420,21 @@ namespace Trk { //(b) const std::vector<const Layer*>* m_confinedArbitraryLayers; //!< Unordered Layers inside the Volume - mutable GlueVolumesDescriptor* m_outsideGlueVolumes; //!< Volumes to glue Volumes from the outside + GlueVolumesDescriptor* m_outsideGlueVolumes; //!< Volumes to glue Volumes from the outside - mutable const AbstractVolume* m_sensitiveVolume; //!< Sensitive volume + const AbstractVolume* m_sensitiveVolume; //!< Sensitive volume LayerAttemptsCalculator* m_layerAttemptsCalculator; //!< provided the number of layer attempts - mutable GeometrySignature m_geometrySignature; //!< The Signature done by the GeometryBuilder - mutable GeometryType m_geometryType; //!< defines how the Extrapolator propagates through this + GeometrySignature m_geometrySignature; //!< The Signature done by the GeometryBuilder + GeometryType m_geometryType; //!< defines how the Extrapolator propagates through this - std::string m_name; //!< Volume name for debug reasons - mutable unsigned int m_colorCode; //!< Color code for displaying - mutable bool m_redoNavigation; //!< Navigation boolean. If true navigation needs to be redone when entering this volume + std::string m_name; //!< Volume name for debug reasons + unsigned int m_colorCode; //!< Color code for displaying + bool m_redoNavigation; //!< Navigation boolean. If true navigation needs to be redone when entering this volume public: - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg.get() << lvl ; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - private: - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; }; @@ -474,16 +467,17 @@ namespace Trk { inline const std::vector<const TrackingVolume*>* TrackingVolume::confinedDenseVolumes() const { return m_confinedDenseVolumes; } - inline void TrackingVolume::registerSensitiveVolume(const AbstractVolume* svol) const + inline void TrackingVolume::registerSensitiveVolume(const AbstractVolume* svol) { m_sensitiveVolume = svol; } + inline void TrackingVolume::registerSensitiveVolume ATLAS_NOT_THREAD_SAFE (const AbstractVolume* svol) const{ + const_cast<TrackingVolume&>(*this).registerSensitiveVolume(svol); + } inline const AbstractVolume* TrackingVolume::sensitiveVolume() const { return m_sensitiveVolume; } - - inline const AbstractVolume* TrackingVolume::checkoutSensitiveVolume() const - { + + inline const AbstractVolume* TrackingVolume::checkoutSensitiveVolume() const{ const AbstractVolume* returnVolume = m_sensitiveVolume; - m_sensitiveVolume = 0; return returnVolume; } @@ -618,14 +612,19 @@ namespace Trk { inline GeometryType TrackingVolume::geometryType() const { return m_geometryType; } - inline void TrackingVolume::registerColorCode(unsigned int icolor) const + inline void TrackingVolume::registerColorCode(unsigned int icolor) { m_colorCode = icolor; } + inline void TrackingVolume::registerColorCode(unsigned int icolor) const + { const_cast<TrackingVolume&> (*this).registerColorCode(icolor);} + inline unsigned int TrackingVolume::colorCode() const { return m_colorCode; } - inline void TrackingVolume::forceNavigationCheck() const + inline void TrackingVolume::forceNavigationCheck() { m_redoNavigation = true; } + inline void TrackingVolume::forceNavigationCheck ATLAS_NOT_THREAD_SAFE() const + { const_cast<TrackingVolume&>(*this).forceNavigationCheck(); } inline bool TrackingVolume::redoNavigation() const { return m_redoNavigation; } @@ -633,17 +632,15 @@ namespace Trk { inline const TrackingVolume* TrackingVolume::getMotherVolume() const { return m_motherVolume; } - inline void TrackingVolume::setMotherVolume(const TrackingVolume* mvol) const + inline void TrackingVolume::setMotherVolume(const TrackingVolume* mvol) { m_motherVolume = mvol; } + inline void TrackingVolume::setMotherVolume ATLAS_NOT_THREAD_SAFE (const TrackingVolume* mvol) const + { const_cast<TrackingVolume&>(*this).setMotherVolume(mvol); } - inline void TrackingVolume::addMaterial ATLAS_NOT_CONST_THREAD_SAFE(const Material &mat, - float fact) const{ - const_cast<TrackingVolume*>(this)->addMaterial(mat,fact); - } - - inline void TrackingVolume::propagateMaterialProperties ATLAS_NOT_CONST_THREAD_SAFE (const Material &mprop) const { + inline void TrackingVolume::propagateMaterialProperties ATLAS_NOT_THREAD_SAFE(const Material& mprop) const { const_cast<TrackingVolume *>(this)->propagateMaterialProperties(mprop); } + } // end of namespace #endif // TRKGEOMETRY_TRACKINGVOLUME_H diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolumeManipulator.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolumeManipulator.h index 15f91d5d3d9e..2623c43b0b38 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolumeManipulator.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/TrackingVolumeManipulator.h @@ -43,76 +43,76 @@ namespace Trk { - second volume that gets glued to the first volume - face of the BoundarySurface to be shared */ - void glueVolumes(const TrackingVolume& firstVol, - BoundarySurfaceFace firstFace, - const TrackingVolume& secondVol, - BoundarySurfaceFace secondFace) const; + void glueVolumes ATLAS_NOT_THREAD_SAFE (const TrackingVolume& firstVol, + BoundarySurfaceFace firstFace, + const TrackingVolume& secondVol, + BoundarySurfaceFace secondFace) const; /** protected method to set the boundary surface of a tracking volume */ - void setBoundarySurface(const TrackingVolume& tvol, - SharedObject<const BoundarySurface<TrackingVolume> > bsurf, - BoundarySurfaceFace face) const; + void setBoundarySurface ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + SharedObject<const BoundarySurface<TrackingVolume> > bsurf, + BoundarySurfaceFace face) const; /** protected method to set inside Volume of a BoundarySurface: input: - the volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume to be set as inside volume */ - void setInsideVolume(const TrackingVolume& tvol, - BoundarySurfaceFace face, - const TrackingVolume* insidevol) const; + void setInsideVolume ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + const TrackingVolume* insidevol) const; /** protected method to set inside VolumeArray of a BoundarySurface: input: - ithe volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume array to be set as inside volume array */ - void setInsideVolumeArray(const TrackingVolume& tvol, - BoundarySurfaceFace face, - BinnedArray<TrackingVolume>* insidevolarray) const; + void setInsideVolumeArray ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + BinnedArray<TrackingVolume>* insidevolarray) const; /** protected method to set inside VolumeArray of a BoundarySurface: input: - ithe volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume array to be set as inside volume array */ - void setInsideVolumeArray(const TrackingVolume& tvol, - BoundarySurfaceFace face, - SharedObject<BinnedArray<TrackingVolume> >insidevolarray) const; + void setInsideVolumeArray ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + SharedObject<BinnedArray<TrackingVolume> >insidevolarray) const; /** protected method to set outside Volume of a BoundarySurface: input: - the volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume to be set as outside volume */ - void setOutsideVolume(const TrackingVolume& tvol, - BoundarySurfaceFace face, - const TrackingVolume* outsidevol) const; + void setOutsideVolume ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + const TrackingVolume* outsidevol) const; /** protected method to set outside VolumeArray of a BoundarySurface: input: - the volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume array to be set as outside volume array */ - void setOutsideVolumeArray(const TrackingVolume& tvol, - BoundarySurfaceFace face, - BinnedArray<TrackingVolume>* outsidevolarray) const; + void setOutsideVolumeArray ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + BinnedArray<TrackingVolume>* outsidevolarray) const; /** protected method to set outside VolumeArray of a BoundarySurface: input: - the volume that holdes the BoundarySurface - the face type of the boundary to be set - the volume array to be set as outside volume array */ - void setOutsideVolumeArray(const TrackingVolume& tvol, - BoundarySurfaceFace face, - SharedObject<BinnedArray<TrackingVolume> > outsidevolarray) const; + void setOutsideVolumeArray ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + BoundarySurfaceFace face, + SharedObject<BinnedArray<TrackingVolume> > outsidevolarray) const; /** protected method to confine (dense) volumes: input: - the volume that holdes the BoundarySurfaces (embedded) - the volume to be set as outside volume */ - void confineVolume(const TrackingVolume& tvol, - const TrackingVolume* outsidevol) const; + void confineVolume ATLAS_NOT_THREAD_SAFE(const TrackingVolume& tvol, + const TrackingVolume* outsidevol) const; }; } diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/AlignableTrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/AlignableTrackingVolume.cxx index bf29e93adc7f..1fe496037d73 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/AlignableTrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/AlignableTrackingVolume.cxx @@ -19,12 +19,12 @@ Trk::AlignableTrackingVolume::AlignableTrackingVolume() : m_binnedMaterial(nullptr) {} -Trk::AlignableTrackingVolume::AlignableTrackingVolume(Amg::Transform3D* htrans, - Amg::Transform3D* align, - VolumeBounds* volbounds, - const Trk::BinnedMaterial* matprop, - int sampleID, - const std::string& volumeName): +ATLAS_NOT_THREAD_SAFE Trk::AlignableTrackingVolume::AlignableTrackingVolume(Amg::Transform3D* htrans, + Amg::Transform3D* align, + VolumeBounds* volbounds, + const Trk::BinnedMaterial* matprop, + int sampleID, + const std::string& volumeName): Trk::TrackingVolume(htrans, volbounds,*matprop,0,0,volumeName), m_alignedTV(0), m_sampleID(sampleID), diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx index 5da1112ed6f5..ed5b7149d132 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -55,17 +55,17 @@ Trk::DetachedTrackingVolume::~DetachedTrackingVolume() delete m_baseTransform; } -void Trk::DetachedTrackingVolume::move( Amg::Transform3D& shift) const +void Trk::DetachedTrackingVolume::move ATLAS_NOT_THREAD_SAFE( Amg::Transform3D& shift) const { m_trkVolume->moveTV( shift ); if (m_layerRepresentation) m_layerRepresentation->moveLayer(shift); if (m_multilayerRepresentation) for (unsigned int i=0;i<m_multilayerRepresentation->size();i++) (*m_multilayerRepresentation)[i]->moveLayer(shift); } -const Trk::DetachedTrackingVolume* Trk::DetachedTrackingVolume::clone( std::string name, Amg::Transform3D& shift) const +const Trk::DetachedTrackingVolume* Trk::DetachedTrackingVolume::clone ATLAS_NOT_THREAD_SAFE( std::string name, Amg::Transform3D& shift) const { - const Trk::TrackingVolume* newTV = new TrackingVolume(*(this->trackingVolume()),shift ); - const Trk::DetachedTrackingVolume* newStat = 0; + Trk::TrackingVolume* newTV = new TrackingVolume(*(this->trackingVolume()),shift ); + Trk::DetachedTrackingVolume* newStat = nullptr; // layer representation ? const Trk::PlaneLayer* newLay=0; if (this->layerRepresentation()) { @@ -128,7 +128,7 @@ const Trk::DetachedTrackingVolume* Trk::DetachedTrackingVolume::clone( std::stri return newStat; } -void Trk::DetachedTrackingVolume::compactify(size_t& cSurfaces, size_t& tSurfaces) const +void Trk::DetachedTrackingVolume::compactify ATLAS_NOT_THREAD_SAFE(size_t& cSurfaces, size_t& tSurfaces) const { // deal with the Tracking Volume representation @@ -157,7 +157,7 @@ void Trk::DetachedTrackingVolume::compactify(size_t& cSurfaces, size_t& tSurface } -void Trk::DetachedTrackingVolume::sign(GeometrySignature signat, GeometryType geotype) const +void Trk::DetachedTrackingVolume::sign ATLAS_NOT_THREAD_SAFE (GeometrySignature signat, GeometryType geotype) const { m_trkVolume->sign(signat, geotype); } Trk::GeometrySignature Trk::DetachedTrackingVolume::geometrySignature() const @@ -175,7 +175,7 @@ void Trk::DetachedTrackingVolume::setBaseTransform( Amg::Transform3D* transf ) } } -void Trk::DetachedTrackingVolume::realign( Amg::Transform3D* transf ) const +void Trk::DetachedTrackingVolume::realign ATLAS_NOT_THREAD_SAFE ( Amg::Transform3D* transf ) const { if ( transf ) { Amg::Transform3D shift = (*transf)*this->trackingVolume()->transform().inverse(); diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx index 49f028c7a84f..02d30237f130 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ // GaudiKernel #include "GaudiKernel/MsgStream.h" -Trk::TrackingGeometry::TrackingGeometry(const Trk::TrackingVolume* highestVolume, Trk::NavigationLevel navLev) +ATLAS_NOT_THREAD_SAFE Trk::TrackingGeometry::TrackingGeometry(const Trk::TrackingVolume* highestVolume, Trk::NavigationLevel navLev) : m_world(highestVolume), m_beam(nullptr), m_navigationLevel(navLev) @@ -67,33 +67,29 @@ const Trk::TrackingVolume* Trk::TrackingGeometry::lowestStaticTrackingVolume(con -void Trk::TrackingGeometry::registerTrackingVolumes(const Trk::TrackingVolume& tvol, const Trk::TrackingVolume* mvol, int lvl) +void Trk::TrackingGeometry::registerTrackingVolumes ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, const Trk::TrackingVolume* mvol, int lvl) { int sublvl = lvl+1; std::string indent = ""; for (int l=0; l<lvl; ++l, indent += " "); tvol.setMotherVolume(mvol); - ATH_MSG_VERBOSE( "registerTrackingVolumes() ... " << indent << tvol.volumeName() << "... in mother volume: " << tvol.getMotherVolume() ); m_trackingVolumes[tvol.volumeName()] = (&tvol); const Trk::BinnedArray< Trk::TrackingVolume >* confinedVolumes = tvol.confinedVolumes(); if (confinedVolumes){ const std::vector<const Trk::TrackingVolume*>& volumes = confinedVolumes->arrayObjects(); - ATH_MSG_VERBOSE( "registerTrackingVolumes() ... " << volumes.size() << " confined volumes found" ); for (auto& volumesIter: volumes) if (volumesIter) registerTrackingVolumes(*volumesIter, &tvol, sublvl); } const std::vector<const Trk::TrackingVolume* >* confinedDenseVolumes = tvol.confinedDenseVolumes(); if (confinedDenseVolumes){ - ATH_MSG_VERBOSE( "registerTrackingVolumes() ... " << confinedDenseVolumes->size() << " confined dense volumes found" ); for (auto& volumesIter : (*confinedDenseVolumes) ) if (volumesIter) registerTrackingVolumes(*volumesIter, &tvol, sublvl); } /** should detached tracking volumes be part of the tracking geometry ? */ const std::vector< const Trk::DetachedTrackingVolume* >* confinedDetachedVolumes = tvol.confinedDetachedVolumes(); if (confinedDetachedVolumes){ - ATH_MSG_VERBOSE( "registerTrackingVolumes() ... " << confinedDetachedVolumes->size() << " confined detached volumes found" ); for (auto& volumesIter : (*confinedDetachedVolumes) ) if (volumesIter && tvol.inside(volumesIter->trackingVolume()->center(),0.) ) registerTrackingVolumes(*(volumesIter->trackingVolume()), &tvol, sublvl); @@ -110,12 +106,11 @@ void Trk::TrackingGeometry::registerTrackingVolumes(const Trk::TrackingVolume& t m_boundaryLayers[bLayer] = 0; } } - ATH_MSG_VERBOSE("registerTrackingVolumes() ... TrackingGeometry has " << m_boundaryLayers.size() << " unique boundary material layers."); } -void Trk::TrackingGeometry::compactify(MsgStream& msg, const TrackingVolume* vol) const +void Trk::TrackingGeometry::compactify ATLAS_NOT_THREAD_SAFE (MsgStream& msg, const TrackingVolume* vol) const { msg << MSG::VERBOSE << "====== Calling TrackingGeometry::compactify() ===== " << std::endl; const Trk::TrackingVolume* tVolume = vol ? vol : m_world; @@ -125,26 +120,29 @@ void Trk::TrackingGeometry::compactify(MsgStream& msg, const TrackingVolume* vol msg << MSG::VERBOSE << " --> set TG ownership of " << cSurfaces << " out of " << tSurfaces << std::endl; for (auto bLayerIter = m_boundaryLayers.begin(); bLayerIter != m_boundaryLayers.end(); ++bLayerIter) bLayerIter->first->surfaceRepresentation().setOwner(Trk::TGOwn); - msg << MSG::VERBOSE << " --> set TG ownership of " << m_boundaryLayers.size() << " boundary layers." << std::endl; + msg << MSG::VERBOSE << " --> set TG ownership of " << m_boundaryLayers.size() << " boundary layers." << std::endl; msg << MSG::VERBOSE << endmsg; - } void Trk::TrackingGeometry::synchronizeLayers(MsgStream& msg, const TrackingVolume* vol) const { - msg << MSG::VERBOSE << "====== Calling TrackingGeometry::synchronizeLayers() ===== " << endmsg; const Trk::TrackingVolume* tVolume = vol ? vol : m_world; tVolume->synchronizeLayers(msg); } -const Trk::TrackingVolume* Trk::TrackingGeometry::checkoutHighestTrackingVolume() const +const Trk::TrackingVolume* Trk::TrackingGeometry::checkoutHighestTrackingVolume() { const Trk::TrackingVolume* checkoutVolume = m_world; - m_world = 0; + m_world = nullptr; // clear the boundary layers they go with the highest volume m_boundaryLayers.clear(); return checkoutVolume; } +const Trk::TrackingVolume* Trk::TrackingGeometry::checkoutHighestTrackingVolume() const +{ + return const_cast<Trk::TrackingGeometry*>(this)->checkoutHighestTrackingVolume(); +} + void Trk::TrackingGeometry::printVolumeHierarchy(MsgStream& msg) const { @@ -194,7 +192,7 @@ void Trk::TrackingGeometry::printVolumeInformation(MsgStream& msg, const Trk::Tr } } -void Trk::TrackingGeometry::indexStaticLayers(GeometrySignature geosit, int offset) const +void Trk::TrackingGeometry::indexStaticLayers ATLAS_NOT_THREAD_SAFE (GeometrySignature geosit, int offset) const { if (m_world) { m_world->indexContainedStaticLayers(geosit, offset); diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx index e37dda8ef75c..c22e0ba8c74e 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -63,11 +63,11 @@ Trk::TrackingVolume::TrackingVolume() : } // constructor: 1 a) -Trk::TrackingVolume::TrackingVolume(Amg::Transform3D* htrans, - VolumeBounds* volbounds, - const LayerArray* subLayers, - const TrackingVolumeArray* subVolumes, - const std::string& volumeName) : +ATLAS_NOT_THREAD_SAFE Trk::TrackingVolume::TrackingVolume (Amg::Transform3D* htrans, + VolumeBounds* volbounds, + const LayerArray* subLayers, + const TrackingVolumeArray* subVolumes, + const std::string& volumeName) : Volume(htrans, volbounds), Material(), m_motherVolume(0), @@ -92,11 +92,11 @@ Trk::TrackingVolume::TrackingVolume(Amg::Transform3D* htrans, } // constructor: 2 a) -Trk::TrackingVolume::TrackingVolume(const Volume& volume, - const Material& matprop, - const LayerArray* subLayers, - const TrackingVolumeArray* subVolumes, - const std::string& volumeName) : +ATLAS_NOT_THREAD_SAFE Trk::TrackingVolume::TrackingVolume (const Volume& volume, + const Material& matprop, + const LayerArray* subLayers, + const TrackingVolumeArray* subVolumes, + const std::string& volumeName) : Volume(volume), Material(matprop), m_motherVolume(0), @@ -122,12 +122,12 @@ Trk::TrackingVolume::TrackingVolume(const Volume& volume, // constructor: 3 a) -Trk::TrackingVolume::TrackingVolume(Amg::Transform3D* htrans, - VolumeBounds* volbounds, - const Material& matprop, - const LayerArray* subLayers, - const TrackingVolumeArray* subVolumes, - const std::string& volumeName) : +ATLAS_NOT_THREAD_SAFE Trk::TrackingVolume::TrackingVolume (Amg::Transform3D* htrans, + VolumeBounds* volbounds, + const Material& matprop, + const LayerArray* subLayers, + const TrackingVolumeArray* subVolumes, + const std::string& volumeName) : Volume(htrans, volbounds), Material(matprop), m_motherVolume(0), @@ -574,7 +574,6 @@ const Trk::LayerIntersection<Amg::Vector3D> } // ---------------- CONFINED LAYER SECTION -------------- if (m_confinedLayers){ - ATH_MSG_VERBOSE( "closestMaterialLayer() ... trying m_confinedLayers" ); // the associated layer const Trk::Layer* assocLayer = associatedLayer(gp); const Trk::Layer* previousMatLayer = 0; @@ -582,7 +581,6 @@ const Trk::LayerIntersection<Amg::Vector3D> // if the associated layer is a navigation layer - get the previous and next from this one const Trk::NavigationLayer* navLayer = dynamic_cast<const Trk::NavigationLayer*>(assocLayer); if (navLayer) { - ATH_MSG_VERBOSE( "closestMaterialLayer() ... trying m_confinedLayers ... seeking navLayer neighbors" ); // get previous / next previousMatLayer = navLayer->previousLayer(); nextMatLayer = navLayer->nextLayer(); @@ -599,7 +597,6 @@ const Trk::LayerIntersection<Amg::Vector3D> // layer candidates found - continue if (layerCandidates.size()){ const Layer* cLayer = 0; - ATH_MSG_VERBOSE( "closestMaterialLayer() ... having " << layerCandidates.size() << " layers to try."); // iterate through and chose for ( auto& lcIter : layerCandidates ){ // only the forceFwd solution is possible here @@ -689,7 +686,7 @@ std::vector<const Trk::DetachedTrackingVolume*>* Trk::TrackingVolume::assocDetac } -void Trk::TrackingVolume::indexContainedStaticLayers(GeometrySignature geoSig, int& offset) const +void Trk::TrackingVolume::indexContainedStaticLayers ATLAS_NOT_THREAD_SAFE(GeometrySignature geoSig, int& offset) const { // the offset gets increased internally @@ -728,7 +725,7 @@ void Trk::TrackingVolume::indexContainedStaticLayers(GeometrySignature geoSig, i } } -void Trk::TrackingVolume::indexContainedMaterialLayers(GeometrySignature geoSig, int& offset) const { +void Trk::TrackingVolume::indexContainedMaterialLayers ATLAS_NOT_THREAD_SAFE (GeometrySignature geoSig, int& offset) const { // the offset gets increased internally // the static layers first and check if they have surfaces with material layers that need index @@ -796,7 +793,12 @@ void Trk::TrackingVolume::addMaterial(const Trk::Material& mprop, float fact) dEdX += flin*mprop.dEdX; } -void Trk::TrackingVolume::propagateMaterialProperties(const Trk::Material& mprop) { +void Trk::TrackingVolume::addMaterial ATLAS_NOT_THREAD_SAFE(const Material &mat, + float fact) const{ + const_cast<Trk::TrackingVolume*>(this)->addMaterial(mat,fact); +} + +void Trk::TrackingVolume::propagateMaterialProperties ATLAS_NOT_THREAD_SAFE(const Trk::Material& mprop){ X0 = mprop.X0; L0 = mprop.L0; @@ -817,12 +819,12 @@ void Trk::TrackingVolume::propagateMaterialProperties(const Trk::Material& mprop } -void Trk::TrackingVolume::sign(Trk::GeometrySignature geosign, Trk::GeometryType geotype) const +void Trk::TrackingVolume::sign ATLAS_NOT_THREAD_SAFE (Trk::GeometrySignature geosign, Trk::GeometryType geotype) const { // never overwrite what is already signed, that's a crime - if (m_geometrySignature == Trk::Unsigned) m_geometrySignature = geosign; - m_geometryType = geotype; + if (m_geometrySignature == Trk::Unsigned) const_cast<Trk::GeometrySignature&> (m_geometrySignature) = geosign; + const_cast<Trk::GeometryType&> (m_geometryType) = geotype; // confined volumes const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); @@ -967,7 +969,7 @@ void Trk::TrackingVolume::createLayerAttemptsCalculator() } } -void Trk::TrackingVolume::interlinkLayers() { +void Trk::TrackingVolume::interlinkLayers ATLAS_NOT_THREAD_SAFE() { if (m_confinedLayers){ const std::vector<const Trk::Layer*>& layers = m_confinedLayers->arrayObjects(); // forward loop @@ -1001,36 +1003,43 @@ void Trk::TrackingVolume::interlinkLayers() { const Trk::LayerArray* Trk::TrackingVolume::checkoutConfinedLayers() const { const Trk::LayerArray* checkoutLayers = m_confinedLayers; - m_confinedLayers=0; return checkoutLayers; } -void Trk::TrackingVolume::registerOutsideGlueVolumes(Trk::GlueVolumesDescriptor* gvd) const +void Trk::TrackingVolume::registerOutsideGlueVolumes(Trk::GlueVolumesDescriptor* gvd) { delete m_outsideGlueVolumes; m_outsideGlueVolumes = gvd; } -const Trk::GlueVolumesDescriptor& Trk::TrackingVolume::glueVolumesDescriptor() const -{ - if (!m_outsideGlueVolumes) - m_outsideGlueVolumes = new Trk::GlueVolumesDescriptor; - return (*m_outsideGlueVolumes); +void Trk::TrackingVolume::registerOutsideGlueVolumes ATLAS_NOT_CONST_THREAD_SAFE(Trk::GlueVolumesDescriptor* gvd) const { + const_cast<const Trk::TrackingVolume&>(*this).registerOutsideGlueVolumes(gvd); +} + +const Trk::GlueVolumesDescriptor& Trk::TrackingVolume::glueVolumesDescriptor() { + if (!m_outsideGlueVolumes) + m_outsideGlueVolumes = new Trk::GlueVolumesDescriptor; + return (*m_outsideGlueVolumes); } -void Trk::TrackingVolume::moveVolume( Amg::Transform3D& shift ) const +const Trk::GlueVolumesDescriptor& Trk::TrackingVolume::glueVolumesDescriptor ATLAS_NOT_CONST_THREAD_SAFE () const{ + return (const_cast<Trk::TrackingVolume&>(*this)).glueVolumesDescriptor(); +} + + +void Trk::TrackingVolume::moveVolume ATLAS_NOT_CONST_THREAD_SAFE (Amg::Transform3D& shift) const { if (m_transform) { Amg::Transform3D transf = shift * (*m_transform); - const_cast<Trk::TrackingVolume*>(this)->m_transform = std::make_unique<Amg::Transform3D>(transf); + const_cast<Trk::TrackingVolume&>(*this).m_transform = std::make_unique<Amg::Transform3D>(transf); } else { - const_cast<Trk::TrackingVolume*>(this)->m_transform = std::make_unique<Amg::Transform3D>(shift); + const_cast<Trk::TrackingVolume&>(*this).m_transform = std::make_unique<Amg::Transform3D>(shift); } - const_cast<Trk::TrackingVolume*>(this)->m_center.store(std::make_unique<Amg::Vector3D>(m_transform->translation())); + const_cast<Trk::TrackingVolume&>(*this).m_center.store(std::make_unique<Amg::Vector3D>(m_transform->translation())); } -const Trk::TrackingVolume* Trk::TrackingVolume::cloneTV(Amg::Transform3D& transform) const +const Trk::TrackingVolume* Trk::TrackingVolume::cloneTV ATLAS_NOT_THREAD_SAFE (Amg::Transform3D& transform) const { // clone the mother volume const Trk::Volume* vol = Trk::Volume::clone(); @@ -1173,13 +1182,12 @@ const Trk::Layer* Trk::TrackingVolume::closest(const Amg::Vector3D& pos, = first.surfaceRepresentation().straightLineDistanceEstimate(pos, dir); Trk::DistanceSolution distSolToNext = second.surfaceRepresentation().straightLineDistanceEstimate(pos, dir); - ATH_MSG_VERBOSE( "closest() ... distance to previous / next layer = " << distSolToPrevious.absClosest() << " / " << distSolToNext.absClosest() ); // find out which one return (distSolToPrevious.absClosest() < distSolToNext.absClosest() ? &first : &second); } -void Trk::TrackingVolume::moveTV(Amg::Transform3D& transform) const { +void Trk::TrackingVolume::moveTV ATLAS_NOT_THREAD_SAFE (Amg::Transform3D& transform) const { moveVolume( transform ); @@ -1214,11 +1222,8 @@ void Trk::TrackingVolume::moveTV(Amg::Transform3D& transform) const { void Trk::TrackingVolume::synchronizeLayers(MsgStream& msgstream, double envelope) const { // case a : Layers exist - msgstream << MSG::VERBOSE << " -> synchronizing Layer dimensions of TrackingVolume '" << volumeName() << "'." << endmsg; - const Trk::BinnedArray< Trk::Layer >* confLayers = confinedLayers(); if (confLayers){ - msgstream << MSG::VERBOSE << " ---> working on " << confLayers->arrayObjects().size() << " (material+navigation) layers." << endmsg; for (auto& clayIter : confLayers->arrayObjects()) if (clayIter){ if (clayIter->surfaceRepresentation().type() == Trk::Surface::Cylinder && !(center().isApprox(clayIter->surfaceRepresentation().center())) ) @@ -1231,13 +1236,12 @@ void Trk::TrackingVolume::synchronizeLayers(MsgStream& msgstream, double envelop // case b : container volume -> step down const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes){ - msgstream << MSG::VERBOSE << " ---> no confined layers, working on " << confVolumes->arrayObjects().size() << " confined volumes." << endmsg; for (auto& cVolumesIter : confVolumes->arrayObjects()) cVolumesIter->synchronizeLayers(msgstream, envelope); } } -void Trk::TrackingVolume::compactify(size_t& cSurfaces, size_t& tSurfaces) const { +void Trk::TrackingVolume::compactify ATLAS_NOT_THREAD_SAFE (size_t& cSurfaces, size_t& tSurfaces) const { // confined 'ordered' layers const Trk::BinnedArray< Trk::Layer >* confLayers = confinedLayers(); @@ -1269,6 +1273,5 @@ void Trk::TrackingVolume::screenDump(MsgStream& msg) const msg << "[[ Trk::TrackingVolume ]] called: " << volumeName() << std::endl; msg << '\t' << '\t' << "# position (x,y,z) : " << center().x() << ", " << center().y() << ", " << center().z() << std::endl; msg << '\t' << '\t' << "# bounds : " << volumeBounds() << endmsg; - } diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolumeManipulator.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolumeManipulator.cxx index a1e0aeeadb6f..08534d2666d5 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolumeManipulator.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolumeManipulator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -10,10 +10,10 @@ #include "TrkGeometry/TrackingVolume.h" #include "TrkGeometry/TrackingVolumeManipulator.h" -void Trk::TrackingVolumeManipulator::glueVolumes(const Trk::TrackingVolume& firstVol, - Trk::BoundarySurfaceFace firstFace, - const Trk::TrackingVolume& secondVol, - Trk::BoundarySurfaceFace secondFace) const +void Trk::TrackingVolumeManipulator::glueVolumes ATLAS_NOT_THREAD_SAFE(const Trk::TrackingVolume& firstVol, + Trk::BoundarySurfaceFace firstFace, + const Trk::TrackingVolume& secondVol, + Trk::BoundarySurfaceFace secondFace) const { // check if it is a cylinder volume const Trk::CylinderVolumeBounds* cylBounds = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(firstVol.volumeBounds())); @@ -30,47 +30,47 @@ void Trk::TrackingVolumeManipulator::glueVolumes(const Trk::TrackingVolume& firs ((*secondVol.m_boundarySurfaces))[secondFace]->setOutsideVolume(&secondVol); } -void Trk::TrackingVolumeManipulator::setBoundarySurface(const Trk::TrackingVolume& tvol, - Trk::SharedObject<const Trk::BoundarySurface<Trk::TrackingVolume> > bsurf, - Trk::BoundarySurfaceFace face) const +void Trk::TrackingVolumeManipulator::setBoundarySurface ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::SharedObject<const Trk::BoundarySurface<Trk::TrackingVolume> > bsurf, + Trk::BoundarySurfaceFace face) const { (*(tvol.m_boundarySurfaces))[face] = bsurf; } -void Trk::TrackingVolumeManipulator::setInsideVolume(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - const Trk::TrackingVolume* insidevol) const +void Trk::TrackingVolumeManipulator::setInsideVolume ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + const Trk::TrackingVolume* insidevol) const { ((*tvol.m_boundarySurfaces)[face])->setInsideVolume(insidevol); } -void Trk::TrackingVolumeManipulator::setInsideVolumeArray(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - Trk::BinnedArray<Trk::TrackingVolume>* insidevolarray) const +void Trk::TrackingVolumeManipulator::setInsideVolumeArray ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + Trk::BinnedArray<Trk::TrackingVolume>* insidevolarray) const { ((*tvol.m_boundarySurfaces)[face])->setInsideVolumeArray(Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >(insidevolarray)); } -void Trk::TrackingVolumeManipulator::setInsideVolumeArray(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >insidevolarray) const +void Trk::TrackingVolumeManipulator::setInsideVolumeArray ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >insidevolarray) const { ((*tvol.m_boundarySurfaces)[face])->setInsideVolumeArray(Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >(insidevolarray)); } -void Trk::TrackingVolumeManipulator::setOutsideVolume(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - const Trk::TrackingVolume* outsidevol) const +void Trk::TrackingVolumeManipulator::setOutsideVolume ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + const Trk::TrackingVolume* outsidevol) const { ((*tvol.m_boundarySurfaces)[face])->setOutsideVolume(outsidevol); } -void Trk::TrackingVolumeManipulator::setOutsideVolumeArray(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - Trk::BinnedArray<Trk::TrackingVolume>* outsidevolarray) const +void Trk::TrackingVolumeManipulator::setOutsideVolumeArray ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + Trk::BinnedArray<Trk::TrackingVolume>* outsidevolarray) const { ((*tvol.m_boundarySurfaces)[face])->setOutsideVolumeArray(Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >(outsidevolarray)); } -void Trk::TrackingVolumeManipulator::setOutsideVolumeArray(const Trk::TrackingVolume& tvol, - Trk::BoundarySurfaceFace face, - Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >outsidevolarray) const +void Trk::TrackingVolumeManipulator::setOutsideVolumeArray ATLAS_NOT_THREAD_SAFE (const Trk::TrackingVolume& tvol, + Trk::BoundarySurfaceFace face, + Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >outsidevolarray) const { ((*tvol.m_boundarySurfaces)[face])->setOutsideVolumeArray(Trk::SharedObject<Trk::BinnedArray<Trk::TrackingVolume> >(outsidevolarray)); } -void Trk::TrackingVolumeManipulator::confineVolume(const TrackingVolume& tvol, - const TrackingVolume* outsideVol) const +void Trk::TrackingVolumeManipulator::confineVolume ATLAS_NOT_THREAD_SAFE (const TrackingVolume& tvol, + const TrackingVolume* outsideVol) const { const std::vector< SharedObject<const BoundarySurface<TrackingVolume> > > bounds = tvol.boundarySurfaces(); for (unsigned int ib = 0; ib < bounds.size(); ib++) { -- GitLab