ATLAS Offline Software
Loading...
Searching...
No Matches
Chamber.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
12namespace MuonGMR4{
13
14 std::ostream& operator<<(std::ostream& ostr,
15 const Chamber::defineArgs& args) {
16 ostr<<"halfX (S/L): "<<halfXlowY(*args.bounds)<<"/"<<halfXhighY(*args.bounds)<<" [mm], ";
17 ostr<<"halfY: "<<halfY(*args.bounds)<<" [mm], ";
18 ostr<<"halfZ: "<<halfZ(*args.bounds)<<" [mm], ";
19 return ostr;
20 }
21 std::ostream& operator<<(std::ostream& ostr, const Chamber& chamber) {
22 ostr<<chamber.identString()<<" "<<chamber.parameters();
23 return ostr;
24 }
25
27 m_args{std::move(args)} {}
28
29 //Comparison operator for the MuonChambers:
30 // Legacy & NSW: sorted by StationName
31 // NSW (MM) & NSW (STG) : sorted by Station Name
32 // NSW (MM/STGC) & NSW(MM/STGC) : if they have same eta and phi -> sorted by multilayer (case for large sectors)
33 // small NSW chambers are sorted by phi - all elements in a sector are grouped in the same chamber
34 bool Chamber::operator<(const Chamber& other) const {
35 if(detectorType() != other.detectorType()) {
36 return detectorType() < other.detectorType();
37 }
38 if (stationName() != other.stationName()) {
39 return stationName() < other.stationName();
40 }
41 if (stationPhi() != other.stationPhi()) {
42 return stationPhi() < other.stationPhi();
43 }
44 if (stationEta() != other.stationEta()) {
45 return stationEta() < other.stationEta();
46 }
47 return readoutEles().front()->identify() <
48 other.readoutEles().front()->identify();
49 }
50
51 std::string Chamber::identString() const {
53 return std::format("MS chamber {:}",
54 idHelperSvc()->toStringDetEl(readoutEles().front()->identify()));
55 }
56 return std::format("MS chamber {:} station {:} eta {:02} phi {:02}",
58 idHelperSvc()->stationNameString(readoutEles().front()->identify()),
60 }
61 bool Chamber::barrel() const {
62 return !idHelperSvc()->isEndcap(readoutEles().front()->identify());
63 }
65 return readoutEles().front()->idHelperSvc();
66 }
68 return readoutEles().front()->chamberIndex();
69 }
70
72 return readoutEles().front()->detectorType();
73 }
74 double Chamber::halfXLong() const { return MuonGMR4::halfXhighY(*m_args.bounds); }
75 double Chamber::halfXShort() const { return MuonGMR4::halfXlowY(*m_args.bounds); }
76 double Chamber::halfY() const { return MuonGMR4::halfY(* m_args.bounds); }
77 double Chamber::halfZ() const { return MuonGMR4::halfZ(*m_args.bounds);}
78
79 std::shared_ptr<Acts::Volume> Chamber::boundingVolume(const ActsTrk::GeometryContext& gctx) const {
80 return std::make_shared<Acts::Volume>(localToGlobalTrans(gctx), bounds());
81 }
82 std::shared_ptr<Acts::VolumeBounds> Chamber::bounds() const { return m_args.bounds; }
83 int Chamber::stationPhi() const{ return readoutEles().front()->stationPhi(); }
84 int Chamber::stationEta() const{ return readoutEles().front()->stationEta(); }
85 int Chamber::stationName() const{ return readoutEles().front()->stationName(); }
86 int8_t Chamber::side() const{ return Acts::copySign(1, readoutEles().front()->stationEta()); }
87 int Chamber::sector() const{ return idHelperSvc()->sector(readoutEles().front()->identify()); }
90 return m_args.detEles;
91 }
92 const Acts::PlaneSurface& Chamber::surface() const {
93 return *m_args.surface;
94 }
96 return surface().transform(gctx.context());
97 }
99 return localToGlobalTrans(gctx).inverse();
100 }
101 const SpectrometerSector* Chamber::parent() const { return m_parent; }
103}
104#endif
Acts::GeometryContext context() const
const SpectrometerSector * m_parent
Definition Chamber.h:94
std::string identString() const
Define a string of the chamber used for debugging.
Definition Chamber.cxx:51
const Acts::PlaneSurface & surface() const
Returns the surface associated with the chamber.
Definition Chamber.cxx:92
int stationEta() const
Returns the station eta of the chamber.
Definition Chamber.cxx:84
const ReadoutSet & readoutEles() const
Returns the list of contained readout elements.
Definition Chamber.cxx:89
double halfXLong() const
Long-extend of the chamber in the x-direction at positive Y.
Definition Chamber.cxx:74
bool operator<(const Chamber &other) const
Comparison operator for set ordering.
Definition Chamber.cxx:34
Chamber(defineArgs &&args)
Standard constructor taking the defineArgs.
Definition Chamber.cxx:26
void setParent(const SpectrometerSector *parent)
Sets the connection to the MS sector enclosing the chamber.
Definition Chamber.cxx:102
const SpectrometerSector * parent() const
Returns the pointer to the MS sector enclosing the chamber.
Definition Chamber.cxx:101
double halfY() const
Extend of the chamber in the y-direction.
Definition Chamber.cxx:76
ActsTrk::DetectorType detectorType() const
Returns the first readout elements detectorType (sorted by techIdx)
Definition Chamber.cxx:71
int sector() const
Returns the MS sector of the chamber.
Definition Chamber.cxx:87
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Definition Chamber.cxx:67
int stationPhi() const
Returns the station phi of the chamber.
Definition Chamber.cxx:83
int stationName() const
Returns an integer representing the stationName.
Definition Chamber.cxx:85
std::shared_ptr< Acts::Volume > boundingVolume(const ActsTrk::GeometryContext &gctx) const
Returns the Acts::Volume representation of the chamber.
Definition Chamber.cxx:79
const defineArgs & parameters() const
Returns the reference to the defining parameters of the chamber.
Definition Chamber.cxx:88
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the transformation chamber frame -> global transformation.
Definition Chamber.cxx:95
std::vector< const MuonReadoutElement * > ReadoutSet
Define the list of read out elements of the chamber.
Definition Chamber.h:26
bool barrel() const
Returns whether the chamber is placed in the barrel.
Definition Chamber.cxx:61
defineArgs m_args
Definition Chamber.h:93
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation.
Definition Chamber.cxx:98
double halfXShort() const
Short extend of the chamber in the x-direction at negative Y.
Definition Chamber.cxx:75
int8_t side() const
Returns the side of the chamber.
Definition Chamber.cxx:86
double halfZ() const
Thickness of the chamber in the z-direction.
Definition Chamber.cxx:77
std::shared_ptr< Acts::VolumeBounds > bounds() const
Returns the volume bounds.
Definition Chamber.cxx:82
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the idHelperSvc.
Definition Chamber.cxx:64
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:14
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.