ATLAS Offline Software
RpcRdoToPrepDataToolMT.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLMT_H
6 #define MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLMT_H
7 
8 #include <set>
9 #include <string>
10 
12 #include "GaudiKernel/ServiceHandle.h"
13 #include "GaudiKernel/ToolHandle.h"
20 #include "MuonRDO/RpcCoinMatrix.h"
31 namespace Muon {
32 
34 
36  : public extends<AthAlgTool, IMuonRdoToPrepDataTool> {
37  public:
38  RpcRdoToPrepDataToolMT(const std::string&, const std::string&,
39  const IInterface*);
40 
41  // setup/teardown functions, similar like those for Algorithm/Service
42  virtual StatusCode initialize() override;
43 
44  virtual StatusCode decode(const EventContext& ctx,
45  const std::vector<IdentifierHash>& idVect) const override;
46 
47  virtual StatusCode decode(const EventContext& ctx,
48  const std::vector<uint32_t>& robIds) const override;
49  virtual StatusCode provideEmptyContainer(const EventContext& ctx) const override;
50 
51  protected:
52  struct State {
53  State(const IMuonIdHelperSvc* idHelperSvc);
54 
57 
58 
60 
61  std::vector<std::unique_ptr<Muon::RpcPrepDataCollection>> rpcPrepDataCollections{};
62  std::vector<std::unique_ptr<Muon::RpcCoinDataCollection>> rpcCoinDataCollections{};
63 
65  std::unique_ptr<Muon::RpcPrepDataContainer> prepDataCont{nullptr};
67  std::unique_ptr<Muon::RpcCoinDataContainer> coinDataCont{nullptr};
68 
69 
70  // keepTrackOfFullEventDecoding
71  bool m_fullEventDone{false};
72 
73  // the set of already requested and decoded offline (PrepRawData)
74  // collections
75  std::unordered_set<IdentifierHash> m_decodedOfflineHashIds{};
76 
77  // the set of unrequested collections with phi hits stored with
78  // ambiguityFlag > 1
79  std::unordered_set<IdentifierHash> m_ambiguousCollections{};
80 
81  // the set of already requested and decoded ROBs
82  std::unordered_set<uint32_t> m_decodedRobIds{};
83  };
84 
86  StatusCode transferAndRecordPrepData(const EventContext& ctx,
87  State& state) const;
89  StatusCode transferAndRecordCoinData(const EventContext& ctx,
90  State& state) const;
92  StatusCode loadProcessedChambers(const EventContext& ctx, State& state) const;
93 
94  void printMTPrepData(const Muon::RpcPrepDataContainer& prepData) const;
95  void printMTCoinData(const Muon::RpcCoinDataContainer& prepData) const;
96 
97  // decoding method
98  StatusCode decodeImpl(const EventContext& ctx, State& state,
99  const std::vector<IdentifierHash>& idVect,
100  bool firstTimeInTheEvent) const;
101  StatusCode decodeImpl(const EventContext& ctx, State& state,
102  const std::vector<uint32_t>& robIds,
103  bool firstTimeInTheEvent) const;
104 
105  StatusCode processPad(const EventContext& ctx, State& state,
106  const RpcPad* rdoColl, bool& processingetaview,
107  bool& processingphiview, int& nPrepRawData,
108  const std::vector<IdentifierHash>& idVect,
109  bool doingSecondLoopAmbigColls) const;
110 
113  bool highptpad, // these are inputs
114  bool& triggerHit, unsigned short& threshold,
115  unsigned short& overlap, bool& toSkip) const;
116 
117  StatusCode processNrpcRdo(const EventContext& ctx, State& state) const;
118 
119 
120 
122  Gaudi::Property<float> m_etaphi_coincidenceTime{
123  this, "etaphi_coincidenceTime", 20., "time for phi*eta coincidence"};
125  Gaudi::Property<float> m_overlap_timeTolerance{
126  this, "overlap_timeTolerance", 10.,
127  "tolerance of the timing calibration"};
128  Gaudi::Property<bool> m_producePRDfromTriggerWords{
129  this, "produceRpcCoinDatafromTriggerWords", true,
130  "tore as prd the trigger hits"};
131  Gaudi::Property<bool> m_solvePhiAmbiguities{
132  this, "solvePhiAmbiguities", true,
133  "toggle on/off the removal of phi ambiguities"};
134  Gaudi::Property<bool> m_reduceCablingOverlap{
135  this, "reduceCablingOverlap", true, "toggle on/off the overlap removal"};
136  Gaudi::Property<float> m_timeShift{this, "timeShift", -12.5,
137  "any global time shift ?!"};
138  Gaudi::Property<bool> m_decodeData{
139  this, "DecodeData",
140  true};
141  Gaudi::Property<bool> m_RPCInfoFromDb{
142  this, "RPCInfoFromDb", false};
143  // end of configurable options
144 
146  this, "DetectorManagerKey", "MuonDetectorManager",
147  "Key of input MuonDetectorManager condition data"};
148 
150  this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
151 
154  this, "OutputCollection", "RPC_Measurements"};
157  this, "TriggerOutputCollection", "RPC_triggerHits"};
158 
160  "RPCPAD"};
161 
163  this, "NrpcInputCollection", "NRPCRDO"};
164 
165  // Rob Data Provider handle
166  ToolHandle<Muon::IRPC_RDO_Decoder> m_rpcRdoDecoderTool{
167  this, "RdoDecoderTool", "Muon::RpcRDO_Decoder"};
168 
170  this, "ReadKey", "RpcCondDbData", "Key of RpcCondDbData"};
172  this, "RpcCablingKey", "RpcCablingCondData", "Key of RpcCablingCondData"};
174  "EventInfo", "event info key"};
176  this, "NrpcCablingKey", "MuonNRPC_CablingMap",
177  "Key of MuonNRPC_CablingMap"};
178 
181  this, "RpcPrdContainerCacheKey", "",
182  "Optional external cache for the RPC PRD container"};
184  this, "RpcCoinDataContainerCacheKey", "",
185  "Optional external cache for the RPC coin data container"};
186 
188  this, "xAODKey", "",
189  "If empty, do not produce xAOD, otherwise this is the key of the output "
190  "xAOD MDT PRD container"};
191 
192  Gaudi::Property<double> m_stripTimeResolution{this, "timeResolution", 0.6 * Gaudi::Units::nanosecond,
193  "Estimated time resolution of the strip readout"};
194 };
195 } // namespace Muon
196 
197 #endif // !ATHEXJOBOPTIONS_CONCRETETOOL_H
Muon::RpcRdoToPrepDataToolMT::m_rpcCoinDataContainerKey
SG::WriteHandleKey< Muon::RpcCoinDataContainer > m_rpcCoinDataContainerKey
RpcCoinData containers.
Definition: RpcRdoToPrepDataToolMT.h:156
IRPC_RDO_Decoder.h
RpcCoinDataContainer.h
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
Muon::RpcRdoToPrepDataToolMT::State::rpcPrepDataCollections
std::vector< std::unique_ptr< Muon::RpcPrepDataCollection > > rpcPrepDataCollections
Definition: RpcRdoToPrepDataToolMT.h:61
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:134
MuonPrepDataCollection_Cache.h
SG::UpdateHandleKey
Property holding a SG store/key/clid from which an UpdateHandle is made.
Definition: UpdateHandleKey.h:40
python.SystemOfUnits.nanosecond
int nanosecond
Definition: SystemOfUnits.py:119
RpcCondDbData.h
Muon::RpcRdoToPrepDataToolMT::provideEmptyContainer
virtual StatusCode provideEmptyContainer(const EventContext &ctx) const override
Definition: RpcRdoToPrepDataToolMT.cxx:168
Muon::RpcRdoToPrepDataToolMT::State::m_fullEventDone
bool m_fullEventDone
Definition: RpcRdoToPrepDataToolMT.h:71
RpcCablingMap.h
Muon::RpcRdoToPrepDataToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: RpcRdoToPrepDataToolMT.h:149
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:597
Muon::MuonCoinDataCollection
Definition: MuonCoinDataCollection.h:25
Muon::RpcRdoToPrepDataToolMT::initialize
virtual StatusCode initialize() override
Definition: RpcRdoToPrepDataToolMT.cxx:54
Muon::RpcRdoToPrepDataToolMT::m_stripTimeResolution
Gaudi::Property< double > m_stripTimeResolution
Definition: RpcRdoToPrepDataToolMT.h:192
Muon::RpcRdoToPrepDataToolMT::printMTCoinData
void printMTCoinData(const Muon::RpcCoinDataContainer &prepData) const
checkFileSG.toSkip
def toSkip(inpName)
Definition: checkFileSG.py:22
Muon::RpcRdoToPrepDataToolMT::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: RpcRdoToPrepDataToolMT.h:173
Muon::RpcRdoToPrepDataToolMT::m_rdoNrpcContainerKey
SG::ReadHandleKey< xAOD::NRPCRDOContainer > m_rdoNrpcContainerKey
Definition: RpcRdoToPrepDataToolMT.h:162
Muon::RpcRdoToPrepDataToolMT::m_RPCInfoFromDb
Gaudi::Property< bool > m_RPCInfoFromDb
correct time prd from cool db
Definition: RpcRdoToPrepDataToolMT.h:141
Muon::RpcRdoToPrepDataToolMT
Definition: RpcRdoToPrepDataToolMT.h:36
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:134
Muon::RpcRdoToPrepDataToolMT::State::m_idHelperSvc
const IMuonIdHelperSvc * m_idHelperSvc
Definition: RpcRdoToPrepDataToolMT.h:59
MuonPrepDataContainer.h
SG::ReadHandleKey< RpcPadContainer >
Muon::RpcRdoToPrepDataToolMT::State::getPrepCollection
Muon::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
Muon::RpcRdoToPrepDataToolMT::State::coinDataCont
std::unique_ptr< Muon::RpcCoinDataContainer > coinDataCont
Pointer of the coin container stored in store gate.
Definition: RpcRdoToPrepDataToolMT.h:67
Muon::RpcRdoToPrepDataToolMT::decodeImpl
StatusCode decodeImpl(const EventContext &ctx, State &state, const std::vector< IdentifierHash > &idVect, bool firstTimeInTheEvent) const
Definition: RpcRdoToPrepDataToolMT.cxx:277
Muon::RpcRdoToPrepDataToolMT::m_xAODKey
SG::WriteHandleKey< xAOD::RpcStripContainer > m_xAODKey
Definition: RpcRdoToPrepDataToolMT.h:187
RpcStripContainer.h
Muon::RpcRdoToPrepDataToolMT::printMTPrepData
void printMTPrepData(const Muon::RpcPrepDataContainer &prepData) const
Muon::RpcRdoToPrepDataToolMT::m_coindataContainerCacheKey
SG::UpdateHandleKey< RpcCoinDataCollection_Cache > m_coindataContainerCacheKey
Definition: RpcRdoToPrepDataToolMT.h:183
Muon::RpcRdoToPrepDataToolMT::m_timeShift
Gaudi::Property< float > m_timeShift
Definition: RpcRdoToPrepDataToolMT.h:136
Muon::RpcRdoToPrepDataToolMT::m_rpcReadKey
SG::ReadCondHandleKey< RpcCablingCondData > m_rpcReadKey
Definition: RpcRdoToPrepDataToolMT.h:171
Muon::RpcRdoToPrepDataToolMT::RpcRdoToPrepDataToolMT
RpcRdoToPrepDataToolMT(const std::string &, const std::string &, const IInterface *)
Definition: RpcRdoToPrepDataToolMT.cxx:48
Muon::RpcRdoToPrepDataToolMT::State
Definition: RpcRdoToPrepDataToolMT.h:52
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
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:180
Muon::RpcRdoToPrepDataToolMT::State::m_decodedRobIds
std::unordered_set< uint32_t > m_decodedRobIds
Definition: RpcRdoToPrepDataToolMT.h:82
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:1188
IMuonRdoToPrepDataTool.h
Muon::RpcRdoToPrepDataToolMT::State::rpcCoinDataCollections
std::vector< std::unique_ptr< Muon::RpcCoinDataCollection > > rpcCoinDataCollections
Definition: RpcRdoToPrepDataToolMT.h:62
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::RpcRdoToPrepDataToolMT::State::State
State(const IMuonIdHelperSvc *idHelperSvc)
Definition: RpcRdoToPrepDataToolMT.cxx:21
MuonTrigCoinData_Cache.h
MuonR4::State
CalibratedSpacePoint::State State
Definition: SpacePointCalibrator.cxx:24
AthAlgTool.h
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
Muon::RpcRdoToPrepDataToolMT::m_rpcPrepDataContainerKey
SG::WriteHandleKey< Muon::RpcPrepDataContainer > m_rpcPrepDataContainerKey
RpcPrepData containers.
Definition: RpcRdoToPrepDataToolMT.h:153
Muon::RpcRdoToPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: RpcRdoToPrepDataToolMT.h:145
ReadCondHandleKey.h
Muon::RpcRdoToPrepDataToolMT::State::prepDataCont
std::unique_ptr< Muon::RpcPrepDataContainer > prepDataCont
Pointer of the prep container stored in store gate.
Definition: RpcRdoToPrepDataToolMT.h:65
Muon::RpcRdoToPrepDataToolMT::transferAndRecordPrepData
StatusCode transferAndRecordPrepData(const EventContext &ctx, State &state) const
Stores the PrepData container into store gate.
Definition: RpcRdoToPrepDataToolMT.cxx:176
Muon::MuonCoinDataContainer
Definition: MuonCoinDataContainer.h:32
Muon::RpcRdoToPrepDataToolMT::m_readKey
SG::ReadCondHandleKey< RpcCondDbData > m_readKey
Definition: RpcRdoToPrepDataToolMT.h:169
Muon::RpcRdoToPrepDataToolMT::m_etaphi_coincidenceTime
Gaudi::Property< float > m_etaphi_coincidenceTime
3 ns is the resolution of the RPC readout electronics
Definition: RpcRdoToPrepDataToolMT.h:122
Muon::RpcRdoToPrepDataToolMT::transferAndRecordCoinData
StatusCode transferAndRecordCoinData(const EventContext &ctx, State &state) const
Stores the CoinData container into store gate.
Definition: RpcRdoToPrepDataToolMT.cxx:237
Muon::RpcRdoToPrepDataToolMT::State::m_ambiguousCollections
std::unordered_set< IdentifierHash > m_ambiguousCollections
Definition: RpcRdoToPrepDataToolMT.h:79
Muon::RpcRdoToPrepDataToolMT::m_producePRDfromTriggerWords
Gaudi::Property< bool > m_producePRDfromTriggerWords
Definition: RpcRdoToPrepDataToolMT.h:128
threshold
Definition: chainparser.cxx:74
Muon::RpcRdoToPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of RPC RDO into RpcPerpData
Definition: RpcRdoToPrepDataToolMT.h:138
RpcPad
Definition: RpcPad.h:21
MuonDetectorManager.h
EventInfo.h
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager >
Muon::RpcRdoToPrepDataToolMT::m_overlap_timeTolerance
Gaudi::Property< float > m_overlap_timeTolerance
Definition: RpcRdoToPrepDataToolMT.h:125
RpcCablingCondData.h
Muon::RpcRdoToPrepDataToolMT::State::getCoinCollection
Muon::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:92
RpcPadContainer.h
Muon::RpcRdoToPrepDataToolMT::m_rpcRdoDecoderTool
ToolHandle< Muon::IRPC_RDO_Decoder > m_rpcRdoDecoderTool
Definition: RpcRdoToPrepDataToolMT.h:166
Muon::RpcRdoToPrepDataToolMT::State::m_decodedOfflineHashIds
std::unordered_set< IdentifierHash > m_decodedOfflineHashIds
Definition: RpcRdoToPrepDataToolMT.h:75
Muon::RpcRdoToPrepDataToolMT::m_nRpcCablingKey
SG::ReadCondHandleKey< RpcCablingMap > m_nRpcCablingKey
Definition: RpcRdoToPrepDataToolMT.h:175
Muon::RpcRdoToPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< RpcPadContainer > m_rdoContainerKey
Definition: RpcRdoToPrepDataToolMT.h:159
Muon::RpcRdoToPrepDataToolMT::processNrpcRdo
StatusCode processNrpcRdo(const EventContext &ctx, State &state) const
15 ns should be the max.diff.
Definition: RpcRdoToPrepDataToolMT.cxx:1100
Muon::RpcRdoToPrepDataToolMT::m_solvePhiAmbiguities
Gaudi::Property< bool > m_solvePhiAmbiguities
Definition: RpcRdoToPrepDataToolMT.h:131
IMuonIdHelperSvc.h
RpcCoinMatrix.h
NRPCRDOContainer.h
ServiceHandle< Muon::IMuonIdHelperSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14