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}",
62 idHelperSvc()->stationNameString(readoutEles().front()->identify()),
64 }
65 bool Chamber::barrel() const {
66 return !idHelperSvc()->isEndcap(readoutEles().front()->identify());
67 }
69 return readoutEles().front()->idHelperSvc();
70 }
72 return readoutEles().front()->chamberIndex();
73 }
74
76 return m_args.placement->detectorType();
77 }
78 double Chamber::halfXLong() const { return MuonGMR4::halfXhighY(*m_args.bounds); }
79 double Chamber::halfXShort() const { return MuonGMR4::halfXlowY(*m_args.bounds); }
80 double Chamber::halfY() const { return MuonGMR4::halfY(* m_args.bounds); }
81 double Chamber::halfZ() const { return MuonGMR4::halfZ(*m_args.bounds);}
82
83 std::shared_ptr<Acts::Volume> Chamber::boundingVolume(const ActsTrk::GeometryContext& /*gctx*/) const {
84 Acts::VolumePlacementBase* ATLAS_THREAD_SAFE placement = m_args.placement.get();
85 return std::make_shared<Acts::Volume>(*placement, bounds());
86 }
87 void Chamber::addPlacement(std::unique_ptr<ActsTrk::VolumePlacement>&& child) const {
88 ActsTrk::VolumePlacement* ATLAS_THREAD_SAFE placement = m_args.placement.get();
89 std::unique_lock guard{placementMutex};
90 placement->addChild(std::move(child));
91 }
92 std::shared_ptr<Acts::VolumeBounds> Chamber::bounds() const { return m_args.bounds; }
93 int Chamber::stationPhi() const{ return readoutEles().front()->stationPhi(); }
94 int Chamber::stationEta() const{ return readoutEles().front()->stationEta(); }
95 int Chamber::stationName() const{ return readoutEles().front()->stationName(); }
96 int8_t Chamber::side() const{ return Acts::copySign(1, readoutEles().front()->stationEta()); }
97 int Chamber::sector() const{ return idHelperSvc()->sector(readoutEles().front()->identify()); }
100 return m_args.detEles;
101 }
102 const Acts::PlaneSurface& Chamber::surface() const {
103 return *m_args.surface;
104 }
106 return m_args.placement->localToGlobalTransform(gctx.context());
107 }
109 return m_args.placement->globalToLocalTransform(gctx.context());
110 }
111 const SpectrometerSector* Chamber::parent() const { return m_parent; }
113}
114#endif
#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:102
void addPlacement(std::unique_ptr< ActsTrk::VolumePlacement > &&placement) const
Adds a volume placement to the Chamber's memory management.
Definition Chamber.cxx:87
const Amg::Transform3D & globalToLocalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation.
Definition Chamber.cxx:108
int stationEta() const
Returns the station eta of the chamber.
Definition Chamber.cxx:94
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the transformation chamber frame -> global transformation.
Definition Chamber.cxx:105
const ReadoutSet & readoutEles() const
Returns the list of contained readout elements.
Definition Chamber.cxx:99
double halfXLong() const
Long-extend of the chamber in the x-direction at positive Y.
Definition Chamber.cxx:78
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:112
const SpectrometerSector * parent() const
Returns the pointer to the MS sector enclosing the chamber.
Definition Chamber.cxx:111
double halfY() const
Extend of the chamber in the y-direction.
Definition Chamber.cxx:80
ActsTrk::DetectorType detectorType() const
Returns the first readout elements detectorType (sorted by techIdx)
Definition Chamber.cxx:75
int sector() const
Returns the MS sector of the chamber.
Definition Chamber.cxx:97
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Definition Chamber.cxx:71
int stationPhi() const
Returns the station phi of the chamber.
Definition Chamber.cxx:93
int stationName() const
Returns an integer representing the stationName.
Definition Chamber.cxx:95
std::shared_ptr< Acts::Volume > boundingVolume(const ActsTrk::GeometryContext &gctx) const
Returns the Acts::Volume representation of the chamber.
Definition Chamber.cxx:83
const defineArgs & parameters() const
Returns the reference to the defining parameters of the chamber.
Definition Chamber.cxx:98
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:65
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:79
int8_t side() const
Returns the side of the chamber.
Definition Chamber.cxx:96
double halfZ() const
Thickness of the chamber in the z-direction.
Definition Chamber.cxx:81
std::shared_ptr< Acts::VolumeBounds > bounds() const
Returns the volume bounds.
Definition Chamber.cxx:92
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the idHelperSvc.
Definition Chamber.cxx:68
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
std::string to_string(const DetectorType &type)
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.