Skip to content
Snippets Groups Projects
Commit 74a2a1f9 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'muIdsMdt' into 'master'

Add issMdt method to MuonIdHelperSvc

See merge request atlas/athena!35619
parents 43f8713a 9916a78c
No related branches found
No related tags found
No related merge requests found
Showing with 51 additions and 49 deletions
...@@ -75,6 +75,9 @@ namespace Muon { ...@@ -75,6 +75,9 @@ namespace Muon {
/** @brief returns whether this is a sTGC Identifier or not */ /** @brief returns whether this is a sTGC Identifier or not */
virtual bool issTgc( const Identifier& id ) const = 0; 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 */ /** @brief returns whether this Identifier belongs to an MDT with HPTDC or not */
virtual bool hasHPTDC( const Identifier& id ) const = 0; virtual bool hasHPTDC( const Identifier& id ) const = 0;
......
...@@ -144,10 +144,10 @@ class MdtIdHelper : public MuonIdHelper ...@@ -144,10 +144,10 @@ class MdtIdHelper : public MuonIdHelper
int gasGap(const Identifier& id) const; int gasGap(const Identifier& id) const;
/// always false for MDTs /// always false for MDTs
bool measuresPhi(const Identifier& id) const; bool measuresPhi(const Identifier& id) const;
/// is this an sMDT chamber
bool isSmallMdt(const Identifier& id) const;
/// is this a BMG chamber /// is this a BMG chamber
bool isBMG(const Identifier& id) const; bool isBMG(const Identifier& id) const;
/// is this a BME chamber
bool isBME(const Identifier& id) const;
private: private:
...@@ -346,10 +346,10 @@ inline bool MdtIdHelper::measuresPhi(const Identifier& /*id*/) const ...@@ -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); int index=stationName(id);
if(stationNameIndex("BME")==index || stationNameIndex("BMG")==index) return true; if(stationNameIndex("BME")==index) return true;
else return false; else return false;
} }
......
...@@ -77,6 +77,9 @@ namespace Muon { ...@@ -77,6 +77,9 @@ namespace Muon {
/** @brief returns whether this is a sTGC Identifier or not */ /** @brief returns whether this is a sTGC Identifier or not */
virtual bool issTgc( const Identifier& id ) const override; 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 */ /** @brief returns whether this Identifier belongs to an MDT with HPTDC or not */
virtual bool hasHPTDC( const Identifier& id ) const override; virtual bool hasHPTDC( const Identifier& id ) const override;
......
...@@ -199,6 +199,17 @@ namespace Muon { ...@@ -199,6 +199,17 @@ namespace Muon {
return m_stgcIdHelper->is_stgc(id); 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 { bool MuonIdHelperSvc::hasHPTDC( const Identifier& id ) const {
if (!isMdt(id)) return false; if (!isMdt(id)) return false;
else if (!m_rpcIdHelper) return false; // there must be RPCs in the layout else if (!m_rpcIdHelper) return false; // there must be RPCs in the layout
......
/* /*
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 #ifndef MDTINTERSECTGEOMETRY_H
...@@ -15,7 +15,6 @@ namespace MuonGM { ...@@ -15,7 +15,6 @@ namespace MuonGM {
class MdtReadoutElement; class MdtReadoutElement;
} }
class MdtIdHelper;
class MdtCondDbData; class MdtCondDbData;
namespace TrkDriftCircleMath { namespace TrkDriftCircleMath {
...@@ -23,11 +22,10 @@ namespace TrkDriftCircleMath { ...@@ -23,11 +22,10 @@ namespace TrkDriftCircleMath {
} }
namespace Muon { namespace Muon {
class IMuonIdHelperSvc;
class MdtIntersectGeometry : public MuonIntersectGeometry { class MdtIntersectGeometry : public MuonIntersectGeometry {
public: public:
MdtIntersectGeometry( const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg, const Muon::IMuonIdHelperSvc* idHelp);
MsgStream* msg);
MdtIntersectGeometry(const MdtIntersectGeometry &right); MdtIntersectGeometry(const MdtIntersectGeometry &right);
MdtIntersectGeometry & operator=(const MdtIntersectGeometry &right); MdtIntersectGeometry & operator=(const MdtIntersectGeometry &right);
~MdtIntersectGeometry(); ~MdtIntersectGeometry();
...@@ -51,7 +49,7 @@ namespace Muon { ...@@ -51,7 +49,7 @@ namespace Muon {
const MuonGM::MdtReadoutElement* m_detElMl1; const MuonGM::MdtReadoutElement* m_detElMl1;
const MuonGM::MuonDetectorManager* m_detMgr; const MuonGM::MuonDetectorManager* m_detMgr;
const MdtCondDbData* m_dbData; const MdtCondDbData* m_dbData;
const MdtIdHelper* m_mdtIdHelper; const Muon::IMuonIdHelperSvc* m_idHelperSvc;
std::set<Identifier> m_deadTubesML; std::set<Identifier> m_deadTubesML;
std::vector<Identifier> m_deadTubes; std::vector<Identifier> m_deadTubes;
}; };
......
...@@ -9,19 +9,19 @@ ...@@ -9,19 +9,19 @@
#include "TrkDriftCircleMath/MdtChamberGeometry.h" #include "TrkDriftCircleMath/MdtChamberGeometry.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonDetectorManager.h"
#include "MuonIdHelpers/MdtIdHelper.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h"
#include "GeoModelUtilities/GeoGetIds.h" #include "GeoModelUtilities/GeoGetIds.h"
#include "MuonCondData/MdtCondDbData.h" #include "MuonCondData/MdtCondDbData.h"
namespace Muon{ 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_chid(chid),
m_mdtGeometry(nullptr), m_mdtGeometry(nullptr),
m_detMgr(detMgr), m_detMgr(detMgr),
m_dbData(dbData), m_dbData(dbData),
m_mdtIdHelper(nullptr) m_idHelperSvc(idHelp)
{ {
init(msg); init(msg);
} }
...@@ -35,7 +35,7 @@ namespace Muon{ ...@@ -35,7 +35,7 @@ namespace Muon{
m_detElMl1 = right.m_detElMl1; m_detElMl1 = right.m_detElMl1;
m_detMgr = right.m_detMgr; m_detMgr = right.m_detMgr;
m_dbData=right.m_dbData; m_dbData=right.m_dbData;
m_mdtIdHelper = right.m_mdtIdHelper; m_idHelperSvc = right.m_idHelperSvc;
} }
MdtIntersectGeometry& MdtIntersectGeometry::operator=(const MdtIntersectGeometry& right) { MdtIntersectGeometry& MdtIntersectGeometry::operator=(const MdtIntersectGeometry& right) {
...@@ -48,7 +48,7 @@ namespace Muon{ ...@@ -48,7 +48,7 @@ namespace Muon{
m_detElMl1 = right.m_detElMl1; m_detElMl1 = right.m_detElMl1;
m_detMgr = right.m_detMgr; m_detMgr = right.m_detMgr;
m_dbData=right.m_dbData; m_dbData=right.m_dbData;
m_mdtIdHelper = right.m_mdtIdHelper; m_idHelperSvc = right.m_idHelperSvc;
} }
return *this; return *this;
} }
...@@ -63,7 +63,7 @@ namespace Muon{ ...@@ -63,7 +63,7 @@ namespace Muon{
MuonStationIntersect intersect; MuonStationIntersect intersect;
if( !m_mdtGeometry ){ if( !m_mdtGeometry ){
MsgStream log(Athena::getMessageSvc(),"MdtIntersectGeometry"); 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; return intersect;
} }
...@@ -85,8 +85,8 @@ namespace Muon{ ...@@ -85,8 +85,8 @@ namespace Muon{
for( ; dit!=dit_end;++dit ){ for( ; dit!=dit_end;++dit ){
double xint = dxdy*( dit->position().x() - lpos.y() ) + lpos.x(); 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 ); 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_mdtIdHelper->multilayerID(tubeid) ) != m_deadTubesML.end() ) { 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() ) if( std::find( m_deadTubes.begin(), m_deadTubes.end(), tubeid ) != m_deadTubes.end() )
continue; continue;
} }
...@@ -114,8 +114,6 @@ namespace Muon{ ...@@ -114,8 +114,6 @@ namespace Muon{
void MdtIntersectGeometry::init(MsgStream* msg) void MdtIntersectGeometry::init(MsgStream* msg)
{ {
m_mdtIdHelper = m_detMgr->mdtIdHelper();
/* calculate chamber geometry /* calculate chamber geometry
it takes as input: it takes as input:
distance between the first and second tube in the chamber within a layer along the tube layer (tube distance) 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{ ...@@ -129,15 +127,15 @@ namespace Muon{
*/ */
// get id // get id
int eta = m_mdtIdHelper->stationEta(m_chid); int eta = m_idHelperSvc->mdtIdHelper().stationEta(m_chid);
int phi = m_mdtIdHelper->stationPhi(m_chid); int phi = m_idHelperSvc->mdtIdHelper().stationPhi(m_chid);
int name = m_mdtIdHelper->stationName(m_chid); int name = m_idHelperSvc->mdtIdHelper().stationName(m_chid);
int isBarrel = m_mdtIdHelper->isBarrel(m_chid); int isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel(m_chid);
int isSmallMdt = m_mdtIdHelper->isSmallMdt(m_chid); int isSmallMdt = m_idHelperSvc->issMdt(m_chid);
TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi ); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi );
// get detEL for first ml (always there) // 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; Identifier firstIdml1;
m_detElMl0 = m_detMgr->getMdtReadoutElement( firstIdml0 ); m_detElMl0 = m_detMgr->getMdtReadoutElement( firstIdml0 );
...@@ -153,7 +151,7 @@ namespace Muon{ ...@@ -153,7 +151,7 @@ namespace Muon{
// treament of chambers with two ml // treament of chambers with two ml
if( nml == 2 ){ 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 ); m_detElMl1 = m_detMgr->getMdtReadoutElement( firstIdml1 );
} }
...@@ -201,14 +199,14 @@ namespace Muon{ ...@@ -201,14 +199,14 @@ namespace Muon{
TrkDriftCircleMath::LocPos firstTube1( firstTubeMl1.y(), firstTubeMl1.z() ); TrkDriftCircleMath::LocPos firstTube1( firstTubeMl1.y(), firstTubeMl1.z() );
// position second tube in ml 0 // 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 )); Amg::Vector3D secondTubeMl0 = transform()*(m_detElMl0->tubePos( secondIdml0 ));
if(m_detElMl0) fillDeadTubes(m_detElMl0, msg); if(m_detElMl0) fillDeadTubes(m_detElMl0, msg);
if(m_detElMl1) fillDeadTubes(m_detElMl1, msg); if(m_detElMl1) fillDeadTubes(m_detElMl1, msg);
// position first tube in second layer ml 0 // 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 )); Amg::Vector3D firstTubeMl0lay1 = transform()*(m_detElMl0->tubePos( firstIdml0lay1 ));
double tubeDist = (secondTubeMl0 - firstTubeMl0).y(); // distance between tube in a given layer double tubeDist = (secondTubeMl0 - firstTubeMl0).y(); // distance between tube in a given layer
...@@ -235,10 +233,10 @@ namespace Muon{ ...@@ -235,10 +233,10 @@ namespace Muon{
Identifier detElId = mydetEl->identify(); Identifier detElId = mydetEl->identify();
int name = m_mdtIdHelper->stationName(detElId); int name = m_idHelperSvc->mdtIdHelper().stationName(detElId);
int eta = m_mdtIdHelper->stationEta(detElId); int eta = m_idHelperSvc->mdtIdHelper().stationEta(detElId);
int phi = m_mdtIdHelper->stationPhi(detElId); int phi = m_idHelperSvc->mdtIdHelper().stationPhi(detElId);
int ml = m_mdtIdHelper->multilayer(detElId); int ml = m_idHelperSvc->mdtIdHelper().multilayer(detElId);
std::vector<int>::iterator it = tubes.begin(); std::vector<int>::iterator it = tubes.begin();
for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){
...@@ -253,8 +251,8 @@ namespace Muon{ ...@@ -253,8 +251,8 @@ namespace Muon{
++it; ++it;
} }
else { else {
Identifier deadTubeId = m_mdtIdHelper->channelID( name, eta, phi, ml, layer, tube ); Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID( name, eta, phi, ml, layer, tube );
Identifier deadTubeMLId = m_mdtIdHelper->multilayerID( deadTubeId ); Identifier deadTubeMLId = m_idHelperSvc->mdtIdHelper().multilayerID( deadTubeId );
m_deadTubes.push_back( deadTubeId ); m_deadTubes.push_back( deadTubeId );
m_deadTubesML.insert( deadTubeMLId ); m_deadTubesML.insert( deadTubeMLId );
if (msg) { if (msg) {
......
...@@ -48,7 +48,7 @@ const std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> > MuonStationInter ...@@ -48,7 +48,7 @@ const std::vector<std::unique_ptr<Muon::MdtIntersectGeometry> > MuonStationInter
continue; 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; return stations;
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h"
#include "MuonRIO_OnTrack/TgcClusterOnTrack.h" #include "MuonRIO_OnTrack/TgcClusterOnTrack.h"
#include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h"
#include "MuonStationIntersectSvc/MdtIntersectGeometry.h"
#include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MdtReadoutElement.h"
#include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h"
#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonDetectorManager.h"
...@@ -472,15 +471,6 @@ namespace Muon { ...@@ -472,15 +471,6 @@ namespace Muon {
std::set<Identifier>::iterator it = chamberSet.begin(); std::set<Identifier>::iterator it = chamberSet.begin();
std::set<Identifier>::iterator it_end = chamberSet.end(); std::set<Identifier>::iterator it_end = chamberSet.end();
for( ;it!=it_end;++it ){ 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 ) ); geos.push_back( createChamberGeometry( *it, gToStation ) );
} }
...@@ -1574,19 +1564,18 @@ namespace Muon { ...@@ -1574,19 +1564,18 @@ namespace Muon {
int phi = m_idHelperSvc->mdtIdHelper().stationPhi(chid); int phi = m_idHelperSvc->mdtIdHelper().stationPhi(chid);
int name = m_idHelperSvc->mdtIdHelper().stationName(chid); int name = m_idHelperSvc->mdtIdHelper().stationName(chid);
int isBarrel = m_idHelperSvc->mdtIdHelper().isBarrel(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 ); TrkDriftCircleMath::MdtStationId stationId( isSmallMdt, isBarrel, name, eta, phi );
SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle}; const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle};
if(MuonDetMgr==nullptr){ if(MuonDetMgr==nullptr){
ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
// return 0;
} }
// get detEL for first ml (always there) // 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* 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; int ntube2 = 0;
// number of multilayers in chamber // number of multilayers in chamber
int nml = detEl1->nMDTinStation(); int nml = detEl1->nMDTinStation();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment