ATLAS Offline Software
ReadoutGeomCnvAlg.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2025 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 #include <format>
46 
47 #include <GaudiKernel/SystemOfUnits.h>
48 
49 
50 namespace {
51  using SubDetAlignment = ActsGeometryContext::AlignmentStorePtr;
52  bool hasStationVolume(const PVConstLink treeTop,
53  const std::set<PVConstLink>& translated) {
54  const unsigned int nCh = treeTop->getNChildVols();
55  for (unsigned int ch = 0 ; ch < nCh; ++ch) {
56  PVConstLink child = treeTop->getChildVol(ch);
57  if (translated.count(child) ||
58  hasStationVolume(child, translated)){
59  return true;
60  }
61  }
62  return false;
63  };
64 }
65 
66 namespace MuonGMR4{
67 
69  ATH_CHECK(m_idHelperSvc.retrieve());
71  ATH_CHECK(m_alignStoreKeys.initialize());
73  return StatusCode::SUCCESS;
74 }
75 
76 
77 StatusCode ReadoutGeomCnvAlg::execute(const EventContext& ctx) const {
79  if (writeHandle.isValid()) {
80  ATH_MSG_DEBUG("The current readout geometry is still valid.");
81  return StatusCode::SUCCESS;
82  }
83  writeHandle.addDependency(IOVInfiniteRange::infiniteRunLB());
85  ActsGeometryContext geoContext{};
86  using TrackingAlignment = ActsTrk::DetectorAlignStore::TrackingAlignStore;
89  if (!readHandle.isValid()) {
90  ATH_MSG_FATAL("Failed to retrieve alignment store "<<key.fullKey());
91  return StatusCode::FAILURE;
92  }
93  writeHandle.addDependency(readHandle);
94  auto alignStore = std::make_unique<ActsTrk::DetectorAlignStore>(**readHandle);
96  if (alignStore->geoModelAlignment) {
97  alignStore->geoModelAlignment->clearPosCache();
98  }
99  alignStore->trackingAlignment = std::make_unique<TrackingAlignment>(alignStore->detType);
100  geoContext.setStore(std::move(alignStore));
101  }
104  std::vector<ActsTrk::DetectorType> presentTechs = m_detMgr->getDetectorTypes();
105  for (const ActsTrk::DetectorType detType : presentTechs) {
106  if (geoContext.getStore(detType)) {
107  continue;
108  }
109  ATH_MSG_WARNING("No external detector alignment has been defined for technology "<<ActsTrk::to_string(detType));
110  geoContext.setStore(std::make_unique<ActsTrk::DetectorAlignStore>(detType));
111  }
113  ConstructionCache cacheObj;
114  cacheObj.detMgr = std::make_unique<MuonGM::MuonDetectorManager>();
115  cacheObj.world = createGeoWorld();
116  cacheObj.detMgr->addTreeTop(cacheObj.world);
118  ATH_CHECK(buildMdt(geoContext, cacheObj));
119  ATH_CHECK(buildTgc(geoContext, cacheObj));
120  ATH_CHECK(buildRpc(geoContext, cacheObj));
121  ATH_CHECK(buildSTGC(geoContext, cacheObj));
122  ATH_CHECK(buildMM(geoContext, cacheObj));
124  std::vector<GeoChildNodeWithTrf> treeTops = getChildrenWithRef(m_detMgr->getTreeTop(0), false);
125 
127  for (const GeoChildNodeWithTrf& treeTop : treeTops) {
128  if (hasStationVolume(treeTop.volume, cacheObj.translatedStations)) continue;
129  ATH_MSG_VERBOSE("Detected passive volume "<<treeTop.nodeName);
130 
131  cacheObj.world->add(const_pointer_cast(treeTop.volume));
132  }
133 
135  if (m_checkGeo) {
136  const std::vector<const MuonGMR4::MuonReadoutElement*> refEles{m_detMgr->getAllReadoutElements()};
137  for (const MuonGMR4::MuonReadoutElement* refEle : refEles) {
138  ATH_CHECK(checkIdCompability(*refEle, *cacheObj.detMgr->getReadoutElement(refEle->identify())));
139  }
140  }
141 
142  ATH_CHECK(writeHandle.record(std::move(cacheObj.detMgr)));
143  return StatusCode::SUCCESS;
144 }
146  const Identifier& stationId,
147  ConstructionCache& cacheObj) const {
148  const std::string stName{m_idHelperSvc->stationNameString(stationId)};
149  const int stEta{m_idHelperSvc->stationEta(stationId)};
150  const int stPhi{m_idHelperSvc->stationPhi(stationId)};
151  MuonGM::MuonStation* station = cacheObj.detMgr->getMuonStation(stName, stEta, stPhi);
152  if (station) {
153  ATH_MSG_DEBUG("Station "<<stName<<", stEta: "<<stEta<<", stPhi: "<<stPhi<<" already exists.");
154  return StatusCode::SUCCESS;
155  }
157  const MuonGMR4::MuonReadoutElement* copyMe = m_detMgr->getReadoutElement(stationId);
158 
160  const GeoVFullPhysVol* readOutVol = copyMe->getMaterialGeom();
161  PVConstLink parentVolume = readOutVol->getParent(); // This is the physical volume that contains the readOutVol as a child. This is a const link to an existing physical volume
162  cacheObj.translatedStations.insert(parentVolume);
164  PVLink parentPhysVol{make_intrusive<GeoFullPhysVol>(parentVolume->getLogVol())}; // This is a mutable pointer. This creates a new physical volume using the same logical structure (shapes and materials but not position).
165 
168  const std::vector<GeoChildNodeWithTrf> children = getChildrenWithRef(parentVolume, false); // we get the list of child nodes attached to the parent volume
169  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};
170  for (const GeoChildNodeWithTrf& child : children) {
171  std::vector<Amg::Vector3D> edges = getPolyShapeEdges(child.volume->getLogVol()->getShape(), //we are getting corner points of the edges
172  readOutVol->getX().inverse() * child.transform); //getX() returns the transformation from readout physical volume ref to parent physical volume ref. We take the inverse and we chain it with child.transform, which is from child ref to parent ref
173  for (const Amg::Vector3D& edge : edges) {
174  minX = std::min(minX, edge.x());
175  maxX = std::max(maxX, edge.x());
176  minZ = std::min(minZ, edge.z());
177  maxZ = std::max(maxZ, edge.z());
178  if (edge.z() < 0) {
179  minY1 = std::min(minY1, edge.y());
180  maxY1 = std::max(maxY1, edge.y());
181  } else {
182  minY2 = std::min(minY2, edge.y());
183  maxY2 = std::max(maxY2, edge.y());
184  }
185  }
186  }
189  const double shortS = (maxY1 - minY1);
190  const double longS = (maxY2 - minY2);
191  const double lengthR = (maxX - minX);
192  const double lengthZ = (maxZ - minZ);
193 
194  const GeoAlignableTransform* alignTrf{copyMe->alignableTransform()};
196  const Amg::Transform3D stationTransform = alignTrf->getDefTransform().inverse()*parentVolume->getX();
197 
198  for (const GeoChildNodeWithTrf& child : children) {
200  const GeoVPhysVol &childVolRef = *child.volume;
201  if (typeid(childVolRef) == typeid(GeoFullPhysVol)) {
202  continue;
203  }
204  // Add the beam lines / foams inside the station volume
205  PVLink childVol = const_pointer_cast<GeoVPhysVol>(child.volume);
206  parentPhysVol->add(cacheObj.newIdTag());
207  parentPhysVol->add(cacheObj.makeTransform(stationTransform*child.transform));
208  parentPhysVol->add(cloneVolume(childVol));
209  }
211  const Amg::Transform3D alignedTransform = copyMe->localToGlobalTrans(gctx) *
212  (stationTransform * readOutVol->getX()).inverse();
213 
214  ATH_MSG_VERBOSE("stName: "<<stName<<", stEta: "<<stEta<<", stPhi: "<<stPhi
215  <<" -- shortS: "<<shortS<<", longS: "<<longS
216  <<", lengthR: "<<lengthR<<", lengthZ: "<<lengthZ
217  <<std::endl<<"AlignableNode: "<<GeoTrf::toString(alignedTransform, true)
218  <<std::endl<<"Station transform: "<<GeoTrf::toString(stationTransform, true)
219  <<std::endl<<"Readout transform: "<<GeoTrf::toString(readOutVol->getX(), true));
220  auto newStation = std::make_unique<MuonGM::MuonStation>(stName,
221  shortS, lengthR, lengthZ,
222  longS, lengthR, lengthZ,
223  stEta, stPhi, false);
224  newStation->setPhysVol(parentPhysVol);
226  cacheObj.world->add(cacheObj.newIdTag());
227  GeoIntrusivePtr<GeoAlignableTransform> trf = make_intrusive<GeoAlignableTransform>(alignedTransform);
228  newStation->setTransform(trf);
229 
230  newStation->setNominalAmdbLRSToGlobal( trf->getTransform());
231 
232  cacheObj.detMgr->addMuonStation(std::move(newStation));
233 
234  cacheObj.world->add(trf);
235  cacheObj.world->add(parentPhysVol);
236 
237  return StatusCode::SUCCESS;
238 }
239 
240 
242  const Identifier& reId,
243  ConstructionCache& cacheObj,
244  GeoIntrusivePtr<GeoVFullPhysVol>& physVol,
245  MuonGM::MuonStation* & station) const {
246 
247  ATH_CHECK(buildStation(gctx, reId, cacheObj));
248  const std::string stName{m_idHelperSvc->stationNameString(reId)};
249  station = cacheObj.detMgr->getMuonStation(stName,
250  m_idHelperSvc->stationEta(reId),
251  m_idHelperSvc->stationPhi(reId));
252 
253  PVLink parentPhysVol{station->getPhysVol()};
255  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
256  parentPhysVol->add(cacheObj.newIdTag());
267  const Amg::Transform3D alignNodeToRE{copyMe->alignableTransform()->getDefTransform().inverse() *
268  readOutVol->getParent()->getX() * readOutVol->getX()};
269  const Amg::Transform3D alignedNode{copyMe->localToGlobalTrans(gctx) * alignNodeToRE.inverse()};
270 
271  const Amg::Transform3D stationTrf{station->getTransform().inverse() * alignedNode};
272 
273  parentPhysVol->add(cacheObj.makeTransform(stationTrf*alignNodeToRE));
275  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
276  physVol = dynamic_pointer_cast<GeoVFullPhysVol>(clonedVol);
277  parentPhysVol->add(physVol);
278  return StatusCode::SUCCESS;
279 }
280 
282 
283  const std::vector<const MuonGMR4::RpcReadoutElement*> readoutEles = m_detMgr->getAllRpcReadoutElements();
284  ATH_MSG_INFO("Copy "<<readoutEles.size()<<" Rpc readout elements to the legacy system");
285  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
286  for (const MuonGMR4::RpcReadoutElement* copyMe : readoutEles) {
287  const Identifier reId = copyMe->identify();
288  const MuonGMR4::RpcReadoutElement::parameterBook& pars{copyMe->getParameters()};
289  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
290  MuonGM::MuonStation* station{nullptr};
291  ATH_CHECK(cloneReadoutVolume(gctx, reId, cacheObj, physVol, station));
292  auto newElement = std::make_unique<MuonGM::RpcReadoutElement>(physVol,
293  m_idHelperSvc->stationNameString(reId),
294  1, 1, false, cacheObj.detMgr.get());
295  const bool aSide{copyMe->stationEta() > 0};
296  newElement->setDoubletPhi(copyMe->doubletPhi());
297  newElement->setDoubletR(copyMe->doubletR());
298  newElement->setDoubletZ(copyMe->doubletZ());
299  newElement->setIdentifier(reId);
300  newElement->setParentMuonStation(station);
301  station->addMuonReadoutElementWithAlTransf(newElement.get(), nullptr, station->nMuonReadoutElements());
302 
304  newElement->setLongZsize(2.*pars.halfLength);
305  newElement->setLongSsize(2.*pars.halfWidth);
306  newElement->setLongRsize(2.*pars.halfThickness);
307  newElement->setZsize(2.*pars.halfLength);
308  newElement->setSsize(2.*pars.halfWidth);
309  newElement->setRsize(2.*pars.halfThickness);
310 
311  newElement->m_nlayers = copyMe->nGasGaps();
312  newElement->m_phistripwidth = copyMe->stripPhiWidth();
313  newElement->m_etastripwidth = copyMe->stripEtaWidth();
314  newElement->m_phistrippitch = copyMe->stripPhiPitch();
315  newElement->m_etastrippitch = (aSide > 0 ? 1. : -1.) *copyMe->stripEtaPitch();
316  newElement->m_phistriplength = copyMe->stripPhiLength();
317  newElement->m_etastriplength = copyMe->stripEtaLength();
318 
319  newElement->m_nphistripsperpanel = copyMe->nPhiStrips();
320  newElement->m_netastripsperpanel = copyMe->nEtaStrips();
321  newElement->m_nphistrippanels = copyMe->nPhiPanels();
322  newElement->m_hasDEDontop = true;
323  newElement->m_descratzneg = false;
324 
325  std::vector<Identifier> gapIds{};
326  for (unsigned int gasGap = 1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
327  for (int doubPhi = copyMe->doubletPhiMax(); doubPhi >= copyMe->doubletPhi(); --doubPhi) {
328  for (bool measPhi : {false, true}) {
329  if (measPhi && copyMe->nPhiStrips()==0) continue;
330  const int channel = 1;
331  const Identifier gapId = idHelper.channelID(copyMe->identify(),
332  copyMe->doubletZ(),
333  doubPhi, gasGap, measPhi,
334  channel);
335 
336  gapIds.push_back(gapId);
337  const Amg::Vector3D locStripPos = copyMe->globalToLocalTrans(gctx) * copyMe->stripPosition(gctx, gapId);
338  ATH_MSG_VERBOSE("GasGap "<<m_idHelperSvc->toString(gapId)<<", local strip position: "<<Amg::toString(locStripPos));
339  newElement->m_gasGap_xPos[gasGap -1] = locStripPos.x();
342  const int dbPIdx = copyMe->doubletPhi() == 2 ? 1 : doubPhi;
343  if (measPhi) {
344  newElement->m_first_phistrip_s[dbPIdx -1] = locStripPos.y();
345  newElement->m_phistrip_z = locStripPos.z();
346  } else{
347  newElement->m_first_etastrip_z = locStripPos.z();
348  newElement->m_etastrip_s[dbPIdx-1] = locStripPos.y();
349  }
350  }
351  }
352  }
353  newElement->fillCache();
355  for (const Identifier& gapId : gapIds) {
356  const int surfaceHash = newElement->surfaceHash(gapId);
357  const int layerHash = newElement->layerHash(gapId);
358  const Amg::Transform3D& refTrf{copyMe->localToGlobalTrans(gctx, gapId)};
359  newElement->m_surfaceData->m_layerTransforms[surfaceHash] = refTrf;
360  newElement->m_surfaceData->m_layerCenters[layerHash] = refTrf.translation();
361  newElement->m_surfaceData->m_layerNormals[layerHash] = refTrf.linear() * Amg::Vector3D::UnitZ();
362  }
363  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newElement));
364  cacheObj.detMgr->addRpcReadoutElement(std::move(newElement));
365  }
366  return StatusCode::SUCCESS;
367 }
368 
369 
371 
372  std::vector<const MuonGMR4::TgcReadoutElement*> tgcReadouts{m_detMgr->getAllTgcReadoutElements()};
373  std::ranges::stable_sort(tgcReadouts,[](const MuonGMR4::TgcReadoutElement* a, const MuonGMR4::TgcReadoutElement* b){
374  return a->stationEta() > b->stationEta();
375  });
376  ATH_MSG_INFO("Copy "<<tgcReadouts.size()<<" Tgc readout elements to the legacy system");
377  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
378 
379  using TgcReadoutParams = MuonGM::TgcReadoutParams;
380  std::map<std::string, std::shared_ptr<TgcReadoutParams>> readoutParMap{};
381 
382  for (const MuonGMR4::TgcReadoutElement* copyMe: tgcReadouts) {
383  const Identifier reId = copyMe->identify();
384  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
385  MuonGM::MuonStation* station{nullptr};
386  ATH_CHECK(cloneReadoutVolume(gctx,reId, cacheObj, physVol, station));
387 
388  auto newRE = std::make_unique<MuonGM::TgcReadoutElement>(physVol, m_idHelperSvc->stationNameString(reId),
389  cacheObj.detMgr.get());
390  newRE->setIdentifier(reId);
391  newRE->setParentMuonStation(station);
392  ATH_MSG_DEBUG("Readout element "<<m_idHelperSvc->toString(reId)<<", design: "<<copyMe->chamberDesign());
393  std::shared_ptr<TgcReadoutParams>& readOutPars = readoutParMap[std::format("{:}_{:}", copyMe->chamberDesign(),
394  copyMe->stationEta()> 0? 'A' : 'C')];
395  if (!readOutPars) {
399 
400  std::array<WiregangArray, 3> wires{};
401  GasGapIntArray nWireGangs{}, nStrips{};
402  std::vector<StripArray> botMountings(copyMe->nGasGaps()),
403  topMountings(copyMe->nGasGaps());
404 
405  double wirePitch{0.};
406  for (unsigned int gasGap =1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
407  const IdentifierHash gangHash = copyMe->constructHash(0, gasGap, false);
408  const IdentifierHash stripHash = copyMe->constructHash(0, gasGap, true);
409  nWireGangs[gasGap -1] = copyMe->numWireGangs(gangHash);
410  nStrips[gasGap -1] = copyMe->numStrips(stripHash);
411  ATH_MSG_VERBOSE("Assigned wire gangs: "<<nWireGangs[gasGap-1]<<", strips: "<<nStrips[gasGap -1]
412  <<" for gas gap "<<gasGap);
413 
414  if (nWireGangs[gasGap -1]) {
415  const MuonGMR4::WireGroupDesign& design{copyMe->wireGangLayout(gangHash)};
416  wirePitch = design.stripPitch();
417  WiregangArray& fillMe{wires[gasGap-1]};
418  for (int gang = 1; gang <= design.numStrips(); ++gang) {
419  fillMe[gang -1] = design.numWiresInGroup(gang);
420  }
421  ATH_MSG_VERBOSE("Gang layout: "<<fillMe);
422  }
423  if (nStrips[gasGap -1]) {
424  const MuonGMR4::RadialStripDesign& design{copyMe->stripLayout(stripHash)};
425  const int nCh = nStrips[gasGap -1];
426  for (int strip = 1; strip <= nCh; ++strip) {
427  botMountings[gasGap-1][strip-1] = - design.stripLeftBottom(strip).x();
428  topMountings[gasGap-1][strip-1] = - design.stripLeftTop(strip).x();
429  }
430  botMountings[gasGap-1][nCh] = - design.stripRightBottom(nCh).x();
431  topMountings[gasGap-1][nCh] = - design.stripRightTop(nCh).x();
432  ATH_MSG_VERBOSE("Strip layout\n bottom: "<<botMountings<<"\n top: "<<topMountings);
433  }
434  }
435  readOutPars = std::make_unique<TgcReadoutParams>(copyMe->chamberDesign(),
436  0, wirePitch,
437  idHelper.stationPhiMax(reId),
438  std::move(nWireGangs),
439  std::move(wires[0]),
440  std::move(wires[1]),
441  std::move(wires[2]),
442  0,
443  std::move(botMountings),
444  std::move(topMountings),
445  std::move(nStrips));
446  }
447 
449  for (unsigned int gasGap = 1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
450  const IdentifierHash layHash{copyMe->constructHash(0, gasGap, false)};
452  const Amg::Vector3D translation{copyMe->globalToLocalTrans(gctx) * copyMe->center(gctx, layHash)};
453  newRE->setPlaneZ(translation.x(), gasGap);
454  }
455  newRE->setRsize(copyMe->moduleHeight());
456  newRE->setSsize(copyMe->moduleWidthS());
457  newRE->setZsize(copyMe->moduleThickness());
458 
459  newRE->setLongRsize(copyMe->moduleHeight());
460  newRE->setLongSsize(copyMe->moduleWidthL());
461  newRE->setLongZsize(copyMe->moduleThickness());
462 
463  newRE->setReadOutParams(readOutPars);
464  newRE->fillCache();
465  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
466  cacheObj.detMgr->addTgcReadoutElement(std::move(newRE));
467 
468  }
469  return StatusCode::SUCCESS;
470 }
471 
472 GeoIntrusivePtr<GeoVFullPhysVol>
474  const MuonGMR4::MuonReadoutElement* copyMe,
475  ConstructionCache& cacheObj) const {
476  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
477  cacheObj.translatedStations.insert(readOutVol->getParent());
478 
479  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
480  GeoIntrusivePtr<GeoFullPhysVol> physVol{dynamic_pointer_cast<GeoFullPhysVol>(clonedVol)};
481  cacheObj.world->add(cacheObj.newIdTag());
482  cacheObj.world->add(cacheObj.makeTransform(copyMe->localToGlobalTrans(gctx)));
483  cacheObj.world->add(physVol);
484  return physVol;
485 }
487 
488  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mm);
489  const auto alignStore = alignItr ?
490  static_cast<const MmAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
491 
492  if (alignStore) {
493  cacheObj.detMgr->setMMPassivation(alignStore->passivation);
494  }
495  const std::vector<const MuonGMR4::MmReadoutElement*> mmReadouts{m_detMgr->getAllMmReadoutElements()};
496  ATH_MSG_INFO("Copy "<<mmReadouts.size()<<" Mm readout elements to the legacy system");
497 
498  for (const MuonGMR4::MmReadoutElement* copyMe : mmReadouts) {
499  const Identifier reId = copyMe->identify();
500  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
501  auto newRE = std::make_unique<MuonGM::MMReadoutElement>(physVol,
502  m_idHelperSvc->stationNameString(reId),
503  copyMe->stationEta(),
504  copyMe->stationPhi(),
505  copyMe->multilayer(), cacheObj.detMgr.get());
507  for (unsigned int gasGap = 0; gasGap < copyMe->nGasGaps(); ++gasGap) {
508  const MuonGMR4::StripLayer& stripLayer{copyMe->stripLayer(MuonGMR4::MmReadoutElement::createHash(gasGap +1, 0))};
509  const MuonGMR4::StripDesign& designFrom{stripLayer.design()};
510 
511  newRE->m_Xlg[gasGap] = stripLayer.toOrigin() *
512  Amg::getRotateZ3D(-designFrom.stereoAngle()) *
514  ATH_MSG_VERBOSE("Layer transform "<<gasGap<<" "<<GeoTrf::toString(newRE->m_Xlg[gasGap], true));
515 
516  MuonGM::MuonChannelDesign& designTo{newRE->m_etaDesign[gasGap]};
517  designTo.defineTrapezoid(designFrom.shortHalfHeight(),
518  designFrom.longHalfHeight(),
519  designFrom.halfWidth(),
520  designFrom.stereoAngle());
522  designTo.detType = MuonGM::MuonChannelDesign::DetType::MM;
523  designTo.inputPitch = designFrom.stripPitch();
524  designTo.inputWidth = designTo.inputPitch * std::cos(designTo.stereoAngle());
525  designTo.nMissedBottomEta = designTo.nMissedBottomStereo = designFrom.firstStripNumber() - 1;
526  designTo.totalStrips = designFrom.numStrips();
527  designTo.nch = designFrom.numStrips();
528 
529  designTo.setFirstPos(designFrom.firstStripPos().x() + 0.5*designTo.inputPitch);
530  }
531 
532  newRE->fillCache();
533  if (alignStore && alignStore->getBLine(reId)) {
534  newRE->setBLinePar(*alignStore->getBLine(reId));
535  }
536  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
537  cacheObj.detMgr->addMMReadoutElement(std::move(newRE));
538  }
539  return StatusCode::SUCCESS;
540 }
541 
543  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::sTgc);
544  auto alignStore = alignItr ? static_cast<const sTgcAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
545 
546  const std::vector<const MuonGMR4::sTgcReadoutElement*> sTgcReadOuts{m_detMgr->getAllsTgcReadoutElements()};
547  ATH_MSG_INFO("Copy "<<sTgcReadOuts.size()<<" sTgc readout elements to the legacy system");
548 
549  for (const MuonGMR4::sTgcReadoutElement* copyMe : sTgcReadOuts) {
550  const Identifier reId = copyMe->identify();
551  ATH_MSG_DEBUG("Translate readout element "<<m_idHelperSvc->toStringDetEl(reId)<<".");
552  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
553 
554  auto newRE = std::make_unique<MuonGM::sTgcReadoutElement>(physVol,
555  m_idHelperSvc->stationNameString(reId).substr(1),
556  copyMe->stationEta(),
557  copyMe->stationPhi(),
558  copyMe->multilayer(),
559  cacheObj.detMgr.get());
560 
561  if (alignStore && alignStore->getBLine(reId)) {
562  newRE->setBLinePar(*alignStore->getBLine(reId));
563  }
564  for (unsigned int layer = 1; layer <= copyMe->numLayers(); ++layer) {
566  using ChannelDesign = MuonGM::MuonChannelDesign;
567  const IdentifierHash layerHash = MuonGMR4::sTgcReadoutElement::createHash(layer,channelType::Strip,0);
568 
569  const MuonGMR4::StripLayer& stripLayer{copyMe->stripLayer(layerHash)};
570  newRE->m_Xlg[layer -1] = stripLayer.toOrigin() * Amg::getRotateY3D(90. * Gaudi::Units::deg) * Amg::getTranslateX3D( layer%2 ? - 0.01 : 0.01 );
571 
572  const MuonGMR4::StripDesign& copyEtaDesign{stripLayer.design()};
573  ATH_MSG_VERBOSE("Layer: "<<layer<<" "<<copyEtaDesign);
575  ChannelDesign& etaDesign{newRE->m_etaDesign[layer-1]};
576  etaDesign.type = ChannelDesign::ChannelType::etaStrip;
577  etaDesign.detType = ChannelDesign::DetType::STGC;
578  if (copyEtaDesign.yCutout()) {
579  etaDesign.defineDiamond(copyEtaDesign.shortHalfHeight(),
580  copyEtaDesign.longHalfHeight(),
581  copyEtaDesign.halfWidth(),
582  copyEtaDesign.yCutout());
583  } else {
584  etaDesign.defineTrapezoid(copyEtaDesign.shortHalfHeight(),
585  copyEtaDesign.longHalfHeight(),
586  copyEtaDesign.halfWidth());
587 
588  }
589  etaDesign.firstPitch = copyEtaDesign.firstStripPos().x() + 0.5*copyEtaDesign.stripPitch() + copyEtaDesign.halfWidth();
590  etaDesign.inputPitch = copyEtaDesign.stripPitch();
591  etaDesign.inputWidth = copyEtaDesign.stripWidth();
592  etaDesign.nch = copyEtaDesign.numStrips();
593  ATH_MSG_VERBOSE(m_idHelperSvc->toStringDetEl(copyMe->identify())<<", layer: "<<layer<<", eta-design: "<< copyEtaDesign);
594  etaDesign.setFirstPos(copyEtaDesign.firstStripPos().x() + 0.5*copyEtaDesign.stripPitch());
596 
597  const MuonGMR4::WireGroupDesign& copyPhiDesign{copyMe->wireDesign(layerHash)};
598 
599  ChannelDesign& phiDesign{newRE->m_phiDesign[layer-1]};
600  phiDesign.type = ChannelDesign::ChannelType::phiStrip;
601  phiDesign.detType = ChannelDesign::DetType::STGC;
602  if (copyPhiDesign.yCutout() == 0.) {
603  phiDesign.defineTrapezoid(copyPhiDesign.shortHalfHeight(),
604  copyPhiDesign.longHalfHeight(),
605  copyPhiDesign.halfWidth());
606  } else {
607  phiDesign.defineDiamond(copyPhiDesign.shortHalfHeight(),
608  copyPhiDesign.longHalfHeight(),
609  copyPhiDesign.halfWidth(),
610  copyPhiDesign.yCutout());
611  }
612  phiDesign.inputPitch = copyPhiDesign.stripPitch();
613  phiDesign.inputWidth = copyPhiDesign.stripWidth();
614  ATH_MSG_VERBOSE(m_idHelperSvc->toStringDetEl(copyMe->identify())<<", layer: "<<layer<<", phi-design: "<< copyPhiDesign);
615  phiDesign.setFirstPos(copyPhiDesign.firstStripPos().x()); // Position of 1st wire, accounts for staggering
616  phiDesign.firstPitch = copyPhiDesign.numWiresInGroup(1); // Number of Wires in 1st group, group staggering
617  phiDesign.groupWidth = copyPhiDesign.numWiresInGroup(2); // Number of Wires normal group
618  phiDesign.nGroups = copyPhiDesign.numStrips(); // Number of Wire Groups
619  phiDesign.wireCutout = copyPhiDesign.wireCutout(); // Size of "active" wire region for digits
620  phiDesign.nch = copyPhiDesign.nAllWires();
621  phiDesign.isConvertedFromPhaseII = true;
622 
623  const MuonGMR4::PadDesign& copyPadDesign{copyMe->padDesign(layerHash)};
624  MuonGM::MuonPadDesign& padDesign{newRE->m_padDesign[layer-1]};
625  padDesign.Length = copyMe->chamberHeight();
626  padDesign.sWidth = copyMe->sChamberLength();
627  padDesign.lWidth = copyMe->lChamberLength();
628  padDesign.Size = 2.*copyPadDesign.halfWidth();
629  padDesign.ysFrame = copyMe->sFrameWidth();
630  padDesign.ylFrame = copyMe->lFrameWidth();
631  padDesign.thickness = copyMe->thickness();
633  if (copyPadDesign.yCutout()) {
634  padDesign.yCutout = copyPadDesign.halfWidth();
635  }
636  padDesign.setR(copyPadDesign.beamlineRadius());
637  padDesign.sPadWidth = 2.*copyPadDesign.shortHalfHeight();
638  padDesign.lPadWidth = 2.*copyPadDesign.longHalfHeight();
639  padDesign.nPadColumns = copyPadDesign.numPadPhi();
640  padDesign.firstPhiPos = copyPadDesign.firstPadPhiDiv();
641  padDesign.inputPhiPitch = copyPadDesign.anglePadPhi();
642  padDesign.PadPhiShift = copyPadDesign.padPhiShift();
643  padDesign.nPadH = copyPadDesign.numPadEta();
644  padDesign.padEtaMax = copyPadDesign.maxPadEta();
645  padDesign.firstRowPos = copyPadDesign.firstPadHeight();
646  padDesign.inputRowPitch = copyPadDesign.padHeight();
647  padDesign.sectorOpeningAngle = copyPadDesign.sectorAngle();
648  padDesign.isConvertedFromPhaseII = true;
649  }
650  newRE->fillCache();
651  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
652  cacheObj.detMgr->addsTgcReadoutElement(std::move(newRE));
653 
654  }
655  return StatusCode::SUCCESS;
656 }
659  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mdt);
660  const MdtAlignmentStore* alignStore = alignItr ?
661  static_cast<const MdtAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
662 
663  const std::vector<const MuonGMR4::MdtReadoutElement*> mdtReadOuts{m_detMgr->getAllMdtReadoutElements()};
664  ATH_MSG_INFO("Copy "<<mdtReadOuts.size()<<" Mdt readout elements to the legacy system");
665  for (const MuonGMR4::MdtReadoutElement* copyMe : mdtReadOuts) {
666  const Identifier reId = copyMe->identify();
667  ATH_MSG_DEBUG("Translate "<<m_idHelperSvc->toStringDetEl(reId));
669  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
670  MuonGM::MuonStation* station{nullptr};
671  ATH_CHECK(cloneReadoutVolume(gctx,reId, cacheObj, physVol, station));
672  if (copyMe->multilayer() == 1) {
673  const MuonGMR4::MdtReadoutElement* otherRE = copyMe->complementaryRE();
674  const double height = std::max(copyMe->moduleHeight(), otherRE->moduleHeight()) -
675  (copyMe->tubePitch() - 2. * copyMe->tubeRadius());
676 
677  const double modHalTHickO{0.5*otherRE->moduleThickness()},
678  modHalfThick{-0.5*copyMe->moduleThickness()};
679 
680  const double thickness = ( (otherRE->asBuiltRefFrame()*(modHalTHickO* Amg::Vector3D::UnitX())) -
681  (copyMe->asBuiltRefFrame()*(modHalfThick* Amg::Vector3D::UnitX()))).z();
682  if (copyMe->isBarrel()) {
683  station->setMdtZsize(height);
684  station->setMdtRsize(thickness);
685  } else {
686  station->setMdtRsize(height);
687  station->setMdtZsize(thickness);
688  }
689  }
690  const MuonGMR4::MdtReadoutElement::parameterBook& pars{copyMe->getParameters()};
691  auto newElement = std::make_unique<MuonGM::MdtReadoutElement>(physVol,
692  m_idHelperSvc->stationNameString(reId),
693  cacheObj.detMgr.get());
694  newElement->setIdentifier(reId);
695  newElement->setMultilayer(copyMe->multilayer());
696  newElement->setNMdtInStation(m_idHelperSvc->mdtIdHelper().multilayerMax(reId));
697  // cppcheck-suppress invalidLifetime; ok: mgr took ownership.
698  newElement->setParentMuonStation(station);
699 
701  newElement->setLongSsize(2*pars.longHalfX - 1.*Gaudi::Units::cm);
702  newElement->setSsize(2*pars.shortHalfX - 1.*Gaudi::Units::cm);
703  newElement->setLongRsize(2*pars.halfY);
704  newElement->setRsize(2*pars.halfY);
705  newElement->setZsize(2*pars.halfHeight);
706  newElement->setLongZsize(2*pars.halfHeight);
707 
708  newElement->m_nlayers = copyMe->numLayers();
709  newElement->m_ntubesperlayer = copyMe->numTubesInLay();
710  newElement->m_deadlength = pars.deadLength;
711  newElement->m_endpluglength = pars.endPlugLength;
712  newElement->m_innerRadius = pars.tubeInnerRad;
713  newElement->m_tubeWallThickness = pars.tubeWall;
714  newElement->m_tubepitch = pars.tubePitch;
717 
719  const MuonGMR4::MdtTubeLayer& tubeLay{*pars.tubeLayers[0]};
720  unsigned int step{1};
721  double lastLength{2.*tubeLay.uncutHalfLength(1)};
722  for (unsigned tube = 0; tube < copyMe->numTubesInLay(); ++tube) {
723  const double currLength = 2.*tubeLay.uncutHalfLength(tube);
724  ATH_MSG_VERBOSE(m_idHelperSvc->toString(copyMe->identify())<< ", tube "<<tube<<", length: "<<currLength);
725  if (std::abs(lastLength - currLength) > std::numeric_limits<float>::epsilon() ||
726  tube == copyMe->numTubesInLay() -1) {
727  newElement->m_tubelength[step-1] = lastLength;
728  newElement->m_tubelength[step] = currLength;
729  if (step == 1) {
730  newElement->m_ntubesinastep = tube;
731  }
732  lastLength = currLength;
733  ++step;
734  }
735  }
736  newElement->m_nsteps = step;
737 
739  double xOffSet{pars.halfY}, yOffSet{pars.halfHeight};
740  if (newElement->barrel()) std::swap(xOffSet, yOffSet);
741  for (unsigned lay = 1; lay <= copyMe->numLayers(); ++lay) {
742  const IdentifierHash tubeHash{copyMe->measurementHash(lay, 1)};
743  const Amg::Vector3D locTube = copyMe->localTubePos(tubeHash);
744  newElement->m_firstwire_x[lay-1] = locTube.z() + xOffSet;
745  newElement->m_firstwire_y[lay-1] = locTube.x() + yOffSet;
746  }
747  MdtAlignmentStore::chamberDistortions distort = alignStore ? alignStore->getDistortion(reId) :
749 
750  if (!station->hasMdtAsBuiltParams()){
751  station->setMdtAsBuiltParams(distort.asBuilt);
752  }
753  if (!station->hasBLines()){
754  station->setBline(distort.bLine);
755  }
756  const Amg::Vector3D refPoint = copyMe->bLineReferencePoint();
757  station->setBlineFixedPointInAmdbLRS(refPoint.x(), refPoint.y(), refPoint.z());
758 
759  newElement->geoInitDone();
760  newElement->setBLinePar(distort.bLine);
761  newElement->fillCache();
762  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newElement));
764  cacheObj.detMgr->addMdtReadoutElement(std::move(newElement));
765  }
766  return StatusCode::SUCCESS;
767 }
768 
770  const MuonGM::MuonReadoutElement& testEle) const{
771 
772  if (refEle.identify() != testEle.identify()) {
773  ATH_MSG_FATAL("Two different elements are compared "
774  <<m_idHelperSvc->toString(refEle.identify())<<" vs. "
775  <<m_idHelperSvc->toString(testEle.identify()));
776  return StatusCode::FAILURE;
777  }
778  if (refEle.identHash() != testEle.detectorElementHash()) {
779  ATH_MSG_FATAL("The hashes of the two detector elements "<<m_idHelperSvc->toString(refEle.identify())
780  <<" are completely different "<<refEle.identHash()<<" vs. "<<testEle.detectorElementHash());
781  return StatusCode::FAILURE;
782  }
783  return StatusCode::SUCCESS;
784 }
785 
787  const MuonGMR4::MmReadoutElement& refEle,
788  const MuonGM::MMReadoutElement& testEle) const {
789 
790  if (!m_checkGeo) {
791  return StatusCode::SUCCESS;
792  }
793  ATH_CHECK(checkIdCompability(refEle, testEle));
794 
795  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
796  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
797  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
798  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
799  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++ gasGap) {
800  const Identifier gapId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, 1);
801 
802  const Amg::Transform3D& refTrf{refEle.localToGlobalTrans(gctx, gapId)};
803  const Amg::Transform3D& testTrf{testEle.transform(gapId)};
804  if (!Amg::isIdentity(refTrf.inverse()*testTrf)) {
805  ATH_MSG_FATAL("The layer "<<m_idHelperSvc->toStringGasGap(gapId)<<" does not transform equally"
806  <<GeoTrf::toString(refTrf, true) <<" vs. "<<GeoTrf::toString(testTrf, true));
807  return StatusCode::FAILURE;
808  }
809  const MuonGMR4::StripDesign& stripDesign{refEle.stripLayer(gapId).design()};
810 
811  for (int strip = stripDesign.firstStripNumber(); strip <= stripDesign.numStrips(); ++strip) {
812  const Identifier stripId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, strip);
813  const Amg::Vector3D refStripPos{refEle.stripPosition(gctx, stripId)};
814  const Amg::Vector3D refStripDir{refEle.localToGlobalTrans(gctx, refEle.layerHash(stripId)).linear() * Amg::Vector3D::UnitX()};
815 
816  Amg::Vector3D testStripPos{Amg::Vector3D::Zero()};
817  if (!testEle.stripGlobalPosition(stripId, testStripPos)) {
818  ATH_MSG_FATAL("Failed to retrieve strip position "<<m_idHelperSvc->toString(stripId));
819  return StatusCode::FAILURE;
820  }
821  const double dist = refStripDir.dot(refStripPos - testStripPos);
822  if (std::abs(dist) > 10. * Gaudi::Units::micrometer) {
823  ATH_MSG_FATAL("The strip "<<Amg::toString(testStripPos)<<" is not describing the same strip as "
824  <<Amg::toString(refStripPos)<<". Channel "<<m_idHelperSvc->toString(stripId)
825  <<" distance: "<<dist<<" "<<(dist / testEle.m_etaDesign[gasGap -1].inputWidth));
826  return StatusCode::FAILURE;
827  }
828  ATH_MSG_VERBOSE("Channel postion "<<m_idHelperSvc->toString(stripId)<<" match between legacy & new");
829  }
830  }
831  return StatusCode::SUCCESS;
832 }
833 
835  const MuonGMR4::MdtReadoutElement& refEle,
836  const MuonGM::MdtReadoutElement& testEle) const {
837 
838  if (!m_checkGeo) {
839  return StatusCode::SUCCESS;
840  }
841  ATH_CHECK(checkIdCompability(refEle, testEle));
842 
843  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
844  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx))
845  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform())
846  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
847  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
848  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
849  for (unsigned int lay = 1; lay <= refEle.numLayers(); ++lay){
850  for (unsigned int tube = 1; tube <= refEle.numTubesInLay(); ++tube) {
851  const IdentifierHash tubeHash {refEle.measurementHash(lay,tube)};
852  if (!refEle.isValid(tubeHash)) {
853  ATH_MSG_VERBOSE("SKip layer / tube "<<lay <<","<<tube);
854  continue;
855  }
856  const Amg::Transform3D globToLocal = refEle.globalToLocalTrans(gctx, tubeHash);
857 
858  const Amg::Vector3D refPos = refEle.globalTubePos(gctx, tubeHash);
859  const Amg::Vector3D tubePos = testEle.tubePos(lay, tube);
860 
861 
862  if ( (refPos - tubePos).mag() > Gaudi::Units::micrometer &&
863  (globToLocal*refPos - globToLocal * tubePos).perp() > Gaudi::Units::micrometer) {
864  ATH_MSG_ERROR("Tube positions differ for "<<m_idHelperSvc->toString(refEle.measurementId(tubeHash))
865  <<" reference: "<<GeoTrf::toString(globToLocal*refPos)<<" vs. test: "
866  <<GeoTrf::toString(globToLocal*tubePos) <<" delta: "<<(refPos - tubePos).mag()
867  <<" Transforms "<<std::endl
868  <<" **** "<< GeoTrf::toString(globToLocal.inverse())<<std::endl
869  <<" **** "<< GeoTrf::toString(testEle.transform(lay, tube)));
870  return StatusCode::FAILURE;
871  }
872  ATH_MSG_VERBOSE("Tube positions layer: "<<lay<<", tube: "<<tube
873  <<std::endl<<"reference: "<<GeoTrf::toString(refPos)
874  <<std::endl<<"test: "<<GeoTrf::toString(tubePos)
875  <<std::endl<<testEle.tubeLength(lay, tube)<<"/"<<testEle.getActiveTubeLength(lay, tube)<<"/"
876  <<testEle.getWireLength(lay,tube)<<" vs. "<<refEle.tubeLength(tubeHash)
877  <<"/"<<refEle.activeTubeLength(tubeHash)<<"/"<<refEle.wireLength(tubeHash)
878  <<"/"<<refEle.uncutTubeLength(tubeHash));
879  if (std::abs(testEle.getTubeLengthForCaching(lay,tube) - refEle.uncutTubeLength(tubeHash)) >
880  std::numeric_limits<float>::epsilon() ) {
881  ATH_MSG_FATAL("Different tube length's detected for "<<m_idHelperSvc->toStringDetEl(refEle.identify())
882  << " layer: "<<lay<<", tube: "<<tube<<" -- "<<testEle.getTubeLengthForCaching(lay,tube)<<" (new) vs. "
883  <<refEle.uncutTubeLength(tubeHash)<<" (ref)");
884  return StatusCode::FAILURE;
885  }
886  }
887  }
888 
889  return StatusCode::SUCCESS;
890 }
892  const MuonGMR4::RpcReadoutElement& refEle,
893  const MuonGM::RpcReadoutElement& testEle) const {
894 
895  if (!m_checkGeo) {
896  return StatusCode::SUCCESS;
897  }
898  ATH_CHECK(checkIdCompability(refEle, testEle));
899 
900  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
901  <<" ref: "<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)<<std::endl
902  <<" test: "<<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
903  <<"delta: "<<GeoTrf::toString(testEle.absTransform().inverse()*refEle.localToGlobalTrans(gctx), true ));
904  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
905  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
906  for (int doubPhi = refEle.doubletPhi(); doubPhi <= refEle.doubletPhiMax(); ++doubPhi) {
907  for (bool measPhi : {false, true}) {
908  if (measPhi && !refEle.nPhiStrips()) continue;
909  for (int strip = 1; strip <= testEle.Nstrips(measPhi); ++strip) {
910  const Identifier stripId = idHelper.channelID(refEle.identify(),
911  refEle.doubletZ(),
912  doubPhi, gasGap, measPhi, strip);
913 
914  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, stripId)};
915  const Amg::Transform3D& testTrans{testEle.transform(stripId)};
916  if (strip == 1 && !Amg::isIdentity(refTrans.inverse()*testTrans)) {
917  ATH_MSG_ERROR("Transformation for "<<m_idHelperSvc->toString(stripId)<<" - "<<refEle.identHash()<<std::endl
918  <<" *** ref: "<<GeoTrf::toString(refTrans)<<std::endl
919  <<" *** test: "<<GeoTrf::toString(testTrans)<<std::endl
920  <<" -> delta: "<<GeoTrf::toString(refTrans.inverse()*testTrans));
921  return StatusCode::FAILURE;
922  }
923 
924  const Amg::Vector3D refStripPos = refEle.stripPosition(gctx, stripId);
925  const Amg::Vector3D testStripPos = testEle.stripPos(stripId);
926  // The threshold here used to be epsilon for a float.
927  // But this was then giving a failure in aarch64,
928  // with a difference of almost exactly 1e-4.
929  // It turned out that that was coming from GeoDeDuplicator,
930  // where to consider two transforms equivalent,
931  // the translations must match to 1e-4. But if the
932  // difference is almost exactly 1e-4, then small FP
933  // differences can be magnified to just about 1e-4.
934  if ((refStripPos - testStripPos).mag() > 2e-4){
935  ATH_MSG_ERROR("Mismatch in strip positions "<<m_idHelperSvc->toString(stripId)
936  <<" ref: "<<Amg::toString(refStripPos)<<" test: "<<Amg::toString(testStripPos)
937  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refStripPos)
938  <<" test: "<<Amg::toString(refTrans.inverse()*testStripPos));
939  return StatusCode::FAILURE;
940  }
941  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(stripId)
942  <<" strip position "<<Amg::toString(refStripPos)
943  <<", local: "<<Amg::toString(refTrans.inverse()*refStripPos));
944  }
945  }
946  }
947  }
948  return StatusCode::SUCCESS;
949 }
951  const MuonGMR4::TgcReadoutElement& refEle,
952  const MuonGM::TgcReadoutElement& testEle) const {
953 
954  if (!m_checkGeo) {
955  return StatusCode::SUCCESS;
956  }
957  ATH_CHECK(checkIdCompability(refEle, testEle));
958 
959  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
960 
961  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
962  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)
963  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform(), true)
964  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
965  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
966  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
967 
968  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
969  for (bool isStrip : {false, true}) {
970  const IdentifierHash layHash = refEle.constructHash(0, gasGap, isStrip);
971 
972  const Identifier layId = idHelper.channelID(refEle.identify(), gasGap, isStrip, 1);
973  ATH_MSG_VERBOSE("Test layer "<<m_idHelperSvc->toString(layId)<<", nCh: "<<refEle.numChannels(layHash)<<", layHash: "<<layHash);
974  if (!refEle.numChannels(layHash)) continue;
975  const Amg::Transform3D& refLayerTrf = refEle.localToGlobalTrans(gctx, layHash);
976  const Amg::Transform3D& testLayerTrf = testEle.transform(layId);
977  if (!Amg::isIdentity(refLayerTrf.inverse()* testLayerTrf)) {
978  ATH_MSG_FATAL("The transformations in "<<m_idHelperSvc->toString(layId)
979  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
980  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true)
981  <<" are not identical. ");
982  return StatusCode::FAILURE;
983  }
984  ATH_MSG_VERBOSE("Transformations in "<<m_idHelperSvc->toString(layId)
985  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
986  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true));
987 
988  for (unsigned int ch = 1; ch <= refEle.numChannels(layHash); ++ch) {
989  const IdentifierHash measHash = refEle.constructHash(ch, gasGap, isStrip);
990  const Identifier measId = refEle.measurementId(measHash);
991  const Amg::Vector3D refChannel = refEle.channelPosition(gctx, measHash);
992  const Amg::Vector3D testChannel = testEle.channelPos(measId);
993  if ((refChannel - testChannel).mag() < std::numeric_limits<float>::epsilon()){
994  continue;
995  }
996  std::stringstream msg{};
997  msg<<"The channel "<<m_idHelperSvc->toString(measId)
998  << " is not at the same position "<<Amg::toString(refChannel)
999  <<" vs. "<<Amg::toString(testChannel)<<". Difference: "
1000  <<(refChannel - testChannel).mag();
1001  if (!isStrip) {
1002  msg<<std::endl<<"*** Test *** - wirePitch: "<<testEle.wirePitch()
1003  <<", tot wires "<<testEle.nWires(gasGap)
1004  <<", wires to reach "<<testEle.nPitchesToGang(gasGap, ch)
1005  <<", wires in gang "<<testEle.nWires(gasGap, ch);
1006  const MuonGMR4::WireGroupDesign& design{refEle.wireGangLayout(gasGap)};
1007  msg<<std::endl<<"*** Ref *** - wirePitch: "<<design.stripPitch()
1008  <<", tot wires "<<testEle.nWires(gasGap)
1009  <<", wires to reach "<<design.numPitchesToGroup(ch)
1010  <<", wires in gang "<<design.numWiresInGroup(ch);
1011  } else {
1012  const Amg::Vector3D locRefPos{refLayerTrf.inverse() * refChannel};
1013  const Amg::Vector3D locTestPos{refLayerTrf.inverse()* testChannel};
1014  msg<<std::endl<<"*** Ref **** - "<<Amg::toString(locRefPos)<<std::endl;
1015  msg<<std::endl<<"*** Test **** - "<<Amg::toString(locTestPos)<<std::endl;
1016  }
1017  ATH_MSG_FATAL(msg.str());
1018  return StatusCode::FAILURE;
1019  }
1020 
1021  }
1022  }
1023  return StatusCode::SUCCESS;
1024 }
1026  const MuonGMR4::sTgcReadoutElement& refEle,
1027  const MuonGM::sTgcReadoutElement& testEle) const {
1028  if (!m_checkGeo) {
1029  return StatusCode::SUCCESS;
1030  }
1031  ATH_CHECK(checkIdCompability(refEle, testEle));
1032 
1033  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
1034  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
1035  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
1036  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
1037  for (unsigned int gasGap = 1; gasGap <= refEle.numLayers(); ++gasGap) {
1038  for (int chType : {sTgcIdHelper::sTgcChannelTypes::Pad , sTgcIdHelper::sTgcChannelTypes::Strip, sTgcIdHelper::sTgcChannelTypes::Wire}) {
1039  const Identifier layID = idHelper.channelID(refEle.identify(),
1040  refEle.multilayer(),
1041  gasGap, chType, 1);
1042  const unsigned int numChannel = refEle.numChannels(layID);
1043  constexpr unsigned firstCh = 1;
1044  for (unsigned int channel = firstCh; channel < numChannel ; ++channel) {
1045  Identifier chID;
1046  bool isValid = false;
1047  if(chType == sTgcIdHelper::sTgcChannelTypes::Pad) {
1048  const int etaIndex = refEle.padDesign(layID).padNumber(channel).first;
1049  const int phiIndex = refEle.padDesign(layID).padNumber(channel).second;
1050  chID = idHelper.padID(refEle.identify(),
1051  refEle.multilayer(),
1052  gasGap, chType, etaIndex, phiIndex, isValid);
1053  } else {
1054  chID = idHelper.channelID(refEle.identify(),
1055  refEle.multilayer(),
1057  }
1058 
1059  if(!isValid) {
1060  ATH_MSG_WARNING("Invalid Identifier detected: " << m_idHelperSvc->toString(chID));
1061  }
1062 
1063  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, chID)};
1064  const Amg::Transform3D& testTrans{testEle.transform(chID)};
1065  if (channel == firstCh && (!Amg::doesNotDeform(testTrans.inverse()*refTrans)
1066  || (testTrans.inverse()*refTrans).translation().perp() > std::numeric_limits<float>::epsilon() ) ) {
1067  ATH_MSG_ERROR(__func__<<"() "<<__LINE__<<" - Transformation for "<<m_idHelperSvc->toString(chID)<<std::endl
1068  <<" *** ref: "<<GeoTrf::toString(refTrans, true)<<std::endl
1069  <<" *** test: "<<GeoTrf::toString(testTrans, true));
1070  return StatusCode::FAILURE;
1071  }
1072  if (chType == sTgcIdHelper::sTgcChannelTypes::Pad) {
1073  const Amg::Transform3D& testPadTrans{testEle.transform(chID)};
1074  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1075  Amg::Vector3D testChannelPos(Amg::Vector3D::Zero());
1076  testEle.stripGlobalPosition(chID, testChannelPos);
1077 
1078  const std::array<Amg::Vector3D,4> refPadCorners = refEle.globalPadCorners(gctx, chID);
1079  std::array<Amg::Vector3D,4> testPadCorners{make_array<Amg::Vector3D, 4>(Amg::Vector3D::Zero())};
1080  testEle.padGlobalCorners(chID, testPadCorners);
1081  for (unsigned int cornerIdx = 0; cornerIdx < refPadCorners.size(); ++cornerIdx) {
1082  const double padCornerDiff = (refPadCorners[cornerIdx] - testPadCorners[cornerIdx]).mag();
1083  if (padCornerDiff - 25. > 1. * Gaudi::Units::micrometer){
1084  ATH_MSG_ERROR("Mismatch in pad Corner " << cornerIdx << ": " <<m_idHelperSvc->toString(chID)
1085  <<" ref: "<<Amg::toString(refPadCorners[cornerIdx])<<" test: "<<Amg::toString(testPadCorners[cornerIdx])
1086  <<" difference: " << padCornerDiff
1087  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refPadCorners[cornerIdx])
1088  <<" test: "<<Amg::toString(testPadTrans.inverse()*testPadCorners[cornerIdx]));
1089  return StatusCode::FAILURE;
1090  }
1091  }
1092  const double padChannelDiff = (refChannelPos - testChannelPos).mag();
1093  if (padChannelDiff - 25. > 1. * Gaudi::Units::micrometer){
1094  ATH_MSG_ERROR("Mismatch in pad positions "<<m_idHelperSvc->toString(chID)
1095  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1096  <<" difference: " << padChannelDiff
1097  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refChannelPos)
1098  <<" test: "<<Amg::toString(testPadTrans.inverse()*testChannelPos));
1099  return StatusCode::FAILURE;
1100  }
1101  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1102  <<" channel position "<<Amg::toString(refChannelPos));
1103  }
1104  else if (chType == sTgcIdHelper::sTgcChannelTypes::Strip){
1105  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1106  Amg::Vector3D testChannelPos{Amg::Vector3D::Zero()};
1107  testEle.stripGlobalPosition(chID, testChannelPos);
1108  if ((refChannelPos - testChannelPos).mag() > 1. * Gaudi::Units::micrometer){
1109  ATH_MSG_ERROR("Mismatch in strip positions "<<m_idHelperSvc->toString(chID)
1110  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1111  <<" local coordinates -- ref: "<<Amg::toString(testTrans.inverse()*refChannelPos)
1112  <<" test: "<<Amg::toString(testTrans.inverse()*testChannelPos));
1113  return StatusCode::FAILURE;
1114  }
1115  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1116  <<" channel position "<<Amg::toString(refChannelPos));
1117  } else { // wire
1118  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1119  Amg::Vector3D testChannelPos{Amg::Vector3D::Zero()};
1120  testEle.stripGlobalPosition(chID, testChannelPos);
1121  Amg::Vector3D localRefPos {testTrans.inverse()*refChannelPos};
1122  Amg::Vector3D localTestPos{testTrans.inverse()*testChannelPos};
1124  if((std::abs(localRefPos.x() -localTestPos.x()) > 1.* Gaudi::Units::micrometer)
1125  || (std::abs(refChannelPos.z() -testChannelPos.z()) > 15.* Gaudi::Units::micrometer)){
1126  ATH_MSG_ERROR("Mismatch in wire positions "<<m_idHelperSvc->toString(chID)
1127  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1128  <<" local coordinates -- ref: "<<Amg::toString(testTrans.inverse()*refChannelPos)
1129  <<" test: "<<Amg::toString(testTrans.inverse()*testChannelPos)
1130  <<"delta X: "<<std::abs(localRefPos.x() -localTestPos.x())
1131  <<", delta Z: "<<std::abs(localRefPos.z() -localTestPos.z()));
1132  return StatusCode::FAILURE;
1133  }
1134  }
1135  }
1136  }
1137  }
1138  return StatusCode::SUCCESS;
1139 }
1140 }
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:542
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:657
MuonGMR4::ReadoutGeomCnvAlg::dumpAndCompare
StatusCode dumpAndCompare(const ActsGeometryContext &gctx, const MuonGMR4::RpcReadoutElement &refEle, const MuonGM::RpcReadoutElement &testEle) const
Definition: ReadoutGeomCnvAlg.cxx:891
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:18
STGC
@ STGC
Definition: RegSelEnums.h:39
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
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:162
MuonGMR4::StripDesign
Definition: StripDesign.h:30
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
MuonGMR4::MdtReadoutElement::asBuiltRefFrame
Amg::Transform3D asBuiltRefFrame() const
Returns the transformation to go into the reference frame of the as-buit & b-line model starting from...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:209
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:241
MuonGMR4::MmReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gas gaps.
MuonGMR4::RpcReadoutElement::nGasGaps
unsigned nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
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
vtune_athena.format
format
Definition: vtune_athena.py:14
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:145
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition: GeometryDefs.h:17
MuonGMR4::PadDesign::padNumber
std::pair< int, int > padNumber(const int SeqChannel) const
Returns the pad (eta,phi) for a given pad number in sequence (1,2,3,...18,19,20......
MdtAlignmentStore::chamberDistortions::bLine
const BLinePar * bLine
Definition: MdtAlignmentStore.h:26
MuonGMR4::ReadoutGeomCnvAlg::buildTgc
StatusCode buildTgc(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:370
perp
Scalar perp() const
perp method - perpenticular length
Definition: AmgMatrixBasePlugin.h:44
MuonGM::MuonStation::getPhysVol
PVConstLink getPhysVol() const
Definition: MuonStation.cxx:398
MuonGM::MuonChannelDesign::defineTrapezoid
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
set the trapezoid dimensions
Definition: MuonChannelDesign.cxx:25
MuonGMR4::sTgcReadoutElement::numChannels
unsigned int numChannels(const Identifier &measId) const
Returns the number of strips / wires / pads in a given gasGap.
ActsTrk::DetectorAlignStore::TrackingAlignStore
Store holding the transfomations used by the Acts algorithms.
Definition: DetectorAlignStore.h:33
TgcIdHelper
Definition: TgcIdHelper.h:50
sTgcReadoutElement.h
MuonGMR4::TgcReadoutElement::wireGangLayout
const WireGroupDesign & wireGangLayout(const IdentifierHash &layHash) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
MuonGMR4::MdtReadoutElement::tubeLength
double tubeLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:183
MuonGMR4::ReadoutGeomCnvAlg::ConstructionCache::world
PVLink world
Pointer to the world.
Definition: ReadoutGeomCnvAlg.h:48
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonGMR4::MdtReadoutElement::moduleThickness
double moduleThickness() const
Returns the thickness of the chamber.
MuonGM::GasGapIntArray
TgcReadoutParams::GasGapIntArray GasGapIntArray
Definition: RDBReaderAtlas.cxx:21
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.
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:104
MuonGM::MuonStation::getTransform
Amg::Transform3D getTransform() const
Definition: MuonStation.h:180
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::StripLayer::toOrigin
const Amg::Transform3D & toOrigin() const
Returns the transformation to go from the strip layer center to the origin of the Strip chamber.
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:171
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:103
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
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:872
MuonGMR4::ReadoutGeomCnvAlg::m_alignStoreKeys
SG::ReadCondHandleKeyArray< ActsTrk::DetectorAlignStore > m_alignStoreKeys
Definition: ReadoutGeomCnvAlg.h:124
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
MuonGMR4::ReadoutGeomCnvAlg::buildMM
StatusCode buildMM(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:486
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:126
MuonGMR4::RpcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/RpcReadoutElement.h:17
MuonGMR4::ReadoutGeomCnvAlg::buildRpc
StatusCode buildRpc(const ActsGeometryContext &gctx, ConstructionCache &cacheObj) const
Definition: ReadoutGeomCnvAlg.cxx:281
RpcIdHelper
Definition: RpcIdHelper.h:51
MuonGMR4::TgcReadoutElement::nGasGaps
unsigned nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
MuonGM::WiregangArray
TgcReadoutParams::WiregangArray WiregangArray
Definition: RDBReaderAtlas.cxx:23
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:769
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:46
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:186
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:473
MMReadoutElement.h
MuonGMR4::MdtReadoutElement::uncutTubeLength
double uncutTubeLength(const IdentifierHash &tubeHash) const
Returns the uncut tube length.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:177
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:19
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:77
z
#define z
MuonGM::MuonChannelDesign::DetType::MM
@ MM
MuonGMR4::MdtReadoutElement::parameterBook
Set of parameters to describe a MDT chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:22
python.SystemOfUnits.micrometer
float micrometer
Definition: SystemOfUnits.py:80
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
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:277
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
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::StripLayer::design
const StripDesign & design(bool phiView=false) const
Returns the underlying strip design.
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::MdtReadoutElement::moduleHeight
double moduleHeight() const
Returns the height of the chamber (Distance bottom - topWidth)
MuonGMR4::MuonDetectorManager::getTreeTop
PVConstLink getTreeTop(unsigned int i) const override final
Returns the i-the tree top GeoModel volume.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:152
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:120
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:18
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
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.
sTgcAlignmentStore
Definition: sTgcAlignmentStore.h:15
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::sTgcReadoutElement::numLayers
unsigned int numLayers() const
Returns the number of gas gap layers.
MuonGMR4::sTgcReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/sTgcReadoutElement.h:20
MuonGMR4::sTgcReadoutElement::padDesign
const PadDesign & padDesign(const Identifier &measId) const
Retrieves the readoutElement Layer given the Identifier/Hash.
RpcReadoutElement.h
MuonChannelDesign.h
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
SG::ReadCondHandleKey< ActsTrk::DetectorAlignStore >
MuonGM::MuonPadDesign::Length
double Length
Definition: MuonPadDesign.h:55
MuonGM::StripArray
TgcReadoutParams::StripArray StripArray
Definition: RDBReaderAtlas.cxx:24
MuonGM::MuonChannelDesign
Definition: MuonChannelDesign.h:24
MuonGMR4::StripLayer
The StripLayer interfaces the 2D description of the strip plane layout with the 3D description of the...
Definition: StripLayer.h:19
MuonGMR4::ReadoutGeomCnvAlg::initialize
StatusCode initialize() override
Definition: ReadoutGeomCnvAlg.cxx:68
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::sTgcReadoutElement::globalPadCorners
globalCornerArray globalPadCorners(const ActsGeometryContext &ctx, const Identifier &measId) const
GeoPrimitivesHelpers.h
MuonGMR4::TgcReadoutElement::constructHash
static IdentifierHash constructHash(unsigned measCh, unsigned gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
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
python.DecayParser.children
children
Definition: DecayParser.py:31
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::MdtReadoutElement::complementaryRE
const MdtReadoutElement * complementaryRE() const
Returns the pointer to the other readout element inside the muon station.
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::TgcReadoutElement::numChannels
unsigned numChannels(const IdentifierHash &measHash) const
Returns the number of readout channels.
MuonGMR4::RadialStripDesign
Definition: RadialStripDesign.h:23
MuonGMR4::ReadoutGeomCnvAlg::m_writeKey
SG::WriteCondHandleKey< MuonGM::MuonDetectorManager > m_writeKey
Definition: ReadoutGeomCnvAlg.h:122
TgcReadoutElement.h
Amg::getTranslateX3D
Amg::Transform3D getTranslateX3D(const double X)
: Returns a shift transformation along the x-axis
Definition: GeoPrimitivesHelpers.h:277
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
MuonGMR4::RpcReadoutElement::nPhiStrips
unsigned nPhiStrips() const
Number of strips measuring the phi coordinate.
calibdata.tube
tube
Definition: calibdata.py:30
MuonGMR4::ReadoutGeomCnvAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: ReadoutGeomCnvAlg.h:127
MuonGM::MuonChannelDesign::ChannelType::etaStrip
@ etaStrip
MmReadoutElement.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
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