ATLAS Offline Software
MdtRdoToPrepDataToolMT.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <algorithm>
8 #include <vector>
9 
10 #include "GaudiKernel/PhysicalConstants.h"
11 #include "GaudiKernel/ThreadLocalContext.h"
13 #include "MdtRDO_Decoder.h"
19 
20 using namespace MuonGM;
21 using namespace Trk;
22 
24 
25 
26 namespace {
27  // the tube number of a tube in a tubeLayer is encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer)
28  constexpr unsigned int maxNTubesPerLayer = MdtIdHelper::maxNTubesPerLayer;
29 
30  inline void updateClosestApproachTwin(MdtCalibInput & in) {
31  const MuonGM::MdtReadoutElement* descriptor = in.legacyDescriptor();
32  if (descriptor) {
33  if (std::abs(descriptor->getStationS()) < std::numeric_limits<double>::epsilon()) {
34  return;
35  }
36  const Amg::Vector3D nominalTubePos = descriptor->tubePos(in.identify());
37  double measuredPerp = std::sqrt(nominalTubePos.perp2() - descriptor->getStationS()* descriptor->getStationS());
38  CxxUtils::sincos tubeSC{nominalTubePos.phi()};
39  Amg::Vector3D measurePos{tubeSC.cs * measuredPerp, tubeSC.sn *measuredPerp, nominalTubePos.z()};
40  in.setClosestApproach(measurePos);
41  }
42  }
43 } // namespace
44 
45 namespace Muon {
46 
47  MdtPrepDataCollection* MdtRdoToPrepDataToolMT::ConvCache::createCollection(const Identifier& elementId, MsgStream& msg) {
48 
49  IdentifierHash mdtHashId = m_idHelperSvc->moduleHash(elementId);
50  if (static_cast<int>(mdtHashId) == -1) {
51  msg << MSG::ERROR << "Module hash creation failed. " << m_idHelperSvc->toString(elementId) << endmsg;
52  return nullptr;
53  }
54  PrdCollMap::iterator itr = addedCols.find(mdtHashId);
55  if (itr != addedCols.end()) return itr->second.get();
56  MdtPrepDataContainer::IDC_WriteHandle lock = legacyPrd->getWriteHandle(mdtHashId);
57  if (lock.alreadyPresent()) {
58  if (msg.level() <= MSG::DEBUG) {
59  msg << MSG::DEBUG << "MdtPrepDataCollection already contained in IDC " << elementId << " " << mdtHashId << endmsg;
60  }
61  return nullptr;
62  }
63  std::unique_ptr<MdtPrepDataCollection> newColl = std::make_unique<MdtPrepDataCollection>(mdtHashId);
64  newColl->setIdentifier(m_idHelperSvc->chamberId(elementId));
65  return addedCols.insert(std::make_pair(mdtHashId, std::move(newColl))).first->second.get();
66  }
68  for (auto& to_insert : addedCols) {
69  if (to_insert.second->empty()) continue;
70  MdtPrepDataContainer::IDC_WriteHandle lock = legacyPrd->getWriteHandle(to_insert.first);
71  if (lock.addOrDelete(std::move(to_insert.second)).isFailure()) {
72  msg << MSG::ERROR << " Failed to add prep data collection " << to_insert.first << endmsg;
73  return StatusCode::FAILURE;
74  }
75  }
76  if (xAODPrd) xAODPrd->lock();
77  return StatusCode::SUCCESS;
78  }
79 
80  MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p) :
81  base_class(t, n, p) {}
82 
84  ATH_CHECK(m_calibrationTool.retrieve());
85  ATH_MSG_VERBOSE("MdtCalibrationTool retrieved with pointer = " << m_calibrationTool);
86  ATH_CHECK(m_prdContainerCacheKey.initialize(!m_prdContainerCacheKey.key().empty()));
87  ATH_CHECK(m_idHelperSvc.retrieve());
88  // Retrieve the RDO decoder
89  ATH_CHECK(m_mdtDecoder.retrieve());
90 
91  // + TWIN TUBES
92  // make an array of [multilayer][layer][twin-pair]; 2 multilayers, 3 layer per multilayer, 36 twin-pairs per layer
93  if (m_useTwin) {
94  for (int i = 0; i < 2; i++) {
95  for (int j = 0; j < 3; j++) {
96  for (int k = 0; k < 36; k++) {
97  // fill m_twin_chamber array with unique numbers
98  m_twin_chamber[i][j][k] = 1000 * i + 100 * j + k;
99  // for secondary hits we need to make a second array with unique numbers
100  // (i+1 is used in the expression, so numbers are always different from m_twin_chamber array)
101  m_secondaryHit_twin_chamber[i][j][k] = 10000 * (i + 1) + 100 * j + k;
102  }
103  }
104  }
105  } // end if(m_useTwin){
106  // - TWIN TUBES
107 
108 
109  m_BMGid = m_idHelperSvc->mdtIdHelper().stationNameIndex("BMG");
110  m_BMGpresent = m_BMGid != -1;
111  if (m_useNewGeo) {
113  }
114  if (m_BMGpresent && !m_useNewGeo) {
115  const MuonGM::MuonDetectorManager* muDetMgr = nullptr;
116  ATH_CHECK(detStore()->retrieve(muDetMgr));
117 
118  ATH_MSG_INFO("Processing configuration for layouts with BMG chambers.");
119 
120  for (int phi = 6; phi < 8; phi++) { // phi sectors
121  for (int eta = 1; eta < 4; eta++) { // eta sectors
122  for (int side = -1; side < 2; side += 2) { // side
123  if (!muDetMgr->getMuonStation("BMG", side * eta, phi)) continue;
124  for (int roe = 1; roe <= (muDetMgr->getMuonStation("BMG", side * eta, phi))->nMuonReadoutElements();
125  roe++) { // iterate on readout elemets
126  const MdtReadoutElement* mdtRE = dynamic_cast<const MdtReadoutElement*>(
127  (muDetMgr->getMuonStation("BMG", side * eta, phi))->getMuonReadoutElement(roe)); // has to be an MDT
128  if (mdtRE) initDeadChannels(mdtRE);
129  }
130  }
131  }
132  }
133  } else if (m_useNewGeo) {
134  std::vector<const MuonGMR4::MdtReadoutElement*> mdtRE = m_detMgrR4->getAllMdtReadoutElements();
135  for (const MuonGMR4::MdtReadoutElement* re : mdtRE) {
136  if (re->stationName() != m_BMGid) {
137  continue;
138  }
139  for (IdentifierHash dead : re->getParameters().removedTubes) {
140  m_DeadChannels.insert(re->measurementId(dead));
141  }
142  }
143  }
144 
145  // check if initializing of DataHandle objects success
147  ATH_CHECK(m_mdtPrepDataContainerKey.initialize());
150  ATH_CHECK(m_mdtxAODKey.initialize(!m_mdtxAODKey.empty()));
152  return StatusCode::SUCCESS;
153  }
154 
155  StatusCode MdtRdoToPrepDataToolMT::decode(const EventContext& ctx, const std::vector<uint32_t>& robIds) const {
157  const MuonMDT_CablingMap* readCdo{*readHandle};
158  if (!readCdo) {
159  ATH_MSG_ERROR("nullptr to the read conditions object");
160  return StatusCode::FAILURE;
161  }
162  return decode(ctx, readCdo->getMultiLayerHashVec(robIds, msgStream()));
163  }
164 
165  const MdtCsmContainer* MdtRdoToPrepDataToolMT::getRdoContainer(const EventContext& ctx) const {
166  SG::ReadHandle<MdtCsmContainer> rdoContainerHandle{m_rdoContainerKey, ctx};
167  if (rdoContainerHandle.isValid()) {
168  ATH_MSG_DEBUG("MdtgetRdoContainer success");
169  return rdoContainerHandle.cptr();
170  }
171  ATH_MSG_WARNING("Retrieval of Mdt RDO container failed !");
172  return nullptr;
173  }
174 
176  return setupMdtPrepDataContainer(ctx).isValid ? StatusCode::SUCCESS : StatusCode::FAILURE;
177  }
178 
179  void MdtRdoToPrepDataToolMT::processPRDHashes(const EventContext& ctx, ConvCache& mdtPrepDataContainer,
180  const std::vector<IdentifierHash>& multiLayerHashInRobs) const {
181  for (const IdentifierHash& hash : multiLayerHashInRobs) {
182  if (!handlePRDHash(ctx, mdtPrepDataContainer, hash)) { ATH_MSG_DEBUG("Failed to process hash " << hash); }
183  } // ends loop over chamberhash
184  }
185 
186  bool MdtRdoToPrepDataToolMT::handlePRDHash(const EventContext& ctx,
187  ConvCache& mdtPrepDataContainer,
188  IdentifierHash rdoHash) const {
189  const MdtCsmContainer* rdoContainer{getRdoContainer(ctx)};
190 
191  if (rdoContainer->empty()) {
192  ATH_MSG_DEBUG("The container is empty");
193  return true;
194  }
195  const MdtCsm* rdoColl = rdoContainer->indexFindPtr(rdoHash);
196  if (!rdoColl) {
197  ATH_MSG_DEBUG("The rdo container does not have the hash " << rdoHash);
198  return true;
199  }
200  if (processCsm(ctx, mdtPrepDataContainer, rdoColl).isFailure()) {
201  ATH_MSG_WARNING("processCsm failed for RDO id " << m_idHelperSvc->toString(rdoColl->identify()));
202  return false;
203  }
204  return true;
205  }
206 
207  StatusCode MdtRdoToPrepDataToolMT::decode(const EventContext& ctx,
208  const std::vector<IdentifierHash>& idVect) const {
209 
210  ATH_MSG_DEBUG("decodeMdtRDO for " << idVect.size() << " offline collections called");
211 
212  // setup output container
213  ConvCache mdtPrepDataContainer = setupMdtPrepDataContainer(ctx);
214  if (!mdtPrepDataContainer.isValid) {
215  return StatusCode::FAILURE;
216  }
217 
218 
219  if (!m_decodeData) {
220  ATH_MSG_DEBUG("Stored empty container. Decoding MDT RDO into MDT PrepRawData is switched off");
221  return StatusCode::SUCCESS;
222  }
223  // seeded or unseeded decoding
224  if (!idVect.empty()) {
225  processPRDHashes(ctx, mdtPrepDataContainer, idVect);
226  } else {
228  std::vector<IdentifierHash> rdoHashes{};
229  const MdtCsmContainer* rdoContainer = getRdoContainer(ctx);
230  if (!rdoContainer || rdoContainer->empty()) return StatusCode::SUCCESS;
231  rdoHashes.reserve(rdoContainer->size());
232  for (const MdtCsm* csm : *rdoContainer) rdoHashes.push_back(csm->identifyHash());
233 
234  processPRDHashes(ctx, mdtPrepDataContainer, rdoHashes);
235  }
236  ATH_CHECK(mdtPrepDataContainer.finalize(msgStream()));
237 
238  return StatusCode::SUCCESS;
239  }
240 
241  std::unique_ptr<MdtPrepData> MdtRdoToPrepDataToolMT::createPrepData(const MdtCalibInput& calibInput,
242  const MdtCalibOutput& calibOutput,
243  ConvCache& cache) const {
244  if (calibInput.isMasked() || calibInput.adc() < m_adcCut ||
246  ATH_MSG_VERBOSE("Do not create calib hit for "<<m_idHelperSvc->toString(calibInput.identify())<<
247  " because it's masked "<<(calibInput.isMasked() ? "si" : "no") <<", "
248  <<"adc: "<<calibInput.adc()<<" vs. "<<m_adcCut<<", calibration bailed out "
249  <<(calibOutput.status() == MdtDriftCircleStatus::MdtStatusUnDefined? "si": "no"));
250  return nullptr;
251  }
252  const MuonGM::MdtReadoutElement* descriptor = calibInput.legacyDescriptor();
253  if (!descriptor) {
254  if (!cache.legacyDetMgr) {
255  return nullptr;
256  }
257  descriptor = cache.legacyDetMgr->getMdtReadoutElement(calibInput.identify());
258  }
259  ATH_MSG_VERBOSE("Calibrated prepdata "<<m_idHelperSvc->toString(calibInput.identify())
260  <<std::endl<<calibInput<<std::endl<<calibOutput);
261 
263  Amg::MatrixX cov(1, 1);
264  if (calibOutput.status() == MdtDriftCircleStatus::MdtStatusDriftTime){
266  const float r = calibOutput.driftRadius();
267  const float sigR = calibOutput.driftRadiusUncert();
268  driftRadius[0] = r;
269  (cov)(0, 0) = sigR * sigR;
270  } else (cov)(0, 0) = 0;
271 
272  return std::make_unique<MdtPrepData>(calibInput.identify(),
273  descriptor->identifyHash(),
274  std::move(driftRadius),
275  std::move(cov),
276  descriptor,
277  calibInput.tdc(),
278  calibInput.adc(),
279  calibOutput.status());
280  }
281 
283  const MdtCalibOutput& calibOutput,
284  xAOD::MdtDriftCircleContainer* xAODMdtPrepDataContainer) const {
285 
286  if (!xAODMdtPrepDataContainer || !calibInput.decriptor() || calibInput.isMasked() ||
287  calibInput.adc() < m_adcCut || calibOutput.status() == MdtDriftCircleStatus::MdtStatusUnDefined) {
288  ATH_MSG_VERBOSE("Do not create calib hit for "
289  << m_idHelperSvc->toString(calibInput.identify())
290  << " because it's masked " << (calibInput.isMasked() ? "si" : "no")
291  << ", " << "adc: " << calibInput.adc() << " vs. " << m_adcCut
292  << ", calibration bailed out " << (calibOutput.status() == MdtDriftCircleStatus::MdtStatusUnDefined ? "si": "no"));
293  return;
294  }
295  ATH_MSG_VERBOSE("Calibrated xAOD prepdata "<< m_idHelperSvc->toString(calibInput.identify()) << std::endl
296  << calibInput << std::endl << calibOutput);
297 
300 
301  if (calibOutput.status() == MdtDriftCircleStatus::MdtStatusDriftTime) {
303  const float r = calibOutput.driftRadius();
304  const float sigR = calibOutput.driftRadiusUncert();
305  driftRadius[0] = r;
306  (cov)(0, 0) = sigR * sigR;
307  } else
308  (cov)(0, 0) = 0;
309 
310  auto xprd = new xAOD::MdtDriftCircle();
311  xAODMdtPrepDataContainer->push_back(xprd);
312 
313  const MdtIdHelper& id_helper{m_idHelperSvc->mdtIdHelper()};
314 
315  const Identifier prdId{calibInput.identify()};
316  xprd->setIdentifier(calibInput.identify().get_compact());
317 
318  xprd->setMeasurement(calibInput.decriptor()
319  ? calibInput.decriptor()->identHash()
320  : calibInput.legacyDescriptor()->identifyHash(), driftRadius, cov);
321 
322  xprd->setTdc(calibInput.tdc());
323  xprd->setAdc(calibInput.adc());
324  xprd->setTube(id_helper.tube(prdId));
325  xprd->setLayer(id_helper.tubeLayer(prdId));
326  xprd->setStatus(calibOutput.status());
327  xprd->setReadoutElement(calibInput.decriptor());
328  return;
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  // two chambers in ATLAS are installed with Twin Tubes; in detector coordinates BOL4A13 & BOL4C13; only INNER multilayer(=1) is
336  // with twin tubes implement twin tube writing to prepData either for all BOL (m_useAllBOLTwin = true) _OR_ only for two
337  // chambers really installed
338  Identifier elementId = rdoColl->identify();
339  MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(elementId);
340  if (chIndex == MuonStationIndex::BOL &&
341  (m_useAllBOLTwin || (std::abs(id_helper.stationEta(elementId)) == 4 && id_helper.stationPhi(elementId) == 7))) {
342  return processCsmTwin(ctx, cache, rdoColl);
343  }
344  }
345 
346  ATH_MSG_DEBUG(" ***************** Start of processCsm");
347 
349  const Identifier elementId = id_helper.parentID(rdoColl->identify());
350 
351  uint16_t subdetId = rdoColl->SubDetId();
352  uint16_t mrodId = rdoColl->MrodId();
353  uint16_t csmId = rdoColl->CsmId();
354  ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toString(elementId) << " subdetId/ mrodId/ csmId = " << subdetId << " / "
355  << mrodId << " / " << csmId);
356 
357  // for each Csm, loop over AmtHit, converter AmtHit to digit
358  // retrieve/create digit collection, and insert digit into collection
359  int mc = 0;
360  for (const MdtAmtHit* amtHit : *rdoColl) {
361  mc++;
362 
363  // FIXME: Still use the digit class.
364  ATH_MSG_VERBOSE("Amt Hit n. " << mc << " tdcId = " << amtHit->tdcId());
365  std::unique_ptr<MdtDigit> newDigit{m_mdtDecoder->getDigit(amtHit, subdetId, mrodId, csmId)};
366  if (!newDigit) {
367  ATH_MSG_WARNING("Found issue MDT RDO decoder for subdetId/mrodId/csmId "
368  << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
369  << amtHit->tdcId());
370  continue;
371  }
372  // Do something with it
373  Identifier channelId = newDigit->identify();
374  if (m_DeadChannels.count(channelId)) continue;
375 
376  // Retrieve the proper PRD container. Note that there are cases where one CSM is either split into 2 chambers (BEE / BIS78
377  // legacy) or 2 CSMs are split into one chamber
378  MdtPrepDataCollection* driftCircleColl = cache.createCollection(channelId, msgStream());
379  if (!driftCircleColl) {
380  ATH_MSG_DEBUG("Corresponding multi layer " << m_idHelperSvc->toString(channelId) << " is already decoded.");
381  continue;
382  }
383 
384  // check if the module ID of this channel is different from the CSM one
385  // If it's the first case, create the additional collection
386 
387  ATH_MSG_VERBOSE("got digit with id ext / hash " << m_idHelperSvc->toString(channelId) << " / "
388  << driftCircleColl->identifyHash());
389 
390  // Rescale ADC/TDC of chambers using HPTDC digitization chip
391  // Must create a new digit from the old one, because MdtDigit has no methods to set ADC/TDC
392  if (m_idHelperSvc->hasHPTDC(channelId)) {
393  int adc = newDigit->adc() / 4;
394  int tdc = newDigit->tdc() / 4;
395  int mask = newDigit->is_masked();
396  newDigit = std::make_unique<MdtDigit>(channelId, tdc, adc, mask);
397  ATH_MSG_DEBUG("Change HPTDC ADC/TDC " << m_idHelperSvc->toString(channelId) << " Old ADC/TDC=" << adc * 4 << " " << tdc * 4
398  << " New=" << adc << " " << tdc);
399  }
400  const MdtCalibInput calibIn = m_useNewGeo ? MdtCalibInput{*newDigit, *m_detMgrR4, *cache.gctx}:
401  MdtCalibInput{*newDigit, *cache.legacyDetMgr};
402  const MdtCalibOutput calibResult{m_calibrationTool->calibrate(ctx, calibIn, false)};
403 
404  std::unique_ptr<MdtPrepData> newPrepData = createPrepData(calibIn, calibResult, cache);
405  if (newPrepData) {
406  newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
407  driftCircleColl->push_back(std::move(newPrepData));
408  }
409  createxAODPrepData(calibIn, calibResult, cache.xAODPrd);
410  }
411  return StatusCode::SUCCESS;
412  }
413  StatusCode MdtRdoToPrepDataToolMT::processCsmTwin(const EventContext& ctx, ConvCache& cache, const MdtCsm* rdoColl) const {
414  const MdtIdHelper& id_helper = m_idHelperSvc->mdtIdHelper();
415  ATH_MSG_DEBUG(" ***************** Start of processCsmTwin");
416  ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size());
418  Identifier elementId = id_helper.parentID(rdoColl->identify());
419 
420  uint16_t subdetId = rdoColl->SubDetId();
421  uint16_t mrodId = rdoColl->MrodId();
422  uint16_t csmId = rdoColl->CsmId();
423  ATH_MSG_VERBOSE("Identifier = " << m_idHelperSvc->toString(elementId) << " subdetId/ mrodId/ csmId = " << rdoColl->SubDetId()
424  << " / " << rdoColl->MrodId() << " / " << rdoColl->CsmId());
425 
426  // for each Csm, loop over AmtHit, converter AmtHit to digit
427  // retrieve/create digit collection, and insert digit into collection
428 
429  // make a map to be filled for every twin-pair
430  // std::map<int, std::vector<MdtDigit*> > mdtDigitColl;
431 
432  using twin_digit = std::pair<std::unique_ptr<MdtDigit>, std::unique_ptr<MdtDigit>>;
433  std::map<int, twin_digit> mdtDigitColl;
434 
435  for (const MdtAmtHit* amtHit : *rdoColl) {
436  std::unique_ptr<MdtDigit> newDigit{m_mdtDecoder->getDigit(amtHit, subdetId, mrodId, csmId)};
437 
438  if (!newDigit) {
439  ATH_MSG_WARNING("Error in MDT RDO decoder for subdetId/mrodId/csmId "
440  << subdetId << "/" << mrodId << "/" << csmId << " amtHit channelId/tdcId =" << amtHit->channelId() << "/"
441  << amtHit->tdcId());
442  continue;
443  }
444 
445  // make an Identifier
446  Identifier channelId = newDigit->identify();
447 
448  // get tube params
449  int tube = id_helper.tube(channelId);
450  int layer = id_helper.tubeLayer(channelId);
451  int multilayer = id_helper.multilayer(channelId);
452 
453  // find the correct twin-pair (tube-1 & tube-3 are twin pair 1, tube-2 & tube-4 are twin pair 2)
454  int twinPair = -1;
455  if (tube % 4 == 1) {
456  twinPair = (tube + 1) / 2;
457  } else if (tube % 4 == 3) {
458  twinPair = (tube - 1) / 2;
459  } else if (tube % 4 == 2) {
460  twinPair = (tube + 2) / 2;
461  } else {
462  twinPair = tube / 2;
463  } // tube%4 == 0
464 
465  // fill the digitColl map
466  twin_digit& pair = mdtDigitColl[m_twin_chamber[multilayer - 1][layer - 1][twinPair - 1]];
467  if (!pair.first) {
468  pair.first = std::move(newDigit);
469  } else if (!pair.second) {
470  pair.second = std::move(newDigit);
471  }
472  // if a secondary hit appears in a tube add it to mdtDigitColl, unless m_discardSecondaryHitTwin flag is true
473  else {
474  ATH_MSG_VERBOSE(" TWIN TUBES: found a secondary(not twin) hit in a twin tube");
475  twin_digit& secondPair = mdtDigitColl[m_secondaryHit_twin_chamber[multilayer - 1][layer - 1][twinPair - 1]];
477  if (!secondPair.first) {
478  secondPair.first = std::move(newDigit);
479  } else if (!secondPair.second) {
480  secondPair.second = std::move(newDigit);
481  } else {
482  ATH_MSG_VERBOSE(" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
483  << m_idHelperSvc->toString(channelId) << " with adc = " << newDigit->adc()
484  << " tdc = " << newDigit->tdc());
485  }
486  } // end -- if(!m_discardSecondaryHitTwin){
487  else {
488  ATH_MSG_DEBUG(" TWIN TUBES: discarding secondary(non-twin) hit in a twin tube as flag m_discardSecondaryHitTwin is set to true");
489  }
490  }
491  } // end for-loop over rdoColl
492 
493  // iterate over mdtDigitColl
494  for (std::pair<const int, twin_digit>& digitPair : mdtDigitColl) {
495  // get the twin hits from mdtDigitColl
496  std::unique_ptr<MdtDigit>& digit = digitPair.second.first;
497  std::unique_ptr<MdtDigit>& second_digit = digitPair.second.second;
498 
499  if (!digit) {
500  ATH_MSG_FATAL("nullptr to a digit ");
501  return StatusCode::FAILURE;
502  }
503 
504  // Do something with it
505  Identifier channelId = digit->identify();
506  int multilayer = id_helper.multilayer(channelId);
507 
508  MdtPrepDataCollection* driftCircleColl = cache.createCollection(channelId, msgStream());
509  if (!driftCircleColl) {
510  ATH_MSG_DEBUG("Corresponding multi layer " << m_idHelperSvc->toString(channelId) << " is already decoded.");
511  continue;
512  }
513 
514  // check if the hit is in multilayer=1
515  // two chambers in ATLAS are installed with Twin Tubes; in detector coordinates BOL4A13 & BOL4C13; only INNER multilayer(=1) is
516  // with twin tubes
517  if (multilayer == 1) {
518  // if no twin hit present in data, use standard PRD making
519  if (!second_digit) {
520  ATH_MSG_VERBOSE("got digit with id ext / hash " << m_idHelperSvc->toString(channelId) << " / "
521  << driftCircleColl->identifyHash());
522 
523  const MdtCalibInput mdtCalibIn = m_useNewGeo ? MdtCalibInput{*digit, *m_detMgrR4, *cache.gctx}:
524  MdtCalibInput{*digit, *cache.legacyDetMgr};
525 
526  const MdtCalibOutput mdtCalibOut{m_calibrationTool->calibrate(ctx, mdtCalibIn, false)};
527 
528  // Create new PrepData
529  std::unique_ptr<MdtPrepData> newPrepData = createPrepData(mdtCalibIn, mdtCalibOut, cache);
530  if (newPrepData) {
531  newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
532  driftCircleColl->push_back(std::move(newPrepData));
533 
534  }
535  createxAODPrepData(mdtCalibIn, mdtCalibOut, cache.xAODPrd);
536  ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_idHelperSvc->toString(channelId) << " " << mdtCalibOut);
537  continue;
538  }
539  if (digit->is_masked() || second_digit->is_masked()) {
540  continue;
541  }
542  MdtCalibInput mdtCalib1st = m_useNewGeo ? MdtCalibInput{*digit, *m_detMgrR4, *cache.gctx}
543  : MdtCalibInput{*digit, *cache.legacyDetMgr};
544 
545  MdtCalibInput mdtCalib2nd = m_useNewGeo ? MdtCalibInput{*second_digit, *m_detMgrR4, *cache.gctx}
546  : MdtCalibInput{*second_digit, *cache.legacyDetMgr};
547 
548  updateClosestApproachTwin(mdtCalib1st);
549  updateClosestApproachTwin(mdtCalib2nd);
550 
551  const MdtCalibTwinOutput twinCalib = m_calibrationTool->calibrateTwinTubes(ctx, mdtCalib1st, mdtCalib2nd);
552 
553  Amg::Vector2D hitPos{twinCalib.primaryDriftR(), twinCalib.locZ()};
554  Amg::MatrixX cov(2, 2);
555  (cov)(0, 0) = twinCalib.uncertPrimaryR() * twinCalib.uncertPrimaryR();
556  (cov)(1, 1) = twinCalib.sigmaZ() * twinCalib.sigmaZ();
557  (cov)(0, 1) = 0;
558  (cov)(1, 0) = 0;
559 
560  const MuonGM::MdtReadoutElement* descriptor = cache.legacyDetMgr->getMdtReadoutElement(mdtCalib1st.identify());
561  std::unique_ptr<MdtTwinPrepData> twin_newPrepData = std::make_unique<MdtTwinPrepData>(twinCalib.primaryID(),
562  descriptor->identifyHash(),
563  std::move(hitPos),
564  std::move(cov),
565  descriptor,
566  twinCalib.primaryTdc(),
567  twinCalib.primaryAdc(),
568  twinCalib.twinTdc(),
569  twinCalib.twinAdc(),
570  twinCalib.primaryStatus());
571 
572  ATH_MSG_DEBUG(" MADE A 2D TWINPREPDATA " << m_idHelperSvc->toString(twinCalib.primaryID()) << " & "
573  << m_idHelperSvc->toString(twinCalib.twinID()) << " "<<twinCalib);
574  Amg::Vector3D gpos_centertube = twin_newPrepData->globalPosition();
575 
576  Amg::Vector3D locpos_centertube = twinCalib.locZ() * Amg::Vector3D::UnitZ();
577  const Amg::Vector3D gpos_twin = descriptor->localToGlobalTransf(twinCalib.primaryID())*locpos_centertube;
578 
579  ATH_MSG_DEBUG("global pos center tube " << Amg::toString(gpos_centertube, 2) << std::endl
580  <<"local pos center tube w/ TWIN INFO "<<Amg::toString(locpos_centertube, 2)<<std::endl
581  <<"global pos w/ TWIN INFO "<<Amg::toString(gpos_twin));
582 
583  twin_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
584  driftCircleColl->push_back(std::move(twin_newPrepData));
585 
586 
587  } else {
588  // if multilayer=2, then treat every hit as a separate hit, no twin hit should be present here as the hardware is not
589  // installed
590 
591  const MdtCalibInput calibInput1st = m_useNewGeo ? MdtCalibInput{*digit, *m_detMgrR4, *cache.gctx}
592  : MdtCalibInput{*digit, *cache.legacyDetMgr};
593  const MdtCalibOutput calibResult1st{m_calibrationTool->calibrate(ctx, calibInput1st, false)};
594  // Create new PrepData
595  std::unique_ptr<MdtPrepData> newPrepData = createPrepData(calibInput1st, calibResult1st, cache);
596  if (newPrepData) {
597  newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
598  driftCircleColl->push_back(std::move(newPrepData));
599  ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA " << m_idHelperSvc->toString(channelId) << " "<<calibResult1st);
600  }
601  createxAODPrepData(calibInput1st, calibResult1st, cache.xAODPrd);
602 
603  if (!second_digit) continue;
604  // Calculate radius
605 
606  const MdtCalibInput calibInput2nd = m_useNewGeo ? MdtCalibInput{*second_digit, *m_detMgrR4, *cache.gctx}
607  : MdtCalibInput{*second_digit, *cache.legacyDetMgr};
608  const MdtCalibOutput calibResult2nd{m_calibrationTool->calibrate(ctx, calibInput2nd, false)};
609 
610  // second_digit
611  // Create new PrepData
612  std::unique_ptr<MdtPrepData> second_newPrepData = createPrepData(calibInput2nd, calibResult2nd, cache);
613  if (second_newPrepData) {
614  second_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
615  driftCircleColl->push_back(std::move(second_newPrepData));
616  }
617  createxAODPrepData(calibInput2nd, calibResult2nd, cache.xAODPrd);
618 
619  // second_digit
620  ATH_MSG_DEBUG(" MADE ORIGINAL PREPDATA FOR SECOND DIGIT "
621  << m_idHelperSvc->toString(calibInput2nd.identify())
622  << " "<<calibResult2nd);
623 
624  }
625  }
626  return StatusCode::SUCCESS;
627  }
629  PVConstLink cv = mydetEl->getMaterialGeom(); // it is "Multilayer"
630  int nGrandchildren = cv->getNChildVols();
631  if (nGrandchildren <= 0) return;
632 
633  std::vector<int> tubes;
634  geoGetIds([&](int id) { tubes.push_back(id); }, &*cv);
635  std::sort(tubes.begin(), tubes.end());
636 
637  const Identifier detElId = mydetEl->identify();
638  const int ml = mydetEl->getMultilayer();
639  std::vector<int>::iterator it = tubes.begin();
640  for (int layer = 1; layer <= mydetEl->getNLayers(); layer++) {
641  for (int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++) {
642  int want_id = layer * maxNTubesPerLayer + tube;
643  if (it != tubes.end() && *it == want_id) {
644  ++it;
645  } else {
646  it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
647  if (it != tubes.end() && *it == want_id) {
648  ++it;
649  } else {
650  Identifier deadTubeId = m_idHelperSvc->mdtIdHelper().channelID(detElId, ml, layer, tube);
651  m_DeadChannels.insert(deadTubeId);
652  ATH_MSG_VERBOSE("adding dead tube "<<m_idHelperSvc->toString(deadTubeId));
653  }
654  }
655  }
656  }
657 
658  }
660 
661  ConvCache cache{m_idHelperSvc.get()};
662 
664  // Caching of PRD container
665  if (m_prdContainerCacheKey.key().empty()) {
666  // without the cache we just record the container
667  StatusCode status = handle.record(std::make_unique<MdtPrepDataContainer>(m_idHelperSvc->mdtIdHelper().module_hash_max()));
668  if (status.isFailure() || !handle.isValid()) {
669  ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key());
670  return cache;
671  }
672  ATH_MSG_VERBOSE("Created container " << m_mdtPrepDataContainerKey.key());
673  cache.legacyPrd = handle.ptr();
674  } else {
675  // use the cache to get the container
677  if (!update.isValid()) {
678  ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
679  return cache;
680  }
681  StatusCode status = handle.record(std::make_unique<MdtPrepDataContainer>(update.ptr()));
682  if (status.isFailure() || !handle.isValid()) {
683  ATH_MSG_FATAL("Could not record container of MDT PrepData Container using cache " << m_prdContainerCacheKey.key() << " - "
684  << m_mdtPrepDataContainerKey.key());
685  return cache;
686  }
687  ATH_MSG_VERBOSE("Created container using cache for " << m_prdContainerCacheKey.key());
688  cache.legacyPrd = handle.ptr();
689  }
690  if (!m_mdtxAODKey.empty()) {
692  if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtDriftCircleContainer>(),
693  std::make_unique<xAOD::MdtDriftCircleAuxContainer>()).isSuccess() ||
694  !writeHandle.isValid()) {
695  ATH_MSG_FATAL("Failed to write xAOD::MdtPrepDataContainer "<<m_mdtxAODKey.fullKey());
696  return cache;
697  }
698  cache.xAODPrd = writeHandle.ptr();
699  }
701  if (!m_geoCtxKey.empty()) {
703  if (!readHandle.isPresent()) {
704  ATH_MSG_FATAL("Failed to retrieve the geometry context "<<m_geoCtxKey.fullKey());
705  return cache;
706  }
707  cache.gctx = readHandle.cptr();
708  }
710  if (!m_muDetMgrKey.empty()) {
712  if (!detMgrHandle.isValid()) {
713  ATH_MSG_FATAL("Failed to retrieve the detector manager from the conditions store "<<m_muDetMgrKey.fullKey());
714  return cache;
715  }
716  cache.legacyDetMgr = detMgrHandle.cptr();
717  }
718  // Pass the container from the handle
719  cache.isValid = true;
720  return cache;
721  }
722 } // namespace Muon
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MdtCalibInput::tdc
int tdc() const
Returns the tdc counts of the hit.
Definition: MdtCalibInput.cxx:63
MdtIdHelper::multilayer
int multilayer(const Identifier &id) const
Access to components of the ID.
Definition: MdtIdHelper.cxx:722
beamspotman.r
def r
Definition: beamspotman.py:676
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:126
MdtReadoutElement.h
MdtCalibInput::decriptor
const MuonGMR4::MdtReadoutElement * decriptor() const
Returns the R4 readout element.
Definition: MdtCalibInput.cxx:66
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
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:29
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
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
Muon::MdtRdoToPrepDataToolMT::ConvCache::createCollection
MdtPrepDataCollection * createCollection(const Identifier &id, MsgStream &msg)
Creates a new MdtPrepDataCollection, if it's neccessary and also possible.
Definition: MdtRdoToPrepDataToolMT.cxx:47
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:27
MdtRDO_Decoder.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MdtCalibTwinOutput::twinAdc
int twinAdc() const
Definition: MdtCalibTwinOutput.cxx:37
MdtCalibInput::legacyDescriptor
const MuonGM::MdtReadoutElement * legacyDescriptor() const
Returns the legacy readout element.
Definition: MdtCalibInput.cxx:65
Muon::MdtRdoToPrepDataToolMT::createPrepData
std::unique_ptr< MdtPrepData > createPrepData(const MdtCalibInput &calibInput, const MdtCalibOutput &calibOutput, ConvCache &cache) const
Creates the PRD object.
Definition: MdtRdoToPrepDataToolMT.cxx:241
MdtCalibInput::isMasked
bool isMasked() const
Returns whether the constructing digit has been masked.
Definition: MdtCalibInput.cxx:67
Muon::MdtRdoToPrepDataToolMT::m_mdtxAODKey
SG::WriteHandleKey< xAOD::MdtDriftCircleContainer > m_mdtxAODKey
Definition: MdtRdoToPrepDataToolMT.h:172
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Muon::MdtRdoToPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< MdtCsmContainer > m_rdoContainerKey
Definition: MdtRdoToPrepDataToolMT.h:136
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
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
MdtCalibTwinOutput::sigmaZ
double sigmaZ() const
Definition: MdtCalibTwinOutput.cxx:49
MdtIdHelper::tubeLayer
int tubeLayer(const Identifier &id) const
Definition: MdtIdHelper.cxx:724
MdtCalibTwinOutput::twinTdc
int twinTdc() const
Definition: MdtCalibTwinOutput.cxx:38
Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODPrd
xAOD::MdtDriftCircleContainer * xAODPrd
Definition: MdtRdoToPrepDataToolMT.h:76
Muon::MdtRdoToPrepDataToolMT::provideEmptyContainer
virtual StatusCode provideEmptyContainer(const EventContext &ctx) const override
Definition: MdtRdoToPrepDataToolMT.cxx:175
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition: MdtCsmContainer.h:22
MdtDriftCircleAuxContainer.h
IdentifiableContainerMT::IDC_WriteHandle::alreadyPresent
bool alreadyPresent()
Definition: IdentifiableContainerMT.h:62
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
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
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
GeoGetIds.h
Visitor to collect all IDs under a GeoModel node.
MdtCalibTwinOutput::uncertPrimaryR
double uncertPrimaryR() const
Definition: MdtCalibTwinOutput.cxx:52
MdtDigit::is_masked
bool is_masked() const
Definition: MdtDigit.h:56
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:62
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:140
Muon::MdtRdoToPrepDataToolMT::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: MdtRdoToPrepDataToolMT.h:130
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
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:247
TRT::Hit::side
@ side
Definition: HitInfo.h:83
Muon::MdtRdoToPrepDataToolMT::m_mdtPrepDataContainerKey
SG::WriteHandleKey< Muon::MdtPrepDataContainer > m_mdtPrepDataContainerKey
MdtPrepRawData containers.
Definition: MdtRdoToPrepDataToolMT.h:134
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:207
MdtCsm::MrodId
uint16_t MrodId() const
Returns the MROD id from the CSM header.
Definition: MdtCsm.h:59
MuonMDT_CablingMap
Definition: MuonMDT_CablingMap.h:24
Muon::MdtRdoToPrepDataToolMT::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: MdtRdoToPrepDataToolMT.cxx:83
xAOD::MdtDriftCircle
MdtDriftCircle_v1 MdtDriftCircle
Defined the version of the MdtDriftCircle.
Definition: MdtDriftCircle.h:12
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:129
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::MdtRdoToPrepDataToolMT::m_useTwin
Gaudi::Property< bool > m_useTwin
Definition: MdtRdoToPrepDataToolMT.h:152
MdtTwinPrepData.h
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:204
CxxUtils::sincos::cs
double cs
Definition: sincos.h:95
MdtCalibInput::adc
int adc() const
Returns the amount of accumulated charge.
Definition: MdtCalibInput.cxx:64
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:50
Muon::MdtRdoToPrepDataToolMT::setupMdtPrepDataContainer
ConvCache setupMdtPrepDataContainer(const EventContext &ctx) const
Creates the prep data container to be written.
Definition: MdtRdoToPrepDataToolMT.cxx:659
Muon::MdtRdoToPrepDataToolMT::processCsmTwin
StatusCode processCsmTwin(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColll) const
Definition: MdtRdoToPrepDataToolMT.cxx:413
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
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
Muon::MdtRdoToPrepDataToolMT::m_useAllBOLTwin
Gaudi::Property< bool > m_useAllBOLTwin
Definition: MdtRdoToPrepDataToolMT.h:153
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:59
Muon::MdtRdoToPrepDataToolMT::m_BMGpresent
bool m_BMGpresent
Definition: MdtRdoToPrepDataToolMT.h:148
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
MdtIdHelper
Definition: MdtIdHelper.h:61
MdtIdHelper::tube
int tube(const Identifier &id) const
Definition: MdtIdHelper.cxx:726
Muon::MdtRdoToPrepDataToolMT::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition: MdtRdoToPrepDataToolMT.h:163
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::MdtRdoToPrepDataToolMT::initDeadChannels
void initDeadChannels(const MuonGM::MdtReadoutElement *mydetEl)
Definition: MdtRdoToPrepDataToolMT.cxx:628
MdtCalibTwinOutput::locZ
double locZ() const
Definition: MdtCalibTwinOutput.cxx:48
Muon::MdtRdoToPrepDataToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtRdoToPrepDataToolMT.h:120
Muon::MdtRdoToPrepDataToolMT::getRdoContainer
const MdtCsmContainer * getRdoContainer(const EventContext &ctx) const
Loads the input RDO container from StoreGate.
Definition: MdtRdoToPrepDataToolMT.cxx:165
MdtCalibInput::setClosestApproach
void setClosestApproach(const Amg::Vector3D &approach)
Sets the closest approach.
Definition: MdtCalibInput.cxx:70
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
MuonGMR4::MuonReadoutElement::identHash
IdentifierHash identHash() const
Returns the Identifier has of the Element that is Identical to the detElHash from the id_helper class...
MuonGM::MdtReadoutElement::localToGlobalTransf
const Amg::Transform3D & localToGlobalTransf(const Identifier &id) const
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:122
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MdtRdoToPrepDataToolMT.h
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:52
Muon::MdtRdoToPrepDataToolMT::ConvCache::gctx
const ActsGeometryContext * gctx
Acts Geometry context.
Definition: MdtRdoToPrepDataToolMT.h:82
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:814
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
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:19
Muon::MdtRdoToPrepDataToolMT::m_discardSecondaryHitTwin
Gaudi::Property< bool > m_discardSecondaryHitTwin
Definition: MdtRdoToPrepDataToolMT.h:155
SG::UpdateHandle
Definition: UpdateHandle.h:94
Muon::MdtRdoToPrepDataToolMT::m_twin_chamber
int m_twin_chamber[2][3][36]
Definition: MdtRdoToPrepDataToolMT.h:156
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
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:809
Muon::MdtRdoToPrepDataToolMT::handlePRDHash
bool handlePRDHash(const EventContext &ctx, ConvCache &mdtPrepDataContainer, IdentifierHash rdoHash) const
Definition: MdtRdoToPrepDataToolMT.cxx:186
Muon::MdtRdoToPrepDataToolMT::ConvCache::finalize
StatusCode finalize(MsgStream &msg)
Copy the non-empty collections into the created prd container.
Definition: MdtRdoToPrepDataToolMT.cxx:67
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
IdentifiableContainerMT::IDC_WriteHandle::addOrDelete
StatusCode addOrDelete(std::unique_ptr< T > ptr)
Definition: IdentifiableContainerMT.h:56
Muon::MdtRdoToPrepDataToolMT::m_BMGid
int m_BMGid
Definition: MdtRdoToPrepDataToolMT.h:149
MdtCalibOutput::driftRadiusUncert
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
Definition: MdtCalibOutput.cxx:20
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
MuonGM::MuonDetectorManager::getMuonStation
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:137
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
dqt_zlumi_pandas.update
update
Definition: dqt_zlumi_pandas.py:42
Muon::MdtRdoToPrepDataToolMT::ConvCache::isValid
bool isValid
Flag set to indicate that the complete validation was successful.
Definition: MdtRdoToPrepDataToolMT.h:85
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:109
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
re
const boost::regex re(r_e)
DEBUG
#define DEBUG
Definition: page_access.h:11
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
MdtCalibTwinOutput::primaryAdc
int primaryAdc() const
Definition: MdtCalibTwinOutput.cxx:34
GeoPrimitivesToStringConverter.h
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:76
Muon::MdtRdoToPrepDataToolMT::m_calibrationTool
ToolHandle< IMdtCalibrationTool > m_calibrationTool
MDT calibration service.
Definition: MdtRdoToPrepDataToolMT.h:123
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
Muon::MdtRdoToPrepDataToolMT::processPRDHashes
void processPRDHashes(const EventContext &ctx, ConvCache &mdtPrepDataContainer, const std::vector< IdentifierHash > &chamberHashInRobs) const
Definition: MdtRdoToPrepDataToolMT.cxx:179
Muon::MdtStatusUnDefined
@ MdtStatusUnDefined
Undefined.
Definition: MdtDriftCircleStatus.h:43
Muon::MdtRdoToPrepDataToolMT::createxAODPrepData
void createxAODPrepData(const MdtCalibInput &calibInput, const MdtCalibOutput &calibOutput, xAOD::MdtDriftCircleContainer *xAODMdtPrepDataContainer) const
Creates the xAOD PRD object.
Definition: MdtRdoToPrepDataToolMT.cxx:282
MdtCalibTwinOutput::primaryDriftR
double primaryDriftR() const
Definition: MdtCalibTwinOutput.cxx:50
MdtCalibTwinOutput::primaryID
Identifier primaryID() const
Definition: MdtCalibTwinOutput.cxx:40
merge.status
status
Definition: merge.py:17
MuonGM::MuonReadoutElement::identifyHash
IdentifierHash identifyHash() const override final
Returns the IdentifierHash of the MuonStation, i.e.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:185
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:54
Muon::MdtRdoToPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of MDT RDO into MdtPrepData
Definition: MdtRdoToPrepDataToolMT.h:143
Muon::MdtRdoToPrepDataToolMT::m_mdtDecoder
ToolHandle< Muon::IMDT_RDO_Decoder > m_mdtDecoder
Definition: MdtRdoToPrepDataToolMT.h:146
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
Muon::MdtRdoToPrepDataToolMT::m_secondaryHit_twin_chamber
int m_secondaryHit_twin_chamber[2][3][36]
Definition: MdtRdoToPrepDataToolMT.h:157
Muon::MuonStationIndex::BOL
@ BOL
Definition: MuonStationIndex.h:17
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Muon::MdtRdoToPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: MdtRdoToPrepDataToolMT.h:165
calibdata.tube
tube
Definition: calibdata.py:31
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
fitman.k
k
Definition: fitman.py:528
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:168
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_DeadChannels
std::unordered_set< Identifier > m_DeadChannels
Definition: MdtRdoToPrepDataToolMT.h:160