ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::MdtRdoToMdtPrepDataTool Class Reference

Tool to produce MDT PRDs for Run 4. More...

#include <MdtRdoToMdtPrepDataTool.h>

Inheritance diagram for MuonR4::MdtRdoToMdtPrepDataTool:
Collaboration diagram for MuonR4::MdtRdoToMdtPrepDataTool:

Classes

struct  HandleCache
 Helper cache to carry the data containers needed for the dedcoding around. More...

Public Member Functions

 ~MdtRdoToMdtPrepDataTool ()=default
 default destructor
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode decode (const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
 Decode method - declared in Muon::IMuonRdoToPrepDataTool.
virtual StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIds) const override
virtual StatusCode provideEmptyContainer (const EventContext &ctx) const override

Protected Types

using DigitPtr_t = std::unique_ptr<MdtDigit>
 Abrivate the digit pointer.
using TwinDigit_t = std::array<DigitPtr_t, 2>
using DigitVec_t = std::vector<DigitPtr_t>
 Store the digits per chamber to ensure sorting.

Protected Member Functions

HandleCache setupHandleCache (const EventContext &ctx) const

Private Member Functions

void processDigit (const EventContext &ctx, DigitPtr_t &&digit, HandleCache &hCache) const
 Process a digit to be converted to a 1D measurement.
void processDigit (const EventContext &ctx, TwinDigit_t &&digit, HandleCache &cache) const
StatusCode processCsm (const EventContext &ctx, const MdtCsm *rdoColl, HandleCache &hCache) const
StatusCode processCsmTwin (const EventContext &ctx, const MdtCsm *rdoColl, HandleCache &hCache) const
StatusCode processPRDHashes (const EventContext &ctx, const std::vector< IdentifierHash > &chamberHashInRobs, HandleCache &hCache) const

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 tools and services
ToolHandle< IMdtCalibrationToolm_calibrationTool {this, "CalibrationTool", "MdtCalibrationTool"}
ToolHandle< Muon::IMDT_RDO_Decoderm_mdtDecoder {this, "Decoder", "Muon::MdtRDO_Decoder/MdtRDO_Decoder"}
const MuonGMR4::MuonDetectorManagerm_detMgrR4 {nullptr}
SG::ReadHandleKey< ActsTrk::GeometryContextm_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "Stored alignment"}
SG::ReadHandleKey< MdtCsmContainerm_rdoContainerKey {this, "RDOContainer", "MDTCSM"}
SG::ReadCondHandleKey< Muon::TwinTubeMapm_twinTubeKey {this, "TwinTubeKey", "MdtTwinTubeMap"}
SG::ReadCondHandleKey< MuonMDT_CablingMapm_cablingKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
Gaudi::Property< int > m_adcCut {this, "AdcCut", 50, "Minimal cut on the adc to convert it into a prepdata object"}
Gaudi::Property< bool > m_calibratePrepData {this, "CalibratePrepData", true}
 toggle on/off calibration of MdtPrepData
Gaudi::Property< bool > m_useTwin {this, "UseTwin", true}
SG::WriteHandleKey< xAOD::MdtDriftCircleContainerm_xAODKey {this, "xAODKey", "xMdtDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
SG::WriteHandleKey< xAOD::MdtTwinDriftCircleContainerm_xAODTwinKey {this, "xAODTwinKey", "xMdtTwinDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}

Detailed Description

Tool to produce MDT PRDs for Run 4.

Definition at line 38 of file MdtRdoToMdtPrepDataTool.h.

Member Typedef Documentation

◆ DigitPtr_t

using MuonR4::MdtRdoToMdtPrepDataTool::DigitPtr_t = std::unique_ptr<MdtDigit>
protected

Abrivate the digit pointer.

Definition at line 55 of file MdtRdoToMdtPrepDataTool.h.

◆ DigitVec_t

Store the digits per chamber to ensure sorting.

Definition at line 58 of file MdtRdoToMdtPrepDataTool.h.

◆ TwinDigit_t

using MuonR4::MdtRdoToMdtPrepDataTool::TwinDigit_t = std::array<DigitPtr_t, 2>
protected

Definition at line 56 of file MdtRdoToMdtPrepDataTool.h.

Constructor & Destructor Documentation

◆ ~MdtRdoToMdtPrepDataTool()

MuonR4::MdtRdoToMdtPrepDataTool::~MdtRdoToMdtPrepDataTool ( )
default

default destructor

Member Function Documentation

◆ decode() [1/2]

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

Decode method - declared in Muon::IMuonRdoToPrepDataTool.

Construct the hashes from the existing RDOs

Definition at line 25 of file MdtRdoToMdtPrepDataTool.cxx.

25 {
26 ATH_MSG_DEBUG("MdtRdoToMdtPrepDataTool for " << idVect.size() << " offline collections called");
28 if(!cache.isValid){
29 ATH_MSG_ERROR("Unable to setup valid HandleCache object");
30 return StatusCode::FAILURE;
31 }
32 // seeded or unseeded decoding
33 if (!idVect.empty()) {
34 ATH_CHECK(processPRDHashes(ctx, idVect, cache));
35 } else {
37 std::vector<IdentifierHash> rdoHashes{};
38 const MdtCsmContainer* rdoContainer{nullptr};
39 ATH_CHECK(SG::get(rdoContainer, m_rdoContainerKey, ctx));
40
41 if (rdoContainer->empty()) {
42 return StatusCode::SUCCESS;
43 }
44 rdoHashes.reserve(rdoContainer->size());
45 for (const MdtCsm* csm : *rdoContainer) {
46 rdoHashes.push_back(csm->identifyHash());
47 }
48 ATH_CHECK(processPRDHashes(ctx, rdoHashes, cache));
49 }
50 return StatusCode::SUCCESS;
51 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current MdtCsm
bool empty() const
return true if container is empty
size_t size() const
Duplicate of fullSize for backwards compatability.
HandleCache setupHandleCache(const EventContext &ctx) const
StatusCode processPRDHashes(const EventContext &ctx, const std::vector< IdentifierHash > &chamberHashInRobs, HandleCache &hCache) const
SG::ReadHandleKey< MdtCsmContainer > m_rdoContainerKey
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.
Helper cache to carry the data containers needed for the dedcoding around.

◆ decode() [2/2]

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

Definition at line 53 of file MdtRdoToMdtPrepDataTool.cxx.

53 {
54 const MuonMDT_CablingMap* cablingMap{nullptr};
55 ATH_CHECK(SG::get(cablingMap, m_cablingKey, ctx));
56 return decode(ctx, cablingMap->getMultiLayerHashVec(robIds, msgStream()));
57 }
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_cablingKey
virtual StatusCode decode(const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
Decode method - declared in Muon::IMuonRdoToPrepDataTool.

◆ initialize()

StatusCode MuonR4::MdtRdoToMdtPrepDataTool::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 10 of file MdtRdoToMdtPrepDataTool.cxx.

10 {
11 // initialize handle keys
12 ATH_CHECK(m_calibrationTool.retrieve());
13 ATH_CHECK(m_idHelperSvc.retrieve());
14 ATH_CHECK(m_mdtDecoder.retrieve());
15 ATH_CHECK(detStore()->retrieve(m_detMgrR4));
17 ATH_CHECK(m_rdoContainerKey.initialize());
18 ATH_CHECK(m_cablingKey.initialize());
19 ATH_CHECK(m_xAODKey.initialize());
21 ATH_CHECK(m_geoCtxKey.initialize());
22 return StatusCode::SUCCESS;
23 }
ToolHandle< IMdtCalibrationTool > m_calibrationTool
const MuonGMR4::MuonDetectorManager * m_detMgrR4
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
tools and services
ToolHandle< Muon::IMDT_RDO_Decoder > m_mdtDecoder
SG::ReadCondHandleKey< Muon::TwinTubeMap > m_twinTubeKey
SG::WriteHandleKey< xAOD::MdtTwinDriftCircleContainer > m_xAODTwinKey
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
SG::WriteHandleKey< xAOD::MdtDriftCircleContainer > m_xAODKey

◆ processCsm()

StatusCode MuonR4::MdtRdoToMdtPrepDataTool::processCsm ( const EventContext & ctx,
const MdtCsm * rdoColl,
HandleCache & hCache ) const
private

MDT hit context

Definition at line 186 of file MdtRdoToMdtPrepDataTool.cxx.

186 {
187 const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
188 // first handle the case of twin tubes
189 if (m_useTwin && cache.twinTubeMap->isTwinTubeLayer(rdoColl->identify())) {
190 return processCsmTwin(ctx, rdoColl, cache);
191 }
192 ATH_MSG_DEBUG(" ***************** Start of processCsm");
193 // initialise write handle
195 uint16_t subdetId = rdoColl->SubDetId();
196 uint16_t mrodId = rdoColl->MrodId();
197 uint16_t csmId = rdoColl->CsmId();
198 ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toString(id_helper.parentID(rdoColl->identify())) << " subdetId/ mrodId/ csmId = " << subdetId << " / "
199 << mrodId << " / " << csmId);
200
201 // for each Csm, loop over AmtHit, converter AmtHit to digit
202 // retrieve/create digit collection, and insert digit into collection
203 for (const MdtAmtHit* amtHit : *rdoColl) {
204 ATH_MSG_VERBOSE("Amt Hit, tdcId = " << amtHit->tdcId());
205 DigitPtr_t newDigit{m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
206 if (!newDigit) {
207 ATH_MSG_WARNING("Found issue MDT RDO decoder for subdetId/mrodId/csmId "
208 << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
209 << amtHit->tdcId());
210 continue;
211 }
212 const IdentifierHash detHash = m_idHelperSvc->detElementHash(newDigit->identify());
213 cache.digitsForCnv[detHash].push_back(std::move(newDigit));
214 }
215 return StatusCode::SUCCESS;
216 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD).
Definition MdtCsm.h:65
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Definition MdtCsm.h:63
Identifier identify() const
Returns the CSM offline identifier (chamber offline id).
Definition MdtCsm.h:55
uint16_t SubDetId() const
Returns the sub-detector Id.
Definition MdtCsm.h:61
Identifier parentID(const Identifier &id) const
get parent id from channel id
std::unique_ptr< MdtDigit > DigitPtr_t
Abrivate the digit pointer.
StatusCode processCsmTwin(const EventContext &ctx, const MdtCsm *rdoColl, HandleCache &hCache) const
setWord1 uint16_t

◆ processCsmTwin()

StatusCode MuonR4::MdtRdoToMdtPrepDataTool::processCsmTwin ( const EventContext & ctx,
const MdtCsm * rdoColl,
HandleCache & hCache ) const
private

check for the twin tube id

Definition at line 218 of file MdtRdoToMdtPrepDataTool.cxx.

218 {
219 ATH_MSG_DEBUG(" ***************** Start of processCsmTwin");
220 ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size());
221
222 uint16_t subdetId = rdoColl->SubDetId();
223 uint16_t mrodId = rdoColl->MrodId();
224 uint16_t csmId = rdoColl->CsmId();
225 ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toStringChamber(rdoColl->identify())
226 << " subdetId/ mrodId/ csmId = " << rdoColl->SubDetId()
227 << " / " << rdoColl->MrodId() << " / " << rdoColl->CsmId());
228
229 // for each Csm, loop over AmtHit, converter AmtHit to digit
230 // retrieve/create digit collection, and insert digit into collection
231 std::unordered_map<Identifier, TwinDigit_t> mdtDigitColl{};
232
233 for (const MdtAmtHit* amtHit : *rdoColl) {
234 DigitPtr_t newDigit{m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
235
236 if (!newDigit) {
237 ATH_MSG_WARNING("Error in MDT RDO decoder for subdetId/mrodId/csmId "
238 << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
239 << amtHit->tdcId());
240 continue;
241 } else if (newDigit->isMasked()) {
242 continue;
243 }
244 std::array<DigitPtr_t, 2> & moveTo = mdtDigitColl[newDigit->identify()];
245 if (!moveTo[0]) {
246 moveTo[0] = std::move(newDigit);
247 } else if (!moveTo[1]) {
248 moveTo[1] = std::move(newDigit);
249 } else {
250 ATH_MSG_VERBOSE(" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
251 << m_idHelperSvc->toString(newDigit->identify()) << " with adc = " << newDigit->adc()
252 << " tdc = " << newDigit->tdc());
253 }
254 } // end for-loop over rdoColl
255
256 for (auto &[id, digits] : mdtDigitColl) {
257 // get the twin hits from mdtDigitColl
258 const Identifier twinId = cache.twinTubeMap->twinId(id);
259 const IdentifierHash detHash = m_idHelperSvc->detElementHash(id);
260 assert(detHash == m_idHelperSvc->detElementHash(twinId));
262 if (id != twinId) {
263 std::array<DigitPtr_t, 2>& twinDigits = mdtDigitColl[twinId];
264 for (std::size_t k = 0 ; k < 2; ++k) {
265 if (digits[k] && twinDigits[k]) {
266 if (digits[k]->identify() > twinDigits[k]->identify()) {
267 std::swap(digits[k], twinDigits[k]);
268 }
269 cache.twinDigitsForCnv[detHash].push_back(std::array{std::move(digits[k]), std::move(twinDigits[k])});
270 } else{
271 DigitVec_t& outDigits = cache.digitsForCnv[detHash];
272 if (digits[k]) { outDigits.push_back(std::move(digits[k])); }
273 if (twinDigits[k]) { outDigits.push_back(std::move(twinDigits[k])); }
274 }
275 }
276 }
277 }
278 return StatusCode::SUCCESS;
279 }
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< DigitPtr_t > DigitVec_t
Store the digits per chamber to ensure sorting.
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.

◆ processDigit() [1/2]

void MuonR4::MdtRdoToMdtPrepDataTool::processDigit ( const EventContext & ctx,
DigitPtr_t && digit,
HandleCache & hCache ) const
private

Process a digit to be converted to a 1D measurement.

Parameters
ctxEventContext to access the calibration constants
digitPointer to the digit for conversion
hCacheData cache handling the container to which the measurement is appended

Definition at line 74 of file MdtRdoToMdtPrepDataTool.cxx.

76 {
77 const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
78 Identifier channelId = digit->identify();
79 const MuonGMR4::MdtReadoutElement* reEle = m_detMgrR4->getMdtReadoutElement(channelId);
80 bool isValidChannel = reEle->isValid(reEle->measurementHash(channelId));
81
82 if (digit->isMasked() || !isValidChannel) {
83 return;
84 }
85 // Rescale ADC/TDC of chambers using HPTDC digitization chip
86 // Must create a new digit from the old one, because MdtDigit has no methods to set ADC/TDC
87 if (m_idHelperSvc->hasHPTDC(channelId)) {
88 digit->setAdc(digit->adc() / 4);
89 digit->setTdc(digit->tdc() / 4);
90 }
91 // if ADC cut too small, skip
92 if(digit->adc() < m_adcCut){
93 return;
94 }
95
96 // calibration
97 const MdtCalibInput calibIn = MdtCalibInput{*digit, *m_detMgrR4, *hCache.gctx};
98 const MdtCalibOutput calibResult{m_calibrationTool->calibrate(ctx, calibIn, false)};
99
100 // copying over create prep data over
101 // if it doesn't match adc cut, skip!
102 if(calibResult.status() == MdtDriftCircleStatus::MdtStatusUnDefined) {
103 ATH_MSG_VERBOSE("Do not create calib hit for "<<m_idHelperSvc->toString(calibIn.identify())
104 <<", adc: "<<calibIn.adc()<<" vs. "<<m_adcCut<<", calibration bailed out "
105 <<(calibResult.status() == MdtDriftCircleStatus::MdtStatusUnDefined? "si": "no"));
106 return;
107 }
108 ATH_MSG_VERBOSE("Calibrated prepdata "<<m_idHelperSvc->toString(calibIn.identify())
109 <<std::endl<<calibIn<<std::endl<<calibResult);
110 double cov{0.}, driftRadius{0.};
111 if (calibResult.status() == MdtDriftCircleStatus::MdtStatusDriftTime){
112 driftRadius = calibResult.driftRadius();
113 cov = Acts::square(calibResult.driftRadiusUncert());
114 } else {
115 cov = Acts::square(reEle->innerTubeRadius());
116 }
117
118 // setting things
119 xAOD::MdtDriftCircle* dc = hCache.prdContainer->push_back(std::make_unique<xAOD::MdtDriftCircle>());
120 const Identifier& id = calibIn.identify();
121 dc->setTdc(calibIn.tdc());
122 dc->setAdc(calibIn.adc());
123 dc->setTube(id_helper.tube(id));
124 dc->setLayer(id_helper.tubeLayer(id));
125 dc->setStatus(calibResult.status());
126 dc->setReadoutElement(reEle);
127
129 xAOD::MeasMatrix<1> locCov{cov};
130 dc->setMeasurement<1>(reEle->identHash(),
131 std::move(locPos),
132 std::move(locCov));
133 return;
134 }
int16_t tdc() const
Returns the tdc counts of the hit.
int16_t adc() const
Returns the amount of accumulated charge.
const Identifier & identify() const
Returns the Identifier of the hit.
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
double driftRadius() const
Returns the drift radius of the calibrated object.
MdtDriftCircleStatus status() const
Status of the calibration.
int tube(const Identifier &id) const
int tubeLayer(const Identifier &id) const
bool isValid(const IdentifierHash &measHash) const
Checks whether the passed meaurement hash corresponds to a valid tube described by the readout elemen...
double innerTubeRadius() const
Returns the inner tube radius.
static IdentifierHash measurementHash(unsigned layerNumber, unsigned tubeNumber)
Constructs a Measurement hash from layer && tube number.
IdentifierHash identHash() const
Returns the hash of the readout element which is identical to the detector element hash provided by t...
void setTube(std::uint16_t tube_n)
Sets the tube number.
void setLayer(std::uint8_t layer_n)
Sets the layer number.
void setReadoutElement(const MuonGMR4::MdtReadoutElement *readoutEle)
set the pointer to the MdtReadoutElement
void setTdc(std::int16_t tdc)
Setter methods.
void setStatus(MdtDriftCircleStatus st)
Sets the status of the drift circle.
void setAdc(std::int16_t adc)
Sets the ADC counts.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
@ driftRadius
trt, straws
Definition ParamDefs.h:53
MdtDriftCircle_v1 MdtDriftCircle
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.

◆ processDigit() [2/2]

void MuonR4::MdtRdoToMdtPrepDataTool::processDigit ( const EventContext & ctx,
TwinDigit_t && digit,
HandleCache & cache ) const
private

Definition at line 135 of file MdtRdoToMdtPrepDataTool.cxx.

137 {
138 ATH_MSG_VERBOSE("Twin digit calibration "<<m_idHelperSvc->toString(digit[0]->identify())
139 <<", tdc: "<<digit[0]->tdc()<<", adc: "<<digit[0]->adc()<<" -- "
140 <<m_idHelperSvc->toString(digit[1]->identify())
141 <<", tdc: "<<digit[1]->tdc()<<", adc: "<<digit[1]->adc());
142 MdtCalibInput mdtCalib1st = MdtCalibInput{*digit[0], *m_detMgrR4, *cache.gctx};
143 MdtCalibInput mdtCalib2nd = MdtCalibInput{*digit[1], *m_detMgrR4, *cache.gctx};
144
145 const MdtCalibTwinOutput twinCalib = m_calibrationTool->calibrateTwinTubes(ctx,
146 std::move(mdtCalib1st),
147 std::move(mdtCalib2nd));
148
149 if (twinCalib.primaryAdc() < m_adcCut) {
150 ATH_MSG_VERBOSE("Do not create calib hit for "<<m_idHelperSvc->toString(twinCalib.primaryID())
151 <<", adc: "<<twinCalib.primaryAdc()<<" vs. "<<m_adcCut<<", calibration bailed out "
152 <<(twinCalib.primaryStatus() == MdtDriftCircleStatus::MdtStatusUnDefined? "si": "no"));
153
154 return;
155 }
156 Amg::Vector2D hitPos{twinCalib.primaryDriftR(), twinCalib.locZ()};
157 AmgSymMatrix(2) cov{AmgSymMatrix(2)::Identity()};
158 cov(0, 0) = Acts::square(twinCalib.uncertPrimaryR());
159 cov(1, 1) = Acts::square(twinCalib.sigmaZ() );
160 const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
161 const MuonGMR4::MdtReadoutElement* descriptor = mdtCalib1st.decriptor();
162 xAOD::MdtTwinDriftCircle* dc = cache.prdTwinContainer->push_back(std::make_unique<xAOD::MdtTwinDriftCircle>());
163
164 const Identifier id = twinCalib.primaryID();
165 const Identifier twin_id = twinCalib.twinID();
166 // record things into xAOD
167 dc->setTdc(twinCalib.primaryTdc());
168 dc->setAdc(twinCalib.primaryAdc());
169 dc->setTwinTdc(twinCalib.twinTdc());
170 dc->setTwinAdc(twinCalib.twinAdc());
171 dc->setTube(id_helper.tube(id));
172 dc->setLayer(id_helper.tubeLayer(id));
173 dc->setTwinTube(id_helper.tube(twin_id));
174 dc->setTwinLayer(id_helper.tubeLayer(twin_id));
175 dc->setStatus(twinCalib.primaryStatus());
176 dc->setReadoutElement(descriptor);
177 dc->setMeasurement<2>(descriptor->identHash(),
178 xAOD::toStorage(hitPos),
179 xAOD::toStorage(cov));
180
181 ATH_MSG_VERBOSE(" MADE A 2D TWINPREPDATA " << m_idHelperSvc->toString(twinCalib.primaryID()) << " & "
182 << m_idHelperSvc->toString(twinCalib.twinID()) << " "<<twinCalib);
183
184 ATH_MSG_VERBOSE("local pos center tube w/ TWIN INFO "<<Amg::toString(twinCalib.locZ() * Amg::Vector3D::UnitZ(), 2));
185 }
#define AmgSymMatrix(dim)
const MuonGMR4::MdtReadoutElement * decriptor() const
Returns the R4 readout element.
MdtDriftCircleStatus primaryStatus() const
double primaryDriftR() const
Identifier twinID() const
Identifier primaryID() const
double uncertPrimaryR() const
void setTwinLayer(std::uint8_t layer_n)
Sets the layer number.
void setTwinAdc(std::int16_t adc)
Sets the ADC counts.
void setTwinTdc(std::int16_t tdc)
Sets the TDC counts.
void setTwinTube(std::uint16_t tube_n)
Sets the tube number.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
MdtTwinDriftCircle_v1 MdtTwinDriftCircle
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...

◆ processPRDHashes()

StatusCode MuonR4::MdtRdoToMdtPrepDataTool::processPRDHashes ( const EventContext & ctx,
const std::vector< IdentifierHash > & chamberHashInRobs,
HandleCache & hCache ) const
private

Definition at line 280 of file MdtRdoToMdtPrepDataTool.cxx.

282 {
283 // looping through each chamber
284 const MdtCsmContainer* rdoContainer{nullptr};
285 ATH_CHECK(SG::get(rdoContainer, m_rdoContainerKey, ctx));
286 if (rdoContainer->empty()) {
287 ATH_MSG_DEBUG("The container is empty");
288 return StatusCode::SUCCESS;
289 }
290 for (const IdentifierHash& hash : multiLayerHashInRobs) {
291 const MdtCsm* rdoColl = rdoContainer->indexFindPtr(hash);
292 if(!rdoColl){
293 ATH_MSG_DEBUG("The rdo container does not have the hash " << hash);
294 continue;
295 }
296 ATH_CHECK(processCsm(ctx, rdoColl, cache));
297 }
298 for (DigitVec_t& digitPerStation : cache.digitsForCnv) {
299 std::ranges::for_each(digitPerStation,
300 [&](DigitPtr_t& digit){
301 processDigit(ctx,std::move(digit),cache);
302 });
303 }
304 for (auto& [hash, digitPerStation] : cache.twinDigitsForCnv) {
305 std::ranges::for_each(digitPerStation,
306 [&](TwinDigit_t& digit){
307 processDigit(ctx,std::move(digit),cache);
308 });
309 }
310 return StatusCode::SUCCESS;
311 }
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
std::array< DigitPtr_t, 2 > TwinDigit_t
void processDigit(const EventContext &ctx, DigitPtr_t &&digit, HandleCache &hCache) const
Process a digit to be converted to a 1D measurement.
StatusCode processCsm(const EventContext &ctx, const MdtCsm *rdoColl, HandleCache &hCache) const

◆ provideEmptyContainer()

StatusCode MuonR4::MdtRdoToMdtPrepDataTool::provideEmptyContainer ( const EventContext & ctx) const
overridevirtual

Definition at line 59 of file MdtRdoToMdtPrepDataTool.cxx.

59 {
60 return setupHandleCache(ctx).isValid ? StatusCode::SUCCESS : StatusCode::FAILURE;
61 }
bool isValid
Flag stating whether the cache is successfully initialized or not.

◆ setupHandleCache()

MdtRdoToMdtPrepDataTool::HandleCache MuonR4::MdtRdoToMdtPrepDataTool::setupHandleCache ( const EventContext & ctx) const
protected

Definition at line 64 of file MdtRdoToMdtPrepDataTool.cxx.

64 {
66 cache.digitsForCnv.resize(m_idHelperSvc->mdtIdHelper().detectorElement_hash_max());
67 cache.isValid = cache.prdContainer.record(m_xAODKey, ctx).isSuccess() &&
68 cache.prdTwinContainer.record(m_xAODTwinKey, ctx).isSuccess() &&
69 SG::get(cache.gctx, m_geoCtxKey, ctx).isSuccess() &&
70 SG::get(cache.twinTubeMap, m_twinTubeKey, ctx).isSuccess();
71 return cache;
72 }

Member Data Documentation

◆ m_adcCut

Gaudi::Property<int> MuonR4::MdtRdoToMdtPrepDataTool::m_adcCut {this, "AdcCut", 50, "Minimal cut on the adc to convert it into a prepdata object"}
private

Definition at line 119 of file MdtRdoToMdtPrepDataTool.h.

119{this, "AdcCut", 50, "Minimal cut on the adc to convert it into a prepdata object"};

◆ m_cablingKey

SG::ReadCondHandleKey<MuonMDT_CablingMap> MuonR4::MdtRdoToMdtPrepDataTool::m_cablingKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}
private

Definition at line 116 of file MdtRdoToMdtPrepDataTool.h.

116{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"};

◆ m_calibratePrepData

Gaudi::Property<bool> MuonR4::MdtRdoToMdtPrepDataTool::m_calibratePrepData {this, "CalibratePrepData", true}
private

toggle on/off calibration of MdtPrepData

Definition at line 120 of file MdtRdoToMdtPrepDataTool.h.

120{this, "CalibratePrepData", true};

◆ m_calibrationTool

ToolHandle<IMdtCalibrationTool> MuonR4::MdtRdoToMdtPrepDataTool::m_calibrationTool {this, "CalibrationTool", "MdtCalibrationTool"}
private

Definition at line 106 of file MdtRdoToMdtPrepDataTool.h.

106{this, "CalibrationTool", "MdtCalibrationTool"};

◆ m_detMgrR4

const MuonGMR4::MuonDetectorManager* MuonR4::MdtRdoToMdtPrepDataTool::m_detMgrR4 {nullptr}
private

Definition at line 108 of file MdtRdoToMdtPrepDataTool.h.

108{nullptr};

◆ m_geoCtxKey

SG::ReadHandleKey<ActsTrk::GeometryContext> MuonR4::MdtRdoToMdtPrepDataTool::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "Stored alignment"}
private

Definition at line 111 of file MdtRdoToMdtPrepDataTool.h.

111{this, "AlignmentKey", "ActsAlignment", "Stored alignment"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::MdtRdoToMdtPrepDataTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

tools and services

Definition at line 105 of file MdtRdoToMdtPrepDataTool.h.

105{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_mdtDecoder

ToolHandle<Muon::IMDT_RDO_Decoder> MuonR4::MdtRdoToMdtPrepDataTool::m_mdtDecoder {this, "Decoder", "Muon::MdtRDO_Decoder/MdtRDO_Decoder"}
private

Definition at line 107 of file MdtRdoToMdtPrepDataTool.h.

107{this, "Decoder", "Muon::MdtRDO_Decoder/MdtRDO_Decoder"};

◆ m_rdoContainerKey

SG::ReadHandleKey<MdtCsmContainer> MuonR4::MdtRdoToMdtPrepDataTool::m_rdoContainerKey {this, "RDOContainer", "MDTCSM"}
private

Definition at line 112 of file MdtRdoToMdtPrepDataTool.h.

112{this, "RDOContainer", "MDTCSM"};

◆ m_twinTubeKey

SG::ReadCondHandleKey<Muon::TwinTubeMap> MuonR4::MdtRdoToMdtPrepDataTool::m_twinTubeKey {this, "TwinTubeKey", "MdtTwinTubeMap"}
private

Definition at line 115 of file MdtRdoToMdtPrepDataTool.h.

115{this, "TwinTubeKey", "MdtTwinTubeMap"};

◆ m_useTwin

Gaudi::Property<bool> MuonR4::MdtRdoToMdtPrepDataTool::m_useTwin {this, "UseTwin", true}
private

Definition at line 121 of file MdtRdoToMdtPrepDataTool.h.

121{this, "UseTwin", true};

◆ m_xAODKey

SG::WriteHandleKey<xAOD::MdtDriftCircleContainer> MuonR4::MdtRdoToMdtPrepDataTool::m_xAODKey {this, "xAODKey", "xMdtDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
private

Definition at line 123 of file MdtRdoToMdtPrepDataTool.h.

123{this, "xAODKey", "xMdtDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};

◆ m_xAODTwinKey

SG::WriteHandleKey<xAOD::MdtTwinDriftCircleContainer> MuonR4::MdtRdoToMdtPrepDataTool::m_xAODTwinKey {this, "xAODTwinKey", "xMdtTwinDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
private

Definition at line 124 of file MdtRdoToMdtPrepDataTool.h.

124{this, "xAODTwinKey", "xMdtTwinDriftCircles", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};

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