ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MdtRdoToPrepDataToolMT::ConvCache Struct Reference

Helper struct to parse the event data around the tool. More...

#include <MdtRdoToPrepDataToolMT.h>

Collaboration diagram for Muon::MdtRdoToPrepDataToolMT::ConvCache:

Public Member Functions

 ConvCache (const Muon::IMuonIdHelperSvc *idHelperSvc)
MdtPrepDataCollectioncreateCollection (const Identifier &id)
 Creates a new MdtPrepDataCollection, if it's neccessary and also possible.
StatusCode finalize (MsgStream &msg)
 Copy the non-empty collections into the created prd container.

Public Attributes

Muon::MdtPrepDataContainerlegacyPrd {nullptr}
xAOD::MdtDriftCircleContainerxAODPrd {nullptr}
xAOD::MdtTwinDriftCircleContainerxAODTwinPrd {nullptr}
const Muon::IMuonIdHelperSvcm_idHelperSvc {nullptr}
const MuonGM::MuonDetectorManagerlegacyDetMgr {nullptr}
 Detector manager from the conditions store.
const MuonGMR4::MuonDetectorManagerr4DetMgr {nullptr}
 Detector manger from R4.
const ActsTrk::GeometryContextgctx {nullptr}
 Acts Geometry context.
const TwinTubeMaptwinTubeMap {nullptr}
 Pointer to the map having the mapping of twin tube pairs.
bool isValid {false}
 Flag set to indicate that the complete validation was successful.
std::vector< std::unique_ptr< MdtPrepDataCollection > > addedCols {}

Detailed Description

Helper struct to parse the event data around the tool.

Definition at line 65 of file MdtRdoToPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ ConvCache()

Muon::MdtRdoToPrepDataToolMT::ConvCache::ConvCache ( const Muon::IMuonIdHelperSvc * idHelperSvc)

Definition at line 61 of file MdtRdoToPrepDataToolMT.cxx.

61 :
62 m_idHelperSvc{idHelperSvc} {
63 addedCols.resize(m_idHelperSvc->mdtIdHelper().module_hash_max());
64 }
const Muon::IMuonIdHelperSvc * m_idHelperSvc
std::vector< std::unique_ptr< MdtPrepDataCollection > > addedCols

Member Function Documentation

◆ createCollection()

MdtPrepDataCollection * Muon::MdtRdoToPrepDataToolMT::ConvCache::createCollection ( const Identifier & id)

Creates a new MdtPrepDataCollection, if it's neccessary and also possible.

Nullptr is returned if the collection cannot be modified

Definition at line 66 of file MdtRdoToPrepDataToolMT.cxx.

66 {
67
68 IdentifierHash mdtHashId = m_idHelperSvc->moduleHash(elementId);
69
70 std::unique_ptr<MdtPrepDataCollection>& coll {addedCols[mdtHashId]};
71 if (!coll) {
72 coll = std::make_unique<MdtPrepDataCollection>(mdtHashId);
73 coll->setIdentifier(m_idHelperSvc->chamberId(elementId));
74 }
75 return coll.get();
76 }

◆ finalize()

StatusCode Muon::MdtRdoToPrepDataToolMT::ConvCache::finalize ( MsgStream & msg)

Copy the non-empty collections into the created prd container.

Fill the prepdata objects just at this stage

The prepdata represents an actual drift circle

That method is kind of depreciated but needed for the Acts conversion test..

Invalid drift circles have a covariance as large as the inner radius assigned

Ordinary 1D circle

Definition at line 77 of file MdtRdoToPrepDataToolMT.cxx.

77 {
78 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
79
80 for (unsigned int moduleHash =0; moduleHash < addedCols.size(); ++moduleHash) {
81 std::unique_ptr<MdtPrepDataCollection>& toInsert{addedCols[moduleHash]};
82 if (!toInsert || toInsert->empty()) continue;
83 if (xAODPrd) {
85 std::vector<const MdtPrepData*> sortMe{toInsert->begin(), toInsert->end()};
86 std::ranges::sort(sortMe, IdentifierByDetElSorter{m_idHelperSvc});
87 for (const MdtPrepData* prd : sortMe) {
88 const Identifier prdId{prd->identify()};
89 xAOD::MdtDriftCircle* dc{nullptr};
91 if (!xAODTwinPrd|| !twinTubeMap || twinTubeMap->twinId(prdId) == prdId ||
92 prd->dimension() == 1) {
93 dc = xAODPrd->push_back(std::make_unique<xAOD::MdtDriftCircle>());
94 } else {
95 dc = xAODTwinPrd->push_back(std::make_unique<xAOD::MdtTwinDriftCircle>());
96 }
98 dc->setIdentifier(prdId.get_compact());
99 dc->setTdc(prd->tdc());
100 dc->setAdc(prd->adc());
101 dc->setTube(idHelper.tube(prdId));
102 dc->setLayer(idHelper.tubeLayer(prdId));
103 dc->setStatus(prd->status());
104 if (r4DetMgr){
105 dc->setReadoutElement(r4DetMgr->getMdtReadoutElement(prdId));
106 }
107 const IdentifierHash detHash{m_idHelperSvc->detElementHash(prdId)};
108 float driftRadius{0.f}, driftCov{0.f};
109 if (prd->status() == MdtDriftCircleStatus::MdtStatusDriftTime) {
110 driftRadius = prd->localPosition().x();
111 driftCov = prd->localCovariance()(0,0);
112 } else {
114 const float maxR = r4DetMgr ? dc->readoutElement()->innerTubeRadius()
115 : prd->detectorElement()->innerTubeRadius();
116 driftCov = std::pow(maxR, 2);
117 }
119 if (dc->numDimensions() == 1) {
121 xAOD::MeasMatrix<1> locCov{driftCov};
122 dc->setMeasurement<1>(detHash, std::move(locPos), std::move(locCov));
123 } else {
124 xAOD::MeasMatrix<2> locCov{xAOD::MeasMatrix<2>::Identity()};
125 locCov(Trk::locR, Trk::locR) = prd->localCovariance()(Trk::locR, Trk::locR);
126 locCov(Trk::locZ, Trk::locZ) = prd->localCovariance()(Trk::locZ, Trk::locZ);
127 dc->setMeasurement<2>(detHash, xAOD::toStorage(prd->localPosition()), std::move(locCov));
128 auto* twinDC{static_cast<xAOD::MdtTwinDriftCircle*>(dc)};
129 auto* twinPRD{static_cast<const MdtTwinPrepData*>(prd)};
130 twinDC->setTwinAdc(twinPRD->adcTwin());
131 twinDC->setTwinTdc(twinPRD->tdcTwin());
132 const Identifier twinId = twinTubeMap->twinId(prdId);
133 twinDC->setTwinTube(idHelper.tube(twinId));
134 twinDC->setTwinLayer(idHelper.tubeLayer(twinId));
135 }
136 }
137 }
138 MdtPrepDataContainer::IDC_WriteHandle lock = legacyPrd->getWriteHandle(moduleHash);
139 if (lock.addOrDelete(std::move(toInsert)).isFailure()) {
140 msg << MSG::ERROR << " Failed to add prep data collection " << moduleHash << endmsg;
141 return StatusCode::FAILURE;
142 }
143 }
144 if (xAODPrd) {
145 xAODPrd->lock();
146 }
147 if (xAODTwinPrd) {
148 xAODTwinPrd->lock();
149 }
150 return StatusCode::SUCCESS;
151 }
#define endmsg
value_type get_compact() const
Get the compact id.
int tube(const Identifier &id) const
int tubeLayer(const Identifier &id) const
double innerTubeRadius() const
Returns the inner tube radius.
unsigned int numDimensions() const override
Override the dimensions to be 1.
void setAdc(int16_t adc)
Sets the ADC counts.
void setReadoutElement(const MuonGMR4::MdtReadoutElement *readoutEle)
set the pointer to the MdtReadoutElement
const MuonGMR4::MdtReadoutElement * readoutElement() const
Retrieve the associated MdtReadoutElement.
void setLayer(uint8_t layer_n)
Sets the layer number.
void setStatus(MdtDriftCircleStatus st)
Sets the status of the drift circle.
void setTdc(int16_t tdc)
Setter methods.
void setTube(uint16_t tube_n)
Sets the tube number.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
@ driftRadius
trt, straws
Definition ParamDefs.h:53
@ locR
Definition ParamDefs.h:44
@ locZ
local cylindrical
Definition ParamDefs.h:42
MdtDriftCircle_v1 MdtDriftCircle
MdtTwinDriftCircle_v1 MdtTwinDriftCircle
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
const TwinTubeMap * twinTubeMap
Pointer to the map having the mapping of twin tube pairs.
xAOD::MdtTwinDriftCircleContainer * xAODTwinPrd
xAOD::MdtDriftCircleContainer * xAODPrd
const MuonGMR4::MuonDetectorManager * r4DetMgr
Detector manger from R4.
MsgStream & msg
Definition testRead.cxx:32

Member Data Documentation

◆ addedCols

std::vector<std::unique_ptr<MdtPrepDataCollection> > Muon::MdtRdoToPrepDataToolMT::ConvCache::addedCols {}

Definition at line 90 of file MdtRdoToPrepDataToolMT.h.

90{};

◆ gctx

const ActsTrk::GeometryContext* Muon::MdtRdoToPrepDataToolMT::ConvCache::gctx {nullptr}

Acts Geometry context.

Definition at line 84 of file MdtRdoToPrepDataToolMT.h.

84{nullptr};

◆ isValid

bool Muon::MdtRdoToPrepDataToolMT::ConvCache::isValid {false}

Flag set to indicate that the complete validation was successful.

Definition at line 89 of file MdtRdoToPrepDataToolMT.h.

89{false};

◆ legacyDetMgr

const MuonGM::MuonDetectorManager* Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyDetMgr {nullptr}

Detector manager from the conditions store.

Definition at line 80 of file MdtRdoToPrepDataToolMT.h.

80{nullptr};

◆ legacyPrd

Muon::MdtPrepDataContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyPrd {nullptr}

Definition at line 74 of file MdtRdoToPrepDataToolMT.h.

74{nullptr};

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* Muon::MdtRdoToPrepDataToolMT::ConvCache::m_idHelperSvc {nullptr}

Definition at line 78 of file MdtRdoToPrepDataToolMT.h.

78{nullptr};

◆ r4DetMgr

const MuonGMR4::MuonDetectorManager* Muon::MdtRdoToPrepDataToolMT::ConvCache::r4DetMgr {nullptr}

Detector manger from R4.

Definition at line 82 of file MdtRdoToPrepDataToolMT.h.

82{nullptr};

◆ twinTubeMap

const TwinTubeMap* Muon::MdtRdoToPrepDataToolMT::ConvCache::twinTubeMap {nullptr}

Pointer to the map having the mapping of twin tube pairs.

Definition at line 86 of file MdtRdoToPrepDataToolMT.h.

86{nullptr};

◆ xAODPrd

xAOD::MdtDriftCircleContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODPrd {nullptr}

Definition at line 75 of file MdtRdoToPrepDataToolMT.h.

75{nullptr};

◆ xAODTwinPrd

xAOD::MdtTwinDriftCircleContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODTwinPrd {nullptr}

Definition at line 76 of file MdtRdoToPrepDataToolMT.h.

76{nullptr};

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