ATLAS Offline Software
Loading...
Searching...
No Matches
Chamber.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef SIMULATIONBASE
7
8#include <Acts/Geometry/TrapezoidVolumeBounds.hpp>
9#include <Acts/Surfaces/PlaneSurface.hpp>
10#include <format>
11#include <mutex>
12namespace {
13 static std::mutex placementMutex{};
14}
15
16namespace MuonGMR4{
17
18 std::ostream& operator<<(std::ostream& ostr,
19 const Chamber::defineArgs& args) {
20 ostr<<"halfX (S/L): "<<halfXlowY(*args.bounds)<<"/"<<halfXhighY(*args.bounds)<<" [mm], ";
21 ostr<<"halfY: "<<halfY(*args.bounds)<<" [mm], ";
22 ostr<<"halfZ: "<<halfZ(*args.bounds)<<" [mm], ";
23 return ostr;
24 }
25 std::ostream& operator<<(std::ostream& ostr, const Chamber& chamber) {
26 ostr<<chamber.identString()<<" "<<chamber.parameters();
27 return ostr;
28 }
29
31 m_args{std::move(args)} {}
32
33 //Comparison operator for the MuonChambers:
34 // Legacy & NSW: sorted by StationName
35 // NSW (MM) & NSW (STG) : sorted by Station Name
36 // NSW (MM/STGC) & NSW(MM/STGC) : if they have same eta and phi -> sorted by multilayer (case for large sectors)
37 // small NSW chambers are sorted by phi - all elements in a sector are grouped in the same chamber
38 bool Chamber::operator<(const Chamber& other) const {
39 if(detectorType() != other.detectorType()) {
40 return detectorType() < other.detectorType();
41 }
42 if (stationName() != other.stationName()) {
43 return stationName() < other.stationName();
44 }
45 if (stationPhi() != other.stationPhi()) {
46 return stationPhi() < other.stationPhi();
47 }
48 if (stationEta() != other.stationEta()) {
49 return stationEta() < other.stationEta();
50 }
51 return readoutEles().front()->identify() <
52 other.readoutEles().front()->identify();
53 }
54
55 std::string Chamber::identString() const {
57 return std::format("MS chamber {:}",
58 idHelperSvc()->toStringDetEl(readoutEles().front()->identify()));
59 }
60 return std::format("MS chamber {:} station {:} eta {:02} phi {:02}",
61 detectorType(),idHelperSvc()->stationNameString(readoutEles().front()->identify()),
63 }
64 bool Chamber::barrel() const {
65 return !idHelperSvc()->isEndcap(readoutEles().front()->identify());
66 }
68 return readoutEles().front()->idHelperSvc();
69 }
71 return readoutEles().front()->chamberIndex();
72 }
73
75 return m_args.placement->detectorType();
76 }
77 double Chamber::halfXLong() const { return MuonGMR4::halfXhighY(*m_args.bounds); }
78 double Chamber::halfXShort() const { return MuonGMR4::halfXlowY(*m_args.bounds); }
79 double Chamber::halfY() const { return MuonGMR4::halfY(* m_args.bounds); }
80 double Chamber::halfZ() const { return MuonGMR4::halfZ(*m_args.bounds);}
81
82 std::shared_ptr<Acts::Volume> Chamber::boundingVolume(const ActsTrk::GeometryContext& /*gctx*/) const {
83 Acts::VolumePlacementBase* ATLAS_THREAD_SAFE placement = m_args.placement.get();
84 return std::make_shared<Acts::Volume>(*placement, bounds());
85 }
86 void Chamber::addPlacement(std::unique_ptr<ActsTrk::VolumePlacement>&& child) const {
87 ActsTrk::VolumePlacement* ATLAS_THREAD_SAFE placement = m_args.placement.get();
88 std::unique_lock guard{placementMutex};
89 placement->addChild(std::move(child));
90 }
91 std::shared_ptr<Acts::VolumeBounds> Chamber::bounds() const { return m_args.bounds; }
92 int Chamber::stationPhi() const{ return readoutEles().front()->stationPhi(); }
93 int Chamber::stationEta() const{ return readoutEles().front()->stationEta(); }
94 int Chamber::stationName() const{ return readoutEles().front()->stationName(); }
95 int8_t Chamber::side() const{ return Acts::copySign(1, readoutEles().front()->stationEta()); }
96 int Chamber::sector() const{ return idHelperSvc()->sector(readoutEles().front()->identify()); }
99 return m_args.detEles;
100 }
101 const Acts::PlaneSurface& Chamber::surface() const {
102 return *m_args.surface;
103 }
105 return m_args.placement->localToGlobalTransform(gctx.context());
106 }
108 return m_args.placement->globalToLocalTransform(gctx.context());
109 }
110 const SpectrometerSector* Chamber::parent() const { return m_parent; }
112}
113#endif
size_t size() const
Number of registered mappings.
#define ATLAS_THREAD_SAFE
Acts::GeometryContext context() const
Implementation to make a (tracking) volume alignable.
Chamber represent the volume enclosing a muon station.
Definition Chamber.h:29
const SpectrometerSector * m_parent
Definition Chamber.h:104
std::string identString() const
Define a string of the chamber used for debugging.
Definition Chamber.cxx:55
const Acts::PlaneSurface & surface() const
Returns the surface associated with the chamber.
Definition Chamber.cxx:101
void addPlacement(std::unique_ptr< ActsTrk::VolumePlacement > &&placement) const
Adds a volume placement to the Chamber's memory management.
Definition Chamber.cxx:86
const Amg::Transform3D & globalToLocalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation.
Definition Chamber.cxx:107
int stationEta() const
Returns the station eta of the chamber.
Definition Chamber.cxx:93
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the transformation chamber frame -> global transformation.
Definition Chamber.cxx:104
const ReadoutSet & readoutEles() const
Returns the list of contained readout elements.
Definition Chamber.cxx:98
double halfXLong() const
Long-extend of the chamber in the x-direction at positive Y.
Definition Chamber.cxx:77
bool operator<(const Chamber &other) const
Comparison operator for set ordering.
Definition Chamber.cxx:38
Chamber(defineArgs &&args)
Standard constructor taking the defineArgs.
Definition Chamber.cxx:30
void setParent(const SpectrometerSector *parent)
Sets the connection to the MS sector enclosing the chamber.
Definition Chamber.cxx:111
const SpectrometerSector * parent() const
Returns the pointer to the MS sector enclosing the chamber.
Definition Chamber.cxx:110
double halfY() const
Extend of the chamber in the y-direction.
Definition Chamber.cxx:79
ActsTrk::DetectorType detectorType() const
Returns the first readout elements detectorType (sorted by techIdx).
Definition Chamber.cxx:74
int sector() const
Returns the MS sector of the chamber.
Definition Chamber.cxx:96
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Definition Chamber.cxx:70
int stationPhi() const
Returns the station phi of the chamber.
Definition Chamber.cxx:92
int stationName() const
Returns an integer representing the stationName.
Definition Chamber.cxx:94
std::shared_ptr< Acts::Volume > boundingVolume(const ActsTrk::GeometryContext &gctx) const
Returns the Acts::Volume representation of the chamber.
Definition Chamber.cxx:82
const defineArgs & parameters() const
Returns the reference to the defining parameters of the chamber.
Definition Chamber.cxx:97
std::vector< const MuonReadoutElement * > ReadoutSet
Define the list of read out elements of the chamber.
Definition Chamber.h:32
bool barrel() const
Returns whether the chamber is placed in the barrel.
Definition Chamber.cxx:64
defineArgs m_args
Definition Chamber.h:103
double halfXShort() const
Short extend of the chamber in the x-direction at negative Y.
Definition Chamber.cxx:78
int8_t side() const
Returns the side of the chamber.
Definition Chamber.cxx:95
double halfZ() const
Thickness of the chamber in the z-direction.
Definition Chamber.cxx:80
std::shared_ptr< Acts::VolumeBounds > bounds() const
Returns the volume bounds.
Definition Chamber.cxx:91
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the idHelperSvc.
Definition Chamber.cxx:67
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
virtual int sector(const Identifier &id) const =0
return sector number 1-16, odd=large, even=small
virtual bool isEndcap(const Identifier &id) const =0
returns whether this is an endcap Identifier or not
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
@ Mm
Maybe not needed in the migration.
@ sTgc
Micromegas (NSW).
Eigen::Affine3d Transform3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid).
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition Chamber.cxx:18
double halfZ(const Acts::VolumeBounds &bounds)
Returns the half-Z length for the parsed volume bounds (Trapezoid/ Cuboid).
double halfXhighY(const Acts::VolumeBounds &bounds)
Returns the half-Y length @ posiive Y for the parsed volume bounds (Trapezoid/ Cuboid).
double halfXlowY(const Acts::VolumeBounds &bounds)
Returns the half-X length @ negative Y for the parsed volume bounds (Trapezoid/ Cuboid).
ChIndex
enum to classify the different chamber layers in the muon spectrometer
STL namespace.