ATLAS Offline Software
MuonStationBuilderImpl.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
10 
11 #include <fstream>
12 #include <map>
13 #include <memory>
14 
16 #include "GeoModelKernel/GeoBox.h"
17 #include "GeoModelKernel/GeoCons.h"
18 #include "GeoModelKernel/GeoPara.h"
19 #include "GeoModelKernel/GeoPgon.h"
20 #include "GeoModelKernel/GeoShape.h"
21 #include "GeoModelKernel/GeoShapeIntersection.h"
22 #include "GeoModelKernel/GeoShapeShift.h"
23 #include "GeoModelKernel/GeoShapeSubtraction.h"
24 #include "GeoModelKernel/GeoShapeUnion.h"
25 #include "GeoModelKernel/GeoTrap.h"
26 #include "GeoModelKernel/GeoTrd.h"
27 #include "GeoModelKernel/GeoTube.h"
28 #include "GeoModelKernel/GeoTubs.h"
29 #include "GeoModelKernel/GeoVolumeCursor.h"
32 #include "GeoModelHelpers/GeoShapeUtils.h"
46 #include "TrkGeometry/Layer.h"
51 #include "TrkSurfaces/DiscBounds.h"
63 
64 constexpr double tolerance{0.001};
65 
66 namespace Muon{
67 
68 // constructor
70  const std::string& n,
71  const IInterface* p)
72  : AthAlgTool(t, n, p) {}
73 
74 // Athena standard methods
75 // initialize
77  // Retrieve the tracking volume helper
78  // -------------------------------------------------
80  ATH_MSG_INFO("Retrieved tool " << m_trackingVolumeHelper);
81 
82  // Retrieve muon station builder tool
83  // -------------------------------------------------
85  ATH_MSG_INFO("Retrieved tool " << m_muonStationTypeBuilder);
86 
87  // if no muon materials are declared, take default ones
88 
89  // default material properties
90  m_muonMaterial = Trk::Material(10e10, 10e10, 0., 0., 0.);
91 
92  ATH_MSG_INFO(" initialize() successful");
93 
94  ATH_CHECK(m_idHelperSvc.retrieve());
95 
96  return StatusCode::SUCCESS;
97 }
98 
101 
102  DetachedVolVec translatedStations{};
103 
104  // retrieve muon station branches from GeoModel tree
105  std::vector<std::pair<const GeoVPhysVol*, std::vector<GMInfo>>> stations = retrieveGMsensitive(muonMgr);
106 
107  for (const auto& mstation : stations) {
108  // build prototype
109  std::string name = mstation.first->getLogVol()->getName();
110  if ( mstation.second[0].mstation ) name = mstation.second[0].mstation->getStationName();
111 
112  std::unique_ptr<Trk::DetachedTrackingVolume> msType = buildDetachedTrackingVolumeType(muonMgr, mstation.first,
113  mstation.second[0]);
114  if (!msType) {
115  continue;
116  }
117  // clone prototype
118  // NSW prototypes built at position
119  if (name.find("sTGC")!= std::string::npos || name.substr(0, 2) == "MM") {
120  for (unsigned int i = 0; i < mstation.second.size(); i++) {
121  std::string sName = name.substr(name.find('-') + 1);
122  Identifier nswId = m_muonStationTypeBuilder->identifyNSW(sName, mstation.second[i].trf);
123  // clone station from prototype
124  Amg::Transform3D trdef(mstation.second[i].trf *
125  mstation.second[0].trf.inverse());
126  std::unique_ptr<Trk::DetachedTrackingVolume> newStat{msType->clone(name, trdef)};
127  // identify layer representation
128  Trk::Layer* layer = (newStat->layerRepresentation());
129  layer->setLayerType(nswId.get_identifier32().get_compact());
130  // identify layers
131  if (m_identifyLayers) identifyNSWLayers(*newStat, nswId);
132  // collect
133  translatedStations.push_back(std::move(newStat));
134  } // end clone NSW stations
135  } else {
136  for (auto gminfo : mstation.second) {
137  // clone station from prototype
138  std::unique_ptr<Trk::DetachedTrackingVolume> newStat{msType->clone(name, gminfo.trf)};
139  // identify layer representation
140  Trk::Layer* layer = newStat->layerRepresentation();
141  int eta{0}, phi{0};
142  Identifier stId = resolveId(name, gminfo, eta, phi, muonMgr);
143  layer->setLayerType(stId.get_identifier32().get_compact());
144  // glue components
145  glueComponents(newStat.get());
146  // identify layers
147  identifyLayers(newStat.get(), stId, eta, phi, muonMgr);
148  // collect
149  translatedStations.push_back(std::move(newStat));
150  } // end clone non-NSW
151  }
152  } // end loop over prototypes
153 
154  ATH_MSG_DEBUG( "returns " << translatedStations.size() << " stations");
155  return translatedStations;
156 }
157 
159  Trk::TrackingVolumeArray* volArray = stat->trackingVolume()->confinedVolumes();
160  if (!volArray || volArray->arrayObjectsNumber() <= 1) {
161  return;
162  }
163 
164  std::span<Trk::TrackingVolume* const> components = volArray->arrayObjects();
165  const Trk::BinUtility* binUtilityX = volArray->binUtility();
166  const Trk::CuboidVolumeBounds* cubVolBounds = dynamic_cast<const Trk::CuboidVolumeBounds*>(&(components[0]->volumeBounds()));
167 
168  // identify 'lower' and 'upper' boundary surface
171 
172  // rectangular station in x ordering (MDT barrel)
173  if (cubVolBounds && binUtilityX) {
174  low = Trk::negativeFaceYZ;
176  }
177 
178  if (low >= 0 && up >= 0) {
179  // glue volumes
180  for (unsigned int i = 0; i < components.size() - 1; ++i) {
181  m_trackingVolumeHelper->glueTrackingVolumes(*(components[i]), up, *(components[i + 1]), low);
182  }
183  }
184 
185 
186 }
187 
189  Trk::DetachedTrackingVolume* station, Identifier /*stationID*/, int eta,
190  int phi, const MuonGM::MuonDetectorManager* muonMgr) const {
191  ATH_MSG_VERBOSE(name() << " identifying layers ");
192 
193  const std::string stationName = station->trackingVolume()->volumeName();
194  ATH_MSG_VERBOSE(" in station " << station->name());
195  const std::string stationStr = stationName.substr(0, 3);
196  bool is_valid{false};
197  if (m_idHelperSvc->hasCSC() && stationStr[0] == 'C') {
198  const int cscEtaSt = eta - MuonGM::MuonDetectorManager::NCscStEtaOffset;
199  const Identifier readout_id = muonMgr->cscIdHelper()->channelID(
200  stationStr, cscEtaSt, phi + 1, 1, 1, 0, 1, is_valid);
201  const MuonGM::CscReadoutElement* cscRE =
202  is_valid ? muonMgr->getCscReadoutElement(readout_id) : nullptr;
203  if (!cscRE) {
204  const Identifier backup_id = muonMgr->cscIdHelper()->channelID(
205  stationStr, cscEtaSt, phi + 1, 2, 1, 0, 1, is_valid);
206  cscRE =
207  is_valid ? muonMgr->getCscReadoutElement(backup_id) : nullptr;
208  }
209  if (cscRE) {
210  for (int gasgap = 0; gasgap < cscRE->Ngasgaps(); gasgap++) {
211  Identifier idi = m_idHelperSvc->cscIdHelper().channelID(
212  cscRE->identify(), cscRE->ChamberLayer(), gasgap + 1, 0, 1,
213  is_valid);
214  if (!is_valid)
215  continue;
216  const auto *stripSurf = dynamic_cast<const Trk::PlaneSurface*>(&(cscRE->surface(idi)));
217  const Amg::Vector3D& gpi = stripSurf->center();
218  Trk::TrackingVolume* assocVol =
219  station->trackingVolume()->associatedSubVolume(gpi);
220  Trk::Layer* assocLay = nullptr;
221  if (assocVol)
222  assocLay = assocVol->associatedLayer(gpi);
223  unsigned int iD = idi.get_identifier32().get_compact();
224  if (assocVol && assocLay) {
225  assocLay->setLayerType(iD);
226  }
227  if (assocLay) {
228  assocLay->setRef((assocLay->surfaceRepresentation().transform().inverse() *gpi)[1]);
229  }
230  }
231  } else {
232  ATH_MSG_DEBUG("cscRE not found:" << stationName << "," << eta << ","
233  << phi);
234  }
235  } else if (stationStr[0] == 'T') {
236  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
237  int st = 7;
238  if (stationStr == "T1F") {
239  st = 0;
240  } else if (stationStr == "T1E") {
241  st = 1;
242  } else if (stationStr == "T2F") {
243  st = 2;
244  } else if (stationStr == "T2E") {
245  st = 3;
246  } else if (stationStr == "T3F") {
247  st = 4;
248  } else if (stationStr == "T3E") {
249  st = 5;
250  } else if (stationStr == "T4F") {
251  st = 6;
252  }
253 
254  const int stationName =
257  const int stationEta =
259  auto getReadout = [stationName, stationEta, muonMgr, &idHelper](int phi) {
260  const int stationPhi = phi + 1;
261  bool is_valid{false};
262  const Identifier id = idHelper.elementID(stationName, stationEta, stationPhi, is_valid);
263  return is_valid ? muonMgr->getTgcReadoutElement(id) : nullptr;
264  };
265  const MuonGM::TgcReadoutElement* tgc = getReadout(phi - 1);
266 
267  if (!tgc || !(station->trackingVolume()->inside(tgc->center(), 0.))) {
268  unsigned int phit = 0;
269 
270  while (phit < 48) {
271  const MuonGM::TgcReadoutElement* tgct = getReadout(phit);
272  if (tgct &&
273  station->trackingVolume()->inside(tgct->center(), 0.)) {
274  tgc = tgct;
275  phi = phit;
276  // update station identity
277  Identifier oldId(station->layerRepresentation()->layerType());
278  int stationName = idHelper.stationName(oldId);
279  int stationEta = idHelper.stationEta(oldId);
280  Identifier stId = idHelper.channelID(stationName, stationEta, phi,
281  1,1,1, is_valid);
282  station->layerRepresentation()->setLayerType(
283  stId.get_identifier32().get_compact());
284  break;
285  }
286  phit++;
287  }
288  }
289 
290  if (tgc) {
291  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
292  int etaSt = tgc->getStationEta();
293  int phiSt = tgc->getStationPhi();
294 
295  bool validId{false};
296  Identifier wireId = idHelper.channelID(stationStr, etaSt, phiSt, 1, 0, 1, validId);
297  if (!validId) {
298  ATH_MSG_ERROR("invalid TGC channel:" << wireId);
299  }
300  const Amg::Vector3D gp = tgc->channelPos(wireId);
301  Trk::TrackingVolume* assocVol =
302  station->trackingVolume()->associatedSubVolume(gp);
303  if (!assocVol)
304  ATH_MSG_DEBUG("wrong tgcROE?" << stationStr << "," << etaSt
305  << "," << phiSt);
306  if (assocVol && assocVol->confinedLayers()) {
307  std::span<Trk::Layer* const> layers =
308  assocVol->confinedLayers()->arrayObjects();
309 
310  for (unsigned int il = 0; il < layers.size(); il++) {
311  wireId = idHelper.channelID(stationStr, etaSt, phiSt, il + 1, 1, 1, validId);
312  if (!validId) {
313  ATH_MSG_ERROR("invalid TGC channel:" << wireId);
314  layers[il]->setLayerType(1);
315  } else {
316  unsigned int id = wireId.get_identifier32().get_compact();
317  layers[il]->setLayerType(id);
318  // validation
319  Identifier checkId(layers[il]->layerType());
320  const auto *stripSurf = dynamic_cast<const Trk::PlaneSurface*>(&(tgc->surface(checkId)));
321  if ((layers[il]->surfaceRepresentation().transform().inverse() * stripSurf->center()).mag() > 0.001)
322  ATH_MSG_DEBUG("TGC strip plane shifted:"<< st << "," << eta << "," << phi
323  << ":"<< layers[il]->surfaceRepresentation().transform().inverse() * stripSurf->center());
324  }
325  }
326  }
327  } else {
328  ATH_MSG_WARNING(name() << "tgcROE not found for :" << stationName
329  << "," << eta << "," << phi);
330  }
331  } else if (m_idHelperSvc->hasMDT() &&
332  (stationName[0] == 'B' || stationName[0] == 'E')) {
333  // recalculate id
334  Identifier stId(station->layerRepresentation()->layerType());
335  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
336  const int nameIndex = idHelper.stationNameIndex(stationName.substr(0, 3));
337  if (station->trackingVolume()->confinedVolumes()) {
338  std::span<Trk::TrackingVolume* const> cVols =
340  for (auto* cVol : cVols) {
341  if (cVol->confinedLayers()) {
342  std::span<Trk::Layer* const> cLays = cVol->confinedLayers()->arrayObjects();
343  const MuonGM::MdtReadoutElement* mdtROE = nullptr;
344  bool is_valid{false};
345 
346  for (auto* cLay : cLays) {
347  Identifier id(cLay->layerType());
348  if (id.get_compact() > 0 && m_idHelperSvc->isMdt(id)) {
349  Identifier newId = idHelper.channelID(nameIndex, eta, phi,
350  idHelper.multilayer(id),
351  idHelper.tubeLayer(id),
352  idHelper.tube(id),
353  is_valid);
354  if (!mdtROE) {
355  mdtROE = is_valid ? muonMgr->getMdtReadoutElement(newId) : nullptr;
356  }
357  unsigned int newid = newId.get_identifier32().get_compact();
358  cLay->setLayerType(newid);
359  // check reference position
360  if (mdtROE) {
361  double ref = cLay->getRef();
362  // double loc = mdtROE->localROPos(newId)[2]; //
363  // this does not take into account ROE shift wrt
364  // TG station/layer
365  double loc = (cLay->surfaceRepresentation().transform().inverse() * mdtROE->tubePos(newId))[1];
366  if (std::abs(ref) > 10e6) {
367  double sign = (ref > 0.) ? 1. : -1.;
368  int dec = int(ref / 1e5);
369  ref = ref - dec * 1e5 -
370  0.5 * (sign + 1) * 1e5;
371  if (std::abs(ref - loc) > 0.001) { // re-pack
372  cLay->setRef(loc + dec * 1e5 + 0.5 * (sign + 1) * 1e5);
373  }
374  } else if (std::abs(ref - loc) > 0.001) {
375  cLay->setRef(loc);
376  }
377  }
378  }
379  }
380  }
381  if (!cVol->confinedArbitraryLayers().empty()) {
382  Trk::ArraySpan<Trk::Layer* const> cLays = cVol->confinedArbitraryLayers();
383  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
384  for (auto* cLay : cLays) {
385  Identifier id(cLay->layerType());
386  bool is_valid{false};
387  if (m_idHelperSvc->hasRPC() && id.get_compact() > 0 && m_idHelperSvc->isRpc(id)) {
388  Identifier newId = idHelper.channelID(nameIndex, eta, phi,
389  idHelper.doubletR(id), idHelper.doubletZ(id),
390  idHelper.doubletPhi(id), idHelper.gasGap(id),
391  1, idHelper.strip(id),
392  is_valid);
393  int newid = newId.get_identifier32().get_compact();
394  cLay->setLayerType(newid);
395  }
396  }
397  }
398  }
399  }
400  }
401  // by now, all the layers should be identified - verify
402  if (station->trackingVolume()->confinedVolumes()) {
403  std::span<Trk::TrackingVolume* const> cVols =
405  for (auto* cVol : cVols) {
406  if (cVol->confinedLayers()) {
407  std::span<Trk::Layer* const> cLays =
408  cVol->confinedLayers()->arrayObjects();
409  for (unsigned int il = 0; il < cLays.size(); il++) {
410  Identifier id(cLays[il]->layerType());
411  if (id == 1)
412  ATH_MSG_DEBUG(station->name()
413  << "," << cVol->volumeName()
414  << ", unidentified active layer:" << il);
415  else if (id != 0)
416  checkLayerId("check layer in " + station->name() +
417  " subvolume " + cVol->volumeName(),
418  muonMgr, id, cLays[il]);
419  }
420  }
421  if (!cVol->confinedArbitraryLayers().empty()) {
423  cVol->confinedArbitraryLayers();
424  for (unsigned int il = 0; il < cLays.size(); il++) {
425  Identifier id(cLays[il]->layerType());
426  if (id == 1)
427  ATH_MSG_DEBUG(station->name()
428  << "," << cVol->volumeName()
429  << ", unidentified active layer:" << il);
430  else if (id != 0)
431  checkLayerId("check arbitrary layer in " +
432  station->name() + " subvolume " +
433  cVol->volumeName(),
434  muonMgr, id, cLays[il]);
435  }
436  }
437  }
438  }
439  if (station->trackingVolume()->confinedLayers()) {
440  std::span<Trk::Layer* const> cLays =
441  station->trackingVolume()->confinedLayers()->arrayObjects();
442  for (unsigned int il = 0; il < cLays.size(); il++) {
443  Identifier id(cLays[il]->layerType());
444  if (id == 1)
445  ATH_MSG_DEBUG(station->name()
446  << "," << station->name()
447  << ", unidentified active layer:" << il);
448  else if (id != 0)
449  checkLayerId("check confined layer in " + station->name(),
450  muonMgr, id, cLays[il]);
451  }
452  }
453  // end identification check
454 }
455 
457  const Identifier& id) const {
458 
459 
460  if (!station.trackingVolume()->confinedLayers()) return;
461  std::span<Trk::Layer* const> lays = station.trackingVolume()->confinedLayers()->arrayObjects();
462  const bool isStgc{station.name().substr(0, 4) == "sTGC"};
463  const bool isMm{station.name().substr(0, 2) == "MM"};
464  if (!isMm && !isStgc) return;
465  for (unsigned int il = 0; il < lays.size(); il++) {
466  if (isStgc) {
467  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
468  const Identifier lid = idHelper.channelID(id, idHelper.multilayer(id), il + 1, 2, 1);
469  lays[il]->setLayerType(lid.get_identifier32().get_compact());
470 
471  } else if (isMm) {
472  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
473  const Identifier lid = idHelper.channelID(id, idHelper.multilayer(id), il + 1, 1);
474  lays[il]->setLayerType(lid.get_identifier32().get_compact());
475  }
476  }
477 }
478 
480  const Amg::Transform3D& transf,
481  const MuonGM::MuonDetectorManager* muonMgr) const {
482  ATH_MSG_VERBOSE(name() << " identifying prototype ");
483 
484  const std::string& stationName = station.volumeName();
485  ATH_MSG_VERBOSE(" for station " << stationName);
486  const std::string stationNameShort = stationName.substr(0, 3);
487  const char stationFirstChar = stationName[0];
488  bool is_valid{false};
489 
490  if (m_idHelperSvc->hasMDT() && (stationFirstChar == 'B' || stationFirstChar == 'E')) {
491  // MDT
492  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
493  const int nameIndex = idHelper.stationNameIndex(stationNameShort);
494  for (int multi = 1; multi <= 2; ++multi) {
495  const Identifier ele_id = idHelper.channelID(nameIndex, eta, phi, multi, 1, 1, is_valid);
496  if (!is_valid) {
497  continue;
498  }
499  const MuonGM::MdtReadoutElement* multilayer = muonMgr->getMdtReadoutElement(ele_id);
500  if (!multilayer) {
501  continue;
502  }
503  Trk::TrackingVolume* assocVol = station.associatedSubVolume(transf.inverse() * multilayer->center());
504  if (!assocVol) {
505  ATH_MSG_WARNING("valid multilayer outside station:" << stationName);
506  continue;
507  }
508  int nLayers = multilayer->getNLayers();
509  for (int layer = 1; layer <= nLayers; ++layer) {
510  Identifier id = idHelper.channelID(nameIndex, eta, phi, multi, layer, 1, is_valid);
511  if (!is_valid) {
512  continue;
513  }
514  // retrieve associated layer
515  Trk::Layer* assocLay = assocVol->associatedLayer(transf.inverse() * multilayer->tubePos(id));
516  if (assocLay) {
517  assocLay->setLayerType(id.get_identifier32().get_compact());
518  }
519  }
520  }
521 
522  // RPC ?
523  Trk::BinnedArray<Trk::TrackingVolume>* confinedVolumes = station.confinedVolumes();
524  if (confinedVolumes) {
525  std::span<Trk::TrackingVolume* const> vols = confinedVolumes->arrayObjects();
526  for (auto* vol : vols) {
527  if (!m_idHelperSvc->hasRPC() || vol->volumeName() != "RPC") {
528  break;
529  }
530 
531  // for active layers do a search of associated ROE
532  Trk::ArraySpan<Trk::Layer* const> layers = vol->confinedArbitraryLayers();
533  int nameIndex = m_idHelperSvc->rpcIdHelper().stationNameIndex(stationNameShort);
535  if (stationNameShort == "BME" || stationNameShort == "BMG") {
536  continue;
537  }
538  // the following checks are not necessarily needed, since
539  // calling channelID with check=true would catch them
540  // However, since these validity checks are slow, let's
541  // manually skip the obvious non-existant ones
542  //
543  // only BOG7/8 and BMS2/4 have doubletZ=3, the remaing BOG
544  // and BOF4 have doubletZ=1
545  int doubletZMax = 2;
546  if (stationNameShort.find("BMS") != std::string::npos && (std::abs(eta) == 2 || std::abs(eta) == 4)) {
547  doubletZMax = 3;
548  }
549  else if (stationNameShort.find("BOG") != std::string::npos) {
550  if (std::abs(eta) == 7 || std::abs(eta) == 8) {
551  doubletZMax = 3;
552  } else {
553  doubletZMax = 1;
554  }
555  } else if (stationNameShort.find("BOF") != std::string::npos && std::abs(eta) == 4){
556  doubletZMax = 1;
557  }
558  // all BOL/BOS and BOF1 have doubletR=1
559  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
560  for (int doubletR = 1; doubletR <= 2; ++doubletR) {
561  bool isValid{false};
562  const Identifier stationId = idHelper.elementID(nameIndex, eta, phi, doubletR, isValid);
563  if (!isValid) {
564  continue;
565  }
566  for (int doubletZ = 1; doubletZ <= doubletZMax; ++doubletZ) {
567  for (int doubletPhi = 1; doubletPhi <= 2; doubletPhi++) {
568 
569  const Identifier id = idHelper.channelID(stationId, doubletZ, doubletPhi,
570  1, 0, 1, isValid);
571  if (!isValid) {
572  continue;
573  }
574  const MuonGM::RpcReadoutElement* rpc = muonMgr->getRpcReadoutElement(id);
575  if (!rpc) {
576  continue;
577  }
578  for (int gasGap = 1; gasGap <= rpc->numberOfLayers(); ++gasGap) {
579 
580  Identifier etaId = idHelper.channelID(id, doubletZ, doubletPhi,
581  gasGap, 0, 1, isValid);
582 
583  const Amg::Vector3D stripLocPos = transf.inverse() * rpc->stripPos(etaId);
584  for (auto* layer : layers) {
585  if (layer->layerType() == 0 ||
586  !layer->surfaceRepresentation().isOnSurface(stripLocPos, false, 0.5* layer->thickness())){
587  continue;
588  }
589  const Amg::Vector3D locPos1 =layer->surfaceRepresentation().transform().inverse() * stripLocPos;
590  const Amg::Vector3D locPos2 = rpc->surface(etaId).transform().inverse() * rpc->stripPos(etaId);
591 
592  double swap = (std::abs(locPos1[1] - locPos2[0]) > 0.001) ? 20000. : 0.;
593 
594  layer->setLayerType(etaId.get_identifier32().get_compact());
595 
596 
597  const Amg::Vector3D locPos = layer->surfaceRepresentation().transform() *
598  transf.inverse() * rpc->surface(etaId).center();
599  layer->setRef(swap + locPos[0]);
600 
601  }
602  }
603  }
604  }
605  }
606  }
607  }
608  }
609 
610  // by now, all the layers should be identified - verify
611  if (station.confinedVolumes()) {
612  std::span<Trk::TrackingVolume* const> cVols = station.confinedVolumes()->arrayObjects();
613  for (auto* cVol : cVols) {
614  if (cVol->confinedLayers()) {
615  std::span<Trk::Layer* const> cLays = cVol->confinedLayers()->arrayObjects();
616  for (unsigned int il = 0; il < cLays.size(); il++) {
617  Identifier id(cLays[il]->layerType());
618  if (id == 1) {
619  ATH_MSG_DEBUG(station.volumeName()<< "," << cVol->volumeName() << ", unidentified active layer:" << il);
620  }
621  }
622  }
623  if (!cVol->confinedArbitraryLayers().empty()) {
624  Trk::ArraySpan<Trk::Layer* const> cLays = cVol->confinedArbitraryLayers();
625  for (unsigned int il = 0; il < cLays.size(); il++) {
626  Identifier id(cLays[il]->layerType());
627  if (id == 1) {
628  ATH_MSG_DEBUG(station.volumeName() << "," << cVol->volumeName() << ", unidentified active layer:" << il);
629  }
630  }
631  }
632  }
633  }
634  if (station.confinedLayers()) {
635  std::span<Trk::Layer* const> cLays = station.confinedLayers()->arrayObjects();
636  for (unsigned int il = 0; il < cLays.size(); il++) {
637  Identifier id(cLays[il]->layerType());
638  if (id == 1) {
639  ATH_MSG_DEBUG(station.volumeName() << ", unidentified active layer:" << il);
640  }
641  }
642  }
643  // end identification check
644 }
645 
646 void MuonStationBuilderImpl::getNSWStationsForTranslation(const GeoVPhysVol* pv, const std::string& name,
648  std::vector<std::pair<std::pair<const GeoLogVol*, Trk::MaterialProperties*>,
649  std::vector<Amg::Transform3D>>>& vols,
650  std::vector<std::string>& volNames) const {
651  // special code to get the Sensitive volume of the sTGC and MM (so the gas
652  // volume) throught the Frame
653 
654  // subcomponents
655  unsigned int nc = pv->getNChildVols();
656  ATH_MSG_DEBUG("getNSWStationsForTranslation from:"
657  << pv->getLogVol()->getName() << ","
658  << pv->getLogVol()->getMaterial()->getName()
659  << ", looping over " << nc << " children");
660 
661  for (unsigned int ic = 0; ic < nc; ic++) {
662  Amg::Transform3D transf = pv->getXToChildVol(ic);
663  const GeoVPhysVol* cv = pv->getChildVol(ic);
664  const GeoLogVol* clv = cv->getLogVol();
665  std::string childName = clv->getName();
666  ATH_MSG_DEBUG("getNSWStationsForTranslation child " << childName);
667 
668  if (childName.empty()) {
669  childName = "Spacer";
670  }
671  if (childName.size() > 9 && childName.substr(childName.size() - 9, 9) == "Sensitive") {
672  childName += std::to_string(ic);
673  }
674 
675  std::string cName = childName.compare(0, 3, "NSW") == 0 || childName.compare(0, 8, "NewSmall") == 0
676  ? name : name + childName;
677  ATH_MSG_VERBOSE("child number,name,position:" << ic << ":" << clv->getName() << ":"<< Amg::toString(transform * transf));
678 
679  if (!cv->getNChildVols()) {
680  bool found = false;
681  for (unsigned int is = 0; is < vols.size(); is++) {
682  if (cName == volNames[is]) {
683  if (std::abs((transform * transf).translation().perp() -
684  vols[is].second.front().translation().perp()) <
685  1.) {
686  found = true;
687  // order transforms to position prototype at phi=0/
688  // 0.125 pi
689  double phiTr = (transform * transf).translation().phi();
690  if (phiTr > -0.001 && phiTr < 0.4) {
691  vols[is].second.insert(vols[is].second.begin(),
692  transform * transf);
693  } else
694  vols[is].second.push_back(transform * transf);
696  "clone?"
697  << clv->getName() << ","
698  << (transform * transf).translation().perp() << ","
699  << (transform * transf).translation().z() << ","
700  << phiTr);
701 
702  break;
703  }
704  }
705  }
706  if (!found) {
707  std::vector<Amg::Transform3D> volTr;
708  volTr.push_back(transform * transf);
709  // divide mother material ? seems strange - check !
710  // double scale = 1.; // 1./nc;
711  double thick = 2 * m_muonStationTypeBuilder->get_x_size(pv);
712  if (pv->getLogVol()->getMaterial()->getName() != "Ether" &&
713  (childName == "MM_Frame" || childName == "sTGC_Frame")) {
714  Trk::MaterialProperties matComb(0., 10.e10, 10.e10, 13.,
715  26., 0.);
717  pv->getLogVol()->getMaterial());
718  matComb.addMaterial(newMat, thick / newMat.x0());
719  ATH_MSG_VERBOSE(" use mother volume thickness, x0: "
720  << matComb.thickness() << ", "
721  << matComb.x0()
722  << " mat: " << matComb.thicknessInX0());
724  new Trk::MaterialProperties(matComb);
725  // store mother volume (and not child = Frame)
726  std::pair<const GeoLogVol*, Trk::MaterialProperties*> cpair(
727  pv->getLogVol(), nMat);
728  vols.emplace_back(cpair, volTr);
729  // store extensive name
730  volNames.push_back(cName);
731  ATH_MSG_VERBOSE("new NSW station volume added:"
732  << cName << ", "
733  << clv->getMaterial()->getName() << ", "
734  << volTr.back().translation().z() << ", "
735  << volTr.back().translation().phi()
736  << " mat: " << matComb.thicknessInX0());
737  }
738  // printInfo(cv);
739  }
740  } else {
741  getNSWStationsForTranslation(cv, cName, transform * transf, vols,
742  volNames);
743  }
744  }
745 }
746 
747 std::vector<std::pair<const GeoVPhysVol*, std::vector<GMInfo>>>
749 
750  // a single loop over GM tree to retrieve all necessary information
751 
752  std::vector<std::pair<const GeoVPhysVol*,
753  std::vector<GMInfo>>> sensitive;
754 
755  std::vector<const MuonGM::MuonStation*> mst = muonMgr->getMuonStations();
756 
757  const GeoVPhysVol* top = muonMgr->getTreeTop(0);
758 
759  GeoVolumeCursor vl(top); unsigned int nfv = 0;
760  std::vector<std::pair<const GeoVPhysVol*, std::vector<GMInfo>>>::iterator it = sensitive.begin();
761  while (!vl.atEnd()) {
762  const GeoVPhysVol* cv = vl.getVolume();
763  const GeoFullPhysVol* cfv = dynamic_cast<const GeoFullPhysVol*> (cv);
764  if (cfv) { nfv++;
765  GMInfo info; info.trf = vl.getTransform(); info.volId = vl.getId() ? *(vl.getId()) : 0;
766  for (auto im : mst) if ( im->getPhysVol().get() == cfv ) info.mstation = im;
767  it = sensitive.begin();
768  while (it < sensitive.end()) {
769  if ( (*it).first->getLogVol() == cv->getLogVol() && m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0) break;
770  ++it;
771  }
772  if (it == sensitive.end()) {
773  std::vector<GMInfo> cloneList;
774  cloneList.push_back(info);
775  sensitive.push_back(std::make_pair(cv, cloneList));
776  } else (*it).second.push_back(info);
777  }
778  vl.next();
779  }
780 
781  if (nfv>0 && nfv >= mst.size() ) {
782  ATH_MSG_INFO( nfv <<" sensitive volumes found in GM tree" );
783  ATH_MSG_INFO( sensitive.size() << " sensitive volume types found in GM tree using match with " << mst.size() <<" muon stations known to muonMgr" );
784  return sensitive;
785  }
786 
787  // NSW stations first to avoid double-counting
788  const GeoVPhysVol* sTGC_top = Trk::GMTreeBrowser::findTopBranch(top, "sTGC_1");
789  const GeoVPhysVol* MM_top = Trk::GMTreeBrowser::findTopBranch(top, "MM_1");
790  if (sTGC_top && sTGC_top != top) {
791  ATH_MSG_DEBUG("sTGC GeoModel branch found:" << sTGC_top->getLogVol()->getName());
792  GeoVolumeCursor vol(sTGC_top);
793  while (!vol.atEnd()) {
794  const GeoVPhysVol* cv = vol.getVolume();
795  const std::string& vname = cv->getLogVol()->getName();
796  if (vname.find("sTGC_1") == std::string::npos) {
797  vol.next();
798  continue;
799  }
800  std::vector<std::pair<const GeoVPhysVol*,
801  std::vector<GMInfo>>>::iterator it =
802  sensitive.begin();
803  while (it < sensitive.end()) {
804  if (vname == (*it).first->getLogVol()->getName() &&
805  m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
806  break;
807  ++it;
808  }
809 
810  GMInfo info; info.trf = vol.getTransform();
811  if (it == sensitive.end()) {
812  std::vector<GMInfo> cloneList;
813  cloneList.emplace_back(info);
814  sensitive.emplace_back(cv, cloneList);
815  } else {
816  // order transforms to position prototype at phi=0/ 0.125 pi
817  double phiTr = info.trf.translation().phi();
818  if (phiTr > -0.001 && phiTr < 0.4)
819  (*it).second.insert((*it).second.begin(),info);
820  else
821  (*it).second.emplace_back(info);
822  }
823  vol.next();
824  }
825  }
826 
827  if (MM_top && MM_top != top) {
828  ATH_MSG_DEBUG("MM GeoModel branch found:" << MM_top->getLogVol()->getName());
829  GeoVolumeCursor vol(MM_top);
830  while (!vol.atEnd()) {
831  const GeoVPhysVol* cv = vol.getVolume();
832  const std::string& vname = cv->getLogVol()->getName();
833  if (vname.find("MM_1") == std::string::npos) {
834  vol.next();
835  continue;
836  }
837  std::vector<std::pair<const GeoVPhysVol*,
838  std::vector<GMInfo>>>::iterator it =
839  sensitive.begin();
840  while (it < sensitive.end()) {
841  if (vname == (*it).first->getLogVol()->getName() &&
842  m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
843  break;
844  ++it;
845  }
846 
847  GMInfo info; info.trf = vol.getTransform();
848  if (it == sensitive.end()) {
849  std::vector<GMInfo> cloneList;
850  cloneList.emplace_back(info);
851  sensitive.emplace_back(cv, cloneList);
852  } else {
853  // order transforms to position prototype at phi=0/ 0.125 pi
854  double phiTr = info.trf.translation().phi();
855  if (phiTr > -0.001 && phiTr < 0.4)
856  (*it).second.insert((*it).second.begin(), info);
857  else
858  (*it).second.emplace_back(info);
859  }
860  vol.next();
861  }
862  }
863 
864  GeoVolumeCursor vol(top);
865  while (!vol.atEnd()) {
866  const GeoVPhysVol* cv = &(*(vol.getVolume()));
867  const std::string& vname = cv->getLogVol()->getName();
868  if (vname.find("Station") == std::string::npos &&
869  vname.find("MM_1") == std::string::npos &&
870  vname.find("sTGC_1") == std::string::npos) {
871  vol.next();
872  continue;
873  }
874 
875  // TGC stations retrieved at level-1
876  if (vname.substr(0, 1) == "T") {
877 
878  for (const auto&[tv, tvTrf] : geoGetVolumes(cv)) {
879  const GeoLogVol* tlv = tv->getLogVol();
880  const Amg::Transform3D transform = vol.getTransform() * tvTrf;
881  const std::string& tgc_name = tlv->getName();
882 
883  std::vector<std::pair<const GeoVPhysVol*,
884  std::vector<GMInfo>>>::iterator it =
885  sensitive.begin();
886  while (it < sensitive.end()) {
887  if (tgc_name == (*it).first->getLogVol()->getName() &&
888  m_gmBrowser.compareGeoVolumes(tv, (*it).first, 1.e-3) ==
889  0)
890  break;
891  ++it;
892  }
893 
894  GMInfo info; info.trf = transform; info.volId = vol.getId() ? *(vol.getId()) : 0;
895  if (it == sensitive.end()) {
896  std::vector<GMInfo> cloneList;
897  cloneList.emplace_back(info);
898  sensitive.emplace_back(tv, cloneList);
899  } else {
900  // order transforms to position prototype at phi=0/ 0.125 pi
901  double phiTr = info.trf.translation().phi();
902  if (phiTr > -0.001 && phiTr < 0.4)
903  (*it).second.insert((*it).second.begin(),info);
904  else
905  (*it).second.emplace_back(info);
906  }
907 
908  } // end loop over TGC
909 
910  } else {
911 
912  std::vector<std::pair<const GeoVPhysVol*,
913  std::vector<GMInfo>>>::iterator it =
914  sensitive.begin();
915  while (it < sensitive.end()) {
916  if (vname == (*it).first->getLogVol()->getName() &&
917  m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
918  break;
919  ++it;
920  }
921 
922  GMInfo info; info.trf = vol.getTransform(); info.volId = vol.getId() ? *(vol.getId()) : 0;
923  if (it == sensitive.end()) {
924  std::vector<GMInfo> cloneList;
925  cloneList.emplace_back(info);
926  sensitive.emplace_back(cv, cloneList);
927  } else {
928  // order transforms to position prototype at phi=0/ 0.125 pi
929  double phiTr = info.trf.translation().phi();
930  if (phiTr > -0.001 && phiTr < 0.4)
931  (*it).second.insert((*it).second.begin(), info);
932  else
933  (*it).second.emplace_back(info);
934  }
935  } // end non-TGC
936  vol.next();
937  }
938 
939  ATH_MSG_DEBUG("Number of muon station types in GeoModel tree:" << sensitive.size());
940 
941  return sensitive;
942 }
943 
944 std::unique_ptr<Trk::DetachedTrackingVolume>
946  const GeoVPhysVol* cv,
947  const GMInfo& gmInfo) const {
948  const GeoLogVol* clv = cv->getLogVol();
949  std::string vname = clv->getName();
950  if (gmInfo.mstation) vname = gmInfo.mstation->getStationName();
951  ATH_MSG_DEBUG(name() << " building station prototype for " << cv->getLogVol()->getName());
954 
955  std::unique_ptr<Trk::DetachedTrackingVolume> typeStat{};
956 
957  if (vname.find("sTGC")!=std::string::npos || vname.starts_with("MM")) {
958  std::string sName = vname.substr(vname.find('-') + 1);
959  Identifier nswId = m_muonStationTypeBuilder->identifyNSW(sName, gmInfo.trf);
960 
961  if (vname.find("sTGC")!=std::string::npos ) {
962  if (!m_idHelperSvc->issTgc(nswId)) nswId = 0;
963  return m_muonStationTypeBuilder->process_sTGC(nswId, cv, gmInfo.trf);
964  } else if (vname.starts_with("MM") ) {
965  if (!m_idHelperSvc->isMM(nswId)) nswId = 0;
966  return m_muonStationTypeBuilder->process_MM(nswId, cv, gmInfo.trf);
967  }
968  }
969 
970  if (!m_buildBarrel && vname.compare(0, 1, "B") == 0)
971  return typeStat;
972  if (!m_buildEndcap && vname.compare(0, 1, "E") == 0)
973  return typeStat;
974  if (!m_buildCsc && vname.compare(0, 1, "C") == 0)
975  return typeStat;
976  if (!m_buildTgc && vname.compare(0, 1, "T") == 0)
977  return typeStat;
978 
979  int etaphi = gmInfo.volId; // retrieve eta/phi indexes
980  int sign = (etaphi < 0) ? -1 : 1;
981  etaphi = sign * etaphi;
982  int is_mirr = etaphi / 1000;
983  etaphi = etaphi - is_mirr * 1000;
984  int eta = etaphi / 100;
985  int phi = etaphi - eta * 100;
986  eta = eta * sign;
987  const MuonGM::MuonStation* gmStation = muonMgr->getMuonStation(vname.substr(0, 3), eta, phi);
988  if (!gmStation) {
989  gmStation = muonMgr->getMuonStation(vname.substr(0, 4), eta, phi);
990  }
991  // assembly ?
992  if (!gmStation) {
993  int etaphi = gmInfo.volId; // retrieve eta/phi indexes
994  int a_etaphi = static_cast<int>(etaphi / 100000);
995  int sideC = static_cast<int>(a_etaphi / 10000);
996  a_etaphi -= sideC * 10000;
997  is_mirr = static_cast<int>(a_etaphi / 1000);
998  a_etaphi -= is_mirr * 1000;
999  eta = static_cast<int>(a_etaphi / 100);
1000  phi = a_etaphi - eta * 100;
1001  if (sideC)
1002  eta *= -1;
1003  gmStation = muonMgr->getMuonStation(vname.substr(0, 3), eta, phi);
1004  }
1005  //
1006  std::string stname = (vname.compare(0, 1, "T") == 0) ? vname : (clv->getName()).substr(0, vname.size() - 8);
1007  //
1008  if (stname.compare(0, 1, "B") == 0 && eta < 0) {
1009  stname = (clv->getName()).substr(0, vname.size() - 8) + "-";
1010  }
1011  ATH_MSG_VERBOSE(" new station type " << stname << "," << clv->getShape()->type());
1012  ATH_MSG_VERBOSE(" prototype built from eta, phi:" << eta << "," << phi);
1013 
1014  if (stname.compare(0, 2, "CS") == 0 || stname.compare(0, 1, "T") == 0) {
1015 
1016  if (stname.compare(0, 2, "CS") == 0) {
1017  auto csc_station = m_muonStationTypeBuilder->processCscStation(cv, stname, cache);
1018  // create layer representation
1019  auto layerRepr = m_muonStationTypeBuilder->createLayerRepresentation(*csc_station);
1020  // create prototype as detached tracking volume
1021  auto layerVec = std ::make_unique<std::vector<Trk::Layer*>>(Muon::release(layerRepr.second));
1022  typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(csc_station),
1023  std::move(layerRepr.first), std::move(layerVec));
1024  } else {
1025  std::unique_ptr<Trk::TrackingVolume> tgc_station{m_muonStationTypeBuilder->processTgcStation(cv, cache)};
1026  // create layer representation
1027  auto layerRepr = m_muonStationTypeBuilder->createLayerRepresentation(*tgc_station);
1028  // create prototype as detached tracking volume
1029  auto layerVec = std ::make_unique<std::vector<Trk::Layer*>>(Muon::release(layerRepr.second));
1030  typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(tgc_station),
1031  std::move(layerRepr.first), std::move(layerVec));
1032  }
1033 
1034  } else {
1035  double halfX1{0.}, halfX2{0.}, halfY1{0.}, halfY2{0.}, halfZ{0.};
1036 
1037  const GeoShape* shapeS = clv->getShape();
1038  if (shapeS->type() != "Trd") {
1039  getEnvelopeDimensions(clv->getShape(), GeoTrf::Transform3D::Identity(),halfX1, halfX2, halfY1, halfY2, halfZ);
1040  } else {
1041  const GeoTrd* trd = dynamic_cast<const GeoTrd*>(shapeS);
1042  //
1043  halfX1 = trd->getXHalfLength1();
1044  halfX2 = trd->getXHalfLength2();
1045  halfY1 = trd->getYHalfLength1();
1046  halfY2 = trd->getYHalfLength2();
1047  halfZ = trd->getZHalfLength();
1048  }
1049  if (vname.starts_with("B") && (std::abs(halfX1-halfX2)>tolerance || std::abs(halfY1-halfY2)>tolerance) ) {
1050  // enforce box
1051  halfX1 = fmax(halfX1,halfX2); halfX2 = halfX1;
1052  halfY1 = fmax(halfY1,halfY2); halfY2 = halfY1;
1053  }
1054 
1055  // define enveloping volume
1056  std::unique_ptr<Trk::TrackingVolumeArray> confinedVolumes{};
1057  std::vector<std::unique_ptr<Trk::Layer>> confinedLayers{};
1058  std::shared_ptr<Trk::Volume> envelope;
1059  std::string shape = "Trd";
1060  if (std::abs(halfX1-halfX2) < tolerance && std::abs(halfY1-halfY2) < tolerance ) shape = "Box";
1061 
1062  if (shape == "Box") {
1063  auto envBounds = std::make_shared<Trk::CuboidVolumeBounds>(halfX1, halfY1, halfZ);
1064  // station components
1065  confinedVolumes = m_muonStationTypeBuilder->processBoxStationComponents(cv, *envBounds, cache);
1066  if (!confinedVolumes) {
1067  confinedLayers = m_muonStationTypeBuilder->processBoxComponentsArbitrary(cv, *envBounds, cache);
1068  }
1069  // enveloping volume
1070  envelope = std::make_shared<Trk::Volume>(nullptr, envBounds);
1071  } else if (shape == "Trd") {
1072  std::shared_ptr<Trk::TrapezoidVolumeBounds> envBounds{};
1073  Amg::Transform3D transf{Amg::Transform3D::Identity()};
1074  if (halfY1 == halfY2) {
1075  envBounds = std::make_shared<Trk::TrapezoidVolumeBounds>(halfX1, halfX2, halfY1, halfZ);
1076  ATH_MSG_VERBOSE("CAUTION!!!: this trapezoid volume does not require XY -> YZ switch");
1077  }
1078  if (halfY1 != halfY2 && halfX1 == halfX2) {
1079  transf = Amg::getRotateY3D(M_PI_2) * Amg::getRotateZ3D(M_PI_2);
1080  envBounds = std::make_shared<Trk::TrapezoidVolumeBounds>(halfY1, halfY2, halfZ, halfX1);
1081  }
1082  if (halfX1 != halfX2 && halfY1 != halfY2) {
1083  ATH_MSG_WARNING("station envelope arbitrary trapezoid?"<< stname);
1084  }
1085  if (envBounds) {
1086  // station components
1087  confinedVolumes = m_muonStationTypeBuilder->processTrdStationComponents(cv, *envBounds, cache);
1088  // enveloping volume
1089  envelope = std::make_shared<Trk::Volume>(makeTransform(transf), envBounds);
1090  }
1091  }
1092 
1093  if (envelope) {
1094  // ready to build the station prototype
1095  std::unique_ptr<Trk::TrackingVolume> newType{};
1096  if (!confinedLayers.empty()) {
1097  auto confinedLayerPtr = std::make_unique<const std::vector<Trk::Layer*>>(Muon::release(confinedLayers));
1098  newType = std::make_unique<Trk::TrackingVolume>(*envelope, m_muonMaterial, std::move(confinedLayerPtr), stname);
1099  } else {
1100  newType = std::make_unique<Trk::TrackingVolume>(*envelope, m_muonMaterial, nullptr, std::move(confinedVolumes), stname);
1101  }
1102 
1103 
1104  // identify prototype
1105  if ((stname.compare(0, 1, "B") == 0 || stname.compare(0, 1, "E") == 0))
1106  identifyPrototype(*newType, eta, phi, gmStation->getTransform(), muonMgr);
1107 
1108  // create layer representation
1109  auto layerRepr = m_muonStationTypeBuilder->createLayerRepresentation(*newType);
1110 
1111  // create prototype as detached tracking volume
1112  auto layerVec = std::make_unique<std::vector<Trk::Layer*>>(Muon::release(layerRepr.second));
1113  typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(newType),
1114  std::move(layerRepr.first), std::move(layerVec));
1115  }
1116  } // end new station type
1117 
1118  ATH_MSG_DEBUG(" station prototype built for " << vname);
1119 
1121  return typeStat;
1122 }
1123 
1124 Identifier MuonStationBuilderImpl::resolveId(const std::string& vname, const GMInfo& gm_info, int& eta, int& phi,
1125  const MuonGM::MuonDetectorManager* muonMgr) const {
1126 
1127  Identifier stId(0);
1128 
1129  if ( gm_info.mstation ) {
1130  bool is_valid=false;
1131  if (m_idHelperSvc->hasTGC() && gm_info.mstation->getStationName()[0] == 'T')
1132  stId = m_idHelperSvc->tgcIdHelper().elementID(gm_info.mstation->getStationName(),gm_info.mstation->getEtaIndex(),
1133  gm_info.mstation->getPhiIndex(), is_valid);
1134  else if (m_idHelperSvc->hasRPC() && gm_info.mstation->getStationName().starts_with("BML"))
1135  stId = m_idHelperSvc->rpcIdHelper().elementID(gm_info.mstation->getStationName(),gm_info.mstation->getEtaIndex(),
1136  gm_info.mstation->getPhiIndex(), 1, is_valid);
1137  else if (m_idHelperSvc->hasMDT() && !gm_info.mstation->getStationName().starts_with("C"))
1138  stId = m_idHelperSvc->mdtIdHelper().elementID(gm_info.mstation->getStationName().substr(0, 3), gm_info.mstation->getEtaIndex(),
1139  gm_info.mstation->getPhiIndex(), is_valid);
1140 
1141  if (!is_valid || !stId.get_compact()) {
1142  ATH_MSG_WARNING("identifier of the station not found:" << gm_info.mstation->getStationName()<<"," << gm_info.mstation->getEtaIndex()
1143  <<"," << gm_info.mstation->getPhiIndex() );
1144  return Identifier(0);
1145  } else return stId;
1146  }
1147 
1148  int etaphi = gm_info.volId; // retrieve eta/phi indexes
1149  int sign = (etaphi < 0) ? -1 : 1;
1150  etaphi = sign * etaphi;
1151  int is_mirr = etaphi / 1000;
1152  etaphi = etaphi - is_mirr * 1000;
1153  eta = etaphi / 100;
1154  phi = etaphi - eta * 100;
1155  eta = eta * sign;
1156  const MuonGM::MuonStation* gmStation =
1157  muonMgr->getMuonStation(vname.substr(0, 3), eta, phi);
1158  // try to retrieve
1159  if (!gmStation) {
1160  gmStation = muonMgr->getMuonStation(vname.substr(0, 4), eta, phi);
1161  }
1162  // assembly ?
1163  if (!gmStation) {
1164  int etaphi = gm_info.volId; // retrieve eta/phi indexes
1165  int a_etaphi = static_cast<int>(etaphi / 100000);
1166  int sideC = static_cast<int>(a_etaphi / 10000);
1167  a_etaphi -= sideC * 10000;
1168  is_mirr = static_cast<int>(a_etaphi / 1000);
1169  a_etaphi -= is_mirr * 1000;
1170  eta = static_cast<int>(a_etaphi / 100);
1171  phi = a_etaphi - eta * 100;
1172  if (sideC)
1173  eta *= -1;
1174  gmStation = muonMgr->getMuonStation(vname.substr(0, 3), eta, phi);
1175  }
1176  //
1177  if (!gmStation)
1178  ATH_MSG_WARNING("Muon station not found! " << vname << "," << eta << ","
1179  << phi);
1180 
1181  std::string stName;
1182  if (vname.compare(0, 1, "T") == 0 || vname.compare(0, 1, "C") == 0) {
1183  stName = vname.substr(0, 4);
1184  } else {
1185  stName = (vname.substr(0, vname.size() - 8));
1186  if (stName.compare(0, 1, "B") == 0 && eta < 0) {
1187  stName = vname.substr(0, vname.size() - 8) + "-";
1188  }
1189  }
1190  if (!gmStation)
1191  return stId;
1192  Amg::Transform3D transf = gmStation->getTransform();
1193  bool is_valid{false};
1194  if (m_idHelperSvc->hasCSC() && stName.compare(0, 1, "C") == 0) {
1195  stId = m_idHelperSvc->cscIdHelper().elementID(vname.substr(0, 3), eta,
1196  phi, is_valid);
1197  }
1198  // adjust eta,phi
1199  if (vname.compare(0, 1, "C") == 0) {
1200  eta = 1;
1201  if (transf.translation().z() < 0)
1202  eta = 0;
1203  double phic = transf.translation().phi() + 0.1;
1204  phi =
1205  static_cast<int>(phic < 0 ? 4 * phic / M_PI + 8 : 4 * phic / M_PI);
1206  }
1207  if (vname.compare(0, 1, "T") == 0) {
1208  bool az = true;
1209  std::string sub = vname.substr(7, 2);
1210  if (transf.translation().z() < 0)
1211  az = false;
1212  if (sub == "01")
1213  eta = az ? 5 : 4;
1214  else if (sub == "02")
1215  eta = az ? 5 : 4;
1216  else if (sub == "03")
1217  eta = az ? 6 : 3;
1218  else if (sub == "04")
1219  eta = az ? 7 : 2;
1220  else if (sub == "05")
1221  eta = az ? 8 : 1;
1222  else if (sub == "06")
1223  eta = az ? 5 : 4;
1224  else if (sub == "07")
1225  eta = az ? 5 : 4;
1226  else if (sub == "08")
1227  eta = az ? 6 : 3;
1228  else if (sub == "09")
1229  eta = az ? 7 : 2;
1230  else if (sub == "10")
1231  eta = az ? 8 : 1;
1232  else if (sub == "11")
1233  eta = az ? 9 : 0;
1234  else if (sub == "12")
1235  eta = az ? 5 : 4;
1236  else if (sub == "13")
1237  eta = az ? 5 : 4;
1238  else if (sub == "14")
1239  eta = az ? 6 : 3;
1240  else if (sub == "15")
1241  eta = az ? 7 : 2;
1242  else if (sub == "16")
1243  eta = az ? 8 : 1;
1244  else if (sub == "17")
1245  eta = az ? 9 : 0;
1246  else if (sub == "18")
1247  eta = az ? 5 : 4;
1248  else if (sub == "19")
1249  eta = az ? 5 : 4;
1250  else if (sub == "20")
1251  eta = az ? 5 : 4;
1252  else if (sub == "21")
1253  eta = az ? 5 : 4;
1254  else if (sub == "22")
1255  eta = az ? 5 : 4;
1256  }
1257  if (m_idHelperSvc->hasTGC() && stName[0] == 'T') {
1258  int etaSt = eta - 4;
1259  if (eta < 5)
1260  etaSt = eta - 5;
1261  double phic = transf.translation().phi();
1262  if (vname.compare(2, 1, "E") == 0 && vname.compare(0, 3, "T4E") != 0)
1263  phi = static_cast<int>(phic < 0 ? 24 * phic / M_PI + 48
1264  : 24 * phic / M_PI);
1265  else
1266  phi = static_cast<int>(phic < 0 ? 12 * phic / M_PI + 24
1267  : 12 * phic / M_PI);
1268  phi++;
1269  stId = m_idHelperSvc->tgcIdHelper().elementID(vname.substr(0, 3), etaSt,
1270  phi, is_valid);
1271  } else if (m_idHelperSvc->hasRPC() && stName.compare(0, 3, "BML") == 0) {
1272  stId = m_idHelperSvc->rpcIdHelper().elementID(vname.substr(0, 3), eta,
1273  phi, 1, is_valid);
1274  } else if (m_idHelperSvc->hasMDT() && stName.compare(0, 1, "C") != 0) {
1275  stId = m_idHelperSvc->mdtIdHelper().elementID(vname.substr(0, 3), eta,
1276  phi, is_valid);
1277  }
1278  if (!is_valid || !stId.get_compact()) {
1279  ATH_MSG_DEBUG("identifier of the station not found:"
1280  << vname << "," << eta << "," << phi);
1281  if (!stId.get_compact())
1282  return Identifier(0);
1283  }
1284  return stId;
1285 }
1286 
1288  Identifier id, const Trk::Layer* lay) const {
1289 
1290  // RE
1291  if (m_idHelperSvc->isMdt(id)) {
1292  const MuonGM::MdtReadoutElement* mdtRE = muonMgr->getMdtReadoutElement(id);
1293  constexpr double tol = 0.5*Gaudi::Units::mm;
1294  if (mdtRE && !lay->surfaceRepresentation().isOnSurface(mdtRE->transform(id).translation(), tol, tol)) {
1295  ATH_MSG_DEBUG(__FILE__<<":"<<__LINE__<<" "<<comment << ":tube(id) "
1296  <<m_idHelperSvc->toString(id)<<" "<<Amg::toString(mdtRE->transform(id).translation())
1297  <<" not on surface:"<<lay->surfaceRepresentation()<<std::endl<<
1298  " "<<Amg::toString(lay->surfaceRepresentation().transform().inverse()*(mdtRE->transform(id).translation())) );
1299  }
1300  } else if (m_idHelperSvc->isRpc(id)) {
1301  const MuonGM::RpcReadoutElement* rpcRE = muonMgr->getRpcReadoutElement(id);
1302  Amg::Transform3D trid = rpcRE->transform(id);
1303  Amg::Transform3D check_layer_identity = lay->surfaceRepresentation().transform().inverse() * trid;
1304  if (!Amg::doesNotDeform(check_layer_identity)) {
1305  ATH_MSG_DEBUG(__FILE__<<":"<<__LINE__<<" "<<comment<<" "<<Amg::toString(check_layer_identity));
1306  }
1307 
1308  } else if (m_idHelperSvc->isTgc(id)) {
1309  const Amg::Transform3D trid = muonMgr->getTgcReadoutElement(id)->transform(id);
1310  Amg::Transform3D check_layer_identity = lay->surfaceRepresentation().transform().inverse() * trid;
1311  if (!Amg::doesNotDeform(check_layer_identity)) {
1312  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" "<<comment <<" "<<Amg::toString(check_layer_identity));
1313  }
1314  }
1315 }
1316 
1317 void MuonStationBuilderImpl::getEnvelopeDimensions(const GeoShape* shape, GeoTrf::Transform3D transf, double& halfX1, double& halfX2, double& halfY1, double& halfY2, double& halfZ) const {
1318 
1319  if (shape->type() == "Tube" ) return;
1320  if (shape->type() == "Trd" || shape->type() == "Box" || shape->type() == "SimplePolygonBrep") {
1321  std::vector<GeoTrf::Vector3D> vtx = getPolyShapeEdges(shape, transf);
1322  for (const auto & vx : vtx) {
1323  halfZ = std::max( std::abs(vx.z()), halfZ );
1324  if ( vx.z()< 0 ) {
1325  halfX1 = std::max( std::abs(vx.x()), halfX1);
1326  halfY1 = std::max( std::abs(vx.y()), halfY1);
1327  } else if ( vx.z()> 0 ) {
1328  halfX2 = std::max( std::abs(vx.x()), halfX2);
1329  halfY2 = std::max( std::abs(vx.y()), halfY2);
1330  }
1331  }
1332  } else if (shape->type() == "Shift") {
1333  const GeoShapeShift* shift = static_cast<const GeoShapeShift*>(shape);
1334  getEnvelopeDimensions(shift->getOp(), transf*shift->getX(), halfX1, halfX2, halfY1, halfY2, halfZ);
1335  } else if (shape->type() == "Union") {
1336  const GeoShapeUnion* uni = static_cast<const GeoShapeUnion*>(shape);
1337  getEnvelopeDimensions(uni->getOpA(), transf, halfX1, halfX2, halfY1, halfY2, halfZ);
1338  getEnvelopeDimensions(uni->getOpB(), transf, halfX1, halfX2, halfY1, halfY2, halfZ);
1339  } else if (shape->type() == "Subtraction") {
1340  const GeoShapeSubtraction* sub = static_cast<const GeoShapeSubtraction*>(shape);
1341  getEnvelopeDimensions(sub->getOpA(), transf, halfX1, halfX2, halfY1, halfY2, halfZ);
1342  } else {
1343  ATH_MSG_WARNING("unexpected station shape in envelope building ? "<< shape->type() );
1344  }
1345  return;
1346 }
1347 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MuonGM::MuonDetectorManager::getRpcReadoutElement
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:181
geoGetVolumes
GeoVolumeVec_t geoGetVolumes(const GeoGraphNode *node, int depthLimit=1, int sizeHint=20)
Return the child volumes and associated transforms.
Definition: GeoVisitVolumes.cxx:211
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
Trk::Layer::setRef
void setRef(double)
set the reference measure
TrapezoidBounds.h
Muon::MuonStationBuilderImpl::checkLayerId
void checkLayerId(std::string_view comment, const MuonGM::MuonDetectorManager *muonMgr, Identifier id, const Trk::Layer *lay) const
Definition: MuonStationBuilderImpl.cxx:1287
MdtReadoutElement.h
MuonGM::MuonClusterReadoutElement::transform
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
Definition: MuonClusterReadoutElement.h:124
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
MuonGM::MdtReadoutElement::getNLayers
int getNLayers() const
Returns the number of tube layers inside the multilayer.
python.SystemOfUnits.mm
float mm
Definition: SystemOfUnits.py:98
Trk::BinnedArray::binUtility
virtual const BinUtility * binUtility() const =0
Return the BinUtility.
Muon::makeTransform
std::unique_ptr< Amg::Transform3D > makeTransform(const Amg::Transform3D &trf)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:14
DiscBounds.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
RectangleBounds.h
Trk::Layer::setLayerType
void setLayerType(int identifier)
set the Layer coding
MuonGM::MdtReadoutElement::center
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
MuonGM::MuonClusterReadoutElement::center
virtual const Amg::Vector3D & center() const override
Return the center of the element.
Definition: MuonClusterReadoutElement.h:125
perp
Scalar perp() const
perp method - perpenticular length
Definition: AmgMatrixBasePlugin.h:44
MaterialProperties.h
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:72
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
Trk::CuboidVolumeBounds
Definition: CuboidVolumeBounds.h:52
TgcIdHelper
Definition: TgcIdHelper.h:50
sTgcReadoutElement.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
Muon::MuonStationBuilderImpl::m_gmBrowser
Trk::GMTreeBrowser m_gmBrowser
Definition: MuonStationBuilderImpl.h:114
Trk::DetachedTrackingVolume::trackingVolume
const TrackingVolume * trackingVolume() const
returns the TrackingVolume
Definition: DetachedTrackingVolume.h:107
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
Muon::MuonStationBuilderImpl::identifyPrototype
void identifyPrototype(Trk::TrackingVolume &station, int eta, int phi, const Amg::Transform3D &transf, const MuonGM::MuonDetectorManager *muonMgr) const
Definition: MuonStationBuilderImpl.cxx:479
BinnedArray.h
Muon::MuonStationBuilderImpl::identifyNSWLayers
void identifyNSWLayers(Trk::DetachedTrackingVolume &station, const Identifier &id) const
Definition: MuonStationBuilderImpl.cxx:456
Muon::MuonStationIndex::stName
const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:104
MuonGM::CscReadoutElement::ChamberLayer
int ChamberLayer() const
Definition: CscReadoutElement.h:290
MuonGM::MuonStation::getTransform
Amg::Transform3D getTransform() const
Definition: MuonStation.h:180
Trk::MaterialProperties::thicknessInX0
float thicknessInX0() const
Return the radiationlength fraction.
Muon::MuonStationBuilderImpl::resolveId
Identifier resolveId(const std::string &vname, const GMInfo &gm_info, int &eta, int &phi, const MuonGM::MuonDetectorManager *muonMgr) const
Definition: MuonStationBuilderImpl.cxx:1124
Trk::TrackingVolume::associatedSubVolume
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
Definition: TrackingVolume.cxx:530
BinUtility.h
Muon::MuonStationBuilderImpl::m_buildTgc
Gaudi::Property< bool > m_buildTgc
Definition: MuonStationBuilderImpl.h:121
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:113
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
Trk::GeoMaterialConverter::convert
static Material convert(const GeoMaterial *gm)
Single conversion , input type GeoMaterial - output type Trk::MaterialProperties.
Definition: GeoMaterialConverter.cxx:18
createCablingJSON.doubletR
int doubletR
Definition: createCablingJSON.py:15
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
python.atlas_oh.im
im
Definition: atlas_oh.py:167
Identifier::get_compact
value_type get_compact() const
Get the compact id.
HomogeneousLayerMaterial.h
Trk::positiveFaceXY
@ positiveFaceXY
Definition: BoundarySurfaceFace.h:33
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:55
Layer.h
Trk::MaterialProperties::x0
float x0() const
Return the radiation length.
IDetachedTrackingVolumeBuilderCond.h
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PlotCalibFromCool.multi
multi
Definition: PlotCalibFromCool.py:99
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:878
Muon::MuonStationBuilderImpl::retrieveGMsensitive
std::vector< std::pair< const GeoVPhysVol *, std::vector< GMInfo > > > retrieveGMsensitive(const MuonGM::MuonDetectorManager *muonMgr) const
Definition: MuonStationBuilderImpl.cxx:748
MuonR4::to_string
std::string to_string(const SectorProjector proj)
Definition: MsTrackSeeder.cxx:66
ITrackingVolumeArrayCreator.h
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
MuonGM::MuonStation::getStationName
const std::string & getStationName() const
like BMS5, T1F1, CSL1
Definition: MuonStation.h:176
MuonStationBuilderImpl.h
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Trk::BoundarySurfaceFace
BoundarySurfaceFace
Definition: BoundarySurfaceFace.h:31
Trk::BinnedArray::arrayObjectsNumber
virtual unsigned int arrayObjectsNumber() const =0
Number of Entries in the Array.
RpcIdHelper
Definition: RpcIdHelper.h:51
TrapezoidVolumeBounds.h
Trk::Layer::layerType
int layerType() const
get the Layer coding
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
Amg::getRotateZ3D
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Definition: GeoPrimitivesHelpers.h:270
Trk::TrackingVolume::confinedLayers
const LayerArray * confinedLayers() const
Return the subLayer array.
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:260
Trk::MaterialProperties::thickness
float thickness() const
Return the thickness in mm.
MuonGM::CscReadoutElement::Ngasgaps
int Ngasgaps() const
Definition: CscReadoutElement.h:308
Muon::MuonStationBuilderImpl::initialize
virtual StatusCode initialize() override
Definition: MuonStationBuilderImpl.cxx:76
Trk::GMTreeBrowser::compareGeoVolumes
int compareGeoVolumes(const GeoVPhysVol *gv1, const GeoVPhysVol *gv2, double tolerance, bool printFullInfo=false, int level=0) const
Recursive comparison of trees/branches/volumes : in quiet mode (printFullInfo=False) ,...
Definition: GMTreeBrowser.cxx:42
DiamondBounds.h
GeoPrimitives.h
GeometryStatics.h
GeoVisitVolumes.h
Visitor to process all volumes under a GeoModel node.
CylinderVolumeBounds.h
MMReadoutElement.h
MuonGM::MuonStation::getPhiIndex
int getPhiIndex() const
a la AMDB
Definition: MuonStation.h:173
Muon::GMInfo::volId
int volId
Definition: MuonStationBuilderImpl.h:36
Trk::MaterialProperties::addMaterial
void addMaterial(const Material &mp, float dInX0)
Material averaging.
Definition: MaterialProperties.cxx:46
Trk::Surface::isOnSurface
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
Definition: Surface.cxx:123
Trk::Material::x0
float x0() const
Definition: Material.h:227
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::Layer::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
Muon::MuonStationBuilderImpl::glueComponents
void glueComponents(Trk::DetachedTrackingVolume *) const
Definition: MuonStationBuilderImpl.cxx:158
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:217
Muon::MuonStationTypeBuilder::Cache
Definition: MuonStationTypeBuilder.h:61
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
Muon::MuonStationBuilderImpl::m_muonStationTypeBuilder
ToolHandle< Muon::MuonStationTypeBuilder > m_muonStationTypeBuilder
Helper Tool to create TrackingVolume Arrays.
Definition: MuonStationBuilderImpl.h:98
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::ArraySpan
std::span< T > ArraySpan
Definition: TrackingVolume.h:59
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:238
beamspotman.n
n
Definition: beamspotman.py:727
MuonGM::MuonDetectorManager::getMuonStations
const std::vector< const MuonStation * > getMuonStations() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:159
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
python.getProblemFolderFromLogs.st
st
Definition: getProblemFolderFromLogs.py:68
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
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
Muon::MuonStationBuilderImpl::buildDetachedTrackingVolumeType
std::unique_ptr< Trk::DetachedTrackingVolume > buildDetachedTrackingVolumeType(const MuonGM::MuonDetectorManager *muonMgr, const GeoVPhysVol *gv, const GMInfo &info) const
Definition: MuonStationBuilderImpl.cxx:945
MuonGM::MuonStation
Definition: MuonStation.h:51
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:108
CscReadoutElement.h
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MdtIdHelper
Definition: MdtIdHelper.h:61
Muon::MuonStationBuilderImpl::m_trackingVolumeHelper
ToolHandle< Trk::ITrackingVolumeHelper > m_trackingVolumeHelper
Helper Tool to create TrackingVolumes.
Definition: MuonStationBuilderImpl.h:105
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:108
Trk::GMTreeBrowser::findTopBranch
static const GeoVPhysVol * findTopBranch(const GeoVPhysVol *gv, std::string_view name)
search of top branch : returns mother volume for children matching name
Definition: GMTreeBrowser.cxx:442
RotatedDiamondBounds.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::negativeFaceXY
@ negativeFaceXY
Definition: BoundarySurfaceFace.h:32
Muon::GMInfo
Definition: MuonStationBuilderImpl.h:34
Muon::GMInfo::mstation
const MuonGM::MuonStation * mstation
Definition: MuonStationBuilderImpl.h:37
MuonGM::MuonDetectorManager::NTgcStEtaOffset
static constexpr int NTgcStEtaOffset
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:162
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
beamspotman.stat
stat
Definition: beamspotman.py:262
Trk::BinnedArray::arrayObjects
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
Trk::BinUtility
Definition: BinUtility.h:39
grepfile.ic
int ic
Definition: grepfile.py:33
CaloCondBlobAlgs_fillNoiseFromASCII.comment
string comment
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
tolerance
Definition: suep_shower.h:17
Trk::DetachedTrackingVolume::clone
DetachedTrackingVolume * clone(const std::string &name, Amg::Transform3D &shift) const
clone with transform
Definition: DetachedTrackingVolume.cxx:58
IOVInfiniteRange.h
Muon::GMInfo::trf
Amg::Transform3D trf
Definition: MuonStationBuilderImpl.h:35
MuonGM::MuonDetectorManager::NCscStEtaOffset
static constexpr int NCscStEtaOffset
Identifier <-> AMDB conversion constants in use.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:160
Trk::TrackingVolume::volumeName
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
SimplePolygonBrepVolumeBounds.h
DoubleTrapezoidVolumeBounds.h
CscIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Definition: CscIdHelper.cxx:711
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Muon::MuonStationBuilderImpl::getNSWStationsForTranslation
void getNSWStationsForTranslation(const GeoVPhysVol *pv, const std::string &name, const Amg::Transform3D &, std::vector< std::pair< std::pair< const GeoLogVol *, Trk::MaterialProperties * >, std::vector< Amg::Transform3D >>> &vols, std::vector< std::string > &volNames) const
Definition: MuonStationBuilderImpl.cxx:646
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
BoundarySurfaceFace.h
Muon::MuonStationBuilderImpl::m_identifyLayers
Gaudi::Property< bool > m_identifyLayers
Definition: MuonStationBuilderImpl.h:122
sTgcIdHelper
Definition: sTgcIdHelper.h:55
Trk::DetachedTrackingVolume::name
const std::string & name() const
returns the Name
Definition: DetachedTrackingVolume.h:115
checkTriggerxAOD.found
found
Definition: checkTriggerxAOD.py:328
Amg::getRotateY3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
Definition: GeoPrimitivesHelpers.h:261
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGM::RpcReadoutElement::numberOfLayers
virtual int numberOfLayers(bool measphi=true) const override final
number of layers in phi/eta projection, same for eta/phi planes
BoundarySurface.h
MuonGM::MuonDetectorManager::getMuonStation
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:139
Muon::MuonStationBuilderImpl::m_buildEndcap
Gaudi::Property< bool > m_buildEndcap
Definition: MuonStationBuilderImpl.h:119
Trk::MaterialProperties
Definition: MaterialProperties.h:40
TrackingVolume.h
MuonGM::MdtReadoutElement::tubePos
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
MmIdHelper
Definition: MmIdHelper.h:54
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:51
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonStationBuilderImpl::MuonStationBuilderImpl
MuonStationBuilderImpl(const std::string &, const std::string &, const IInterface *)
Definition: MuonStationBuilderImpl.cxx:69
ref
const boost::regex ref(r_ef)
Trk::PlaneSurface
Definition: PlaneSurface.h:64
GeoPrimitivesHelpers.h
MuonGM::MuonStation::getEtaIndex
int getEtaIndex() const
a la AMDB
Definition: MuonStation.h:174
Trk::TrackingVolume::confinedVolumes
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:173
RPDUtils::sideC
unsigned constexpr int sideC
Definition: RPDUtils.h:15
Muon::MuonStationBuilderImpl::getEnvelopeDimensions
void getEnvelopeDimensions(const GeoShape *shape, GeoTrf::Transform3D transf, double &halfX1, double &halfX2, double &halfY1, double &halfY2, double &halfZ) const
Definition: MuonStationBuilderImpl.cxx:1317
python.changerun.pv
pv
Definition: changerun.py:79
GeoPrimitivesToStringConverter.h
MuonGM::MuonDetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:117
Trk::negativeFaceYZ
@ negativeFaceYZ
Definition: BoundarySurfaceFace.h:34
Muon::MuonStationBuilderImpl::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonStationBuilderImpl.h:61
Trk::DetachedTrackingVolume::layerRepresentation
const Layer * layerRepresentation() const
returns layer representation
Definition: DetachedTrackingVolume.h:117
Muon::MuonStationBuilderImpl::m_muonMaterial
Trk::Material m_muonMaterial
the material
Definition: MuonStationBuilderImpl.h:111
Muon::MuonStationBuilderImpl::buildDetachedTrackingVolumesImpl
DetachedVolVec buildDetachedTrackingVolumesImpl(const MuonGM::MuonDetectorManager *muonMgr, bool blend=false) const
Definition: MuonStationBuilderImpl.cxx:100
createCablingJSON.doubletPhi
int doubletPhi
Definition: createCablingJSON.py:16
TrackingGeometry.h
TgcReadoutElement.h
Muon::MuonStationBuilderImpl::m_buildCsc
Gaudi::Property< bool > m_buildCsc
Definition: MuonStationBuilderImpl.h:120
top
@ top
Definition: TruthClasses.h:64
MuonGM::MuonDetectorManager::cscIdHelper
const CscIdHelper * cscIdHelper() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:236
Trk::Material
Definition: Material.h:117
Trk::BinnedArray
Definition: BinnedArray.h:36
tolerance
constexpr double tolerance
Definition: MuonStationBuilderImpl.cxx:64
MuonGM::MdtReadoutElement::transform
virtual const Amg::Transform3D & transform(const Identifier &id) const override final
Return local to global transform associated with this identifier.
AthAlgTool
Definition: AthAlgTool.h:26
MuonGM::MuonDetectorManager::NTgcStatTypeOff
static constexpr int NTgcStatTypeOff
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:161
RotatedTrapezoidBounds.h
Trk::DetachedTrackingVolume
Definition: DetachedTrackingVolume.h:37
MuonStation.h
Trk::positiveFaceYZ
@ positiveFaceYZ
Definition: BoundarySurfaceFace.h:35
Trk::TrackingVolume
Definition: TrackingVolume.h:119
Trk::TrackingVolume::associatedLayer
const Layer * associatedLayer(const Amg::Vector3D &gp) const
Return the associated Layer.
Definition: TrackingVolume.cxx:382
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Material
@ Material
Definition: MaterialTypes.h:8
python.ParticleTypeUtil.info
def info
Definition: ParticleTypeUtil.py:87
Utils.h
Muon::MuonStationBuilderImpl::identifyLayers
void identifyLayers(Trk::DetachedTrackingVolume *, Identifier, int, int, const MuonGM::MuonDetectorManager *) const
Definition: MuonStationBuilderImpl.cxx:188
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
Muon::release
std::vector< ObjType * > release(std::vector< std::unique_ptr< ObjType >> &objVec)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:18
Muon::MuonStationBuilderImpl::m_buildBarrel
Gaudi::Property< bool > m_buildBarrel
Definition: MuonStationBuilderImpl.h:118
plotBeamSpotMon.nc
int nc
Definition: plotBeamSpotMon.py:82
CuboidVolumeBounds.h
MuonGM::MuonReadoutElement::getStationPhi
int getStationPhi() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:183
MuonGM::MuonReadoutElement::getStationEta
int getStationEta() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:182
Trk::Layer
Definition: Layer.h:72
Muon::MuonStationBuilderImpl::DetachedVolVec
std::vector< std::unique_ptr< Trk::DetachedTrackingVolume > > DetachedVolVec
Definition: MuonStationBuilderImpl.h:53
RpcReadoutElement.h
Identifier
Definition: IdentifierFieldParser.cxx:14