ATLAS Offline Software
MdtRdoToPrepDataToolMT.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 MUONMdtRdoToPrepDataToolMT_H
6 #define MUONMdtRdoToPrepDataToolMT_H
7 
8 
12 
14 
19 
22 
26 
29 
32 
33 class MdtDigit;
34 
35 namespace Muon {
40  class MdtRdoToPrepDataToolMT : public extends<AthAlgTool, IMuonRdoToPrepDataTool> {
41  public:
42  MdtRdoToPrepDataToolMT(const std::string&, const std::string&, const IInterface*);
43 
45  virtual ~MdtRdoToPrepDataToolMT() = default;
46 
48  virtual StatusCode initialize() override;
49 
51  virtual StatusCode decode(const EventContext& ctx, const std::vector<IdentifierHash>& idVect) const override;
52  virtual StatusCode provideEmptyContainer(const EventContext& ctx) const override;
53  // new decode method for Rob based readout
54  virtual StatusCode decode(const EventContext& ctx, const std::vector<uint32_t>& robIds) const override;
55 
56  protected:
57  void printPrepDataImpl(const Muon::MdtPrepDataContainer* mdtPrepDataContainer) const;
58 
60  Muon::MdtDriftCircleStatus getMdtTwinPosition(const MdtDigit& prompt_digit, const MdtDigit& twin_digit, double& radius,
61  double& errRadius, double& zTwin, double& errZTwin, bool& twinIsPrompt) const;
62 
63 
65  struct ConvCache {
66  ConvCache(const Muon::IMuonIdHelperSvc* idHelperSvc);
72  StatusCode finalize(MsgStream& msg);
73 
77 
84  const ActsGeometryContext* gctx{nullptr};
86  const TwinTubeMap* twinTubeMap{nullptr};
87 
89  bool isValid{false};
90  std::vector<std::unique_ptr<MdtPrepDataCollection>> addedCols{};
91  };
92 
93  StatusCode processCsm(const EventContext& ctx, ConvCache& mdtPrepDataContainer,
94  const MdtCsm* rdoColl) const;
95 
96  StatusCode processCsmTwin(const EventContext& ctx,
97  ConvCache& mdtPrepDataContainer,
98  const MdtCsm* rdoColll) const;
99 
101  std::unique_ptr<MdtPrepData> createPrepData(const MdtCalibInput& calibInput,
102  const MdtCalibOutput& calibOutput,
103  ConvCache& cache) const;
105  ConvCache setupMdtPrepDataContainer(const EventContext& ctx) const;
106 
108  const MdtCsmContainer* getRdoContainer(const EventContext& ctx) const;
109 
110  void processPRDHashes(const EventContext& ctx, ConvCache& mdtPrepDataContainer,
111  const std::vector<IdentifierHash>& chamberHashInRobs) const;
112 
113  bool handlePRDHash(const EventContext& ctx, ConvCache& mdtPrepDataContainer,
114  IdentifierHash rdoHash) const;
115 
116  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
117 
119  ToolHandle<IMdtCalibrationTool> m_calibrationTool{this, "CalibrationTool", "MdtCalibrationTool"};
120 
121 
122  Gaudi::Property<bool> m_useNewGeo{this, "UseR4DetMgr", false,
123  "Switch between the legacy and the new geometry"};
124 
126  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "Stored alignment"};
127 
128 
130  SG::WriteHandleKey<Muon::MdtPrepDataContainer> m_mdtPrepDataContainerKey{this, "OutputCollection", "MDT_DriftCircles"};
131 
132  SG::ReadHandleKey<MdtCsmContainer> m_rdoContainerKey{this, "RDOContainer", "MDTCSM"};
133 
134 
136  Gaudi::Property<int> m_adcCut{this, "AdcCut", 50,
137  "Minimal cut on the adc to convert it into a prepdata object"};
138  Gaudi::Property<bool> m_calibratePrepData{this, "CalibratePrepData", true};
139  Gaudi::Property<bool> m_decodeData{this, "DecodeData", true};
140  bool m_sortPrepData = false;
141 
142  ToolHandle<Muon::IMDT_RDO_Decoder> m_mdtDecoder{this, "Decoder", "Muon::MdtRDO_Decoder/MdtRDO_Decoder"};
143 
144  bool m_BMGpresent{false};
145  int m_BMGid{-1};
146 
147  // + TWIN TUBE
148  Gaudi::Property<bool> m_useTwin{this, "UseTwin", true};
149  Gaudi::Property<bool> m_discardSecondaryHitTwin{this, "DiscardSecondaryHitTwin", false};
150 
151  // - TWIN TUBE
152  SG::ReadCondHandleKey<TwinTubeMap> m_twinTubeKey{this, "TwinTubeKey", "MdtTwinTubeMap"};
153 
154  std::unordered_set<Identifier> m_DeadChannels{};
155  void initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl);
156 
157  SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"};
158 
159  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey{this, "DetectorManagerKey", "MuonDetectorManager",
160  "Key of input MuonDetectorManager condition data"};
163  "Optional external cache for the MDT PRD container"};
164 
165  // xAOD PRDs
166  SG::WriteHandleKey<xAOD::MdtDriftCircleContainer> m_xAODKey{this, "xAODKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};
167  SG::WriteHandleKey<xAOD::MdtTwinDriftCircleContainer> m_xAODTwinKey{this, "xAODTwinKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};
168 
169  };
170 } // namespace Muon
171 
172 #endif
Muon::MdtRdoToPrepDataToolMT::m_useNewGeo
Gaudi::Property< bool > m_useNewGeo
Definition: MdtRdoToPrepDataToolMT.h:122
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
Muon::MdtRdoToPrepDataToolMT::ConvCache::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: MdtRdoToPrepDataToolMT.h:78
MuonPrepDataCollection_Cache.h
SG::UpdateHandleKey
Property holding a SG store/key/clid from which an UpdateHandle is made.
Definition: UpdateHandleKey.h:40
MuonGMR4::MuonDetectorManager
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:62
MdtCalibInput
Definition: MdtCalibInput.h:35
MdtDigit
Definition: MdtDigit.h:19
Muon::MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT
MdtRdoToPrepDataToolMT(const std::string &, const std::string &, const IInterface *)
Definition: MdtRdoToPrepDataToolMT.cxx:144
Muon::MdtRdoToPrepDataToolMT::createPrepData
std::unique_ptr< MdtPrepData > createPrepData(const MdtCalibInput &calibInput, const MdtCalibOutput &calibOutput, ConvCache &cache) const
Creates the PRD object.
Definition: MdtRdoToPrepDataToolMT.cxx:290
IMdtCalibrationTool.h
Muon::MdtRdoToPrepDataToolMT::m_twinTubeKey
SG::ReadCondHandleKey< TwinTubeMap > m_twinTubeKey
Definition: MdtRdoToPrepDataToolMT.h:152
IMuonRawDataProviderTool.h
Muon::MdtRdoToPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< MdtCsmContainer > m_rdoContainerKey
Definition: MdtRdoToPrepDataToolMT.h:132
Muon::MdtDriftCircleStatus
MdtDriftCircleStatus
Enum to represent the 'status' of Mdt measurements e.g.
Definition: MdtDriftCircleStatus.h:25
Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODPrd
xAOD::MdtDriftCircleContainer * xAODPrd
Definition: MdtRdoToPrepDataToolMT.h:75
Muon::MdtRdoToPrepDataToolMT::provideEmptyContainer
virtual StatusCode provideEmptyContainer(const EventContext &ctx) const override
Definition: MdtRdoToPrepDataToolMT.cxx:224
Muon::MdtRdoToPrepDataToolMT::ConvCache::r4DetMgr
const MuonGMR4::MuonDetectorManager * r4DetMgr
Detector manger from R4.
Definition: MdtRdoToPrepDataToolMT.h:82
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition: MdtCsmContainer.h:22
MuonPrepDataContainer.h
SG::ReadHandleKey< ActsGeometryContext >
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition: MdtCsm.h:19
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
MdtCsmContainer.h
Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODTwinPrd
xAOD::MdtTwinDriftCircleContainer * xAODTwinPrd
Definition: MdtRdoToPrepDataToolMT.h:76
Muon::MdtRdoToPrepDataToolMT::m_adcCut
Gaudi::Property< int > m_adcCut
member variables for algorithm properties:
Definition: MdtRdoToPrepDataToolMT.h:136
Muon::MdtRdoToPrepDataToolMT::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: MdtRdoToPrepDataToolMT.h:126
Muon::MdtRdoToPrepDataToolMT::processCsm
StatusCode processCsm(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColl) const
Definition: MdtRdoToPrepDataToolMT.cxx:329
Muon::MdtRdoToPrepDataToolMT::m_sortPrepData
bool m_sortPrepData
Toggle on/off the sorting of the MdtPrepData.
Definition: MdtRdoToPrepDataToolMT.h:140
Muon::MdtRdoToPrepDataToolMT::m_mdtPrepDataContainerKey
SG::WriteHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepDataContainerKey
MdtPrepRawData containers.
Definition: MdtRdoToPrepDataToolMT.h:130
Muon::MdtRdoToPrepDataToolMT::decode
virtual StatusCode decode(const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
Decode method - declared in Muon::IMuonRdoToPrepDataTool.
Definition: MdtRdoToPrepDataToolMT.cxx:256
Muon::MdtRdoToPrepDataToolMT::m_calibratePrepData
Gaudi::Property< bool > m_calibratePrepData
toggle on/off calibration of MdtPrepData
Definition: MdtRdoToPrepDataToolMT.h:138
Muon::MdtRdoToPrepDataToolMT::~MdtRdoToPrepDataToolMT
virtual ~MdtRdoToPrepDataToolMT()=default
default destructor
IMDT_RDO_Decoder.h
Muon::MdtRdoToPrepDataToolMT::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: MdtRdoToPrepDataToolMT.cxx:147
MdtTwinDriftCircleContainer.h
Muon::MdtRdoToPrepDataToolMT::m_detMgrR4
const MuonGMR4::MuonDetectorManager * m_detMgrR4
Definition: MdtRdoToPrepDataToolMT.h:125
Muon::MdtRdoToPrepDataToolMT::m_useTwin
Gaudi::Property< bool > m_useTwin
Definition: MdtRdoToPrepDataToolMT.h:148
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
Muon::MdtRdoToPrepDataToolMT::setupMdtPrepDataContainer
ConvCache setupMdtPrepDataContainer(const EventContext &ctx) const
Creates the prep data container to be written.
Definition: MdtRdoToPrepDataToolMT.cxx:559
Muon::MdtRdoToPrepDataToolMT::processCsmTwin
StatusCode processCsmTwin(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColll) const
Definition: MdtRdoToPrepDataToolMT.cxx:401
IMuonRdoToPrepDataTool.h
Muon::TwinTubeMap
Definition: TwinTubeMap.h:16
MuonMDT_CablingMap.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Muon::MdtRdoToPrepDataToolMT::m_BMGpresent
bool m_BMGpresent
Definition: MdtRdoToPrepDataToolMT.h:144
MuonDetectorManager.h
Muon::MdtRdoToPrepDataToolMT::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition: MdtRdoToPrepDataToolMT.h:157
Muon::MdtRdoToPrepDataToolMT::initDeadChannels
void initDeadChannels(const MuonGM::MdtReadoutElement *mydetEl)
Definition: MdtRdoToPrepDataToolMT.cxx:528
Muon::MdtRdoToPrepDataToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtRdoToPrepDataToolMT.h:116
Muon::MdtRdoToPrepDataToolMT::getRdoContainer
const MdtCsmContainer * getRdoContainer(const EventContext &ctx) const
Loads the input RDO container from StoreGate.
Definition: MdtRdoToPrepDataToolMT.cxx:214
Muon::MdtRdoToPrepDataToolMT
Definition: MdtRdoToPrepDataToolMT.h:40
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
MdtCalibOutput
Definition: MdtCalibOutput.h:10
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
ReadCondHandleKey.h
Muon::MdtRdoToPrepDataToolMT::ConvCache::gctx
const ActsGeometryContext * gctx
Acts Geometry context.
Definition: MdtRdoToPrepDataToolMT.h:84
MdtDriftCircleContainer.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
Muon::MdtRdoToPrepDataToolMT::m_discardSecondaryHitTwin
Gaudi::Property< bool > m_discardSecondaryHitTwin
Definition: MdtRdoToPrepDataToolMT.h:149
Muon::MdtRdoToPrepDataToolMT::getMdtTwinPosition
Muon::MdtDriftCircleStatus getMdtTwinPosition(const MdtDigit &prompt_digit, const MdtDigit &twin_digit, double &radius, double &errRadius, double &zTwin, double &errZTwin, bool &twinIsPrompt) const
method to get the twin tube 2nd coordinate
Muon::MdtRdoToPrepDataToolMT::ConvCache::addedCols
std::vector< std::unique_ptr< MdtPrepDataCollection > > addedCols
Definition: MdtRdoToPrepDataToolMT.h:90
Muon::MdtRdoToPrepDataToolMT::ConvCache::ConvCache
ConvCache(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition: MdtRdoToPrepDataToolMT.cxx:52
Muon::MdtRdoToPrepDataToolMT::handlePRDHash
bool handlePRDHash(const EventContext &ctx, ConvCache &mdtPrepDataContainer, IdentifierHash rdoHash) const
Definition: MdtRdoToPrepDataToolMT.cxx:235
Muon::MdtRdoToPrepDataToolMT::ConvCache::finalize
StatusCode finalize(MsgStream &msg)
Copy the non-empty collections into the created prd container.
Definition: MdtRdoToPrepDataToolMT.cxx:68
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
MuonDetectorManager.h
Muon::MdtRdoToPrepDataToolMT::m_BMGid
int m_BMGid
Definition: MdtRdoToPrepDataToolMT.h:145
SG::ReadCondHandleKey
Definition: ReadCondHandleKey.h:20
Muon::MdtRdoToPrepDataToolMT::ConvCache::twinTubeMap
const TwinTubeMap * twinTubeMap
Pointer to the map having the mapping of twin tube pairs.
Definition: MdtRdoToPrepDataToolMT.h:86
Muon::MdtRdoToPrepDataToolMT::ConvCache
Helper struct to parse the event data around the tool.
Definition: MdtRdoToPrepDataToolMT.h:65
Muon::MdtRdoToPrepDataToolMT::printPrepDataImpl
void printPrepDataImpl(const Muon::MdtPrepDataContainer *mdtPrepDataContainer) const
Muon::MdtRdoToPrepDataToolMT::ConvCache::isValid
bool isValid
Flag set to indicate that the complete validation was successful.
Definition: MdtRdoToPrepDataToolMT.h:89
Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyPrd
Muon::MdtPrepDataContainer * legacyPrd
Definition: MdtRdoToPrepDataToolMT.h:74
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:26
Muon::MdtRdoToPrepDataToolMT::m_calibrationTool
ToolHandle< IMdtCalibrationTool > m_calibrationTool
MDT calibration service.
Definition: MdtRdoToPrepDataToolMT.h:119
Muon::MdtRdoToPrepDataToolMT::processPRDHashes
void processPRDHashes(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const std::vector< IdentifierHash > &chamberHashInRobs) const
Definition: MdtRdoToPrepDataToolMT.cxx:228
TwinTubeMap.h
Muon::MdtRdoToPrepDataToolMT::ConvCache::createCollection
MdtPrepDataCollection * createCollection(const Identifier &id)
Creates a new MdtPrepDataCollection, if it's neccessary and also possible.
Definition: MdtRdoToPrepDataToolMT.cxx:57
Muon::MdtRdoToPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of MDT RDO into MdtPrepData
Definition: MdtRdoToPrepDataToolMT.h:139
Muon::MdtRdoToPrepDataToolMT::m_mdtDecoder
ToolHandle< Muon::IMDT_RDO_Decoder > m_mdtDecoder
Definition: MdtRdoToPrepDataToolMT.h:142
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Muon::MdtRdoToPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: MdtRdoToPrepDataToolMT.h:159
Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyDetMgr
const MuonGM::MuonDetectorManager * legacyDetMgr
Detector manager from the conditions store.
Definition: MdtRdoToPrepDataToolMT.h:80
IMuonIdHelperSvc.h
Muon::MdtRdoToPrepDataToolMT::m_prdContainerCacheKey
SG::UpdateHandleKey< MdtPrepDataCollection_Cache > m_prdContainerCacheKey
This is the key for the cache for the MDT PRD containers, can be empty.
Definition: MdtRdoToPrepDataToolMT.h:162
Muon::MdtRdoToPrepDataToolMT::m_xAODTwinKey
SG::WriteHandleKey< xAOD::MdtTwinDriftCircleContainer > m_xAODTwinKey
Definition: MdtRdoToPrepDataToolMT.h:167
ServiceHandle< Muon::IMuonIdHelperSvc >
Muon::MdtRdoToPrepDataToolMT::m_DeadChannels
std::unordered_set< Identifier > m_DeadChannels
Definition: MdtRdoToPrepDataToolMT.h:154
Muon::MdtRdoToPrepDataToolMT::m_xAODKey
SG::WriteHandleKey< xAOD::MdtDriftCircleContainer > m_xAODKey
Definition: MdtRdoToPrepDataToolMT.h:166
Identifier
Definition: IdentifierFieldParser.cxx:14