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

#include <MM_ROD_Decoder.h>

Inheritance diagram for Muon::MM_ROD_Decoder:
Collaboration diagram for Muon::MM_ROD_Decoder:

Public Member Functions

 MM_ROD_Decoder (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~MM_ROD_Decoder ()=default
virtual StatusCode initialize () override
virtual StatusCode fillCollection (const EventContext &, const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &, const std::vector< IdentifierHash > &, std::unordered_map< IdentifierHash, std::unique_ptr< MM_RawDataCollection > > &) const override
 Convert ROBFragments to RDOs.
 DeclareInterfaceID (Muon::IMM_ROD_Decoder, 1, 0)
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

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

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

const MmIdHelperm_MmIdHelper = nullptr
SG::ReadCondHandleKey< Nsw_CablingMapm_cablingKey {this, "CablingMap", "NswCabling","Key of Nsw_CablingMap"}
SG::ReadCondHandleKey< NswDcsDbDatam_dscKey
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 23 of file MM_ROD_Decoder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MM_ROD_Decoder()

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

Definition at line 22 of file MM_ROD_Decoder.cxx.

23: AthAlgTool(type, name, parent)
24{
25 declareInterface<IMM_ROD_Decoder>( this );
26}
AthAlgTool()
Default constructor:

◆ ~MM_ROD_Decoder()

virtual Muon::MM_ROD_Decoder::~MM_ROD_Decoder ( )
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)

◆ DeclareInterfaceID()

Muon::IMM_ROD_Decoder::DeclareInterfaceID ( Muon::IMM_ROD_Decoder ,
1 ,
0  )
inherited

◆ 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

◆ fillCollection()

StatusCode Muon::MM_ROD_Decoder::fillCollection ( const EventContext & ,
const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & ,
const std::vector< IdentifierHash > & ,
std::unordered_map< IdentifierHash, std::unique_ptr< MM_RawDataCollection > > &  ) const
overridevirtual

Convert ROBFragments to RDOs.

Implements Muon::IMM_ROD_Decoder.

Definition at line 45 of file MM_ROD_Decoder.cxx.

46{
47 // check fragment for errors
48 try {
49 robFrag.check();
50 } catch (const eformat::Issue &ex) {
51 ATH_MSG_WARNING(ex.what());
52 return StatusCode::SUCCESS;
53 }
54 const Nsw_CablingMap* mmCablingMap{nullptr};
55 if (!m_cablingKey.empty()) {
56 SG::ReadCondHandle<Nsw_CablingMap> readCondHandle{m_cablingKey, ctx};
57 if(!readCondHandle.isValid()){
58 ATH_MSG_ERROR("Cannot find Micromegas cabling map!");
59 return StatusCode::FAILURE;
60 }
61 mmCablingMap = readCondHandle.cptr();
62 }
63 const NswDcsDbData* dcsData{nullptr};
64 if(!m_dscKey.empty()) {
65 SG::ReadCondHandle<NswDcsDbData> readCondHandle{m_dscKey, ctx};
66 if(!readCondHandle.isValid()){
67 ATH_MSG_ERROR("Cannot find the NSW DcsCondDataObj "<<m_dscKey.fullKey());
68 return StatusCode::FAILURE;
69 }
70 dcsData = readCondHandle.cptr();
71 }
72
73
74 // if the vector of hashes is not empty, then we are in seeded mode
75 bool seeded_mode(!rdoIdhVect.empty());
76
77 // have the NSWCommonDecoder take care of the decoding
78 Muon::nsw::NSWCommonDecoder common_decoder(robFrag);
79 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.get_elinks();
80 ATH_MSG_DEBUG("Retrieved "<<elinks.size()<<" elinks");
81 if (elinks.empty()) return StatusCode::SUCCESS;
82
83
84 // loop on elinks. we need an RDO (collection) per quadruplet!
85 for (auto* elink : elinks) {
86
87 // skip null packets
88 if (elink->isNull()) continue;
89
90 // get the offline ID hash (module ctx) to be passed to the RDO
91 // also specifies the index of the RDO in the container.
92 const char* station_name = elink->elinkId()->is_large_station() ? "MML" : "MMS";
93 int station_eta = (int)elink->elinkId()->station_eta();
94 unsigned int station_phi = (unsigned int)elink->elinkId()->station_phi();
95 unsigned int multi_layer = (unsigned int)elink->elinkId()->multi_layer();
96 unsigned int gas_gap = (unsigned int)elink->elinkId()->gas_gap();
97 Identifier module_ID = m_MmIdHelper->elementID(station_name, station_eta, station_phi);
98
99 IdentifierHash module_hashID{0};
100 m_MmIdHelper->get_module_hash(module_ID, module_hashID);
101
102 // if we are in ROI-seeded mode, check if this hashID is requested
103 if (seeded_mode && std::find(rdoIdhVect.begin(), rdoIdhVect.end(), module_hashID) == rdoIdhVect.end()) continue;
104
105 std::unique_ptr<MM_RawDataCollection>& rdo = rdo_map[module_hashID];
106 if (!rdo) rdo = std::make_unique<MM_RawDataCollection>(module_hashID);
107
108 // loop on all channels of this elink to fill the collection
109 const std::vector<Muon::nsw::VMMChannel *>& channels = elink->get_channels();
110 for (auto *channel : channels) {
111 unsigned int channel_number = channel->channel_number();
112 if (channel_number == 0) continue; // skip disconnected vmm channels
113 Identifier channel_ID = m_MmIdHelper->channelID(module_ID, multi_layer, gas_gap, channel_number); // not validating the IDs (too slow)
114 // now we have to check if for this channel there is a correction of the cabling needed
115 if (mmCablingMap) {
116 std::optional<Identifier> correctedChannelId = mmCablingMap->correctChannel(channel_ID, msgStream());
117 if (!correctedChannelId) {
118 ATH_MSG_DEBUG("Channel was shifted outside its connector and is therefore not decoded into and RDO");
119 continue;
120 }
121 channel_ID = (*correctedChannelId);
122 channel_number = m_MmIdHelper->channel(channel_ID);
123 }
124 if (dcsData && !dcsData->isGood(ctx,channel_ID)) continue;
125
126 rdo->push_back(new MM_RawData(channel_ID, channel_number, channel->tdo(),
127 channel->pdo(), channel->rel_bcid(), true));
128 }
129 }
130
131 return StatusCode::SUCCESS;
132}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
SG::ReadCondHandleKey< Nsw_CablingMap > m_cablingKey
const MmIdHelper * m_MmIdHelper
SG::ReadCondHandleKey< NswDcsDbData > m_dscKey
bool isGood(const EventContext &ctx, const Identifier &channelId, bool issTgcQ1OuterHv=false) const
Returns whether the channel is alive, i.e. DCS state on, etc...
std::optional< Identifier > correctChannel(const Identifier &id, MsgStream &msg) const
const_pointer_type cptr()
str station_name
Simple script to generate a BIS78 cabling map as used for the Monte Carlo processing.

◆ initialize()

StatusCode Muon::MM_ROD_Decoder::initialize ( )
overridevirtual

Definition at line 30 of file MM_ROD_Decoder.cxx.

31{
32 ATH_CHECK(detStore()->retrieve(m_MmIdHelper, "MMIDHELPER"));
33 ATH_CHECK(m_cablingKey.initialize(!m_cablingKey.empty()));
34 ATH_CHECK(m_dscKey.initialize(!m_dscKey.empty()));
35 return StatusCode::SUCCESS;
36}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

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

◆ 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

◆ m_cablingKey

SG::ReadCondHandleKey<Nsw_CablingMap> Muon::MM_ROD_Decoder::m_cablingKey {this, "CablingMap", "NswCabling","Key of Nsw_CablingMap"}
private

Definition at line 33 of file MM_ROD_Decoder.h.

33{this, "CablingMap", "NswCabling","Key of Nsw_CablingMap"};

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

SG::ReadCondHandleKey<NswDcsDbData> Muon::MM_ROD_Decoder::m_dscKey
private
Initial value:
{this, "DcsKey", "NswDcsDbData",
"Key of NswDcsDbData object containing DCS conditions data"}

Definition at line 35 of file MM_ROD_Decoder.h.

35 {this, "DcsKey", "NswDcsDbData",
36 "Key of NswDcsDbData object containing DCS conditions data"};

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

const MmIdHelper* Muon::MM_ROD_Decoder::m_MmIdHelper = nullptr
private

Definition at line 32 of file MM_ROD_Decoder.h.

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


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