diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt index 6e9681dfe74b7d9f01a69897b78493ba76e99b00..036514cda728ccea37c809f42204f59eb8bcc23f 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/CMakeLists.txt @@ -7,6 +7,7 @@ atlas_subdir( MuonReadoutGeometry ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Control/CxxUtils Control/AthenaBaseComps Control/AthenaKernel DetectorDescription/GeoPrimitives @@ -32,6 +33,6 @@ atlas_add_library( MuonReadoutGeometry src/*.c* PUBLIC_HEADERS MuonReadoutGeometry INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MuonAlignmentData TrkDetElementBase TrkDistortedSurfaces TrkSurfaces MuonIdHelpersLib StoreGateLib GeoModelUtilities + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MuonAlignmentData TrkDetElementBase TrkDistortedSurfaces TrkSurfaces MuonIdHelpersLib StoreGateLib GeoModelUtilities CxxUtils PRIVATE_LINK_LIBRARIES AGDDModel MuonAGDDDescription ) diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscDetectorElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscDetectorElement.h index 53629aa8dff51a4fc605f23596ed0da070e7114a..5bb08e6f1cc8151c3296aba42ac03d5a6f739725 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscDetectorElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscDetectorElement.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 */ /*************************************************************************** @@ -70,7 +70,7 @@ public: const Amg::Vector3D& center(const Identifier& id) const; - const std::vector<const Trk::Surface*>& surfaces() const; + std::vector<const Trk::Surface*> surfaces() const; private: const CscReadoutElement *m_cscre; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscReadoutElement.h index db14a2ae3e0a16269e54ed62c72b0d7ab1ef80a8..242c466753e90e8f7f2b8eb732c283596ded62c3 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/CscReadoutElement.h @@ -77,43 +77,43 @@ namespace MuonGM { /** distance to readout. If the local position is outside the active volume, the function first shift the position back into the active volume */ - inline double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual inline double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip number corresponding to local position. If the local position is outside the active volume, the function first shift the position back into the active volume */ - inline int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual inline int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip position If the strip number is outside the range of valid strips, the function will return false */ - bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const; + virtual bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; /** returns the hash function to be used to look up the center and the normal of the tracking surface for a given identifier */ - inline int layerHash(const Identifier& id) const; + virtual inline int layerHash(const Identifier& id) const override; /** returns the hash function to be used to look up the surface and surface transform for a given identifier */ - inline int surfaceHash(const Identifier& id) const; + virtual inline int surfaceHash(const Identifier& id) const override; /** returns the hash function to be used to look up the surface boundary for a given identifier */ - inline int boundaryHash(const Identifier& id) const; + virtual inline int boundaryHash(const Identifier& id) const override; /** returns whether the given identifier measures phi or not */ - inline bool measuresPhi(const Identifier& id) const; + virtual inline bool measuresPhi(const Identifier& id) const override; /** number of layers in phi/eta projection */ - inline int numberOfLayers( bool ) const; + virtual inline int numberOfLayers( bool ) const override; /** number of strips per layer */ - inline int numberOfStrips( const Identifier& layerId ) const; - inline int numberOfStrips( int layer, bool ) const; + virtual inline int numberOfStrips( const Identifier& layerId ) const override; + virtual inline int numberOfStrips( int layer, bool ) const override; /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi projection. If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const override; /** Global space point position for a given pair of phi and eta identifiers If one of the identifiers is outside the valid range, the function will return false */ - inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const; + virtual inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const override; /** space point position for a pair of phi and eta local positions and a layer identifier The LocalPosition is expressed in the reference frame of the phi projection. @@ -244,13 +244,13 @@ namespace MuonGM { double getGasGapIntAlign_rott(int gasGap) const; - virtual bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; // compute sin(stereo angle) at a given position: double sinStereo(const Identifier & stripId) const; - void fillCache() const; - void refreshCache() const {clearCache(); fillCache();} + virtual void fillCache() override; + virtual void refreshCache() override {clearCache(); fillCache();} double xCoordinateInTrackingFrame( const Identifier& id ) const; private: diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h index f1575b0f4187f3074a72907aea4b5ffc77266bda..ae64d383e8c9a004def288ead8bfc75755ca57c9 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h @@ -44,38 +44,38 @@ namespace MuonGM { ~MMReadoutElement(); /** function to be used to check whether a given Identifier is contained in the readout element */ - bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; /** distance to readout. If the local position is outside the active volume, the function first shift the position back into the active volume */ - double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip number corresponding to local position. If the local position is outside the active volume, the function first shift the position back into the active volume */ - int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip position -- local or global If the strip number is outside the range of valid strips, the function will return false */ - bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const; + virtual bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; bool stripGlobalPosition( const Identifier& id, Amg::Vector3D& gpos ) const; double stripLength( const Identifier& id) const; /** number of layers in phi/eta projection */ - int numberOfLayers( bool ) const; + virtual int numberOfLayers( bool ) const override; /** number of strips per layer */ - int numberOfStrips( const Identifier& layerId ) const; - int numberOfStrips( int , bool measuresPhi ) const; + virtual int numberOfStrips( const Identifier& layerId ) const override; + virtual int numberOfStrips( int , bool measuresPhi ) const override; /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi surface. If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const override; /** Global space point position for a given pair of phi and eta identifiers If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const override; /** space point position for a pair of phi and eta local positions and a layer identifier The LocalPosition is expressed in the reference frame of the phi projection. @@ -89,25 +89,25 @@ namespace MuonGM { /** @brief function to fill tracking cache */ - void fillCache() const; - void refreshCache() const {clearCache(); fillCache();} + virtual void fillCache() override; + virtual void refreshCache() override {clearCache(); fillCache();} /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ - int surfaceHash( const Identifier& id ) const; + virtual int surfaceHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ int surfaceHash( int gasGap, int measPhi) const; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ - int layerHash( const Identifier& id ) const; + virtual int layerHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ int layerHash( int gasGap) const; /** returns the hash function to be used to look up the surface boundary for a given identifier */ - int boundaryHash(const Identifier& id) const; + virtual int boundaryHash(const Identifier& id) const override; /** @brief returns whether the current identifier corresponds to a phi measurement */ - bool measuresPhi(const Identifier& id) const; + virtual bool measuresPhi(const Identifier& id) const override; /** @brief initialize the design classes for this readout element */ void initDesign(double largeY, double smallY, double lengthX, double pitch, double thickness); @@ -127,11 +127,9 @@ namespace MuonGM { inline bool has_ALines() const; inline bool has_BLines() const; void setDelta(double, double, double, double, double, double); //input: translations, rotations - void setBLinePar(BLinePar* bLine) const; - inline void clearBLinePar() const; + void setBLinePar(BLinePar* bLine); + inline void clearBLinePar(); inline const BLinePar* getBLinePar() const { return m_BLinePar;} - void clearBLineCache() const; - void fillBLineCache() const; private: @@ -158,13 +156,13 @@ namespace MuonGM { HepGeom::Transform3D* m_delta; - mutable BLinePar* m_BLinePar; + BLinePar* m_BLinePar; // transforms (RE->layer) Amg::Transform3D m_Xlg[4]; }; - void MMReadoutElement::clearBLinePar() const + void MMReadoutElement::clearBLinePar() { m_BLinePar = 0;} double MMReadoutElement::getALine_rots() const diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtDetectorElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtDetectorElement.h index e4522f0a5e2470817d845330016d20be408fc947..a8f6438deef3dfd7cf2130f5424c0a8c0dd79e17 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtDetectorElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtDetectorElement.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 */ /*************************************************************************** @@ -81,7 +81,7 @@ public: const Amg::Vector3D& center(const Identifier& id) const; - const std::vector<const Trk::Surface*>& surfaces() const; + std::vector<const Trk::Surface*> surfaces() const; unsigned int nMDTinStation() const {return nReadoutElements();} unsigned int nCSCinStation() const {return 0;} @@ -107,9 +107,6 @@ protected: private: const MdtReadoutElement *m_mdtRE[maxMdtREinDE]; unsigned int m_nRE; - - mutable std::vector<const Trk::Surface*> m_detectorSurfaces; - }; } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h index d11d406651c19d0ef5ea8bff6fe888f873df32af..d79e1cb7d71fe3525473ceabe5bf565fdc991448 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.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 */ /*************************************************************************** @@ -11,11 +11,12 @@ #ifndef MUONGEOMODEL_MDTREADOUTELEMENT_H # define MUONGEOMODEL_MDTREADOUTELEMENT_H -//<<<<<< INCLUDES >>>>>> #include "MuonReadoutGeometry/MuonReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "TrkDistortedSurfaces/SaggedLineSurface.h" -//<<<<<< PUBLIC DEFINES >>>>>> +#include "CxxUtils/CachedValue.h" +#include "CxxUtils/CachedUniquePtr.h" + #define maxnlayers 4 #define maxnsteps 10 @@ -82,7 +83,7 @@ public: bool getWireFirstLocalCoordAlongZ(int tubeLayer, double& coord) const; bool getWireFirstLocalCoordAlongR(int tubeLayer, double& coord) const; - virtual bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; // detector specific inline double getTubeLength(int tubeLayer, int tube) const; @@ -151,49 +152,51 @@ public: const Amg::Vector3D tubeFrame_localROPos(Identifier id) const; // defining B-line parameters - /*inline*/ void setBLinePar(BLinePar* bLine) const; - inline void clearBLinePar() const; + /*inline*/ void setBLinePar(BLinePar* bLine); + inline void clearBLinePar(); inline const BLinePar* getBLinePar() const {return m_BLinePar;} //////////////////////////////////////////////////////////// //// Tracking interfaces //////////////////////////////////////////////////////////// - void clearCache() const; - void fillCache() const; - void refreshCache() const {clearCache();} - void clearBLineCache() const; - void fillBLineCache() const; + virtual void clearCache() override; + virtual void fillCache() override; + virtual void refreshCache() override {clearCache();} + void clearBLineCache(); + void fillBLineCache(); //void fillBLineCache() const; - virtual const Trk::Surface& surface() const; - virtual const Trk::SaggedLineSurface& surface(const Identifier& id) const; + virtual const Trk::Surface& surface() const override; + virtual const Trk::SaggedLineSurface& surface(const Identifier& id) const override; virtual const Trk::SaggedLineSurface& surface(int tubeLayer, int tube) const; - virtual const Trk::SurfaceBounds& bounds() const; - virtual const Trk::CylinderBounds& bounds(const Identifier& id) const; + virtual const Trk::SurfaceBounds& bounds() const override; + virtual const Trk::CylinderBounds& bounds(const Identifier& id) const override; virtual const Trk::CylinderBounds& bounds(int tubeLayer, int tube) const; - virtual const Amg::Transform3D& transform(const Identifier&) const; - virtual const Amg::Transform3D& transform(int tubeLayer, int tube) const; - virtual const Amg::Transform3D& transform() const {return absTransform();} + virtual const Amg::Transform3D& transform(const Identifier&) const override; + virtual const Amg::Transform3D& transform(int tubeLayer, int tube) const; + virtual const Amg::Transform3D& transform() const override {return absTransform();} - virtual const Amg::Vector3D& center(const Identifier&) const; + virtual const Amg::Vector3D& center(const Identifier&) const override; virtual const Amg::Vector3D& center(int tubeLayer, int tube) const; - virtual const Amg::Vector3D& center() const; + virtual const Amg::Vector3D& center() const override; - virtual const Amg::Vector3D& normal(const Identifier&) const {return normal();} + virtual const Amg::Vector3D& normal(const Identifier&) const override {return normal();} virtual const Amg::Vector3D tubeNormal(const Identifier&) const; virtual const Amg::Vector3D& normal(int , int ) const {return normal();} virtual const Amg::Vector3D tubeNormal(int, int ) const; - virtual const Amg::Vector3D& normal() const; + virtual const Amg::Vector3D& normal() const override; /** returns all the surfaces contained in this detector element */ - virtual const std::vector<const Trk::Surface*>& surfaces() const; + virtual std::vector<const Trk::Surface*> surfaces() const; // methods handling deformations const Amg::Transform3D& fromIdealToDeformed(const Identifier&) const; const Amg::Transform3D& fromIdealToDeformed(int multilayer, int tubelayer, int tube) const; private: + // Called from MuonChamber + void geoInitDone(); double getTubeLengthForCaching(int tubeLayer, int tube) const; double getNominalTubeLengthWoCutouts(int tubeLayer, int tube) const; @@ -206,8 +209,8 @@ private: void wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, int multilayer, int tubelayer, int tube) const; // methods used only by friend class MdtAlignModule to shift chambers - void shiftTube(const Identifier& id) const; - void restoreTubes() const; + void shiftTube(const Identifier& id); + void restoreTubes(); int m_multilayer; @@ -227,27 +230,39 @@ private: double m_firstwire_y[maxnlayers]; double m_innerRadius; double m_tubeWallThickness; - mutable int m_zsignRO_tubeFrame; // comes from AMDB CRO location in the station - - mutable std::vector<Amg::Transform3D*> * m_deformTransfs; - mutable BLinePar* m_BLinePar; - mutable Amg::Vector3D * m_elemNormal; // one - mutable std::vector<Trk::SaggedLineSurface *> * m_tubeSurfaces; // one per tube - mutable std::vector<Amg::Transform3D *> * m_tubeTransf; // one per tube - mutable std::vector<Amg::Vector3D *> * m_tubeCenter; // one per tube - mutable std::vector<Trk::CylinderBounds *> * m_tubeBounds; // one per step in tube-length - mutable std::vector<Amg::Vector3D *> * m_backupTubeCenter; // one per tube - mutable std::vector<Amg::Transform3D *> * m_backupTubeTransf; // one per tube - mutable std::vector<Amg::Transform3D *> * m_backupDeformTransf; // one per tube - - /** these are all surfaces represented by this detector element : it's for visualization without casting */ - mutable std::vector<const Trk::Surface*> m_elementSurfaces; - - // the single surface information representing the DetElement - mutable Trk::Surface* m_associatedSurface; - mutable Trk::SurfaceBounds* m_associatedBounds; + CxxUtils::CachedValue<int> m_zsignRO_tubeFrame; // comes from AMDB CRO location in the station + const Amg::Transform3D globalTransform (const Amg::Vector3D& tubePos, + const Amg::Transform3D& toDeform) const; + const Amg::Transform3D globalTransform (const Amg::Vector3D& tubePos) const; + struct GeoInfo + { + GeoInfo (const Amg::Transform3D& transform) + : m_transform (transform), + m_center (transform.translation()) + { + } + Amg::Transform3D m_transform; + Amg::Vector3D m_center; + }; + std::unique_ptr<GeoInfo> makeGeoInfo (int tubelayer, int tube) const; + const GeoInfo& geoInfo (int tubeLayer, int tube) const; + Amg::Transform3D deformedTransform (int multilayer, int tubelayer, int tube) const; + + std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_tubeGeo; // one per tube + std::vector<CxxUtils::CachedUniquePtr<GeoInfo> > m_backupTubeGeo; // one per tube + std::vector<CxxUtils::CachedUniquePtr<Amg::Transform3D> > m_deformTransf; // one per tube + std::vector<CxxUtils::CachedUniquePtr<Amg::Transform3D> > m_backupDeformTransf; // one per tube + + BLinePar* m_BLinePar; + CxxUtils::CachedValue<Amg::Vector3D> m_elemNormal; // one + std::vector<CxxUtils::CachedUniquePtr<Trk::SaggedLineSurface> > m_tubeSurfaces; // one per tube + std::vector<CxxUtils::CachedUniquePtr<Trk::CylinderBounds> > m_tubeBounds; // one per step in tube-length + + // the single surface information representing the DetElement + CxxUtils::CachedUniquePtr<Trk::Surface> m_associatedSurface; + CxxUtils::CachedUniquePtr<Trk::SurfaceBounds> m_associatedBounds; }; int MdtReadoutElement::getMultilayer() const @@ -266,7 +281,7 @@ bool MdtReadoutElement::isInBarrel() const {return m_inBarrel;} double MdtReadoutElement::tubePitch() const {return m_tubepitch;} -void MdtReadoutElement::clearBLinePar() const +void MdtReadoutElement::clearBLinePar() {m_BLinePar = 0;} double MdtReadoutElement::getWireLength(int tubeLayer, int tube) const { @@ -285,17 +300,16 @@ double MdtReadoutElement::getActiveTubeLength(int tubeLayer, int tube) const return 2.*(bounds(tubeLayer,tube).halflengthZ()); } -inline const std::vector<const Trk::Surface*>& MdtReadoutElement::surfaces() const { - // create when first time requested and when possible - if (!m_elementSurfaces.size() && ( m_associatedSurface || m_tubeSurfaces ) ){ - if (m_associatedSurface) m_elementSurfaces.push_back(m_associatedSurface); - if (m_tubeSurfaces){ - for (auto& sf : (*m_tubeSurfaces) ) - m_elementSurfaces.push_back(sf); - } +inline std::vector<const Trk::Surface*> MdtReadoutElement::surfaces() const { + std::vector<const Trk::Surface*> elementSurfaces; + elementSurfaces.reserve (m_tubeSurfaces.size() + 1); + if (m_associatedSurface) { + elementSurfaces.push_back(m_associatedSurface.get()); + } + for (const auto& s : m_tubeSurfaces) { + if (s) elementSurfaces.push_back (s.get()); } - // return the element surfaces - return m_elementSurfaces; + return elementSurfaces; } } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonClusterReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonClusterReadoutElement.h index 9a6550e5a1e6a87bde6e08277d75424b73d93a73..c854f9830c96baa15b23acff139edf58a47a936c 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonClusterReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonClusterReadoutElement.h @@ -95,24 +95,24 @@ namespace MuonGM { virtual int numberOfStrips( int layer, bool measuresPhi ) const = 0; /** clear the cache of the readout elememt */ - void clearCache() const; + virtual void clearCache() override; /** fill the cache of the readout element, to be implemented by the concrete implementations */ - virtual void fillCache() const = 0; + virtual void fillCache() override = 0; /** access to chamber surface (phi orientation), uses the first gas gap */ - const Trk::PlaneSurface& surface() const; - const Trk::SurfaceBounds& bounds() const; - const Amg::Vector3D& center() const; - const Amg::Vector3D& normal() const; - const Amg::Transform3D& transform() const; + virtual const Trk::PlaneSurface& surface() const override; + virtual const Trk::SurfaceBounds& bounds() const override; + virtual const Amg::Vector3D& center() const override; + virtual const Amg::Vector3D& normal() const override; + virtual const Amg::Transform3D& transform() const override; /** access to layer surfaces */ - const Trk::PlaneSurface& surface(const Identifier& id) const; - const Trk::SurfaceBounds& bounds(const Identifier& id) const; - const Amg::Vector3D& center(const Identifier& id) const; - const Amg::Vector3D& normal(const Identifier& id) const; - const Amg::Transform3D& transform(const Identifier& id) const; + virtual const Trk::PlaneSurface& surface(const Identifier& id) const override; + virtual const Trk::SurfaceBounds& bounds(const Identifier& id) const override; + virtual const Amg::Vector3D& center(const Identifier& id) const override; + virtual const Amg::Vector3D& normal(const Identifier& id) const override; + virtual const Amg::Transform3D& transform(const Identifier& id) const override; /** access to layer surfaces */ const Trk::PlaneSurface& surface(int surfHash) const; @@ -122,7 +122,7 @@ namespace MuonGM { const Amg::Transform3D& transform(int surfHash) const; /** returns all the surfaces contained in this detector element */ - virtual const std::vector<const Trk::Surface*>& surfaces() const; + virtual std::vector<const Trk::Surface*> surfaces() const; /** returns the hash function to be used to look up the center and the normal of the tracking surface for a given identifier */ virtual int layerHash(const Identifier& id) const = 0; @@ -138,13 +138,10 @@ namespace MuonGM { protected: - void shiftSurface(const Identifier& id) const; - void restoreSurfaces() const; + void shiftSurface(const Identifier& id); + void restoreSurfaces(); - mutable SurfaceData* m_surfaceData; - - /** these are all surfaces represented by this detector element : it's for visualization without casting */ - mutable std::vector<const Trk::Surface*> m_elementSurfaces; + SurfaceData* m_surfaceData; }; inline const Trk::PlaneSurface& MuonClusterReadoutElement::surface() const { return surface(0); } @@ -160,7 +157,7 @@ namespace MuonGM { inline const Amg::Vector3D& MuonClusterReadoutElement::normal(const Identifier& id) const { return normal(layerHash(id) ); } inline const Trk::SurfaceBounds& MuonClusterReadoutElement::bounds(const Identifier& id) const { return bounds(boundaryHash(id)); } - inline void MuonClusterReadoutElement::clearCache() const { + inline void MuonClusterReadoutElement::clearCache() { // clear base cache delete m_surfaceData; m_surfaceData = 0; } @@ -227,12 +224,13 @@ namespace MuonGM { return *m_surfaceData->m_surfBounds[hash]; } - inline const std::vector<const Trk::Surface*>& MuonClusterReadoutElement::surfaces() const { + inline std::vector<const Trk::Surface*> MuonClusterReadoutElement::surfaces() const { + std::vector<const Trk::Surface*> elementSurfaces; // create when first time requested and when possible - if (!m_elementSurfaces.size() && m_surfaceData) - m_elementSurfaces.insert(m_elementSurfaces.begin(), m_surfaceData->m_layerSurfaces.begin(), m_surfaceData->m_layerSurfaces.end()); + if (m_surfaceData) + elementSurfaces.assign(m_surfaceData->m_layerSurfaces.begin(), m_surfaceData->m_layerSurfaces.end()); // return the element surfaces - return m_elementSurfaces; + return elementSurfaces; } } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h index 6f6dcd08ef9c239a7fcd8f97e9e2d8bd4c23f03d..7f2944850ca3c7a0751ca383bd84e985ddda0bf9 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h @@ -80,14 +80,14 @@ namespace MuonGM { void addTreeTop( PVLink); // Add a XxxReadoutElement to the Collection - void addMdtReadoutElement (const MdtReadoutElement*, Identifier);//!< store the MdtReadoutElement using as "key" the identifier - void addRpcReadoutElement (const RpcReadoutElement*, Identifier);//!< store the RpcReadoutElement using as "key" the identifier - void addTgcReadoutElement (const TgcReadoutElement*, Identifier);//!< store the TgcReadoutElement using as "key" the identifier - void addCscReadoutElement (const CscReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier - void addsTgcReadoutElement (const sTgcReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier - void addMMReadoutElement (const MMReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier - void addsTgcReadoutElement_withIdFields (const sTgcReadoutElement*, int iStname, int iStEta, int iStPhi, int imL);//!< store the sTgcReadoutElement using as "key" the identifier - void addMMReadoutElement_withIdFields (const MMReadoutElement*, int iStname, int iStEta, int iStPhi, int imL);//!< store the MMReadoutElement using as "key" the identifier + void addMdtReadoutElement (MdtReadoutElement*, Identifier);//!< store the MdtReadoutElement using as "key" the identifier + void addRpcReadoutElement (RpcReadoutElement*, Identifier);//!< store the RpcReadoutElement using as "key" the identifier + void addTgcReadoutElement (TgcReadoutElement*, Identifier);//!< store the TgcReadoutElement using as "key" the identifier + void addCscReadoutElement (CscReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier + void addsTgcReadoutElement (sTgcReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier + void addMMReadoutElement (MMReadoutElement*, Identifier);//!< store the CscReadoutElement using as "key" the identifier + void addsTgcReadoutElement_withIdFields (sTgcReadoutElement*, int iStname, int iStEta, int iStPhi, int imL);//!< store the sTgcReadoutElement using as "key" the identifier + void addMMReadoutElement_withIdFields (MMReadoutElement*, int iStname, int iStEta, int iStPhi, int imL);//!< store the MMReadoutElement using as "key" the identifier // storeTgcReadoutParams void storeTgcReadoutParams(TgcReadoutParams* x); @@ -110,6 +110,7 @@ namespace MuonGM { const MdtReadoutElement* getMdtReadoutElement(int i1, int i2, int i3, int i4) const; + MdtReadoutElement* getMdtReadoutElement(int i1, int i2, int i3, int i4); //!< access via internally defined array indices; not friendly to users // FIX: New Small Wheel ? No equivalent in .cxx file @@ -120,12 +121,15 @@ namespace MuonGM { // const RpcReadoutElement* getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5) const; + RpcReadoutElement* getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5); //!< access via internally defined array indices; not friendly to users const TgcReadoutElement* getTgcReadoutElement(int i1, int i2, int i3) const; + TgcReadoutElement* getTgcReadoutElement(int i1, int i2, int i3); //!< access via internally defined array indices; not friendly to users const CscReadoutElement* getCscReadoutElement(int i1, int i2, int i3, int i4) const; + CscReadoutElement* getCscReadoutElement(int i1, int i2, int i3, int i4); //!< access via internally defined array indices; not friendly to users @@ -313,42 +317,43 @@ namespace MuonGM { // Add a MuonStation to the list void addMuonStation(MuonStation* mst); - MuonStation* getMuonStation (std::string stName, int eta, int phi) const; + const MuonStation* getMuonStation (std::string stName, int eta, int phi) const; + MuonStation* getMuonStation (std::string stName, int eta, int phi); //<! access to the MuonStation by StationName, Jzz, Jff (amdb indices!!!! not stationPhi and Eta) std::string muonStationKey(std::string stName, int statEtaIndex, int statPhiIndex) const; - void clearCache() const; - void refreshCache() const; - void fillCache() const; + void clearCache(); + void refreshCache(); + void fillCache(); - void clearMdtCache() const; - void clearRpcCache() const; - void clearCscCache() const; - void clearTgcCache() const; + void clearMdtCache(); + void clearRpcCache(); + void clearCscCache(); + void clearTgcCache(); // New Small Wheel - void clearsTgcCache() const; - void clearMMCache() const; + void clearsTgcCache(); + void clearMMCache(); - void refreshMdtCache() const; - void refreshRpcCache() const; - void refreshCscCache() const; - void refreshTgcCache() const; + void refreshMdtCache(); + void refreshRpcCache(); + void refreshCscCache(); + void refreshTgcCache(); // New Small Wheel - void refreshsTgcCache() const; - void refreshMMCache() const; + void refreshsTgcCache(); + void refreshMMCache(); - void fillMdtCache() const; - void fillRpcCache() const; - void fillCscCache() const; - void fillTgcCache() const; + void fillMdtCache(); + void fillRpcCache(); + void fillCscCache(); + void fillTgcCache(); // New Small Wheel - void fillsTgcCache() const; - void fillMMCache() const; + void fillsTgcCache(); + void fillMMCache(); - inline ALineMapContainer * ALineContainer() const; - inline BLineMapContainer * BLineContainer() const; - inline CscInternalAlignmentMapContainer * CscInternalAlignmentContainer() const; - inline MdtAsBuiltMapContainer* MdtAsBuiltContainer() const; + inline const ALineMapContainer * ALineContainer() const; + inline const BLineMapContainer * BLineContainer() const; + inline const CscInternalAlignmentMapContainer * CscInternalAlignmentContainer() const; + inline const MdtAsBuiltMapContainer* MdtAsBuiltContainer() const; inline ciALineMap ALineMapBegin() const; inline ciBLineMap BLineMapBegin() const; inline ciALineMap ALineMapEnd() const; @@ -357,17 +362,21 @@ namespace MuonGM { inline ciCscInternalAlignmentMap CscALineMapEnd() const; inline ciMdtAsBuiltMap MdtAsBuiltMapBegin() const; inline ciMdtAsBuiltMap MdtAsBuiltMapEnd() const; - StatusCode updateAlignment(const ALineMapContainer* a) const; - StatusCode updateDeformations(const BLineMapContainer* a) const; - StatusCode updateAsBuiltParams(const MdtAsBuiltMapContainer* a) const; - StatusCode initCSCInternalAlignmentMap() const; - StatusCode updateCSCInternalAlignmentMap(const CscInternalAlignmentMapContainer* cscIntAline) const; - void initABlineContainers() const; + StatusCode updateAlignment(const ALineMapContainer* a); + StatusCode updateDeformations(const BLineMapContainer* a); + StatusCode updateAsBuiltParams(const MdtAsBuiltMapContainer* a); + StatusCode initCSCInternalAlignmentMap(); + StatusCode updateCSCInternalAlignmentMap(const CscInternalAlignmentMapContainer* cscIntAline); + void initABlineContainers(); // get Mdt AsBuilt parameters for chamber specified by Identifier - MdtAsBuiltPar* getMdtAsBuiltParams(Identifier id); + const MdtAsBuiltPar* getMdtAsBuiltParams(Identifier id) const; private: + void checkRpcReadoutElementIndices(int i1, int i2, int i3, int i4, int i5)const; + void checkTgcReadoutElementIndices(int i1, int i2, int i3)const; + void checkCscReadoutElementIndices(int i1, int i2, int i3, int i4)const; + void checkMdtReadoutElementIndices(int i1, int i2, int i3, int i4)const; int m_cachingFlag; int m_cacheFillingFlag; @@ -404,12 +413,12 @@ namespace MuonGM { const MmIdHelper* m_mmIdHelper; // 115.6 kBytes. - const MdtReadoutElement* m_mdtArray[NMdtStatType][NMdtStatEta][NMdtStatPhi][NMdtMultilayer]; - const CscReadoutElement* m_cscArray[NCscStatType][NCscStatEta][NCscStatPhi][NCscChamberLayer]; - const RpcReadoutElement* m_rpcArray[NRpcStatType][NRpcStatEta][NRpcStatPhi][NDoubletR][NDoubletZ]; - const TgcReadoutElement* m_tgcArray[NTgcStatType][NTgcStatEta][NTgcStatPhi]; - const sTgcReadoutElement* m_stgArray[NsTgStatType][NsTgStatEta][NsTgStatPhi][NsTgChamberLayer]; - const MMReadoutElement* m_mmcArray[NMMcStatType][NMMcStatEta][NMMcStatPhi][NMMcChamberLayer]; + MdtReadoutElement* m_mdtArray[NMdtStatType][NMdtStatEta][NMdtStatPhi][NMdtMultilayer]; + CscReadoutElement* m_cscArray[NCscStatType][NCscStatEta][NCscStatPhi][NCscChamberLayer]; + RpcReadoutElement* m_rpcArray[NRpcStatType][NRpcStatEta][NRpcStatPhi][NDoubletR][NDoubletZ]; + TgcReadoutElement* m_tgcArray[NTgcStatType][NTgcStatEta][NTgcStatPhi]; + sTgcReadoutElement* m_stgArray[NsTgStatType][NsTgStatEta][NsTgStatPhi][NsTgChamberLayer]; + MMReadoutElement* m_mmcArray[NMMcStatType][NMMcStatEta][NMMcStatPhi][NMMcChamberLayer]; // const MdtReadoutElement *m_mdtArrayByHash[MdtRElMaxHash]; const CscReadoutElement *m_cscArrayByHash[CscRElMaxHash]; @@ -442,14 +451,14 @@ namespace MuonGM { CscDetectorElement* m_cscDEArray[CscDetElMaxHash]; // TODO: New Small Wheel - mutable ALineMapContainer * m_aLineContainer; - mutable BLineMapContainer * m_bLineContainer; + ALineMapContainer * m_aLineContainer; + BLineMapContainer * m_bLineContainer; // CscInternalAlignmentMapContainer (pointers) will be created by RDBReaderAccess at the first attempt to store a CscInternalAlignmentPar -rot and transl parameters are held by the CSCredoutElements and the corresponding A-line is provided with this map (key Identifier) by the manager - the manager is responsible to delete the CscInternalAlignmentPar - mutable CscInternalAlignmentMapContainer * m_cscALineContainer; - mutable MdtAsBuiltMapContainer* m_AsBuiltParamsMap; + CscInternalAlignmentMapContainer * m_cscALineContainer; + MdtAsBuiltMapContainer* m_AsBuiltParamsMap; }; - + const MdtIdHelper* MuonDetectorManager::mdtIdHelper() const {return m_mdtIdHelper;} const CscIdHelper* MuonDetectorManager::cscIdHelper() const {return m_cscIdHelper;} const RpcIdHelper* MuonDetectorManager::rpcIdHelper() const {return m_rpcIdHelper;} @@ -539,19 +548,19 @@ namespace MuonGM { unsigned int MuonDetectorManager::nTgcDE() const {return m_n_tgcDE;} // TODO: New Small Wheel - ALineMapContainer* + const ALineMapContainer* MuonDetectorManager::ALineContainer() const {return m_aLineContainer;} - BLineMapContainer* + const BLineMapContainer* MuonDetectorManager::BLineContainer() const {return m_bLineContainer;} - CscInternalAlignmentMapContainer* + const CscInternalAlignmentMapContainer* MuonDetectorManager::CscInternalAlignmentContainer() const {return m_cscALineContainer;} - MdtAsBuiltMapContainer* + const MdtAsBuiltMapContainer* MuonDetectorManager::MdtAsBuiltContainer() const {return m_AsBuiltParamsMap;} diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonPadDesign.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonPadDesign.h index 35a5c18a0ca19301c9514a4a768be2694336a5cf..21ad68890b6a294df617f0a4002cc92c6c621241 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonPadDesign.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonPadDesign.h @@ -51,7 +51,7 @@ namespace MuonGM { double lWidth; double Size; double thickness; - mutable double radialDistance; ///< DT-2015-11-29 distance from the beamline to the center of the module + double radialDistance; ///< DT-2015-11-29 distance from the beamline to the center of the module double sPadWidth; double lPadWidth; @@ -109,7 +109,7 @@ namespace MuonGM { double gasGapThickness() const; /** access to cache */ - void setR( double R) const {this->radialDistance = R; } + void setR( double R) {this->radialDistance = R; } }; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h index 8e4e1bbf729f7ec46c2dd1e14132bc7db3919610..3e88b926e6c27d2ae8baf54b58765a771031a723 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h @@ -18,7 +18,6 @@ #include "GeoPrimitives/CLHEPtoEigenConverter.h" #include "AthenaKernel/CLASS_DEF.h" -//<<<<<< PUBLIC VARIABLES >>>>>> #define maxfieldindex 10 class GeoPhysVol; @@ -157,9 +156,9 @@ public: // This creates a new surface. The client is responsible for deleting it. inline int cachingFlag() const; inline void setCachingFlag(int value); - virtual void clearCache() const = 0; - virtual void fillCache() const = 0; - virtual void refreshCache() const = 0; + virtual void clearCache() = 0; + virtual void fillCache() = 0; + virtual void refreshCache() = 0; const Amg::Transform3D& defTransform(const Identifier&) const {return defTransform();}; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonStation.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonStation.h index 89afed292e333fea9396e39f2a35b698a7537807..1dbd8d361f1fe73b72d1b756fabfa1c5816e72d3 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonStation.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonStation.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 */ #ifndef MuonStation_H @@ -83,6 +83,7 @@ public: void setBlineFixedPointInAmdbLRS(double s0, double z0, double t0); HepGeom::Point3D<double> getBlineFixedPointInAmdbLRS() const; HepGeom::Point3D<double> getUpdatedBlineFixedPointInAmdbLRS() const; + void updateBlineFixedPointInAmdbLRS(); inline void setNativeToAmdbLRS(HepGeom::Transform3D xf); void setNominalAmdbLRSToGlobal(HepGeom::Transform3D xf); void setDeltaAmdbLRS(HepGeom::Transform3D xf); @@ -94,21 +95,22 @@ public: //inline void addMuonReadoutElement(const MuonReadoutElement* a); //inline void addMuonReadoutElement(const MuonReadoutElement* a, int jobIndex); - void addMuonReadoutElementWithAlTransf(const MuonReadoutElement* a, GeoAlignableTransform* ptrsf, int jobIndex); + void addMuonReadoutElementWithAlTransf(MuonReadoutElement* a, GeoAlignableTransform* ptrsf, int jobIndex); const MuonReadoutElement* getMuonReadoutElement(int jobIndex) const; + MuonReadoutElement* getMuonReadoutElement(int jobIndex); GeoAlignableTransform* getComponentAlTransf(int jobIndex) const; inline int nMuonReadoutElements() const; - void clearCache() const; - void refreshCache() const; - void fillCache() const; - void clearBLineCache() const; - void fillBLineCache() const; + void clearCache(); + void refreshCache(); + void fillCache(); + void clearBLineCache(); + void fillBLineCache(); void setBline(BLinePar * bline); inline GeoAlignableTransform* getGeoTransform() const; inline HepGeom::Transform3D getTransform() const; - inline HepGeom::Transform3D* getNativeToAmdbLRS() const; + inline const HepGeom::Transform3D* getNativeToAmdbLRS() const; inline HepGeom::Transform3D getAmdbLRSToGlobal() const; - inline HepGeom::Transform3D* getNominalAmdbLRSToGlobal() const; + inline const HepGeom::Transform3D* getNominalAmdbLRSToGlobal() const; inline double getALine_tras() const; inline double getALine_traz() const; inline double getALine_trat() const; @@ -118,13 +120,13 @@ public: inline bool hasALines() const; inline bool hasBLines() const; inline bool hasMdtAsBuiltParams() const; - MdtAsBuiltPar* getMdtAsBuiltParams() const; - void setMdtAsBuiltParams(MdtAsBuiltPar* xtomo); + const MdtAsBuiltPar* getMdtAsBuiltParams() const; + void setMdtAsBuiltParams(const MdtAsBuiltPar* xtomo); private: //Declaring private message stream member. - mutable bool m_firstRequestBlineFixedP; + bool m_firstRequestBlineFixedP; std::string m_statname; double m_Ssize, m_Rsize, m_Zsize, m_LongSsize, m_LongRsize, m_LongZsize, m_xAmdbCRO; @@ -142,12 +144,12 @@ private: double m_rott; bool m_hasALines; bool m_hasBLines; - mutable HepGeom::Point3D<double> m_BlineFixedPointInAmdbLRS; - MdtAsBuiltPar* m_XTomoData; + HepGeom::Point3D<double> m_BlineFixedPointInAmdbLRS; + const MdtAsBuiltPar* m_XTomoData; //std::map< int, const MuonReadoutElement* > *m_REinStation; //!< keep track of the REs in this station - typedef std::pair<const MuonReadoutElement*, GeoAlignableTransform*> pairRE_AlignTransf; + typedef std::pair<MuonReadoutElement*, GeoAlignableTransform*> pairRE_AlignTransf; std::map< int, pairRE_AlignTransf > *m_REwithAlTransfInStation; //!< keep track of the REs in this station //std::vector<const MuonReadoutElement *> * m_REinStation; //!< keep track of the REs in this station @@ -206,11 +208,11 @@ void MuonStation::setNativeToAmdbLRS(HepGeom::Transform3D xf) else *m_native_to_amdbl = xf; } -HepGeom::Transform3D* +const HepGeom::Transform3D* MuonStation::getNativeToAmdbLRS() const {return m_native_to_amdbl;} -HepGeom::Transform3D* +const HepGeom::Transform3D* MuonStation::getNominalAmdbLRSToGlobal() const {return m_amdbl_to_global;} diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcDetectorElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcDetectorElement.h index 5c80ede93d4fa15952ebda0692f07d36874d33a8..126fe925fc82e9acb57673ac86ae2a6c067ee564 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcDetectorElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcDetectorElement.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 */ /*************************************************************************** @@ -73,7 +73,7 @@ namespace MuonGM { const Amg::Vector3D& center(const Identifier& id) const; - const std::vector<const Trk::Surface*>& surfaces() const; + std::vector<const Trk::Surface*> surfaces() const; enum RpcGMRanges {NDoubletZ = 4}; @@ -84,9 +84,6 @@ namespace MuonGM { const RpcIdHelper* m_helper; int m_ndbz; const RpcReadoutElement* m_rpcVector[NDoubletZ]; - //here is the std::vector of pointers to ReadoutElements in this DetectorElement - - mutable std::vector<const Trk::Surface*> m_detectorSurfaces; }; } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h index 1a1a625e205f5dce74f841768614966466e6388d..6b265327bb2861f5aababb3775762659d87b4d5d 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h @@ -85,7 +85,7 @@ namespace MuonGM { bool hasDEDontop() const; //!< return whether the RPC is 'up-side-down' /** function to be used to check whether a given Identifier is contained in the readout element */ - bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; /** returns whether the RE is in the ribs of the muon spectrometer */ bool inTheRibs() const; @@ -107,32 +107,32 @@ namespace MuonGM { /** distance to readout. If the local position is outside the active volume, the function first shift the position back into the active volume */ - double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip number corresponding to local position. If the local position is outside the active volume, the function first shift the position back into the active volume */ - int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip position If the strip number is outside the range of valid strips, the function will return false */ - bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const; + virtual bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; /** number of layers in phi/eta projection, same for eta/phi planes */ - int numberOfLayers( bool measPhi = true ) const; + virtual int numberOfLayers( bool measPhi = true ) const override; /** number of strips per layer */ - int numberOfStrips( const Identifier& layerId ) const; - int numberOfStrips( int , bool measuresPhi ) const; + virtual int numberOfStrips( const Identifier& layerId ) const override; + virtual int numberOfStrips( int , bool measuresPhi ) const override; /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi surface. If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const override; /** Global space point position for a given pair of phi and eta identifiers If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const override; /** space point position for a pair of phi and eta local positions and a layer identifier The LocalPosition is expressed in the reference frame of the phi projection. @@ -143,25 +143,25 @@ namespace MuonGM { const Amg::Vector3D REcenter() const; /** @brief function to fill tracking cache */ - void fillCache() const; - void refreshCache() const {clearCache(); fillCache();} + virtual void fillCache() override; + virtual void refreshCache() override {clearCache(); fillCache();} /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ - int surfaceHash( const Identifier& id ) const; + int surfaceHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ int surfaceHash( int dbPhi, int gasGap, int measPhi) const; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ - int layerHash( const Identifier& id ) const; + int layerHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ int layerHash( int dbPhi, int gasGap) const; /** returns the hash function to be used to look up the surface boundary for a given identifier */ - int boundaryHash(const Identifier& id) const; + virtual int boundaryHash(const Identifier& id) const override; /** @brief returns whether the current identifier corresponds to a phi measurement */ - bool measuresPhi(const Identifier& id) const; + virtual bool measuresPhi(const Identifier& id) const override; /** @brief initialize the design classes for this readout element */ void initDesign(); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcDetectorElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcDetectorElement.h index d4b6f71844ed091e995a026fa8fb11992f11192c..ed54ef6e4dd3d8bb7b5f4449e017cfa9c13c5766 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcDetectorElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcDetectorElement.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 */ /*************************************************************************** @@ -61,14 +61,12 @@ public: const Amg::Vector3D& center(const Identifier& id) const; - const std::vector<const Trk::Surface*>& surfaces() const; + std::vector<const Trk::Surface*> surfaces() const; // access to the readout-elements in this DetectorElement const TgcReadoutElement* readoutElement() const {return m_tgcre;} void setReadoutElement(const TgcReadoutElement *re) {m_tgcre=re;} - // access to the MuonStation this DetectorElement belongs to - MuonStation* parentMuonStation() const; unsigned int NreadoutElements() const {return 1;} diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h index 1f7ae361563c2b1b7fe577429f3ae7b9e246e7b1..8929b74356d665196303fcbd962b880b8b9c262f 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h @@ -72,46 +72,46 @@ namespace MuonGM { /** distance to readout. If the local position is outside the active volume, the function first shift the position back into the active volume */ - inline double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual inline double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip number corresponding to local position. If the local position is outside the active volume, the function first shift the position back into the active volume */ - inline int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual inline int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip position If the strip number is outside the range of valid strips, the function will return false */ - inline bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const; + virtual inline bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; /** returns the hash function to be used to look up the center and the normal of the tracking surface for a given identifier */ - inline int layerHash(const Identifier& id) const; + virtual inline int layerHash(const Identifier& id) const override; /** returns the hash function to be used to look up the surface and surface transform for a given identifier */ - inline int surfaceHash(const Identifier& id) const; + virtual inline int surfaceHash(const Identifier& id) const override; /** returns the hash function to be used to look up the surface boundary for a given identifier */ - inline int boundaryHash(const Identifier& id) const; + virtual inline int boundaryHash(const Identifier& id) const override; /** returns whether the given identifier measures phi or not */ - inline bool measuresPhi(const Identifier& id) const; + virtual inline bool measuresPhi(const Identifier& id) const override; /** number of layers in phi/eta projection */ - inline int numberOfLayers( bool ) const; + virtual inline int numberOfLayers( bool ) const override; /** number of strips per layer */ - inline int numberOfStrips( const Identifier& layerId ) const; - inline int numberOfStrips( int layer, bool ) const; + virtual inline int numberOfStrips( const Identifier& layerId ) const override; + virtual inline int numberOfStrips( int layer, bool ) const override; /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi projection. If one of the identifiers is outside the valid range, the function will return false */ - inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const; + virtual inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const override; /** Global space point position for a given pair of phi and eta identifiers If one of the identifiers is outside the valid range, the function will return false */ - inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const; + virtual inline bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const override; void setIdentifier(Identifier id); - virtual bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; inline int Ngasgaps () const; inline int NstripPlanes() const; inline int NwirePlanes () const; @@ -265,8 +265,8 @@ namespace MuonGM { inline const TgcReadoutParams* getReadoutParams() const; - void fillCache() const; - void refreshCache() const {clearCache(); fillCache();} + virtual void fillCache() override; + virtual void refreshCache() override {clearCache(); fillCache();} private: diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h index bb89e98d656c6d4f7a48c1a975e2e399becf6719..960de37f960799c84e82ccc1155a32f6dfa685a7 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h @@ -44,15 +44,15 @@ namespace MuonGM { ~sTgcReadoutElement(); /** function to be used to check whether a given Identifier is contained in the readout element */ - bool containsId(Identifier id) const; + virtual bool containsId(Identifier id) const override; /** distance to readout. If the local position is outside the active volume, the function first shift the position back into the active volume */ - double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual double distanceToReadout( const Amg::Vector2D& pos, const Identifier& id ) const override; /** strip number corresponding to local position. Should be renamed to channelNumber : the only public access for all hit types */ - int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const; + virtual int stripNumber( const Amg::Vector2D& pos, const Identifier& id ) const override; /** Channel pitch. Gives full pitch for strips, width of a full wire group Gives the Height of a pad */ @@ -60,7 +60,7 @@ namespace MuonGM { /** strip position - should be renamed to channel position If the strip number is outside the range of valid strips, the function will return false */ - bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const; + virtual bool stripPosition( const Identifier& id, Amg::Vector2D& pos ) const override; /** pad number corresponding to local position */ int padNumber( const Amg::Vector2D& pos, const Identifier& id) const; @@ -72,20 +72,20 @@ namespace MuonGM { bool padCorners ( const Identifier& id, std::vector<Amg::Vector2D> &corners) const; /** number of layers in phi/eta projection */ - int numberOfLayers( bool ) const; + virtual int numberOfLayers( bool ) const override; /** number of strips per layer */ - int numberOfStrips( const Identifier& layerId ) const; - int numberOfStrips( int , bool measuresPhi ) const; + virtual int numberOfStrips( const Identifier& layerId ) const override; + virtual int numberOfStrips( int , bool measuresPhi ) const override; /** space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in the reference frame of the phi surface. If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector2D& pos ) const override; /** Global space point position for a given pair of phi and eta identifiers If one of the identifiers is outside the valid range, the function will return false */ - bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const; + virtual bool spacePointPosition( const Identifier& phiId, const Identifier& etaId, Amg::Vector3D& pos ) const override; /** space point position for a pair of phi and eta local positions and a layer identifier The LocalPosition is expressed in the reference frame of the phi projection. @@ -96,26 +96,26 @@ namespace MuonGM { Amg::Vector3D localToGlobalCoords(Amg::Vector3D locPos, Identifier id) const; /** @brief function to fill tracking cache */ - void fillCache() const; - void refreshCache() const {clearCache(); fillCache();} + virtual void fillCache() override; + virtual void refreshCache() override {clearCache(); fillCache();} /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ - int surfaceHash( const Identifier& id ) const; + virtual int surfaceHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the surface and transform in the MuonClusterReadoutElement tracking cache */ int surfaceHash( int gasGap, int channelType) const; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ - int layerHash( const Identifier& id ) const; + virtual int layerHash( const Identifier& id ) const override; /** @brief returns the hash to be used to look up the normal and center in the MuonClusterReadoutElement tracking cache */ // int layerHash( int gasGap) const; // does not fit in the scheme ( layer hash needs to follow surface hash ) /** returns the hash function to be used to look up the surface boundary for a given identifier */ - int boundaryHash(const Identifier& id) const; + virtual int boundaryHash(const Identifier& id) const override; /** @brief returns whether the current identifier corresponds to a phi measurement */ - bool measuresPhi(const Identifier& id) const; + virtual bool measuresPhi(const Identifier& id) const override; /** @brief initialize the design classes for this readout element */ void initDesign(double largeX, double smallX, double lengthY, double stripPitch, double wirePitch, @@ -129,6 +129,7 @@ namespace MuonGM { /** returns the MuonChannelDesign class for the given identifier */ const MuonPadDesign* getPadDesign( const Identifier& id ) const; + MuonPadDesign* getPadDesign( const Identifier& id ); /** returns the MuonChannelDesign */ const MuonPadDesign* getPadDesign( int gasGap ) const; @@ -147,10 +148,8 @@ namespace MuonGM { inline bool has_ALines() const; inline bool has_BLines() const; void setDelta(double, double, double, double, double, double); - void setBLinePar(BLinePar* bLine) const; - inline void clearBLinePar() const; - void clearBLineCache() const; - void fillBLineCache() const; + void setBLinePar(BLinePar* bLine); + inline void clearBLinePar(); private: @@ -188,13 +187,13 @@ namespace MuonGM { std::vector<double> m_PadminHalfY; std::vector<double> m_PadmaxHalfY; - mutable BLinePar* m_BLinePar; + BLinePar* m_BLinePar; // transforms (RE->layer) Amg::Transform3D m_Xlg[4]; }; - void sTgcReadoutElement::clearBLinePar() const + void sTgcReadoutElement::clearBLinePar() { m_BLinePar = 0;} double sTgcReadoutElement::getALine_rots() const @@ -250,6 +249,11 @@ namespace MuonGM { return 0; } + inline MuonPadDesign* sTgcReadoutElement::getPadDesign( const Identifier& id ) { + if (manager()->stgcIdHelper()->channelType(id)==0) return &(m_padDesign[manager()->stgcIdHelper()->gasGap(id)-1]); + return 0; + } + inline const MuonChannelDesign* sTgcReadoutElement::getDesign( int gasGap, int channelType ) const { if (channelType==1) return &(m_etaDesign[gasGap-1]); if (channelType==2) return &(m_phiDesign[gasGap-1]); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscDetectorElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscDetectorElement.cxx index 3a9d4e369761804f8950ef5f393b899a4dcf7083..48b9b5c4f076c808cc367d167910e19fb01dc45e 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscDetectorElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscDetectorElement.cxx @@ -60,7 +60,7 @@ const Amg::Vector3D& CscDetectorElement::normal(const Identifier& id) const {return m_cscre->normal(id);} -const std::vector<const Trk::Surface*>& CscDetectorElement::surfaces() const +std::vector<const Trk::Surface*> CscDetectorElement::surfaces() const {return m_cscre->surfaces();} } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscReadoutElement.cxx index 247610024812664867d8ebedecc36603087ec3bd..74bdb9d92e137d22046b37e9baefc8441010d95e 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/CscReadoutElement.cxx @@ -856,7 +856,7 @@ CscReadoutElement::originForInternalALines(int gasGap) const } -void CscReadoutElement::fillCache() const +void CscReadoutElement::fillCache() { diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx index cd72282d0345628d25089077031c5d5024a7fc55..ff09a3cee4aa8b7b9622ef5546fe29a71a2e7bd7 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx @@ -265,7 +265,7 @@ namespace MuonGM { } - void MMReadoutElement::fillCache() const + void MMReadoutElement::fillCache() { if( !m_surfaceData ) m_surfaceData = new SurfaceData(); else{ @@ -354,7 +354,7 @@ namespace MuonGM { } } - void MMReadoutElement::setBLinePar(BLinePar* bLine) const + void MMReadoutElement::setBLinePar(BLinePar* bLine) { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MMReadoutElement"); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtDetectorElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtDetectorElement.cxx index 0e3b6d7456b495d58969014baaabdfab0d58fcb7..00f184a2f11c6d0fd53df1e43d0f012d54323d10 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtDetectorElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtDetectorElement.cxx @@ -115,14 +115,15 @@ const Amg::Vector3D& MdtDetectorElement::normal(const Identifier& id) const {return m_mdtRE[0]->normal(id);} -const std::vector<const Trk::Surface*>& MdtDetectorElement::surfaces() const +std::vector<const Trk::Surface*> MdtDetectorElement::surfaces() const { // needs to be created each time because there's no clearCache() method - m_detectorSurfaces.clear(); + std::vector<const Trk::Surface*> detectorSurfaces; for (unsigned int i=0; i<maxMdtREinDE; ++i) { - m_detectorSurfaces.insert(m_detectorSurfaces.end(),m_mdtRE[i]->surfaces().begin(),m_mdtRE[i]->surfaces().end()); + std::vector<const Trk::Surface*> resurf = m_mdtRE[i]->surfaces(); + detectorSurfaces.insert(detectorSurfaces.end(),resurf.begin(),resurf.end()); } - return m_detectorSurfaces; + return detectorSurfaces; } } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx index 5f7854ee22c61022f48de75a5b63cec239a8f0bd..75959d9928cd5f2d6f3df027d8b3c09b488031f6 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx @@ -58,18 +58,7 @@ MdtReadoutElement::MdtReadoutElement(GeoVFullPhysVol* pv, std::string stName, m_nlayers(-1), m_tubepitch(-9999.), m_tubelayerpitch(-9999.), m_ntubesperlayer(-1), m_nsteps(-1), m_ntubesinastep(-1), m_tubelenStepSize(-9999.), m_cutoutShift(-9999.), m_endpluglength(-9999.), m_deadlength(-9999.), m_innerRadius(-9999.), m_tubeWallThickness(-9999.), - m_deformTransfs(0), - m_BLinePar(0), - m_elemNormal(0), - m_tubeSurfaces(0), - m_tubeTransf(0), - m_tubeCenter(0), - m_tubeBounds(0), - m_backupTubeCenter(0), - m_backupTubeTransf(0), - m_backupDeformTransf(0), - m_associatedSurface(0), - m_associatedBounds(0) + m_BLinePar(0) { m_multilayer = 0; @@ -84,58 +73,11 @@ MdtReadoutElement::MdtReadoutElement(GeoVFullPhysVol* pv, std::string stName, if (zi<0 && !is_mirrored) m_descratzneg = true; setStationName(stName); - m_zsignRO_tubeFrame = 0; - - } MdtReadoutElement::~MdtReadoutElement() { - delete m_elemNormal; - delete m_associatedSurface; - delete m_associatedBounds; - - if (m_deformTransfs) { - for (unsigned int tsf = 0; tsf < m_deformTransfs->size(); ++tsf) delete (*m_deformTransfs)[tsf]; - delete m_deformTransfs; - } - - if (m_tubeSurfaces) { - for (unsigned int tsf = 0; tsf < m_tubeSurfaces->size(); ++tsf) delete (*m_tubeSurfaces)[tsf]; - delete m_tubeSurfaces; - } - - if (m_tubeTransf) { - for (unsigned int ttf = 0; ttf < m_tubeTransf->size(); ++ttf) delete (*m_tubeTransf)[ttf]; - delete m_tubeTransf; - } - - if (m_tubeCenter) { - for (unsigned int tcf = 0; tcf < m_tubeCenter->size(); ++tcf) delete (*m_tubeCenter)[tcf]; - delete m_tubeCenter; - } - - if (m_tubeBounds) { - for (unsigned int tcf = 0; tcf < m_tubeBounds->size(); ++tcf) delete (*m_tubeBounds)[tcf]; - delete m_tubeBounds; - } - - if (m_backupTubeTransf) { - for (unsigned int btt = 0; btt < m_backupTubeTransf->size(); ++btt) delete (*m_backupTubeTransf)[btt]; - delete m_backupTubeTransf; - } - - if (m_backupDeformTransf) { - for (unsigned int bdt = 0; bdt < m_backupDeformTransf->size(); ++bdt) delete (*m_backupDeformTransf)[bdt]; - delete m_backupDeformTransf; - } - - if (m_backupTubeCenter) { - for (unsigned int btc = 0; btc < m_backupTubeCenter->size(); ++btc) delete (*m_backupTubeCenter)[btc]; - delete m_backupTubeCenter; - } - } bool MdtReadoutElement::getWireFirstLocalCoordAlongZ(int tubeLayer, double& coord) const @@ -163,6 +105,20 @@ double MdtReadoutElement::outerTubeRadius() const } +void MdtReadoutElement::geoInitDone() +{ + m_tubeGeo.resize (m_nlayers * m_ntubesperlayer); + m_deformTransf.resize (m_nlayers * m_ntubesperlayer); + m_tubeSurfaces.resize (m_nlayers * m_ntubesperlayer); + + int ntot_steps = m_nsteps; + if (hasCutouts() && manager()->MinimalGeoFlag() == 0) { + ntot_steps = m_nlayers * m_ntubesperlayer; + } + m_tubeBounds.resize (ntot_steps); +} + + double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const { const MdtIdHelper* idh = manager()->mdtIdHelper(); @@ -379,7 +335,7 @@ double MdtReadoutElement::signedRODistanceFromTubeCentre(int multilayer, int tub } int amdb_plus_minus1 = 1; - if ( m_zsignRO_tubeFrame == 0 ) + if ( !m_zsignRO_tubeFrame.isValid() ) { const MdtIdHelper* idh = manager()->mdtIdHelper(); Identifier id = idh->channelID(idh->parentID(identify()), multilayer, tubelayer, tube); @@ -390,11 +346,11 @@ double MdtReadoutElement::signedRODistanceFromTubeCentre(int multilayer, int tub Amg::Transform3D amdbToGlobal = Amg::CLHEPTransformToEigen(ms->getAmdbLRSToGlobal()); Amg::Vector3D temGlo = amdbToGlobal*tem; Amg::Vector3D ROtubeFrame = nodeform_globalToLocalCoords(temGlo, id); - if (ROtubeFrame.z()<0) m_zsignRO_tubeFrame = -1; - else m_zsignRO_tubeFrame = 1; + if (ROtubeFrame.z()<0) m_zsignRO_tubeFrame.set (-1); + else m_zsignRO_tubeFrame.set (1); } } - if ( m_zsignRO_tubeFrame == 0) + if ( !m_zsignRO_tubeFrame.isValid()) { // if no CRO in a chamber in AMDB (BIS in layout R), use the standard convention for RO-HV side int sign = 0; if (barrel()) @@ -425,9 +381,9 @@ double MdtReadoutElement::signedRODistanceFromTubeCentre(int multilayer, int tub else sign = 1; } } - m_zsignRO_tubeFrame = sign; + m_zsignRO_tubeFrame.set (sign); } - amdb_plus_minus1 = m_zsignRO_tubeFrame; + amdb_plus_minus1 = *m_zsignRO_tubeFrame.ptr(); if (amdb_plus_minus1 == 0) { MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); @@ -756,6 +712,21 @@ MdtReadoutElement::localToGlobalCoords(Amg::Vector3D x, Identifier id) const return transform(id)*x; } +const Amg::Transform3D +MdtReadoutElement::globalTransform (const Amg::Vector3D& tubePos, + const Amg::Transform3D& toDeform) const +{ + const Amg::Translation3D xfp(tubePos.x(), tubePos.y(), tubePos.z()); + return transform()*toDeform*xfp*Amg::AngleAxis3D(90.*CLHEP::deg,Amg::Vector3D(1.,0.,0.)); +} + +const Amg::Transform3D +MdtReadoutElement::globalTransform (const Amg::Vector3D& tubePos) const +{ + const Amg::Translation3D xfp(tubePos.x(), tubePos.y(), tubePos.z()); + return transform()*xfp*Amg::AngleAxis3D(90.*CLHEP::deg,Amg::Vector3D(1.,0.,0.)); +} + const Amg::Vector3D MdtReadoutElement::nodeform_localToGlobalCoords(Amg::Vector3D x, Identifier id) const { const Amg::Vector3D tp = nodeform_localTubePos(id); @@ -764,25 +735,18 @@ const Amg::Vector3D MdtReadoutElement::nodeform_localToGlobalCoords(Amg::Vector3 } const Amg::Transform3D MdtReadoutElement::localToGlobalTransf(Identifier id) const { - // a point at z=-L/2 goes at y=+L/2 - const Amg::Vector3D tp = nodeform_localTubePos(id); - const Amg::Translation3D xfp(tp.x(), tp.y(), tp.z()); - const Amg::Transform3D toDeform = fromIdealToDeformed(id); - return transform()*toDeform*xfp*Amg::AngleAxis3D(90.*CLHEP::deg,Amg::Vector3D(1.,0.,0.)); + // a point at z=-L/2 goes at y=+L/2 + return globalTransform (nodeform_localTubePos(id), fromIdealToDeformed(id)); } const Amg::Transform3D MdtReadoutElement::localToGlobalTransf(int tubeLayer, int tube) const { // a point at z=-L/2 goes at y=+L/2 - const Amg::Vector3D tp = nodeform_localTubePos(getMultilayer(), tubeLayer, tube); - const Amg::Translation3D xfp(tp.x(), tp.y(), tp.z()); - const Amg::Transform3D toDeform = fromIdealToDeformed(getMultilayer(), tubeLayer, tube); - return transform()*toDeform*xfp*Amg::AngleAxis3D(90.*CLHEP::deg,Amg::Vector3D(1.,0.,0.)); + return globalTransform (nodeform_localTubePos(getMultilayer(), tubeLayer, tube), + fromIdealToDeformed(getMultilayer(), tubeLayer, tube)); } const Amg::Transform3D MdtReadoutElement::nodeform_localToGlobalTransf(Identifier id) const { - const Amg::Vector3D tp = nodeform_localTubePos(id); - const Amg::Translation3D xfp(tp.x(), tp.y(), tp.z()); - return transform()*xfp*Amg::AngleAxis3D(90.*CLHEP::deg,Amg::Vector3D(1.,0.,0.)); + return globalTransform (nodeform_localTubePos(id)); } const Amg::Transform3D @@ -885,6 +849,31 @@ Amg::Vector3D MdtReadoutElement::localNominalTubePosWoCutouts(int tubelayer, int } const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, int tubelayer, int tube) const +{ + size_t itube = (tubelayer-1)*m_ntubesperlayer + tube - 1; + if( itube >= m_deformTransf.size() ) { + MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); + log << MSG::WARNING <<" geoInfo called with tubeLayer or tube out of range in chamber " + << manager()->mdtIdHelper()->print_to_string(m_id) + << " : layer " << tubelayer << " max " << m_nlayers + << " tube " << tube << " max " << m_ntubesperlayer + <<" will compute deformation for first tube in this chamber"<< endmsg; + log << MSG::WARNING <<"Please run in DEBUG mode to get extra diagnostic"<<endmsg; + itube = 0; + } + + const CxxUtils::CachedUniquePtr<Amg::Transform3D>& ptr = m_deformTransf.at (itube); + if (!ptr) { + Amg::Transform3D trans = + deformedTransform (multilayer, tubelayer, tube); + ptr.set (std::make_unique<Amg::Transform3D> (trans)); + } + return *ptr; +} + + +Amg::Transform3D +MdtReadoutElement::deformedTransform (int multilayer, int tubelayer, int tube) const { const MuonStation* ms = parentMuonStation(); HepGeom::Point3D<double> fpp = ms->getUpdatedBlineFixedPointInAmdbLRS(); @@ -898,34 +887,11 @@ const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, ( (!(manager()->applyMdtAsBuiltParams()))|| (!(ms->hasMdtAsBuiltParams())) ) ) { - if (!m_deformTransfs) - { - m_deformTransfs = new std::vector<Amg::Transform3D *>( 1 ); -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE <<"RE "<< idh->show_to_string(identify())<<" created vector of deform-trasf with size 1 - pointer "<<(uintptr_t)m_deformTransfs<<endmsg; -#endif - } - Amg::Transform3D * transf = (*m_deformTransfs)[0]; - if( transf ) return *transf; - transf = new Amg::Transform3D(Amg::Transform3D::Identity()); - (*m_deformTransfs)[0] = transf; -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE <<"RE "<< idh->show_to_string(identify())<<" creating deform-trasf as identity for tLayer, tube "<<tubelayer<<" "<<tube - <<" globalIndex = "<<0<<" pointer "<<(uintptr_t)transf<<endmsg; -#endif - return *transf; + return Amg::Transform3D::Identity(); } int ntot_tubes = m_nlayers * m_ntubesperlayer; - if (!m_deformTransfs ) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE <<"Creating vector of deform-Transformations for RE "<< idh->show_to_string(identify()) - <<" with "<<ntot_tubes << " components"<<endmsg; -#endif - m_deformTransfs = new std::vector<Amg::Transform3D *>( ntot_tubes ); - for (int j=0; j<ntot_tubes; ++j) (*m_deformTransfs)[j] = 0; - } int itube = (tubelayer-1)*m_ntubesperlayer + tube - 1; if (itube>=ntot_tubes) { #ifdef NDEBUG @@ -934,15 +900,6 @@ const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, log << MSG::WARNING <<"global index for tubelayer/tube = "<<tubelayer<<"/"<<tube<<" is "<<itube<<" >=ntot_tubes ="<<ntot_tubes<<" RESETTING global index to 0"<<endmsg; itube = 0; } - Amg::Transform3D * transf = (*m_deformTransfs)[itube]; - if( transf ) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE <<"RE "<< idh->show_to_string(identify()) - <<" reusing deform-trasf for tLayer, tube "<<tubelayer<<" "<<tube<<" globalIndex = "<<itube<<endmsg; -#endif - return *transf; - } - // Chamber parameters double width_narrow = m_Ssize; @@ -1041,15 +998,10 @@ const Amg::Transform3D & MdtReadoutElement::fromIdealToDeformed(int multilayer, rotation_vector_unit = rotation_vector.unit(); const Amg::AngleAxis3D wire_rotation(asin(rotation_vector.mag()),rotation_vector_unit); - transf = new Amg::Transform3D(from_center*wire_rotation*to_center); - (*m_deformTransfs)[itube] = transf; -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE <<"RE "<< idh->show_to_string(identify()) - <<" created deform-trasf for tLayer, tube "<<tubelayer<<" "<<tube<<" globalIndex = "<<itube<<endmsg; -#endif - return *transf; + return Amg::Transform3D(from_center*wire_rotation*to_center); } + Amg::Vector3D MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos, const BLinePar* bLine, const Amg::Vector3D fixedPoint) const { @@ -1123,7 +1075,7 @@ MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos, Amg::Vector3D deformPos(locAMDBPos); - //NOTE s0,z0,t0 are the coord. in the amdb frame of this point: the origine of the frame can be different than the fixed point for deformations s0mdt,z0mdt,t0mdt + //NOTE s0,z0,t0 are the coord. in the amdb frame of this point: the origin of the frame can be different than the fixed point for deformations s0mdt,z0mdt,t0mdt // (always equal to the point at lowest t,z and s=0 of the MDT stack) double s0 = locAMDBPos.x(); double z0 = locAMDBPos.y(); @@ -1145,9 +1097,9 @@ MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos, MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); #endif log << MSG::WARNING - <<"posOnDefChamStraigthWire: correcting the local position of a point outside the mdt station (2 multilayers) volume -- RE " + <<"posOnDefChamWire: correcting the local position of a point outside the mdt station (2 multilayers) volume -- RE " << manager()->mdtIdHelper()->show_to_string(identify()) - <<"local point: szt="<<s0<<" "<<z0<<" "<<t0<<" fixedPoint "<<fixedPoint<<endmsg; + <<" local point: szt="<<s0<<" "<<z0<<" "<<t0<<" fixedPoint "<<fixedPoint<<endmsg; } #ifdef TESTBLINES log << MSG::WARNING<<"** In posOnDefChamWire - correct for offset of B-line fixed point "<<s0mdt<<" "<<z0mdt<<" "<<t0mdt<<" "<<endmsg; @@ -1221,7 +1173,7 @@ MdtReadoutElement::posOnDefChamWire( const Amg::Vector3D& locAMDBPos, // http://atlas-muon-align.web.cern.ch/atlas-muon-align/endplug/asbuilt.pdf void MdtReadoutElement::wireEndpointsAsBuilt(Amg::Vector3D& locAMDBWireEndP, Amg::Vector3D& locAMDBWireEndN, int multilayer, int tubelayer, int tube) const { - MdtAsBuiltPar* params = parentMuonStation()->getMdtAsBuiltParams(); + const MdtAsBuiltPar* params = parentMuonStation()->getMdtAsBuiltParams(); if (!params) { MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); log << MSG::WARNING << "Cannot find Mdt AsBuilt parameters for chamber " @@ -1364,75 +1316,55 @@ MdtReadoutElement::transform(const Identifier & id) const return transform(tubeLayer, tube); } -const Amg::Transform3D & -MdtReadoutElement::transform(int tubeLayer, int tube) const -{ - int ntot_tubes = m_nlayers * m_ntubesperlayer; - int itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1; - if( itube >= ntot_tubes ) { - MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); - log << MSG::WARNING <<" transform called with tubeLayer or tube out of range in chamber " - << manager()->mdtIdHelper()->print_to_string(m_id) - << " : layer " << tubeLayer << " max " << m_nlayers - << " tube " << tube << " max " << m_ntubesperlayer - <<" will compute transform for first tube in this chamber"<< endmsg; - log << MSG::WARNING <<"Please run in DEBUG mode to get extra diagnostic"<<endmsg; - itube = 0; - } - if (m_caching >0) - { - if (!m_tubeTransf) m_tubeTransf = new std::vector<Amg::Transform3D *>( ntot_tubes ); - Amg::Transform3D * transfPtr = (*m_tubeTransf)[itube]; - if (!transfPtr) { - transfPtr = new Amg::Transform3D(localToGlobalTransf(tubeLayer, tube)); - (*m_tubeTransf)[itube] = transfPtr; - } - return *transfPtr; - } - else - { - if (!m_tubeTransf) m_tubeTransf = new std::vector<Amg::Transform3D *>; - Amg::Transform3D * transfPtr = new Amg::Transform3D(localToGlobalTransf(tubeLayer, tube)); - m_tubeTransf->push_back(transfPtr); - return *transfPtr; - } +std::unique_ptr<MdtReadoutElement::GeoInfo> +MdtReadoutElement::makeGeoInfo (int tubelayer, int tube) const +{ + const Amg::Transform3D& toDeformed = fromIdealToDeformed (getMultilayer(), tubelayer, tube); + const Amg::Transform3D transform = globalTransform (nodeform_localTubePos(getMultilayer(), tubelayer, tube), + toDeformed); + return std::make_unique<GeoInfo> (transform); } -void MdtReadoutElement::restoreTubes() const -{ - if (0==m_backupTubeCenter || 0==m_backupTubeTransf) return; - for (int i=0;i<(int)(m_backupTubeCenter->size());i++) { - if (0!=(*m_backupTubeCenter)[i]) { - delete (*m_tubeCenter)[i]; - (*m_tubeCenter)[i]=(*m_backupTubeCenter)[i]; - } +const MdtReadoutElement::GeoInfo& +MdtReadoutElement::geoInfo (int tubeLayer, int tube) const +{ + size_t itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1; + if( itube >= m_tubeGeo.size() ) { + MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); + log << MSG::WARNING <<" geoInfo called with tubeLayer or tube out of range in chamber " + << manager()->mdtIdHelper()->print_to_string(m_id) + << " : layer " << tubeLayer << " max " << m_nlayers + << " tube " << tube << " max " << m_ntubesperlayer + <<" will compute transform for first tube in this chamber"<< endmsg; + log << MSG::WARNING <<"Please run in DEBUG mode to get extra diagnostic"<<endmsg; + itube = 0; } - for (int i=0;i<(int)(m_backupTubeTransf->size());i++) { - if (0!=(*m_backupTubeTransf)[i]) { - delete (*m_tubeTransf)[i]; - (*m_tubeTransf)[i]=(*m_backupTubeTransf)[i]; - } + const CxxUtils::CachedUniquePtr<GeoInfo>& ptr = m_tubeGeo.at (itube); + if (!ptr) { + ptr.set (makeGeoInfo (tubeLayer, tube)); } + return *ptr; +} - for (int i=0;i<(int)(m_backupDeformTransf->size());i++) { - if (0!=(*m_backupDeformTransf)[i]) { - delete (*m_deformTransfs)[i]; - (*m_deformTransfs)[i]=(*m_backupDeformTransf)[i]; - } - } - delete m_backupTubeCenter; m_backupTubeCenter=0; - delete m_backupTubeTransf; m_backupTubeTransf=0; - delete m_backupDeformTransf; m_backupDeformTransf=0; +const Amg::Transform3D & +MdtReadoutElement::transform(int tubeLayer, int tube) const +{ + return geoInfo (tubeLayer, tube).m_transform; +} - return; +void MdtReadoutElement::restoreTubes() +{ + if (m_backupTubeGeo.empty()) return; + m_tubeGeo = std::move (m_backupTubeGeo); + m_deformTransf = std::move (m_backupDeformTransf); } -void MdtReadoutElement::shiftTube(const Identifier& id) const +void MdtReadoutElement::shiftTube(const Identifier& id) { const MdtIdHelper* idh = manager()->mdtIdHelper(); int mlayer = idh->multilayer(id); @@ -1447,39 +1379,21 @@ void MdtReadoutElement::shiftTube(const Identifier& id) const int itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1; - if (0==m_backupTubeCenter) { - m_backupTubeCenter = new std::vector<Amg::Vector3D *>( ntot_tubes ); - m_backupTubeTransf = new std::vector<Amg::Transform3D *>( ntot_tubes ); + if (m_backupTubeGeo.empty()) { + m_backupTubeGeo.resize (ntot_tubes); } - if (0==m_backupDeformTransf && m_deformTransfs) { - unsigned int sizeDeformTransf = m_deformTransfs->size(); - m_backupDeformTransf = new std::vector<Amg::Transform3D *>( sizeDeformTransf ); - } - - // new tube transform (must be done before transform() called) - if (0==(*m_backupTubeTransf)[itube]) { - (*m_backupTubeTransf)[itube]=(*m_tubeTransf)[itube]; - (*m_tubeTransf)[itube]= new Amg::Transform3D(localToGlobalTransf(tubeLayer,tube)); + if (!m_backupTubeGeo[itube]) { + m_backupTubeGeo[itube].store (m_tubeGeo[itube].release()); + m_tubeGeo[itube].store (makeGeoInfo (tubeLayer, tube)); } - // new tube center - if (0==(*m_backupTubeCenter)[itube]) { - - (*m_backupTubeCenter)[itube]=(*m_tubeCenter)[itube]; - - // double wireTension = 350.; - // if (getStationName().substr(0,3) == "BOL") wireTension = 285.; - (*m_tubeCenter)[itube]= new Amg::Vector3D(transform(tubeLayer,tube)*Amg::Vector3D(0.,0.,0.)); + if (m_backupDeformTransf.empty()) { + m_backupDeformTransf.resize (ntot_tubes); } - // new deformation transform - if (m_deformTransfs) { - int jtube=(m_deformTransfs->size()==1) ? 0 : itube; - if (0==(*m_backupDeformTransf)[jtube]) { - (*m_backupDeformTransf)[jtube]=(*m_deformTransfs)[jtube]; - (*m_deformTransfs)[jtube]=0; - } + if (!m_backupDeformTransf[itube]) { + m_backupDeformTransf[itube].store (m_deformTransf[itube].release()); } return; @@ -1492,7 +1406,6 @@ MdtReadoutElement::surface (int tubeLayer, int tube) const Identifier id = idh->channelID(idh->parentID(identify()), getMultilayer(), tubeLayer, tube); int ntot_tubes = m_nlayers * m_ntubesperlayer; - if (!m_tubeSurfaces) m_tubeSurfaces = new std::vector<Trk::SaggedLineSurface *>( ntot_tubes ); int itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1; // consistency checks if( itube >= ntot_tubes ) { @@ -1506,28 +1419,14 @@ MdtReadoutElement::surface (int tubeLayer, int tube) const itube = 0; } - if (m_caching >0) - { - if (!m_tubeSurfaces) m_tubeSurfaces = new std::vector<Trk::SaggedLineSurface *>( ntot_tubes ); - Trk::SaggedLineSurface * surfacePtr = (*m_tubeSurfaces)[itube]; - if (!surfacePtr) { - double wireTension = 350.; - if (getStationName().substr(0,3) == "BOL") wireTension = 285.; - surfacePtr = new Trk::SaggedLineSurface(*this, id, getWireLength(tubeLayer, tube), wireTension, linearDensity); - (*m_tubeSurfaces)[itube] = surfacePtr; - } - return *surfacePtr; - } - else - { - if (!m_tubeSurfaces) m_tubeSurfaces = new std::vector<Trk::SaggedLineSurface *>; - double wireTension = 350.; - if (getStationName().substr(0,3) == "BOL") wireTension = 285.; - Trk::SaggedLineSurface * surfacePtr = - new Trk::SaggedLineSurface(*this, id, getWireLength(tubeLayer, tube), wireTension, linearDensity); - m_tubeSurfaces->push_back(surfacePtr); - return *surfacePtr; + const CxxUtils::CachedUniquePtr<Trk::SaggedLineSurface>& ptr = + m_tubeSurfaces.at(itube); + if (!ptr) { + double wireTension = 350.; + if (getStationName().substr(0,3) == "BOL") wireTension = 285.; + ptr.set (std::make_unique<Trk::SaggedLineSurface>(*this, id, getWireLength(tubeLayer, tube), wireTension, linearDensity)); } + return *ptr; } const Trk::SaggedLineSurface& MdtReadoutElement::surface (const Identifier& id) const @@ -1578,28 +1477,13 @@ MdtReadoutElement::bounds(int tubeLayer, int tube) const } } - if (m_caching >0) - { - if (!m_tubeBounds) m_tubeBounds = new std::vector<Trk::CylinderBounds *>( ntot_steps ); - Trk::CylinderBounds * boundsPtr = (*m_tubeBounds)[istep]; - if (!boundsPtr) { - double tubelength = getTubeLengthForCaching(tubeLayer, tube); - boundsPtr = new Trk::CylinderBounds(innerTubeRadius(), 0.5*tubelength - m_deadlength); - (*m_tubeBounds)[istep] = boundsPtr; - } - else - { - } - return *boundsPtr; - } - else - { - if (!m_tubeBounds) m_tubeBounds = new std::vector<Trk::CylinderBounds *>; - double tubelength = getTubeLengthForCaching(tubeLayer, tube); - Trk::CylinderBounds * boundsPtr = new Trk::CylinderBounds(innerTubeRadius(), 0.5*tubelength - m_deadlength); - m_tubeBounds->push_back(boundsPtr); - return *boundsPtr; + const CxxUtils::CachedUniquePtr<Trk::CylinderBounds>& ptr = + m_tubeBounds.at(istep); + if (!ptr) { + double tubelength = getTubeLengthForCaching(tubeLayer, tube); + ptr.set (std::make_unique<Trk::CylinderBounds>(innerTubeRadius(), 0.5*tubelength - m_deadlength)); } + return *ptr; } const Trk::CylinderBounds & MdtReadoutElement::bounds(const Identifier& id) const @@ -1650,47 +1534,15 @@ MdtReadoutElement::center (const Identifier& id) const const Amg::Vector3D& MdtReadoutElement::center (int tubeLayer, int tube) const { - int ntot_tubes = m_nlayers * m_ntubesperlayer; - int itube = (tubeLayer-1)*m_ntubesperlayer + tube - 1; - // consistency checks - if( itube >= ntot_tubes ) { - MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); - log << MSG::WARNING <<"center called with tubeLayer or tube out of range in chamber " - << manager()->mdtIdHelper()->print_to_string(m_id) - << " : layer " << tubeLayer << " max " << m_nlayers - << " tube " << tube << " max " << m_ntubesperlayer - <<" will compute center for first tube in this chamber"<< endmsg; - log << MSG::WARNING <<"Please run in DEBUG mode to get extra diagnostic"<<endmsg; - itube = 0; - } - - - if (m_caching>0) - { - if (!m_tubeCenter) m_tubeCenter = new std::vector<Amg::Vector3D *>( ntot_tubes ); - Amg::Vector3D * centerPtr = (*m_tubeCenter)[itube]; - if (!centerPtr) { - centerPtr = new Amg::Vector3D(transform(tubeLayer, tube)*Amg::Vector3D(0.,0.,0.)); - (*m_tubeCenter)[itube] = centerPtr; - } - return *centerPtr; - } - else - { - if (!m_tubeCenter) m_tubeCenter = new std::vector<Amg::Vector3D *>; - Amg::Vector3D * centerPtr = new Amg::Vector3D(transform(tubeLayer, tube)*Amg::Vector3D(0.,0.,0.)); - m_tubeCenter->push_back(centerPtr); - return *centerPtr; - } + return geoInfo (tubeLayer, tube).m_center; } const Amg::Vector3D& MdtReadoutElement::normal () const { - if (!m_elemNormal) - { - m_elemNormal = new Amg::Vector3D( transform().linear()*Amg::Vector3D(1.,0.,0.) ); + if (!m_elemNormal.isValid()) { + m_elemNormal.set (Amg::Vector3D( transform().linear()*Amg::Vector3D(1.,0.,0.)) ); } - return *m_elemNormal; + return *m_elemNormal.ptr(); } const Amg::Vector3D @@ -1719,14 +1571,17 @@ MdtReadoutElement::surface() const trans3D.pretranslate(transform().translation()); if (MuonReadoutElement::barrel()){ - m_associatedSurface = new Trk::PlaneSurface(new Amg::Transform3D(trans3D), - MuonReadoutElement::getSsize()/2., - MuonReadoutElement::getZsize()/2.); - } else { - m_associatedSurface = new Trk::PlaneSurface(new Amg::Transform3D(trans3D), - MuonReadoutElement::getSsize()/2., - MuonReadoutElement::getLongSsize()/2., - MuonReadoutElement::getRsize()/2.); + m_associatedSurface.set + (std::make_unique<Trk::PlaneSurface>(new Amg::Transform3D(trans3D), + MuonReadoutElement::getSsize()/2., + MuonReadoutElement::getZsize()/2.)); + } + else { + m_associatedSurface.set + (std::make_unique<Trk::PlaneSurface>(new Amg::Transform3D(trans3D), + MuonReadoutElement::getSsize()/2., + MuonReadoutElement::getLongSsize()/2., + MuonReadoutElement::getRsize()/2.)); } } return *m_associatedSurface; @@ -1741,20 +1596,23 @@ MdtReadoutElement::center() const const Trk::SurfaceBounds& MdtReadoutElement::bounds() const { - if (!m_associatedBounds){ + if (!m_associatedBounds){ if (MuonReadoutElement::barrel()){ - m_associatedBounds = new Trk::RectangleBounds(MuonReadoutElement::getSsize()/2., - MuonReadoutElement::getZsize()/2.); - } else { - m_associatedBounds = new Trk::TrapezoidBounds(MuonReadoutElement::getSsize()/2., - MuonReadoutElement::getLongSsize()/2., - MuonReadoutElement::getRsize()/2.); - } - } - return (*m_associatedBounds); + m_associatedBounds.set + (std::make_unique<Trk::RectangleBounds>(MuonReadoutElement::getSsize()/2., + MuonReadoutElement::getZsize()/2.)); + } + else { + m_associatedBounds.set + (std::make_unique<Trk::TrapezoidBounds> (MuonReadoutElement::getSsize()/2., + MuonReadoutElement::getLongSsize()/2., + MuonReadoutElement::getRsize()/2.)); + } + } + return *m_associatedBounds; } -void MdtReadoutElement::fillBLineCache() const +void MdtReadoutElement::fillBLineCache() { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); @@ -1767,35 +1625,19 @@ void MdtReadoutElement::fillBLineCache() const } } } -void MdtReadoutElement::clearBLineCache() const +void MdtReadoutElement::clearBLineCache() { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Clearing BLine cache for ReadoutElement "<<getStationName()<<"/"<<getTechnologyName() - <<" eta/phi "<<getStationEta()<<"/"<<getStationPhi() <<" ml "<<m_multilayer<<" pointer to vector or deform-transfs "<<(uintptr_t)m_deformTransfs<<endmsg; -#endif - if (m_deformTransfs) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"non null pointer to the vector of deform-transfs"<<endmsg; -#endif - if (!m_deformTransfs->empty()) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"vector of deform-transfs has size "<< m_deformTransfs->size()<<endmsg; -#endif - for (unsigned int tsf = 0; tsf < m_deformTransfs->size(); ++tsf) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"vector of deform-transfs - going to delete component "<<tsf<< m_deformTransfs->size()<<endmsg; + <<" eta/phi "<<getStationEta()<<"/"<<getStationPhi() <<" ml "<<m_multilayer<<endmsg; #endif - delete (*m_deformTransfs)[tsf]; - (*m_deformTransfs)[tsf] = nullptr; - } - } - delete m_deformTransfs; - m_deformTransfs=nullptr; + for (auto& d : m_deformTransf) { + d.release(); } } -void MdtReadoutElement::clearCache() const +void MdtReadoutElement::clearCache() { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); @@ -1803,8 +1645,7 @@ void MdtReadoutElement::clearCache() const <<" eta/phi "<<getStationEta()<<"/"<<getStationPhi() <<" ml "<<m_multilayer<<endmsg; #endif if (m_associatedSurface) { - delete m_associatedSurface; - m_associatedSurface=nullptr; + m_associatedSurface.release(); } #ifndef NDEBUG else { @@ -1812,155 +1653,28 @@ void MdtReadoutElement::clearCache() const } #endif if (m_associatedBounds) { - delete m_associatedBounds; - m_associatedBounds=nullptr; + m_associatedBounds.release(); } #ifndef NDEBUG else { if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated bounds to be deleted"<<endmsg; } #endif - if (m_elemNormal) { - delete m_elemNormal; - m_elemNormal=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated normal to be deleted"<<endmsg; - } -#endif - if (m_tubeSurfaces) { - if (!m_tubeSurfaces->empty()) { -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"size of vector m_tubeSurfaces "<<m_tubeSurfaces->size()<<endmsg; -#endif - for (unsigned int i=0; i<m_tubeSurfaces->size(); ++i) { - if ( (*m_tubeSurfaces)[i] ) { - delete (*m_tubeSurfaces)[i]; - (*m_tubeSurfaces)[i]=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated surface at index "<<i<<" to be deleted "<<endmsg; - } -#endif - } -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"size of vector m_tubeSurfaces "<<m_tubeSurfaces->size()<<endmsg; -#endif - m_tubeSurfaces->clear(); - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Empty vector m_tubeSurfaces"<<endmsg; - } -#endif - delete m_tubeSurfaces; - m_tubeSurfaces=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Never allocated memory for m_tubeSurfaces"<<endmsg; - } -#endif - if (m_tubeTransf) { - if (!m_tubeTransf->empty()) { - for (unsigned int i=0; i<m_tubeTransf->size(); ++i) { - if ( (*m_tubeTransf)[i] ) { - delete (*m_tubeTransf)[i]; - (*m_tubeTransf)[i]=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated transform at index "<<i<<" to be deleted "<<endmsg; - } -#endif - } -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"size of vector m_tubeTransf is "<<m_tubeTransf->size()<<endmsg; -#endif - m_tubeTransf->clear(); - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Empty vector m_tubeTransf"<<endmsg; - } -#endif - delete m_tubeTransf; - m_tubeTransf=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Never allocated memory for m_tubeTransf"<<endmsg; - } -#endif - if (m_tubeCenter) { - if (!m_tubeCenter->empty()) { - for (unsigned int i=0; i<m_tubeCenter->size(); ++i) { - if ((*m_tubeCenter)[i]) { - delete (*m_tubeCenter)[i]; - (*m_tubeCenter)[i]=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated tube center at index "<<i<<" to be deleted "<<endmsg; - } -#endif - } -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"size of vector m_tubeCenter is "<<m_tubeCenter->size()<<endmsg; -#endif - m_tubeCenter->clear(); - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Empty vector m_tubeCenter"<<endmsg; - } -#endif - delete m_tubeCenter; - m_tubeCenter=nullptr; + m_elemNormal.reset(); + for (auto& s : m_tubeSurfaces) { + s.release(); } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Never allocated memory for m_tubeCenter"<<endmsg; + for (auto& g : m_tubeGeo) { + g.release(); } -#endif - if (m_tubeBounds) { - if (!m_tubeBounds->empty()) { - for (unsigned int i=0; i<m_tubeBounds->size(); ++i) { - if ((*m_tubeBounds)[i]) { - delete (*m_tubeBounds)[i]; - (*m_tubeBounds)[i]=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"no associated tube bounds at index "<<i<<" to be deleted "<<endmsg; - } -#endif - } -#ifndef NDEBUG - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"size of vector m_tubeBounds is "<<m_tubeBounds->size()<<endmsg; -#endif - m_tubeBounds->clear(); - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Empty vector m_tubeBounds"<<endmsg; - } -#endif - delete m_tubeBounds; - m_tubeBounds=nullptr; - } -#ifndef NDEBUG - else { - if (log.level()<=MSG::VERBOSE) log << MSG::VERBOSE<<"Never allocated memory for m_tubeBounds"<<endmsg; + for (auto& b : m_tubeBounds) { + b.release(); } -#endif // reset here the deform-related transforms clearBLineCache(); } -void MdtReadoutElement::setBLinePar(BLinePar* bLine) const +void MdtReadoutElement::setBLinePar(BLinePar* bLine) { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); @@ -1969,7 +1683,7 @@ void MdtReadoutElement::setBLinePar(BLinePar* bLine) const m_BLinePar = bLine; } -void MdtReadoutElement::fillCache() const +void MdtReadoutElement::fillCache() { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"MdtReadoutElement"); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonClusterReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonClusterReadoutElement.cxx index af643ea9559efc847eca622ab05c5784eafabef6..ae0f56d3d17147e0efc3b3c90731fd08c1ccd710 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonClusterReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonClusterReadoutElement.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 */ #include "MuonReadoutGeometry/MuonClusterReadoutElement.h" @@ -21,11 +21,11 @@ namespace MuonGM { } - void MuonClusterReadoutElement::shiftSurface(const Identifier&) const{ + void MuonClusterReadoutElement::shiftSurface(const Identifier&){ fillCache(); } - void MuonClusterReadoutElement::restoreSurfaces() const { + void MuonClusterReadoutElement::restoreSurfaces() { delete m_surfaceData; fillCache(); } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx index e55a97600e229f07886e5ee7589a3eb18d4722bc..bb555630f97bb514d81222e7e0cd1ad6da491eb5 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx @@ -224,7 +224,7 @@ MuonDetectorManager::~MuonDetectorManager() { } -void MuonDetectorManager::clearCache() const +void MuonDetectorManager::clearCache() { clearMdtCache(); clearRpcCache(); @@ -232,46 +232,46 @@ void MuonDetectorManager::clearCache() const clearCscCache(); } -void MuonDetectorManager::refreshCache() const +void MuonDetectorManager::refreshCache() { refreshMdtCache(); refreshRpcCache(); refreshTgcCache(); refreshCscCache(); } -void MuonDetectorManager::refreshMdtCache() const +void MuonDetectorManager::refreshMdtCache() { clearMdtCache(); // NEED to fill since FillCacheInitTime = 1 is the default now. fillMdtCache(); } -void MuonDetectorManager::refreshRpcCache() const +void MuonDetectorManager::refreshRpcCache() { clearRpcCache(); fillRpcCache(); } -void MuonDetectorManager::refreshTgcCache() const +void MuonDetectorManager::refreshTgcCache() { clearTgcCache(); fillTgcCache(); } -void MuonDetectorManager::refreshCscCache() const +void MuonDetectorManager::refreshCscCache() { clearCscCache(); fillCscCache(); } -void MuonDetectorManager::refreshMMCache() const +void MuonDetectorManager::refreshMMCache() { clearMMCache(); fillMMCache(); } -void MuonDetectorManager::refreshsTgcCache() const +void MuonDetectorManager::refreshsTgcCache() { clearsTgcCache(); fillsTgcCache(); } -void MuonDetectorManager::clearMdtCache() const +void MuonDetectorManager::clearMdtCache() { for (unsigned int i=0; i<NMdtStatType; ++i) for (unsigned int j=0; j<NMdtStatEta; ++j) @@ -280,7 +280,7 @@ void MuonDetectorManager::clearMdtCache() const if (m_mdtArray[i][j][k][l]) m_mdtArray[i][j][k][l]->clearCache(); } } -void MuonDetectorManager::clearRpcCache() const +void MuonDetectorManager::clearRpcCache() { for (unsigned int i=0; i<NRpcStatType; ++i) for (unsigned int j=0; j<NRpcStatEta; ++j) @@ -290,7 +290,7 @@ void MuonDetectorManager::clearRpcCache() const if( m_rpcArray[i][j][k][l][h] ) m_rpcArray[i][j][k][l][h]->clearCache() ; } } -void MuonDetectorManager::clearTgcCache() const +void MuonDetectorManager::clearTgcCache() { for (unsigned int i=0; i<NTgcStatType; ++i) for (unsigned int j=0; j<NTgcStatEta; ++j) @@ -298,7 +298,7 @@ void MuonDetectorManager::clearTgcCache() const if ( m_tgcArray[i][j][k] ) m_tgcArray[i][j][k]->clearCache(); } } -void MuonDetectorManager::clearCscCache() const +void MuonDetectorManager::clearCscCache() { if (nCscRE()<1) return; for (unsigned int i=0; i<NCscStatType; ++i) @@ -308,7 +308,7 @@ void MuonDetectorManager::clearCscCache() const if( m_cscArray[i][j][k][l] ) m_cscArray[i][j][k][l]->clearCache(); } } -void MuonDetectorManager::clearMMCache() const +void MuonDetectorManager::clearMMCache() { if (nMMRE()<1) return; for (unsigned int i=0; i<NMMcStatType; ++i) @@ -318,7 +318,7 @@ void MuonDetectorManager::clearMMCache() const if (m_mmcArray[i][j][k][l]) m_mmcArray[i][j][k][l]->clearCache(); } } -void MuonDetectorManager::clearsTgcCache() const +void MuonDetectorManager::clearsTgcCache() { if (nsTgcRE()<1) return; for (unsigned int i=0; i<NsTgStatType; ++i) @@ -328,7 +328,7 @@ void MuonDetectorManager::clearsTgcCache() const if (m_stgArray[i][j][k][l]) m_stgArray[i][j][k][l]->clearCache(); } } -void MuonDetectorManager::fillMMCache() const +void MuonDetectorManager::fillMMCache() { if (nMMRE()<1) return; for (unsigned int i=0; i<NMMcStatType; ++i) @@ -338,7 +338,7 @@ void MuonDetectorManager::fillMMCache() const if (m_mmcArray[i][j][k][l]) m_mmcArray[i][j][k][l]->fillCache(); } } -void MuonDetectorManager::fillsTgcCache() const +void MuonDetectorManager::fillsTgcCache() { if (nsTgcRE()<1) return; for (unsigned int i=0; i<NsTgStatType; ++i) @@ -348,7 +348,7 @@ void MuonDetectorManager::fillsTgcCache() const if (m_stgArray[i][j][k][l]) m_stgArray[i][j][k][l]->fillCache(); } } -void MuonDetectorManager::fillCache() const +void MuonDetectorManager::fillCache() { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); log<<MSG::INFO<<"Filling cache"<<endmsg; @@ -357,7 +357,7 @@ void MuonDetectorManager::fillCache() const fillTgcCache(); fillCscCache(); } -void MuonDetectorManager::fillMdtCache() const +void MuonDetectorManager::fillMdtCache() { for (unsigned int i=0; i<NMdtStatType; ++i) for (unsigned int j=0; j<NMdtStatEta; ++j) @@ -366,7 +366,7 @@ void MuonDetectorManager::fillMdtCache() const if (m_mdtArray[i][j][k][l]) m_mdtArray[i][j][k][l]->fillCache(); } } -void MuonDetectorManager::fillRpcCache() const +void MuonDetectorManager::fillRpcCache() { for (unsigned int i=0; i<NRpcStatType; ++i) for (unsigned int j=0; j<NRpcStatEta; ++j) @@ -376,7 +376,7 @@ void MuonDetectorManager::fillRpcCache() const if( m_rpcArray[i][j][k][l][h] ) m_rpcArray[i][j][k][l][h]->fillCache() ; } } -void MuonDetectorManager::fillTgcCache() const +void MuonDetectorManager::fillTgcCache() { for (unsigned int i=0; i<NTgcStatType; ++i) for (unsigned int j=0; j<NTgcStatEta; ++j) @@ -384,7 +384,7 @@ void MuonDetectorManager::fillTgcCache() const if ( m_tgcArray[i][j][k] ) m_tgcArray[i][j][k]->fillCache(); } } -void MuonDetectorManager::fillCscCache() const +void MuonDetectorManager::fillCscCache() { if (nCscRE()<1) return; for (unsigned int i=0; i<NCscStatType; ++i) @@ -430,7 +430,7 @@ MuonDetectorManager::muonStationKey(std::string stName, int statEtaIndex, int st return key; } -MuonStation* +const MuonStation* MuonDetectorManager::getMuonStation(std::string stName, int stEtaIndex, int stPhiIndex) const { @@ -441,7 +441,18 @@ MuonDetectorManager::getMuonStation(std::string stName, int stEtaIndex, int stPh else return nullptr; } -void MuonDetectorManager::addRpcReadoutElement (const RpcReadoutElement* x, Identifier id) +MuonStation* +MuonDetectorManager::getMuonStation(std::string stName, int stEtaIndex, int stPhiIndex) +{ + + std::string key = muonStationKey(stName, stEtaIndex, stPhiIndex); + + std::map< std::string, MuonStation *>::const_iterator it = m_MuonStationMap.find(key); + if ( it != m_MuonStationMap.end()) return (*it).second; + else return nullptr; +} + +void MuonDetectorManager::addRpcReadoutElement (RpcReadoutElement* x, Identifier id) { // check if RE has id as identity if (id!=x->identify()) { @@ -623,7 +634,7 @@ const MMReadoutElement* MuonDetectorManager::getMMRElement_fromIdFields (int i return m_mmcArray[stname_index][steta_index][stphi_index][ml_index]; } -void MuonDetectorManager::addMMReadoutElement_withIdFields (const MMReadoutElement* x, int iStname, int iStEta, int iStPhi, int imL) +void MuonDetectorManager::addMMReadoutElement_withIdFields (MMReadoutElement* x, int iStname, int iStEta, int iStPhi, int imL) { int stname_index = iStname; int steta_index = iStEta+NMMcStEtaOffset; @@ -654,7 +665,7 @@ void MuonDetectorManager::addMMReadoutElement_withIdFields (const MMReadoutEle m_n_mmcRE++; } -void MuonDetectorManager::addsTgcReadoutElement_withIdFields (const sTgcReadoutElement* x, int iStname, int iStEta, int iStPhi, int imL) +void MuonDetectorManager::addsTgcReadoutElement_withIdFields (sTgcReadoutElement* x, int iStname, int iStEta, int iStPhi, int imL) { int stname_index = iStname; int steta_index = iStEta+NsTgStEtaOffset; @@ -710,19 +721,19 @@ const sTgcReadoutElement* MuonDetectorManager::getsTgcRElement_fromIdFields (i return m_stgArray[stname_index][steta_index][stphi_index][ml_index]; } -void MuonDetectorManager::addMMReadoutElement (const MMReadoutElement* x, Identifier id) +void MuonDetectorManager::addMMReadoutElement (MMReadoutElement* x, Identifier id) { if (id!=x->identify()) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::addMMReadoutElement() - Trying to add MMReadoutElement with id %s not matching the id assigned to the MMReadoutElement %s", __FILE__, __LINE__, m_mmIdHelper->show_to_string(id).c_str(), m_mmIdHelper->show_to_string(x->identify()).c_str())); } } -void MuonDetectorManager::addsTgcReadoutElement (const sTgcReadoutElement* x, Identifier id) +void MuonDetectorManager::addsTgcReadoutElement (sTgcReadoutElement* x, Identifier id) { if (id!=x->identify()) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::addsTgcReadoutElement() - Trying to add sTgcReadoutElement with id %s not matching the id assigned to the sTgcReadoutElement %s", __FILE__, __LINE__, m_stgcIdHelper->show_to_string(id).c_str(), m_stgcIdHelper->show_to_string(x->identify()).c_str())); } } -void MuonDetectorManager::addMdtReadoutElement (const MdtReadoutElement* x, Identifier id) +void MuonDetectorManager::addMdtReadoutElement (MdtReadoutElement* x, Identifier id) { if (id!=x->identify()) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::addMdtReadoutElement() - Trying to add MdtReadoutElement with id %s not matching the id assigned to the MdtReadoutElement %s", __FILE__, __LINE__, m_mdtIdHelper->show_to_string(id).c_str(), m_mdtIdHelper->show_to_string(x->identify()).c_str())); @@ -817,7 +828,7 @@ const MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(Identifier id } -void MuonDetectorManager::addCscReadoutElement (const CscReadoutElement* x, Identifier id) +void MuonDetectorManager::addCscReadoutElement (CscReadoutElement* x, Identifier id) { if (id!=x->identify()) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::addCscReadoutElement() - Trying to add CscReadoutElement with id %s not matching the id assigned to the CscReadoutElement %s", __FILE__, __LINE__, m_cscIdHelper->show_to_string(id).c_str(), m_cscIdHelper->show_to_string(x->identify()).c_str())); @@ -896,7 +907,7 @@ const CscReadoutElement* MuonDetectorManager::getCscReadoutElement(Identifier id } -void MuonDetectorManager::addTgcReadoutElement (const TgcReadoutElement* x, Identifier id) +void MuonDetectorManager::addTgcReadoutElement (TgcReadoutElement* x, Identifier id) { if (id!=x->identify()) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::addTgcReadoutElement() - Trying to add TgcReadoutElement with id %s not matching the id assigned to the TgcReadoutElement %s", __FILE__, __LINE__, m_tgcIdHelper->show_to_string(id).c_str(), m_tgcIdHelper->show_to_string(x->identify()).c_str())); @@ -1004,7 +1015,7 @@ const MdtReadoutElement* MuonDetectorManager::getMdtRElement_fromIdFields(int i1 return getMdtReadoutElement(stname_index,steta_index,stphi_index,ml_index); } -const MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(int i1, int i2, int i3, int i4)const +void MuonDetectorManager::checkMdtReadoutElementIndices(int i1, int i2, int i3, int i4)const { if (i1<0 || i1 >= NMdtStatType) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getMdtReadoutElement() - stNameindex out of range %d 0-%d", __FILE__, __LINE__, i1, NMdtStatType-1)); @@ -1018,6 +1029,17 @@ const MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(int i1, int i if (i4 < 0 || i4 >= NMdtMultilayer) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getMdtReadoutElement() - ml_index out of range %d 0-%d", __FILE__, __LINE__, i4, NMdtMultilayer-1)); } +} + +const MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(int i1, int i2, int i3, int i4)const +{ + checkMdtReadoutElementIndices(i1, i2, i3, i4); + return m_mdtArray[i1][i2][i3][i4]; +} + +MdtReadoutElement* MuonDetectorManager::getMdtReadoutElement(int i1, int i2, int i3, int i4) +{ + checkMdtReadoutElementIndices(i1, i2, i3, i4); return m_mdtArray[i1][i2][i3][i4]; } @@ -1035,7 +1057,7 @@ const CscReadoutElement* MuonDetectorManager::getCscRElement_fromIdFields(int i1 return getCscReadoutElement(stname_index, steta_index, stphi_index, ml_index); } -const CscReadoutElement* MuonDetectorManager::getCscReadoutElement(int i1, int i2, int i3, int i4)const +void MuonDetectorManager::checkCscReadoutElementIndices(int i1, int i2, int i3, int i4)const { if (i1<0 || i1 >= NCscStatType) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getCscReadoutElement() - stNameindex out of range %d 0-%d", __FILE__, __LINE__, i1, NCscStatType-1)); @@ -1049,8 +1071,20 @@ const CscReadoutElement* MuonDetectorManager::getCscReadoutElement(int i1, int i if (i4 < 0 || i4 >= NCscChamberLayer) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getCscReadoutElement() - ml_index out of range %d 0-%d", __FILE__, __LINE__, i4, NCscChamberLayer-1)); } +} + +const CscReadoutElement* MuonDetectorManager::getCscReadoutElement(int i1, int i2, int i3, int i4)const +{ + checkCscReadoutElementIndices(i1, i2, i3, i4); return m_cscArray[i1][i2][i3][i4]; } + +CscReadoutElement* MuonDetectorManager::getCscReadoutElement(int i1, int i2, int i3, int i4) +{ + checkCscReadoutElementIndices(i1, i2, i3, i4); + return m_cscArray[i1][i2][i3][i4]; +} + const RpcReadoutElement* MuonDetectorManager::getRpcRElement_fromIdFields(int i1, int i2, int i3, int i4, int i5, int i6) const @@ -1115,7 +1149,8 @@ const RpcReadoutElement* MuonDetectorManager::getRpcRElement_fromIdFields(int i1 return getRpcReadoutElement(stname_index, steta_index, stphi_index, dbr_index, dbz_index); } -const RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5)const + +void MuonDetectorManager::checkRpcReadoutElementIndices(int i1, int i2, int i3, int i4, int i5)const { if (i1<0 || i1 >= NRpcStatType) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getRpcReadoutElement() - stNameindex out of range %d 0-%d", __FILE__, __LINE__, i1, NRpcStatType-1)); @@ -1132,8 +1167,20 @@ const RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i if (i5 < 0 || i5 >= NDoubletZ) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getRpcReadoutElement() - dbz_index out of range %d 0-%d", __FILE__, __LINE__, i5, NDoubletZ-1)); } +} + +const RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5)const +{ + checkRpcReadoutElementIndices(i1, i2, i3, i4, i5); return m_rpcArray[i1][i2][i3][i4][i5]; } + +RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5) +{ + checkRpcReadoutElementIndices(i1, i2, i3, i4, i5); + return m_rpcArray[i1][i2][i3][i4][i5]; +} + const TgcReadoutElement* MuonDetectorManager::getTgcRElement_fromIdFields(int i1, int i2, int i3) const @@ -1146,7 +1193,8 @@ const TgcReadoutElement* MuonDetectorManager::getTgcRElement_fromIdFields(int i1 return getTgcReadoutElement(stname_index, steta_index, stphi_index); } -const TgcReadoutElement* MuonDetectorManager::getTgcReadoutElement(int i1, int i2, int i3)const + +void MuonDetectorManager::checkTgcReadoutElementIndices (int i1, int i2, int i3)const { if (i1<0 || i1 >= NTgcStatType) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getTgcReadoutElement() - stNameindex out of range %d 0-%d", __FILE__, __LINE__, i1, NTgcStatType-1)); @@ -1157,11 +1205,22 @@ const TgcReadoutElement* MuonDetectorManager::getTgcReadoutElement(int i1, int i if (i3<0 || i3>= NTgcStatPhi) { throw std::runtime_error(Form("File: %s, Line: %d\nMuonDetectorManager::getTgcReadoutElement() - stPhiindex out of range %d 0-%d", __FILE__, __LINE__, i3, NTgcStatPhi-1)); } +} + +const TgcReadoutElement* MuonDetectorManager::getTgcReadoutElement(int i1, int i2, int i3)const +{ + checkTgcReadoutElementIndices (i1, i2, i3); + return m_tgcArray[i1][i2][i3]; +} + +TgcReadoutElement* MuonDetectorManager::getTgcReadoutElement(int i1, int i2, int i3) +{ + checkTgcReadoutElementIndices (i1, i2, i3); return m_tgcArray[i1][i2][i3]; } void -MuonDetectorManager::initABlineContainers() const +MuonDetectorManager::initABlineContainers() { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); m_aLineContainer = new ALineMapContainer; @@ -1228,7 +1287,7 @@ MuonDetectorManager::initABlineContainers() const StatusCode -MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const +MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) { #ifdef TESTBLINES { @@ -1330,7 +1389,7 @@ MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating extisting entry in A-line container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff << endmsg; ALinePar * oldALine = (*ci).second; - ALineContainer()->erase(ALineId); + m_aLineContainer->erase(ALineId); delete oldALine; } else @@ -1338,7 +1397,7 @@ MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< " New entry in A-line container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff <<" --- in the container with key "<< m_mdtIdHelper->show_to_string(ALineId)<< endmsg; } - ALineContainer()->insert(std::make_pair(ALineId,ALine)); + m_aLineContainer->insert(std::make_pair(ALineId,ALine)); } else {// job different than 0 (standard for TGC conditions for Sept 2010 repro.) @@ -1393,7 +1452,7 @@ MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating existing entry in A-line container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff << endmsg; ALinePar * oldALine = (*ci).second; - ALineContainer()->erase(ALineId); + m_aLineContainer->erase(ALineId); delete oldALine; oldALine=0; } else @@ -1401,7 +1460,7 @@ MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< " New entry in A-line container for Station Component " <<stType<<" at Jzz/Jff/Job "<<jzz<<"/"<< jff <<"/"<<job<<" --- in the container with key "<< m_mdtIdHelper->show_to_string(ALineId)<< endmsg; } - ALineContainer()->insert(std::make_pair(ALineId,ALine)); + m_aLineContainer->insert(std::make_pair(ALineId,ALine)); } } log<<MSG::INFO<<"# of A-lines read from the ALineMapContainer in StoreGate is "<<nLines<<endmsg; @@ -1412,7 +1471,7 @@ MuonDetectorManager::updateAlignment(const ALineMapContainer * alineData) const } StatusCode -MuonDetectorManager::updateDeformations(const BLineMapContainer * blineData) const +MuonDetectorManager::updateDeformations(const BLineMapContainer * blineData) { #ifdef TESTBLINES { @@ -1549,7 +1608,7 @@ MuonDetectorManager::updateDeformations(const BLineMapContainer * blineData) con if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating existing entry in B-line container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff << endmsg; BLinePar * oldBLine = (*ci).second; - BLineContainer()->erase(BLineId); + m_bLineContainer->erase(BLineId); delete oldBLine; oldBLine=0; } else @@ -1557,7 +1616,7 @@ MuonDetectorManager::updateDeformations(const BLineMapContainer * blineData) con if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< " New entry in B-line container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff <<" --- in the container with key "<< m_mdtIdHelper->show_to_string(BLineId)<< endmsg; } - BLineContainer()->insert(std::make_pair(BLineId,BLine)); + m_bLineContainer->insert(std::make_pair(BLineId,BLine)); } else { @@ -1578,7 +1637,7 @@ void MuonDetectorManager::storeTgcReadoutParams(TgcReadoutParams* x) m_TgcReadoutParamsVec.push_back(x); } -StatusCode MuonDetectorManager::initCSCInternalAlignmentMap() const +StatusCode MuonDetectorManager::initCSCInternalAlignmentMap() { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); @@ -1627,7 +1686,7 @@ StatusCode MuonDetectorManager::initCSCInternalAlignmentMap() const return StatusCode::SUCCESS; } StatusCode -MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMapContainer* ilineData) const +MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMapContainer* ilineData) { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); if (ilineData == nullptr) { @@ -1683,11 +1742,10 @@ MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMap if (int(choice/100000)%10== 0) traz = 0.; if (m_controlCscIlines!=111111) ILine->setParameters(tras,traz,trat,rots,rotz,rott); if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"Setting CSC I-Lines for Station "<<stType<<" "<<jzz<<" "<<jff<<" "<<job<<" "<<jlay<<" "<<" params are = "<<tras<<" "<<traz<<" "<<trat<<" "<<rots<<" "<<rotz<<" "<<rott<<endmsg; - const CscReadoutElement* CscRE = dynamic_cast<const CscReadoutElement*> (thisStation->getMuonReadoutElement(job)); + CscReadoutElement* CscRE = dynamic_cast<CscReadoutElement*> (thisStation->getMuonReadoutElement(job)); if(!CscRE) log<<MSG::ERROR<<"The CSC I-lines container includes stations which are no CSCs! This is impossible." <<endmsg; else { - CscReadoutElement* CscREnoConst = const_cast<CscReadoutElement*> (CscRE); - CscREnoConst->setCscInternalAlignmentPar(ILine); + CscRE->setCscInternalAlignmentPar(ILine); } if (cacheFillingFlag()) { @@ -1713,7 +1771,7 @@ MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMap if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating extisting entry in CSC I-line container for Station " <<stType<<" at Jzz/Jff/Jlay "<<jzz<<"/"<< jff <<"/"<< jlay<< endmsg; CscInternalAlignmentPar * oldILine = (*ci).second; - CscInternalAlignmentContainer()->erase(ILineId); + m_cscALineContainer->erase(ILineId); delete oldILine; oldILine=0; } else @@ -1721,7 +1779,7 @@ MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMap if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< " New entry in CSC I-line container for Station " <<stType<<" at Jzz/Jff/Jlay "<<jzz<<"/"<< jff<<"/"<< jlay <<" --- in the container with key "<< m_cscIdHelper->show_to_string(ILineId)<< endmsg; } - CscInternalAlignmentContainer()->insert(std::make_pair(ILineId,ILine)); + m_cscALineContainer->insert(std::make_pair(ILineId,ILine)); } else { @@ -1735,7 +1793,7 @@ MuonDetectorManager::updateCSCInternalAlignmentMap(const CscInternalAlignmentMap return StatusCode::SUCCESS; } StatusCode -MuonDetectorManager::updateAsBuiltParams(const MdtAsBuiltMapContainer* asbuiltData) const +MuonDetectorManager::updateAsBuiltParams(const MdtAsBuiltMapContainer* asbuiltData) { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); if (asbuiltData == nullptr) { @@ -1781,13 +1839,13 @@ MuonDetectorManager::updateAsBuiltParams(const MdtAsBuiltMapContainer* asbuiltDa if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating extisting entry in AsBuilt container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff << endmsg; MdtAsBuiltPar* oldAsBuilt = (*ci).second; - MdtAsBuiltContainer()->erase(AsBuiltId); + m_AsBuiltParamsMap->erase(AsBuiltId); delete oldAsBuilt; oldAsBuilt=0; } else { if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "New entry in AsBuilt container for Station " <<stType<<" at Jzz/Jff "<<jzz<<"/"<< jff<<" --- in the container with key "<< m_mdtIdHelper->show_to_string(AsBuiltId)<< endmsg; } - MdtAsBuiltContainer()->insert(std::make_pair(AsBuiltId,AsBuiltPar)); + m_AsBuiltParamsMap->insert(std::make_pair(AsBuiltId,AsBuiltPar)); } if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG <<"MdtAsBuiltPar with AmdbId " <<stType<<" "<<jzz<<" "<<jff<<" "<<job<<" is new ID = "<<m_mdtIdHelper->show_to_string(AsBuiltId)<<endmsg; @@ -1864,24 +1922,24 @@ void MuonDetectorManager::storeMdtAsBuiltParams(MdtAsBuiltPar* params) { if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "Updating extisting entry in AsBuilt container for Station " <<stName<<" at Jzz/Jff "<<jzz<<"/"<< jff << endmsg; MdtAsBuiltPar* oldAsBuilt = (*ci).second; - MdtAsBuiltContainer()->erase(id); + m_AsBuiltParamsMap->erase(id); delete oldAsBuilt; oldAsBuilt=0; } else { if (log.level()<=MSG::DEBUG) log << MSG::DEBUG<< "New entry in AsBuilt container for Station " <<stName<<" at Jzz/Jff "<<jzz<<"/"<< jff<<" --- in the container with key "<< m_mdtIdHelper->show_to_string(id)<< endmsg; } - MdtAsBuiltContainer()->insert(std::make_pair(id,params)); + m_AsBuiltParamsMap->insert(std::make_pair(id,params)); return; } -MdtAsBuiltPar* MuonDetectorManager::getMdtAsBuiltParams(Identifier id) { +const MdtAsBuiltPar* MuonDetectorManager::getMdtAsBuiltParams(Identifier id) const { if (!MdtAsBuiltContainer()) { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); log << MSG::DEBUG << "No Mdt AsBuilt parameter container available" << endmsg; return nullptr; } - iMdtAsBuiltMap iter = MdtAsBuiltContainer()->find(id); + iMdtAsBuiltMap iter = m_AsBuiltParamsMap->find(id); if (iter == MdtAsBuiltContainer()->end()) { MsgStream log(Athena::getMessageSvc(),"MGM::MuonDetectorManager"); log << MSG::DEBUG << "No Mdt AsBuilt parameters for station " << id.getString() diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx index 46c2e7f092df1ac5a87e653b972eb9e54fd3f037..89c8faefc0c82cbf43f1074482cba2f0bb61aec4 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx @@ -223,7 +223,7 @@ namespace MuonGM { HepGeom::Point3D<double> p(x[0],x[1],x[2]); HepGeom::Transform3D msToGlobal = parentMuonStation()->getTransform(); // native_MuonStation to global - HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) + const HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) HepGeom::Point3D<double> p2 = msToGlobal*(msToAmdb->inverse())*p; return Amg::Vector3D(p2.x(),p2.y(),p2.z()); } @@ -231,7 +231,7 @@ namespace MuonGM { const Amg::Transform3D MuonReadoutElement::AmdbLRSToGlobalTransform() const { HepGeom::Transform3D msToGlobal = parentMuonStation()->getTransform(); // native_MuonStation to global - HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) + const HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) return Amg::CLHEPTransformToEigen(msToGlobal*(msToAmdb->inverse())); } @@ -239,7 +239,7 @@ namespace MuonGM { HepGeom::Point3D<double> p(x[0],x[1],x[2]); HepGeom::Transform3D msToGlobal = parentMuonStation()->getTransform(); // native_MuonStation to global - HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) + const HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) HepGeom::Point3D<double> p2 = (*msToAmdb)*(msToGlobal.inverse())*p; return Amg::Vector3D(p2.x(),p2.y(),p2.z()); } @@ -247,7 +247,7 @@ namespace MuonGM { const Amg::Transform3D MuonReadoutElement::GlobalToAmdbLRSTransform() const { HepGeom::Transform3D msToGlobal = parentMuonStation()->getTransform(); // native_MuonStation to global - HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) + const HepGeom::Transform3D* msToAmdb = parentMuonStation()->getNativeToAmdbLRS(); //native_MuonStation to Amdb local (szt) return Amg::CLHEPTransformToEigen((*msToAmdb)*(msToGlobal.inverse())); } } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx index 5285f1ae9278ac9ea9ce83026becd9eecce346cb..7e183cc3a68a215249aa31b79313de5581289566 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonStation.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 */ /*************************************************************************** @@ -101,7 +101,12 @@ HepGeom::Point3D<double> MuonStation::getBlineFixedPointInAmdbLRS() const HepGeom::Point3D<double> MuonStation::getUpdatedBlineFixedPointInAmdbLRS() const { - if (!m_firstRequestBlineFixedP) return m_BlineFixedPointInAmdbLRS; + return m_BlineFixedPointInAmdbLRS; +} + +void MuonStation::updateBlineFixedPointInAmdbLRS() +{ + if (!m_firstRequestBlineFixedP) return; MsgStream log(Athena::getMessageSvc(),"MuonStation"); // Before correction m_BlineFixedPointInAmdbLRS has a z set at the edge of @@ -161,11 +166,10 @@ HepGeom::Point3D<double> MuonStation::getUpdatedBlineFixedPointInAmdbLRS() cons } } - m_firstRequestBlineFixedP = false; - return m_BlineFixedPointInAmdbLRS; - } + + void MuonStation::setDeltaAmdbLRS(HepGeom::Transform3D xf) { if (m_delta_amdb_frame== nullptr) m_delta_amdb_frame= new HepGeom::Transform3D(xf); @@ -270,6 +274,18 @@ const MuonReadoutElement* MuonStation::getMuonReadoutElement(int jobIndex) const return ((*m_REwithAlTransfInStation)[jobIndex]).first; } +MuonReadoutElement* MuonStation::getMuonReadoutElement(int jobIndex) +{ + if (m_REwithAlTransfInStation->find(jobIndex)==m_REwithAlTransfInStation->end()) return nullptr; + #ifndef NDEBUG + MsgStream log(Athena::getMessageSvc(),"MuonStation"); + if (log.level()<=MSG::DEBUG) log <<MSG::DEBUG<<"getMuonReadoutElement at Job="<<jobIndex<<" for station " + <<getStationName()<<" at zi/fi = "<<getEtaIndex()<<"/"<<getPhiIndex() + <<endmsg; + #endif + return ((*m_REwithAlTransfInStation)[jobIndex]).first; +} + GeoAlignableTransform* MuonStation::getComponentAlTransf(int jobIndex) const { if (m_REwithAlTransfInStation->find(jobIndex)==m_REwithAlTransfInStation->end()) return nullptr; @@ -283,7 +299,7 @@ GeoAlignableTransform* MuonStation::getComponentAlTransf(int jobIndex) const } void -MuonStation::addMuonReadoutElementWithAlTransf(const MuonReadoutElement* a, GeoAlignableTransform* ptrsf, int jobIndex) +MuonStation::addMuonReadoutElementWithAlTransf(MuonReadoutElement* a, GeoAlignableTransform* ptrsf, int jobIndex) { #ifndef NDEBUG @@ -387,10 +403,10 @@ MuonStation::setDelta_fromAline_forComp(int jobindex, } -void MuonStation::clearCache() const +void MuonStation::clearCache() { - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); MsgStream log(Athena::getMessageSvc(),"MuonStation"); if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"n. of RE in this station is "<<m_REwithAlTransfInStation->size()<<endmsg; @@ -400,7 +416,7 @@ void MuonStation::clearCache() const { ++i; if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"Clearing cache .... for RE ... iteration n. "<<i<<endmsg; - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr){ if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in MuonStation:clearCache "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a not existing RE (iteration n. ) "<<i<<" RE is null, skipping"<<endmsg; @@ -411,10 +427,10 @@ void MuonStation::clearCache() const } } -void MuonStation::refreshCache() const +void MuonStation::refreshCache() { - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); MsgStream log(Athena::getMessageSvc(),"MuonStation"); if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"n. of RE in this station is "<<m_REwithAlTransfInStation->size()<<endmsg; @@ -423,7 +439,7 @@ void MuonStation::refreshCache() const for (;it!=itEnd; ++it) { ++i; if (log.level()<=MSG::DEBUG) log<<MSG::DEBUG<<"Refreshing cache .... for RE ... iteration n. "<<i<<endmsg; - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr){ if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in MuonStation:refreshCache "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a not existing RE (iteration n. ) "<<i<<" RE is null, skipping"<<endmsg; @@ -434,13 +450,13 @@ void MuonStation::refreshCache() const } -void MuonStation::fillCache() const +void MuonStation::fillCache() { - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); MsgStream log(Athena::getMessageSvc(),"MuonStation"); for (;it!=itEnd; it++) { - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr) { if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in MuonStation:fillCache "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a not existing RE, skipping"<<endmsg; @@ -453,57 +469,57 @@ void MuonStation::fillCache() const void MuonStation::setBline(BLinePar * bline) { m_hasBLines = true; - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); MsgStream log(Athena::getMessageSvc(),"MuonStation"); for (;it!=itEnd; ++it) { - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr) { if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in setBLine "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a null MuonReadoutElement, skipping"<<endmsg; continue; } if ( re->getTechnologyType().substr(0,3)=="MDT" ) { - const MdtReadoutElement* mdt = (const MdtReadoutElement*)re; + MdtReadoutElement* mdt = dynamic_cast<MdtReadoutElement*>(re); mdt->setBLinePar(bline); } } } -void MuonStation::clearBLineCache() const +void MuonStation::clearBLineCache() { - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); int i=0; MsgStream log(Athena::getMessageSvc(),"MuonStation"); for (;it!=itEnd; ++it) { ++i; - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr) { if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in MuonStation:clearBLineCache "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a not existing RE (iteration n. ) "<<i<<" RE is null, skipping"<<endmsg; continue; } if ( re->getTechnologyType().substr(0,3)=="MDT" ) { - const MdtReadoutElement* mdt = (const MdtReadoutElement*)re; + MdtReadoutElement* mdt = dynamic_cast<MdtReadoutElement*>(re); mdt->clearBLineCache(); } } } -void MuonStation::fillBLineCache() const +void MuonStation::fillBLineCache() { - std::map<int, pairRE_AlignTransf>::const_iterator it = m_REwithAlTransfInStation->begin(); - std::map<int, pairRE_AlignTransf>::const_iterator itEnd = m_REwithAlTransfInStation->end(); + std::map<int, pairRE_AlignTransf>::iterator it = m_REwithAlTransfInStation->begin(); + std::map<int, pairRE_AlignTransf>::iterator itEnd = m_REwithAlTransfInStation->end(); MsgStream log(Athena::getMessageSvc(),"MuonStation"); for (;it!=itEnd; ++it) { - const MuonReadoutElement * re = ((*it).second).first; + MuonReadoutElement * re = ((*it).second).first; if (re==nullptr) { if (log.level()<=MSG::WARNING) log<<MSG::WARNING<<" in MuonStation:fillBLineCache "<< getStationType()<<" at zi/fi "<<getEtaIndex()<<"/"<<getPhiIndex() <<" trying to get a non existing RE, skipping"<<endmsg; continue; } if ( re->getTechnologyType().substr(0,3)=="MDT" ) { - const MdtReadoutElement* mdt = (const MdtReadoutElement*)re; + MdtReadoutElement* mdt = dynamic_cast<MdtReadoutElement*>(re); mdt->fillBLineCache(); } } @@ -606,7 +622,7 @@ bool MuonStation::endcap() const return !barrel(); } -MdtAsBuiltPar* MuonStation::getMdtAsBuiltParams() const { +const MdtAsBuiltPar* MuonStation::getMdtAsBuiltParams() const { if (!hasMdtAsBuiltParams()) { MsgStream log(Athena::getMessageSvc(),"MuonStation"); if (log.level()<=MSG::WARNING) log <<MSG::WARNING << "No Mdt AsBuilt parameters for chamber " << getStationName() << endmsg; @@ -614,7 +630,7 @@ MdtAsBuiltPar* MuonStation::getMdtAsBuiltParams() const { return m_XTomoData; } -void MuonStation::setMdtAsBuiltParams(MdtAsBuiltPar* xtomo) { +void MuonStation::setMdtAsBuiltParams(const MdtAsBuiltPar* xtomo) { m_XTomoData = xtomo; } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcDetectorElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcDetectorElement.cxx index f773aba8a2a3f20222cbaa0777c745d212900654..a332a5a5f4d7da037bbb3e1c6743e0014b2b12b9 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcDetectorElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcDetectorElement.cxx @@ -119,14 +119,15 @@ const Amg::Vector3D& RpcDetectorElement::normal(const Identifier& id) const {return m_rpcVector[0]->normal(id);} -const std::vector<const Trk::Surface*>& RpcDetectorElement::surfaces() const +std::vector<const Trk::Surface*> RpcDetectorElement::surfaces() const { - // needs to be created each time because there's no clearCache() method - m_detectorSurfaces.clear(); - for (unsigned int i=0; i<NDoubletZ; i++) - m_detectorSurfaces.insert(m_detectorSurfaces.end(),m_rpcVector[i]->surfaces().begin(),m_rpcVector[i]->surfaces().end()); + std::vector<const Trk::Surface*> detectorSurfaces; + for (unsigned int i=0; i<NDoubletZ; i++) { + std::vector<const Trk::Surface*> surfs = m_rpcVector[i]->surfaces(); + detectorSurfaces.insert(detectorSurfaces.end(),surfs.begin(),surfs.end()); + } - return m_detectorSurfaces; + return detectorSurfaces; } } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx index 6aed8c79066e872b36b86205a3749ec1f9073f24..50401fa2abec38171b44ea1a15c6bc061b359c0a 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx @@ -885,7 +885,7 @@ namespace MuonGM { } - void RpcReadoutElement::fillCache() const + void RpcReadoutElement::fillCache() { if( !m_surfaceData ) m_surfaceData = new SurfaceData(); diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcDetectorElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcDetectorElement.cxx index a0e93f1963c99f729ea0e59a7619892ace37a8ef..d766b1bb3a58943235b0854c70cb190be0d78fa4 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcDetectorElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcDetectorElement.cxx @@ -60,7 +60,7 @@ const Amg::Vector3D& TgcDetectorElement::normal(const Identifier& id) const {return m_tgcre->normal(id);} -const std::vector<const Trk::Surface*>& +std::vector<const Trk::Surface*> TgcDetectorElement::surfaces() const {return m_tgcre->surfaces();} diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx index 7b9927f7fd1d40ed9ebcd7e2d2804b17c8716641..043d45abc9ba1adb2f051f6535aa6680ff6dd6b5 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx @@ -871,7 +871,7 @@ void TgcReadoutElement::setIdentifier(Identifier id) } -void TgcReadoutElement::fillCache() const { +void TgcReadoutElement::fillCache() { if( !m_surfaceData ) m_surfaceData = new SurfaceData(); else{ diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 88607fe3bde779b44514ce82981ecc281d60a52f..04b24ef9ed3c894758b0f2baea89aa3dea589035 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -374,7 +374,7 @@ namespace MuonGM { } - void sTgcReadoutElement::fillCache() const + void sTgcReadoutElement::fillCache() { if( !m_surfaceData ) m_surfaceData = new SurfaceData(); else{ @@ -471,7 +471,7 @@ namespace MuonGM { m_surfaceData->m_layerNormals.push_back(m_surfaceData->m_layerTransforms.back().linear()*Amg::Vector3D(0.,0.,-1.)); // update the padDesign info - const MuonGM::MuonPadDesign* padDesign=this->getPadDesign(id); + MuonGM::MuonPadDesign* padDesign=this->getPadDesign(id); if (padDesign) padDesign->setR(m_surfaceData->m_layerCenters.back().perp()); } @@ -529,7 +529,7 @@ namespace MuonGM { } } - void sTgcReadoutElement::setBLinePar(BLinePar* bLine) const + void sTgcReadoutElement::setBLinePar(BLinePar* bLine) { #ifndef NDEBUG MsgStream log(Athena::getMessageSvc(),"sTgcReadoutElement"); diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h index 508a07f6a73427fed4e3f4b734c05f1f530f14b6..f65e323d5e051331d6120e01a8da64464100264e 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.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 */ #ifndef MUONGEOMODEL_MUONDETECTORTOOL_H @@ -83,7 +83,7 @@ private: int m_switchOnOff_BUILDFORWARDSHIELD; - const MuonGM::MuonDetectorManager* m_manager; + MuonGM::MuonDetectorManager* m_manager; }; #endif // GEOMODELEXAMPLES_TOYDETECTORTOOL_H diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonChamber.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonChamber.cxx index 3b351ba40663d79c0352095fd6023c1de9ab4c67..db6c96306b83eb633321ae171ff339c0db9cde14 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonChamber.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonChamber.cxx @@ -1195,6 +1195,7 @@ GeoVPhysVol* MuonChamber::build( det->setMultilayer(ml); det->setParentStationPV(PVConstLink(ptrd)); det->setParentMuonStation(mstat); + det->geoInitDone(); if (ml==1) { // set fixed point for MDT deformations: s0,z0,t0 for the point at lowest t,z (z,y amdb) and s=x=0 @@ -1225,7 +1226,7 @@ GeoVPhysVol* MuonChamber::build( // Select right MdtAsBuilt parameters from map in MuonDetectorManager and assign them to MuonStation if(manager->applyMdtAsBuiltParams() ) { Identifier AsBuiltId = manager->mdtIdHelper()->elementID(mstat->getStationType(), mstat->getEtaIndex(), mstat->getPhiIndex()); - MdtAsBuiltPar* xtomo = manager->getMdtAsBuiltParams(AsBuiltId); + const MdtAsBuiltPar* xtomo = manager->getMdtAsBuiltParams(AsBuiltId); mstat->setMdtAsBuiltParams(xtomo); } } @@ -1561,6 +1562,7 @@ GeoVPhysVol* MuonChamber::build( for (size_t i = 0 ; i < vcutdef_todel.size(); i++) delete vcutdef_todel[i]; } // End big loop over components + mstat->updateBlineFixedPointInAmdbLRS(); return ptrd; } diff --git a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMCheck.h b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMCheck.h index 4ad37cb1a3035bfa911812d5a5c8dfad65dfd69f..bda5fa9d80196daae108496b055f0b611a205261 100644 --- a/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMCheck.h +++ b/MuonSpectrometer/MuonGeoModelTest/MuonGeoModelTest/MuonGMCheck.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 */ @@ -83,7 +83,7 @@ private: - const MuonGM::MuonDetectorManager* p_MuonMgr; + MuonGM::MuonDetectorManager* p_MuonMgr; ToolHandle<MuonCalib::IIdToFixedIdTool> m_fixedIdTool; ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", diff --git a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx index 500ef30c6123bc34521774b2ab081dec766f854f..d2bf6ff0bf3845aa731dfea8399941a617ca8e0e 100644 --- a/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.cxx +++ b/MuonSpectrometer/MuonGeoModelTest/src/MuonGMCheck.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 */ /*************************************************************************** @@ -3065,7 +3065,7 @@ void MuonGMCheck::testRpcCache_here() { for (int dbz_index = 0; dbz_index<MuonDetectorManager::NDoubletZ; ++dbz_index) { - const RpcReadoutElement* rpc = p_MuonMgr->getRpcReadoutElement(sname_index, + RpcReadoutElement* rpc = p_MuonMgr->getRpcReadoutElement(sname_index, seta_index, sphi_index, dbr_index, @@ -3114,7 +3114,7 @@ void MuonGMCheck::testTgcCache_here() for (int sphi_index = 0; sphi_index<MuonDetectorManager::NTgcStatPhi; ++sphi_index) { - const TgcReadoutElement* tgc = p_MuonMgr->getTgcReadoutElement(sname_index, + TgcReadoutElement* tgc = p_MuonMgr->getTgcReadoutElement(sname_index, seta_index, sphi_index); if (tgc == NULL) continue; @@ -3154,7 +3154,7 @@ void MuonGMCheck::testCscCache_here() for (int ml=0; ml<MuonDetectorManager::NCscChamberLayer; ++ml) { - const CscReadoutElement* csc = p_MuonMgr->getCscReadoutElement(sname_index, + CscReadoutElement* csc = p_MuonMgr->getCscReadoutElement(sname_index, seta_index, sphi_index, ml); @@ -3196,7 +3196,7 @@ void MuonGMCheck::testMdtCache_here() { for (int dbr_index = 0; dbr_index<MuonDetectorManager::NMdtMultilayer; ++dbr_index) { - const MdtReadoutElement* mdt = p_MuonMgr->getMdtReadoutElement(sname_index, + MdtReadoutElement* mdt = p_MuonMgr->getMdtReadoutElement(sname_index, seta_index, sphi_index, dbr_index);