ATLAS Offline Software
RpcRdoToPrepDataToolMT.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "GaudiKernel/ThreadLocalContext.h"
13 #include "TrkSurfaces/Surface.h"
16 #include "GeoModelKernel/throwExcept.h"
17 using namespace MuonGM;
18 using namespace Trk;
19 namespace Muon{
22  m_idHelperSvc{idHelperSvc} {
23  const IdentifierHash hashMax = m_idHelperSvc->rpcIdHelper().module_hash_max();
24  rpcPrepDataCollections.resize(hashMax);
25  rpcCoinDataCollections.resize(hashMax);
26 }
28 
29  const IdentifierHash rpdModHash = m_idHelperSvc->moduleHash(chanId);
30  std::unique_ptr<RpcPrepDataCollection>& coll = rpcPrepDataCollections[rpdModHash];
31  if (!coll) {
32  coll = std::make_unique<RpcPrepDataCollection>(rpdModHash);
33  coll->setIdentifier(m_idHelperSvc->chamberId(chanId));
34  }
35  return coll.get();
36 }
38  const IdentifierHash rpdModHash = m_idHelperSvc->moduleHash(chanId);
39  std::unique_ptr<RpcCoinDataCollection>& coll = rpcCoinDataCollections[rpdModHash];
40  if (!coll) {
41  coll = std::make_unique<RpcCoinDataCollection>(rpdModHash);
42  coll->setIdentifier(m_idHelperSvc->chamberId(chanId));
43  }
44  return coll.get();
45 }
46 
47 
48 //___________________________________________________________________________
50  // perform necessary one-off initialization
51 
52  ATH_MSG_INFO("properties are ");
53  ATH_MSG_INFO("produceRpcCoinDatafromTriggerWords " <<m_producePRDfromTriggerWords);
54  ATH_MSG_INFO("reduceCablingOverlap " << m_reduceCablingOverlap);
55  ATH_MSG_INFO("solvePhiAmbiguities " << m_solvePhiAmbiguities);
56  ATH_MSG_INFO("timeShift " << m_timeShift);
58  ATH_MSG_WARNING("Inconsistent setting of properties (solvePhiAmbiguities entails reduceCablingOverlap)");
59  ATH_MSG_WARNING("Resetting reduceCablingOverlap to true");
61  }
62  ATH_MSG_INFO("etaphi_coincidenceTime " << m_etaphi_coincidenceTime);
63  ATH_MSG_INFO("overlap_timeTolerance " << m_overlap_timeTolerance);
64  ATH_MSG_INFO("Correct prd time from cool db " << m_RPCInfoFromDb);
65  ATH_CHECK(m_rpcRdoDecoderTool.retrieve());
66  ATH_CHECK(m_idHelperSvc.retrieve());
71  ATH_CHECK(m_nRpcCablingKey.initialize(!m_rdoNrpcContainerKey.empty()));
72  // If we don't configure the NRPC RDO
73  // key, the cabling is needed either.
79  ATH_CHECK(m_xAODKey.initialize(!m_xAODKey.empty()));
80  return StatusCode::SUCCESS;
81 }
82 StatusCode RpcRdoToPrepDataToolMT::loadProcessedChambers(const EventContext& ctx, State& state) const {
83  const int modHashMax = m_idHelperSvc->rpcIdHelper().module_hash_max();
84  if (!m_prdContainerCacheKey.key().empty()) {
86  if (!update.isValid()) {
87  ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
88  return StatusCode::FAILURE;
89  }
90  state.prepDataCont = std::make_unique<RpcPrepDataContainer>(update.ptr());
91  for (const RpcPrepDataCollection* coll : *state.prepDataCont) {
92  state.m_decodedOfflineHashIds.insert(coll->identifyHash());
93  }
94  } else{
95  state.prepDataCont = std::make_unique<RpcPrepDataContainer>(modHashMax);
96  }
97  if (m_coindataContainerCacheKey.key().empty()) {
98  // without the cache we just record the container
99  state.coinDataCont = std::make_unique<RpcCoinDataContainer>(modHashMax);
100  } else {
101  // use the cache to get the container
103  if (!update.isValid()) {
104  ATH_MSG_FATAL("Invalid UpdateHandle "<< m_coindataContainerCacheKey.key());
105  return StatusCode::FAILURE;
106  }
107  state.coinDataCont = std::make_unique<RpcCoinDataContainer>(update.ptr());
108  for (const RpcCoinDataCollection* coll : *state.coinDataCont) {
109  state.m_decodedOfflineHashIds.insert(coll->identifyHash());
110  }
111  }
112  return StatusCode::SUCCESS;
113 }
117  const std::vector<IdentifierHash>& idVect) const {
118  ATH_MSG_DEBUG("Calling Core decode function from MT decode function (hash vector)");
119  State state{m_idHelperSvc.get()};
120  ATH_CHECK(loadProcessedChambers(ctx, state));
121 
122  ATH_CHECK(decodeImpl(ctx, state, idVect, true));
123  ATH_CHECK(processNrpcRdo(ctx, state));
124  ATH_MSG_DEBUG("Core decode processed in MT decode (hash vector)");
125 
128 
129  return StatusCode::SUCCESS;
130 }
131 
135  const std::vector<uint32_t>& robIds) const {
136  ATH_MSG_DEBUG("Calling Core decode function from MT decode function (ROB vector)");
137  State state{m_idHelperSvc.get()};
138  ATH_CHECK(loadProcessedChambers(ctx, state));
139 
140  ATH_CHECK(decodeImpl(ctx, state, robIds, true));
141  ATH_CHECK(processNrpcRdo(ctx, state));
142  ATH_MSG_DEBUG("Core decode processed in MT decode (ROB vector)");
143 
146 
147  return StatusCode::SUCCESS;
148 }
150  State state{m_idHelperSvc.get()};
151  ATH_CHECK(loadProcessedChambers(ctx, state));
154  return StatusCode::SUCCESS;
155 }
156 
158 
160  if (!m_xAODKey.empty()) {
161  writeHandleXAOD = SG::WriteHandle{m_xAODKey, ctx};
162  ATH_CHECK(writeHandleXAOD.record(std::make_unique<xAOD::RpcStripContainer>(),
163  std::make_unique<xAOD::RpcStripAuxContainer>()));
164  }
165  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
166  for (std::unique_ptr<RpcPrepDataCollection>& collection : state.rpcPrepDataCollections) {
167  if (!collection || collection->empty()) {
168  continue;
169  }
170  if (!m_xAODKey.empty()) {
173  std::vector<const RpcPrepData*> sortMe{collection->begin(), collection->end()};
174  std::ranges::sort(sortMe, IdentifierByDetElSorter{m_idHelperSvc.get()});
175  for (const RpcPrepData* prd : sortMe) {
176  const Identifier id = prd->identify();
177  xAOD::RpcStrip* strip = writeHandleXAOD->push_back(std::make_unique<xAOD::RpcStrip>());
178  strip->setDoubletPhi(idHelper.doubletPhi(id));
179  strip->setGasGap(idHelper.gasGap(id));
180  strip->setMeasuresPhi(idHelper.measuresPhi(id));
181  strip->setStripNumber(idHelper.channel(id));
182  strip->setAmbiguityFlag(prd->ambiguityFlag());
183  strip->setTimeOverThreshold(prd->timeOverThreshold());
184  strip->setTime(prd->time());
185  strip->setTimeCovariance(std::pow(m_stripTimeResolution, 2));
186  strip->setTriggerInfo(prd->triggerInfo());
187  xAOD::MeasVector<1> locPos{prd->localPosition().x()};
188  xAOD::MeasMatrix<1> locCov{prd->localCovariance()(0,0)};
189  strip->setMeasurement(m_idHelperSvc->detElementHash(id), std::move(locPos), std::move(locCov));
190  }
191  }
192 
193  const IdentifierHash hash = collection->identifyHash();
194  // If not present, get a write lock for the hash and move collection
196  if (lock.alreadyPresent()) {
197  ATH_MSG_DEBUG("RpcPrepDataCollection already contained in IDC "
198  << m_idHelperSvc->toString(collection->identify()));
199  continue;
200  }
201  ATH_CHECK(lock.addOrDelete(std::move(collection)));
202  ATH_MSG_DEBUG("PRD hash " << hash << " has been moved to cache container");
203  }
204  state.rpcPrepDataCollections.clear();
205 
206  if (msgLvl(MSG::DEBUG)) {
207  for (const auto& [hash, ptr] : state.prepDataCont->GetAllHashPtrPair()) {
208  ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash);
209  }
210  }
211  SG::WriteHandle rpcPRDHandle{m_rpcPrepDataContainerKey, ctx};
212  ATH_CHECK(rpcPRDHandle.record(std::move(state.prepDataCont)));
213  ATH_MSG_DEBUG("Created container " << m_rpcPrepDataContainerKey.key());
214 
215  return StatusCode::SUCCESS;
216 }
217 
220  return StatusCode::SUCCESS;
221  }
222 
223  // Take localContainer and transfer contents to rpcCoinHandle
224  for (std::unique_ptr<RpcCoinDataCollection>& collection : state.rpcCoinDataCollections) {
225  if (!collection || collection->empty()) {
226  continue;
227  }
228  const IdentifierHash hash = collection->identifyHash();
229  // If not present, get a write lock for the hash and move collection
231  if (lock.alreadyPresent()) {
232  ATH_MSG_DEBUG("RpcCoinDataCollection already contained in IDC "
233  << m_idHelperSvc->toString(collection->identify()));
234  continue;
235  }
236  ATH_CHECK(lock.addOrDelete(std::move(collection)));
237  ATH_MSG_DEBUG("Coin hash " << hash << " has been moved to cache container");
238  }
239  state.rpcCoinDataCollections.clear();
240  if (msgLvl(MSG::DEBUG)) {
241  for (const auto& [hash, ptr] : state.coinDataCont->GetAllHashPtrPair()) {
242  ATH_MSG_DEBUG("Contents of LOCAL in this view : " << hash);
243  }
244  }
247  ATH_CHECK(rpcCoinHandle.record(std::move(state.coinDataCont)));
248 
249  ATH_MSG_DEBUG("Created container " << m_rpcCoinDataContainerKey.key());
250  // For additional information on the contents of the cache-based container,
251  // this function can be used printMTCoinData (*rpcCoinHandle);
252 
253  return StatusCode::SUCCESS;
254 }
255 
256 //___________________________________________________________________________
257 StatusCode RpcRdoToPrepDataToolMT::decodeImpl(const EventContext& ctx, State& state,
258  const std::vector<IdentifierHash>& idVect,
259  bool firstTimeInTheEvent) const {
260  int sizeVectorRequested = idVect.size();
261  ATH_MSG_DEBUG("Decode method called for " << sizeVectorRequested << " offline collections");
262  if (sizeVectorRequested == 0){
263  ATH_MSG_DEBUG("Decoding the entire event");
264  }
265  // create an empty vector of hash ids to be decoded (will be filled if
266  // RoI-based and left empty if full-scan)
267  std::vector<IdentifierHash> idVectToBeDecoded;
268  idVectToBeDecoded.reserve(idVect.size());
269 
270  if (firstTimeInTheEvent) {
271  state.m_fullEventDone = sizeVectorRequested == 0;
272  } else {
273  if (state.m_fullEventDone) {
274  ATH_MSG_DEBUG("Whole event has already been decoded; nothing to do.");
275  return StatusCode::SUCCESS;
276  }
277  if (sizeVectorRequested == 0) {
278  state.m_fullEventDone = true;
279  }
280  }
281 
282  if (sizeVectorRequested != 0) {
283  // the program goes in here only if RoI-based decoding has been called and
284  // the full event is not already decoded this code ensures decoding of every
285  // offline hash id is called only once
286  for (const IdentifierHash& itHashId : idVect) {
287  if (state.m_decodedOfflineHashIds.insert(itHashId).second)
288  idVectToBeDecoded.push_back(itHashId);
289  }
290 
291  if (idVectToBeDecoded.empty()) {
292  ATH_MSG_DEBUG("All requested offline collections have already been decoded; nothing to do.");
293  return StatusCode::SUCCESS;
294  } else {
295  ATH_MSG_DEBUG(idVectToBeDecoded.size()
296  << " offline collections have not yet been decoded and will be decoded now.");
297  ATH_MSG_VERBOSE("The list of offline collection hash ids to be decoded:"<<std::endl<<idVectToBeDecoded);
298  }
299  }
300 
301  // if RPC decoding is switched off stop here
302  if (!m_decodeData) {
303  ATH_MSG_DEBUG("Stored empty container. Decoding RPC RDO into RPC PrepRawData is switched off");
304  return StatusCode::SUCCESS;
305  }
306 
307  ATH_MSG_DEBUG("Decoding RPC RDO into RPC PrepRawData");
308 
309  SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
310  // if the vector requested has size 0, we need to perform a scan of the entire
311  // RDO container otherwise select the pads to be decoded
312  std::vector<IdentifierHash> rdoHashVec;
313  if (sizeVectorRequested != 0) {
314  ATH_MSG_DEBUG("Looking for pads IdHash to be decoded for the requested collection Ids");
315  ATH_CHECK(rpcCabling->giveRDO_fromPRD(idVectToBeDecoded, rdoHashVec));
316  }
317 
319  IdContext rpcContext = m_idHelperSvc->rpcIdHelper().module_context();
320 
321  // we come here if the rdo container is already in SG (for example in MC RDO!)
322  ATH_MSG_DEBUG("Retrieving Rpc PAD container from the store");
323  auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
324  if (!rdoContainerHandle.isValid()) {
325  ATH_MSG_ERROR("Retrieval of RPC RDO container failed ! "<<m_rdoContainerKey.fullKey());
326  return StatusCode::FAILURE;
327  }
328 
331  if (rdoContainerHandle->numberOfCollections() == 0) {
332  // empty pad container - no rpc rdo in this event
333  ATH_MSG_DEBUG("Empty pad container - no rpc rdo in this event ");
334  return StatusCode::SUCCESS;
335  }
336  ATH_MSG_DEBUG("Not empty pad container in this event ");
337 
338  // start here to process the RDO (for the full event of for a fraction of it)
339  bool processingetaview{m_solvePhiAmbiguities}, processingphiview{false};
340  bool doingSecondLoopAmbigColls = false;
341  while (processingetaview || processingphiview || (!m_solvePhiAmbiguities)) {
342  int ipad{0}, nPrepRawData{0}, nPhiPrepRawData{0}, nEtaPrepRawData{0};
343  if (processingphiview) {
344  state.m_ambiguousCollections.clear();
345  }
346  ATH_MSG_DEBUG("*** Processing "<<(processingetaview ? "eta" : "phi")<<" view ");
347  // seeded decoding
348  if (sizeVectorRequested != 0) {
349  ATH_MSG_DEBUG("Start loop over pads hashes - seeded mode ");
350  for (const IdentifierHash& iPadHash : rdoHashVec) {
351  const RpcPad* rdoColl = rdoContainerHandle->indexFindPtr(iPadHash);
352  if (!rdoColl) {
353  ATH_MSG_DEBUG("Requested pad with online id "<< iPadHash << " not found in the rdoContainerHandle.");
354  continue;
355  }
356  ++ipad;
357 
358  ATH_MSG_DEBUG("A new pad here n. " << ipad << ", online id "<< rdoColl->identifyHash()
359  << ", with " << rdoColl->size() << " CM inside ");
360  ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
361  processingphiview, nPrepRawData, idVectToBeDecoded, doingSecondLoopAmbigColls));
362 
363  } // end loop over requested pads hashes
364  } else { // unseeded // whole event
365  ATH_MSG_DEBUG("Start loop over pads - unseeded mode ");
366  for (const RpcPad* rdoColl : *rdoContainerHandle) {
367  // loop over all elements of the pad container
368  if (rdoColl->empty()){
369  continue;
370  }
371  ++ipad;
372  ATH_MSG_DEBUG("A new pad here n. " << ipad << ", online id "<< rdoColl->identifyHash()
373  << ", with " << rdoColl->size() << " CM inside ");
374 
375  ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
376  processingphiview, nPrepRawData, idVectToBeDecoded, doingSecondLoopAmbigColls));
377  } // end loop over pads
378  }
379 
380  if (processingetaview) {
381  processingetaview = false;
382  processingphiview = true;
383  nEtaPrepRawData = nPrepRawData;
384  ATH_MSG_DEBUG("*** " << nEtaPrepRawData << " eta PrepRawData registered");
385  } else {
386  processingphiview = false;
387  nPhiPrepRawData = nPrepRawData - nEtaPrepRawData;
388  ATH_MSG_DEBUG("*** " << nPhiPrepRawData << " phi PrepRawData registered");
389  if (!state.m_ambiguousCollections.empty()) {
390  // loop again for unrequested collections stored with ambiguous phi hits
391  doingSecondLoopAmbigColls = true;
392  processingetaview = true;
393  ATH_MSG_DEBUG(state.m_ambiguousCollections.size() << " ambiguous collections were stored:");
394  idVectToBeDecoded.clear();
395  rdoHashVec.clear();
396  for (const IdentifierHash& itAmbiColl : state.m_ambiguousCollections) {
397  ATH_MSG_DEBUG(itAmbiColl << " ");
398  idVectToBeDecoded.push_back(itAmbiColl);
399  state.m_decodedOfflineHashIds.insert(itAmbiColl);
400  }
401  ATH_CHECK(rpcCabling->giveRDO_fromPRD(idVectToBeDecoded, rdoHashVec));
402  }
403  }
404  if (!m_solvePhiAmbiguities) {
405  ATH_MSG_DEBUG("*** " << nPrepRawData << " PrepRawData registered");
406  break;
407  }
408  }
409 
410  ATH_MSG_DEBUG("*** Final Cleanup ");
411  return StatusCode::SUCCESS;
412 }
413 
414 //___________________________________________________________________________
415 StatusCode RpcRdoToPrepDataToolMT::decodeImpl(const EventContext& ctx, State& state,
416  const std::vector<uint32_t>& robIds, bool firstTimeInTheEvent) const {
417  // ROB-based decoding is only applied in seeded mode. Full scan should use the
418  // hashId-based method with empty requested collections vector.
419 
420  int sizeVectorRequested = robIds.size();
421  ATH_MSG_DEBUG("Decode method called for " << sizeVectorRequested << " ROBs");
422 
423  std::vector<uint32_t> robIdsToBeDecoded{};
424  robIdsToBeDecoded.reserve(robIds.size());
425 
426  if (firstTimeInTheEvent) {
427  state.m_fullEventDone = false;
428  } else {
429  if (state.m_fullEventDone) {
430  ATH_MSG_DEBUG("Whole event has already been decoded; nothing to do.");
431  return StatusCode::SUCCESS;
432  }
433  }
434 
435  // check which of the requested robs are not yet decoded
436  for (uint32_t robid : robIds) {
437  if (state.m_decodedRobIds.insert(robid).second) {
438  robIdsToBeDecoded.push_back(robid);
439  }
440  }
441 
442  if (robIdsToBeDecoded.empty()) {
443  ATH_MSG_DEBUG("All requested ROBs have already been decoded; nothing to do.");
444  return StatusCode::SUCCESS;
445  }
446  ATH_MSG_DEBUG(robIdsToBeDecoded.size()<< " ROBs have not yet been decoded and will be decoded now.");
447  if (msgLvl(MSG::VERBOSE)) {
448  ATH_MSG_VERBOSE("The list of ROB Ids to be decoded:");
449  for (uint32_t robid : robIdsToBeDecoded)
450  ATH_MSG_VERBOSE("0x" << MSG::hex << robid << MSG::dec << " ");
451  }
452 
453  SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
454 
455  // if all robs will be decoded after the current execution of the method, set
456  // the flag m_fullEventDone
457  if (state.m_decodedRobIds.size() == rpcCabling->giveFullListOfRobIds().size())
458  state.m_fullEventDone = true;
459 
460  // if RPC decoding is switched off stop here
461  if (!m_decodeData) {
462  ATH_MSG_DEBUG("Stored empty container. Decoding RPC RDO into RPC PrepRawData is switched off");
463  return StatusCode::SUCCESS;
464  }
465 
466  ATH_MSG_DEBUG("Decoding RPC RDO into RPC PrepRawData");
467 
468  // we come here if the rdo container is already in SG (for example in MC RDO!)
469  ATH_MSG_DEBUG("Retrieving Rpc PAD container from the store");
470  auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
471  if (!rdoContainerHandle.isValid()) {
472  ATH_MSG_WARNING("Retrieval of RPC RDO container failed ! "<<m_rdoContainerKey.fullKey());
473  return StatusCode::SUCCESS;
474  }
475 
476  // here the RDO container is retrieved and filled -whatever input type we
477  // start with- => check the size
478  if (rdoContainerHandle->empty()) {
479  // empty pad container - no rpc rdo in this event
480  ATH_MSG_DEBUG("Empty pad container - no rpc rdo in this event ");
481  return StatusCode::SUCCESS;
482  }
483  ATH_MSG_DEBUG("Not empty pad container in this event ");
484 
485  // obtain a list of PADs (RDOs) to be processed
486  std::vector<IdentifierHash> rdoHashVec;
487  rdoHashVec.reserve(13 * robIdsToBeDecoded.size()); // most ROBs have 13 RDOs, some have less
488  ATH_CHECK(rpcCabling->giveRDO_fromROB(robIdsToBeDecoded, rdoHashVec));
489 
490  // start here to process the RDOs
491  bool processingetaview = true;
492  bool processingphiview = false;
493  if (!m_solvePhiAmbiguities){
494  processingetaview = false;
495  }
496  while (processingetaview || processingphiview || (!m_solvePhiAmbiguities)) {
497  int ipad{0}, nPrepRawData{0}, nPhiPrepRawData{0}, nEtaPrepRawData{0};
498  if (processingphiview){
499  state.m_ambiguousCollections.clear();
500  }
501  ATH_MSG_DEBUG("*** Processing "<<(processingetaview? "eta" : "phi")<<" view ");
502 
503  // seeded decoding (for full scan, use the hashId-based method)
504  ATH_MSG_DEBUG("Start loop over pads hashes - seeded mode ");
505 
506  for (const IdentifierHash& padHashId : rdoHashVec) {
507  const RpcPad* rdoColl = rdoContainerHandle->indexFindPtr(padHashId);
508  if (!rdoColl) {
509  ATH_MSG_DEBUG("Requested pad with online id "<< padHashId << " not found in the rdoContainerHandle.");
510  continue;
511  }
512  ++ipad;
513  ATH_MSG_DEBUG("A new pad here n."<< ipad << ", online id " << rdoColl->identifyHash()
514  << ", with " << rdoColl->size() << " CM inside ");
515  ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
516  processingphiview, nPrepRawData, rdoHashVec, false));
517  }
518 
519  if (processingetaview) {
520  processingetaview = false;
521  processingphiview = true;
522  nEtaPrepRawData = nPrepRawData;
523  ATH_MSG_DEBUG("*** " << nEtaPrepRawData << " eta PrepRawData registered");
524  } else {
525  processingphiview = false;
526  nPhiPrepRawData = nPrepRawData - nEtaPrepRawData;
527  ATH_MSG_DEBUG("*** " << nPhiPrepRawData << " phi PrepRawData registered");
528  }
529  if (!m_solvePhiAmbiguities) {
530  ATH_MSG_DEBUG("*** " << nPrepRawData << " PrepRawData registered");
531  break;
532  }
533  }
534 
535  ATH_MSG_DEBUG("*** Final Cleanup ");
536 
537  return StatusCode::SUCCESS;
538 
539 }
540 
541 StatusCode RpcRdoToPrepDataToolMT::processPad(const EventContext& ctx, State& state, const RpcPad* rdoColl,
542  bool& processingetaview, bool& processingphiview, int& nPrepRawData,
543  const std::vector<IdentifierHash>& idVect,
544  bool doingSecondLoopAmbigColls) const {
545 
546  const RpcIdHelper& idHelper = m_idHelperSvc->rpcIdHelper();
547 
548  std::unordered_set<IdentifierHash>& ambiguousCollections{state.m_ambiguousCollections};
549  ATH_MSG_DEBUG("***************** Start of processPad eta/phiview "<< processingetaview << "/" << processingphiview);
550  //{processPad
551  // Get pad online id and sector id
552  uint16_t padId = rdoColl->onlineId();
553  uint16_t sectorId = rdoColl->sector();
554  ATH_MSG_DEBUG("***************** for Pad online Id "<< padId << " m_logic sector ID " << sectorId);
555 
556  // Create an RPC PrepDataCollection
557  Identifier oldId{}, oldIdTrg{};
558  ATH_MSG_VERBOSE("Init pointer to RpcPrepDataCollection ");
559  RpcPrepDataCollection* collection{nullptr};
560  RpcCoinDataCollection* collectionTrg{nullptr};
561  IdentifierHash rpcHashId{0};
562 
563  SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
564 
565  // For each pad, loop on the coincidence matrices
566  int icm = 0;
567  for (const RpcCoinMatrix* coinMat : *rdoColl) {
568  ++icm;
569  bool etaview = !m_isMC;
570  bool highPtCm = false;
571  // Get CM online Id
572  uint16_t cmaId = coinMat->onlineId();
573  ATH_MSG_DEBUG("A new CM here n. "<< icm << " CM online ID " << cmaId<< " with n. of hits = " << coinMat->size()
574  <<", empty: "<<coinMat->empty());
575  ATH_MSG_DEBUG((cmaId < 4? "low": "high") <<" pt ");
576  if (cmaId < 2) {
577  etaview = m_isMC;
578  } else if (cmaId >=4) {
579  highPtCm = true;
580  if (cmaId < 6) {
581  etaview = m_isMC;
582  }
583  }
584  ATH_MSG_DEBUG(" eta view = " << etaview<<", processingetaview: "<<processingetaview
585  <<", processingphiview: "<<processingphiview);
586 
587  if (processingetaview && !etaview){
588  continue;
589  } else if (processingphiview && etaview) {
590  continue;
591  }
592  if (coinMat->empty()) {
593  ATH_MSG_DEBUG("Empty CM");
594  }
595  // For each CM, loop on the fired channels
596  int idata = 0;
597  for (RpcCoinMatrix::const_iterator itD = coinMat->begin(); itD != coinMat->end(); ++itD) {
598  const RpcFiredChannel* rpcChan{*itD};
599  idata++;
600  // trigger related quantities
601  unsigned short threshold = 99;
602  unsigned short overlap = 99;
603 
604  // flags defining the processing mode of this hit
605  bool solvePhiAmb_thisHit = m_solvePhiAmbiguities;
606  bool reduceCablOvl_thisHit = m_reduceCablingOverlap;
607 
608  ATH_MSG_DEBUG("A new CM Hit " << idata);
609  ATH_MSG_DEBUG("RpcFiredChannel: bcid " << rpcChan->bcid() << " time " << rpcChan->time()
610  << " ijk "<< rpcChan->ijk() <<" ch " << ( rpcChan->ijk() < 7 ? rpcChan->channel() : -1));
611  // check if trigger hit
612  // select the cases: ijk = 0 and high p, ijk= 6, ijk=7
613  bool triggerHit = false;
614  bool toSkip = false;
615  processTriggerHitHypothesis(itD, coinMat->end(), highPtCm, triggerHit, threshold, overlap, toSkip);
616  if (toSkip) {
617  continue;
618  }
619  if (triggerHit) {
620  // here ijk = 6 or ijk = 0 in high pt cm
621  // keep all pivot + trigger info (even if duplicated [should never
622  // happen, for pivot hits])
623  solvePhiAmb_thisHit = false;
624  reduceCablOvl_thisHit = false;
625  ATH_MSG_DEBUG("RpcFiredChannel: it's a triggerHit or a lowPt coinc. in a high pt CM \n"
626  << " ijk = " << rpcChan->ijk() << " isHighPtCM " << highPtCm
627  << " thr/ovl = " << threshold << "/" << overlap);
628  }
629 
630  // here decode (get offline ids for the online indices of this hit)
631  double time = 0.;
632  std::vector<Identifier> digitVec{m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId,
633  cmaId, time, rpcCabling.cptr())};
634  time += m_timeShift;
635 
636  int nMatchingEtaHits{0}, nDuplicatePhiHits{0};
637  bool unsolvedAmbiguity{false}, notFinished{true};
638  // allow for 2 iterations in case there are phi digits without matching
639  // eta (eta inefficiency) all eta digits, not already recorded, will be
640  // registered as PrepRawData and all phi digits, not yet recorded and with
641  // a eta digit in the same module and gap, will produce a PrepRawData. Phi
642  // digits without a eta match will not be recorded at the first iteration.
643  // If all phi digits do not have a eta match, they will be all recorded as
644  // PrepRawData in the second iteration (the ambiguity will remain
645  // unsolved)
646  while (notFinished) {
647  // Loop on the digits corresponding to the fired channel
648  ATH_MSG_DEBUG("size of the corresponding list of ID = " << digitVec.size());
649  if (digitVec.empty()) {
650  ATH_MSG_DEBUG("going to next CM hit");
651  notFinished = false;
652  continue;
653  }
654  for (const Identifier& channelId : digitVec) {
655  // Prepare the prepdata for this identifier
656  // channel Id
657  rpcHashId = m_idHelperSvc->moduleHash(channelId);
658  const Identifier parentId = idHelper.parentID(channelId);
659 
660  // There is some ambiguity in the channel/sectorId's, so need to
661  // explicitly filter out hashIDs outside of the RoI in seeded decoding
662  // mode
663  if (!idVect.empty() && std::find(idVect.begin(), idVect.end(), rpcHashId) == idVect.end()) {
664  continue;
665  }
666  ATH_MSG_DEBUG("CM Hit decoded into offline Id "<< m_idHelperSvc->toString(channelId) << " time "<< time);
667  ATH_MSG_DEBUG(" oldID = " << m_idHelperSvc->toString(oldId) <<" oldIDtrg = " << m_idHelperSvc->toString(oldIdTrg));
668  bool hasAMatchingEtaHit = 0;
669  // current collection has Id "parentId"; get it from the container !
670  if (triggerHit) {
671  if ((oldIdTrg != parentId) || !collectionTrg) {
672  // Get collection from IDC if it exists, or create it and add it
673  // if not.
674  ATH_MSG_DEBUG(" Looking/Creating a collection with ID = "<< m_idHelperSvc->toString(parentId)
675  << " hash = " << rpcHashId);
676  collectionTrg = state.getCoinCollection(parentId);
677  oldIdTrg = parentId;
678  ATH_MSG_DEBUG(" Resetting oldIDtrg to current parentID = "<< m_idHelperSvc->toString(oldIdTrg));
679  }
680  } else if ((oldId != parentId) || !collection) {
681  // Get collection from IDC if it exists, or create it and add it if
682  // not.
683  ATH_MSG_DEBUG(" Looking/Creating a collection with ID = "<< m_idHelperSvc->toString(parentId) << " hash = "<< rpcHashId);
684  collection = state.getPrepCollection(parentId);
685  oldId = parentId;
686  ATH_MSG_DEBUG(" Resetting oldID to current parentID = "<< m_idHelperSvc->toString(oldId));
687  }
688 
689  // check if the data has already been recorded
690  // (if you want to reduce the redundancy due to cabling overlap and if
691  // the collection is not empty)
692  bool duplicate = false;
693  if (reduceCablOvl_thisHit) {
694  ATH_MSG_VERBOSE("Check for duplicates in coll. with size "<< collection->size());
695  for (RpcPrepData* rpc : *collection) {
696  const Identifier existId{rpc->identify()};
697  if (channelId == existId &&
698  std::abs(time - rpc->time()) < m_overlap_timeTolerance) {
699  duplicate = true;
700  hasAMatchingEtaHit = false; // we don't want to increment the
701  // number of strips with
702  // a matching eta due to a cabling overlap
703  ATH_MSG_VERBOSE("Duplicated RpcPrepData(not recorded) = " << m_idHelperSvc->toString(channelId));
704  float previous_time = rpc->time();
705  // choose the smallest time within timeTolerance
706  if (time < previous_time) {
707  rpc->m_time = time;
708  ATH_MSG_DEBUG("time of the prd previously stored is now updated with "
709  << "current hit time: "<< previous_time << " -> " << rpc->time());
710  }
711  break; // this break is why we cannot have
712  // solvePhiAmb_thisHit = true and
713  // reduceCablOvl_thisHit= false
714  }
715 
716 
717  if (processingphiview && solvePhiAmb_thisHit && !unsolvedAmbiguity && !idHelper.measuresPhi(existId) &&
718  m_idHelperSvc->gasGapId(existId) == m_idHelperSvc->gasGapId(channelId) &&
719  std::abs(time - rpc->time()) < m_etaphi_coincidenceTime) {
720  hasAMatchingEtaHit = true;
721  ATH_MSG_VERBOSE("There's a matching eta hit with id "<< m_idHelperSvc->toString(existId));
722  // here there can be a break ? NO, we need to
723  // keep looping in order to check
724  // if this preprawdata has been already
725  // recorded (due to cabling overlaps)
726  }
727  }
728  if (hasAMatchingEtaHit)
729  nMatchingEtaHits++; // Number of phi strips (possibly
730  // corresponding to this CM hit)
731  // with a matching eta
732  if (processingphiview && duplicate)
733  nDuplicatePhiHits++; // Number of phi strips (possibly
734  // corresponding to this CM hit)
735  // already in the collection
736  } // end of if reduceCablingOverlap
737 
738  if (solvePhiAmb_thisHit && !etaview){
739  ATH_MSG_VERBOSE("nMatchingEtaHits = " << nMatchingEtaHits
740  << " hasAMatchingEtaHit = "<< hasAMatchingEtaHit);
741  }
742  if (duplicate) {
743  // this hit was already recorded
744  ATH_MSG_DEBUG("digit already in the collection ");
745  continue;
746  }
747  ATH_MSG_VERBOSE(" solvePhiAmb_thisHit: "<<solvePhiAmb_thisHit<<", processingetaview:"<<processingetaview
748  <<", processingphiview: "<<processingphiview<<", hasAMatchingEtaHit: "<<hasAMatchingEtaHit
749  <<", unsolvedAmbiguity: "<< unsolvedAmbiguity);
750  if ( !solvePhiAmb_thisHit || processingetaview ||
751  (processingphiview && (hasAMatchingEtaHit || unsolvedAmbiguity))) {
752  if (unsolvedAmbiguity) {
753  if (idVect.empty()) { // full-scan mode
754  ATH_MSG_DEBUG("storing data even if unsolvedAmbiguity");
755  } else {
756  // if in RoI mode and the collection was not requested in this
757  // event, add it to ambiguousCollections
758  ATH_MSG_DEBUG("unsolvedAmbiguity is true, adding collection with hash = "
759  << rpcHashId << " to ambiguous collections vector");
760  const auto& decode{state.m_decodedOfflineHashIds};
761  if (!decode.empty() && decode.find(rpcHashId) == decode.end()) {
762  ambiguousCollections.insert(rpcHashId);
763  ATH_MSG_DEBUG("collection not yet processed; added to ambiguous "
764  <<"collection vector; going to the next offline channel ID");
765  continue; // go to the next possible offline channel ID
766  } else if (!doingSecondLoopAmbigColls) {
767  ambiguousCollections.insert(rpcHashId);
768  ATH_MSG_DEBUG("collection already processed and doingSecondLoopAmbigColls=false; added to ambiguous "
769  <<"collection vector; going to the next offline channel ID");
770  continue;
771  } else {
772  ATH_MSG_DEBUG("collection already processed and doingSecondLoopAmbigColls=true; trying to store data even if unsolvedAmbiguity");
773  }
774  }
775  }
776  SG::ReadCondHandle muDetMgr{m_muDetMgrKey, ctx};
777  const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(channelId);
778 
779  // here check validity
780  // if invalid, reset flags
781  if (!descriptor->containsId(channelId)) {
782  hasAMatchingEtaHit = false;
783  duplicate = false;
784  if (idHelper.stationNameString(idHelper.stationName(channelId)) == "BOG"){
785  ATH_MSG_DEBUG("Identifier from the cabling service <"<< m_idHelperSvc->toString(channelId)
786  << "> inconsistent with the geometry of detector element <"
787  << m_idHelperSvc->toStringDetEl(descriptor->identify())
788  << "> =>>ignore this hit /// there are unmasked channels in BOG");
789  }else{
790  ATH_MSG_WARNING("Identifier from the cabling service <"<< m_idHelperSvc->toString(channelId)
791  << "> inconsistent with the geometry of detector element <"
792  << m_idHelperSvc->toStringDetEl(descriptor->identify())<< "> =>>ignore this hit");
793  }
794  continue;
795  }
796 
797  //
798  // Global position
799  Amg::Vector3D tempGlobalPosition = descriptor->stripPos(channelId);
800  ATH_MSG_VERBOSE("RPC RDO->PrepRawdata: global position "<<Amg::toString(tempGlobalPosition));
801  // Local position
802  Amg::Vector2D pointLocPos{Amg::Vector2D::Zero()};
803  descriptor->surface(channelId).globalToLocal(tempGlobalPosition, tempGlobalPosition, pointLocPos);
804 
805  // List of Digits in the cluster (self)
806  std::vector<Identifier> identifierList{channelId};
807 
808  // width of the cluster (self)
809  float stripWidth = descriptor->StripWidth(m_idHelperSvc->rpcIdHelper().measuresPhi(channelId));
810 
811  // Error matrix
812  double errPos = stripWidth / std::sqrt(12.0);
813  Amg::MatrixX mat(1, 1);
814  mat.setIdentity();
815  mat *= errPos * errPos;
816  // check if this is a triggerINFO rather then a real hit
817  // Create a new PrepData
818  int ambiguityFlag = 0;
819  if (solvePhiAmb_thisHit) {
820  if (processingetaview){
821  ambiguityFlag = 1;
822  }
823  if (unsolvedAmbiguity){
824  ambiguityFlag = digitVec.size();
825  } else if (hasAMatchingEtaHit){
826  ambiguityFlag = nMatchingEtaHits;
827  }
828  }
829 
830  // correct prd time from cool db
831  if (m_RPCInfoFromDb) {
832  SG::ReadCondHandle readHandle{m_readKey, ctx};
833  std::optional<double> StripTimeFromCool = readHandle->getStripTime(channelId);
834  if (StripTimeFromCool) {
835  time -= (*StripTimeFromCool);
836  }
837  }
838 
839  if (triggerHit) {
840  ATH_MSG_DEBUG("producing a new RpcCoinData");
841 
842  auto newCoinData = std::make_unique<RpcCoinData>(channelId, rpcHashId,
843  std::move(pointLocPos), std::move(identifierList),
844  std::move(mat), descriptor, time,
845  ambiguityFlag, rpcChan->ijk(), threshold, overlap, cmaId, padId, sectorId,
846  !(highPtCm));
847 
848  // record the new data in the collection
849  ATH_MSG_DEBUG(" Adding RpcCoinData @ "<< newCoinData.get() << " to collection "
850  << m_idHelperSvc->toString(collectionTrg->identify()));
851 
852  newCoinData->setHashAndIndex(collectionTrg->identifyHash(),
853  collectionTrg->size());
854  collectionTrg->push_back(std::move(newCoinData));
855  } // end of to be stored now for RpcCoinData
856  else {
857  ATH_MSG_DEBUG("producing a new RpcPrepData with "
858  << "ambiguityFlag = " << ambiguityFlag);
859 
860  auto newPrepData = std::make_unique<RpcPrepData>(channelId, rpcHashId,std::move(pointLocPos),
861  std::move(identifierList),
862  std::move(mat), descriptor, time, ambiguityFlag);
863 
864  // record the new data in the collection
865  ATH_MSG_DEBUG(" Adding digit @ "<< newPrepData.get() << " to collection "
866  << m_idHelperSvc->toString(collection->identify()));
867 
868  newPrepData->setHashAndIndex(collection->identifyHash(),
869  collection->size());
870  collection->push_back(std::move(newPrepData));
871  // here one should reset ambiguityFlag for the prepdata
872  // registered before the current one (from the same RDO hit) if
873  // nMatchingEtaHits > 1
874  nPrepRawData++;
875  }
876  } // end of to be stored now
877  } // end loop over possible offline identifiers corresponding to this
878  // CM hit
879  ATH_MSG_VERBOSE("processingphiview:"<<processingphiview<<", nMatchingEtaHits:"<<nMatchingEtaHits
880  <<", nDuplicatePhiHits, unsolvedAmbiguity: "<<unsolvedAmbiguity<<", solvePhiAmb_thisHit : "
881  << solvePhiAmb_thisHit);
882  if ((processingphiview && (nMatchingEtaHits == 0)) && (nDuplicatePhiHits == 0) &&
883  (!unsolvedAmbiguity) && (solvePhiAmb_thisHit)) {
884  unsolvedAmbiguity = true;
885  // no eta hits matching any phi digit
886  // loop once again and store all phi digits potentially generating
887  // this CM hit
888  ATH_MSG_DEBUG("No eta prepData matching any phi hit from this CM hit \n"
889  << "loop once again and store all phi digits potentially "
890  "generating this CM hit");
891  } else if (unsolvedAmbiguity)
892  notFinished = false;
893  else
894  notFinished = false;
895  } // end of not finished
896  } // end loop over CM hits
897  } // end loop over CMs
898 
899  ATH_MSG_DEBUG("***************** Stop of processPad eta/phiview "
900  << processingetaview << "/" << processingphiview
901  << "***************** for Pad online Id " << padId
902  << " m_logic sector ID " << sectorId);
903 
904  return StatusCode::SUCCESS;
905 }
906 
908  State& state) const {
909  if (m_rdoNrpcContainerKey.empty()) {
910  ATH_MSG_DEBUG("The NRPC processing is disabled.");
911  return StatusCode::SUCCESS;
912  }
913 
914  ATH_MSG_DEBUG("Retrieving Nrpc RDO container from the store");
915  SG::ReadHandle rdoNrpcContainerHandle{m_rdoNrpcContainerKey, ctx};
916  if (!rdoNrpcContainerHandle.isPresent()) {
917  ATH_MSG_ERROR("Retrieval of NRPC RDO " << m_rdoNrpcContainerKey.fullKey()
918  << " container failed !");
919  return StatusCode::FAILURE;
920  }
921 
922  if (rdoNrpcContainerHandle->empty()) {
923  // empty NRPC RDO container - no nrpc rdo in this event
924  ATH_MSG_DEBUG("Empty NRPC RDO container - no nrpc rdo in this event ");
925  return StatusCode::SUCCESS;
926  }
927  ATH_MSG_DEBUG("Not empty NRPC RDO container in this event ");
928 
929  SG::ReadCondHandle readCdo{m_nRpcCablingKey, ctx};
930  if (!readCdo.isValid()) {
931  ATH_MSG_ERROR("Could not retrieve " << m_nRpcCablingKey.fullKey()
932  << " from the conditions store");
933  return StatusCode::FAILURE;
934  }
936  SG::ReadCondHandle muDetMgr{m_muDetMgrKey, ctx};
937 
938  for (const xAOD::NRPCRDO* nrpcrdo : *rdoNrpcContainerHandle) {
940  RpcCablingData translateCache{};
941  translateCache.subDetector = nrpcrdo->subdetector();
942  translateCache.boardSector = nrpcrdo->boardsector();
943  translateCache.board = nrpcrdo->board();
944  translateCache.channelId = nrpcrdo->channel();
945  Identifier chanId{};
946  if (!readCdo->getOfflineId(translateCache, msgStream()) ||
947  !readCdo->convert(translateCache, chanId, false)) {
948  ATH_MSG_FATAL("Failed to retrieve the offline Identifier");
949  return StatusCode::FAILURE;
950  }
951 
952  RpcPrepDataCollection* collection = state.getPrepCollection(chanId);
953 
954  const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(chanId);
955 
956  // List of Digits in the cluster (self)
957  std::vector<Identifier> identifierList{chanId};
958  // Global position
959  const Amg::Vector3D stripPos{descriptor->stripPos(chanId)};
960  ATH_MSG_DEBUG("RPC RDO->PrepRawdata " << m_idHelperSvc->toString(chanId)
961  << " global position "
962  << Amg::toString(stripPos, 2));
963  // Local position
964  Amg::Vector2D pointLocPos{Amg::Vector2D::Zero()};
965  descriptor->surface(chanId).globalToLocal(stripPos, stripPos, pointLocPos);
966  // width of the cluster (self)
967 
968  const double stripWidth = descriptor->StripWidth(
969  m_idHelperSvc->rpcIdHelper().measuresPhi(chanId));
970  // Error matrix
971  const double errPos = stripWidth / std::sqrt(12.0);
972  Amg::MatrixX mat(1, 1);
973  mat.setIdentity();
974  mat *= errPos * errPos;
975 
976  int ambiguityFlag = 0; // Ambiguity flag not checked for BIS RPCs
977 
978  const float time = nrpcrdo->time();
980  const float timeoverthr = nrpcrdo->timeoverthr();
981 
982  const IdentifierHash rpcHashId = m_idHelperSvc->moduleHash(chanId);
983  auto newPrepData = std::make_unique<RpcPrepData>(chanId, rpcHashId, pointLocPos, identifierList, mat,
984  descriptor, time, timeoverthr, 0, ambiguityFlag);
985 
986  newPrepData->setHashAndIndex(collection->identifyHash(),
987  collection->size());
988  collection->push_back(std::move(newPrepData));
989  }
990  return StatusCode::SUCCESS;
991 }
992 
995  bool highPtCm, bool& triggerHit,
996  unsigned short& threshold, unsigned short& overlap,
997  bool& toSkip) const {
998  toSkip = false;
999  const RpcFiredChannel* rpcChan = (*itD);
1000  if ((highPtCm && rpcChan->ijk() < 2) || (rpcChan->ijk() > 5)) {
1001  ATH_MSG_VERBOSE("RpcFiredChannel: it's a trigger hit");
1002  triggerHit = true;
1003 
1004  // triggerHit
1006  // skip if not storing the trigger info
1007  toSkip = true;
1008  return;
1009  }
1010  if (rpcChan->ijk() == 7) {
1011  // the info in ijk 7 refer to the previous CM hit with ijk 6 => skip
1012  toSkip = true;
1013  return;
1014  }
1015  if (rpcChan->ijk() == 6) {
1016  // look for the subsequent ijk 7 to define threshold and overlap
1017  ATH_MSG_VERBOSE("This hit: ijk = " << rpcChan->ijk() << "in "<<(highPtCm ? "high" : "low")
1018  <<" pT CM, bcid is " << rpcChan->bcid()<< " time is " << rpcChan->time()
1019  << " ch " << rpcChan->channel());
1020  RpcCoinMatrix::const_iterator itDnext = itD + 1;
1021  while (itDnext != itD_end) {
1022  const RpcFiredChannel* rpcChanNext = (*itDnext);
1023  ATH_MSG_VERBOSE("Next hit: ijk = " << rpcChanNext->ijk() << "in "<<(highPtCm ? "high" : "low")
1024  <<" pT CM, bcid is " << rpcChan->bcid() << " time is " << rpcChanNext->time()
1025  <<", ch: "<<( rpcChanNext->ijk() < 7? rpcChanNext->channel() : -1));
1026 
1027  if (rpcChanNext->ijk() == 7) {
1028  if (rpcChanNext->bcid() == rpcChan->bcid() && rpcChanNext->time() == rpcChan->time()) {
1029  ATH_MSG_VERBOSE("bdid/tick match; assigning thr/overlap = " << rpcChanNext->thr() << "/" << rpcChanNext->ovl());
1030  threshold = rpcChanNext->thr();
1031  overlap = rpcChanNext->ovl();
1032  } else {
1033  ATH_MSG_WARNING("ijk =7 after a ijk = 6 BUT bdid/tick don't match - will not assign threshold/overlap ");
1034  }
1035  break;
1036  } else {
1037  if (rpcChanNext->ijk() == 6) {
1038  ++itDnext;
1039  // std::cout<<"next has ijk 6; try next to next"<<std::endl;
1040  } else {
1041  ATH_MSG_WARNING("RPC cm hit with ijk = 6 not followed by ijk = 6 or 7 - will not assign threshold / overlap");
1042  break;
1043  }
1044  }
1045  }
1046  }
1047  } else {
1048  triggerHit = false;
1049  return;
1050  }
1051  ATH_MSG_VERBOSE("RPC trigger hit; ijk = "
1052  << rpcChan->ijk() << " threshold / overlap = " << threshold
1053  << "/" << overlap);
1054 }
1055 }
RpcFiredChannel::ijk
ubit16 ijk() const
Definition: RpcFiredChannel.h:56
IRPC_RDO_Decoder.h
RpcCoinDataContainer.h
Trk::PlaneSurface::globalToLocal
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Definition: PlaneSurface.cxx:209
RpcIdHelper::parentID
Identifier parentID(const Identifier &id) const
Definition: RpcIdHelper.cxx:989
RpcFiredChannel::time
ubit16 time() const
Definition: RpcFiredChannel.h:54
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Muon::RpcRdoToPrepDataToolMT::m_reduceCablingOverlap
Gaudi::Property< bool > m_reduceCablingOverlap
Definition: RpcRdoToPrepDataToolMT.h:128
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
RpcFiredChannel::ovl
ubit16 ovl() const
Definition: RpcFiredChannel.h:61
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
RpcFiredChannel::thr
ubit16 thr() const
Definition: RpcFiredChannel.h:65
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Muon::RpcCablingOnlineID::subDetector
int16_t & subDetector
Identifier of the subdetector region in the readout BA / BC etc.
Definition: RpcCablingData.h:82
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Surface.h
RpcFiredChannel::channel
ubit16 channel() const
Definition: RpcFiredChannel.h:58
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
Muon::RpcRdoToPrepDataToolMT::provideEmptyContainer
virtual StatusCode provideEmptyContainer(const EventContext &ctx) const override
Definition: RpcRdoToPrepDataToolMT.cxx:149
Muon::RpcRdoToPrepDataToolMT::State::m_fullEventDone
bool m_fullEventDone
Definition: RpcRdoToPrepDataToolMT.h:65
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
Muon::RpcRdoToPrepDataToolMT::processPad
StatusCode processPad(const EventContext &ctx, State &state, const RpcPad *rdoColl, bool &processingetaview, bool &processingphiview, int &nPrepRawData, const std::vector< IdentifierHash > &idVect, bool doingSecondLoopAmbigColls) const
Definition: RpcRdoToPrepDataToolMT.cxx:541
RpcIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
Definition: RpcIdHelper.cxx:1059
Muon::MuonCoinDataCollection
Definition: MuonCoinDataCollection.h:25
Muon::RpcRdoToPrepDataToolMT::initialize
virtual StatusCode initialize() override
Definition: RpcRdoToPrepDataToolMT.cxx:49
Muon::RpcRdoToPrepDataToolMT::m_stripTimeResolution
Gaudi::Property< double > m_stripTimeResolution
Definition: RpcRdoToPrepDataToolMT.h:183
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:55
Muon::RpcRdoToPrepDataToolMT::m_rdoNrpcContainerKey
SG::ReadHandleKey< xAOD::NRPCRDOContainer > m_rdoNrpcContainerKey
Definition: RpcRdoToPrepDataToolMT.h:156
Muon::RpcRdoToPrepDataToolMT::m_RPCInfoFromDb
Gaudi::Property< bool > m_RPCInfoFromDb
correct time prd from cool db
Definition: RpcRdoToPrepDataToolMT.h:135
xAOD::NRPCRDO_v1
Definition: NRPCRDO_v1.h:14
Muon::RpcRdoToPrepDataToolMT::decode
virtual StatusCode decode(const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
This code is thread-safe as we will propagate local thread collection contents to a thread-safe one.
Definition: RpcRdoToPrepDataToolMT.cxx:116
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:804
MuonPrepDataContainer.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
Muon::RpcRdoToPrepDataToolMT::State::getPrepCollection
RpcPrepDataCollection * getPrepCollection(const Identifier &id)
Definition: RpcRdoToPrepDataToolMT.cxx:27
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
xAOD::RpcStrip_v1
Definition: RpcStrip_v1.h:11
Muon::RpcRdoToPrepDataToolMT::decodeImpl
StatusCode decodeImpl(const EventContext &ctx, State &state, const std::vector< IdentifierHash > &idVect, bool firstTimeInTheEvent) const
Definition: RpcRdoToPrepDataToolMT.cxx:257
RpcCoinMatrix
Definition: RpcCoinMatrix.h:20
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
RpcIdHelper
Definition: RpcIdHelper.h:51
RpcFiredChannel
Definition: RpcFiredChannel.h:20
Muon::RpcRdoToPrepDataToolMT::m_xAODKey
SG::WriteHandleKey< xAOD::RpcStripContainer > m_xAODKey
Definition: RpcRdoToPrepDataToolMT.h:178
Muon::RpcRdoToPrepDataToolMT::m_rpcCoinDataContainerKey
SG::WriteHandleKey< RpcCoinDataContainer > m_rpcCoinDataContainerKey
RpcCoinData containers.
Definition: RpcRdoToPrepDataToolMT.h:150
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
Muon::RpcRdoToPrepDataToolMT::m_coindataContainerCacheKey
SG::UpdateHandleKey< RpcCoinDataCollection_Cache > m_coindataContainerCacheKey
Definition: RpcRdoToPrepDataToolMT.h:174
Muon::RpcRdoToPrepDataToolMT::m_timeShift
Gaudi::Property< float > m_timeShift
Definition: RpcRdoToPrepDataToolMT.h:130
Muon::RpcRdoToPrepDataToolMT::m_rpcReadKey
SG::ReadCondHandleKey< RpcCablingCondData > m_rpcReadKey
Definition: RpcRdoToPrepDataToolMT.h:165
Muon::RpcRdoToPrepDataToolMT::State
Definition: RpcRdoToPrepDataToolMT.h:46
Muon::MuonPrepDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::RpcRdoToPrepDataToolMT::m_prdContainerCacheKey
SG::UpdateHandleKey< RpcPrepDataCollection_Cache > m_prdContainerCacheKey
This is the key for the cache for the MDT PRD containers, can be empty.
Definition: RpcRdoToPrepDataToolMT.h:171
Muon::RpcRdoToPrepDataToolMT::State::m_decodedRobIds
std::unordered_set< uint32_t > m_decodedRobIds
Definition: RpcRdoToPrepDataToolMT.h:76
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
Muon::RpcRdoToPrepDataToolMT::processTriggerHitHypothesis
void processTriggerHitHypothesis(RpcCoinMatrix::const_iterator itD, RpcCoinMatrix::const_iterator itD_end, bool highptpad, bool &triggerHit, unsigned short &threshold, unsigned short &overlap, bool &toSkip) const
Definition: RpcRdoToPrepDataToolMT.cxx:993
Muon::RpcPrepData
Class to represent RPC measurements.
Definition: RpcPrepData.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::RpcRdoToPrepDataToolMT::m_rpcPrepDataContainerKey
SG::WriteHandleKey< RpcPrepDataContainer > m_rpcPrepDataContainerKey
RpcPrepData containers.
Definition: RpcRdoToPrepDataToolMT.h:147
MuonR4::State
CalibratedSpacePoint::State State
Definition: SpacePointCalibrator.cxx:33
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
Muon::RpcRdoToPrepDataToolMT::State::rpcPrepDataCollections
std::vector< std::unique_ptr< RpcPrepDataCollection > > rpcPrepDataCollections
Definition: RpcRdoToPrepDataToolMT.h:55
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::RpcRdoToPrepDataToolMT::State::coinDataCont
std::unique_ptr< RpcCoinDataContainer > coinDataCont
Pointer of the coin container stored in store gate.
Definition: RpcRdoToPrepDataToolMT.h:61
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:121
Muon::RpcRdoToPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: RpcRdoToPrepDataToolMT.h:139
RpcPad::onlineId
ubit16 onlineId() const
Definition: RpcPad.h:107
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:53
Muon::RpcRdoToPrepDataToolMT::transferAndRecordPrepData
StatusCode transferAndRecordPrepData(const EventContext &ctx, State &state) const
Stores the PrepData container into store gate.
Definition: RpcRdoToPrepDataToolMT.cxx:157
MuonIdHelper::stationNameString
const std::string & stationNameString(const int &index) const
Definition: MuonIdHelper.cxx:858
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Muon::RpcCablingData
Helper struct that is parsed to the cabling map to translate between the offline & online Identifiers...
Definition: RpcCablingData.h:96
IDC_Helper.h
MuonGM::RpcReadoutElement::containsId
virtual bool containsId(const Identifier &id) const override
function to be used to check whether a given Identifier is contained in the readout element
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:423
Muon::RpcRdoToPrepDataToolMT::State::prepDataCont
std::unique_ptr< RpcPrepDataContainer > prepDataCont
Pointer of the prep container stored in store gate.
Definition: RpcRdoToPrepDataToolMT.h:59
Muon::RpcRdoToPrepDataToolMT::m_readKey
SG::ReadCondHandleKey< RpcCondDbData > m_readKey
Definition: RpcRdoToPrepDataToolMT.h:163
Muon::RpcRdoToPrepDataToolMT::m_etaphi_coincidenceTime
Gaudi::Property< float > m_etaphi_coincidenceTime
3 ns is the resolution of the RPC readout electronics
Definition: RpcRdoToPrepDataToolMT.h:116
Muon::RpcRdoToPrepDataToolMT::transferAndRecordCoinData
StatusCode transferAndRecordCoinData(const EventContext &ctx, State &state) const
Stores the CoinData container into store gate.
Definition: RpcRdoToPrepDataToolMT.cxx:218
Muon::RpcRdoToPrepDataToolMT::State::m_ambiguousCollections
std::unordered_set< IdentifierHash > m_ambiguousCollections
Definition: RpcRdoToPrepDataToolMT.h:73
Muon::RpcRdoToPrepDataToolMT::m_producePRDfromTriggerWords
Gaudi::Property< bool > m_producePRDfromTriggerWords
Definition: RpcRdoToPrepDataToolMT.h:122
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
threshold
Definition: chainparser.cxx:74
SG::UpdateHandle
Definition: UpdateHandle.h:91
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
RpcPad::identifyHash
IdentifierHash identifyHash() const
Returns the OFFLINE identifier hash for this collection.
Definition: RpcPad.h:103
Muon::RpcRdoToPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of RPC RDO into RpcPerpData
Definition: RpcRdoToPrepDataToolMT.h:132
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
RpcPad
Definition: RpcPad.h:21
Muon::MuonCoinDataCollection::identifyHash
IdentifierHash identifyHash() const
MuonGM::RpcReadoutElement::StripWidth
double StripWidth(bool measphi) const
returns the strip width for the phi or eta plane
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
Muon::RpcRdoToPrepDataToolMT::m_overlap_timeTolerance
Gaudi::Property< float > m_overlap_timeTolerance
Definition: RpcRdoToPrepDataToolMT.h:119
RpcFiredChannel::bcid
ubit16 bcid() const
Definition: RpcFiredChannel.h:52
Muon::RpcRdoToPrepDataToolMT::m_idHelperSvc
ServiceHandle< IMuonIdHelperSvc > m_idHelperSvc
Definition: RpcRdoToPrepDataToolMT.h:143
RpcPad::sector
int sector() const
Definition: RpcPad.h:112
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
xAOD::parentId
@ parentId
Definition: TrackingPrimitives.h:517
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::RpcRdoToPrepDataToolMT::m_rpcRdoDecoderTool
ToolHandle< IRPC_RDO_Decoder > m_rpcRdoDecoderTool
Definition: RpcRdoToPrepDataToolMT.h:160
DEBUG
#define DEBUG
Definition: page_access.h:11
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
Muon::RpcRdoToPrepDataToolMT::State::rpcCoinDataCollections
std::vector< std::unique_ptr< RpcCoinDataCollection > > rpcCoinDataCollections
Definition: RpcRdoToPrepDataToolMT.h:56
Muon::RpcRdoToPrepDataToolMT::State::getCoinCollection
RpcCoinDataCollection * getCoinCollection(const Identifier &id)
Definition: RpcRdoToPrepDataToolMT.cxx:37
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
Muon::RpcRdoToPrepDataToolMT::loadProcessedChambers
StatusCode loadProcessedChambers(const EventContext &ctx, State &state) const
Load the hashes of the processed chambers.
Definition: RpcRdoToPrepDataToolMT.cxx:82
IdentifierByDetElSorter.h
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:55
Muon::IdentifierByDetElSorter
Definition: IdentifierByDetElSorter.h:17
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
Muon::RpcRdoToPrepDataToolMT::State::m_decodedOfflineHashIds
std::unordered_set< IdentifierHash > m_decodedOfflineHashIds
Definition: RpcRdoToPrepDataToolMT.h:69
RpcRdoToPrepDataToolMT.h
Muon::RpcRdoToPrepDataToolMT::m_nRpcCablingKey
SG::ReadCondHandleKey< RpcCablingMap > m_nRpcCablingKey
Definition: RpcRdoToPrepDataToolMT.h:167
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
RpcStripAuxContainer.h
Muon::RpcRdoToPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< RpcPadContainer > m_rdoContainerKey
Definition: RpcRdoToPrepDataToolMT.h:153
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::RpcRdoToPrepDataToolMT::processNrpcRdo
StatusCode processNrpcRdo(const EventContext &ctx, State &state) const
15 ns should be the max.diff.
Definition: RpcRdoToPrepDataToolMT.cxx:907
Muon::RpcRdoToPrepDataToolMT::m_solvePhiAmbiguities
Gaudi::Property< bool > m_solvePhiAmbiguities
Definition: RpcRdoToPrepDataToolMT.h:125
Muon::RpcRdoToPrepDataToolMT::m_isMC
Gaudi::Property< bool > m_isMC
Definition: RpcRdoToPrepDataToolMT.h:137
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
RpcReadoutElement.h
Identifier
Definition: IdentifierFieldParser.cxx:14