ATLAS Offline Software
MSTrackingVolumeBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
11 
12 #include "Acts/Geometry/CylinderLayer.hpp"
13 #include "Acts/Geometry/CutoutCylinderVolumeBounds.hpp"
14 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
15 #include "Acts/Geometry/TrapezoidVolumeBounds.hpp"
16 #include "Acts/Geometry/TrackingVolume.hpp"
17 #include "Acts/Material/HomogeneousVolumeMaterial.hpp"
18 #include "Acts/Utilities/BinnedArrayXD.hpp"
19 #include "Acts/Surfaces/SurfaceArray.hpp"
20 #include "Acts/Utilities/Helpers.hpp"
21 
22 #include <ranges>
23 
24 using namespace Muon::MuonStationIndex;
25 
26 namespace ActsTrk{
27 
29  ATH_CHECK(detStore()->retrieve(m_detMgr));
30  return StatusCode::SUCCESS;
31  }
32 
33  std::shared_ptr<Acts::TrackingVolume>
34  MSTrackingVolumeBuilder::trackingVolume(const Acts::GeometryContext& /*gctx*/,
35  std::shared_ptr<const Acts::TrackingVolume> insideVolume,
36  std::shared_ptr<const Acts::VolumeBounds> /*outsideBounds*/) const {
37 
38  ATH_MSG_INFO("Setup MS Gen-1 tracking volume");
39  std::shared_ptr<Acts::VolumeBounds> msBounds{};
40  if (insideVolume) {
41  msBounds = std::make_unique<Acts::CutoutCylinderVolumeBounds>(0, 4000, 14500, 22500, 3200);
42  } else {
43  msBounds = std::make_unique<Acts::CylinderVolumeBounds>(0, 14500, 22500);
44  }
46  auto surfCounter = make_array<unsigned, toInt(ChIndex::ChIndexMax)>(0);
47  std::vector<std::shared_ptr<const Acts::Surface>> msSurfaces{};
48  Acts::SurfaceVector rawSurfs{};
49  for (const MuonGMR4::MuonReadoutElement* re : m_detMgr->getAllReadoutElements()) {
50  const unsigned chIdx = toInt(re->chamberIndex());
51  auto reSurfaces = re->getSurfaces();
52  msSurfaces.reserve(msSurfaces.size() + reSurfaces.size());
53  for (std::shared_ptr<Acts::Surface>& surf : reSurfaces) {
54  surf->assignGeometryId(Acts::GeometryIdentifier{}.withLayer(chIdx + m_firstLayId).withSensitive(++surfCounter[chIdx]));
55  const auto* det = static_cast<const ActsTrk::IDetectorElementBase*>(surf->associatedDetectorElement());
56  ATH_MSG_DEBUG("Append new surface "<<m_detMgr->idHelperSvc()->toString(det->identify())
57  <<" -> geoId: "<<surf->geometryId());
58  msSurfaces.push_back(std::move(surf));
59  }
60  }
61  rawSurfs = Acts::unpackSmartPointers(msSurfaces);
62  auto surfaceArray = std::make_unique<Acts::SurfaceArray>(std::make_unique<Acts::SurfaceArray::SingleElementLookup>(rawSurfs),
63  msSurfaces);
64 
65  auto cylinder = Acts::CylinderLayer::create(Amg::Transform3D::Identity(),
66  std::make_shared<Acts::CylinderBounds>(14500, 22500),
67  std::move(surfaceArray), 10.*Gaudi::Units::m,
68  nullptr, Acts::LayerType::active);
69 
70  auto material = std::make_unique<Acts::HomogeneousVolumeMaterial>(Acts::Material::Vacuum());
71 
72  auto layerArray = std::make_unique<Acts::BinnedArrayXD<Acts::LayerPtr>>(cylinder);
73 
74  return std::make_shared<Acts::TrackingVolume>(Acts::Transform3::Identity(), std::move(msBounds),
75  std::move(material), std::move(layerArray), nullptr,
76  Acts::MutableTrackingVolumeVector{},
77  "Muon Spectrometer Envelope");
78 }
79 
80 }
81 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Muon::MuonStationIndex
Definition: MuonStationIndex.h:13
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
initialize
void initialize()
Definition: run_EoverP.cxx:894
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
SpectrometerSector.h
ActsTrk::IDetectorElementBase
base class interface providing the bare minimal interface extension.
Definition: IDetectorElement.h:32
Trk::active
@ active
Definition: Layer.h:47
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
MuonDetectorManager.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MSTrackingVolumeBuilder.h
re
const boost::regex re(r_e)
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MdtCalibInput.h:31
MuonReadoutElement.h
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
Muon::MuonStationIndex::toInt
constexpr int toInt(const EnumType enumVal)
Definition: MuonStationIndex.h:61