ATLAS Offline Software
MdtRdoToPrepDataToolMT.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <algorithm>
8 #include <vector>
9 
10 #include "GaudiKernel/PhysicalConstants.h"
12 #include "MdtRDO_Decoder.h"
22 
23 
24 using namespace MuonGM;
25 using namespace Trk;
26 
28 
29 
30 namespace {
31  // the tube number of a tube in a tubeLayer is encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer)
32  constexpr unsigned int maxNTubesPerLayer = MdtIdHelper::maxNTubesPerLayer;
33 
34  inline void updateClosestApproachTwin(MdtCalibInput & in) {
35  const MuonGM::MdtReadoutElement* descriptor = in.legacyDescriptor();
36  if (descriptor) {
37  if (std::abs(descriptor->getStationS()) < std::numeric_limits<double>::epsilon()) {
38  return;
39  }
40  const Amg::Vector3D nominalTubePos = descriptor->tubePos(in.identify());
41  double measuredPerp = std::sqrt(nominalTubePos.perp2() - descriptor->getStationS()* descriptor->getStationS());
42  CxxUtils::sincos tubeSC{nominalTubePos.phi()};
43  Amg::Vector3D measurePos{tubeSC.cs * measuredPerp, tubeSC.sn *measuredPerp, nominalTubePos.z()};
44  in.setClosestApproach(measurePos);
45  }
46  }
47  inline std::string print(const Muon::MdtPrepData& prd) {
48  const auto* idHelperSvc = prd.detectorElement()->idHelperSvc();
49  std::stringstream sstr{};
50  sstr<<" PrepData "<<idHelperSvc->toString(prd.identify())
51  <<" radius: "<<prd.localPosition()[Trk::locR]<<" pm "
52  <<std::sqrt(prd.localCovariance()(Trk::locR, Trk::locR))<<
53  ", tdc: "<<prd.tdc()<<", adc: "<<prd.adc()<<", status: "<<prd.status();
54  return sstr.str();
55  }
56 } // namespace
57 
58 namespace Muon {
59 
60 
61  MdtRdoToPrepDataToolMT::ConvCache::ConvCache(const Muon::IMuonIdHelperSvc* idHelperSvc):
62  m_idHelperSvc{idHelperSvc} {
63  addedCols.resize(m_idHelperSvc->mdtIdHelper().module_hash_max());
64  }
65 
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  }
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) {
122  dc->setMeasurement<1>(detHash, std::move(locPos), std::move(locCov));
123  } else {
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  }
152 
154  ATH_CHECK(m_calibrationTool.retrieve());
155  ATH_MSG_VERBOSE("MdtCalibrationTool retrieved with pointer = " << m_calibrationTool);
156  ATH_CHECK(m_prdContainerCacheKey.initialize(!m_prdContainerCacheKey.key().empty()));
157  ATH_CHECK(m_idHelperSvc.retrieve());
158  // Retrieve the RDO decoder
159  ATH_CHECK(m_mdtDecoder.retrieve());
160 
161  ATH_CHECK(m_twinTubeKey.initialize(m_useTwin));
162 
163  m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG");
164  m_BMGpresent = m_BMGid != -1;
165  if (m_useNewGeo) {
167  }
168  if (m_BMGpresent && !m_useNewGeo) {
169  const MuonGM::MuonDetectorManager* muDetMgr = nullptr;
170  ATH_CHECK(detStore()->retrieve(muDetMgr));
171 
172  ATH_MSG_INFO("Processing configuration for layouts with BMG chambers.");
173 
174  for (int phi = 6; phi < 8; phi++) { // phi sectors
175  for (int eta = 1; eta < 4; eta++) { // eta sectors
176  for (int side = -1; side < 2; side += 2) { // side
177  if (!muDetMgr->getMuonStation("BMG", side * eta, phi)) continue;
178  for (int roe = 1; roe <= (muDetMgr->getMuonStation("BMG", side * eta, phi))->nMuonReadoutElements();
179  roe++) { // iterate on readout elemets
180  const MdtReadoutElement* mdtRE = dynamic_cast<const MdtReadoutElement*>(
181  (muDetMgr->getMuonStation("BMG", side * eta, phi))->getMuonReadoutElement(roe)); // has to be an MDT
182  if (mdtRE) initDeadChannels(mdtRE);
183  }
184  }
185  }
186  }
187  } else if (m_useNewGeo) {
188  std::vector<const MuonGMR4::MdtReadoutElement*> mdtRE = m_detMgrR4->getAllMdtReadoutElements();
189  for (const MuonGMR4::MdtReadoutElement* re : mdtRE) {
190  if (re->stationName() != m_BMGid) {
191  continue;
192  }
193  for (const IdentifierHash& dead : re->getParameters().removedTubes) {
194  m_DeadChannels.insert(re->measurementId(dead));
195  }
196  }
197  }
198 
199  // check if initializing of DataHandle objects success
201  ATH_CHECK(m_mdtPrepDataContainerKey.initialize());
204  ATH_CHECK(m_xAODKey.initialize(!m_xAODKey.empty()));
205  ATH_CHECK(m_xAODTwinKey.initialize(!m_xAODTwinKey.empty()));
207  return StatusCode::SUCCESS;
208  }
209 
210  StatusCode MdtRdoToPrepDataToolMT::decode(const EventContext& ctx, const std::vector<uint32_t>& robIds) const {
211  const MuonMDT_CablingMap* readCdo{nullptr};
212  ATH_CHECK(SG::get(readCdo, m_readKey, ctx));
213  return decode(ctx, readCdo->getMultiLayerHashVec(robIds, msgStream()));
214  }
215 
216  const MdtCsmContainer* MdtRdoToPrepDataToolMT::getRdoContainer(const EventContext& ctx) const {
217  SG::ReadHandle rdoContainerHandle{m_rdoContainerKey, ctx};
218  if (rdoContainerHandle.isValid()) {
219  ATH_MSG_DEBUG("MdtgetRdoContainer success");
220  return rdoContainerHandle.cptr();
221  }
222  ATH_MSG_WARNING("Retrieval of Mdt RDO container failed !");
223  return nullptr;
224  }
225 
227  return setupMdtPrepDataContainer(ctx).isValid ? StatusCode::SUCCESS : StatusCode::FAILURE;
228  }
229 
230  void MdtRdoToPrepDataToolMT::processPRDHashes(const EventContext& ctx, ConvCache& mdtPrepDataContainer,
231  const std::vector<IdentifierHash>& multiLayerHashInRobs) const {
232  for (const IdentifierHash& hash : multiLayerHashInRobs) {
233  if (!handlePRDHash(ctx, mdtPrepDataContainer, hash)) { ATH_MSG_DEBUG("Failed to process hash " << hash); }
234  } // ends loop over chamberhash
235  }
236 
237  bool MdtRdoToPrepDataToolMT::handlePRDHash(const EventContext& ctx,
238  ConvCache& mdtPrepDataContainer,
239  IdentifierHash rdoHash) const {
240  const MdtCsmContainer* rdoContainer{getRdoContainer(ctx)};
241 
242  if (rdoContainer->empty()) {
243  ATH_MSG_DEBUG("The container is empty");
244  return true;
245  }
246  const MdtCsm* rdoColl = rdoContainer->indexFindPtr(rdoHash);
247  if (!rdoColl) {
248  ATH_MSG_DEBUG("The rdo container does not have the hash " << rdoHash);
249  return true;
250  }
251  if (processCsm(ctx, mdtPrepDataContainer, rdoColl).isFailure()) {
252  ATH_MSG_WARNING("processCsm failed for RDO id " << m_idHelperSvc->toString(rdoColl->identify()));
253  return false;
254  }
255  return true;
256  }
257 
258  StatusCode MdtRdoToPrepDataToolMT::decode(const EventContext& ctx,
259  const std::vector<IdentifierHash>& idVect) const {
260 
261  ATH_MSG_DEBUG("decodeMdtRDO for " << idVect.size() << " offline collections called");
262 
263  // setup output container
264  ConvCache mdtPrepDataContainer = setupMdtPrepDataContainer(ctx);
265  if (!mdtPrepDataContainer.isValid) {
266  return StatusCode::FAILURE;
267  }
268 
269 
270  if (!m_decodeData) {
271  ATH_MSG_DEBUG("Stored empty container. Decoding MDT RDO into MDT PrepRawData is switched off");
272  return StatusCode::SUCCESS;
273  }
274  // seeded or unseeded decoding
275  if (!idVect.empty()) {
276  processPRDHashes(ctx, mdtPrepDataContainer, idVect);
277  } else {
279  std::vector<IdentifierHash> rdoHashes{};
280  const MdtCsmContainer* rdoContainer = getRdoContainer(ctx);
281  if (!rdoContainer || rdoContainer->empty()) return StatusCode::SUCCESS;
282  rdoHashes.reserve(rdoContainer->size());
283  for (const MdtCsm* csm : *rdoContainer) rdoHashes.push_back(csm->identifyHash());
284 
285  processPRDHashes(ctx, mdtPrepDataContainer, rdoHashes);
286  }
287  ATH_CHECK(mdtPrepDataContainer.finalize(msgStream()));
288 
289  return StatusCode::SUCCESS;
290  }
291 
292  std::unique_ptr<MdtPrepData> MdtRdoToPrepDataToolMT::createPrepData(const MdtCalibInput& calibInput,
293  const MdtCalibOutput& calibOutput,
294  ConvCache& cache) const {
295  if (calibInput.adc() < m_adcCut ||
297  ATH_MSG_VERBOSE("Do not create calib hit for "<<m_idHelperSvc->toString(calibInput.identify())
298  <<", adc: "<<calibInput.adc()<<" vs. "<<m_adcCut<<", calibration bailed out "
299  <<(calibOutput.status() == MdtDriftCircleStatus::MdtStatusUnDefined? "si": "no"));
300  return nullptr;
301  }
302  const MuonGM::MdtReadoutElement* descriptor = calibInput.legacyDescriptor();
303  if (!descriptor) {
304  if (!cache.legacyDetMgr) {
305  return nullptr;
306  }
307  descriptor = cache.legacyDetMgr->getMdtReadoutElement(calibInput.identify());
308  }
309  ATH_MSG_VERBOSE("Calibrated prepdata "<<m_idHelperSvc->toString(calibInput.identify())
310  <<std::endl<<calibInput<<std::endl<<calibOutput);
311 
313  Amg::MatrixX cov(1, 1);
314  if (calibOutput.status() == MdtDriftCircleStatus::MdtStatusDriftTime){
316  const float r = calibOutput.driftRadius();
317  const float sigR = calibOutput.driftRadiusUncert();
318  driftRadius[0] = r;
319  (cov)(0, 0) = sigR * sigR;
320  } else (cov)(0, 0) = std::pow(descriptor->innerTubeRadius(), 2);
321 
322  return std::make_unique<MdtPrepData>(calibInput.identify(),
323  std::move(driftRadius),
324  std::move(cov),
325  descriptor,
326  calibInput.tdc(),
327  calibInput.adc(),
328  calibOutput.status());
329  }
330 
331  StatusCode MdtRdoToPrepDataToolMT::processCsm(const EventContext& ctx, ConvCache& cache, const MdtCsm* rdoColl) const {
332  const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
333  // first handle the case of twin tubes
334  if (m_useTwin) {
335  if (cache.twinTubeMap->isTwinTubeLayer(rdoColl->identify())) {
336  return processCsmTwin(ctx, cache, rdoColl);
337  }
338  }
339 
340  ATH_MSG_DEBUG(" ***************** Start of processCsm");
341 
343  const Identifier elementId = id_helper.parentID(rdoColl->identify());
344 
345  uint16_t subdetId = rdoColl->SubDetId();
346  uint16_t mrodId = rdoColl->MrodId();
347  uint16_t csmId = rdoColl->CsmId();
348  ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toString(elementId) << " subdetId/ mrodId/ csmId = " << subdetId << " / "
349  << mrodId << " / " << csmId);
350 
351  // for each Csm, loop over AmtHit, converter AmtHit to digit
352  // retrieve/create digit collection, and insert digit into collection
353  unsigned mc{0};
354 
355  for (const MdtAmtHit* amtHit : *rdoColl) {
356  ++mc;
357 
358  // FIXME: Still use the digit class.
359  ATH_MSG_VERBOSE("Amt Hit n. " << mc << " tdcId = " << amtHit->tdcId());
360  std::unique_ptr<MdtDigit> newDigit{m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
361  if (!newDigit) {
362  ATH_MSG_WARNING("Found issue MDT RDO decoder for subdetId/mrodId/csmId "
363  << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
364  << amtHit->tdcId());
365  continue;
366  }
367  // Do something with it
368  Identifier channelId = newDigit->identify();
369  if (newDigit->isMasked() || m_DeadChannels.count(channelId)) {
370  continue;
371  }
372  // Retrieve the proper PRD container. Note that there are cases where one CSM is either split into 2 chambers (BEE / BIS78
373  // legacy) or 2 CSMs are split into one chamber
374  MdtPrepDataCollection* driftCircleColl = cache.createCollection(channelId);
375  if (!driftCircleColl) {
376  ATH_MSG_DEBUG("Corresponding multi layer " << m_idHelperSvc->toString(channelId) << " is already decoded.");
377  continue;
378  }
379 
380  // check if the module ID of this channel is different from the CSM one
381  // If it's the first case, create the additional collection
382 
383  ATH_MSG_VERBOSE("got digit with id ext / hash " << m_idHelperSvc->toString(channelId) << " / "
384  << driftCircleColl->identifyHash());
385 
386  // Rescale ADC/TDC of chambers using HPTDC digitization chip
387  // Must create a new digit from the old one, because MdtDigit has no methods to set ADC/TDC
388  if (m_idHelperSvc->hasHPTDC(channelId)) {
389  newDigit->setAdc(newDigit->adc() / 4);
390  newDigit->setTdc(newDigit->tdc() / 4);
391  }
392  const MdtCalibInput calibIn = m_useNewGeo ? MdtCalibInput{*newDigit, *m_detMgrR4, *cache.gctx}:
393  MdtCalibInput{*newDigit, *cache.legacyDetMgr};
394  const MdtCalibOutput calibResult{m_calibrationTool->calibrate(ctx, calibIn, false)};
395 
396  std::unique_ptr<MdtPrepData> newPrepData = createPrepData(calibIn, calibResult, cache);
397  if (!newPrepData) {
398  continue;
399  }
400  if (driftCircleColl->size()) {
401  MdtPrepData* prevPrd = driftCircleColl->at(driftCircleColl->size()-1);
402  if (prevPrd->identify() == channelId) {
403  std::stringstream sstr{};
404  ATH_MSG_VERBOSE("Duplicated prep data object detected: "<<std::endl
405  <<" **** "<<print(*prevPrd)<<std::endl
406  <<" **** "<<print(*newPrepData));
408  ATH_MSG_VERBOSE("Prd is already good");
409  } else if (newPrepData->status() == MdtDriftCircleStatus::MdtStatusDriftTime) {
410  (*prevPrd) = std::move(*newPrepData);
411  prevPrd->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size()-1);
412  }
413  continue;
414  }
415  }
416  ATH_MSG_VERBOSE("New prd created "<<print(*newPrepData));
417  newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
418  driftCircleColl->push_back(std::move(newPrepData));
419  }
420  return StatusCode::SUCCESS;
421  }
422  StatusCode MdtRdoToPrepDataToolMT::processCsmTwin(const EventContext& ctx, ConvCache& cache, const MdtCsm* rdoColl) const {
423  const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
424  ATH_MSG_DEBUG(" ***************** Start of processCsmTwin");
425  ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size());
427  Identifier elementId = id_helper.parentID(rdoColl->identify());
428 
429  uint16_t subdetId = rdoColl->SubDetId();
430  uint16_t mrodId = rdoColl->MrodId();
431  uint16_t csmId = rdoColl->CsmId();
432  ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toString(elementId) << " subdetId/ mrodId/ csmId = " << rdoColl->SubDetId()
433  << " / " << rdoColl->MrodId() << " / " << rdoColl->CsmId());
434 
435  // for each Csm, loop over AmtHit, converter AmtHit to digit
436  // retrieve/create digit collection, and insert digit into collection
437  std::map<Identifier, std::array<std::unique_ptr<MdtDigit>, 2>> mdtDigitColl{};
438 
439  for (const MdtAmtHit* amtHit : *rdoColl) {
440  std::unique_ptr<MdtDigit> newDigit{m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
441 
442  if (!newDigit) {
443  ATH_MSG_WARNING("Error in MDT RDO decoder for subdetId/mrodId/csmId "
444  << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
445  << amtHit->tdcId());
446  continue;
447  }
448  std::array<std::unique_ptr<MdtDigit>, 2> & moveTo = mdtDigitColl[newDigit->identify()];
449  if (!moveTo[0]) {
450  moveTo[0] = std::move(newDigit);
451  } else if (!moveTo[1] && !m_discardSecondaryHitTwin) {
452  moveTo[1] = std::move(newDigit);
453  } else {
454  ATH_MSG_VERBOSE(" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
455  << m_idHelperSvc->toString(newDigit->identify()) << " with adc = " << newDigit->adc()
456  << " tdc = " << newDigit->tdc());
457  }
458  } // end for-loop over rdoColl
459 
460  auto convertTwins = [this, &cache, &ctx](std::unique_ptr<MdtDigit> digit,
461  std::unique_ptr<MdtDigit> digit2) {
462  if (!digit || digit->isMasked() || !cache.legacyDetMgr) {
463  return;
464  }
465 
466  MdtPrepDataCollection* driftCircleColl = cache.createCollection(digit->identify());
467 
468  if (!digit2 || digit2->isMasked()) {
469  ATH_MSG_VERBOSE("Got single digit " << m_idHelperSvc->toString(digit->identify())<<", tdc: "
470  <<digit->tdc()<<", adc: "<<digit->adc()
471  << ", hash: "<< driftCircleColl->identifyHash());
472 
473  const MdtCalibInput mdtCalibIn = m_useNewGeo ? MdtCalibInput{*digit, *m_detMgrR4, *cache.gctx}:
474  MdtCalibInput{*digit, *cache.legacyDetMgr};
475 
476  const MdtCalibOutput mdtCalibOut{m_calibrationTool->calibrate(ctx, mdtCalibIn, false)};
477 
479  std::unique_ptr<MdtPrepData> newPrepData = createPrepData(mdtCalibIn, mdtCalibOut, cache);
480  if (!newPrepData) return;
481 
482  newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
483  driftCircleColl->push_back(std::move(newPrepData));
484  return;
485  }
486  ATH_MSG_VERBOSE("Twin digit calibration "<<m_idHelperSvc->toString(digit->identify())
487  <<", tdc: "<<digit->tdc()<<", adc: "<<digit->adc()<<" -- "
488  <<m_idHelperSvc->toString(digit2->identify())
489  <<", tdc: "<<digit2->tdc()<<", adc: "<<digit2->adc());
490  MdtCalibInput mdtCalib1st = m_useNewGeo ? MdtCalibInput{*digit, *m_detMgrR4, *cache.gctx}
491  : MdtCalibInput{*digit, *cache.legacyDetMgr};
492 
493  MdtCalibInput mdtCalib2nd = m_useNewGeo ? MdtCalibInput{*digit2, *m_detMgrR4, *cache.gctx}
494  : MdtCalibInput{*digit2, *cache.legacyDetMgr};
495 
496  updateClosestApproachTwin(mdtCalib1st);
497  updateClosestApproachTwin(mdtCalib2nd);
498 
499  const MdtCalibTwinOutput twinCalib = m_calibrationTool->calibrateTwinTubes(ctx,
500  std::move(mdtCalib1st),
501  std::move(mdtCalib2nd));
502 
503  Amg::Vector2D hitPos{twinCalib.primaryDriftR(), twinCalib.locZ()};
504  Amg::MatrixX cov(2, 2);
505  cov(0, 0) = twinCalib.uncertPrimaryR() * twinCalib.uncertPrimaryR();
506  cov(1, 1) = twinCalib.sigmaZ() * twinCalib.sigmaZ();
507  cov(0, 1) = cov(1, 0) = 0;
508 
509  const MuonGM::MdtReadoutElement* descriptor = cache.legacyDetMgr->getMdtReadoutElement(digit->identify());
510  auto twin_newPrepData = std::make_unique<MdtTwinPrepData>(twinCalib.primaryID(),
511  std::move(hitPos),
512  std::move(cov),
513  descriptor,
514  twinCalib.primaryTdc(),
515  twinCalib.primaryAdc(),
516  twinCalib.twinTdc(),
517  twinCalib.twinAdc(),
518  twinCalib.primaryStatus());
519 
520  ATH_MSG_VERBOSE(" MADE A 2D TWINPREPDATA " << m_idHelperSvc->toString(twinCalib.primaryID()) << " & "
521  << m_idHelperSvc->toString(twinCalib.twinID()) << " "<<twinCalib);
522 
523  ATH_MSG_VERBOSE("global pos center tube " << Amg::toString(twin_newPrepData->globalPosition(), 2) << std::endl
524  <<"local pos center tube w/ TWIN INFO "<<Amg::toString(twinCalib.locZ() * Amg::Vector3D::UnitZ(), 2)<<std::endl
525  <<"global pos w/o TWIN INFO "<<Amg::toString(descriptor->tubePos(twinCalib.primaryID())));
526 
527  twin_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
528  driftCircleColl->push_back(std::move(twin_newPrepData));
529  };
530 
531  // iterate over mdtDigitColl
532  for (auto &[id, digits] : mdtDigitColl) {
533  // get the twin hits from mdtDigitColl
534  const Identifier twinId = cache.twinTubeMap->twinId(id);
536  if (id != twinId) {
537  std::array<std::unique_ptr<MdtDigit>, 2>& twinDigits = mdtDigitColl[twinId];
538  ATH_MSG_VERBOSE("Convert digits: "<<digits[0].get()<<" "<<twinDigits[0].get());
539  convertTwins(std::move(digits[0]), std::move(twinDigits[0]));
540  ATH_MSG_VERBOSE("Convert digits: "<<digits[1].get()<<" "<<twinDigits[1].get());
541  convertTwins(std::move(digits[1]), std::move(twinDigits[1]));
542  } else {
543  convertTwins(std::move(digits[0]), nullptr);
544  convertTwins(std::move(digits[1]), nullptr);
545  }
546  }
547  return StatusCode::SUCCESS;
548  }
550  PVConstLink cv = mydetEl->getMaterialGeom(); // it is "Multilayer"
551  int nGrandchildren = cv->getNChildVols();
552  if (nGrandchildren <= 0) return;
553 
554  std::vector<int> tubes;
555  geoGetIds([&](int id) { tubes.push_back(id); }, &*cv);
556  std::sort(tubes.begin(), tubes.end());
557 
558  const Identifier detElId = mydetEl->identify();
559  const int ml = mydetEl->getMultilayer();
560  std::vector<int>::iterator it = tubes.begin();
561  for (int layer = 1; layer <= mydetEl->getNLayers(); layer++) {
562  for (int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++) {
563  int want_id = layer * maxNTubesPerLayer + tube;
564  if (it != tubes.end() && *it == want_id) {
565  ++it;
566  } else {
567  it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
568  if (it != tubes.end() && *it == want_id) {
569  ++it;
570  } else {
571  Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID(detElId, ml, layer, tube);
572  m_DeadChannels.insert(deadTubeId);
573  ATH_MSG_VERBOSE("adding dead tube "<<m_idHelperSvc->toString(deadTubeId));
574  }
575  }
576  }
577  }
578 
579  }
581 
582  ConvCache cache{m_idHelperSvc.get()};
583 
585  // Caching of PRD container
586  if (m_prdContainerCacheKey.key().empty()) {
587  // without the cache we just record the container
588  StatusCode status = handle.record(std::make_unique<MdtPrepDataContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max()));
589  if (status.isFailure() || !handle.isValid()) {
590  ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key());
591  return cache;
592  }
593  ATH_MSG_VERBOSE("Created container " << m_mdtPrepDataContainerKey.key());
594  cache.legacyPrd = handle.ptr();
595  } else {
596  // use the cache to get the container
598  if (!update.isValid()) {
599  ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
600  return cache;
601  }
602  StatusCode status = handle.record(std::make_unique<MdtPrepDataContainer>(update.ptr()));
603  if (status.isFailure() || !handle.isValid()) {
604  ATH_MSG_FATAL("Could not record container of MDT PrepData Container using cache " << m_prdContainerCacheKey.key() << " - "
605  << m_mdtPrepDataContainerKey.key());
606  return cache;
607  }
608  ATH_MSG_VERBOSE("Created container using cache for " << m_prdContainerCacheKey.key());
609  cache.legacyPrd = handle.ptr();
610  }
611  if (!m_xAODTwinKey.empty()) {
612  SG::WriteHandle writeHandle{m_xAODTwinKey, ctx};
613  if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtTwinDriftCircleContainer>(),
614  std::make_unique<xAOD::MdtTwinDriftCircleAuxContainer>()).isSuccess() ||
615  !writeHandle.isValid()) {
616  ATH_MSG_FATAL("Failed to write xAOD::MdtPrepDataContainer "<<m_xAODTwinKey.fullKey());
617  return cache;
618  }
619  cache.xAODTwinPrd = writeHandle.ptr();
620  }
621  if (!m_xAODKey.empty()) {
622  SG::WriteHandle writeHandle{m_xAODKey, ctx};
623  if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtDriftCircleContainer>(),
624  std::make_unique<xAOD::MdtDriftCircleAuxContainer>()).isSuccess() ||
625  !writeHandle.isValid()) {
626  ATH_MSG_FATAL("Failed to write xAOD::MdtPrepDataContainer "<<m_xAODKey.fullKey());
627  return cache;
628  }
629  cache.xAODPrd = writeHandle.ptr();
630  }
632  if (!m_geoCtxKey.empty()) {
633  SG::ReadHandle readHandle{m_geoCtxKey, ctx};
634  if (!readHandle.isPresent()) {
635  ATH_MSG_FATAL("Failed to retrieve the geometry context "<<m_geoCtxKey.fullKey());
636  return cache;
637  }
638  cache.gctx = readHandle.cptr();
639  }
641  if (!m_muDetMgrKey.empty()) {
642  SG::ReadCondHandle detMgrHandle{m_muDetMgrKey, ctx};
643  if (!detMgrHandle.isValid()) {
644  ATH_MSG_FATAL("Failed to retrieve the detector manager from the conditions store "<<m_muDetMgrKey.fullKey());
645  return cache;
646  }
647  cache.legacyDetMgr = detMgrHandle.cptr();
648  }
649  if (m_useTwin) {
650  SG::ReadCondHandle twinTubeHandle{m_twinTubeKey, ctx};
651  if (!twinTubeHandle.isValid()) {
652  ATH_MSG_FATAL("Failed to initialize twin tube map "<<m_twinTubeKey.fullKey());
653  return cache;
654  }
655  cache.twinTubeMap = twinTubeHandle.cptr();
656  }
657  cache.r4DetMgr = m_detMgrR4;
658  // Pass the container from the handle
659  cache.isValid = true;
660  return cache;
661  }
662 } // namespace Muon
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
beamspotman.r
def r
Definition: beamspotman.py:674
MdtCsm::CsmId
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD)
Definition: MdtCsm.h:61
Muon::MdtRdoToPrepDataToolMT::m_useNewGeo
Gaudi::Property< bool > m_useNewGeo
Definition: MdtRdoToPrepDataToolMT.h:122
MdtReadoutElement.h
MuonGM::MdtReadoutElement::getNLayers
int getNLayers() const
Returns the number of tube layers inside the multilayer.
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
MdtAmtHit
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
Definition: MdtAmtHit.h:20
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonGM::MuonReadoutElement::getStationS
double getStationS() const
Seems to be exclusively used by the MDTs --> Move it to MdtReadoutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:202
MdtCalibOutput::MdtDriftCircleStatus
Muon::MdtDriftCircleStatus MdtDriftCircleStatus
Definition: MdtCalibOutput.h:63
MdtCalibInput
Definition: MdtCalibInput.h:34
MuonGM::MdtReadoutElement::innerTubeRadius
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
MdtRDO_Decoder.h
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
MdtCalibTwinOutput::twinAdc
int twinAdc() const
Definition: MdtCalibTwinOutput.cxx:37
MdtCalibInput::legacyDescriptor
const MuonGM::MdtReadoutElement * legacyDescriptor() const
Returns the legacy readout element.
Definition: MdtCalibInput.cxx:87
Muon::MdtRdoToPrepDataToolMT::createPrepData
std::unique_ptr< MdtPrepData > createPrepData(const MdtCalibInput &calibInput, const MdtCalibOutput &calibOutput, ConvCache &cache) const
Creates the PRD object.
Definition: MdtRdoToPrepDataToolMT.cxx:292
Muon::MdtRdoToPrepDataToolMT::m_twinTubeKey
SG::ReadCondHandleKey< TwinTubeMap > m_twinTubeKey
Definition: MdtRdoToPrepDataToolMT.h:152
MuonR4::driftCov
double driftCov(const CalibratedSpacePoint &dcHit)
Definition: MdtSegmentSeedGenerator.cxx:22
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
skel.it
it
Definition: skel.GENtoEVGEN.py:407
Muon::MdtRdoToPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< MdtCsmContainer > m_rdoContainerKey
Definition: MdtRdoToPrepDataToolMT.h:132
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:200
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:206
MdtCsm::identify
Identifier identify() const
Returns the CSM offline identifier (chamber offline id)
Definition: MdtCsm.h:51
MdtCsm::SubDetId
uint16_t SubDetId() const
Returns the sub-detector Id.
Definition: MdtCsm.h:57
Muon::MdtDriftCircleStatus
MdtDriftCircleStatus
Enum to represent the 'status' of Mdt measurements e.g.
Definition: MdtDriftCircleStatus.h:25
xAOD::toStorage
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
Definition: MeasurementDefs.h:69
MdtCalibTwinOutput::sigmaZ
double sigmaZ() const
Definition: MdtCalibTwinOutput.cxx:49
MdtCalibTwinOutput::twinTdc
int twinTdc() const
Definition: MdtCalibTwinOutput.cxx:38
Muon::MdtRdoToPrepDataToolMT::provideEmptyContainer
virtual StatusCode provideEmptyContainer(const EventContext &ctx) const override
Definition: MdtRdoToPrepDataToolMT.cxx:226
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition: MdtCsmContainer.h:22
MdtDriftCircleAuxContainer.h
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
Trk::locR
@ locR
Definition: ParamDefs.h:44
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
MdtCsm
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
Definition: MdtCsm.h:19
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MdtPrepData::adc
int adc() const
Returns the ADC (typically range is 0 to 250)
Definition: MdtPrepData.h:146
GeoGetIds.h
Visitor to collect all IDs under a GeoModel node.
MdtCalibTwinOutput::uncertPrimaryR
double uncertPrimaryR() const
Definition: MdtCalibTwinOutput.cxx:52
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
MdtCalibInput::identify
const Identifier & identify() const
Returns the Identifier of the hit.
Definition: MdtCalibInput.cxx:84
MdtCalibTwinOutput::primaryTdc
int primaryTdc() const
Definition: MdtCalibTwinOutput.cxx:35
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:331
IdentifiableContainerMT::empty
bool empty() const
return true if container is empty
Definition: IdentifiableContainerMT.h:244
TRT::Hit::side
@ side
Definition: HitInfo.h:83
Muon::MdtRdoToPrepDataToolMT::m_mdtPrepDataContainerKey
SG::WriteHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepDataContainerKey
MdtPrepRawData containers.
Definition: MdtRdoToPrepDataToolMT.h:130
MuonGM::MuonReadoutElement::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:136
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:258
MdtCsm::MrodId
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Definition: MdtCsm.h:59
MuonMDT_CablingMap
Definition: MuonMDT_CablingMap.h:28
xAOD::UncalibratedMeasurement_v1::setIdentifier
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
Muon::MdtRdoToPrepDataToolMT::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: MdtRdoToPrepDataToolMT.cxx:153
mc
Definition: mc.PG_single_nu_valid.py:1
Muon::MuonPrepDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
Muon::MdtRdoToPrepDataToolMT::m_detMgrR4
const MuonGMR4::MuonDetectorManager * m_detMgrR4
Definition: MdtRdoToPrepDataToolMT.h:125
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
Muon::MdtRdoToPrepDataToolMT::m_useTwin
Gaudi::Property< bool > m_useTwin
Definition: MdtRdoToPrepDataToolMT.h:148
MdtTwinPrepData.h
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:206
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
CxxUtils::sincos::cs
double cs
Definition: sincos.h:54
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
Muon::TwinTubeMap::twinId
Identifier twinId(const Identifier &channelId) const
Returns the Identifier of the mapped twin tube.
Definition: TwinTubeMap.cxx:19
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:580
Muon::MdtRdoToPrepDataToolMT::processCsmTwin
StatusCode processCsmTwin(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColll) const
Definition: MdtRdoToPrepDataToolMT.cxx:422
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:287
Trk::PrepRawData::setHashAndIndex
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:53
Muon::MdtRdoToPrepDataToolMT::m_BMGpresent
bool m_BMGpresent
Definition: MdtRdoToPrepDataToolMT.h:144
xAOD::MdtTwinDriftCircle_v1
Definition: MdtTwinDriftCircle_v1.h:12
MuonDetectorManager.h
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
MdtIdHelper
Definition: MdtIdHelper.h:61
Muon::MdtRdoToPrepDataToolMT::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition: MdtRdoToPrepDataToolMT.h:157
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::MdtRdoToPrepDataToolMT::initDeadChannels
void initDeadChannels(const MuonGM::MdtReadoutElement *mydetEl)
Definition: MdtRdoToPrepDataToolMT.cxx:549
MdtCalibTwinOutput::locZ
double locZ() const
Definition: MdtCalibTwinOutput.cxx:48
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:216
MdtCalibInput::setClosestApproach
void setClosestApproach(const Amg::Vector3D &approach)
Sets the closest approach.
Definition: MdtCalibInput.cxx:106
MuonGM::MdtReadoutElement::getMultilayer
int getMultilayer() const
Returns the multilayer represented by the readout element.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
MdtCalibOutput::status
MdtDriftCircleStatus status() const
Status of the calibration.
Definition: MdtCalibOutput.cxx:40
MdtCalibOutput
Definition: MdtCalibOutput.h:10
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:121
MdtRdoToPrepDataToolMT.h
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:53
Muon::MdtRdoToPrepDataToolMT::ConvCache::gctx
const ActsGeometryContext * gctx
Acts Geometry context.
Definition: MdtRdoToPrepDataToolMT.h:84
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
MdtTwinDriftCircleAuxContainer.h
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
MdtCalibTwinOutput::twinID
Identifier twinID() const
Definition: MdtCalibTwinOutput.cxx:41
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Muon::MdtPrepData::tdc
int tdc() const
Returns the TDC (typically range is 0 to 2500).
Definition: MdtPrepData.h:145
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:18
Muon::MdtRdoToPrepDataToolMT::m_discardSecondaryHitTwin
Gaudi::Property< bool > m_discardSecondaryHitTwin
Definition: MdtRdoToPrepDataToolMT.h:149
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
SG::UpdateHandle
Definition: UpdateHandle.h:91
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
MdtCalibTwinOutput::primaryStatus
MdtDriftCircleStatus primaryStatus() const
Definition: MdtCalibTwinOutput.cxx:54
Muon::MdtRdoToPrepDataToolMT::handlePRDHash
bool handlePRDHash(const EventContext &ctx, ConvCache &mdtPrepDataContainer, IdentifierHash rdoHash) const
Definition: MdtRdoToPrepDataToolMT.cxx:237
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
MdtCalibInput::adc
int16_t adc() const
Returns the amount of accumulated charge.
Definition: MdtCalibInput.cxx:86
Muon::MdtRdoToPrepDataToolMT::ConvCache::finalize
StatusCode finalize(MsgStream &msg)
Copy the non-empty collections into the created prd container.
Definition: MdtRdoToPrepDataToolMT.cxx:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Muon::MdtRdoToPrepDataToolMT::m_BMGid
int m_BMGid
Definition: MdtRdoToPrepDataToolMT.h:145
MdtCalibOutput::driftRadiusUncert
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
Definition: MdtCalibOutput.cxx:20
Muon::MdtRdoToPrepDataToolMT::ConvCache::twinTubeMap
const TwinTubeMap * twinTubeMap
Pointer to the map having the mapping of twin tube pairs.
Definition: MdtRdoToPrepDataToolMT.h:86
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
MuonGM::MuonDetectorManager::getMuonStation
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:139
Muon::MdtRdoToPrepDataToolMT::ConvCache
Helper struct to parse the event data around the tool.
Definition: MdtRdoToPrepDataToolMT.h:65
geoGetIds
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition: GeoGetIds.h:82
Muon::MdtRdoToPrepDataToolMT::ConvCache::isValid
bool isValid
Flag set to indicate that the complete validation was successful.
Definition: MdtRdoToPrepDataToolMT.h:89
MuonGM::MdtReadoutElement::tubePos
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
MdtCalibTwinOutput
Definition: MdtCalibTwinOutput.h:11
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
Muon::IMuonIdHelperSvc::toString
virtual std::string toString(const Identifier &id) const =0
print all fields to string
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MdtReadoutElement.h
re
const boost::regex re(r_e)
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
MdtCalibTwinOutput::primaryAdc
int primaryAdc() const
Definition: MdtCalibTwinOutput.cxx:34
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
GeoPrimitivesToStringConverter.h
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:39
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
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:230
Muon::MdtStatusUnDefined
@ MdtStatusUnDefined
Undefined.
Definition: MdtDriftCircleStatus.h:43
MdtCalibTwinOutput::primaryDriftR
double primaryDriftR() const
Definition: MdtCalibTwinOutput.cxx:50
MdtCalibTwinOutput::primaryID
Identifier primaryID() const
Definition: MdtCalibTwinOutput.cxx:40
merge.status
status
Definition: merge.py:16
IdentifierByDetElSorter.h
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:55
Muon::IdentifierByDetElSorter
Definition: IdentifierByDetElSorter.h:17
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
Muon::MdtRdoToPrepDataToolMT::ConvCache::createCollection
MdtPrepDataCollection * createCollection(const Identifier &id)
Creates a new MdtPrepDataCollection, if it's neccessary and also possible.
Definition: MdtRdoToPrepDataToolMT.cxx:66
Muon::MdtRdoToPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of MDT RDO into MdtPrepData
Definition: MdtRdoToPrepDataToolMT.h:139
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
Muon::MdtRdoToPrepDataToolMT::m_mdtDecoder
ToolHandle< Muon::IMDT_RDO_Decoder > m_mdtDecoder
Definition: MdtRdoToPrepDataToolMT.h:142
Muon::MdtPrepData::status
MdtDriftCircleStatus status() const
Returns the status of the measurement.
Definition: MdtPrepData.h:147
covarianceTool.mc
mc
Definition: covarianceTool.py:554
MdtIdHelper::maxNTubesPerLayer
static constexpr int maxNTubesPerLayer
The maxNTubesPerLayer represents the absolute maximum of tubes which are built into a single multilay...
Definition: MdtIdHelper.h:68
MuonGM::MdtReadoutElement::getNtubesperlayer
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
MuonStation.h
MdtCalibInput::tdc
int16_t tdc() const
Returns the tdc counts of the hit.
Definition: MdtCalibInput.cxx:85
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Muon::TwinTubeMap::isTwinTubeLayer
bool isTwinTubeLayer(const Identifier &channelId) const
Returns whether the multilayer is equipped with twin-tubes or not.
Definition: TwinTubeMap.cxx:12
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::MdtPrepData::detectorElement
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
Definition: MdtPrepData.h:141
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Muon::MdtRdoToPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: MdtRdoToPrepDataToolMT.h:159
calibdata.tube
tube
Definition: calibdata.py:30
Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyDetMgr
const MuonGM::MuonDetectorManager * legacyDetMgr
Detector manager from the conditions store.
Definition: MdtRdoToPrepDataToolMT.h:80
MdtCalibOutput::driftRadius
double driftRadius() const
Returns the drift radius of the calibrated object.
Definition: MdtCalibOutput.cxx:19
Muon::MdtTwinPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtTwinPrepData.h:33
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
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
MdtIdHelper::parentID
Identifier parentID(const Identifier &id) const
get parent id from channel id
Definition: MdtIdHelper.cxx:711
Muon::MdtRdoToPrepDataToolMT::m_xAODTwinKey
SG::WriteHandleKey< xAOD::MdtTwinDriftCircleContainer > m_xAODTwinKey
Definition: MdtRdoToPrepDataToolMT.h:167
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