ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MuonGMR4::MuonDetectorManager Class Reference

#include <MuonDetectorManager.h>

Inheritance diagram for MuonGMR4::MuonDetectorManager:
Collaboration diagram for MuonGMR4::MuonDetectorManager:

Classes

struct  ChamberSorter
 Helper struct to ensur that the sorting of the MuonChambers remains constants across the jobs. More...
 

Public Types

template<class MuonDetectorType >
using ElementPtr = std::unique_ptr< MuonDetectorType >
 
template<class MuonDetectorType >
using ElementStorage = std::vector< ElementPtr< MuonDetectorType > >
 
using MuonChamberSet = std::set< const MuonChamber *, ChamberSorter >
 

Public Member Functions

 MuonDetectorManager ()
 
 ~MuonDetectorManager ()=default
 
unsigned int getNumTreeTops () const override final
 Access specifically the individual readout element technologies. More...
 
PVConstLink getTreeTop (unsigned int i) const override final
 Returns the i-th top node of the MuonSystem trees. More...
 
void addTreeTop (PVConstLink pv)
 Adds a new GeoModelTree node indicating the entrance to a muon system description. More...
 
const Muon::IMuonIdHelperSvcidHelperSvc () const
 Returns a pointer to the central MuonIdHelperSvc. More...
 
std::vector< const MuonReadoutElement * > getAllReadoutElements () const
 Returns the list of all detector elements. More...
 
std::vector< MuonReadoutElement * > getAllReadoutElements ()
 
const MuonReadoutElementgetReadoutElement (const Identifier &id) const
 Returns a generic Muon readout element. More...
 
MuonReadoutElementgetReadoutElement (const Identifier &id)
 
const MuonChambergetChamber (const Identifier &channelId) const
 
MuonChamberSet getAllChambers () const
 : Returns all MuonChambers associated with the readout geometry More...
 
std::vector< ActsTrk::DetectorTypegetDetectorTypes () const
 Returns a list of all detector types. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
ElementStorage< MdtReadoutElementm_mdtEles {}
 
ElementStorage< TgcReadoutElementm_tgcEles {}
 
ElementStorage< RpcReadoutElementm_rpcEles {}
 
ElementStorage< sTgcReadoutElementm_sTgcEles {}
 
ElementStorage< MmReadoutElementm_mmEles {}
 
std::vector< PVConstLink > m_treeTopVector {}
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 61 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h.

Member Typedef Documentation

◆ ElementPtr

template<class MuonDetectorType >
using MuonGMR4::MuonDetectorManager::ElementPtr = std::unique_ptr<MuonDetectorType>

◆ ElementStorage

template<class MuonDetectorType >
using MuonGMR4::MuonDetectorManager::ElementStorage = std::vector<ElementPtr<MuonDetectorType> >

◆ MuonChamberSet

Constructor & Destructor Documentation

◆ MuonDetectorManager()

MuonGMR4::MuonDetectorManager::MuonDetectorManager ( )

Definition at line 105 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

106  : AthMessaging{"MuonDetectorManagerR4"} {
107  if (!m_idHelperSvc.retrieve().isSuccess()) {
108  ATH_MSG_FATAL(__func__<< "() -- Failed to retrieve the Identifier service");
109  throw std::runtime_error("MuonIdHelperSvc does not exist");
110  }
111  setName("MuonR4");
112 }

◆ ~MuonDetectorManager()

MuonGMR4::MuonDetectorManager::~MuonDetectorManager ( )
default

Member Function Documentation

◆ addTreeTop()

void MuonGMR4::MuonDetectorManager::addTreeTop ( PVConstLink  pv)

Adds a new GeoModelTree node indicating the entrance to a muon system description.

Definition at line 129 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

129  {
130  m_treeTopVector.push_back(pv);
131 }

◆ getAllChambers()

MuonDetectorManager::MuonChamberSet MuonGMR4::MuonDetectorManager::getAllChambers ( ) const

: Returns all MuonChambers associated with the readout geometry

Definition at line 150 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

150  {
151  MuonChamberSet allChambers{};
152  std::vector<const MuonReadoutElement*> allREs{getAllReadoutElements()};
153  for (const MuonReadoutElement* re : allREs) {
154  if (re->getChamber()) {
155  allChambers.insert(re->getChamber());
156  }
157  }
158  return allChambers;
159  }

◆ getAllReadoutElements() [1/2]

std::vector<MuonReadoutElement*> MuonGMR4::MuonDetectorManager::getAllReadoutElements ( )

◆ getAllReadoutElements() [2/2]

std::vector<const MuonReadoutElement*> MuonGMR4::MuonDetectorManager::getAllReadoutElements ( ) const

Returns the list of all detector elements.

◆ getChamber()

const MuonChamber * MuonGMR4::MuonDetectorManager::getChamber ( const Identifier channelId) const

Definition at line 146 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

146  {
147  const MuonReadoutElement* re = getReadoutElement(channelId);
148  return re ? re->getChamber() : nullptr;
149  }

◆ getDetectorTypes()

std::vector< ActsTrk::DetectorType > MuonGMR4::MuonDetectorManager::getDetectorTypes ( ) const

Returns a list of all detector types.

Definition at line 135 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

135  {
136  std::vector<ActsTrk::DetectorType> types{};
137  if (!m_mdtEles.empty()) types.push_back(ActsTrk::DetectorType::Mdt);
138  if (!m_tgcEles.empty()) types.push_back(ActsTrk::DetectorType::Tgc);
139  if (!m_rpcEles.empty()) types.push_back(ActsTrk::DetectorType::Rpc);
140  if (!m_sTgcEles.empty()) types.push_back(ActsTrk::DetectorType::sTgc);
141  if (!m_mmEles.empty()) types.push_back(ActsTrk::DetectorType::Mm);
142  return types;
143 }

◆ getNumTreeTops()

unsigned int MuonGMR4::MuonDetectorManager::getNumTreeTops ( ) const
finaloverride

Access specifically the individual readout element technologies.

Returns the number of primary nodes in the GeoModel tree that are building the full MuonSystem (MuonBarrel, MuonEndCap, NSW etc)

Definition at line 122 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

122  {
123  return m_treeTopVector.size();
124 }

◆ getReadoutElement() [1/2]

MuonReadoutElement* MuonGMR4::MuonDetectorManager::getReadoutElement ( const Identifier id)

◆ getReadoutElement() [2/2]

const MuonReadoutElement* MuonGMR4::MuonDetectorManager::getReadoutElement ( const Identifier id) const

Returns a generic Muon readout element.

◆ getTreeTop()

PVConstLink MuonGMR4::MuonDetectorManager::getTreeTop ( unsigned int  i) const
finaloverride

Returns the i-th top node of the MuonSystem trees.

Definition at line 125 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

125  {
126  return m_treeTopVector[i];
127 }

◆ idHelperSvc()

const Muon::IMuonIdHelperSvc * MuonGMR4::MuonDetectorManager::idHelperSvc ( ) const

Returns a pointer to the central MuonIdHelperSvc.

Definition at line 132 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

132  {
133  return m_idHelperSvc.get();
134 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonGMR4::MuonDetectorManager::m_idHelperSvc
private
Initial value:
{
"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"}

Definition at line 111 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_mdtEles

ElementStorage<MdtReadoutElement> MuonGMR4::MuonDetectorManager::m_mdtEles {}
private

◆ m_mmEles

ElementStorage<MmReadoutElement> MuonGMR4::MuonDetectorManager::m_mmEles {}
private

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_rpcEles

ElementStorage<RpcReadoutElement> MuonGMR4::MuonDetectorManager::m_rpcEles {}
private

◆ m_sTgcEles

ElementStorage<sTgcReadoutElement> MuonGMR4::MuonDetectorManager::m_sTgcEles {}
private

◆ m_tgcEles

ElementStorage<TgcReadoutElement> MuonGMR4::MuonDetectorManager::m_tgcEles {}
private

◆ m_treeTopVector

std::vector<PVConstLink> MuonGMR4::MuonDetectorManager::m_treeTopVector {}
private

The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::MuonDetectorManager::m_tgcEles
ElementStorage< TgcReadoutElement > m_tgcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:115
ActsTrk::DetectorType::Tgc
@ Tgc
Resitive Plate Chambers.
MuonGMR4::MuonDetectorManager::getAllReadoutElements
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
Returns the list of all detector elements.
MuonGMR4::MuonDetectorManager::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:111
MuonGMR4::MuonDetectorManager::m_rpcEles
ElementStorage< RpcReadoutElement > m_rpcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:116
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ActsTrk::DetectorType::Mm
@ Mm
Maybe not needed in the migration.
lumiFormat.i
int i
Definition: lumiFormat.py:92
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MuonChamberSet
MuonGMR4::MuonDetectorManager::MuonChamberSet MuonChamberSet
Definition: MuonDetectorBuilderTool.cxx:33
MuonGMR4::MuonDetectorManager::m_mdtEles
ElementStorage< MdtReadoutElement > m_mdtEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:114
MuonGMR4::MuonDetectorManager::m_treeTopVector
std::vector< PVConstLink > m_treeTopVector
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:120
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
python.root_lsr_rank.types
types
Definition: root_lsr_rank.py:35
MuonGMR4::MuonDetectorManager::m_sTgcEles
ElementStorage< sTgcReadoutElement > m_sTgcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:117
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
re
const boost::regex re(r_e)
python.changerun.pv
pv
Definition: changerun.py:81
ActsTrk::DetectorType::Rpc
@ Rpc
Monitored Drift Tubes.
MuonGMR4::MuonDetectorManager::m_mmEles
ElementStorage< MmReadoutElement > m_mmEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:118
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
MuonGMR4::MuonDetectorManager::getReadoutElement
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.