ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MdtROD_Decoder Class Reference

#include <MdtROD_Decoder.h>

Inheritance diagram for MdtROD_Decoder:
Collaboration diagram for MdtROD_Decoder:

Public Types

using leading_amt_map = std::map< uint16_t, std::unique_ptr< MdtAmtHit > >
 

Public Member Functions

 MdtROD_Decoder (const std::string &type, const std::string &name, const IInterface *parent)
 constructor More...
 
virtual ~MdtROD_Decoder ()=default
 destructor More...
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
MDT_Hid2RESrcIDgetHid2RE () const
 TODO Add documentation. More...
 
StatusCode fillCollections (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, MdtCsmContainer &rdoIDC) const
 
int specialROBNumber () const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool InterfaceID. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::unique_ptr< MDT_Hid2RESrcIDm_hid2re {}
 
SG::ReadCondHandleKey< MuonMDT_CablingMapm_readKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
int m_specialROBNumber {-1}
 TMP special ROB number for sector13 runs. More...
 
std::atomic_uint m_nCache ATLAS_THREAD_SAFE = 0
 
std::atomic_uint m_nNotCache ATLAS_THREAD_SAFE = 0
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 31 of file MdtROD_Decoder.h.

Member Typedef Documentation

◆ leading_amt_map

using MdtROD_Decoder::leading_amt_map = std::map<uint16_t, std::unique_ptr<MdtAmtHit> >

Definition at line 33 of file MdtROD_Decoder.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MdtROD_Decoder()

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

constructor

Definition at line 21 of file MdtROD_Decoder.cxx.

21  :
23  declareInterface<MdtROD_Decoder>(this);
24 
25  declareProperty("SpecialROBNumber", m_specialROBNumber = -1);
26 }

◆ ~MdtROD_Decoder()

virtual MdtROD_Decoder::~MdtROD_Decoder ( )
virtualdefault

destructor

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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

◆ fillCollections()

StatusCode MdtROD_Decoder::fillCollections ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag,
MdtCsmContainer rdoIDC 
) const

Definition at line 50 of file MdtROD_Decoder.cxx.

50  {
51 #define WARNING_WITH_LINE(msg) ATH_MSG_WARNING(__func__ << "():" << __LINE__<< " " << msg)
52  // m_debug = (m_log.level() <= MSG::DEBUG); // use to control if output debug info.
53  // decoding classes
54  MdtCsmReadOut csmReadOut;
55  MdtAmtReadOut amtReadOut;
56  MdtHptdcReadOut hptdcReadOut;
57 
58  ATH_MSG_DEBUG("fillCollection: starting");
59  uint32_t wordPos = 0;
60 
61  // Check the ROB and ROD fragment for lenght and version consistency. E.P.
62 
63  try {
64  robFrag.check();
65  } catch (const eformat::Issue& ex) {
66  WARNING_WITH_LINE(ex.what());
67  return StatusCode::FAILURE; // error in fragment - we search for no collection
68  }
69 
70  // Check the ROB status word for truncation or corruption E.P.
71 
72  uint32_t nstat = robFrag.nstatus();
73 
74  if (nstat) {
75  const uint32_t* it{nullptr};
76  robFrag.status(it);
77 
78  if (*it) {
79  WARNING_WITH_LINE("Error in ROB status word: 0x" << std::hex << *it << std::dec);
80 
81  // the status word analysis in case of eformat version > 3.0
82  // if ( (robFrag.version() >> 16) > 0x0300 ) {
83 
84  // various checks to be defined
85 
86  //}
87  return StatusCode::FAILURE;
88  }
89  }
90 
91  // here go the checks on the ROD header
92 
93  const unsigned int size = robFrag.rod_ndata(); // Think this is right - it was size() before. Ed. // Yes it is... Enrico
94 
95  // FIXME - Removed debug output for the moment. EJWM
96  // if (m_debug) log << MSG::DEBUG
97  // << "Collection identifier : " << csmOfflineId.getString() << endmsg;
98  //
99  // if (m_debug) log << MSG::DEBUG
100  // << "**********Decoder dumping the words******** " << endmsg;
101  // if (size > 0) {
102  // log << MSG::DEBUG << "The size of this ROD-read is " << size << endmsg;
103  // for (unsigned int i=0; i < size; i++)
104  // if (m_debug) log << MSG::DEBUG << "word " << i
105  // << " = " << MSG::hex << robFrag[i] << MSG::dec << endmsg;
106  // }
107  // else {
108  // if (m_debug) log << MSG::DEBUG << " Buffer size 0 ! "
109  // << endmsg;
110  // return;
111  // }
112 
113  leading_amt_map leadingHitMap{};
114 
115  // Decode the SourceId from the ROD Header
116  SourceIdentifier sid(robFrag.rod_source_id());
117 
119  cabling_data.subdetectorId = sid.subdetector_id();
120  cabling_data.mrod = sid.module_id();
121 
122  // Get the first word of a buffer:
124  robFrag.rod_data(vint);
125 
126  ATH_MSG_DEBUG("**********Decoder dumping the words******** ");
127 
128  if (size > 0) {
129  ATH_MSG_DEBUG("The size of this ROD-read is ");
130  for (unsigned int i = 0; i < size; i++) ATH_MSG_DEBUG("word " << i << " = " << MSG::hex << vint[i] << MSG::dec);
131  } else {
132  WARNING_WITH_LINE("Buffer size 0 ! ");
133  return StatusCode::FAILURE;
134  }
135 
136  csmReadOut.decodeWord(vint[wordPos]);
137 
138  if (csmReadOut.is_BOB()) {
139  ATH_MSG_DEBUG("Found the beginning of buffer ");
140  // Check that Lvl1d matches the one from the ROD header
141  ATH_MSG_DEBUG("Level 1 Id : " << csmReadOut.lvl1Id());
142  } else {
143  ATH_MSG_ERROR(" Beginning of block not found ! ");
144  ATH_MSG_ERROR(" Subdetector, ROD ID: 0x" << MSG::hex << cabling_data.subdetectorId << MSG::dec << ", 0x" << cabling_data.mrod
145  << MSG::dec);
146  }
147 
148  if (size < 2) {
149  WARNING_WITH_LINE("Too few ROD words: " << size);
150  return StatusCode::FAILURE;
151  }
152  ++wordPos;
153  csmReadOut.decodeWord(vint[wordPos]);
154  if (csmReadOut.is_EOB()) {
155  ATH_MSG_WARNING("No CSM data ROD ID: 0x" << MSG::hex << cabling_data.subdetectorId <<
156  ", 0x" << static_cast<unsigned int>(cabling_data.mrod) << MSG::dec);
157  return StatusCode::SUCCESS;
158  }
159 
161  const MuonMDT_CablingMap* readCdo{*readHandle};
162  if (!readCdo) {
163  WARNING_WITH_LINE("Null pointer to the read conditions object");
164  return StatusCode::FAILURE;
165  }
166  auto& msg = msgStream();
167  while (!csmReadOut.is_EOB()) {
168  while ((!csmReadOut.is_BOL()) && (!csmReadOut.is_EOB())) {
169  wordPos += 1;
170  if (wordPos >= size) {
171  WARNING_WITH_LINE("failure: data corrupted");
172  return StatusCode::FAILURE;
173  }
174  csmReadOut.decodeWord(vint[wordPos]);
175  }
176 
177  if (csmReadOut.is_BOL()) {
178  ATH_MSG_DEBUG("Found the Beginnning of Link ");
179  } else if (csmReadOut.is_EOB()) {
180  WARNING_WITH_LINE(" failure: collection not found");
181  return StatusCode::FAILURE;
182  }
183 
184  // uint16_t subdetId = 0x61;
185  // uint16_t mrodId = csmReadOut.mrodId();
186 
187  cabling_data.csm = csmReadOut.csmId();
188 
189  // Get the offline identifier from the MDT cabling service
190  // TDC and Tube identifier are dummy, only the chamber map is needed here
191 
192  ATH_MSG_DEBUG("subdetId : " << cabling_data.subdetectorId << " "
193  << "mrodId : " << cabling_data.mrod << " "
194  << "csmId : " << cabling_data.csm);
195 
196  cabling_data.tdcId = 0xff;
197  cabling_data.channelId = 0xff;
198 
199  Identifier moduleId{0};
200  IdentifierHash idHash{0};
201  bool cab = readCdo->getOfflineId(cabling_data, msg) && readCdo->getMultiLayerCode(cabling_data, moduleId, idHash, msg);
202 
203  ATH_MSG_DEBUG("getOfflineIdfromOnlineID result: " << cabling_data);
204 
205  if (!cab) {
206  ATH_MSG_WARNING("Cabling not understood");
207  ATH_MSG_WARNING("Skip decoding of CSM link, subdetId : " << MSG::hex << std::showbase << cabling_data.subdetectorId << " "
208  << "mrodId : " << cabling_data.mrod << " " << MSG::dec
209  << "csmId : " << cabling_data.csm);
210  // assert(false);
211  // continue; // Go to next link instead of crashing (here or later) E.P.
212 
213  // In case of failure this produce an infinite loop because
214  // you do not decode the next word before doing "continue".
215  // I commented it out.
216 
217  // The previous implementation was ok, the bad BOL was simply
218  // skipped. This means that you skip decoding this chamber.
219 
220  // I'm not sure how you can recover this error. I think you
221  // simple have to store the error condition in the
222  // StatusCode word returned to the client.
223  // } else if (!isValid) {
224  // ATH_MSG_DEBUG("Offline identifier returned by MdtIdHelper is not valid");
225  // ATH_MSG_DEBUG("Skip decoding of CSM link, subdetId : "
226  // << MSG::hex << std::showbase << subdetId << " "
227  // << "mrodId : " << mrodId << " " << MSG::dec
228  // << "csmId : " << csmId);
229 
230  } else {
231  // EJWM Removed: if ( moduleId == csmOfflineId)
232  // Can't see how to keep that in here now, and also not really sure what the point of it is
233  // Might be wrong though - job for experts to look into.
234  // FIXME
235 
236  const bool isHpTdc = m_idHelperSvc->hasHPTDC(moduleId);
237 
238  // Create MdtCsm and try to get it from the cache via the IDC_WriteHandle
239  std::unique_ptr<MdtCsm> collection{nullptr};
240  MdtCsmContainer::IDC_WriteHandle lock = rdoIDC.getWriteHandle(idHash);
241  if (lock.alreadyPresent()) {
242  ATH_MSG_DEBUG("collections already found, do not convert");
243  ++m_nCache;
244  } else {
245  ATH_MSG_DEBUG(" Collection ID = " << m_idHelperSvc->toString(moduleId) << " does not exist, create it ");
246  collection = std::make_unique<MdtCsm>(moduleId, idHash);
247  ++m_nNotCache;
248  }
249 
250  // Set values (keep Identifier and IdentifierHash the same though)
251  if (collection)
252  collection->set_values(collection->identify(), collection->identifyHash(), cabling_data.subdetectorId, cabling_data.mrod,
253  cabling_data.csm);
254 
255  wordPos += 1;
256  if (wordPos >= size) {
257  WARNING_WITH_LINE("failure: data corrupted");
258  return StatusCode::FAILURE;
259  }
260  csmReadOut.decodeWord(vint[wordPos]);
261  if (!csmReadOut.is_TLP()) { ATH_MSG_DEBUG("failure: TDC Link Present not found "); }
262 
263  // Loop on the TDCs blocks, if present
264  wordPos += 1;
265  if (wordPos >= size) {
266  WARNING_WITH_LINE("failure: data corrupted");
267  return StatusCode::FAILURE;
268  }
269  isHpTdc ? hptdcReadOut.decodeWord(vint[wordPos]) : amtReadOut.decodeWord(vint[wordPos]);
270  csmReadOut.decodeWord(vint[wordPos]);
271  while (!csmReadOut.is_TWC()) {
272  uint16_t tdcNum = isHpTdc ? hptdcReadOut.tdcId() : amtReadOut.tdcId();
273 
274  ATH_MSG_DEBUG(" Decoding data from TDC number : " << tdcNum);
275 
276  // increase word count by one
277  wordPos += 1;
278  if (wordPos >= size) {
279  WARNING_WITH_LINE("failure: data corrupted");
280  return StatusCode::FAILURE;
281  }
282 
283  isHpTdc ? hptdcReadOut.decodeWord(vint[wordPos]) : amtReadOut.decodeWord(vint[wordPos]);
284 
285  std::unique_ptr<MdtAmtHit> amtHit{nullptr};
286  // Loop on the TDC data words and create the corresponding
287  // RDO's
288  while (!((isHpTdc ? hptdcReadOut.is_EOT() : amtReadOut.is_EOT()) ||
289  (isHpTdc ? hptdcReadOut.is_BOT() : amtReadOut.is_BOT()) ||
290  (isHpTdc ? csmReadOut.is_TWC() : amtReadOut.is_TWC()))) {
291  isHpTdc ? hptdcReadOut.decodeWord(vint[wordPos]) : amtReadOut.decodeWord(vint[wordPos]);
292  int tdcCounts;
294  // decode the tdc channel number
295 
296  // Check whether this channel has already been
297  // created for this CSM
298 
299  if ((isHpTdc ? hptdcReadOut.is_TSM() : amtReadOut.is_TSM()) &&
300  (isHpTdc ? hptdcReadOut.isLeading() : amtReadOut.isLeading()) && collection) {
301  chanNum = isHpTdc ? hptdcReadOut.channel() : amtReadOut.channel();
302 
303  amtHit = std::make_unique<MdtAmtHit>(tdcNum, chanNum);
304  amtHit->setValues((isHpTdc ? hptdcReadOut.coarse() : amtReadOut.coarse()),
305  (isHpTdc ? hptdcReadOut.fine() : amtReadOut.fine()), 0);
306  amtHit->addData(vint[wordPos]);
307  leadingHitMap.insert(std::make_pair(chanNum, std::move(amtHit)));
308  } else if ((isHpTdc ? hptdcReadOut.is_TSM() : amtReadOut.is_TSM()) &&
309  !(isHpTdc ? hptdcReadOut.isLeading() : amtReadOut.isLeading()) && collection) {
310  chanNum = isHpTdc ? hptdcReadOut.channel() : amtReadOut.channel();
311  leading_amt_map::iterator chanPosition = leadingHitMap.find(chanNum);
312 
313  if (chanPosition != leadingHitMap.end()) {
314  // get the amt hit corresponding to the first data word
315  amtHit = std::move(chanPosition->second);
316  uint16_t coarse = amtHit->coarse();
317  uint16_t fine = amtHit->fine();
318  int tdcCountsFirst = coarse * 32 + fine;
319 
320  // get the tdc counts of the current data word
321  tdcCounts =
322  isHpTdc ? hptdcReadOut.coarse() * 32 + hptdcReadOut.fine() : amtReadOut.coarse() * 32 + amtReadOut.fine();
323  int width = tdcCounts - tdcCountsFirst;
324 
325  amtHit->setValues(coarse, fine, width);
326  amtHit->addData(vint[wordPos]);
327  collection->push_back(std::move(amtHit));
328 
329  // delete the channel from the map
330  leadingHitMap.erase(chanPosition);
331  } else {
332  ATH_MSG_DEBUG("failure: corresponding leading edge not found for the trailing edge tdc: " << tdcNum << " chan: "
333  << chanNum);
334  }
335 
336  } else if ((isHpTdc ? hptdcReadOut.is_TCM() : amtReadOut.is_TCM()) && collection) {
337  uint16_t chanNum = isHpTdc ? hptdcReadOut.channel() : amtReadOut.channel();
338 
339  amtHit = std::make_unique<MdtAmtHit>(tdcNum, chanNum);
340  amtHit->setValues((isHpTdc ? hptdcReadOut.coarse() : amtReadOut.coarse()),
341  (isHpTdc ? hptdcReadOut.fine() : amtReadOut.fine()),
342  (isHpTdc ? hptdcReadOut.width() : amtReadOut.width()));
343  amtHit->addData(vint[wordPos]);
344  collection->push_back(std::move(amtHit));
345  }
346 
347  // increase word count by one
348  wordPos += 1;
349  if (wordPos >= size) {
350  WARNING_WITH_LINE("failure: data corrupted");
351  return StatusCode::FAILURE;
352  }
353 
354  isHpTdc ? hptdcReadOut.decodeWord(vint[wordPos]) : amtReadOut.decodeWord(vint[wordPos]);
355 
356  if (isHpTdc) csmReadOut.decodeWord(vint[wordPos]);
357 
358  } // End of loop on AMTs
359 
360  if (collection) {
361  for (auto& itHit : leadingHitMap) { collection->push_back(std::move(itHit.second)); }
362  }
363  leadingHitMap.clear();
364 
365  // increase the decoding position only if it's end of TDC
366  // i.e. not operating in TDC trailer suppression mode
367  if ((isHpTdc ? hptdcReadOut.is_EOT() : amtReadOut.is_EOT())) {
368  wordPos += 1;
369  if (wordPos >= size) {
370  WARNING_WITH_LINE("failure: data corrupted");
371  return StatusCode::FAILURE;
372  }
373  }
374  csmReadOut.decodeWord(vint[wordPos]);
375  isHpTdc ? hptdcReadOut.decodeWord(vint[wordPos]) : amtReadOut.decodeWord(vint[wordPos]);
376  } // End of loop on TDCs
377  if (collection) ATH_CHECK(lock.addOrDelete(std::move(collection)));
378  // Collection has been found, go out
379  // return;
380  } // Check for the chamber offline id = collection offline id
381  wordPos += 1;
382  if (wordPos >= size) {
383  WARNING_WITH_LINE("Data corrupted");
384  return StatusCode::FAILURE;
385  }
386  csmReadOut.decodeWord(vint[wordPos]);
387  }
388  return StatusCode::SUCCESS;
389 }

◆ finalize()

StatusCode MdtROD_Decoder::finalize ( )
overridevirtual

Definition at line 41 of file MdtROD_Decoder.cxx.

41  {
42  if (m_nCache > 0 || m_nNotCache > 0) {
43  const float cacheFraction = ((float)m_nCache) / ((float)(m_nCache + m_nNotCache));
44  ATH_MSG_INFO("Fraction of fills that use the cache = " << cacheFraction);
45  }
46 
47  return StatusCode::SUCCESS;
48 }

◆ getHid2RE()

MDT_Hid2RESrcID* MdtROD_Decoder::getHid2RE ( ) const
inline

TODO Add documentation.

What is a MDT_Hid2RESrcID?

Definition at line 51 of file MdtROD_Decoder.h.

51 { return m_hid2re.get(); }

◆ initialize()

StatusCode MdtROD_Decoder::initialize ( )
overridevirtual

Definition at line 30 of file MdtROD_Decoder.cxx.

30  {
31  ATH_CHECK(m_idHelperSvc.retrieve());
32 
33  // Here the mapping service has to be initialized
34  m_hid2re = std::make_unique<MDT_Hid2RESrcID>();
35  ATH_CHECK(m_hid2re->set(&m_idHelperSvc->mdtIdHelper()));
37 
38  return StatusCode::SUCCESS;
39 }

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

◆ interfaceID()

const InterfaceID & MdtROD_Decoder::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 28 of file MdtROD_Decoder.cxx.

28 { return IID_IMdtROD_Decoder; }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ specialROBNumber()

int MdtROD_Decoder::specialROBNumber ( ) const
inline

Definition at line 55 of file MdtROD_Decoder.h.

55 { return m_specialROBNumber; }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

std::atomic_uint m_nCache MdtROD_Decoder::ATLAS_THREAD_SAFE = 0
mutableprivate

Definition at line 68 of file MdtROD_Decoder.h.

◆ ATLAS_THREAD_SAFE [2/2]

std::atomic_uint m_nNotCache MdtROD_Decoder::ATLAS_THREAD_SAFE = 0
mutableprivate

Definition at line 69 of file MdtROD_Decoder.h.

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

std::unique_ptr<MDT_Hid2RESrcID> MdtROD_Decoder::m_hid2re {}
private

Definition at line 58 of file MdtROD_Decoder.h.

◆ m_idHelperSvc

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

Definition at line 61 of file MdtROD_Decoder.h.

◆ m_readKey

SG::ReadCondHandleKey<MuonMDT_CablingMap> MdtROD_Decoder::m_readKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
private

Definition at line 59 of file MdtROD_Decoder.h.

◆ m_specialROBNumber

int MdtROD_Decoder::m_specialROBNumber {-1}
private

TMP special ROB number for sector13 runs.

Definition at line 64 of file MdtROD_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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MdtCsmReadOut::is_TWC
bool is_TWC() const
Definition: MdtCsmReadOut.h:63
MdtAmtReadOut::fine
uint16_t fine()
Definition: MdtAmtReadOut.h:106
MdtCsmReadOut::decodeWord
void decodeWord(uint32_t dataWord)
Definition: MdtCsmReadOut.cxx:26
MdtROD_Decoder::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtROD_Decoder.h:61
MdtHptdcReadOut::is_TSM
bool is_TSM() const
Definition: MdtHptdcReadOut.h:79
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MdtHptdcReadOut::decodeWord
void decodeWord(uint32_t dataWord)
Definition: MdtHptdcReadOut.cxx:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
MdtAmtReadOut::channel
uint16_t channel()
Definition: MdtAmtReadOut.h:104
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IdentifiableContainerMT::getWriteHandle
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
Definition: IdentifiableContainerMT.h:251
MdtAmtReadOut
Definition: MdtAmtReadOut.h:15
MdtHptdcReadOut::coarse
uint16_t coarse() const
Definition: MdtHptdcReadOut.h:91
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MdtROD_Decoder::m_hid2re
std::unique_ptr< MDT_Hid2RESrcID > m_hid2re
Definition: MdtROD_Decoder.h:58
Issue
Configuration Issue
Definition: PscIssues.h:31
WARNING_WITH_LINE
#define WARNING_WITH_LINE(msg)
skel.it
it
Definition: skel.GENtoEVGEN.py:423
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
MdtAmtReadOut::is_TCM
bool is_TCM()
Definition: MdtAmtReadOut.h:91
MdtCsmReadOut::is_TLP
bool is_TLP() const
Definition: MdtCsmReadOut.h:62
createCablingJSON.cabling_data
dictionary cabling_data
Definition: createCablingJSON.py:18
IdentifiableContainerMT::IDC_WriteHandle::alreadyPresent
bool alreadyPresent()
Definition: IdentifiableContainerMT.h:62
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MdtROD_Decoder::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition: MdtROD_Decoder.h:59
MdtHptdcReadOut::width
uint16_t width() const
Definition: MdtHptdcReadOut.h:93
MdtHptdcReadOut::isLeading
bool isLeading() const
Definition: MdtHptdcReadOut.h:95
MdtCsmReadOut::is_BOL
bool is_BOL() const
Definition: MdtCsmReadOut.h:61
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
MdtHptdcReadOut::fine
uint16_t fine() const
Definition: MdtHptdcReadOut.h:92
MdtCsmReadOut::csmId
uint16_t csmId() const
Definition: MdtCsmReadOut.h:74
MdtAmtReadOut::tdcId
uint16_t tdcId()
Definition: MdtAmtReadOut.h:99
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MdtCsmReadOut
Definition: MdtCsmReadOut.h:15
MdtCsmReadOut::lvl1Id
uint32_t lvl1Id() const
Definition: MdtCsmReadOut.h:67
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
MuonMDT_CablingMap
Definition: MuonMDT_CablingMap.h:24
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MdtHptdcReadOut::is_BOT
bool is_BOT() const
Definition: MdtHptdcReadOut.h:75
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
MdtHptdcReadOut::is_EOT
bool is_EOT() const
Definition: MdtHptdcReadOut.h:77
MdtHptdcReadOut::is_TCM
bool is_TCM() const
Definition: MdtHptdcReadOut.h:81
lumiFormat.i
int i
Definition: lumiFormat.py:92
MdtHptdcReadOut
Definition: MdtHptdcReadOut.h:15
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtHptdcReadOut::tdcId
uint16_t tdcId() const
Definition: MdtHptdcReadOut.h:86
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
MdtCsmReadOut::is_EOB
bool is_EOB() const
Definition: MdtCsmReadOut.h:64
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MdtCablingData
Definition: MdtCablingData.h:82
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
MdtCsmReadOut::is_BOB
bool is_BOB() const
Definition: MdtCsmReadOut.h:59
MdtAmtReadOut::decodeWord
void decodeWord(uint32_t dataWord)
Definition: MdtAmtReadOut.cxx:29
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
IdentifiableContainerMT::IDC_WriteHandle::addOrDelete
StatusCode addOrDelete(std::unique_ptr< T > ptr)
Definition: IdentifiableContainerMT.h:56
MdtAmtReadOut::is_TWC
bool is_TWC()
Definition: MdtAmtReadOut.h:96
MdtAmtReadOut::coarse
uint16_t coarse()
Definition: MdtAmtReadOut.h:105
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
MdtROD_Decoder::m_specialROBNumber
int m_specialROBNumber
TMP special ROB number for sector13 runs.
Definition: MdtROD_Decoder.h:64
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
MdtAmtReadOut::is_EOT
bool is_EOT()
Definition: MdtAmtReadOut.h:85
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
IdentifierHash
Definition: IdentifierHash.h:38
MdtAmtReadOut::is_TSM
bool is_TSM()
Definition: MdtAmtReadOut.h:89
MdtAmtReadOut::isLeading
bool isLeading()
Definition: MdtAmtReadOut.h:111
MdtAmtReadOut::is_BOT
bool is_BOT()
Definition: MdtAmtReadOut.h:83
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
readCCLHist.float
float
Definition: readCCLHist.py:83
fitman.k
k
Definition: fitman.py:528
MdtAmtReadOut::width
uint16_t width()
Definition: MdtAmtReadOut.h:107
MdtHptdcReadOut::channel
uint16_t channel() const
Definition: MdtHptdcReadOut.h:90
MdtROD_Decoder::leading_amt_map
std::map< uint16_t, std::unique_ptr< MdtAmtHit > > leading_amt_map
Definition: MdtROD_Decoder.h:33