diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h index a91e286db8b2d82c0ffea4766a14459b5b899acf..1cfd56d89c0144d7769578ab8e651ac28faaec95 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/IMuonIdHelperSvc.h @@ -75,6 +75,9 @@ namespace Muon { /** @brief returns whether this is a sTGC Identifier or not */ virtual bool issTgc( const Identifier& id ) const = 0; + /** @brief returns whether this is a sMDT Identifier or not */ + virtual bool issMdt( const Identifier& id ) const = 0; + /** @brief returns whether this Identifier belongs to an MDT with HPTDC or not */ virtual bool hasHPTDC( const Identifier& id ) const = 0; diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MdtIdHelper.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MdtIdHelper.h index ecbf00980469e470c0016d048ac4678a1c96a7f7..109ceed683f6594c2c770e1f69ede5440cafb960 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MdtIdHelper.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MdtIdHelper.h @@ -144,10 +144,10 @@ class MdtIdHelper : public MuonIdHelper int gasGap(const Identifier& id) const; /// always false for MDTs bool measuresPhi(const Identifier& id) const; - /// is this an sMDT chamber - bool isSmallMdt(const Identifier& id) const; /// is this a BMG chamber bool isBMG(const Identifier& id) const; + /// is this a BME chamber + bool isBME(const Identifier& id) const; private: @@ -346,10 +346,10 @@ inline bool MdtIdHelper::measuresPhi(const Identifier& /*id*/) const } -inline bool MdtIdHelper::isSmallMdt(const Identifier& id) const +inline bool MdtIdHelper::isBME(const Identifier& id) const { int index=stationName(id); - if(stationNameIndex("BME")==index || stationNameIndex("BMG")==index) return true; + if(stationNameIndex("BME")==index) return true; else return false; } diff --git a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h index 55630f0a2133a217ce78835df086b1ad19d69d27..f5861aa67b7a7bf83e3c5ef2b88f273a7af6c075 100644 --- a/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h +++ b/MuonSpectrometer/MuonIdHelpers/MuonIdHelpers/MuonIdHelperSvc.h @@ -77,6 +77,9 @@ namespace Muon { /** @brief returns whether this is a sTGC Identifier or not */ virtual bool issTgc( const Identifier& id ) const override; + /** @brief returns whether this is a sMDT Identifier or not */ + virtual bool issMdt( const Identifier& id ) const override; + /** @brief returns whether this Identifier belongs to an MDT with HPTDC or not */ virtual bool hasHPTDC( const Identifier& id ) const override; diff --git a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx index 946e5b55a5f3f19e346b69d0bb295f43c2f6d398..af6cd27a209cbf2a6af1ac858430368e9fc9fef2 100644 --- a/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx +++ b/MuonSpectrometer/MuonIdHelpers/src/MuonIdHelperSvc.cxx @@ -199,6 +199,17 @@ namespace Muon { return m_stgcIdHelper->is_stgc(id); } + bool MuonIdHelperSvc::issMdt( const Identifier& id ) const { + if (!m_mdtIdHelper) return false; + else if (!isMdt(id)) return false; + else if (m_mdtIdHelper->isEndcap(id)) return false; // there are no sMDTs in the endcaps + else if (!m_rpcIdHelper) return false; // need RPC helper for the hasHPTDC check + bool sMdt = false; + if (m_mdtIdHelper->isBME(id)) sMdt = true; // all BME chambers are sMDTs + else if (hasHPTDC(id)) sMdt = true; // all chambers with HPTDC are sMDTs + return sMdt; + } + bool MuonIdHelperSvc::hasHPTDC( const Identifier& id ) const { if (!isMdt(id)) return false; else if (!m_rpcIdHelper) return false; // there must be RPCs in the layout diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MdtIntersectGeometry.h b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MdtIntersectGeometry.h index 5b54539b1adc1235abf162c26426a6893fce8b0b..c464247efaa8083b652d033b4fbed7095fc725e0 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MdtIntersectGeometry.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/MuonStationIntersectSvc/MdtIntersectGeometry.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 MDTINTERSECTGEOMETRY_H @@ -15,7 +15,6 @@ namespace MuonGM { class MdtReadoutElement; } -class MdtIdHelper; class MdtCondDbData; namespace TrkDriftCircleMath { @@ -23,11 +22,10 @@ namespace TrkDriftCircleMath { } namespace Muon { - + class IMuonIdHelperSvc; class MdtIntersectGeometry : public MuonIntersectGeometry { public: - MdtIntersectGeometry( const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, - MsgStream* msg); + MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg, const Muon::IMuonIdHelperSvc* idHelp); MdtIntersectGeometry(const MdtIntersectGeometry &right); MdtIntersectGeometry & operator=(const MdtIntersectGeometry &right); ~MdtIntersectGeometry(); @@ -51,7 +49,7 @@ namespace Muon { const MuonGM::MdtReadoutElement* m_detElMl1; const MuonGM::MuonDetectorManager* m_detMgr; const MdtCondDbData* m_dbData; - const MdtIdHelper* m_mdtIdHelper; + const Muon::IMuonIdHelperSvc* m_idHelperSvc; std::set<Identifier> m_deadTubesML; std::vector<Identifier> m_deadTubes; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx index fbc80277b7f4db6811b3543e6edd1a73515ca106..de72e259b0dcb0952d2a68d3437bd275876337fe 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx @@ -9,19 +9,19 @@ #include "TrkDriftCircleMath/MdtChamberGeometry.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MdtIdHelper.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "GeoModelUtilities/GeoGetIds.h" #include "MuonCondData/MdtCondDbData.h" namespace Muon{ - MdtIntersectGeometry::MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg) : + MdtIntersectGeometry::MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg, const Muon::IMuonIdHelperSvc* idHelp) : m_chid(chid), m_mdtGeometry(nullptr), m_detMgr(detMgr), m_dbData(dbData), - m_mdtIdHelper(nullptr) + m_idHelperSvc(idHelp) { init(msg); } @@ -35,7 +35,7 @@ namespace Muon{ m_detElMl1 = right.m_detElMl1; m_detMgr = right.m_detMgr; m_dbData=right.m_dbData; - m_mdtIdHelper = right.m_mdtIdHelper; + m_idHelperSvc = right.m_idHelperSvc; } MdtIntersectGeometry& MdtIntersectGeometry::operator=(const MdtIntersectGeometry& right) { @@ -48,7 +48,7 @@ namespace Muon{ m_detElMl1 = right.m_detElMl1; m_detMgr = right.m_detMgr; m_dbData=right.m_dbData; - m_mdtIdHelper = right.m_mdtIdHelper; + m_idHelperSvc = right.m_idHelperSvc; } return *this; } @@ -63,7 +63,7 @@ namespace Muon{ MuonStationIntersect intersect; if( !m_mdtGeometry ){ MsgStream log(Athena::getMessageSvc(),"MdtIntersectGeometry"); - log<<MSG::WARNING<<"MdtIntersectGeometry::intersection() - MdtIntersectGeometry not correctly initialized "<< m_mdtIdHelper->print_to_string(m_chid)<<endmsg; + log<<MSG::WARNING<<"MdtIntersectGeometry::intersection() - MdtIntersectGeometry not correctly initialized "<< m_idHelperSvc->mdtIdHelper().print_to_string(m_chid)<<endmsg; return intersect; } @@ -85,8 +85,8 @@ namespace Muon{ for( ; dit!=dit_end;++dit ){ double xint = dxdy*( dit->position().x() - lpos.y() ) + lpos.x(); - Identifier tubeid = m_mdtIdHelper->channelID( m_chid, dit->id().ml()+1, dit->id().lay()+1, dit->id().tube()+1 ); - if( m_deadTubesML.find( m_mdtIdHelper->multilayerID(tubeid) ) != m_deadTubesML.end() ) { + Identifier tubeid = m_idHelperSvc->mdtIdHelper().channelID( m_chid, dit->id().ml()+1, dit->id().lay()+1, dit->id().tube()+1 ); + if( m_deadTubesML.find( m_idHelperSvc->mdtIdHelper().multilayerID(tubeid) ) != m_deadTubesML.end() ) { if( std::find( m_deadTubes.begin(), m_deadTubes.end(), tubeid ) != m_deadTubes.end() ) continue; } @@ -114,8 +114,6 @@ namespace Muon{ void MdtIntersectGeometry::init(MsgStream* msg) { - m_mdtIdHelper = m_detMgr->mdtIdHelper(); - /* calculate chamber geometry it takes as input: distance between the first and second tube in the chamber within a layer along the tube layer (tube distance) @@ -129,15 +127,15 @@ namespace Muon{ */ // get id - int eta = m_mdtIdHelper->stationEta(m_chid); - int phi = m_mdtIdHelper->stationPhi(m_chid); - int name = m_mdtIdHelper->stationName(m_chid); - int isBarrel = m_mdtIdHelper->isBarrel(m_chid); - int isSmallMdt = m_mdtIdHelper->isSmallMdt(m_chid); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(m_chid); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(m_chid); + int name = m_idHelperSvc->mdtIdHelper().stationName(m_chid); + int isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel(m_chid); + int isSmallMdt = m_idHelperSvc->issMdt(m_chid); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi ); // get detEL for first ml (always there) - Identifier firstIdml0 = m_mdtIdHelper->channelID( name,eta,phi,1,1,1 ); + Identifier firstIdml0 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,1,1 ); Identifier firstIdml1; m_detElMl0 = m_detMgr->getMdtReadoutElement( firstIdml0 ); @@ -153,7 +151,7 @@ namespace Muon{ // treament of chambers with two ml if( nml == 2 ){ - firstIdml1 = m_mdtIdHelper->channelID( name,eta,phi,2,1,1 ); + firstIdml1 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,2,1,1 ); m_detElMl1 = m_detMgr->getMdtReadoutElement( firstIdml1 ); } @@ -201,14 +199,14 @@ namespace Muon{ TrkDriftCircleMath::LocPos firstTube1( firstTubeMl1.y(), firstTubeMl1.z() ); // position second tube in ml 0 - Identifier secondIdml0 = m_mdtIdHelper->channelID( name,eta,phi,firstMlIndex,1,2 ); + Identifier secondIdml0 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,firstMlIndex,1,2 ); Amg::Vector3D secondTubeMl0 = transform()*(m_detElMl0->tubePos( secondIdml0 )); if(m_detElMl0) fillDeadTubes(m_detElMl0, msg); if(m_detElMl1) fillDeadTubes(m_detElMl1, msg); // position first tube in second layer ml 0 - Identifier firstIdml0lay1 = m_mdtIdHelper->channelID( name,eta,phi,firstMlIndex,2,1 ); + Identifier firstIdml0lay1 = m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,firstMlIndex,2,1 ); Amg::Vector3D firstTubeMl0lay1 = transform()*(m_detElMl0->tubePos( firstIdml0lay1 )); double tubeDist = (secondTubeMl0 - firstTubeMl0).y(); // distance between tube in a given layer @@ -235,10 +233,10 @@ namespace Muon{ Identifier detElId = mydetEl->identify(); - int name = m_mdtIdHelper->stationName(detElId); - int eta = m_mdtIdHelper->stationEta(detElId); - int phi = m_mdtIdHelper->stationPhi(detElId); - int ml = m_mdtIdHelper->multilayer(detElId); + int name = m_idHelperSvc->mdtIdHelper().stationName(detElId); + int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId); + int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId); + int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId); std::vector<int>::iterator it = tubes.begin(); for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ @@ -253,8 +251,8 @@ namespace Muon{ ++it; } else { - Identifier deadTubeId = m_mdtIdHelper->channelID( name, eta, phi, ml, layer, tube ); - Identifier deadTubeMLId = m_mdtIdHelper->multilayerID( deadTubeId ); + Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube ); + Identifier deadTubeMLId = m_idHelperSvc->mdtIdHelper().multilayerID( deadTubeId ); m_deadTubes.push_back( deadTubeId ); m_deadTubesML.insert( deadTubeMLId ); if (msg) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx index 897379807cafcdbd9b66e14b289e769785388ace..09173c881daa4e634fb9e7738669e3fadac9a0f4 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MuonStationIntersectSvc.cxx @@ -48,7 +48,7 @@ const std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> > MuonStationInter continue; } } - stations.push_back(std::unique_ptr<Muon::MdtIntersectGeometry>(new Muon::MdtIntersectGeometry( chId, detMgr,dbData,&this->msgStream()))); + stations.push_back(std::unique_ptr<Muon::MdtIntersectGeometry>(new Muon::MdtIntersectGeometry( chId, detMgr,dbData,&this->msgStream(),m_idHelperSvc.get()))); } return stations; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx index 78911fe942c9d691ce28a9d1962b6e2725a03fe6..d1af1e1313340fa2b5d76430f6bc4154431c9558 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx @@ -33,7 +33,6 @@ #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" -#include "MuonStationIntersectSvc/MdtIntersectGeometry.h" #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" @@ -472,15 +471,6 @@ namespace Muon { std::set<Identifier>::iterator it = chamberSet.begin(); std::set<Identifier>::iterator it_end = chamberSet.end(); for( ;it!=it_end;++it ){ - - // this does not work yet.... - // get geometry of chamber - //const Muon::MuonIntersectGeometry* intersectGeometry = m_intersectSvc->getChamberGeometry( *it ); - - //const MdtIntersectGeometry* mdtGeo = dynamic_cast<const MdtIntersectGeometry*>(intersectGeometry); - //if( !mdtGeo ) continue; - //geos.push_back( *mdtGeo->mdtChamberGeometry() ); - geos.push_back( createChamberGeometry( *it, gToStation ) ); } @@ -1574,19 +1564,18 @@ namespace Muon { int phi = m_idHelperSvc->mdtIdHelper().stationPhi(chid); int name = m_idHelperSvc->mdtIdHelper().stationName(chid); int isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel(chid); - int isSmallMdt = m_idHelperSvc->mdtIdHelper().isSmallMdt(chid); + int isSmallMdt = m_idHelperSvc->issMdt(chid); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi ); SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; if(MuonDetMgr==nullptr){ ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); - // return 0; } // get detEL for first ml (always there) const MuonGM::MdtReadoutElement* detEl1 = MuonDetMgr->getMdtReadoutElement( m_idHelperSvc->mdtIdHelper().channelID( name,eta,phi,1,1,1 ) ); - const MuonGM::MdtReadoutElement* detEl2 = 0; + const MuonGM::MdtReadoutElement* detEl2 = nullptr; int ntube2 = 0; // number of multilayers in chamber int nml = detEl1->nMDTinStation();