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

#include <RpcRdoToPrepDataToolMT.h>

Inheritance diagram for Muon::RpcRdoToPrepDataToolMT:

Classes

struct  State

Public Member Functions

virtual StatusCode initialize () override
virtual StatusCode finalize () override
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.
virtual StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIds) const override
 This code is thread-safe as we will propagate local thread collection contents to a thread-safe one.
virtual StatusCode provideEmptyContainer (const EventContext &ctx) const override

Protected Member Functions

StatusCode transferAndRecordPrepData (const EventContext &ctx, State &state) const
 Stores the PrepData container into store gate.
StatusCode transferAndRecordCoinData (const EventContext &ctx, State &state) const
 Stores the CoinData container into store gate.
StatusCode loadProcessedChambers (const EventContext &ctx, State &state) const
 Load the hashes of the processed chambers.
void printMTPrepData (const RpcPrepDataContainer &prepData) const
void printMTCoinData (const RpcCoinDataContainer &prepData) const
StatusCode decodeImpl (const EventContext &ctx, State &state, const std::vector< IdentifierHash > &idVect, bool firstTimeInTheEvent) const
StatusCode decodeImpl (const EventContext &ctx, State &state, const std::vector< uint32_t > &robIds, bool firstTimeInTheEvent) const
StatusCode processPad (const EventContext &ctx, State &state, const RpcPad *rdoColl, bool &processingetaview, bool &processingphiview, int &nPrepRawData, const std::vector< IdentifierHash > &idVect, bool doingSecondLoopAmbigColls) const
void processTriggerHitHypothesis (RpcCoinMatrix::const_iterator itD, RpcCoinMatrix::const_iterator itD_end, bool highptpad, bool &triggerHit, unsigned short &threshold, unsigned short &overlap, bool &toSkip) const
StatusCode processNrpcRdo (const EventContext &ctx, State &state) const
 15 ns should be the max.diff.

Protected Attributes

Gaudi::Property< float > m_etaphi_coincidenceTime
 3 ns is the resolution of the RPC readout electronics
Gaudi::Property< float > m_overlap_timeTolerance
Gaudi::Property< bool > m_producePRDfromTriggerWords
Gaudi::Property< bool > m_solvePhiAmbiguities
Gaudi::Property< bool > m_reduceCablingOverlap
Gaudi::Property< float > m_timeShift
Gaudi::Property< bool > m_decodeData
 toggle on/off the decoding of RPC RDO into RpcPerpData
Gaudi::Property< bool > m_RPCInfoFromDb {this, "RPCInfoFromDb", false}
 correct time prd from cool db
Gaudi::Property< bool > m_isMC {this, "isMC", false}
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_muDetMgrKey
ServiceHandle< IMuonIdHelperSvcm_idHelperSvc
SG::WriteHandleKey< RpcPrepDataContainerm_rpcPrepDataContainerKey
 RpcPrepData containers.
SG::WriteHandleKey< RpcCoinDataContainerm_rpcCoinDataContainerKey
 RpcCoinData containers.
SG::ReadHandleKey< RpcPadContainerm_rdoContainerKey
SG::ReadHandleKey< xAOD::NRPCRDOContainerm_rdoNrpcContainerKey
ToolHandle< IRPC_RDO_Decoderm_rpcRdoDecoderTool
SG::ReadCondHandleKey< RpcCondDbDatam_readKey
SG::ReadCondHandleKey< RpcCablingCondDatam_rpcReadKey
SG::ReadCondHandleKey< RpcCablingMapm_nRpcCablingKey
SG::UpdateHandleKey< RpcPrepDataCollection_Cachem_prdContainerCacheKey
 This is the key for the cache for the MDT PRD containers, can be empty.
SG::UpdateHandleKey< RpcCoinDataCollection_Cachem_coindataContainerCacheKey
Gaudi::Property< double > m_stripTimeResolution

Private Attributes

std::atomic_int m_spuriousHitCounter

Detailed Description

Definition at line 30 of file RpcRdoToPrepDataToolMT.h.

Member Function Documentation

◆ decode() [1/2]

StatusCode Muon::RpcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< IdentifierHash > & idVect ) const
overridevirtual

This code is thread-safe as we will propagate local thread collection contents to a thread-safe one.

Definition at line 118 of file RpcRdoToPrepDataToolMT.cxx.

119 {
120 ATH_MSG_DEBUG("Calling Core decode function from MT decode function (hash vector)");
121 State state{m_idHelperSvc.get()};
122 ATH_CHECK(loadProcessedChambers(ctx, state));
123
124 ATH_CHECK(decodeImpl(ctx, state, idVect, true));
125 ATH_CHECK(processNrpcRdo(ctx, state));
126 ATH_MSG_DEBUG("Core decode processed in MT decode (hash vector)");
127
130
131 return StatusCode::SUCCESS;
132}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
StatusCode decodeImpl(const EventContext &ctx, State &state, const std::vector< IdentifierHash > &idVect, bool firstTimeInTheEvent) const
ServiceHandle< IMuonIdHelperSvc > m_idHelperSvc
StatusCode transferAndRecordPrepData(const EventContext &ctx, State &state) const
Stores the PrepData container into store gate.
StatusCode loadProcessedChambers(const EventContext &ctx, State &state) const
Load the hashes of the processed chambers.
StatusCode processNrpcRdo(const EventContext &ctx, State &state) const
15 ns should be the max.diff.
StatusCode transferAndRecordCoinData(const EventContext &ctx, State &state) const
Stores the CoinData container into store gate.

◆ decode() [2/2]

StatusCode Muon::RpcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< uint32_t > & robIds ) const
overridevirtual

This code is thread-safe as we will propagate local thread collection contents to a thread-safe one.

Definition at line 136 of file RpcRdoToPrepDataToolMT.cxx.

137 {
138 ATH_MSG_DEBUG("Calling Core decode function from MT decode function (ROB vector)");
139 State state{m_idHelperSvc.get()};
140 ATH_CHECK(loadProcessedChambers(ctx, state));
141
142 ATH_CHECK(decodeImpl(ctx, state, robIds, true));
143 ATH_CHECK(processNrpcRdo(ctx, state));
144 ATH_MSG_DEBUG("Core decode processed in MT decode (ROB vector)");
145
148
149 return StatusCode::SUCCESS;
150}

◆ decodeImpl() [1/2]

StatusCode Muon::RpcRdoToPrepDataToolMT::decodeImpl ( const EventContext & ctx,
State & state,
const std::vector< IdentifierHash > & idVect,
bool firstTimeInTheEvent ) const
protected

here the RDO container is retrieved and filled -whatever input type we start with- => check the size

Definition at line 229 of file RpcRdoToPrepDataToolMT.cxx.

231 {
232 int sizeVectorRequested = idVect.size();
233 ATH_MSG_DEBUG("Decode method called for " << sizeVectorRequested << " offline collections");
234 if (sizeVectorRequested == 0){
235 ATH_MSG_DEBUG("Decoding the entire event");
236 }
237 // create an empty vector of hash ids to be decoded (will be filled if
238 // RoI-based and left empty if full-scan)
239 std::vector<IdentifierHash> idVectToBeDecoded;
240 idVectToBeDecoded.reserve(idVect.size());
241
242 if (firstTimeInTheEvent) {
243 state.m_fullEventDone = sizeVectorRequested == 0;
244 } else {
245 if (state.m_fullEventDone) {
246 ATH_MSG_DEBUG("Whole event has already been decoded; nothing to do.");
247 return StatusCode::SUCCESS;
248 }
249 if (sizeVectorRequested == 0) {
250 state.m_fullEventDone = true;
251 }
252 }
253
254 if (sizeVectorRequested != 0) {
255 // the program goes in here only if RoI-based decoding has been called and
256 // the full event is not already decoded this code ensures decoding of every
257 // offline hash id is called only once
258 for (const IdentifierHash& itHashId : idVect) {
259 if (state.m_decodedOfflineHashIds.insert(itHashId).second)
260 idVectToBeDecoded.push_back(itHashId);
261 }
262
263 if (idVectToBeDecoded.empty()) {
264 ATH_MSG_DEBUG("All requested offline collections have already been decoded; nothing to do.");
265 return StatusCode::SUCCESS;
266 } else {
267 ATH_MSG_DEBUG(idVectToBeDecoded.size()
268 << " offline collections have not yet been decoded and will be decoded now.");
269 ATH_MSG_VERBOSE("The list of offline collection hash ids to be decoded:"<<std::endl<<idVectToBeDecoded);
270 }
271 }
272
273 // if RPC decoding is switched off stop here
274 if (!m_decodeData) {
275 ATH_MSG_DEBUG("Stored empty container. Decoding RPC RDO into RPC PrepRawData is switched off");
276 return StatusCode::SUCCESS;
277 }
278
279 ATH_MSG_DEBUG("Decoding RPC RDO into RPC PrepRawData");
280
281 SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
282 // if the vector requested has size 0, we need to perform a scan of the entire
283 // RDO container otherwise select the pads to be decoded
284 std::vector<IdentifierHash> rdoHashVec;
285 if (sizeVectorRequested != 0) {
286 ATH_MSG_DEBUG("Looking for pads IdHash to be decoded for the requested collection Ids");
287 ATH_CHECK(rpcCabling->giveRDO_fromPRD(idVectToBeDecoded, rdoHashVec));
288 }
289
290 // we come here if the rdo container is already in SG (for example in MC RDO!)
291 ATH_MSG_DEBUG("Retrieving Rpc PAD container from the store");
292 auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
293 if (!rdoContainerHandle.isValid()) {
294 ATH_MSG_ERROR("Retrieval of RPC RDO container failed ! "<<m_rdoContainerKey.fullKey());
295 return StatusCode::FAILURE;
296 }
297
300 if (rdoContainerHandle->numberOfCollections() == 0) {
301 // empty pad container - no rpc rdo in this event
302 ATH_MSG_DEBUG("Empty pad container - no rpc rdo in this event ");
303 return StatusCode::SUCCESS;
304 }
305 ATH_MSG_DEBUG("Not empty pad container in this event ");
306
307 // start here to process the RDO (for the full event of for a fraction of it)
308 bool processingetaview{m_solvePhiAmbiguities}, processingphiview{false};
309 bool doingSecondLoopAmbigColls = false;
310 while (processingetaview || processingphiview || (!m_solvePhiAmbiguities)) {
311 int ipad{0}, nPrepRawData{0}, nPhiPrepRawData{0}, nEtaPrepRawData{0};
312 if (processingphiview) {
313 state.m_ambiguousCollections.clear();
314 }
315 ATH_MSG_DEBUG("*** Processing "<<(processingetaview ? "eta" : "phi")<<" view ");
316 // seeded decoding
317 if (sizeVectorRequested != 0) {
318 ATH_MSG_DEBUG("Start loop over pads hashes - seeded mode ");
319 for (const IdentifierHash& iPadHash : rdoHashVec) {
320 const RpcPad* rdoColl = rdoContainerHandle->indexFindPtr(iPadHash);
321 if (!rdoColl) {
322 ATH_MSG_DEBUG("Requested pad with online id "<< iPadHash << " not found in the rdoContainerHandle.");
323 continue;
324 }
325 ++ipad;
326
327 ATH_MSG_DEBUG("A new pad here n. " << ipad << ", online id "<< rdoColl->identifyHash()
328 << ", with " << rdoColl->size() << " CM inside ");
329 ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
330 processingphiview, nPrepRawData, idVectToBeDecoded, doingSecondLoopAmbigColls));
331
332 } // end loop over requested pads hashes
333 } else { // unseeded // whole event
334 ATH_MSG_DEBUG("Start loop over pads - unseeded mode ");
335 for (const RpcPad* rdoColl : *rdoContainerHandle) {
336 // loop over all elements of the pad container
337 if (rdoColl->empty()){
338 continue;
339 }
340 ++ipad;
341 ATH_MSG_DEBUG("A new pad here n. " << ipad << ", online id "<< rdoColl->identifyHash()
342 << ", with " << rdoColl->size() << " CM inside ");
343
344 ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
345 processingphiview, nPrepRawData, idVectToBeDecoded, doingSecondLoopAmbigColls));
346 } // end loop over pads
347 }
348
349 if (processingetaview) {
350 processingetaview = false;
351 processingphiview = true;
352 nEtaPrepRawData = nPrepRawData;
353 ATH_MSG_DEBUG("*** " << nEtaPrepRawData << " eta PrepRawData registered");
354 } else {
355 processingphiview = false;
356 nPhiPrepRawData = nPrepRawData - nEtaPrepRawData;
357 ATH_MSG_DEBUG("*** " << nPhiPrepRawData << " phi PrepRawData registered");
358 if (!state.m_ambiguousCollections.empty()) {
359 // loop again for unrequested collections stored with ambiguous phi hits
360 doingSecondLoopAmbigColls = true;
361 processingetaview = true;
362 ATH_MSG_DEBUG(state.m_ambiguousCollections.size() << " ambiguous collections were stored:");
363 idVectToBeDecoded.clear();
364 rdoHashVec.clear();
365 for (const IdentifierHash& itAmbiColl : state.m_ambiguousCollections) {
366 ATH_MSG_DEBUG(itAmbiColl << " ");
367 idVectToBeDecoded.push_back(itAmbiColl);
368 state.m_decodedOfflineHashIds.insert(itAmbiColl);
369 }
370 ATH_CHECK(rpcCabling->giveRDO_fromPRD(idVectToBeDecoded, rdoHashVec));
371 }
372 }
374 ATH_MSG_DEBUG("*** " << nPrepRawData << " PrepRawData registered");
375 break;
376 }
377 }
378
379 ATH_MSG_DEBUG("*** Final Cleanup ");
380 return StatusCode::SUCCESS;
381}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcPad
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
SG::ReadHandleKey< RpcPadContainer > m_rdoContainerKey
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of RPC RDO into RpcPerpData
StatusCode processPad(const EventContext &ctx, State &state, const RpcPad *rdoColl, bool &processingetaview, bool &processingphiview, int &nPrepRawData, const std::vector< IdentifierHash > &idVect, bool doingSecondLoopAmbigColls) const
SG::ReadCondHandleKey< RpcCablingCondData > m_rpcReadKey
Gaudi::Property< bool > m_solvePhiAmbiguities
IdentifierHash identifyHash() const
Returns the OFFLINE identifier hash for this collection.
Definition RpcPad.h:103
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ decodeImpl() [2/2]

StatusCode Muon::RpcRdoToPrepDataToolMT::decodeImpl ( const EventContext & ctx,
State & state,
const std::vector< uint32_t > & robIds,
bool firstTimeInTheEvent ) const
protected

Definition at line 384 of file RpcRdoToPrepDataToolMT.cxx.

385 {
386 // ROB-based decoding is only applied in seeded mode. Full scan should use the
387 // hashId-based method with empty requested collections vector.
388
389 int sizeVectorRequested = robIds.size();
390 ATH_MSG_DEBUG("Decode method called for " << sizeVectorRequested << " ROBs");
391
392 std::vector<uint32_t> robIdsToBeDecoded{};
393 robIdsToBeDecoded.reserve(robIds.size());
394
395 if (firstTimeInTheEvent) {
396 state.m_fullEventDone = false;
397 } else {
398 if (state.m_fullEventDone) {
399 ATH_MSG_DEBUG("Whole event has already been decoded; nothing to do.");
400 return StatusCode::SUCCESS;
401 }
402 }
403
404 // check which of the requested robs are not yet decoded
405 for (uint32_t robid : robIds) {
406 if (state.m_decodedRobIds.insert(robid).second) {
407 robIdsToBeDecoded.push_back(robid);
408 }
409 }
410
411 if (robIdsToBeDecoded.empty()) {
412 ATH_MSG_DEBUG("All requested ROBs have already been decoded; nothing to do.");
413 return StatusCode::SUCCESS;
414 }
415 ATH_MSG_DEBUG(robIdsToBeDecoded.size()<< " ROBs have not yet been decoded and will be decoded now.");
416 if (msgLvl(MSG::VERBOSE)) {
417 ATH_MSG_VERBOSE("The list of ROB Ids to be decoded:");
418 for (uint32_t robid : robIdsToBeDecoded)
419 ATH_MSG_VERBOSE("0x" << MSG::hex << robid << MSG::dec << " ");
420 }
421
422 SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
423
424 // if all robs will be decoded after the current execution of the method, set
425 // the flag m_fullEventDone
426 if (state.m_decodedRobIds.size() == rpcCabling->giveFullListOfRobIds().size())
427 state.m_fullEventDone = true;
428
429 // if RPC decoding is switched off stop here
430 if (!m_decodeData) {
431 ATH_MSG_DEBUG("Stored empty container. Decoding RPC RDO into RPC PrepRawData is switched off");
432 return StatusCode::SUCCESS;
433 }
434
435 ATH_MSG_DEBUG("Decoding RPC RDO into RPC PrepRawData");
436
437 // we come here if the rdo container is already in SG (for example in MC RDO!)
438 ATH_MSG_DEBUG("Retrieving Rpc PAD container from the store");
439 auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
440 if (!rdoContainerHandle.isValid()) {
441 ATH_MSG_WARNING("Retrieval of RPC RDO container failed ! "<<m_rdoContainerKey.fullKey());
442 return StatusCode::SUCCESS;
443 }
444
445 // here the RDO container is retrieved and filled -whatever input type we
446 // start with- => check the size
447 if (rdoContainerHandle->empty()) {
448 // empty pad container - no rpc rdo in this event
449 ATH_MSG_DEBUG("Empty pad container - no rpc rdo in this event ");
450 return StatusCode::SUCCESS;
451 }
452 ATH_MSG_DEBUG("Not empty pad container in this event ");
453
454 // obtain a list of PADs (RDOs) to be processed
455 std::vector<IdentifierHash> rdoHashVec;
456 rdoHashVec.reserve(13 * robIdsToBeDecoded.size()); // most ROBs have 13 RDOs, some have less
457 ATH_CHECK(rpcCabling->giveRDO_fromROB(robIdsToBeDecoded, rdoHashVec));
458
459 // start here to process the RDOs
460 bool processingetaview = true;
461 bool processingphiview = false;
463 processingetaview = false;
464 }
465 while (processingetaview || processingphiview || (!m_solvePhiAmbiguities)) {
466 int ipad{0}, nPrepRawData{0}, nPhiPrepRawData{0}, nEtaPrepRawData{0};
467 if (processingphiview){
468 state.m_ambiguousCollections.clear();
469 }
470 ATH_MSG_DEBUG("*** Processing "<<(processingetaview? "eta" : "phi")<<" view ");
471
472 // seeded decoding (for full scan, use the hashId-based method)
473 ATH_MSG_DEBUG("Start loop over pads hashes - seeded mode ");
474
475 for (const IdentifierHash& padHashId : rdoHashVec) {
476 const RpcPad* rdoColl = rdoContainerHandle->indexFindPtr(padHashId);
477 if (!rdoColl) {
478 ATH_MSG_DEBUG("Requested pad with online id "<< padHashId << " not found in the rdoContainerHandle.");
479 continue;
480 }
481 ++ipad;
482 ATH_MSG_DEBUG("A new pad here n."<< ipad << ", online id " << rdoColl->identifyHash()
483 << ", with " << rdoColl->size() << " CM inside ");
484 ATH_CHECK(processPad(ctx, state, rdoColl, processingetaview,
485 processingphiview, nPrepRawData, rdoHashVec, false));
486 }
487
488 if (processingetaview) {
489 processingetaview = false;
490 processingphiview = true;
491 nEtaPrepRawData = nPrepRawData;
492 ATH_MSG_DEBUG("*** " << nEtaPrepRawData << " eta PrepRawData registered");
493 } else {
494 processingphiview = false;
495 nPhiPrepRawData = nPrepRawData - nEtaPrepRawData;
496 ATH_MSG_DEBUG("*** " << nPhiPrepRawData << " phi PrepRawData registered");
497 }
499 ATH_MSG_DEBUG("*** " << nPrepRawData << " PrepRawData registered");
500 break;
501 }
502 }
503
504 ATH_MSG_DEBUG("*** Final Cleanup ");
505
506 return StatusCode::SUCCESS;
507
508}
#define ATH_MSG_WARNING(x)

◆ finalize()

StatusCode Muon::RpcRdoToPrepDataToolMT::finalize ( )
overridevirtual

Definition at line 80 of file RpcRdoToPrepDataToolMT.cxx.

80 {
81 ATH_MSG_INFO(" Total number of spurious RPC channels in RAW data that are not associated to RPC strips: " << m_spuriousHitCounter);
82 return StatusCode::SUCCESS;
83}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode Muon::RpcRdoToPrepDataToolMT::initialize ( )
overridevirtual

Definition at line 47 of file RpcRdoToPrepDataToolMT.cxx.

47 {
48 // perform necessary one-off initialization
49
50 ATH_MSG_INFO("properties are ");
51 ATH_MSG_INFO("produceRpcCoinDatafromTriggerWords " <<m_producePRDfromTriggerWords);
52 ATH_MSG_INFO("reduceCablingOverlap " << m_reduceCablingOverlap);
53 ATH_MSG_INFO("solvePhiAmbiguities " << m_solvePhiAmbiguities);
54 ATH_MSG_INFO("timeShift " << m_timeShift);
56 ATH_MSG_WARNING("Inconsistent setting of properties (solvePhiAmbiguities entails reduceCablingOverlap)");
57 ATH_MSG_WARNING("Resetting reduceCablingOverlap to true");
59 }
60 ATH_MSG_INFO("etaphi_coincidenceTime " << m_etaphi_coincidenceTime);
61 ATH_MSG_INFO("overlap_timeTolerance " << m_overlap_timeTolerance);
62 ATH_MSG_INFO("Correct prd time from cool db " << m_RPCInfoFromDb);
64 ATH_CHECK(m_idHelperSvc.retrieve());
65 ATH_CHECK(m_rpcReadKey.initialize());
67 ATH_CHECK(m_rdoContainerKey.initialize());
70 // If we don't configure the NRPC RDO
71 // key, the cabling is needed either.
74 ATH_CHECK(m_muDetMgrKey.initialize());
78 return StatusCode::SUCCESS;
79}
SG::ReadCondHandleKey< RpcCondDbData > m_readKey
Gaudi::Property< bool > m_RPCInfoFromDb
correct time prd from cool db
Gaudi::Property< bool > m_producePRDfromTriggerWords
SG::WriteHandleKey< RpcCoinDataContainer > m_rpcCoinDataContainerKey
RpcCoinData containers.
Gaudi::Property< float > m_timeShift
Gaudi::Property< float > m_overlap_timeTolerance
SG::UpdateHandleKey< RpcCoinDataCollection_Cache > m_coindataContainerCacheKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
SG::WriteHandleKey< RpcPrepDataContainer > m_rpcPrepDataContainerKey
RpcPrepData containers.
Gaudi::Property< float > m_etaphi_coincidenceTime
3 ns is the resolution of the RPC readout electronics
ToolHandle< IRPC_RDO_Decoder > m_rpcRdoDecoderTool
SG::ReadCondHandleKey< RpcCablingMap > m_nRpcCablingKey
SG::ReadHandleKey< xAOD::NRPCRDOContainer > m_rdoNrpcContainerKey
Gaudi::Property< bool > m_reduceCablingOverlap
SG::UpdateHandleKey< RpcPrepDataCollection_Cache > m_prdContainerCacheKey
This is the key for the cache for the MDT PRD containers, can be empty.

◆ loadProcessedChambers()

StatusCode Muon::RpcRdoToPrepDataToolMT::loadProcessedChambers ( const EventContext & ctx,
State & state ) const
protected

Load the hashes of the processed chambers.

Definition at line 84 of file RpcRdoToPrepDataToolMT.cxx.

84 {
85 const int modHashMax = m_idHelperSvc->rpcIdHelper().module_hash_max();
86 if (!m_prdContainerCacheKey.key().empty()) {
87 SG::UpdateHandle update{m_prdContainerCacheKey, ctx};
88 if (!update.isValid()) {
89 ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
90 return StatusCode::FAILURE;
91 }
92 state.prepDataCont = std::make_unique<RpcPrepDataContainer>(update.ptr());
93 for (const RpcPrepDataCollection* coll : *state.prepDataCont) {
94 state.m_decodedOfflineHashIds.insert(coll->identifyHash());
95 }
96 } else{
97 state.prepDataCont = std::make_unique<RpcPrepDataContainer>(modHashMax);
98 }
99 if (m_coindataContainerCacheKey.key().empty()) {
100 // without the cache we just record the container
101 state.coinDataCont = std::make_unique<RpcCoinDataContainer>(modHashMax);
102 } else {
103 // use the cache to get the container
104 SG::UpdateHandle update{m_coindataContainerCacheKey, ctx};
105 if (!update.isValid()) {
106 ATH_MSG_FATAL("Invalid UpdateHandle "<< m_coindataContainerCacheKey.key());
107 return StatusCode::FAILURE;
108 }
109 state.coinDataCont = std::make_unique<RpcCoinDataContainer>(update.ptr());
110 for (const RpcCoinDataCollection* coll : *state.coinDataCont) {
111 state.m_decodedOfflineHashIds.insert(coll->identifyHash());
112 }
113 }
114 return StatusCode::SUCCESS;
115}
#define ATH_MSG_FATAL(x)
MuonCoinDataCollection< RpcCoinData > RpcCoinDataCollection
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection

◆ printMTCoinData()

void Muon::RpcRdoToPrepDataToolMT::printMTCoinData ( const RpcCoinDataContainer & prepData) const
protected

◆ printMTPrepData()

void Muon::RpcRdoToPrepDataToolMT::printMTPrepData ( const RpcPrepDataContainer & prepData) const
protected

◆ processNrpcRdo()

StatusCode Muon::RpcRdoToPrepDataToolMT::processNrpcRdo ( const EventContext & ctx,
State & state ) const
protected

15 ns should be the max.diff.

in prop.time in phi and eta strips

No need to check for its validity. It's done at other places for sure

Convert from online to offline cabling

That needs to be parsed to the constructor of the PRD somehow...

Definition at line 876 of file RpcRdoToPrepDataToolMT.cxx.

877 {
878 if (m_rdoNrpcContainerKey.empty()) {
879 ATH_MSG_DEBUG("The NRPC processing is disabled.");
880 return StatusCode::SUCCESS;
881 }
882
883 ATH_MSG_DEBUG("Retrieving Nrpc RDO container from the store");
884 SG::ReadHandle rdoNrpcContainerHandle{m_rdoNrpcContainerKey, ctx};
885 if (!rdoNrpcContainerHandle.isPresent()) {
886 ATH_MSG_ERROR("Retrieval of NRPC RDO " << m_rdoNrpcContainerKey.fullKey()
887 << " container failed !");
888 return StatusCode::FAILURE;
889 }
890
891 if (rdoNrpcContainerHandle->empty()) {
892 // empty NRPC RDO container - no nrpc rdo in this event
893 ATH_MSG_DEBUG("Empty NRPC RDO container - no nrpc rdo in this event ");
894 return StatusCode::SUCCESS;
895 }
896 ATH_MSG_DEBUG("Not empty NRPC RDO container in this event ");
897
898 SG::ReadCondHandle readCdo{m_nRpcCablingKey, ctx};
899 if (!readCdo.isValid()) {
900 ATH_MSG_ERROR("Could not retrieve " << m_nRpcCablingKey.fullKey()
901 << " from the conditions store");
902 return StatusCode::FAILURE;
903 }
905 SG::ReadCondHandle muDetMgr{m_muDetMgrKey, ctx};
906
907 for (const xAOD::NRPCRDO* nrpcrdo : *rdoNrpcContainerHandle) {
909 RpcCablingData translateCache{};
910 translateCache.subDetector = nrpcrdo->subdetector();
911 translateCache.boardSector = nrpcrdo->boardsector();
912 translateCache.board = nrpcrdo->board();
913 translateCache.channelId = nrpcrdo->channel();
914 Identifier chanId{};
915 if (!readCdo->getOfflineId(translateCache, msgStream()) ||
916 !readCdo->convert(translateCache, chanId, false)) {
917 // If online channel is not associated to offline, continue to decode the remaining part of the RDO
919 continue;
920 }
921
922 RpcPrepDataCollection* collection = state.getPrepCollection(chanId);
923
924 const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(chanId);
925
926 // List of Digits in the cluster (self)
927 std::vector<Identifier> identifierList{chanId};
928 // Global position
929 const Amg::Vector3D stripPos{descriptor->stripPos(chanId)};
930 ATH_MSG_DEBUG("RPC RDO->PrepRawdata " << m_idHelperSvc->toString(chanId)
931 << " global position "
932 << Amg::toString(stripPos, 2));
933 // Local position
934 Amg::Vector2D pointLocPos{Amg::Vector2D::Zero()};
935 descriptor->surface(chanId).globalToLocal(stripPos, stripPos, pointLocPos);
936 // width of the cluster (self)
937
938 const double stripWidth = descriptor->StripWidth(
939 m_idHelperSvc->rpcIdHelper().measuresPhi(chanId));
940 // Error matrix
941 const double errPos = stripWidth / std::sqrt(12.0);
942 Amg::MatrixX mat(1, 1);
943 mat.setIdentity();
944 mat *= errPos * errPos;
945
946 int ambiguityFlag = 0; // Ambiguity flag not checked for BIS RPCs
947
948 const float time = nrpcrdo->time();
950 const float timeoverthr = nrpcrdo->timeoverthr();
951
952 const IdentifierHash rpcHashId = m_idHelperSvc->moduleHash(chanId);
953 auto newPrepData = std::make_unique<RpcPrepData>(chanId, rpcHashId, pointLocPos, identifierList, mat,
954 descriptor, time, timeoverthr, 0, ambiguityFlag);
955
956 newPrepData->setHashAndIndex(collection->identifyHash(),
957 collection->size());
958 collection->push_back(std::move(newPrepData));
959 }
960 return StatusCode::SUCCESS;
961}
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
double StripWidth(bool measphi) const
returns the strip width for the phi or eta plane
bool isPresent() const
Is the referenced object present in SG?
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...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
time(flags, cells_name, *args, **kw)
NRPCRDO_v1 NRPCRDO
Define the version of the NRPC RDO class.
Definition NRPCRDO.h:13

◆ processPad()

StatusCode Muon::RpcRdoToPrepDataToolMT::processPad ( const EventContext & ctx,
State & state,
const RpcPad * rdoColl,
bool & processingetaview,
bool & processingphiview,
int & nPrepRawData,
const std::vector< IdentifierHash > & idVect,
bool doingSecondLoopAmbigColls ) const
protected

Definition at line 510 of file RpcRdoToPrepDataToolMT.cxx.

513 {
514
515 const RpcIdHelper& idHelper = m_idHelperSvc->rpcIdHelper();
516
517 std::unordered_set<IdentifierHash>& ambiguousCollections{state.m_ambiguousCollections};
518 ATH_MSG_DEBUG("***************** Start of processPad eta/phiview "<< processingetaview << "/" << processingphiview);
519 //{processPad
520 // Get pad online id and sector id
521 uint16_t padId = rdoColl->onlineId();
522 uint16_t sectorId = rdoColl->sector();
523 ATH_MSG_DEBUG("***************** for Pad online Id "<< padId << " m_logic sector ID " << sectorId);
524
525 // Create an RPC PrepDataCollection
526 Identifier oldId{}, oldIdTrg{};
527 ATH_MSG_VERBOSE("Init pointer to RpcPrepDataCollection ");
528 RpcPrepDataCollection* collection{nullptr};
529 RpcCoinDataCollection* collectionTrg{nullptr};
530 IdentifierHash rpcHashId{0};
531
532 SG::ReadCondHandle rpcCabling{m_rpcReadKey, ctx};
533
534 // For each pad, loop on the coincidence matrices
535 int icm = 0;
536 for (const RpcCoinMatrix* coinMat : *rdoColl) {
537 ++icm;
538 bool etaview = !m_isMC;
539 bool highPtCm = false;
540 // Get CM online Id
541 uint16_t cmaId = coinMat->onlineId();
542 ATH_MSG_DEBUG("A new CM here n. "<< icm << " CM online ID " << cmaId<< " with n. of hits = " << coinMat->size()
543 <<", empty: "<<coinMat->empty());
544 ATH_MSG_DEBUG((cmaId < 4? "low": "high") <<" pt ");
545 if (cmaId < 2) {
546 etaview = m_isMC;
547 } else if (cmaId >=4) {
548 highPtCm = true;
549 if (cmaId < 6) {
550 etaview = m_isMC;
551 }
552 }
553 ATH_MSG_DEBUG(" eta view = " << etaview<<", processingetaview: "<<processingetaview
554 <<", processingphiview: "<<processingphiview);
555
556 if (processingetaview && !etaview){
557 continue;
558 } else if (processingphiview && etaview) {
559 continue;
560 }
561 if (coinMat->empty()) {
562 ATH_MSG_DEBUG("Empty CM");
563 }
564 // For each CM, loop on the fired channels
565 int idata = 0;
566 for (RpcCoinMatrix::const_iterator itD = coinMat->begin(); itD != coinMat->end(); ++itD) {
567 const RpcFiredChannel* rpcChan{*itD};
568 idata++;
569 // trigger related quantities
570 unsigned short threshold = 99;
571 unsigned short overlap = 99;
572
573 // flags defining the processing mode of this hit
574 bool solvePhiAmb_thisHit = m_solvePhiAmbiguities;
575 bool reduceCablOvl_thisHit = m_reduceCablingOverlap;
576
577 ATH_MSG_DEBUG("A new CM Hit " << idata);
578 ATH_MSG_DEBUG("RpcFiredChannel: bcid " << rpcChan->bcid() << " time " << rpcChan->time()
579 << " ijk "<< rpcChan->ijk() <<" ch " << ( rpcChan->ijk() < 7 ? rpcChan->channel() : -1));
580 // check if trigger hit
581 // select the cases: ijk = 0 and high p, ijk= 6, ijk=7
582 bool triggerHit = false;
583 bool toSkip = false;
584 processTriggerHitHypothesis(itD, coinMat->end(), highPtCm, triggerHit, threshold, overlap, toSkip);
585 if (toSkip) {
586 continue;
587 }
588 if (triggerHit) {
589 // here ijk = 6 or ijk = 0 in high pt cm
590 // keep all pivot + trigger info (even if duplicated [should never
591 // happen, for pivot hits])
592 solvePhiAmb_thisHit = false;
593 reduceCablOvl_thisHit = false;
594 ATH_MSG_DEBUG("RpcFiredChannel: it's a triggerHit or a lowPt coinc. in a high pt CM \n"
595 << " ijk = " << rpcChan->ijk() << " isHighPtCM " << highPtCm
596 << " thr/ovl = " << threshold << "/" << overlap);
597 }
598
599 // here decode (get offline ids for the online indices of this hit)
600 double time = 0.;
601 std::vector<Identifier> digitVec{m_rpcRdoDecoderTool->getOfflineData(rpcChan, sectorId, padId,
602 cmaId, time, rpcCabling.cptr())};
603 time += m_timeShift;
604
605 int nMatchingEtaHits{0}, nDuplicatePhiHits{0};
606 bool unsolvedAmbiguity{false}, notFinished{true};
607 // allow for 2 iterations in case there are phi digits without matching
608 // eta (eta inefficiency) all eta digits, not already recorded, will be
609 // registered as PrepRawData and all phi digits, not yet recorded and with
610 // a eta digit in the same module and gap, will produce a PrepRawData. Phi
611 // digits without a eta match will not be recorded at the first iteration.
612 // If all phi digits do not have a eta match, they will be all recorded as
613 // PrepRawData in the second iteration (the ambiguity will remain
614 // unsolved)
615 while (notFinished) {
616 // Loop on the digits corresponding to the fired channel
617 ATH_MSG_DEBUG("size of the corresponding list of ID = " << digitVec.size());
618 if (digitVec.empty()) {
619 ATH_MSG_DEBUG("going to next CM hit");
620 notFinished = false;
621 continue;
622 }
623 for (const Identifier& channelId : digitVec) {
624 // Prepare the prepdata for this identifier
625 // channel Id
626 rpcHashId = m_idHelperSvc->moduleHash(channelId);
627 const Identifier parentId = idHelper.parentID(channelId);
628
629 // There is some ambiguity in the channel/sectorId's, so need to
630 // explicitly filter out hashIDs outside of the RoI in seeded decoding
631 // mode
632 if (!idVect.empty() && std::find(idVect.begin(), idVect.end(), rpcHashId) == idVect.end()) {
633 continue;
634 }
635 ATH_MSG_DEBUG("CM Hit decoded into offline Id "<< m_idHelperSvc->toString(channelId) << " time "<< time);
636 ATH_MSG_DEBUG(" oldID = " << m_idHelperSvc->toString(oldId) <<" oldIDtrg = " << m_idHelperSvc->toString(oldIdTrg));
637 bool hasAMatchingEtaHit = 0;
638 // current collection has Id "parentId"; get it from the container !
639 if (triggerHit) {
640 if ((oldIdTrg != parentId) || !collectionTrg) {
641 // Get collection from IDC if it exists, or create it and add it
642 // if not.
643 ATH_MSG_DEBUG(" Looking/Creating a collection with ID = "<< m_idHelperSvc->toString(parentId)
644 << " hash = " << rpcHashId);
645 collectionTrg = state.getCoinCollection(parentId);
646 oldIdTrg = parentId;
647 ATH_MSG_DEBUG(" Resetting oldIDtrg to current parentID = "<< m_idHelperSvc->toString(oldIdTrg));
648 }
649 } else if ((oldId != parentId) || !collection) {
650 // Get collection from IDC if it exists, or create it and add it if
651 // not.
652 ATH_MSG_DEBUG(" Looking/Creating a collection with ID = "<< m_idHelperSvc->toString(parentId) << " hash = "<< rpcHashId);
653 collection = state.getPrepCollection(parentId);
654 oldId = parentId;
655 ATH_MSG_DEBUG(" Resetting oldID to current parentID = "<< m_idHelperSvc->toString(oldId));
656 }
657
658 // check if the data has already been recorded
659 // (if you want to reduce the redundancy due to cabling overlap and if
660 // the collection is not empty)
661 bool duplicate = false;
662 if (reduceCablOvl_thisHit) {
663 ATH_MSG_VERBOSE("Check for duplicates in coll. with size "<< collection->size());
664 for (RpcPrepData* rpc : *collection) {
665 const Identifier existId{rpc->identify()};
666 if (channelId == existId &&
667 std::abs(time - rpc->time()) < m_overlap_timeTolerance) {
668 duplicate = true;
669 hasAMatchingEtaHit = false; // we don't want to increment the
670 // number of strips with
671 // a matching eta due to a cabling overlap
672 ATH_MSG_VERBOSE("Duplicated RpcPrepData(not recorded) = " << m_idHelperSvc->toString(channelId));
673 float previous_time = rpc->time();
674 // choose the smallest time within timeTolerance
675 if (time < previous_time) {
676 rpc->m_time = time;
677 ATH_MSG_DEBUG("time of the prd previously stored is now updated with "
678 << "current hit time: "<< previous_time << " -> " << rpc->time());
679 }
680 break; // this break is why we cannot have
681 // solvePhiAmb_thisHit = true and
682 // reduceCablOvl_thisHit= false
683 }
684
685
686 if (processingphiview && solvePhiAmb_thisHit && !unsolvedAmbiguity && !idHelper.measuresPhi(existId) &&
687 m_idHelperSvc->gasGapId(existId) == m_idHelperSvc->gasGapId(channelId) &&
688 std::abs(time - rpc->time()) < m_etaphi_coincidenceTime) {
689 hasAMatchingEtaHit = true;
690 ATH_MSG_VERBOSE("There's a matching eta hit with id "<< m_idHelperSvc->toString(existId));
691 // here there can be a break ? NO, we need to
692 // keep looping in order to check
693 // if this preprawdata has been already
694 // recorded (due to cabling overlaps)
695 }
696 }
697 if (hasAMatchingEtaHit)
698 nMatchingEtaHits++; // Number of phi strips (possibly
699 // corresponding to this CM hit)
700 // with a matching eta
701 if (processingphiview && duplicate)
702 nDuplicatePhiHits++; // Number of phi strips (possibly
703 // corresponding to this CM hit)
704 // already in the collection
705 } // end of if reduceCablingOverlap
706
707 if (solvePhiAmb_thisHit && !etaview){
708 ATH_MSG_VERBOSE("nMatchingEtaHits = " << nMatchingEtaHits
709 << " hasAMatchingEtaHit = "<< hasAMatchingEtaHit);
710 }
711 if (duplicate) {
712 // this hit was already recorded
713 ATH_MSG_DEBUG("digit already in the collection ");
714 continue;
715 }
716 ATH_MSG_VERBOSE(" solvePhiAmb_thisHit: "<<solvePhiAmb_thisHit<<", processingetaview:"<<processingetaview
717 <<", processingphiview: "<<processingphiview<<", hasAMatchingEtaHit: "<<hasAMatchingEtaHit
718 <<", unsolvedAmbiguity: "<< unsolvedAmbiguity);
719 if ( !solvePhiAmb_thisHit || processingetaview ||
720 (processingphiview && (hasAMatchingEtaHit || unsolvedAmbiguity))) {
721 if (unsolvedAmbiguity) {
722 if (idVect.empty()) { // full-scan mode
723 ATH_MSG_DEBUG("storing data even if unsolvedAmbiguity");
724 } else {
725 // if in RoI mode and the collection was not requested in this
726 // event, add it to ambiguousCollections
727 ATH_MSG_DEBUG("unsolvedAmbiguity is true, adding collection with hash = "
728 << rpcHashId << " to ambiguous collections vector");
729 const auto& decode{state.m_decodedOfflineHashIds};
730 if (!decode.empty() && decode.find(rpcHashId) == decode.end()) {
731 ambiguousCollections.insert(rpcHashId);
732 ATH_MSG_DEBUG("collection not yet processed; added to ambiguous "
733 <<"collection vector; going to the next offline channel ID");
734 continue; // go to the next possible offline channel ID
735 } else if (!doingSecondLoopAmbigColls) {
736 ambiguousCollections.insert(rpcHashId);
737 ATH_MSG_DEBUG("collection already processed and doingSecondLoopAmbigColls=false; added to ambiguous "
738 <<"collection vector; going to the next offline channel ID");
739 continue;
740 } else {
741 ATH_MSG_DEBUG("collection already processed and doingSecondLoopAmbigColls=true; trying to store data even if unsolvedAmbiguity");
742 }
743 }
744 }
745 SG::ReadCondHandle muDetMgr{m_muDetMgrKey, ctx};
746 const RpcReadoutElement* descriptor = muDetMgr->getRpcReadoutElement(channelId);
747
748 // here check validity
749 // if invalid, reset flags
750 if (!descriptor->containsId(channelId)) {
751 hasAMatchingEtaHit = false;
752 duplicate = false;
753 if (idHelper.stationNameString(idHelper.stationName(channelId)) == "BOG"){
754 ATH_MSG_DEBUG("Identifier from the cabling service <"<< m_idHelperSvc->toString(channelId)
755 << "> inconsistent with the geometry of detector element <"
756 << m_idHelperSvc->toStringDetEl(descriptor->identify())
757 << "> =>>ignore this hit /// there are unmasked channels in BOG");
758 }else{
759 ATH_MSG_WARNING("Identifier from the cabling service <"<< m_idHelperSvc->toString(channelId)
760 << "> inconsistent with the geometry of detector element <"
761 << m_idHelperSvc->toStringDetEl(descriptor->identify())<< "> =>>ignore this hit");
762 }
763 continue;
764 }
765
766 //
767 // Global position
768 Amg::Vector3D tempGlobalPosition = descriptor->stripPos(channelId);
769 ATH_MSG_VERBOSE("RPC RDO->PrepRawdata: global position "<<Amg::toString(tempGlobalPosition));
770 // Local position
771 Amg::Vector2D pointLocPos{Amg::Vector2D::Zero()};
772 descriptor->surface(channelId).globalToLocal(tempGlobalPosition, tempGlobalPosition, pointLocPos);
773
774 // List of Digits in the cluster (self)
775 std::vector<Identifier> identifierList{channelId};
776
777 // width of the cluster (self)
778 float stripWidth = descriptor->StripWidth(m_idHelperSvc->rpcIdHelper().measuresPhi(channelId));
779
780 // Error matrix
781 double errPos = stripWidth / std::sqrt(12.0);
782 Amg::MatrixX mat(1, 1);
783 mat.setIdentity();
784 mat *= errPos * errPos;
785 // check if this is a triggerINFO rather then a real hit
786 // Create a new PrepData
787 int ambiguityFlag = 0;
788 if (solvePhiAmb_thisHit) {
789 if (processingetaview){
790 ambiguityFlag = 1;
791 }
792 if (unsolvedAmbiguity){
793 ambiguityFlag = digitVec.size();
794 } else if (hasAMatchingEtaHit){
795 ambiguityFlag = nMatchingEtaHits;
796 }
797 }
798
799 // correct prd time from cool db
800 if (m_RPCInfoFromDb) {
801 SG::ReadCondHandle readHandle{m_readKey, ctx};
802 std::optional<double> StripTimeFromCool = readHandle->getStripTime(channelId);
803 if (StripTimeFromCool) {
804 time -= (*StripTimeFromCool);
805 }
806 }
807
808 if (triggerHit) {
809 ATH_MSG_DEBUG("producing a new RpcCoinData");
810
811 auto newCoinData = std::make_unique<RpcCoinData>(channelId, rpcHashId,
812 std::move(pointLocPos), std::move(identifierList),
813 std::move(mat), descriptor, time,
814 ambiguityFlag, rpcChan->ijk(), threshold, overlap, cmaId, padId, sectorId,
815 !(highPtCm));
816
817 // record the new data in the collection
818 ATH_MSG_DEBUG(" Adding RpcCoinData @ "<< newCoinData.get() << " to collection "
819 << m_idHelperSvc->toString(collectionTrg->identify()));
820
821 newCoinData->setHashAndIndex(collectionTrg->identifyHash(),
822 collectionTrg->size());
823 collectionTrg->push_back(std::move(newCoinData));
824 } // end of to be stored now for RpcCoinData
825 else {
826 ATH_MSG_DEBUG("producing a new RpcPrepData with "
827 << "ambiguityFlag = " << ambiguityFlag);
828
829 auto newPrepData = std::make_unique<RpcPrepData>(channelId, rpcHashId,std::move(pointLocPos),
830 std::move(identifierList),
831 std::move(mat), descriptor, time, ambiguityFlag);
832
833 // record the new data in the collection
834 ATH_MSG_DEBUG(" Adding digit @ "<< newPrepData.get() << " to collection "
835 << m_idHelperSvc->toString(collection->identify()));
836
837 newPrepData->setHashAndIndex(collection->identifyHash(),
838 collection->size());
839 collection->push_back(std::move(newPrepData));
840 // here one should reset ambiguityFlag for the prepdata
841 // registered before the current one (from the same RDO hit) if
842 // nMatchingEtaHits > 1
843 nPrepRawData++;
844 }
845 } // end of to be stored now
846 } // end loop over possible offline identifiers corresponding to this
847 // CM hit
848 ATH_MSG_VERBOSE("processingphiview:"<<processingphiview<<", nMatchingEtaHits:"<<nMatchingEtaHits
849 <<", nDuplicatePhiHits, unsolvedAmbiguity: "<<unsolvedAmbiguity<<", solvePhiAmb_thisHit : "
850 << solvePhiAmb_thisHit);
851 if ((processingphiview && (nMatchingEtaHits == 0)) && (nDuplicatePhiHits == 0) &&
852 (!unsolvedAmbiguity) && (solvePhiAmb_thisHit)) {
853 unsolvedAmbiguity = true;
854 // no eta hits matching any phi digit
855 // loop once again and store all phi digits potentially generating
856 // this CM hit
857 ATH_MSG_DEBUG("No eta prepData matching any phi hit from this CM hit \n"
858 << "loop once again and store all phi digits potentially "
859 "generating this CM hit");
860 } else if (unsolvedAmbiguity)
861 notFinished = false;
862 else
863 notFinished = false;
864 } // end of not finished
865 } // end loop over CM hits
866 } // end loop over CMs
867
868 ATH_MSG_DEBUG("***************** Stop of processPad eta/phiview "
869 << processingetaview << "/" << processingphiview
870 << "***************** for Pad online Id " << padId
871 << " m_logic sector ID " << sectorId);
872
873 return StatusCode::SUCCESS;
874}
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcCoinMatrix
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
virtual bool containsId(const Identifier &id) const override
function to be used to check whether a given Identifier is contained in the readout element
const std::string & stationNameString(const Identifier &id) const
int stationName(const Identifier &id) const
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.
void processTriggerHitHypothesis(RpcCoinMatrix::const_iterator itD, RpcCoinMatrix::const_iterator itD_end, bool highptpad, bool &triggerHit, unsigned short &threshold, unsigned short &overlap, bool &toSkip) const
ubit16 bcid() const
ubit16 channel() const
ubit16 ijk() const
ubit16 time() const
Identifier parentID(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
ubit16 onlineId() const
Definition RpcPad.h:107
int sector() const
Definition RpcPad.h:112
const_pointer_type cptr()
setWord1 uint16_t

◆ processTriggerHitHypothesis()

void Muon::RpcRdoToPrepDataToolMT::processTriggerHitHypothesis ( RpcCoinMatrix::const_iterator itD,
RpcCoinMatrix::const_iterator itD_end,
bool highptpad,
bool & triggerHit,
unsigned short & threshold,
unsigned short & overlap,
bool & toSkip ) const
protected

Definition at line 963 of file RpcRdoToPrepDataToolMT.cxx.

967 {
968 toSkip = false;
969 const RpcFiredChannel* rpcChan = (*itD);
970 if ((highPtCm && rpcChan->ijk() < 2) || (rpcChan->ijk() > 5)) {
971 ATH_MSG_VERBOSE("RpcFiredChannel: it's a trigger hit");
972 triggerHit = true;
973
974 // triggerHit
976 // skip if not storing the trigger info
977 toSkip = true;
978 return;
979 }
980 if (rpcChan->ijk() == 7) {
981 // the info in ijk 7 refer to the previous CM hit with ijk 6 => skip
982 toSkip = true;
983 return;
984 }
985 if (rpcChan->ijk() == 6) {
986 // look for the subsequent ijk 7 to define threshold and overlap
987 ATH_MSG_VERBOSE("This hit: ijk = " << rpcChan->ijk() << "in "<<(highPtCm ? "high" : "low")
988 <<" pT CM, bcid is " << rpcChan->bcid()<< " time is " << rpcChan->time()
989 << " ch " << rpcChan->channel());
990 RpcCoinMatrix::const_iterator itDnext = itD + 1;
991 while (itDnext != itD_end) {
992 const RpcFiredChannel* rpcChanNext = (*itDnext);
993 ATH_MSG_VERBOSE("Next hit: ijk = " << rpcChanNext->ijk() << "in "<<(highPtCm ? "high" : "low")
994 <<" pT CM, bcid is " << rpcChan->bcid() << " time is " << rpcChanNext->time()
995 <<", ch: "<<( rpcChanNext->ijk() < 7? rpcChanNext->channel() : -1));
996
997 if (rpcChanNext->ijk() == 7) {
998 if (rpcChanNext->bcid() == rpcChan->bcid() && rpcChanNext->time() == rpcChan->time()) {
999 ATH_MSG_VERBOSE("bdid/tick match; assigning thr/overlap = " << rpcChanNext->thr() << "/" << rpcChanNext->ovl());
1000 threshold = rpcChanNext->thr();
1001 overlap = rpcChanNext->ovl();
1002 } else {
1003 ATH_MSG_WARNING("ijk =7 after a ijk = 6 BUT bdid/tick don't match - will not assign threshold/overlap ");
1004 }
1005 break;
1006 } else {
1007 if (rpcChanNext->ijk() == 6) {
1008 ++itDnext;
1009 // std::cout<<"next has ijk 6; try next to next"<<std::endl;
1010 } else {
1011 ATH_MSG_WARNING("RPC cm hit with ijk = 6 not followed by ijk = 6 or 7 - will not assign threshold / overlap");
1012 break;
1013 }
1014 }
1015 }
1016 }
1017 } else {
1018 triggerHit = false;
1019 return;
1020 }
1021 ATH_MSG_VERBOSE("RPC trigger hit; ijk = "
1022 << rpcChan->ijk() << " threshold / overlap = " << threshold
1023 << "/" << overlap);
1024}
ubit16 thr() const
ubit16 ovl() const

◆ provideEmptyContainer()

StatusCode Muon::RpcRdoToPrepDataToolMT::provideEmptyContainer ( const EventContext & ctx) const
overridevirtual

Definition at line 151 of file RpcRdoToPrepDataToolMT.cxx.

151 {
152 State state{m_idHelperSvc.get()};
153 ATH_CHECK(loadProcessedChambers(ctx, state));
156 return StatusCode::SUCCESS;
157}

◆ transferAndRecordCoinData()

StatusCode Muon::RpcRdoToPrepDataToolMT::transferAndRecordCoinData ( const EventContext & ctx,
State & state ) const
protected

Stores the CoinData container into store gate.

Definition at line 190 of file RpcRdoToPrepDataToolMT.cxx.

190 {
192 return StatusCode::SUCCESS;
193 }
194
195 // Take localContainer and transfer contents to rpcCoinHandle
196 for (std::unique_ptr<RpcCoinDataCollection>& collection : state.rpcCoinDataCollections) {
197 if (!collection || collection->empty()) {
198 continue;
199 }
200 const IdentifierHash hash = collection->identifyHash();
201 // If not present, get a write lock for the hash and move collection
202 RpcCoinDataContainer::IDC_WriteHandle lock = state.coinDataCont->getWriteHandle(hash);
203 if (lock.alreadyPresent()) {
204 ATH_MSG_DEBUG("RpcCoinDataCollection already contained in IDC "
205 << m_idHelperSvc->toString(collection->identify()));
206 continue;
207 }
208 ATH_CHECK(lock.addOrDelete(std::move(collection)));
209 ATH_MSG_DEBUG("Coin hash " << hash << " has been moved to cache container");
210 }
211 state.rpcCoinDataCollections.clear();
212 if (msgLvl(MSG::DEBUG)) {
213 for (const auto [hash, ptr] : state.coinDataCont->GetAllHashPtrPair()) {
214 ATH_MSG_DEBUG("Contents of LOCAL in this view : " << hash);
215 }
216 }
217 SG::WriteHandle<RpcCoinDataContainer> rpcCoinHandle{
219 ATH_CHECK(rpcCoinHandle.record(std::move(state.coinDataCont)));
220
221 ATH_MSG_DEBUG("Created container " << m_rpcCoinDataContainerKey.key());
222 // For additional information on the contents of the cache-based container,
223 // this function can be used printMTCoinData (*rpcCoinHandle);
224
225 return StatusCode::SUCCESS;
226}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.

◆ transferAndRecordPrepData()

StatusCode Muon::RpcRdoToPrepDataToolMT::transferAndRecordPrepData ( const EventContext & ctx,
State & state ) const
protected

Stores the PrepData container into store gate.

Definition at line 159 of file RpcRdoToPrepDataToolMT.cxx.

159 {
160
161 for (std::unique_ptr<RpcPrepDataCollection>& collection : state.rpcPrepDataCollections) {
162 if (!collection || collection->empty()) {
163 continue;
164 }
165 const IdentifierHash hash = collection->identifyHash();
166 // If not present, get a write lock for the hash and move collection
167 RpcPrepDataContainer::IDC_WriteHandle lock = state.prepDataCont->getWriteHandle(hash);
168 if (lock.alreadyPresent()) {
169 ATH_MSG_DEBUG("RpcPrepDataCollection already contained in IDC "
170 << m_idHelperSvc->toString(collection->identify()));
171 continue;
172 }
173 ATH_CHECK(lock.addOrDelete(std::move(collection)));
174 ATH_MSG_DEBUG("PRD hash " << hash << " has been moved to cache container");
175 }
176 state.rpcPrepDataCollections.clear();
177
178 if (msgLvl(MSG::DEBUG)) {
179 for (const auto [hash, ptr] : state.prepDataCont->GetAllHashPtrPair()) {
180 ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash);
181 }
182 }
183 SG::WriteHandle rpcPRDHandle{m_rpcPrepDataContainerKey, ctx};
184 ATH_CHECK(rpcPRDHandle.record(std::move(state.prepDataCont)));
185 ATH_MSG_DEBUG("Created container " << m_rpcPrepDataContainerKey.key());
186
187 return StatusCode::SUCCESS;
188}

Member Data Documentation

◆ m_coindataContainerCacheKey

SG::UpdateHandleKey<RpcCoinDataCollection_Cache> Muon::RpcRdoToPrepDataToolMT::m_coindataContainerCacheKey
protected
Initial value:
{
this, "RpcCoinDataContainerCacheKey", "",
"Optional external cache for the RPC coin data container"}

Definition at line 175 of file RpcRdoToPrepDataToolMT.h.

175 {
176 this, "RpcCoinDataContainerCacheKey", "",
177 "Optional external cache for the RPC coin data container"};

◆ m_decodeData

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_decodeData
protected
Initial value:
{
this, "DecodeData",
true}

toggle on/off the decoding of RPC RDO into RpcPerpData

Definition at line 133 of file RpcRdoToPrepDataToolMT.h.

133 {
134 this, "DecodeData",
135 true};

◆ m_etaphi_coincidenceTime

Gaudi::Property<float> Muon::RpcRdoToPrepDataToolMT::m_etaphi_coincidenceTime
protected
Initial value:
{
this, "etaphi_coincidenceTime", 20., "time for phi*eta coincidence"}

3 ns is the resolution of the RPC readout electronics

Definition at line 117 of file RpcRdoToPrepDataToolMT.h.

117 {
118 this, "etaphi_coincidenceTime", 20., "time for phi*eta coincidence"};

◆ m_idHelperSvc

ServiceHandle<IMuonIdHelperSvc> Muon::RpcRdoToPrepDataToolMT::m_idHelperSvc
protected
Initial value:
{
this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 144 of file RpcRdoToPrepDataToolMT.h.

144 {
145 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_isMC

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_isMC {this, "isMC", false}
protected

Definition at line 138 of file RpcRdoToPrepDataToolMT.h.

138{this, "isMC", false};

◆ m_muDetMgrKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::RpcRdoToPrepDataToolMT::m_muDetMgrKey
protected
Initial value:
{
this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}

Definition at line 140 of file RpcRdoToPrepDataToolMT.h.

140 {
141 this, "DetectorManagerKey", "MuonDetectorManager",
142 "Key of input MuonDetectorManager condition data"};

◆ m_nRpcCablingKey

SG::ReadCondHandleKey<RpcCablingMap> Muon::RpcRdoToPrepDataToolMT::m_nRpcCablingKey
protected
Initial value:
{this, "NrpcCablingKey","MuonNRPC_CablingMap",
"Key of MuonNRPC_CablingMap"}

Definition at line 168 of file RpcRdoToPrepDataToolMT.h.

168 {this, "NrpcCablingKey","MuonNRPC_CablingMap",
169 "Key of MuonNRPC_CablingMap"};

◆ m_overlap_timeTolerance

Gaudi::Property<float> Muon::RpcRdoToPrepDataToolMT::m_overlap_timeTolerance
protected
Initial value:
{
this, "overlap_timeTolerance", 10.,
"tolerance of the timing calibration"}

Definition at line 120 of file RpcRdoToPrepDataToolMT.h.

120 {
121 this, "overlap_timeTolerance", 10.,
122 "tolerance of the timing calibration"};

◆ m_prdContainerCacheKey

SG::UpdateHandleKey<RpcPrepDataCollection_Cache> Muon::RpcRdoToPrepDataToolMT::m_prdContainerCacheKey
protected
Initial value:
{
this, "RpcPrdContainerCacheKey", "",
"Optional external cache for the RPC PRD container"}

This is the key for the cache for the MDT PRD containers, can be empty.

Definition at line 172 of file RpcRdoToPrepDataToolMT.h.

172 {
173 this, "RpcPrdContainerCacheKey", "",
174 "Optional external cache for the RPC PRD container"};

◆ m_producePRDfromTriggerWords

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_producePRDfromTriggerWords
protected
Initial value:
{
this, "produceRpcCoinDatafromTriggerWords", true,
"tore as prd the trigger hits"}

Definition at line 123 of file RpcRdoToPrepDataToolMT.h.

123 {
124 this, "produceRpcCoinDatafromTriggerWords", true,
125 "tore as prd the trigger hits"};

◆ m_rdoContainerKey

SG::ReadHandleKey<RpcPadContainer> Muon::RpcRdoToPrepDataToolMT::m_rdoContainerKey
protected
Initial value:
{this, "RDOContainer",
"RPCPAD"}

Definition at line 154 of file RpcRdoToPrepDataToolMT.h.

154 {this, "RDOContainer",
155 "RPCPAD"};

◆ m_rdoNrpcContainerKey

SG::ReadHandleKey<xAOD::NRPCRDOContainer> Muon::RpcRdoToPrepDataToolMT::m_rdoNrpcContainerKey
protected
Initial value:
{
this, "NrpcInputCollection", "NRPCRDO"}

Definition at line 157 of file RpcRdoToPrepDataToolMT.h.

157 {
158 this, "NrpcInputCollection", "NRPCRDO"};

◆ m_readKey

SG::ReadCondHandleKey<RpcCondDbData> Muon::RpcRdoToPrepDataToolMT::m_readKey
protected
Initial value:
{
this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"}

Definition at line 164 of file RpcRdoToPrepDataToolMT.h.

164 {
165 this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"};

◆ m_reduceCablingOverlap

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_reduceCablingOverlap
protected
Initial value:
{
this, "reduceCablingOverlap", true, "toggle on/off the overlap removal"}

Definition at line 129 of file RpcRdoToPrepDataToolMT.h.

129 {
130 this, "reduceCablingOverlap", true, "toggle on/off the overlap removal"};

◆ m_rpcCoinDataContainerKey

SG::WriteHandleKey<RpcCoinDataContainer> Muon::RpcRdoToPrepDataToolMT::m_rpcCoinDataContainerKey
protected
Initial value:
{
this, "TriggerOutputCollection", "RPC_triggerHits"}

RpcCoinData containers.

Definition at line 151 of file RpcRdoToPrepDataToolMT.h.

151 {
152 this, "TriggerOutputCollection", "RPC_triggerHits"};

◆ m_RPCInfoFromDb

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_RPCInfoFromDb {this, "RPCInfoFromDb", false}
protected

correct time prd from cool db

Definition at line 136 of file RpcRdoToPrepDataToolMT.h.

136{this, "RPCInfoFromDb", false};

◆ m_rpcPrepDataContainerKey

SG::WriteHandleKey<RpcPrepDataContainer> Muon::RpcRdoToPrepDataToolMT::m_rpcPrepDataContainerKey
protected
Initial value:
{
this, "OutputCollection", "RPC_Measurements"}

RpcPrepData containers.

Definition at line 148 of file RpcRdoToPrepDataToolMT.h.

148 {
149 this, "OutputCollection", "RPC_Measurements"};

◆ m_rpcRdoDecoderTool

ToolHandle<IRPC_RDO_Decoder> Muon::RpcRdoToPrepDataToolMT::m_rpcRdoDecoderTool
protected
Initial value:
{
this, "RdoDecoderTool", "Muon::RpcRDO_Decoder"}

Definition at line 161 of file RpcRdoToPrepDataToolMT.h.

161 {
162 this, "RdoDecoderTool", "Muon::RpcRDO_Decoder"};

◆ m_rpcReadKey

SG::ReadCondHandleKey<RpcCablingCondData> Muon::RpcRdoToPrepDataToolMT::m_rpcReadKey
protected
Initial value:
{
this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"}

Definition at line 166 of file RpcRdoToPrepDataToolMT.h.

166 {
167 this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"};

◆ m_solvePhiAmbiguities

Gaudi::Property<bool> Muon::RpcRdoToPrepDataToolMT::m_solvePhiAmbiguities
protected
Initial value:
{
this, "solvePhiAmbiguities", true,
"toggle on/off the removal of phi ambiguities"}

Definition at line 126 of file RpcRdoToPrepDataToolMT.h.

126 {
127 this, "solvePhiAmbiguities", true,
128 "toggle on/off the removal of phi ambiguities"};

◆ m_spuriousHitCounter

std::atomic_int Muon::RpcRdoToPrepDataToolMT::m_spuriousHitCounter
mutableprivate

Definition at line 183 of file RpcRdoToPrepDataToolMT.h.

◆ m_stripTimeResolution

Gaudi::Property<double> Muon::RpcRdoToPrepDataToolMT::m_stripTimeResolution
protected
Initial value:
{this, "timeResolution", 0.6 * Gaudi::Units::nanosecond,
"Estimated time resolution of the strip readout"}

Definition at line 179 of file RpcRdoToPrepDataToolMT.h.

179 {this, "timeResolution", 0.6 * Gaudi::Units::nanosecond,
180 "Estimated time resolution of the strip readout"};

◆ m_timeShift

Gaudi::Property<float> Muon::RpcRdoToPrepDataToolMT::m_timeShift
protected
Initial value:
{this, "timeShift", -12.5,
"any global time shift ?!"}

Definition at line 131 of file RpcRdoToPrepDataToolMT.h.

131 {this, "timeShift", -12.5,
132 "any global time shift ?!"};

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