ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonLayerHashProviderTool Class Reference

#include <MuonLayerHashProviderTool.h>

Inheritance diagram for Muon::MuonLayerHashProviderTool:
Collaboration diagram for Muon::MuonLayerHashProviderTool:

Classes

struct  RegionHashesPerSector

Public Types

using HashVec = std::vector<IdentifierHash>
 define data structure
using RegionHashVec = std::array<HashVec, MuonStationIndex::sectorLayerHashMax()>
using TechnologyIndex = MuonStationIndex::TechnologyIndex
using TechnologyRegionHashVec = std::array< RegionHashVec, techMax>
using RegionHashesPerSectorVec = std::array<RegionHashesPerSector, MuonStationIndex::numberOfSectors()>

Public Member Functions

const HashVecgetHashes (int sector, TechnologyIndex technologyIndex, unsigned int sectorLayerHash) const
 access hashes for a given sector, technology and layer hash
 MuonLayerHashProviderTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default AlgTool functions.
virtual ~MuonLayerHashProviderTool ()=default
StatusCode initialize () override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface

Static Public Attributes

static constexpr unsigned techMax = MuonStationIndex::toInt(TechnologyIndex::TechnologyIndexMax)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void insertTechnology (const MuonIdHelper &idHelper)
 insert hashes of a given technology
void insertTgcs () const
 insert hashes for the tgcs
void insertHash (const IdentifierHash &hash, const Identifier &id) const
 insert a single hash for a given identifier
void insertHash (int sector, const IdentifierHash &hash, const Identifier &id) const
 insert a single hash for a given identifier and sector
bool initializeSectorMapping ()
 initialize the mapping structure
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

RegionHashesPerSectorVec m_regionHashesPerSector ATLAS_THREAD_SAFE {}
 cachaed hash data structure
std::atomic< bool > m_hashLoaded ATLAS_THREAD_SAFE {false}
std::mutex m_tgcHash {}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_detMgrKey
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 22 of file MuonLayerHashProviderTool.h.

Member Typedef Documentation

◆ HashVec

define data structure

  • sector
    • technology
      • hashes

Definition at line 29 of file MuonLayerHashProviderTool.h.

◆ RegionHashesPerSectorVec

◆ RegionHashVec

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ TechnologyIndex

◆ TechnologyRegionHashVec

Constructor & Destructor Documentation

◆ MuonLayerHashProviderTool()

Muon::MuonLayerHashProviderTool::MuonLayerHashProviderTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Default AlgTool functions.

Definition at line 15 of file MuonLayerHashProviderTool.cxx.

15 :
16 AthAlgTool(type,name,parent) {
17 declareInterface<MuonLayerHashProviderTool>(this);
18
19 }
AthAlgTool()
Default constructor:

◆ ~MuonLayerHashProviderTool()

virtual Muon::MuonLayerHashProviderTool::~MuonLayerHashProviderTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getHashes()

const std::vector< IdentifierHash > & Muon::MuonLayerHashProviderTool::getHashes ( int sector,
TechnologyIndex technologyIndex,
unsigned int sectorLayerHash ) const
inline

access hashes for a given sector, technology and layer hash

Definition at line 88 of file MuonLayerHashProviderTool.h.

89 {
90 if (!m_hashLoaded){
91 insertTgcs();
92 }
93 using namespace MuonStationIndex;
94 return m_regionHashesPerSector[sector-1].technologyRegionHashVecs[toInt(technologyIndex)][sectorLayerHash];
95 }
void insertTgcs() const
insert hashes for the tgcs
constexpr int toInt(const EnumType enumVal)
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer

◆ initialize()

StatusCode Muon::MuonLayerHashProviderTool::initialize ( )
override

Definition at line 21 of file MuonLayerHashProviderTool.cxx.

21 {
22
23 ATH_CHECK(m_idHelperSvc.retrieve());
24 ATH_CHECK(m_detMgrKey.initialize());
25
27 ATH_MSG_ERROR("Failed to initialize sector mapping");
28 return StatusCode::FAILURE;
29 }
30
31 return StatusCode::SUCCESS;
32 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
bool initializeSectorMapping()
initialize the mapping structure
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ initializeSectorMapping()

bool Muon::MuonLayerHashProviderTool::initializeSectorMapping ( )
private

initialize the mapping structure

Definition at line 103 of file MuonLayerHashProviderTool.cxx.

103 {
104 // set sector numbers
105 for( unsigned int i=0;i<m_regionHashesPerSector.size();++i ) {
106 m_regionHashesPerSector[i].sector=i+1;
107 }
108 ATH_MSG_DEBUG("Initializing hashes: number of sectors " << numberOfSectors()
109 << " sectorLayers " << sectorLayerHashMax() );
110
111 // add technologies
112 if (m_idHelperSvc->hasMDT()) insertTechnology(m_idHelperSvc->mdtIdHelper());
113 if (m_idHelperSvc->hasRPC()) insertTechnology(m_idHelperSvc->rpcIdHelper());
114 if (m_idHelperSvc->hasCSC()) insertTechnology(m_idHelperSvc->cscIdHelper());
115 if (m_idHelperSvc->hasMM()) insertTechnology(m_idHelperSvc->mmIdHelper());
116 if (m_idHelperSvc->hasSTGC()) insertTechnology(m_idHelperSvc->stgcIdHelper());
117 return true;
118 }
#define ATH_MSG_DEBUG(x)
void insertTechnology(const MuonIdHelper &idHelper)
insert hashes of a given technology
constexpr unsigned numberOfSectors()
return total number of sectors
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ insertHash() [1/2]

void Muon::MuonLayerHashProviderTool::insertHash ( const IdentifierHash & hash,
const Identifier & id ) const
private

insert a single hash for a given identifier

Definition at line 35 of file MuonLayerHashProviderTool.cxx.

35 {
36 insertHash(m_idHelperSvc->sector(id),hash,id);
37 }
void insertHash(const IdentifierHash &hash, const Identifier &id) const
insert a single hash for a given identifier

◆ insertHash() [2/2]

void Muon::MuonLayerHashProviderTool::insertHash ( int sector,
const IdentifierHash & hash,
const Identifier & id ) const
private

insert a single hash for a given identifier and sector

Definition at line 39 of file MuonLayerHashProviderTool.cxx.

39 {
40 const int techIndex = toInt(m_idHelperSvc->technologyIndex(id));
41 const int layHash = sectorLayerHash(m_idHelperSvc->regionIndex(id),m_idHelperSvc->layerIndex(id));
42 m_regionHashesPerSector[sector-1].technologyRegionHashVecs[techIndex][layHash].push_back(hash);
43 }

◆ insertTechnology()

void Muon::MuonLayerHashProviderTool::insertTechnology ( const MuonIdHelper & idHelper)
private

insert hashes of a given technology

Definition at line 45 of file MuonLayerHashProviderTool.cxx.

45 {
46
47 // loop over all available STGC collection identifiers and order them per sector
50 for( ;it!=it_end; ++it ){
51 IdentifierHash hash;
52 idHelper.get_module_hash(*it,hash);
53 insertHash(hash,*it);
54 }
55
56 }
std::vector< Identifier >::const_iterator const_id_iterator
const_id_iterator module_end() const
const_id_iterator module_begin() const
Iterators over full set of ids.
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const

◆ insertTgcs()

void Muon::MuonLayerHashProviderTool::insertTgcs ( ) const
private

insert hashes for the tgcs

Definition at line 58 of file MuonLayerHashProviderTool.cxx.

58 {
59 std::lock_guard guard{m_tgcHash};
60 if (m_hashLoaded) return;
61 // the tgc's can be in multiple sectors so we need to do something special here
62 SG::ReadCondHandle detMgr{m_detMgrKey};
63
64 MuonSectorMapping sectorMapping;
65
66 // loop over all available TGC collection identifiers and order them per sector
67 MuonIdHelper::const_id_iterator it = m_idHelperSvc->tgcIdHelper().module_begin();
68 MuonIdHelper::const_id_iterator it_end = m_idHelperSvc->tgcIdHelper().module_end();
69 for( ;it!=it_end; ++it ){
70 const MuonGM::TgcReadoutElement* detEl = detMgr->getTgcReadoutElement(*it);
71 if( !detEl ) {
72 ATH_MSG_DEBUG(" No detector element found for " << m_idHelperSvc->toString(*it) );
73 continue;
74 }
75 const IdentifierHash hash = m_idHelperSvc->moduleHash(*it);
76 int nstrips = detEl->nStrips(1);
77 Amg::Vector3D p1 = detEl->channelPos(1,1,1);
78 Amg::Vector3D p2 = detEl->channelPos(1,1,nstrips);
79 std::vector<int> sectors1;
80 sectorMapping.getSectors(p1.phi(),sectors1);
81 std::set<int> added;
82 std::vector<int>::iterator sit = sectors1.begin();
83 std::vector<int>::iterator sit_end = sectors1.end();
84 for( ;sit!=sit_end; ++sit ){
85 insertHash(*sit,hash,*it);
86 added.insert(*sit);
87 }
88
89 std::vector<int> sectors2;
90 sectorMapping.getSectors(p2.phi(),sectors2);
91 sit = sectors2.begin();
92 sit_end = sectors2.end();
93 for( ;sit!=sit_end; ++sit ){
94 if( added.count(*sit) ) continue;
95 added.insert(*sit);
96 insertHash(*sit,hash,*it);
97 }
98 }
99 m_hashLoaded = true;
100 }
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ interfaceID()

const InterfaceID & Muon::MuonLayerHashProviderTool::interfaceID ( )
inlinestatic

access to tool interface

Definition at line 51 of file MuonLayerHashProviderTool.h.

51 {
52 static const InterfaceID IID_MuonLayerHashProviderTool("Muon::MuonLayerHashProviderTool",1,0);
53 return IID_MuonLayerHashProviderTool;
54 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

RegionHashesPerSectorVec m_regionHashesPerSector Muon::MuonLayerHashProviderTool::ATLAS_THREAD_SAFE {}
mutableprivate

cachaed hash data structure

Definition at line 75 of file MuonLayerHashProviderTool.h.

75{};

◆ ATLAS_THREAD_SAFE [2/2]

std::atomic<bool> m_hashLoaded Muon::MuonLayerHashProviderTool::ATLAS_THREAD_SAFE {false}
mutableprivate

Definition at line 76 of file MuonLayerHashProviderTool.h.

76{false};

◆ m_detMgrKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::MuonLayerHashProviderTool::m_detMgrKey
private
Initial value:
{this, "DetMgr", "MuonDetectorManager",
"MuonManager ReadKey for IOV Range intersection"}

Definition at line 81 of file MuonLayerHashProviderTool.h.

81 {this, "DetMgr", "MuonDetectorManager",
82 "MuonManager ReadKey for IOV Range intersection"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonLayerHashProviderTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 79 of file MuonLayerHashProviderTool.h.

79{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_tgcHash

std::mutex Muon::MuonLayerHashProviderTool::m_tgcHash {}
mutableprivate

Definition at line 77 of file MuonLayerHashProviderTool.h.

77{};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ techMax

unsigned Muon::MuonLayerHashProviderTool::techMax = MuonStationIndex::toInt(TechnologyIndex::TechnologyIndexMax)
staticconstexpr

Definition at line 33 of file MuonLayerHashProviderTool.h.


The documentation for this class was generated from the following files: