ATLAS Offline Software
ReadoutGeomCnvAlg.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5 #include "ReadoutGeomCnvAlg.h"
6 
7 #include <GeoModelKernel/GeoVPhysVol.h>
11 #include <GeoModelKernel/GeoFullPhysVol.h>
12 
18 
19 
21 
25 
26 
33 
35 
37 #include <GaudiKernel/SystemOfUnits.h>
38 
39 #include <GeoModelHelpers/defineWorld.h>
40 #include <GeoModelHelpers/cloneVolume.h>
41 #include <GeoModelHelpers/getChildNodesWithTrf.h>
42 #include <GeoModelHelpers/TransformToStringConverter.h>
43 #include <GeoModelHelpers/GeoShapeUtils.h>
44 #include <map>
45 
46 #include <GaudiKernel/SystemOfUnits.h>
47 
48 
49 namespace {
50  using SubDetAlignment = ActsGeometryContext::AlignmentStorePtr;
51  bool hasStationVolume(const PVConstLink treeTop,
52  const std::set<PVConstLink>& translated) {
53  const unsigned int nCh = treeTop->getNChildVols();
54  for (unsigned int ch = 0 ; ch < nCh; ++ch) {
55  PVConstLink child = treeTop->getChildVol(ch);
56  if (translated.count(child) ||
57  hasStationVolume(child, translated)){
58  return true;
59  }
60  }
61  return false;
62  };
63 }
64 
65 namespace MuonGMR4{
66 ReadoutGeomCnvAlg::ReadoutGeomCnvAlg(const std::string& name, ISvcLocator* pSvcLocator):
67  AthReentrantAlgorithm{name, pSvcLocator} {}
68 
70  ATH_CHECK(m_idHelperSvc.retrieve());
72  ATH_CHECK(m_alignStoreKeys.initialize());
74  return StatusCode::SUCCESS;
75 }
76 
77 
78 StatusCode ReadoutGeomCnvAlg::execute(const EventContext& ctx) const {
80  if (writeHandle.isValid()) {
81  ATH_MSG_DEBUG("The current readout geometry is still valid.");
82  return StatusCode::SUCCESS;
83  }
84  writeHandle.addDependency(IOVInfiniteRange::infiniteRunLB());
86  ActsGeometryContext geoContext{};
87  using TrackingAlignment = ActsTrk::DetectorAlignStore::TrackingAlignStore;
90  if (!readHandle.isValid()) {
91  ATH_MSG_FATAL("Failed to retrieve alignment store "<<key.fullKey());
92  return StatusCode::FAILURE;
93  }
94  writeHandle.addDependency(readHandle);
95  auto alignStore = std::make_unique<ActsTrk::DetectorAlignStore>(**readHandle);
97  if (alignStore->geoModelAlignment) {
98  alignStore->geoModelAlignment->clearPosCache();
99  }
100  alignStore->trackingAlignment = std::make_unique<TrackingAlignment>(alignStore->detType);
101  geoContext.setStore(std::move(alignStore));
102  }
105  std::vector<ActsTrk::DetectorType> presentTechs = m_detMgr->getDetectorTypes();
106  for (const ActsTrk::DetectorType detType : presentTechs) {
107  if (geoContext.getStore(detType)) {
108  continue;
109  }
110  ATH_MSG_WARNING("No external detector alignment has been defined for technology "<<ActsTrk::to_string(detType));
111  geoContext.setStore(std::make_unique<ActsTrk::DetectorAlignStore>(detType));
112  }
114  ConstructionCache cacheObj;
115  cacheObj.detMgr = std::make_unique<MuonGM::MuonDetectorManager>();
116  cacheObj.world = createGeoWorld();
117  cacheObj.detMgr->addTreeTop(cacheObj.world);
119  ATH_CHECK(buildMdt(geoContext, cacheObj));
120  ATH_CHECK(buildTgc(geoContext, cacheObj));
121  ATH_CHECK(buildRpc(geoContext, cacheObj));
122  ATH_CHECK(buildSTGC(geoContext, cacheObj));
123  ATH_CHECK(buildMM(geoContext, cacheObj));
125  std::vector<GeoChildNodeWithTrf> treeTops = getChildrenWithRef(m_detMgr->getTreeTop(0), false);
126 
128  for (const GeoChildNodeWithTrf& treeTop : treeTops) {
129  if (hasStationVolume(treeTop.volume, cacheObj.translatedStations)) continue;
130  ATH_MSG_VERBOSE("Detected passive volume "<<treeTop.nodeName);
131 
132  cacheObj.world->add(const_pointer_cast(treeTop.volume));
133  }
134 
136  if (m_checkGeo) {
137  const std::vector<const MuonGMR4::MuonReadoutElement*> refEles{m_detMgr->getAllReadoutElements()};
138  for (const MuonGMR4::MuonReadoutElement* refEle : refEles) {
139  ATH_CHECK(checkIdCompability(*refEle, *cacheObj.detMgr->getReadoutElement(refEle->identify())));
140  }
141  }
142 
143  ATH_CHECK(writeHandle.record(std::move(cacheObj.detMgr)));
144  return StatusCode::SUCCESS;
145 }
147  const Identifier& stationId,
148  ConstructionCache& cacheObj) const {
149  const std::string stName{m_idHelperSvc->stationNameString(stationId)};
150  const int stEta{m_idHelperSvc->stationEta(stationId)};
151  const int stPhi{m_idHelperSvc->stationPhi(stationId)};
152  MuonGM::MuonStation* station = cacheObj.detMgr->getMuonStation(stName, stEta, stPhi);
153  if (station) {
154  ATH_MSG_DEBUG("Station "<<stName<<" "<<stEta<<" "<<stPhi<<" already exists.");
155  return StatusCode::SUCCESS;
156  }
158  const MuonGMR4::MuonReadoutElement* copyMe = m_detMgr->getReadoutElement(stationId);
159 
161  const GeoVFullPhysVol* readOutVol = copyMe->getMaterialGeom();
162  PVConstLink parentVolume = readOutVol->getParent();
163  cacheObj.translatedStations.insert(parentVolume);
165  PVLink parentPhysVol{make_intrusive<GeoFullPhysVol>(parentVolume->getLogVol())};
166 
169  const std::vector<GeoChildNodeWithTrf> children = getChildrenWithRef(parentVolume, false);
170  double minX{1.e9}, maxX{-1.e9}, minY1{1.e9}, maxY1{-1.e9}, minY2{1.e9}, maxY2{-1.e9}, minZ{1.e9}, maxZ{-1.e9};
171  for (const GeoChildNodeWithTrf& child : children) {
172  std::vector<Amg::Vector3D> edges = getPolyShapeEdges(child.volume->getLogVol()->getShape(),
173  readOutVol->getX().inverse() * child.transform);
174  for (const Amg::Vector3D& edge : edges) {
175  minX = std::min(minX, edge.x());
176  maxX = std::max(maxX, edge.x());
177  minZ = std::min(minZ, edge.z());
178  maxZ = std::max(maxZ, edge.z());
179  if (edge.z() < 0) {
180  minY1 = std::min(minY1, edge.y());
181  maxY1 = std::max(maxY1, edge.y());
182  } else {
183  minY2 = std::min(minY2, edge.y());
184  maxY2 = std::max(maxY2, edge.y());
185  }
186  }
187  }
190  const double shortS = (maxY1 - minY1);
191  const double longS = (maxY2 - minY2);
192  const double lengthR = (maxX - minX);
193  const double lengthZ = (maxZ - minZ);
194 
195 
196 
197  const GeoAlignableTransform* alignTrf{copyMe->alignableTransform()};
199  const Amg::Transform3D stationTransform = alignTrf->getDefTransform().inverse()*parentVolume->getX();
200 
201  for (const GeoChildNodeWithTrf& child : children) {
203  const GeoVPhysVol &childVolRef = *child.volume;
204  if (typeid(childVolRef) == typeid(GeoFullPhysVol)) {
205  continue;
206  }
207  // Add the beam lines / foams inside the station volume
208  PVLink childVol = const_pointer_cast<GeoVPhysVol>(child.volume);
209  parentPhysVol->add(cacheObj.newIdTag());
210  parentPhysVol->add(cacheObj.makeTransform(stationTransform*child.transform));
211  parentPhysVol->add(cloneVolume(childVol));
212  }
214  const Amg::Transform3D alignedTransform = copyMe->localToGlobalTrans(gctx) *
215  (stationTransform * readOutVol->getX()).inverse();
216 
217  ATH_MSG_VERBOSE("stName "<<stName<<","<<stEta<<","<<stPhi<<" -- shortS: "<<shortS<<", longS: "<<longS
218  <<", lengthR: "<<lengthR<<", lengthZ "<<lengthZ
219  <<std::endl<<"AlignableNode: "<<GeoTrf::toString(alignedTransform, true)
220  <<std::endl<<"Station transform: "<<GeoTrf::toString(stationTransform, true)
221  <<std::endl<<"Readout transform: "<<GeoTrf::toString(readOutVol->getX(), true));
222  auto newStation = std::make_unique<MuonGM::MuonStation>(stName,
223  shortS, lengthR, lengthZ,
224  longS, lengthR, lengthZ,
225  stEta, stPhi, false);
226  newStation->setPhysVol(parentPhysVol);
228  cacheObj.world->add(cacheObj.newIdTag());
229  GeoIntrusivePtr<GeoAlignableTransform> trf = make_intrusive<GeoAlignableTransform>(alignedTransform);
230  newStation->setTransform(trf);
231  cacheObj.detMgr->addMuonStation(std::move(newStation));
232 
233  cacheObj.world->add(trf);
234  cacheObj.world->add(parentPhysVol);
235 
236  return StatusCode::SUCCESS;
237 }
238 
239 
241  const Identifier& reId,
242  ConstructionCache& cacheObj,
243  GeoIntrusivePtr<GeoVFullPhysVol>& physVol,
244  MuonGM::MuonStation* & station) const {
245 
246  ATH_CHECK(buildStation(gctx, reId, cacheObj));
247  const std::string stName{m_idHelperSvc->stationNameString(reId)};
248  station = cacheObj.detMgr->getMuonStation(stName,
249  m_idHelperSvc->stationEta(reId),
250  m_idHelperSvc->stationPhi(reId));
251 
252  PVLink parentPhysVol{station->getPhysVol()};
254  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
255  parentPhysVol->add(cacheObj.newIdTag());
266  const Amg::Transform3D alignNodeToRE{copyMe->alignableTransform()->getDefTransform().inverse() *
267  readOutVol->getParent()->getX() * readOutVol->getX()};
268  const Amg::Transform3D alignedNode{copyMe->localToGlobalTrans(gctx) * alignNodeToRE.inverse()};
269 
270  const Amg::Transform3D stationTrf{station->getTransform().inverse() * alignedNode};
271 
272  parentPhysVol->add(cacheObj.makeTransform(stationTrf*alignNodeToRE));
274  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
275  physVol = dynamic_pointer_cast<GeoVFullPhysVol>(clonedVol);
276  parentPhysVol->add(physVol);
277  return StatusCode::SUCCESS;
278 }
279 
281 
282  const std::vector<const MuonGMR4::RpcReadoutElement*> readoutEles = m_detMgr->getAllRpcReadoutElements();
283  ATH_MSG_INFO("Copy "<<readoutEles.size()<<" Rpc readout elements to the legacy system");
284  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
285  for (const MuonGMR4::RpcReadoutElement* copyMe : readoutEles) {
286  const Identifier reId = copyMe->identify();
287  const MuonGMR4::RpcReadoutElement::parameterBook& pars{copyMe->getParameters()};
288  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
289  MuonGM::MuonStation* station{nullptr};
290  ATH_CHECK(cloneReadoutVolume(gctx, reId, cacheObj, physVol, station));
291  auto newElement = std::make_unique<MuonGM::RpcReadoutElement>(physVol,
292  m_idHelperSvc->stationNameString(reId),
293  1, 1, false, cacheObj.detMgr.get());
294  const bool aSide{copyMe->stationEta() > 0};
295  newElement->setDoubletPhi(copyMe->doubletPhi());
296  newElement->setDoubletR(copyMe->doubletR());
297  newElement->setDoubletZ(copyMe->doubletZ());
298  newElement->setIdentifier(reId);
299  newElement->setParentMuonStation(station);
300 
302  newElement->setLongRsize(pars.halfLength);
303  newElement->setLongSsize(pars.halfWidth);
304  newElement->setLongZsize(pars.halfThickness);
305  newElement->setRsize(pars.halfLength);
306  newElement->setSsize(pars.halfWidth);
307  newElement->setZsize(pars.halfThickness);
308 
309  newElement->m_nlayers = copyMe->nGasGaps();
310  newElement->m_phistripwidth = copyMe->stripPhiWidth();
311  newElement->m_etastripwidth = copyMe->stripEtaWidth();
312  newElement->m_phistrippitch = copyMe->stripPhiPitch();
313  newElement->m_etastrippitch = (aSide > 0 ? 1. : -1.) *copyMe->stripEtaPitch();
314  newElement->m_phistriplength = copyMe->stripPhiLength();
315  newElement->m_etastriplength = copyMe->stripEtaLength();
316 
317  newElement->m_nphistripsperpanel = copyMe->nPhiStrips();
318  newElement->m_netastripsperpanel = copyMe->nEtaStrips();
319  newElement->m_nphistrippanels = copyMe->nPhiPanels();
320  newElement->m_hasDEDontop = true;
321  newElement->m_descratzneg = false;
322 
323  std::vector<Identifier> gapIds{};
324  for (unsigned int gasGap = 1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
325  for (int doubPhi = copyMe->doubletPhiMax(); doubPhi >= copyMe->doubletPhi(); --doubPhi) {
326  for (bool measPhi : {false, true}) {
327  if (measPhi && copyMe->nPhiStrips()==0) continue;
328  const int channel = 1;
329  const Identifier gapId = idHelper.channelID(copyMe->identify(),
330  copyMe->doubletZ(),
331  doubPhi, gasGap, measPhi,
332  channel);
333 
334  gapIds.push_back(gapId);
335  const Amg::Vector3D locStripPos = copyMe->globalToLocalTrans(gctx) * copyMe->stripPosition(gctx, gapId);
336  ATH_MSG_VERBOSE("GasGap "<<m_idHelperSvc->toString(gapId)<<", local strip position: "<<Amg::toString(locStripPos));
337  newElement->m_gasGap_xPos[gasGap -1] = locStripPos.x();
340  const int dbPIdx = copyMe->doubletPhi() == 2 ? 1 : doubPhi;
341  if (measPhi) {
342  newElement->m_first_phistrip_s[dbPIdx -1] = locStripPos.y();
343  newElement->m_phistrip_z = locStripPos.z();
344  } else{
345  newElement->m_first_etastrip_z = locStripPos.z();
346  newElement->m_etastrip_s[dbPIdx-1] = locStripPos.y();
347  }
348  }
349  }
350  }
351  newElement->fillCache();
353  for (const Identifier& gapId : gapIds) {
354  const int surfaceHash = newElement->surfaceHash(gapId);
355  const int layerHash = newElement->layerHash(gapId);
356  const Amg::Transform3D& refTrf{copyMe->localToGlobalTrans(gctx, gapId)};
357  newElement->m_surfaceData->m_layerTransforms[surfaceHash] = refTrf;
358  newElement->m_surfaceData->m_layerCenters[layerHash] = refTrf.translation();
359  newElement->m_surfaceData->m_layerNormals[layerHash] = refTrf.linear() * Amg::Vector3D::UnitZ();
360  }
361  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newElement));
362  cacheObj.detMgr->addRpcReadoutElement(std::move(newElement));
363  }
364  return StatusCode::SUCCESS;
365 }
366 
367 
369 
370  std::vector<const MuonGMR4::TgcReadoutElement*> tgcReadouts{m_detMgr->getAllTgcReadoutElements()};
371  std::stable_sort(tgcReadouts.begin(), tgcReadouts.end(),
373  return a->stationEta() > b->stationEta();
374  });
375  ATH_MSG_INFO("Copy "<<tgcReadouts.size()<<" Tgc readout elements to the legacy system");
376  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
377 
378  using TgcReadoutParams = MuonGM::TgcReadoutParams;
379  std::map<std::string, std::shared_ptr<TgcReadoutParams>> readoutParMap{};
380 
381  for (const MuonGMR4::TgcReadoutElement* copyMe: tgcReadouts) {
382  const Identifier reId = copyMe->identify();
383  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
384  MuonGM::MuonStation* station{nullptr};
385  ATH_CHECK(cloneReadoutVolume(gctx,reId, cacheObj, physVol, station));
386 
387  auto newRE = std::make_unique<MuonGM::TgcReadoutElement>(physVol, m_idHelperSvc->stationNameString(reId),
388  cacheObj.detMgr.get());
389  newRE->setIdentifier(reId);
390  newRE->setParentMuonStation(station);
391 
392  std::shared_ptr<TgcReadoutParams>& readOutPars = readoutParMap[copyMe->chamberDesign()];
393  if (!readOutPars) {
397 
398  std::array<WiregangArray, 3> wires{};
399  GasGapIntArray nWireGangs{}, nStrips{};
400  StripArray botMountings{}, topMountings{};
401  bool stripSet{false};
402  double wirePitch{0.};
403 
404  for (unsigned int gasGap =1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
405  nWireGangs[gasGap -1] = copyMe->numWireGangs(gasGap);
406  nStrips[gasGap -1] = copyMe->numStrips(gasGap);
407  if (nWireGangs[gasGap -1]) {
408  const MuonGMR4::WireGroupDesign& design{copyMe->wireGangLayout(gasGap)};
409  wirePitch = design.stripPitch();
410  WiregangArray& fillMe{wires[gasGap-1]};
411  for (int gang = 1; gang <= design.numStrips(); ++gang) {
412  fillMe[gang -1] = design.numWiresInGroup(gang);
413  }
414  }
415  if (nStrips[gasGap -1] && !stripSet) {
416  const MuonGMR4::RadialStripDesign& design {copyMe->stripLayout(gasGap)};
417  const int nCh = nStrips[gasGap -1];
418  for (int strip = 1; strip <= nCh; ++strip) {
419  botMountings[strip-1] = - design.stripLeftBottom(strip).x();
420  topMountings[strip-1] = - design.stripLeftTop(strip).x();
421  }
422  botMountings[nCh] = - design.stripRightBottom(nCh).x();
423  topMountings[nCh] = - design.stripRightTop(nCh).x();
424 
425  stripSet = true;
426  }
427  }
428  readOutPars = std::make_unique<TgcReadoutParams>(copyMe->chamberDesign(),
429  0, 0, wirePitch,
430  idHelper.stationPhiMax(reId),
431  std::move(nWireGangs),
432  std::move(wires[0]),
433  std::move(wires[1]),
434  std::move(wires[2]),
435  0,
436  std::move(botMountings),
437  std::move(topMountings),
438  std::move(nStrips));
439  }
440 
442  for (unsigned int gasGap = 1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
443  const IdentifierHash layHash{ copyMe->constructHash(0, gasGap, false)};
445  const Amg::Vector3D translation{copyMe->globalToLocalTrans(gctx) * copyMe->center(gctx, layHash)};
446  newRE->setPlaneZ(translation.x(), gasGap);
447  }
448  newRE->setSsize(copyMe->moduleHeight());
449  newRE->setRsize(copyMe->moduleWidthS());
450  newRE->setZsize(copyMe->moduleThickness());
451 
452  newRE->setLongSsize(copyMe->moduleHeight());
453  newRE->setLongRsize(copyMe->moduleWidthL());
454  newRE->setLongZsize(copyMe->moduleThickness());
455 
456  newRE->setReadOutParams(readOutPars);
457  newRE->fillCache();
458  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
459  cacheObj.detMgr->addTgcReadoutElement(std::move(newRE));
460 
461  }
462  return StatusCode::SUCCESS;
463 }
464 
465 GeoIntrusivePtr<GeoVFullPhysVol>
467  const MuonGMR4::MuonReadoutElement* copyMe,
468  ConstructionCache& cacheObj) const {
469  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
470  cacheObj.translatedStations.insert(readOutVol->getParent());
471 
472  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
473  GeoIntrusivePtr<GeoFullPhysVol> physVol{dynamic_pointer_cast<GeoFullPhysVol>(clonedVol)};
474  cacheObj.world->add(cacheObj.newIdTag());
475  cacheObj.world->add(cacheObj.makeTransform(copyMe->localToGlobalTrans(gctx)));
476  cacheObj.world->add(physVol);
477  return physVol;
478 }
480 
481  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mm);
482  const auto alignStore = alignItr ?
483  static_cast<const MmAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
484 
485  const std::vector<const MuonGMR4::MmReadoutElement*> mmReadouts{m_detMgr->getAllMmReadoutElements()};
486  ATH_MSG_INFO("Copy "<<mmReadouts.size()<<" Mm readout elements to the legacy system");
487 
488  for (const MuonGMR4::MmReadoutElement* copyMe : mmReadouts) {
489  const Identifier reId = copyMe->identify();
490  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
491  auto newRE = std::make_unique<MuonGM::MMReadoutElement>(physVol,
492  m_idHelperSvc->stationNameString(reId),
493  copyMe->stationEta(),
494  copyMe->stationPhi(),
495  copyMe->multilayer(), cacheObj.detMgr.get(),
496  alignStore ? alignStore->passivation : nullptr);
498  for (unsigned int gasGap = 0; gasGap < copyMe->nGasGaps(); ++gasGap) {
499  const MuonGMR4::StripLayer& stripLayer{copyMe->stripLayer(MuonGMR4::MmReadoutElement::createHash(gasGap +1, 0))};
500  const MuonGMR4::StripDesign& designFrom{stripLayer.design()};
501 
502  newRE->m_Xlg[gasGap] = stripLayer.toOrigin() *
503  Amg::getRotateZ3D(-designFrom.stereoAngle()) *
505  ATH_MSG_VERBOSE("Layer transform "<<gasGap<<" "<<GeoTrf::toString(newRE->m_Xlg[gasGap], true));
506 
507  MuonGM::MuonChannelDesign& designTo{newRE->m_etaDesign[gasGap]};
508  designTo.defineTrapezoid(designFrom.shortHalfHeight(),
509  designFrom.longHalfHeight(),
510  designFrom.halfWidth(),
511  designFrom.stereoAngle());
513  designTo.detType = MuonGM::MuonChannelDesign::DetType::MM;
514  designTo.inputPitch = designFrom.stripPitch();
515  designTo.inputWidth = designTo.inputPitch * std::cos(designTo.stereoAngle());
516  designTo.nMissedBottomEta = designTo.nMissedBottomStereo = designFrom.firstStripNumber() - 1;
517  designTo.totalStrips = designFrom.numStrips();
518  designTo.nch = designFrom.numStrips();
519 
520  designTo.setFirstPos(designFrom.firstStripPos().x() + 0.5*designTo.inputPitch);
521  }
522 
523  newRE->fillCache();
524  if (alignStore && alignStore->getBLine(reId)) {
525  newRE->setBLinePar(*alignStore->getBLine(reId));
526  }
527  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
528  cacheObj.detMgr->addMMReadoutElement(std::move(newRE));
529  }
530  return StatusCode::SUCCESS;
531 }
532 
534  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::sTgc);
535  auto alignStore = alignItr ? static_cast<const sTgcAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
536 
537  const std::vector<const MuonGMR4::sTgcReadoutElement*> sTgcReadOuts{m_detMgr->getAllsTgcReadoutElements()};
538  ATH_MSG_INFO("Copy "<<sTgcReadOuts.size()<<" sTgc readout elements to the legacy system");
539 
540  for (const MuonGMR4::sTgcReadoutElement* copyMe : sTgcReadOuts) {
541  const Identifier reId = copyMe->identify();
542  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
543 
544  auto newRE = std::make_unique<MuonGM::sTgcReadoutElement>(physVol,
545  m_idHelperSvc->stationNameString(reId).substr(1),
546  copyMe->stationEta(),
547  copyMe->stationPhi(),
548  copyMe->multilayer(),
549  cacheObj.detMgr.get());
550 
551  if (alignStore && alignStore->getBLine(reId)) {
552  newRE->setBLinePar(*alignStore->getBLine(reId));
553  }
554  for (unsigned int layer = 1; layer <= copyMe->numLayers(); ++layer) {
556  using ChannelDesign = MuonGM::MuonChannelDesign;
557  const IdentifierHash layerHash = MuonGMR4::sTgcReadoutElement::createHash(layer,channelType::Strip,0);
558  newRE->m_Xlg[layer -1] = Amg::getTranslate3D(copyMe->globalToLocalTrans(gctx) *
559  copyMe->center(gctx, layerHash));
560 
561  const MuonGMR4::StripDesign& copyEtaDesign{copyMe->stripDesign(layerHash)};
563  ChannelDesign& etaDesign{newRE->m_etaDesign[layer-1]};
564  etaDesign.type = ChannelDesign::ChannelType::etaStrip;
565  etaDesign.detType = ChannelDesign::DetType::STGC;
566  if (copyEtaDesign.yCutout()) {
567  etaDesign.defineDiamond(copyEtaDesign.shortHalfHeight(),
568  copyEtaDesign.longHalfHeight(),
569  copyEtaDesign.halfWidth(),
570  copyEtaDesign.yCutout());
571  } else {
572  etaDesign.defineTrapezoid(copyEtaDesign.shortHalfHeight(),
573  copyEtaDesign.longHalfHeight(),
574  copyEtaDesign.halfWidth());
575  }
576  etaDesign.inputPitch = copyEtaDesign.stripPitch();
577  etaDesign.inputWidth = copyEtaDesign.stripWidth();
578  etaDesign.nch = copyEtaDesign.numStrips();
579  etaDesign.setFirstPos(copyEtaDesign.firstStripPos().x());
581 
582  const MuonGMR4::WireGroupDesign& copyPhiDesign{copyMe->wireDesign(layerHash)};
583 
584  ChannelDesign& phiDesign{newRE->m_phiDesign[layer-1]};
585  phiDesign.type = ChannelDesign::ChannelType::phiStrip;
586  phiDesign.detType = ChannelDesign::DetType::STGC;
587  if (copyPhiDesign.yCutout() == 0.) {
588  phiDesign.defineTrapezoid(copyPhiDesign.shortHalfHeight(),
589  copyPhiDesign.longHalfHeight(),
590  copyPhiDesign.halfWidth());
591  } else {
592  phiDesign.defineDiamond(copyPhiDesign.shortHalfHeight(),
593  copyPhiDesign.longHalfHeight(),
594  copyPhiDesign.halfWidth(),
595  copyPhiDesign.yCutout());
596  }
597  phiDesign.inputPitch = copyPhiDesign.stripPitch();
598  phiDesign.inputWidth = copyPhiDesign.stripWidth();
599  phiDesign.setFirstPos(copyPhiDesign.firstStripPos().x()); // Position of 1st wire, accounts for staggering
600  phiDesign.firstPitch = copyPhiDesign.numWiresInGroup(1); // Number of Wires in 1st group, group staggering
601  phiDesign.groupWidth = copyPhiDesign.numWiresInGroup(2); // Number of Wires normal group
602  phiDesign.nGroups = copyPhiDesign.numStrips(); // Number of Wire Groups
603  phiDesign.wireCutout = copyPhiDesign.wireCutout(); // Size of "active" wire region for digits
604  phiDesign.nch = copyPhiDesign.nAllWires();
605 
606  const MuonGMR4::PadDesign& copyPadDesign{copyMe->padDesign(layerHash)};
607  MuonGM::MuonPadDesign& padDesign{newRE->m_padDesign[layer-1]};
608  padDesign.Length = copyMe->chamberHeight();
609  padDesign.sWidth = copyMe->sChamberLength();
610  padDesign.lWidth = copyMe->lChamberLength();
611  padDesign.Size = 2.*copyPadDesign.halfWidth();
612  padDesign.ysFrame = copyMe->sFrameWidth();
613  padDesign.ylFrame = copyMe->lFrameWidth();
614  padDesign.thickness = copyMe->thickness();
615  padDesign.yCutout = copyPadDesign.yCutout();
616  padDesign.setR(copyPadDesign.beamlineRadius());
617  padDesign.sPadWidth = 2.*copyPadDesign.shortHalfHeight();
618  padDesign.lPadWidth = 2.*copyPadDesign.longHalfHeight();
619  padDesign.nPadColumns = copyPadDesign.numPadPhi();
620  padDesign.firstPhiPos = copyPadDesign.firstPadPhiDiv();
621  padDesign.inputPhiPitch = copyPadDesign.anglePadPhi();
622  padDesign.PadPhiShift = copyPadDesign.padPhiShift();
623  padDesign.nPadH = copyPadDesign.numPadEta();
624  padDesign.padEtaMax = copyPadDesign.maxPadEta();
625  padDesign.firstRowPos = copyPadDesign.firstPadHeight();
626  padDesign.inputRowPitch = copyPadDesign.padHeight();
627  padDesign.sectorOpeningAngle = copyPadDesign.sectorAngle();
628  }
629  newRE->fillCache();
630  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
631  cacheObj.detMgr->addsTgcReadoutElement(std::move(newRE));
632  }
633  return StatusCode::SUCCESS;
634 }
637  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mdt);
638  const MdtAlignmentStore* alignStore = alignItr ?
639  static_cast<const MdtAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
640 
641  const std::vector<const MuonGMR4::MdtReadoutElement*> mdtReadOuts{m_detMgr->getAllMdtReadoutElements()};
642  ATH_MSG_INFO("Copy "<<mdtReadOuts.size()<<" Mdt readout elements to the legacy system");
643  for (const MuonGMR4::MdtReadoutElement* copyMe : mdtReadOuts) {
644  const Identifier reId = copyMe->identify();
645  ATH_MSG_DEBUG("Translate "<<m_idHelperSvc->toStringDetEl(reId));
647  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
648  MuonGM::MuonStation* station{nullptr};
649  ATH_CHECK(cloneReadoutVolume(gctx,reId, cacheObj, physVol, station));
650 
651  const MuonGMR4::MdtReadoutElement::parameterBook& pars{copyMe->getParameters()};
652  auto newElement = std::make_unique<MuonGM::MdtReadoutElement>(physVol,
653  m_idHelperSvc->stationNameString(reId),
654  cacheObj.detMgr.get());
655  newElement->setIdentifier(reId);
656  newElement->setMultilayer(copyMe->multilayer());
657  newElement->setNMdtInStation(m_idHelperSvc->mdtIdHelper().multilayerMax(reId));
658  // cppcheck-suppress invalidLifetime; ok: mgr took ownership.
659  newElement->setParentMuonStation(station);
661  newElement->setLongRsize(2*pars.halfY);
663  newElement->setLongSsize(2*pars.longHalfX - 1.*Gaudi::Units::cm);
664  newElement->setLongZsize(2*pars.halfHeight);
665  newElement->setRsize(2*pars.halfY);
666  newElement->setSsize(2*pars.shortHalfX - 1.*Gaudi::Units::cm);
667  newElement->setZsize(2*pars.halfHeight);
668 
669  newElement->m_nlayers = copyMe->numLayers();
670  newElement->m_ntubesperlayer = copyMe->numTubesInLay();
671  newElement->m_deadlength = pars.deadLength;
672  newElement->m_endpluglength = pars.endPlugLength;
673  newElement->m_innerRadius = pars.tubeInnerRad;
674  newElement->m_tubeWallThickness = pars.tubeWall;
675  newElement->m_tubepitch = pars.tubePitch;
678 
680  const MuonGMR4::MdtTubeLayer& tubeLay{*pars.tubeLayers[0]};
681  unsigned int step{1};
682  double lastLength{2.*tubeLay.uncutHalfLength(1)};
683  for (unsigned tube = 0; tube < copyMe->numTubesInLay(); ++tube) {
684  const double currLength = 2.*tubeLay.uncutHalfLength(tube);
685  ATH_MSG_VERBOSE(m_idHelperSvc->toString(copyMe->identify())<< ", tube "<<tube<<", length: "<<currLength);
686  if (std::abs(lastLength - currLength) > std::numeric_limits<float>::epsilon() ||
687  tube == copyMe->numTubesInLay() -1) {
688  newElement->m_tubelength[step-1] = lastLength;
689  newElement->m_tubelength[step] = currLength;
690  if (step == 1) {
691  newElement->m_ntubesinastep = tube;
692  }
693  lastLength = currLength;
694  ++step;
695  }
696  }
697  newElement->m_nsteps = step;
698 
700  double xOffSet{pars.halfY}, yOffSet{pars.halfHeight};
701  if (newElement->barrel()) std::swap(xOffSet, yOffSet);
702  for (unsigned lay = 1; lay <= copyMe->numLayers(); ++lay) {
703  const IdentifierHash tubeHash{copyMe->measurementHash(lay, 1)};
704  const Amg::Vector3D locTube = copyMe->localTubePos(tubeHash);
705  newElement->m_firstwire_x[lay-1] = locTube.z() + xOffSet;
706  newElement->m_firstwire_y[lay-1] = locTube.x() + yOffSet;
707  }
708  MdtAlignmentStore::chamberDistortions distort = alignStore ? alignStore->getDistortion(reId) :
710 
711  if (!station->hasMdtAsBuiltParams()){
712  station->setMdtAsBuiltParams(distort.asBuilt);
713  }
714  if (!station->hasBLines()){
715  station->setBline(distort.bLine);
716  }
717  const Amg::Vector3D refPoint = copyMe->bLineReferencePoint();
718  station->setBlineFixedPointInAmdbLRS(refPoint.x(), refPoint.y(), refPoint.z());
719 
720  newElement->geoInitDone();
721  newElement->setBLinePar(distort.bLine);
722  newElement->fillCache();
724  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newElement));
725  cacheObj.detMgr->addMdtReadoutElement(std::move(newElement));
726  }
727  return StatusCode::SUCCESS;
728 }
729 
731  const MuonGM::MuonReadoutElement& testEle) const{
732 
733  if (refEle.identify() != testEle.identify()) {
734  ATH_MSG_FATAL("Two different elements are compared "
735  <<m_idHelperSvc->toString(refEle.identify())<<" vs. "
736  <<m_idHelperSvc->toString(testEle.identify()));
737  return StatusCode::FAILURE;
738  }
739  if (refEle.identHash() != testEle.detectorElementHash()) {
740  ATH_MSG_FATAL("The hashes of the two detector elements "<<m_idHelperSvc->toString(refEle.identify())
741  <<" are completely different "<<refEle.identHash()<<" vs. "<<testEle.detectorElementHash());
742  return StatusCode::FAILURE;
743  }
744  return StatusCode::SUCCESS;
745 }
746 
748  const MuonGMR4::MmReadoutElement& refEle,
749  const MuonGM::MMReadoutElement& testEle) const {
750 
751  if (!m_checkGeo) {
752  return StatusCode::SUCCESS;
753  }
754  ATH_CHECK(checkIdCompability(refEle, testEle));
755 
756  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
757  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
758  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
759  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
760  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++ gasGap) {
761  const Identifier gapId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, 1);
762 
763  const Amg::Transform3D& refTrf{refEle.localToGlobalTrans(gctx, gapId)};
764  const Amg::Transform3D& testTrf{testEle.transform(gapId)};
765  if (!Amg::doesNotDeform(refTrf.inverse()*testTrf)) {
766  ATH_MSG_FATAL("The layer "<<m_idHelperSvc->toStringGasGap(gapId)<<" does not transform equally"
767  <<GeoTrf::toString(refTrf, true) <<" vs. "<<GeoTrf::toString(testTrf, true));
768  return StatusCode::FAILURE;
769  }
770  const MuonGMR4::StripDesign& stripDesign{refEle.stripLayer(gapId).design()};
771 
772  for (int strip = stripDesign.firstStripNumber(); strip <= stripDesign.numStrips(); ++strip) {
773  const Identifier stripId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, strip);
774  const Amg::Vector3D refStripPos{refEle.stripPosition(gctx, stripId)};
775  const Amg::Vector3D refStripDir{refEle.localToGlobalTrans(gctx, refEle.layerHash(stripId)).linear() * Amg::Vector3D::UnitX()};
776 
777  Amg::Vector3D testStripPos{Amg::Vector3D::Zero()};
778  if (!testEle.stripGlobalPosition(stripId, testStripPos)) {
779  ATH_MSG_FATAL("Failed to retrieve strip position "<<m_idHelperSvc->toString(stripId));
780  return StatusCode::FAILURE;
781  }
782  const double dist = refStripDir.dot(refStripPos - testStripPos);
783  if (std::abs(dist) > 10. * Gaudi::Units::micrometer) {
784  ATH_MSG_FATAL("The strip "<<Amg::toString(testStripPos)<<" is not describing the same strip as "
785  <<Amg::toString(refStripPos)<<". Channel "<<m_idHelperSvc->toString(stripId)
786  <<" distance: "<<dist<<" "<<(dist / testEle.m_etaDesign[gasGap -1].inputWidth));
787  return StatusCode::FAILURE;
788  }
789  ATH_MSG_VERBOSE("Channel postion "<<m_idHelperSvc->toString(stripId)<<" match between legacy & new");
790  }
791  }
792  return StatusCode::SUCCESS;
793 }
794 
796  const MuonGMR4::MdtReadoutElement& refEle,
797  const MuonGM::MdtReadoutElement& testEle) const {
798 
799  if (!m_checkGeo) {
800  return StatusCode::SUCCESS;
801  }
802  ATH_CHECK(checkIdCompability(refEle, testEle));
803 
804  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
805  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx))
806  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform())
807  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
808  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
809  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
810  for (unsigned int lay = 1; lay <= refEle.numLayers(); ++lay){
811  for (unsigned int tube = 1; tube <= refEle.numTubesInLay(); ++tube) {
812  const IdentifierHash tubeHash {refEle.measurementHash(lay,tube)};
813  if (!refEle.isValid(tubeHash)) {
814  ATH_MSG_VERBOSE("SKip layer / tube "<<lay <<","<<tube);
815  continue;
816  }
817  const Amg::Transform3D globToLocal = refEle.globalToLocalTrans(gctx, tubeHash);
818 
819  const Amg::Vector3D refPos = refEle.globalTubePos(gctx, tubeHash);
820  const Amg::Vector3D tubePos = testEle.tubePos(lay, tube);
821 
822 
823  if ( (refPos - tubePos).mag() > Gaudi::Units::micrometer &&
824  (globToLocal*refPos - globToLocal * tubePos).perp() > Gaudi::Units::micrometer) {
825  ATH_MSG_ERROR("Tube positions differ for "<<m_idHelperSvc->toString(refEle.measurementId(tubeHash))
826  <<" reference: "<<GeoTrf::toString(globToLocal*refPos)<<" vs. test: "
827  <<GeoTrf::toString(globToLocal*tubePos) <<" delta: "<<(refPos - tubePos).mag()
828  <<" Transforms "<<std::endl
829  <<" **** "<< GeoTrf::toString(globToLocal.inverse())<<std::endl
830  <<" **** "<< GeoTrf::toString(testEle.transform(lay, tube)));
831  return StatusCode::FAILURE;
832  }
833  ATH_MSG_VERBOSE("Tube positions layer: "<<lay<<", tube: "<<tube
834  <<std::endl<<"reference: "<<GeoTrf::toString(refPos)
835  <<std::endl<<"test: "<<GeoTrf::toString(tubePos)
836  <<std::endl<<testEle.tubeLength(lay, tube)<<"/"<<testEle.getActiveTubeLength(lay, tube)<<"/"
837  <<testEle.getWireLength(lay,tube)<<" vs. "<<refEle.tubeLength(tubeHash)
838  <<"/"<<refEle.activeTubeLength(tubeHash)<<"/"<<refEle.wireLength(tubeHash)
839  <<"/"<<refEle.uncutTubeLength(tubeHash));
840  if (std::abs(testEle.getTubeLengthForCaching(lay,tube) - refEle.uncutTubeLength(tubeHash)) >
841  std::numeric_limits<float>::epsilon() ) {
842  ATH_MSG_FATAL("Different tube length's detected for "<<m_idHelperSvc->toStringDetEl(refEle.identify())
843  << " layer: "<<lay<<", tube: "<<tube<<" -- "<<testEle.getTubeLengthForCaching(lay,tube)<<" (new) vs. "
844  <<refEle.uncutTubeLength(tubeHash)<<" (ref)");
845  return StatusCode::FAILURE;
846  }
847  }
848  }
849 
850  return StatusCode::SUCCESS;
851 }
853  const MuonGMR4::RpcReadoutElement& refEle,
854  const MuonGM::RpcReadoutElement& testEle) const {
855 
856  if (!m_checkGeo) {
857  return StatusCode::SUCCESS;
858  }
859  ATH_CHECK(checkIdCompability(refEle, testEle));
860 
861  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
862  <<" ref: "<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)<<std::endl
863  <<" test: "<<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
864  <<"delta: "<<GeoTrf::toString(testEle.absTransform().inverse()*refEle.localToGlobalTrans(gctx), true ));
865  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
866  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
867  for (int doubPhi = refEle.doubletPhi(); doubPhi <= refEle.doubletPhiMax(); ++doubPhi) {
868  for (bool measPhi : {false, true}) {
869  if (measPhi && !refEle.nPhiStrips()) continue;
870  for (int strip = 1; strip <= testEle.Nstrips(measPhi); ++strip) {
871  const Identifier stripId = idHelper.channelID(refEle.identify(),
872  refEle.doubletZ(),
873  doubPhi, gasGap, measPhi, strip);
874 
875  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, stripId)};
876  const Amg::Transform3D& testTrans{testEle.transform(stripId)};
877  if (strip == 1 && !Amg::doesNotDeform(refTrans.inverse()*testTrans)) {
878  ATH_MSG_ERROR("Transformation for "<<m_idHelperSvc->toString(stripId)<<" - "<<refEle.identHash()<<std::endl
879  <<" *** ref: "<<GeoTrf::toString(refTrans)<<std::endl
880  <<" *** test: "<<GeoTrf::toString(testTrans)<<std::endl
881  <<" -> delta: "<<GeoTrf::toString(refTrans.inverse()*testTrans));
882  return StatusCode::FAILURE;
883  }
884 
885  const Amg::Vector3D refStripPos = refEle.stripPosition(gctx, stripId);
886  const Amg::Vector3D testStripPos = testEle.stripPos(stripId);
887  // The threshold here used to be epsilon for a float.
888  // But this was then giving a failure in aarch64,
889  // with a difference of almost exactly 1e-4.
890  // It turned out that that was coming from GeoDeDuplicator,
891  // where to consider two transforms equivalent,
892  // the translations must match to 1e-4. But if the
893  // difference is almost exactly 1e-4, then small FP
894  // differences can be magnified to just about 1e-4.
895  if ((refStripPos - testStripPos).mag() > 2e-4){
896  ATH_MSG_ERROR("Mismatch in strip positions "<<m_idHelperSvc->toString(stripId)
897  <<" ref: "<<Amg::toString(refStripPos)<<" test: "<<Amg::toString(testStripPos)
898  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refStripPos)
899  <<" test: "<<Amg::toString(refTrans.inverse()*testStripPos));
900  return StatusCode::FAILURE;
901  }
902  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(stripId)
903  <<" strip position "<<Amg::toString(refStripPos)
904  <<", local: "<<Amg::toString(refTrans.inverse()*refStripPos));
905  }
906  }
907  }
908  }
909  return StatusCode::SUCCESS;
910 }
912  const MuonGMR4::TgcReadoutElement& refEle,
913  const MuonGM::TgcReadoutElement& testEle) const {
914 
915  if (!m_checkGeo) {
916  return StatusCode::SUCCESS;
917  }
918  ATH_CHECK(checkIdCompability(refEle, testEle));
919 
920  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
921 
922  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
923  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)
924  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform(), true)
925  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
926  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
927  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
928 
929  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
930  for (bool isStrip : {false, true}) {
931  const IdentifierHash layHash = refEle.constructHash(0, gasGap, isStrip);
932  const Identifier layId = idHelper.channelID(refEle.identify(), gasGap, isStrip, 1);
933  ATH_MSG_VERBOSE("Test layer "<<m_idHelperSvc->toString(layId)<<" "<<refEle.numChannels(layHash)<<" "<<layHash);
934  if (!refEle.numChannels(layHash)) continue;
935  const Amg::Transform3D& refLayerTrf = refEle.localToGlobalTrans(gctx, layHash);
936  const Amg::Transform3D& testLayerTrf = testEle.transform(layId);
937  if (!Amg::isIdentity(refLayerTrf.inverse()* testLayerTrf)) {
938  ATH_MSG_FATAL("The transformations in "<<m_idHelperSvc->toString(layId)
939  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
940  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true)
941  <<" are not identical. ");
942  return StatusCode::FAILURE;
943  }
944  ATH_MSG_VERBOSE("Transformations in "<<m_idHelperSvc->toString(layId)
945  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
946  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true));
947 
948  for (unsigned int ch = 1; ch <= refEle.numChannels(layHash); ++ch) {
949  const IdentifierHash measHash = refEle.constructHash(ch, gasGap, isStrip);
950  const Identifier measId = refEle.measurementId(measHash);
951  const Amg::Vector3D refChannel = refEle.channelPosition(gctx, measHash);
952  const Amg::Vector3D testChannel = testEle.channelPos(measId);
953  if ((refChannel - testChannel).mag() < std::numeric_limits<float>::epsilon()){
954  continue;
955  }
956  std::stringstream msg{};
957  msg<<"The channel "<<m_idHelperSvc->toString(measId)
958  << " is not at the same position "<<Amg::toString(refChannel)
959  <<" vs. "<<Amg::toString(testChannel)<<". Difference: "
960  <<(refChannel - testChannel).mag();
961  if (!isStrip) {
962  msg<<std::endl<<"*** Test *** - wirePitch: "<<testEle.wirePitch()
963  <<", tot wires "<<testEle.nWires(gasGap)
964  <<", wires to reach "<<testEle.nPitchesToGang(gasGap, ch)
965  <<", wires in gang "<<testEle.nWires(gasGap, ch);
966  const MuonGMR4::WireGroupDesign& design{refEle.wireGangLayout(gasGap)};
967  msg<<std::endl<<"*** Ref *** - wirePitch: "<<design.stripPitch()
968  <<", tot wires "<<testEle.nWires(gasGap)
969  <<", wires to reach "<<design.numPitchesToGroup(ch)
970  <<", wires in gang "<<design.numWiresInGroup(ch);
971  } else {
972  const Amg::Vector3D locRefPos{refLayerTrf.inverse() * refChannel};
973  const Amg::Vector3D locTestPos{refLayerTrf.inverse()* testChannel};
974  msg<<std::endl<<"*** Ref **** - "<<Amg::toString(locRefPos)<<std::endl;
975  msg<<std::endl<<"*** Test **** - "<<Amg::toString(locTestPos)<<std::endl;
976  }
977  ATH_MSG_FATAL(msg.str());
978  return StatusCode::FAILURE;
979  }
980 
981  }
982  }
983  return StatusCode::SUCCESS;
984 }
986  const MuonGMR4::sTgcReadoutElement& refEle,
987  const MuonGM::sTgcReadoutElement& testEle) const {
988 
989  if (!m_checkGeo) {
990  return StatusCode::SUCCESS;
991  }
992  ATH_CHECK(checkIdCompability(refEle, testEle));
993 
994  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
995  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
996  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
997  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
998  for (unsigned int gasGap = 1; gasGap <= refEle.numLayers(); ++gasGap) {
999  for (int chType = sTgcIdHelper::sTgcChannelTypes::Pad; chType <= sTgcIdHelper::sTgcChannelTypes::Wire; ++chType) {
1000  unsigned int numChannel = 0;
1001  const Identifier layID = idHelper.channelID(refEle.identify(),
1002  refEle.multilayer(),
1003  gasGap, chType, 1);
1004  switch(chType) {
1005  case sTgcIdHelper::sTgcChannelTypes::Pad:
1006  numChannel = refEle.numPads(layID);
1007  break;
1008 
1009  case sTgcIdHelper::sTgcChannelTypes::Strip:
1010  numChannel = refEle.numStrips(layID);
1011  break;
1012 
1013  case sTgcIdHelper::sTgcChannelTypes::Wire:
1014  numChannel = refEle.numWireGroups(gasGap);
1015  break;
1016  }
1017  for (unsigned int channel = 1; channel < numChannel ; ++channel) {
1018  const Identifier chID = idHelper.channelID(refEle.identify(),
1019  refEle.multilayer(),
1020  gasGap, chType, channel);
1021 
1022  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, chID)};
1023  const Amg::Transform3D& testTrans{testEle.transform(chID)};
1024  if (channel == 1 && Amg::doesNotDeform(refTrans.inverse()*testTrans)) {
1025  ATH_MSG_ERROR("Transformation for "<<m_idHelperSvc->toString(chID)<<std::endl
1026  <<" *** ref: "<<GeoTrf::toString(refTrans, true)<<std::endl
1027  <<" *** test: "<<GeoTrf::toString(testTrans, true));
1028  return StatusCode::FAILURE;
1029  }
1030  if (chType == sTgcIdHelper::sTgcChannelTypes::Pad) {
1031  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1032  Amg::Vector3D testChannelPos(Amg::Vector3D::Zero());
1033  testEle.stripGlobalPosition(chID, testChannelPos);
1034 
1035  const std::array<Amg::Vector3D,4> refPadCorners = refEle.globalPadCorners(gctx, chID);
1036  std::array<Amg::Vector3D,4> testPadCorners{make_array<Amg::Vector3D, 4>(Amg::Vector3D::Zero())};
1037  testEle.padGlobalCorners(chID, testPadCorners);
1038  for (unsigned int cornerIdx = 0; cornerIdx < refPadCorners.size(); ++cornerIdx) {
1039  if ((refPadCorners[cornerIdx] - testPadCorners[cornerIdx]).mag() > 10. * Gaudi::Units::micrometer){
1040  ATH_MSG_ERROR("Mismatch in pad Corner "<<m_idHelperSvc->toString(chID)
1041  <<" ref: "<<Amg::toString(refPadCorners[cornerIdx])<<" test: "<<Amg::toString(testPadCorners[cornerIdx])
1042  <<" local coordinates -- ref: "<<Amg::toString(testEle.absTransform().inverse()*refPadCorners[cornerIdx])
1043  <<" test: "<<Amg::toString(testEle.absTransform().inverse()*testPadCorners[cornerIdx]));
1044  return StatusCode::FAILURE;
1045  }
1046  }
1047  if ((refChannelPos - testChannelPos).mag() > 10. * Gaudi::Units::micrometer){
1048  ATH_MSG_ERROR("Mismatch in channel positions "<<m_idHelperSvc->toString(chID)
1049  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1050  <<" local coordinates -- ref: "<<Amg::toString(testEle.absTransform().inverse()*refChannelPos)
1051  <<" test: "<<Amg::toString(testEle.absTransform().inverse()*testChannelPos));
1052  return StatusCode::FAILURE;
1053  }
1054  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1055  <<" channel position "<<Amg::toString(refChannelPos));
1056  }
1057  else {
1058  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1059  Amg::Vector3D testChannelPos(Amg::Vector3D::Zero());
1060  testEle.stripGlobalPosition(chID, testChannelPos);
1061  if ((refChannelPos - testChannelPos).mag() > 10. * Gaudi::Units::micrometer){
1062  ATH_MSG_ERROR("Mismatch in channel positions "<<m_idHelperSvc->toString(chID)
1063  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1064  <<" local coordinates -- ref: "<<Amg::toString(testEle.absTransform().inverse()*refChannelPos)
1065  <<" test: "<<Amg::toString(testEle.absTransform().inverse()*testChannelPos));
1066  return StatusCode::FAILURE;
1067  }
1068  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1069  <<" channel position "<<Amg::toString(refChannelPos));
1070  }
1071  }
1072  }
1073  }
1074  return StatusCode::SUCCESS;
1075 }
1076 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonGMR4::ReadoutGeomCnvAlg::buildSTGC
StatusCode buildSTGC(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:533
MuonGMR4::RpcReadoutElement::doubletPhiMax
int doubletPhiMax() const
Returns the maximum phi panel.
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::ReadoutGeomCnvAlg::buildMdt
StatusCode buildMdt(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:635
chType
sTgcIdHelper::sTgcChannelTypes chType
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/NSWGeoPlottingAlg.cxx:20
MuonGMR4::ReadoutGeomCnvAlg::dumpAndCompare
StatusCode dumpAndCompare(const ActsGeometryContext &gctx, const MuonGMR4::RpcReadoutElement &refEle, const MuonGM::RpcReadoutElement &testEle) const
Definition: ReadoutGeomCnvAlg.cxx:852
MuonGM::MuonPadDesign
Parameters defining the design of the readout sTGC pads.
Definition: MuonPadDesign.h:40
MdtReadoutElement.h
MuonGMR4::sTgcReadoutElement::multilayer
int multilayer() const
Returns the multilayer of the sTgcReadoutElement.
MuonGM::MuonClusterReadoutElement::transform
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
Definition: MuonClusterReadoutElement.h:124
MuonGMR4::MmReadoutElement
Definition: MmReadoutElement.h:19
STGC
@ STGC
Definition: RegSelEnums.h:39
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
MuonGMR4::TgcReadoutElement::wireGangLayout
const WireGroupDesign & wireGangLayout(unsigned int gasGap) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::MuonDetectorManager::getDetectorTypes
std::vector< ActsTrk::DetectorType > getDetectorTypes() const
Returns a list of all detector types.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:143
MuonGMR4::StripDesign
Definition: StripDesign.h:30
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
MuonGMR4::MmReadoutElement::createHash
static IdentifierHash createHash(const int gasGap, const int strip)
MuonGM::MuonReadoutElement::absTransform
const Amg::Transform3D & absTransform() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:210
MuonGMR4::ReadoutGeomCnvAlg::cloneReadoutVolume
StatusCode cloneReadoutVolume(const ActsGeometryContext &gctx, const Identifier &stationId, ConstructionCache &cacheObj, GeoIntrusivePtr< GeoVFullPhysVol > &clonedPhysVol, MuonGM::MuonStation *&station) const
Clones the fullPhysical volume of the readoutElement and embeds it into the associated station.
Definition: ReadoutGeomCnvAlg.cxx:240
MuonGMR4::MmReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gas gaps.
MuonGMR4::WireGroupDesign
Definition: WireGroupDesign.h:23
MuonGM::MdtReadoutElement::tubeLength
double tubeLength(const int tubeLayer, const int tube) const
MuonGMR4::MdtReadoutElement::numTubesInLay
unsigned int numTubesInLay() const
Returns the number of tubes per layer.
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache::newIdTag
GeoIntrusivePtr< GeoIdentifierTag > newIdTag()
Returns an identifier tag.
Definition: ReadoutGeomCnvAlg.h:52
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonGMR4::ReadoutGeomCnvAlg::buildStation
StatusCode buildStation(const ActsGeometryContext &gctx, const Identifier &stationId, ConstructionCache &cacheObj) const
builds a station object from readout element.
Definition: ReadoutGeomCnvAlg.cxx:146
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition: GeometryDefs.h:17
MdtAlignmentStore::chamberDistortions::bLine
const BLinePar * bLine
Definition: MdtAlignmentStore.h:26
MuonGMR4::ReadoutGeomCnvAlg::buildTgc
StatusCode buildTgc(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:368
perp
Scalar perp() const
perp method - perpenticular length
Definition: AmgMatrixBasePlugin.h:44
MuonGM::MuonStation::getPhysVol
PVConstLink getPhysVol() const
Definition: MuonStation.cxx:381
MuonGM::MuonChannelDesign::defineTrapezoid
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
set the trapezoid dimensions
Definition: MuonChannelDesign.cxx:25
ActsTrk::DetectorAlignStore::TrackingAlignStore
Store holding the transfomations used by the Acts algorithms.
Definition: DetectorAlignStore.h:33
TgcIdHelper
Definition: TgcIdHelper.h:50
sTgcReadoutElement.h
MuonGMR4::MdtReadoutElement::tubeLength
double tubeLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:185
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache::world
PVLink world
Pointer to the world.
Definition: ReadoutGeomCnvAlg.h:48
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonGM::GasGapIntArray
TgcReadoutParams::GasGapIntArray GasGapIntArray
Definition: RDBReaderAtlas.cxx:20
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
MuonGMR4::MdtReadoutElement::measurementHash
static IdentifierHash measurementHash(unsigned int layerNumber, unsigned int tubeNumber)
Transform the layer and tube number to the measurementHash.
MuonGMR4::TgcReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
MuonGM::MuonStation::getTransform
Amg::Transform3D getTransform() const
Definition: MuonStation.h:169
MuonGMR4::TgcReadoutElement::channelPosition
Amg::Vector3D channelPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the center of the measurement channel eta measurement: wire gang center phi measurement: stri...
MuonGMR4::RpcReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
MuonGMR4::MdtReadoutElement::activeTubeLength
double activeTubeLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:173
MuonGM::MuonReadoutElement::getZsize
double getZsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:198
MuonGM::MuonReadoutElement::detectorElementHash
IdentifierHash detectorElementHash() const
Returns the IdentifierHash of the detector element.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:186
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonGMR4::sTgcReadoutElement::ReadoutChannelType
ReadoutChannelType
ReadoutChannelType to distinguish the available readout channels Pad - pad readout channel Strip - et...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h:30
MuonGMR4::MdtTubeLayer
Helper struct to retrieve the tube lengths and the tube centers directly from the GeoModel tree.
Definition: MdtTubeLayer.h:28
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:55
ReadoutGeomCnvAlg.h
MuonGMR4::MuonDetectorManager::getAllReadoutElements
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
Returns the list of all detector elements.
MuonGM::MdtReadoutElement::getTubeLengthForCaching
double getTubeLengthForCaching(const int tubeLayer, const int tube) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx:104
MuonGMR4::MuonReadoutElement::globalToLocalTrans
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:78
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonGMR4::ReadoutGeomCnvAlg::m_alignStoreKeys
SG::ReadCondHandleKeyArray< ActsTrk::DetectorAlignStore > m_alignStoreKeys
Definition: ReadoutGeomCnvAlg.h:125
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
MuonGMR4::ReadoutGeomCnvAlg::buildMM
StatusCode buildMM(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:479
sTgcIdHelper::sTgcChannelTypes
sTgcChannelTypes
Definition: sTgcIdHelper.h:190
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache::detMgr
std::unique_ptr< MuonGM::MuonDetectorManager > detMgr
Pointer to the legacy MuonDetectorManager.
Definition: ReadoutGeomCnvAlg.h:46
MuonGM::MuonReadoutElement::getLongSsize
double getLongSsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:199
sTgcAlignmentStore.h
SpectrometerSector.h
MuonGMR4::ReadoutGeomCnvAlg::m_checkGeo
Gaudi::Property< bool > m_checkGeo
Definition: ReadoutGeomCnvAlg.h:127
MuonGMR4::RpcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:17
MuonGMR4::TgcReadoutElement::constructHash
static IdentifierHash constructHash(unsigned int measCh, unsigned int gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
MuonGMR4::ReadoutGeomCnvAlg::buildRpc
StatusCode buildRpc(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:280
RpcIdHelper
Definition: RpcIdHelper.h:51
MuonGM::WiregangArray
TgcReadoutParams::WiregangArray WiregangArray
Definition: RDBReaderAtlas.cxx:22
ReadCondHandle.h
MuonGM::sTgcReadoutElement::padGlobalCorners
bool padGlobalCorners(const Identifier &id, std::array< Amg::Vector3D, 4 > &gcorners) const
pad global corners
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:370
MuonGMR4::RpcReadoutElement::parameterBook
Set of parameters to describe a RPC chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:21
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
MuonGMR4::ReadoutGeomCnvAlg::checkIdCompability
StatusCode checkIdCompability(const MuonGMR4::MuonReadoutElement &refEle, const MuonGM::MuonReadoutElement &testEle) const
Definition: ReadoutGeomCnvAlg.cxx:730
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
Amg::getRotateZ3D
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Definition: GeoPrimitivesHelpers.h:270
MuonGM::MuonReadoutElement
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:40
MuonGM::MuonReadoutElement::getLongRsize
double getLongRsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:200
MuonGM::MuonReadoutElement::getSsize
double getSsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:196
MuonGMR4::MdtReadoutElement::measurementId
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:47
MdtAlignmentStore
Helper struct to cache simulatenously the As-built and the BLine corrections of the Mdts for fast acc...
Definition: MdtAlignmentStore.h:19
MuonGMR4::MdtReadoutElement::wireLength
double wireLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:188
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonGM::MdtReadoutElement::getWireLength
double getWireLength(const int tubeLayer, const int tube) const
MdtAlignmentStore::getDistortion
chamberDistortions getDistortion(const Identifier &detElId) const
Returns a chamber distortion that's cached for the corresponding Mdt chamber element.
Definition: MdtAlignmentStore.h:33
sTgcReadoutElement.h
ActsGeometryContext::getStore
AlignmentStorePtr & getStore(const DetectorType type)
Returns the mutable alignable store for the ATLAS detector type (Pixel, Mdt, etc.)
Definition: ActsGeometryContext.h:33
MuonGMR4::ReadoutGeomCnvAlg::cloneNswWedge
GeoIntrusivePtr< GeoVFullPhysVol > cloneNswWedge(const ActsGeometryContext &gctx, const MuonGMR4::MuonReadoutElement *nswRE, ConstructionCache &cacheObj) const
Clones the fullPhysicalVolume of the
Definition: ReadoutGeomCnvAlg.cxx:466
MMReadoutElement.h
MuonGMR4::MdtReadoutElement::uncutTubeLength
double uncutTubeLength(const IdentifierHash &tubeHash) const
Returns the uncut tube length.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:179
MuonGMR4::sTgcReadoutElement::createHash
static IdentifierHash createHash(const unsigned int gasGap, const unsigned int channelType, const unsigned int channel, const unsigned int wireInGrp=0)
Create a measurement hash from the Identifier fields.
MdtAlignmentStore::chamberDistortions
Helper struct to store the pointer to the Mdt distrotion parameters, namely the As-built and the BLin...
Definition: MdtAlignmentStore.h:25
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
MuonGMR4::MmReadoutElement::multilayer
int multilayer() const
Returns the multi layer of the element [1-2].
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:20
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonGM::TgcReadoutElement::nPitchesToGang
double nPitchesToGang(int gasGap, int gang) const
Returns the number of wire pitches that have to be travelled to reach gang i.
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
MuonGMR4::MmReadoutElement::stripPosition
Amg::Vector3D stripPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
ActsTrk::DetectorType::Mm
@ Mm
Maybe not needed in the migration.
MuonGMR4::ReadoutGeomCnvAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: ReadoutGeomCnvAlg.cxx:78
MuonGMR4::sTgcReadoutElement::numWireGroups
unsigned int numWireGroups(unsigned int gasGap) const
Number of wire groups in the gas gap.
MuonGM::MuonChannelDesign::DetType::MM
@ MM
MuonGMR4::MdtReadoutElement::parameterBook
Set of parameters to describe a MDT chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:27
MuonGM::MuonReadoutElement::getLongZsize
double getLongZsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:201
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtAlignmentStore.h
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGM::TgcReadoutElement::nWires
int nWires(int gasGap) const
Returns the total number of wires in a given gas gap.
MuonGM::MMReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MMReadoutElement.h:280
WriteCondHandle.h
MuonGMR4::RpcReadoutElement::doubletPhi
int doubletPhi() const
Returns the doublet Phi field of the MuonReadoutElement identifier.
MuonGM::MdtReadoutElement::getActiveTubeLength
double getActiveTubeLength(const int tubeLayer, const int tube) const
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:30
MuonGMR4::MdtReadoutElement::numLayers
unsigned int numLayers() const
Returns the number of tube layer.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::doesNotDeform
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Definition: GeoPrimitivesHelpers.h:383
MuonGMR4::RpcReadoutElement::stripPosition
Amg::Vector3D stripPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
MuonGM::MuonStation
Definition: MuonStation.h:51
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition: IOVInfiniteRange.h:39
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonGMR4::TgcReadoutElement::measurementId
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
MuonGMR4::RpcReadoutElement::doubletZ
int doubletZ() const
Returns the doublet Z field of the MuonReadoutElement identifier.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Amg::isIdentity
bool isIdentity(const Amg::Transform3D &trans)
Checks whether the transformation is the Identity transformation.
Definition: GeoPrimitivesHelpers.h:393
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
MuonGMR4::MuonReadoutElement::identHash
IdentifierHash identHash() const
Returns the Identifier has of the Element that is Identical to the detElHash from the id_helper class...
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache::translatedStations
std::set< PVConstLink > translatedStations
Set of all translated Physical volumes.
Definition: ReadoutGeomCnvAlg.h:50
MuonGMR4::MmReadoutElement::stripLayer
const StripLayer & stripLayer(const Identifier &measId) const
MuonGM::nStrips
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
Definition: MuonDetDescr/MuonGeoModelTest/src/GeoModelTgcTest.cxx:46
MuonGMR4::MuonDetectorManager::getTreeTop
PVConstLink getTreeTop(unsigned int i) const override final
Returns the i-th top node of the MuonSystem trees.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:133
IOVInfiniteRange.h
MdtAlignmentStore::chamberDistortions::asBuilt
const MdtAsBuiltPar * asBuilt
Definition: MdtAlignmentStore.h:27
dumpTgcDigiThreshold.isStrip
list isStrip
Definition: dumpTgcDigiThreshold.py:33
ActsTrk::DetectorType::Mdt
@ Mdt
MuonSpectrometer.
MuonGMR4::ReadoutGeomCnvAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: ReadoutGeomCnvAlg.h:121
MuonGM::MMReadoutElement::m_etaDesign
std::array< MuonChannelDesign, 4 > m_etaDesign
Definition: MMReadoutElement.h:157
MuonGMR4::sTgcReadoutElement::globalChannelPosition
Amg::Vector3D globalChannelPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global pad/strip/wireGroup position.
MmAlignmentStore
Definition: MmAlignmentStore.h:15
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
MuonGMR4::MuonReadoutElement::alignableTransform
const GeoAlignableTransform * alignableTransform() const
Returnsthe alignable transform of the readout element.
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
MuonGM::sTgcReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:332
sTgcIdHelper
Definition: sTgcIdHelper.h:55
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Amg::getRotateY3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
Definition: GeoPrimitivesHelpers.h:261
MuonGMR4::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
MuonGMR4::RpcReadoutElement::nPhiStrips
unsigned int nPhiStrips() const
Number of strips measuring the phi coordinate.
sTgcAlignmentStore
Definition: sTgcAlignmentStore.h:14
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGM::TgcReadoutElement::wirePitch
double wirePitch() const
Returns the pitch of the wires.
MuonGMR4::TgcReadoutElement::numChannels
unsigned int numChannels(const IdentifierHash &measHash) const
Returns the number of readout channels.
MuonGMR4::sTgcReadoutElement::numLayers
unsigned int numLayers() const
Returns the number of gas gap layers.
MuonGMR4::sTgcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h:20
MuonGMR4::StripLayer::design
const StripDesign & design() const
Returns the underlying strip design.
RpcReadoutElement.h
MuonChannelDesign.h
SG::ReadCondHandleKey< ActsTrk::DetectorAlignStore >
MuonGM::MuonPadDesign::Length
double Length
Definition: MuonPadDesign.h:55
MuonGM::StripArray
TgcReadoutParams::StripArray StripArray
Definition: RDBReaderAtlas.cxx:23
MuonGM::MuonChannelDesign
Definition: MuonChannelDesign.h:24
MuonGMR4::StripLayer
Definition: StripLayer.h:10
MuonGMR4::ReadoutGeomCnvAlg::initialize
StatusCode initialize() override
Definition: ReadoutGeomCnvAlg.cxx:69
MuonGM::MdtReadoutElement::tubePos
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
a
TList * a
Definition: liststreamerinfos.cxx:10
MmIdHelper
Definition: MmIdHelper.h:54
MuonGM::MuonReadoutElement::getRsize
double getRsize() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:197
MuonGMR4::MmReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MdtReadoutElement.h
MuonGMR4::ReadoutGeomCnvAlg::ReadoutGeomCnvAlg
ReadoutGeomCnvAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ReadoutGeomCnvAlg.cxx:66
MuonGMR4::sTgcReadoutElement::globalPadCorners
globalCornerArray globalPadCorners(const ActsGeometryContext &ctx, const Identifier &measId) const
GeoPrimitivesHelpers.h
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
ActsGeometryContext::AlignmentStorePtr
GeoModel::TransientConstSharedPtr< AlignmentStore > AlignmentStorePtr
Definition: ActsGeometryContext.h:31
MuonGM::TgcReadoutParams
Definition: TgcReadoutParams.h:38
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:25
MuonGM::RpcReadoutElement::Nstrips
int Nstrips(bool measphi) const
returns the number of strips for the phi or eta plane
MuonGMR4::sTgcReadoutElement::numPads
unsigned int numPads(const Identifier &measId) const
Pads Total number of pads in the given layer.
python.DecayParser.children
children
Definition: DecayParser.py:32
MuonGMR4::sTgcReadoutElement::numStrips
unsigned int numStrips(const Identifier &measId) const
Strips Number of strips in a chamber.
MuonGMR4::MuonReadoutElement::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:81
LArCellBinning.step
step
Definition: LArCellBinning.py:158
MuonGMR4::MdtReadoutElement::globalTubePos
Amg::Vector3D globalTubePos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the tube center.
MmAlignmentStore.h
TgcReadoutElement.h
MuonGMR4::StripDesign::stripPitch
double stripPitch() const
Distance between two adjacent strips.
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20
MuonGM::MdtReadoutElement::transform
virtual const Amg::Transform3D & transform(const Identifier &id) const override final
Return local to global transform associated with this identifier.
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
MuonGMR4::PadDesign
Definition: PadDesign.h:24
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache
Definition: ReadoutGeomCnvAlg.h:42
MuonStation.h
MuonGMR4::RadialStripDesign
Definition: RadialStripDesign.h:23
MuonGMR4::ReadoutGeomCnvAlg::m_writeKey
SG::WriteCondHandleKey< MuonGM::MuonDetectorManager > m_writeKey
Definition: ReadoutGeomCnvAlg.h:123
TgcReadoutElement.h
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
MuonGMR4::MdtReadoutElement::isValid
bool isValid(const IdentifierHash &measHash) const
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
MuonGMR4::TgcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:19
calibdata.tube
tube
Definition: calibdata.py:31
MuonGMR4::ReadoutGeomCnvAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: ReadoutGeomCnvAlg.h:128
MuonGM::MuonChannelDesign::ChannelType::etaStrip
@ etaStrip
MmReadoutElement.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Amg::getTranslate3D
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Definition: GeoPrimitivesHelpers.h:289
MuonGMR4::MuonDetectorManager::getReadoutElement
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
RpcReadoutElement.h
Identifier
Definition: IdentifierFieldParser.cxx:14