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 
68  ATH_CHECK(m_idHelperSvc.retrieve());
70  ATH_CHECK(m_alignStoreKeys.initialize());
72  return StatusCode::SUCCESS;
73 }
74 
75 
76 StatusCode ReadoutGeomCnvAlg::execute(const EventContext& ctx) const {
78  if (writeHandle.isValid()) {
79  ATH_MSG_DEBUG("The current readout geometry is still valid.");
80  return StatusCode::SUCCESS;
81  }
82  writeHandle.addDependency(IOVInfiniteRange::infiniteRunLB());
84  ActsGeometryContext geoContext{};
85  using TrackingAlignment = ActsTrk::DetectorAlignStore::TrackingAlignStore;
88  if (!readHandle.isValid()) {
89  ATH_MSG_FATAL("Failed to retrieve alignment store "<<key.fullKey());
90  return StatusCode::FAILURE;
91  }
92  writeHandle.addDependency(readHandle);
93  auto alignStore = std::make_unique<ActsTrk::DetectorAlignStore>(**readHandle);
95  if (alignStore->geoModelAlignment) {
96  alignStore->geoModelAlignment->clearPosCache();
97  }
98  alignStore->trackingAlignment = std::make_unique<TrackingAlignment>(alignStore->detType);
99  geoContext.setStore(std::move(alignStore));
100  }
103  std::vector<ActsTrk::DetectorType> presentTechs = m_detMgr->getDetectorTypes();
104  for (const ActsTrk::DetectorType detType : presentTechs) {
105  if (geoContext.getStore(detType)) {
106  continue;
107  }
108  ATH_MSG_WARNING("No external detector alignment has been defined for technology "<<ActsTrk::to_string(detType));
109  geoContext.setStore(std::make_unique<ActsTrk::DetectorAlignStore>(detType));
110  }
112  ConstructionCache cacheObj;
113  cacheObj.detMgr = std::make_unique<MuonGM::MuonDetectorManager>();
114  cacheObj.world = createGeoWorld();
115  cacheObj.detMgr->addTreeTop(cacheObj.world);
117  ATH_CHECK(buildMdt(geoContext, cacheObj));
118  ATH_CHECK(buildTgc(geoContext, cacheObj));
119  ATH_CHECK(buildRpc(geoContext, cacheObj));
120  ATH_CHECK(buildSTGC(geoContext, cacheObj));
121  ATH_CHECK(buildMM(geoContext, cacheObj));
123  std::vector<GeoChildNodeWithTrf> treeTops = getChildrenWithRef(m_detMgr->getTreeTop(0), false);
124 
126  for (const GeoChildNodeWithTrf& treeTop : treeTops) {
127  if (hasStationVolume(treeTop.volume, cacheObj.translatedStations)) continue;
128  ATH_MSG_VERBOSE("Detected passive volume "<<treeTop.nodeName);
129 
130  cacheObj.world->add(const_pointer_cast(treeTop.volume));
131  }
132 
134  if (m_checkGeo) {
135  const std::vector<const MuonGMR4::MuonReadoutElement*> refEles{m_detMgr->getAllReadoutElements()};
136  for (const MuonGMR4::MuonReadoutElement* refEle : refEles) {
137  ATH_CHECK(checkIdCompability(*refEle, *cacheObj.detMgr->getReadoutElement(refEle->identify())));
138  }
139  }
140 
141  ATH_CHECK(writeHandle.record(std::move(cacheObj.detMgr)));
142  return StatusCode::SUCCESS;
143 }
145  const Identifier& stationId,
146  ConstructionCache& cacheObj) const {
147  const std::string stName{m_idHelperSvc->stationNameString(stationId)};
148  const int stEta{m_idHelperSvc->stationEta(stationId)};
149  const int stPhi{m_idHelperSvc->stationPhi(stationId)};
150  MuonGM::MuonStation* station = cacheObj.detMgr->getMuonStation(stName, stEta, stPhi);
151  if (station) {
152  ATH_MSG_DEBUG("Station "<<stName<<" "<<stEta<<" "<<stPhi<<" already exists.");
153  return StatusCode::SUCCESS;
154  }
156  const MuonGMR4::MuonReadoutElement* copyMe = m_detMgr->getReadoutElement(stationId);
157 
159  const GeoVFullPhysVol* readOutVol = copyMe->getMaterialGeom();
160  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
161  cacheObj.translatedStations.insert(parentVolume);
163  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).
164 
167  const std::vector<GeoChildNodeWithTrf> children = getChildrenWithRef(parentVolume, false); // we get the list of child nodes attached to the parent volume
168  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};
169  for (const GeoChildNodeWithTrf& child : children) {
170  std::vector<Amg::Vector3D> edges = getPolyShapeEdges(child.volume->getLogVol()->getShape(), //we are getting corner points of the edges
171  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
172  for (const Amg::Vector3D& edge : edges) {
173  minX = std::min(minX, edge.x());
174  maxX = std::max(maxX, edge.x());
175  minZ = std::min(minZ, edge.z());
176  maxZ = std::max(maxZ, edge.z());
177  if (edge.z() < 0) {
178  minY1 = std::min(minY1, edge.y());
179  maxY1 = std::max(maxY1, edge.y());
180  } else {
181  minY2 = std::min(minY2, edge.y());
182  maxY2 = std::max(maxY2, edge.y());
183  }
184  }
185  }
188  const double shortS = (maxY1 - minY1);
189  const double longS = (maxY2 - minY2);
190  const double lengthR = (maxX - minX);
191  const double lengthZ = (maxZ - minZ);
192 
193  const GeoAlignableTransform* alignTrf{copyMe->alignableTransform()};
195  const Amg::Transform3D stationTransform = alignTrf->getDefTransform().inverse()*parentVolume->getX();
196 
197  for (const GeoChildNodeWithTrf& child : children) {
199  const GeoVPhysVol &childVolRef = *child.volume;
200  if (typeid(childVolRef) == typeid(GeoFullPhysVol)) {
201  continue;
202  }
203  // Add the beam lines / foams inside the station volume
204  PVLink childVol = const_pointer_cast<GeoVPhysVol>(child.volume);
205  parentPhysVol->add(cacheObj.newIdTag());
206  parentPhysVol->add(cacheObj.makeTransform(stationTransform*child.transform));
207  parentPhysVol->add(cloneVolume(childVol));
208  }
210  const Amg::Transform3D alignedTransform = copyMe->localToGlobalTrans(gctx) *
211  (stationTransform * readOutVol->getX()).inverse();
212 
213  ATH_MSG_VERBOSE("stName "<<stName<<","<<stEta<<","<<stPhi<<" -- shortS: "<<shortS<<", longS: "<<longS
214  <<", lengthR: "<<lengthR<<", lengthZ "<<lengthZ
215  <<std::endl<<"AlignableNode: "<<GeoTrf::toString(alignedTransform, true)
216  <<std::endl<<"Station transform: "<<GeoTrf::toString(stationTransform, true)
217  <<std::endl<<"Readout transform: "<<GeoTrf::toString(readOutVol->getX(), true));
218  auto newStation = std::make_unique<MuonGM::MuonStation>(stName,
219  shortS, lengthR, lengthZ,
220  longS, lengthR, lengthZ,
221  stEta, stPhi, false);
222  newStation->setPhysVol(parentPhysVol);
224  cacheObj.world->add(cacheObj.newIdTag());
225  GeoIntrusivePtr<GeoAlignableTransform> trf = make_intrusive<GeoAlignableTransform>(alignedTransform);
226  newStation->setTransform(trf);
227 
228  newStation->setNominalAmdbLRSToGlobal( trf->getTransform());
229 
230  cacheObj.detMgr->addMuonStation(std::move(newStation));
231 
232  cacheObj.world->add(trf);
233  cacheObj.world->add(parentPhysVol);
234 
235  return StatusCode::SUCCESS;
236 }
237 
238 
240  const Identifier& reId,
241  ConstructionCache& cacheObj,
242  GeoIntrusivePtr<GeoVFullPhysVol>& physVol,
243  MuonGM::MuonStation* & station) const {
244 
245  ATH_CHECK(buildStation(gctx, reId, cacheObj));
246  const std::string stName{m_idHelperSvc->stationNameString(reId)};
247  station = cacheObj.detMgr->getMuonStation(stName,
248  m_idHelperSvc->stationEta(reId),
249  m_idHelperSvc->stationPhi(reId));
250 
251  PVLink parentPhysVol{station->getPhysVol()};
253  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
254  parentPhysVol->add(cacheObj.newIdTag());
265  const Amg::Transform3D alignNodeToRE{copyMe->alignableTransform()->getDefTransform().inverse() *
266  readOutVol->getParent()->getX() * readOutVol->getX()};
267  const Amg::Transform3D alignedNode{copyMe->localToGlobalTrans(gctx) * alignNodeToRE.inverse()};
268 
269  const Amg::Transform3D stationTrf{station->getTransform().inverse() * alignedNode};
270 
271  parentPhysVol->add(cacheObj.makeTransform(stationTrf*alignNodeToRE));
273  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
274  physVol = dynamic_pointer_cast<GeoVFullPhysVol>(clonedVol);
275  parentPhysVol->add(physVol);
276  return StatusCode::SUCCESS;
277 }
278 
280 
281  const std::vector<const MuonGMR4::RpcReadoutElement*> readoutEles = m_detMgr->getAllRpcReadoutElements();
282  ATH_MSG_INFO("Copy "<<readoutEles.size()<<" Rpc readout elements to the legacy system");
283  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
284  for (const MuonGMR4::RpcReadoutElement* copyMe : readoutEles) {
285  const Identifier reId = copyMe->identify();
286  const MuonGMR4::RpcReadoutElement::parameterBook& pars{copyMe->getParameters()};
287  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
288  MuonGM::MuonStation* station{nullptr};
289  ATH_CHECK(cloneReadoutVolume(gctx, reId, cacheObj, physVol, station));
290  auto newElement = std::make_unique<MuonGM::RpcReadoutElement>(physVol,
291  m_idHelperSvc->stationNameString(reId),
292  1, 1, false, cacheObj.detMgr.get());
293  const bool aSide{copyMe->stationEta() > 0};
294  newElement->setDoubletPhi(copyMe->doubletPhi());
295  newElement->setDoubletR(copyMe->doubletR());
296  newElement->setDoubletZ(copyMe->doubletZ());
297  newElement->setIdentifier(reId);
298  newElement->setParentMuonStation(station);
299  station->addMuonReadoutElementWithAlTransf(newElement.get(), nullptr, station->nMuonReadoutElements());
300 
302  newElement->setLongZsize(2.*pars.halfLength);
303  newElement->setLongSsize(2.*pars.halfWidth);
304  newElement->setLongRsize(2.*pars.halfThickness);
305  newElement->setZsize(2.*pars.halfLength);
306  newElement->setSsize(2.*pars.halfWidth);
307  newElement->setRsize(2.*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  const IdentifierHash gangHash = copyMe->constructHash(0, gasGap, false);
406  const IdentifierHash stripHash = copyMe->constructHash(0, gasGap, true);
407  nWireGangs[gasGap -1] = copyMe->numWireGangs(gangHash);
408  nStrips[gasGap -1] = copyMe->numStrips(stripHash);
409  if (nWireGangs[gasGap -1]) {
410  const MuonGMR4::WireGroupDesign& design{copyMe->wireGangLayout(gangHash)};
411  wirePitch = design.stripPitch();
412  WiregangArray& fillMe{wires[gasGap-1]};
413  for (int gang = 1; gang <= design.numStrips(); ++gang) {
414  fillMe[gang -1] = design.numWiresInGroup(gang);
415  }
416  }
417  if (nStrips[gasGap -1] && !stripSet) {
418  const MuonGMR4::RadialStripDesign& design{copyMe->stripLayout(stripHash)};
419  const int nCh = nStrips[gasGap -1];
420  for (int strip = 1; strip <= nCh; ++strip) {
421  botMountings[strip-1] = - design.stripLeftBottom(strip).x();
422  topMountings[strip-1] = - design.stripLeftTop(strip).x();
423  }
424  botMountings[nCh] = - design.stripRightBottom(nCh).x();
425  topMountings[nCh] = - design.stripRightTop(nCh).x();
426 
427  stripSet = true;
428  }
429  }
430  readOutPars = std::make_unique<TgcReadoutParams>(copyMe->chamberDesign(),
431  0, 0, wirePitch,
432  idHelper.stationPhiMax(reId),
433  std::move(nWireGangs),
434  std::move(wires[0]),
435  std::move(wires[1]),
436  std::move(wires[2]),
437  0,
438  std::move(botMountings),
439  std::move(topMountings),
440  std::move(nStrips));
441  }
442 
444  for (unsigned int gasGap = 1; gasGap <= copyMe->nGasGaps(); ++gasGap) {
445  const IdentifierHash layHash{copyMe->constructHash(0, gasGap, false)};
447  const Amg::Vector3D translation{copyMe->globalToLocalTrans(gctx) * copyMe->center(gctx, layHash)};
448  newRE->setPlaneZ(translation.x(), gasGap);
449  }
450  newRE->setRsize(copyMe->moduleHeight());
451  newRE->setSsize(copyMe->moduleWidthS());
452  newRE->setZsize(copyMe->moduleThickness());
453 
454  newRE->setLongRsize(copyMe->moduleHeight());
455  newRE->setLongSsize(copyMe->moduleWidthL());
456  newRE->setLongZsize(copyMe->moduleThickness());
457 
458  newRE->setReadOutParams(readOutPars);
459  newRE->fillCache();
460  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
461  cacheObj.detMgr->addTgcReadoutElement(std::move(newRE));
462 
463  }
464  return StatusCode::SUCCESS;
465 }
466 
467 GeoIntrusivePtr<GeoVFullPhysVol>
469  const MuonGMR4::MuonReadoutElement* copyMe,
470  ConstructionCache& cacheObj) const {
471  GeoIntrusivePtr<const GeoVFullPhysVol> readOutVol{copyMe->getMaterialGeom()};
472  cacheObj.translatedStations.insert(readOutVol->getParent());
473 
474  PVLink clonedVol{cloneVolume(const_pointer_cast<GeoVFullPhysVol>(readOutVol))};
475  GeoIntrusivePtr<GeoFullPhysVol> physVol{dynamic_pointer_cast<GeoFullPhysVol>(clonedVol)};
476  cacheObj.world->add(cacheObj.newIdTag());
477  cacheObj.world->add(cacheObj.makeTransform(copyMe->localToGlobalTrans(gctx)));
478  cacheObj.world->add(physVol);
479  return physVol;
480 }
482 
483  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mm);
484  const auto alignStore = alignItr ?
485  static_cast<const MmAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
486 
487  if (alignStore) {
488  cacheObj.detMgr->setMMPassivation(alignStore->passivation);
489  }
490  const std::vector<const MuonGMR4::MmReadoutElement*> mmReadouts{m_detMgr->getAllMmReadoutElements()};
491  ATH_MSG_INFO("Copy "<<mmReadouts.size()<<" Mm readout elements to the legacy system");
492 
493  for (const MuonGMR4::MmReadoutElement* copyMe : mmReadouts) {
494  const Identifier reId = copyMe->identify();
495  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
496  auto newRE = std::make_unique<MuonGM::MMReadoutElement>(physVol,
497  m_idHelperSvc->stationNameString(reId),
498  copyMe->stationEta(),
499  copyMe->stationPhi(),
500  copyMe->multilayer(), cacheObj.detMgr.get());
502  for (unsigned int gasGap = 0; gasGap < copyMe->nGasGaps(); ++gasGap) {
503  const MuonGMR4::StripLayer& stripLayer{copyMe->stripLayer(MuonGMR4::MmReadoutElement::createHash(gasGap +1, 0))};
504  const MuonGMR4::StripDesign& designFrom{stripLayer.design()};
505 
506  newRE->m_Xlg[gasGap] = stripLayer.toOrigin() *
507  Amg::getRotateZ3D(-designFrom.stereoAngle()) *
509  ATH_MSG_VERBOSE("Layer transform "<<gasGap<<" "<<GeoTrf::toString(newRE->m_Xlg[gasGap], true));
510 
511  MuonGM::MuonChannelDesign& designTo{newRE->m_etaDesign[gasGap]};
512  designTo.defineTrapezoid(designFrom.shortHalfHeight(),
513  designFrom.longHalfHeight(),
514  designFrom.halfWidth(),
515  designFrom.stereoAngle());
517  designTo.detType = MuonGM::MuonChannelDesign::DetType::MM;
518  designTo.inputPitch = designFrom.stripPitch();
519  designTo.inputWidth = designTo.inputPitch * std::cos(designTo.stereoAngle());
520  designTo.nMissedBottomEta = designTo.nMissedBottomStereo = designFrom.firstStripNumber() - 1;
521  designTo.totalStrips = designFrom.numStrips();
522  designTo.nch = designFrom.numStrips();
523 
524  designTo.setFirstPos(designFrom.firstStripPos().x() + 0.5*designTo.inputPitch);
525  }
526 
527  newRE->fillCache();
528  if (alignStore && alignStore->getBLine(reId)) {
529  newRE->setBLinePar(*alignStore->getBLine(reId));
530  }
531  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
532  cacheObj.detMgr->addMMReadoutElement(std::move(newRE));
533  }
534  return StatusCode::SUCCESS;
535 }
536 
538  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::sTgc);
539  auto alignStore = alignItr ? static_cast<const sTgcAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
540 
541  const std::vector<const MuonGMR4::sTgcReadoutElement*> sTgcReadOuts{m_detMgr->getAllsTgcReadoutElements()};
542  ATH_MSG_INFO("Copy "<<sTgcReadOuts.size()<<" sTgc readout elements to the legacy system");
543 
544  for (const MuonGMR4::sTgcReadoutElement* copyMe : sTgcReadOuts) {
545  const Identifier reId = copyMe->identify();
546  ATH_MSG_DEBUG("Translate readout element "<<m_idHelperSvc->toStringDetEl(reId)<<".");
547  GeoIntrusivePtr<GeoVFullPhysVol> physVol{cloneNswWedge(gctx, copyMe, cacheObj)};
548 
549  auto newRE = std::make_unique<MuonGM::sTgcReadoutElement>(physVol,
550  m_idHelperSvc->stationNameString(reId).substr(1),
551  copyMe->stationEta(),
552  copyMe->stationPhi(),
553  copyMe->multilayer(),
554  cacheObj.detMgr.get());
555 
556  if (alignStore && alignStore->getBLine(reId)) {
557  newRE->setBLinePar(*alignStore->getBLine(reId));
558  }
559  for (unsigned int layer = 1; layer <= copyMe->numLayers(); ++layer) {
561  using ChannelDesign = MuonGM::MuonChannelDesign;
562  const IdentifierHash layerHash = MuonGMR4::sTgcReadoutElement::createHash(layer,channelType::Strip,0);
563 
564  const MuonGMR4::StripLayer& stripLayer{copyMe->stripLayer(layerHash)};
565  newRE->m_Xlg[layer -1] = stripLayer.toOrigin() * Amg::getRotateY3D(90. * Gaudi::Units::deg) * Amg::getTranslateX3D( layer%2 ? - 0.01 : 0.01 );
566 
567  const MuonGMR4::StripDesign& copyEtaDesign{stripLayer.design()};
568  ATH_MSG_VERBOSE("Layer: "<<layer<<" "<<copyEtaDesign);
570  ChannelDesign& etaDesign{newRE->m_etaDesign[layer-1]};
571  etaDesign.type = ChannelDesign::ChannelType::etaStrip;
572  etaDesign.detType = ChannelDesign::DetType::STGC;
573  if (copyEtaDesign.yCutout()) {
574  etaDesign.defineDiamond(copyEtaDesign.shortHalfHeight(),
575  copyEtaDesign.longHalfHeight(),
576  copyEtaDesign.halfWidth(),
577  copyEtaDesign.yCutout());
578  } else {
579  etaDesign.defineTrapezoid(copyEtaDesign.shortHalfHeight(),
580  copyEtaDesign.longHalfHeight(),
581  copyEtaDesign.halfWidth());
582 
583  }
584  etaDesign.firstPitch = copyEtaDesign.firstStripPos().x() + 0.5*copyEtaDesign.stripPitch() + copyEtaDesign.halfWidth();
585  etaDesign.inputPitch = copyEtaDesign.stripPitch();
586  etaDesign.inputWidth = copyEtaDesign.stripWidth();
587  etaDesign.nch = copyEtaDesign.numStrips();
588  ATH_MSG_VERBOSE(m_idHelperSvc->toStringDetEl(copyMe->identify())<<", layer: "<<layer<<", eta-design: "<< copyEtaDesign);
589  etaDesign.setFirstPos(copyEtaDesign.firstStripPos().x() + 0.5*copyEtaDesign.stripPitch());
591 
592  const MuonGMR4::WireGroupDesign& copyPhiDesign{copyMe->wireDesign(layerHash)};
593 
594  ChannelDesign& phiDesign{newRE->m_phiDesign[layer-1]};
595  phiDesign.type = ChannelDesign::ChannelType::phiStrip;
596  phiDesign.detType = ChannelDesign::DetType::STGC;
597  if (copyPhiDesign.yCutout() == 0.) {
598  phiDesign.defineTrapezoid(copyPhiDesign.shortHalfHeight(),
599  copyPhiDesign.longHalfHeight(),
600  copyPhiDesign.halfWidth());
601  } else {
602  phiDesign.defineDiamond(copyPhiDesign.shortHalfHeight(),
603  copyPhiDesign.longHalfHeight(),
604  copyPhiDesign.halfWidth(),
605  copyPhiDesign.yCutout());
606  }
607  phiDesign.inputPitch = copyPhiDesign.stripPitch();
608  phiDesign.inputWidth = copyPhiDesign.stripWidth();
609  ATH_MSG_VERBOSE(m_idHelperSvc->toStringDetEl(copyMe->identify())<<", layer: "<<layer<<", phi-design: "<< copyPhiDesign);
610  phiDesign.setFirstPos(copyPhiDesign.firstStripPos().x()); // Position of 1st wire, accounts for staggering
611  phiDesign.firstPitch = copyPhiDesign.numWiresInGroup(1); // Number of Wires in 1st group, group staggering
612  phiDesign.groupWidth = copyPhiDesign.numWiresInGroup(2); // Number of Wires normal group
613  phiDesign.nGroups = copyPhiDesign.numStrips(); // Number of Wire Groups
614  phiDesign.wireCutout = copyPhiDesign.wireCutout(); // Size of "active" wire region for digits
615  phiDesign.nch = copyPhiDesign.nAllWires();
616  phiDesign.isConvertedFromPhaseII = true;
617 
618  const MuonGMR4::PadDesign& copyPadDesign{copyMe->padDesign(layerHash)};
619  MuonGM::MuonPadDesign& padDesign{newRE->m_padDesign[layer-1]};
620  padDesign.Length = copyMe->chamberHeight();
621  padDesign.sWidth = copyMe->sChamberLength();
622  padDesign.lWidth = copyMe->lChamberLength();
623  padDesign.Size = 2.*copyPadDesign.halfWidth();
624  padDesign.ysFrame = copyMe->sFrameWidth();
625  padDesign.ylFrame = copyMe->lFrameWidth();
626  padDesign.thickness = copyMe->thickness();
628  if (copyPadDesign.yCutout()) {
629  padDesign.yCutout = copyPadDesign.halfWidth();
630  }
631  padDesign.setR(copyPadDesign.beamlineRadius());
632  padDesign.sPadWidth = 2.*copyPadDesign.shortHalfHeight();
633  padDesign.lPadWidth = 2.*copyPadDesign.longHalfHeight();
634  padDesign.nPadColumns = copyPadDesign.numPadPhi();
635  padDesign.firstPhiPos = copyPadDesign.firstPadPhiDiv();
636  padDesign.inputPhiPitch = copyPadDesign.anglePadPhi();
637  padDesign.PadPhiShift = copyPadDesign.padPhiShift();
638  padDesign.nPadH = copyPadDesign.numPadEta();
639  padDesign.padEtaMax = copyPadDesign.maxPadEta();
640  padDesign.firstRowPos = copyPadDesign.firstPadHeight();
641  padDesign.inputRowPitch = copyPadDesign.padHeight();
642  padDesign.sectorOpeningAngle = copyPadDesign.sectorAngle();
643  padDesign.isConvertedFromPhaseII = true;
644  }
645  newRE->fillCache();
646  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newRE));
647  cacheObj.detMgr->addsTgcReadoutElement(std::move(newRE));
648 
649  }
650  return StatusCode::SUCCESS;
651 }
654  SubDetAlignment alignItr = gctx.getStore(ActsTrk::DetectorType::Mdt);
655  const MdtAlignmentStore* alignStore = alignItr ?
656  static_cast<const MdtAlignmentStore*>(alignItr->internalAlignment.get()) : nullptr;
657 
658  const std::vector<const MuonGMR4::MdtReadoutElement*> mdtReadOuts{m_detMgr->getAllMdtReadoutElements()};
659  ATH_MSG_INFO("Copy "<<mdtReadOuts.size()<<" Mdt readout elements to the legacy system");
660  for (const MuonGMR4::MdtReadoutElement* copyMe : mdtReadOuts) {
661  const Identifier reId = copyMe->identify();
662  ATH_MSG_DEBUG("Translate "<<m_idHelperSvc->toStringDetEl(reId));
664  GeoIntrusivePtr<GeoVFullPhysVol> physVol{};
665  MuonGM::MuonStation* station{nullptr};
666  ATH_CHECK(cloneReadoutVolume(gctx,reId, cacheObj, physVol, station));
667  if (copyMe->multilayer() == 1) {
668  const MuonGMR4::MdtReadoutElement* otherRE = copyMe->complementaryRE();
669  const double height = std::max(copyMe->moduleHeight(), otherRE->moduleHeight()) -
670  (copyMe->tubePitch() - 2. * copyMe->tubeRadius());
671 
672  const double modHalTHickO{0.5*otherRE->moduleThickness()},
673  modHalfThick{-0.5*copyMe->moduleThickness()};
674 
675  const double thickness = ( (otherRE->asBuiltRefFrame()*(modHalTHickO* Amg::Vector3D::UnitX())) -
676  (copyMe->asBuiltRefFrame()*(modHalfThick* Amg::Vector3D::UnitX()))).z();
677  if (copyMe->isBarrel()) {
678  station->setMdtZsize(height);
679  station->setMdtRsize(thickness);
680  } else {
681  station->setMdtRsize(height);
682  station->setMdtZsize(thickness);
683  }
684  }
685  const MuonGMR4::MdtReadoutElement::parameterBook& pars{copyMe->getParameters()};
686  auto newElement = std::make_unique<MuonGM::MdtReadoutElement>(physVol,
687  m_idHelperSvc->stationNameString(reId),
688  cacheObj.detMgr.get());
689  newElement->setIdentifier(reId);
690  newElement->setMultilayer(copyMe->multilayer());
691  newElement->setNMdtInStation(m_idHelperSvc->mdtIdHelper().multilayerMax(reId));
692  // cppcheck-suppress invalidLifetime; ok: mgr took ownership.
693  newElement->setParentMuonStation(station);
694 
696  newElement->setLongSsize(2*pars.longHalfX - 1.*Gaudi::Units::cm);
697  newElement->setSsize(2*pars.shortHalfX - 1.*Gaudi::Units::cm);
698  newElement->setLongRsize(2*pars.halfY);
699  newElement->setRsize(2*pars.halfY);
700  newElement->setZsize(2*pars.halfHeight);
701  newElement->setLongZsize(2*pars.halfHeight);
702 
703  newElement->m_nlayers = copyMe->numLayers();
704  newElement->m_ntubesperlayer = copyMe->numTubesInLay();
705  newElement->m_deadlength = pars.deadLength;
706  newElement->m_endpluglength = pars.endPlugLength;
707  newElement->m_innerRadius = pars.tubeInnerRad;
708  newElement->m_tubeWallThickness = pars.tubeWall;
709  newElement->m_tubepitch = pars.tubePitch;
712 
714  const MuonGMR4::MdtTubeLayer& tubeLay{*pars.tubeLayers[0]};
715  unsigned int step{1};
716  double lastLength{2.*tubeLay.uncutHalfLength(1)};
717  for (unsigned tube = 0; tube < copyMe->numTubesInLay(); ++tube) {
718  const double currLength = 2.*tubeLay.uncutHalfLength(tube);
719  ATH_MSG_VERBOSE(m_idHelperSvc->toString(copyMe->identify())<< ", tube "<<tube<<", length: "<<currLength);
720  if (std::abs(lastLength - currLength) > std::numeric_limits<float>::epsilon() ||
721  tube == copyMe->numTubesInLay() -1) {
722  newElement->m_tubelength[step-1] = lastLength;
723  newElement->m_tubelength[step] = currLength;
724  if (step == 1) {
725  newElement->m_ntubesinastep = tube;
726  }
727  lastLength = currLength;
728  ++step;
729  }
730  }
731  newElement->m_nsteps = step;
732 
734  double xOffSet{pars.halfY}, yOffSet{pars.halfHeight};
735  if (newElement->barrel()) std::swap(xOffSet, yOffSet);
736  for (unsigned lay = 1; lay <= copyMe->numLayers(); ++lay) {
737  const IdentifierHash tubeHash{copyMe->measurementHash(lay, 1)};
738  const Amg::Vector3D locTube = copyMe->localTubePos(tubeHash);
739  newElement->m_firstwire_x[lay-1] = locTube.z() + xOffSet;
740  newElement->m_firstwire_y[lay-1] = locTube.x() + yOffSet;
741  }
742  MdtAlignmentStore::chamberDistortions distort = alignStore ? alignStore->getDistortion(reId) :
744 
745  if (!station->hasMdtAsBuiltParams()){
746  station->setMdtAsBuiltParams(distort.asBuilt);
747  }
748  if (!station->hasBLines()){
749  station->setBline(distort.bLine);
750  }
751  const Amg::Vector3D refPoint = copyMe->bLineReferencePoint();
752  station->setBlineFixedPointInAmdbLRS(refPoint.x(), refPoint.y(), refPoint.z());
753 
754  newElement->geoInitDone();
755  newElement->setBLinePar(distort.bLine);
756  newElement->fillCache();
757  ATH_CHECK(dumpAndCompare(gctx, *copyMe, *newElement));
759  cacheObj.detMgr->addMdtReadoutElement(std::move(newElement));
760  }
761  return StatusCode::SUCCESS;
762 }
763 
765  const MuonGM::MuonReadoutElement& testEle) const{
766 
767  if (refEle.identify() != testEle.identify()) {
768  ATH_MSG_FATAL("Two different elements are compared "
769  <<m_idHelperSvc->toString(refEle.identify())<<" vs. "
770  <<m_idHelperSvc->toString(testEle.identify()));
771  return StatusCode::FAILURE;
772  }
773  if (refEle.identHash() != testEle.detectorElementHash()) {
774  ATH_MSG_FATAL("The hashes of the two detector elements "<<m_idHelperSvc->toString(refEle.identify())
775  <<" are completely different "<<refEle.identHash()<<" vs. "<<testEle.detectorElementHash());
776  return StatusCode::FAILURE;
777  }
778  return StatusCode::SUCCESS;
779 }
780 
782  const MuonGMR4::MmReadoutElement& refEle,
783  const MuonGM::MMReadoutElement& testEle) const {
784 
785  if (!m_checkGeo) {
786  return StatusCode::SUCCESS;
787  }
788  ATH_CHECK(checkIdCompability(refEle, testEle));
789 
790  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
791  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
792  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
793  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
794  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++ gasGap) {
795  const Identifier gapId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, 1);
796 
797  const Amg::Transform3D& refTrf{refEle.localToGlobalTrans(gctx, gapId)};
798  const Amg::Transform3D& testTrf{testEle.transform(gapId)};
799  if (!Amg::isIdentity(refTrf.inverse()*testTrf)) {
800  ATH_MSG_FATAL("The layer "<<m_idHelperSvc->toStringGasGap(gapId)<<" does not transform equally"
801  <<GeoTrf::toString(refTrf, true) <<" vs. "<<GeoTrf::toString(testTrf, true));
802  return StatusCode::FAILURE;
803  }
804  const MuonGMR4::StripDesign& stripDesign{refEle.stripLayer(gapId).design()};
805 
806  for (int strip = stripDesign.firstStripNumber(); strip <= stripDesign.numStrips(); ++strip) {
807  const Identifier stripId = idHelper.channelID(refEle.identify(), refEle.multilayer(), gasGap, strip);
808  const Amg::Vector3D refStripPos{refEle.stripPosition(gctx, stripId)};
809  const Amg::Vector3D refStripDir{refEle.localToGlobalTrans(gctx, refEle.layerHash(stripId)).linear() * Amg::Vector3D::UnitX()};
810 
811  Amg::Vector3D testStripPos{Amg::Vector3D::Zero()};
812  if (!testEle.stripGlobalPosition(stripId, testStripPos)) {
813  ATH_MSG_FATAL("Failed to retrieve strip position "<<m_idHelperSvc->toString(stripId));
814  return StatusCode::FAILURE;
815  }
816  const double dist = refStripDir.dot(refStripPos - testStripPos);
817  if (std::abs(dist) > 10. * Gaudi::Units::micrometer) {
818  ATH_MSG_FATAL("The strip "<<Amg::toString(testStripPos)<<" is not describing the same strip as "
819  <<Amg::toString(refStripPos)<<". Channel "<<m_idHelperSvc->toString(stripId)
820  <<" distance: "<<dist<<" "<<(dist / testEle.m_etaDesign[gasGap -1].inputWidth));
821  return StatusCode::FAILURE;
822  }
823  ATH_MSG_VERBOSE("Channel postion "<<m_idHelperSvc->toString(stripId)<<" match between legacy & new");
824  }
825  }
826  return StatusCode::SUCCESS;
827 }
828 
830  const MuonGMR4::MdtReadoutElement& refEle,
831  const MuonGM::MdtReadoutElement& testEle) const {
832 
833  if (!m_checkGeo) {
834  return StatusCode::SUCCESS;
835  }
836  ATH_CHECK(checkIdCompability(refEle, testEle));
837 
838  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
839  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx))
840  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform())
841  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
842  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
843  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
844  for (unsigned int lay = 1; lay <= refEle.numLayers(); ++lay){
845  for (unsigned int tube = 1; tube <= refEle.numTubesInLay(); ++tube) {
846  const IdentifierHash tubeHash {refEle.measurementHash(lay,tube)};
847  if (!refEle.isValid(tubeHash)) {
848  ATH_MSG_VERBOSE("SKip layer / tube "<<lay <<","<<tube);
849  continue;
850  }
851  const Amg::Transform3D globToLocal = refEle.globalToLocalTrans(gctx, tubeHash);
852 
853  const Amg::Vector3D refPos = refEle.globalTubePos(gctx, tubeHash);
854  const Amg::Vector3D tubePos = testEle.tubePos(lay, tube);
855 
856 
857  if ( (refPos - tubePos).mag() > Gaudi::Units::micrometer &&
858  (globToLocal*refPos - globToLocal * tubePos).perp() > Gaudi::Units::micrometer) {
859  ATH_MSG_ERROR("Tube positions differ for "<<m_idHelperSvc->toString(refEle.measurementId(tubeHash))
860  <<" reference: "<<GeoTrf::toString(globToLocal*refPos)<<" vs. test: "
861  <<GeoTrf::toString(globToLocal*tubePos) <<" delta: "<<(refPos - tubePos).mag()
862  <<" Transforms "<<std::endl
863  <<" **** "<< GeoTrf::toString(globToLocal.inverse())<<std::endl
864  <<" **** "<< GeoTrf::toString(testEle.transform(lay, tube)));
865  return StatusCode::FAILURE;
866  }
867  ATH_MSG_VERBOSE("Tube positions layer: "<<lay<<", tube: "<<tube
868  <<std::endl<<"reference: "<<GeoTrf::toString(refPos)
869  <<std::endl<<"test: "<<GeoTrf::toString(tubePos)
870  <<std::endl<<testEle.tubeLength(lay, tube)<<"/"<<testEle.getActiveTubeLength(lay, tube)<<"/"
871  <<testEle.getWireLength(lay,tube)<<" vs. "<<refEle.tubeLength(tubeHash)
872  <<"/"<<refEle.activeTubeLength(tubeHash)<<"/"<<refEle.wireLength(tubeHash)
873  <<"/"<<refEle.uncutTubeLength(tubeHash));
874  if (std::abs(testEle.getTubeLengthForCaching(lay,tube) - refEle.uncutTubeLength(tubeHash)) >
875  std::numeric_limits<float>::epsilon() ) {
876  ATH_MSG_FATAL("Different tube length's detected for "<<m_idHelperSvc->toStringDetEl(refEle.identify())
877  << " layer: "<<lay<<", tube: "<<tube<<" -- "<<testEle.getTubeLengthForCaching(lay,tube)<<" (new) vs. "
878  <<refEle.uncutTubeLength(tubeHash)<<" (ref)");
879  return StatusCode::FAILURE;
880  }
881  }
882  }
883 
884  return StatusCode::SUCCESS;
885 }
887  const MuonGMR4::RpcReadoutElement& refEle,
888  const MuonGM::RpcReadoutElement& testEle) const {
889 
890  if (!m_checkGeo) {
891  return StatusCode::SUCCESS;
892  }
893  ATH_CHECK(checkIdCompability(refEle, testEle));
894 
895  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
896  <<" ref: "<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)<<std::endl
897  <<" test: "<<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
898  <<"delta: "<<GeoTrf::toString(testEle.absTransform().inverse()*refEle.localToGlobalTrans(gctx), true ));
899  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
900  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
901  for (int doubPhi = refEle.doubletPhi(); doubPhi <= refEle.doubletPhiMax(); ++doubPhi) {
902  for (bool measPhi : {false, true}) {
903  if (measPhi && !refEle.nPhiStrips()) continue;
904  for (int strip = 1; strip <= testEle.Nstrips(measPhi); ++strip) {
905  const Identifier stripId = idHelper.channelID(refEle.identify(),
906  refEle.doubletZ(),
907  doubPhi, gasGap, measPhi, strip);
908 
909  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, stripId)};
910  const Amg::Transform3D& testTrans{testEle.transform(stripId)};
911  if (strip == 1 && !Amg::isIdentity(refTrans.inverse()*testTrans)) {
912  ATH_MSG_ERROR("Transformation for "<<m_idHelperSvc->toString(stripId)<<" - "<<refEle.identHash()<<std::endl
913  <<" *** ref: "<<GeoTrf::toString(refTrans)<<std::endl
914  <<" *** test: "<<GeoTrf::toString(testTrans)<<std::endl
915  <<" -> delta: "<<GeoTrf::toString(refTrans.inverse()*testTrans));
916  return StatusCode::FAILURE;
917  }
918 
919  const Amg::Vector3D refStripPos = refEle.stripPosition(gctx, stripId);
920  const Amg::Vector3D testStripPos = testEle.stripPos(stripId);
921  // The threshold here used to be epsilon for a float.
922  // But this was then giving a failure in aarch64,
923  // with a difference of almost exactly 1e-4.
924  // It turned out that that was coming from GeoDeDuplicator,
925  // where to consider two transforms equivalent,
926  // the translations must match to 1e-4. But if the
927  // difference is almost exactly 1e-4, then small FP
928  // differences can be magnified to just about 1e-4.
929  if ((refStripPos - testStripPos).mag() > 2e-4){
930  ATH_MSG_ERROR("Mismatch in strip positions "<<m_idHelperSvc->toString(stripId)
931  <<" ref: "<<Amg::toString(refStripPos)<<" test: "<<Amg::toString(testStripPos)
932  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refStripPos)
933  <<" test: "<<Amg::toString(refTrans.inverse()*testStripPos));
934  return StatusCode::FAILURE;
935  }
936  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(stripId)
937  <<" strip position "<<Amg::toString(refStripPos)
938  <<", local: "<<Amg::toString(refTrans.inverse()*refStripPos));
939  }
940  }
941  }
942  }
943  return StatusCode::SUCCESS;
944 }
946  const MuonGMR4::TgcReadoutElement& refEle,
947  const MuonGM::TgcReadoutElement& testEle) const {
948 
949  if (!m_checkGeo) {
950  return StatusCode::SUCCESS;
951  }
952  ATH_CHECK(checkIdCompability(refEle, testEle));
953 
954  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
955 
956  ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toString(refEle.identify())
957  <<std::endl<<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true)
958  <<std::endl<<GeoTrf::toString(testEle.getMaterialGeom()->getAbsoluteTransform(), true)
959  <<std::endl<<"r-size: "<<testEle.getRsize()<<"/"<<testEle.getLongRsize()
960  <<" s-size: "<<testEle.getSsize()<<"/"<<testEle.getLongSsize()
961  <<" z-size: "<<testEle.getZsize()<<"/"<<testEle.getLongZsize());
962 
963  for (unsigned int gasGap = 1; gasGap <= refEle.nGasGaps(); ++gasGap) {
964  for (bool isStrip : {false, true}) {
965  const IdentifierHash layHash = refEle.constructHash(0, gasGap, isStrip);
966 
967  const Identifier layId = idHelper.channelID(refEle.identify(), gasGap, isStrip, 1);
968  ATH_MSG_VERBOSE("Test layer "<<m_idHelperSvc->toString(layId)<<" "<<refEle.numChannels(layHash)<<" "<<layHash);
969  if (!refEle.numChannels(layHash)) continue;
970  const Amg::Transform3D& refLayerTrf = refEle.localToGlobalTrans(gctx, layHash);
971  const Amg::Transform3D& testLayerTrf = testEle.transform(layId);
972  if (!Amg::isIdentity(refLayerTrf.inverse()* testLayerTrf)) {
973  ATH_MSG_FATAL("The transformations in "<<m_idHelperSvc->toString(layId)
974  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
975  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true)
976  <<" are not identical. ");
977  return StatusCode::FAILURE;
978  }
979  ATH_MSG_VERBOSE("Transformations in "<<m_idHelperSvc->toString(layId)
980  <<std::endl<<"ref : "<<GeoTrf::toString(refLayerTrf,true)
981  <<std::endl<<"test: "<<GeoTrf::toString(testLayerTrf,true));
982 
983  for (unsigned int ch = 1; ch <= refEle.numChannels(layHash); ++ch) {
984  const IdentifierHash measHash = refEle.constructHash(ch, gasGap, isStrip);
985  const Identifier measId = refEle.measurementId(measHash);
986  const Amg::Vector3D refChannel = refEle.channelPosition(gctx, measHash);
987  const Amg::Vector3D testChannel = testEle.channelPos(measId);
988  if ((refChannel - testChannel).mag() < std::numeric_limits<float>::epsilon()){
989  continue;
990  }
991  std::stringstream msg{};
992  msg<<"The channel "<<m_idHelperSvc->toString(measId)
993  << " is not at the same position "<<Amg::toString(refChannel)
994  <<" vs. "<<Amg::toString(testChannel)<<". Difference: "
995  <<(refChannel - testChannel).mag();
996  if (!isStrip) {
997  msg<<std::endl<<"*** Test *** - wirePitch: "<<testEle.wirePitch()
998  <<", tot wires "<<testEle.nWires(gasGap)
999  <<", wires to reach "<<testEle.nPitchesToGang(gasGap, ch)
1000  <<", wires in gang "<<testEle.nWires(gasGap, ch);
1001  const MuonGMR4::WireGroupDesign& design{refEle.wireGangLayout(gasGap)};
1002  msg<<std::endl<<"*** Ref *** - wirePitch: "<<design.stripPitch()
1003  <<", tot wires "<<testEle.nWires(gasGap)
1004  <<", wires to reach "<<design.numPitchesToGroup(ch)
1005  <<", wires in gang "<<design.numWiresInGroup(ch);
1006  } else {
1007  const Amg::Vector3D locRefPos{refLayerTrf.inverse() * refChannel};
1008  const Amg::Vector3D locTestPos{refLayerTrf.inverse()* testChannel};
1009  msg<<std::endl<<"*** Ref **** - "<<Amg::toString(locRefPos)<<std::endl;
1010  msg<<std::endl<<"*** Test **** - "<<Amg::toString(locTestPos)<<std::endl;
1011  }
1012  ATH_MSG_FATAL(msg.str());
1013  return StatusCode::FAILURE;
1014  }
1015 
1016  }
1017  }
1018  return StatusCode::SUCCESS;
1019 }
1021  const MuonGMR4::sTgcReadoutElement& refEle,
1022  const MuonGM::sTgcReadoutElement& testEle) const {
1023  if (!m_checkGeo) {
1024  return StatusCode::SUCCESS;
1025  }
1026  ATH_CHECK(checkIdCompability(refEle, testEle));
1027 
1028  ATH_MSG_VERBOSE("Compare basic readout transforms"<<std::endl
1029  <<GeoTrf::toString(testEle.absTransform(),true)<<std::endl
1030  <<GeoTrf::toString(refEle.localToGlobalTrans(gctx), true));
1031  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
1032  for (unsigned int gasGap = 1; gasGap <= refEle.numLayers(); ++gasGap) {
1033  for (int chType : {sTgcIdHelper::sTgcChannelTypes::Pad , sTgcIdHelper::sTgcChannelTypes::Strip, sTgcIdHelper::sTgcChannelTypes::Wire}) {
1034  const Identifier layID = idHelper.channelID(refEle.identify(),
1035  refEle.multilayer(),
1036  gasGap, chType, 1);
1037  const unsigned int numChannel = refEle.numChannels(layID);
1038  constexpr unsigned firstCh = 1;
1039  for (unsigned int channel = firstCh; channel < numChannel ; ++channel) {
1040  Identifier chID;
1041  bool isValid = false;
1042  if(chType == sTgcIdHelper::sTgcChannelTypes::Pad) {
1043  const int etaIndex = refEle.padDesign(layID).padNumber(channel).first;
1044  const int phiIndex = refEle.padDesign(layID).padNumber(channel).second;
1045  chID = idHelper.padID(refEle.identify(),
1046  refEle.multilayer(),
1047  gasGap, chType, etaIndex, phiIndex, isValid);
1048  } else {
1049  chID = idHelper.channelID(refEle.identify(),
1050  refEle.multilayer(),
1052  }
1053 
1054  if(!isValid) {
1055  ATH_MSG_WARNING("Invalid Identifier detected: " << m_idHelperSvc->toString(chID));
1056  }
1057 
1058  const Amg::Transform3D& refTrans{refEle.localToGlobalTrans(gctx, chID)};
1059  const Amg::Transform3D& testTrans{testEle.transform(chID)};
1060  if (channel == firstCh && (!Amg::doesNotDeform(testTrans.inverse()*refTrans)
1061  || (testTrans.inverse()*refTrans).translation().perp() > std::numeric_limits<float>::epsilon() ) ) {
1062  ATH_MSG_ERROR(__func__<<"() "<<__LINE__<<" - Transformation for "<<m_idHelperSvc->toString(chID)<<std::endl
1063  <<" *** ref: "<<GeoTrf::toString(refTrans, true)<<std::endl
1064  <<" *** test: "<<GeoTrf::toString(testTrans, true));
1065  return StatusCode::FAILURE;
1066  }
1067  if (chType == sTgcIdHelper::sTgcChannelTypes::Pad) {
1068  const Amg::Transform3D& testPadTrans{testEle.transform(chID)};
1069  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1070  Amg::Vector3D testChannelPos(Amg::Vector3D::Zero());
1071  testEle.stripGlobalPosition(chID, testChannelPos);
1072 
1073  const std::array<Amg::Vector3D,4> refPadCorners = refEle.globalPadCorners(gctx, chID);
1074  std::array<Amg::Vector3D,4> testPadCorners{make_array<Amg::Vector3D, 4>(Amg::Vector3D::Zero())};
1075  testEle.padGlobalCorners(chID, testPadCorners);
1076  for (unsigned int cornerIdx = 0; cornerIdx < refPadCorners.size(); ++cornerIdx) {
1077  const double padCornerDiff = (refPadCorners[cornerIdx] - testPadCorners[cornerIdx]).mag();
1078  if (padCornerDiff - 25. > 1. * Gaudi::Units::micrometer){
1079  ATH_MSG_ERROR("Mismatch in pad Corner " << cornerIdx << ": " <<m_idHelperSvc->toString(chID)
1080  <<" ref: "<<Amg::toString(refPadCorners[cornerIdx])<<" test: "<<Amg::toString(testPadCorners[cornerIdx])
1081  <<" difference: " << padCornerDiff
1082  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refPadCorners[cornerIdx])
1083  <<" test: "<<Amg::toString(testPadTrans.inverse()*testPadCorners[cornerIdx]));
1084  return StatusCode::FAILURE;
1085  }
1086  }
1087  const double padChannelDiff = (refChannelPos - testChannelPos).mag();
1088  if (padChannelDiff - 25. > 1. * Gaudi::Units::micrometer){
1089  ATH_MSG_ERROR("Mismatch in pad positions "<<m_idHelperSvc->toString(chID)
1090  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1091  <<" difference: " << padChannelDiff
1092  <<" local coordinates -- ref: "<<Amg::toString(refTrans.inverse()*refChannelPos)
1093  <<" test: "<<Amg::toString(testPadTrans.inverse()*testChannelPos));
1094  return StatusCode::FAILURE;
1095  }
1096  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1097  <<" channel position "<<Amg::toString(refChannelPos));
1098  }
1099  else if (chType == sTgcIdHelper::sTgcChannelTypes::Strip){
1100  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1101  Amg::Vector3D testChannelPos{Amg::Vector3D::Zero()};
1102  testEle.stripGlobalPosition(chID, testChannelPos);
1103  if ((refChannelPos - testChannelPos).mag() > 1. * Gaudi::Units::micrometer){
1104  ATH_MSG_ERROR("Mismatch in strip positions "<<m_idHelperSvc->toString(chID)
1105  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1106  <<" local coordinates -- ref: "<<Amg::toString(testTrans.inverse()*refChannelPos)
1107  <<" test: "<<Amg::toString(testTrans.inverse()*testChannelPos));
1108  return StatusCode::FAILURE;
1109  }
1110  ATH_MSG_VERBOSE("Agreement between new and old geometry for channel "<<m_idHelperSvc->toString(chID)
1111  <<" channel position "<<Amg::toString(refChannelPos));
1112  } else { // wire
1113  const Amg::Vector3D refChannelPos = refEle.globalChannelPosition(gctx, chID);
1114  Amg::Vector3D testChannelPos{Amg::Vector3D::Zero()};
1115  testEle.stripGlobalPosition(chID, testChannelPos);
1116  Amg::Vector3D localRefPos {testTrans.inverse()*refChannelPos};
1117  Amg::Vector3D localTestPos{testTrans.inverse()*testChannelPos};
1119  if((std::abs(localRefPos.x() -localTestPos.x()) > 1.* Gaudi::Units::micrometer)
1120  || (std::abs(refChannelPos.z() -testChannelPos.z()) > 15.* Gaudi::Units::micrometer)){
1121  ATH_MSG_ERROR("Mismatch in wire positions "<<m_idHelperSvc->toString(chID)
1122  <<" ref: "<<Amg::toString(refChannelPos)<<" test: "<<Amg::toString(testChannelPos)
1123  <<" local coordinates -- ref: "<<Amg::toString(testTrans.inverse()*refChannelPos)
1124  <<" test: "<<Amg::toString(testTrans.inverse()*testChannelPos)
1125  <<"delta X: "<<std::abs(localRefPos.x() -localTestPos.x())
1126  <<", delta Z: "<<std::abs(localRefPos.z() -localTestPos.z()));
1127  return StatusCode::FAILURE;
1128  }
1129  }
1130  }
1131  }
1132  }
1133  return StatusCode::SUCCESS;
1134 }
1135 }
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:537
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:652
MuonGMR4::ReadoutGeomCnvAlg::dumpAndCompare
StatusCode dumpAndCompare(const ActsGeometryContext &gctx, const MuonGMR4::RpcReadoutElement &refEle, const MuonGM::RpcReadoutElement &testEle) const
Definition: ReadoutGeomCnvAlg.cxx:886
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:239
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
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:144
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:368
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: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.
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:867
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:481
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:279
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: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:764
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:468
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:76
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
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: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:23
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:67
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:32
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