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  MSEnvelopeSorter
 Helper struct to ensure that the spectrometer sectors & chambers are sorted. More...
 

Public Types

template<class MuonDetectorType >
using ElementPtr = std::unique_ptr< MuonDetectorType >
 
template<class MuonDetectorType >
using ElementStorage = std::vector< ElementPtr< MuonDetectorType > >
 
using MuonSectorSet = std::set< const SpectrometerSector *, MSEnvelopeSorter >
 
using MuonChamberSet = std::set< const Chamber *, MSEnvelopeSorter >
 

Public Member Functions

 MuonDetectorManager ()
 
 ~MuonDetectorManager ()
 
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)
 
void addSpectrometerSector (ElementPtr< SpectrometerSector > &&chSector)
 Add a spectrometer enevelope object to the manager. More...
 
const SpectrometerSectorgetSectorEnvelope (const Identifier &channelId) const
 Retrieves the spectrometer envelope enclosing the channel's readout element. More...
 
const ChambergetChamber (const Identifier &channelId) const
 Retrieves the chamber enclosing the channel's readout element. More...
 
MuonSectorSet getAllSectors () const
 : Returns all MuonChambers associated with the readout geometry More...
 
MuonChamberSet getAllChambers () const
 
std::vector< ActsTrk::DetectorTypegetDetectorTypes () const
 Returns a list of all detector types. More...
 
template<>
void linkElements (ElementStorage< MdtReadoutElement > &detStore, MdtReadoutElement *refEle)
 
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

template<class MuonDetectorType >
void linkElements (ElementStorage< MuonDetectorType > &allStore, MuonDetectorType *readOutEle)
 Method that connect the same elements from the station with the parsed readout Element and vice versa. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
ElementStorage< SpectrometerSectorm_secEnvelopes {}
 
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 62 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

◆ MuonSectorSet

Constructor & Destructor Documentation

◆ MuonDetectorManager()

MuonGMR4::MuonDetectorManager::MuonDetectorManager ( )

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

115  : AthMessaging{"MuonDetectorManagerR4"} {
116  if (!m_idHelperSvc.retrieve().isSuccess()) {
117  THROW_EXCEPTION(__func__<< "() -- Failed to retrieve the Identifier service");
118  }
119  setName("MuonR4");
120 }

◆ ~MuonDetectorManager()

MuonGMR4::MuonDetectorManager::~MuonDetectorManager ( )

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

109  {
110 #ifndef SIMULATIONBASE
111  m_secEnvelopes.clear();
112 #endif
113 }

Member Function Documentation

◆ addSpectrometerSector()

void MuonGMR4::MuonDetectorManager::addSpectrometerSector ( ElementPtr< SpectrometerSector > &&  chSector)

Add a spectrometer enevelope object to the manager.

Parameters
chSectorUnique_ptr to the sector

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

156  {
157  m_secEnvelopes.push_back(std::move(chSector));
158  }

◆ addTreeTop()

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

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

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

137  {
138  m_treeTopVector.push_back(pv);
139 }

◆ getAllChambers()

MuonChamberSet MuonGMR4::MuonDetectorManager::getAllChambers ( ) const

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

176  {
177  MuonChamberSet chambers{};
178  std::ranges::for_each(m_secEnvelopes,
179  [&chambers](const ElementPtr<SpectrometerSector>& ms){
180  std::ranges::for_each(ms->chambers(),
181  [&chambers](const SpectrometerSector::ChamberPtr& ch){
182  chambers.insert(ch.get());
183  });
184  });
185  return chambers;
186  }

◆ 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.

◆ getAllSectors()

MuonSectorSet MuonGMR4::MuonDetectorManager::getAllSectors ( ) const

: Returns all MuonChambers associated with the readout geometry

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

168  {
169  MuonSectorSet sectors{};
170  std::ranges::for_each(m_secEnvelopes,
171  [&sectors](const ElementPtr<SpectrometerSector>& ms){
172  sectors.insert(ms.get());
173  });
174  return sectors;
175  }

◆ getChamber()

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

Retrieves the chamber enclosing the channel's readout element.

Parameters
channelIdIdentifier of a muon channel of interest

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

164  {
166  }

◆ getDetectorTypes()

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

Returns a list of all detector types.

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

143  {
144  std::vector<ActsTrk::DetectorType> types{};
145  if (!m_mdtEles.empty()) types.push_back(ActsTrk::DetectorType::Mdt);
146  if (!m_tgcEles.empty()) types.push_back(ActsTrk::DetectorType::Tgc);
147  if (!m_rpcEles.empty()) types.push_back(ActsTrk::DetectorType::Rpc);
148  if (!m_sTgcEles.empty()) types.push_back(ActsTrk::DetectorType::sTgc);
149  if (!m_mmEles.empty()) types.push_back(ActsTrk::DetectorType::Mm);
150  return types;
151 }

◆ 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 130 of file MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx.

130  {
131  return m_treeTopVector.size();
132 }

◆ 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.

◆ getSectorEnvelope()

const SpectrometerSector * MuonGMR4::MuonDetectorManager::getSectorEnvelope ( const Identifier channelId) const

Retrieves the spectrometer envelope enclosing the channel's readout element.

Parameters
channelIdIdentifier of a muon channel of interest

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

159  {
161  }

◆ getTreeTop()

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

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

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

133  {
134  return m_treeTopVector[i];
135 }

◆ idHelperSvc()

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

Returns a pointer to the central MuonIdHelperSvc.

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

140  {
141  return m_idHelperSvc.get();
142 }

◆ 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 }

◆ linkElements() [1/2]

template<>
void MuonGMR4::MuonDetectorManager::linkElements ( ElementStorage< MdtReadoutElement > &  detStore,
MdtReadoutElement refEle 
)

The complementary detector element has not yet been parsed.

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

194  {
195  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
196  const int complMl = refEle->multilayer() == 2 ? 1 : idHelper.multilayerMax(refEle->identify());
197  const Identifier complMlId = idHelper.multilayerID(refEle->identify(), complMl);
198  const unsigned mlHash =static_cast<unsigned>(m_idHelperSvc->detElementHash(complMlId));
200  if (mlHash >= detStore.size() || !detStore[mlHash]) {
201  return;
202  }
203  detStore[mlHash]->setComplementaryReadoutEle(refEle);
204  refEle->setComplementaryReadoutEle(detStore[mlHash].get());
205 
206 }

◆ linkElements() [2/2]

template<class MuonDetectorType >
void MuonGMR4::MuonDetectorManager::linkElements ( ElementStorage< MuonDetectorType > &  allStore,
MuonDetectorType *  readOutEle 
)
private

Method that connect the same elements from the station with the parsed readout Element and vice versa.

The way how they are inter-linked depends on the detector technology For the moment, only link Mdts from the same multilayer against each other.

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

190  {
191  ATH_MSG_VERBOSE("No inter-linking for "<<ActsTrk::to_string(reEle->detectorType())<<" "<<detStore.size());
192 }

◆ 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 130 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_secEnvelopes

ElementStorage<SpectrometerSector> MuonGMR4::MuonDetectorManager::m_secEnvelopes {}
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
MuonGMR4::SpectrometerSector::ChamberPtr
GeoModel::TransientConstSharedPtr< Chamber > ChamberPtr
Definition: SpectrometerSector.h:42
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
MuonGMR4::MuonReadoutElement::chamber
const Chamber * chamber() const
Returns the pointer to the chamber enclosing this readout element.
MuonGMR4::MuonReadoutElement::msSector
const SpectrometerSector * msSector() const
Returns the pointer to the envelope volume enclosing all chambers in the sector.
MuonGMR4::MuonDetectorManager::MuonSectorSet
std::set< const SpectrometerSector *, MSEnvelopeSorter > MuonSectorSet
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:113
MuonGMR4::MuonDetectorManager::m_tgcEles
ElementStorage< TgcReadoutElement > m_tgcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:136
MuonGMR4::MuonDetectorManager::m_secEnvelopes
ElementStorage< SpectrometerSector > m_secEnvelopes
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:133
ActsTrk::DetectorType::Tgc
@ Tgc
Resitive Plate Chambers.
MuonGMR4::MuonDetectorManager::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:130
MuonGMR4::MuonDetectorManager::m_rpcEles
ElementStorage< RpcReadoutElement > m_rpcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:137
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
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:85
MdtIdHelper
Definition: MdtIdHelper.h:61
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:52
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MuonGMR4::MuonDetectorManager::m_mdtEles
ElementStorage< MdtReadoutElement > m_mdtEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:135
MuonGMR4::MuonDetectorManager::m_treeTopVector
std::vector< PVConstLink > m_treeTopVector
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:141
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
python.root_lsr_rank.types
types
Definition: root_lsr_rank.py:35
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MuonGMR4::MuonDetectorManager::m_sTgcEles
ElementStorage< sTgcReadoutElement > m_sTgcEles
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:138
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
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:139
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.
Identifier
Definition: IdentifierFieldParser.cxx:14