ATLAS Offline Software
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 
12 namespace MuonGMR4{
13  using BoundEnums = Acts::TrapezoidVolumeBounds::BoundValues;
14 
15  std::ostream& operator<<(std::ostream& ostr,
16  const Chamber::defineArgs& args) {
17  ostr<<"halfX (S/L): "<<args.bounds->get(BoundEnums::eHalfLengthXnegY)
18  <<"/"<<args.bounds->get(BoundEnums::eHalfLengthXposY)<<" [mm], ";
19  ostr<<"halfY: "<<args.bounds->get(BoundEnums::eHalfLengthY)<<" [mm], ";
20  ostr<<"halfZ: "<<args.bounds->get(BoundEnums::eHalfLengthZ)<<" [mm], ";
21  return ostr;
22  }
23  std::ostream& operator<<(std::ostream& ostr, const Chamber& chamber) {
24 
25  ostr<<chamber.identString()<<" "<<chamber.parameters();
26  return ostr;
27  }
28 
30  m_args{std::move(args)} {}
31 
32  //Comparison operator for the MuonChambers:
33  // Legacy & NSW: sorted by StationName
34  // NSW (MM) & NSW (STG) : sorted by Station Name
35  // NSW (MM/STGC) & NSW(MM/STGC) : if they have same eta and phi -> sorted by multilayer (case for large sectors)
36  // small NSW chambers are sorted by phi - all elements in a sector are grouped in the same chamber
37  bool Chamber::operator<(const Chamber& other) const {
38 
39 
40  if (stationName() != other.stationName()) {
41  return stationName() < other.stationName();
42  }
43 
44  if(stationPhi() != other.stationPhi()) {
45  return stationPhi() < other.stationPhi();
46  }
47 
48  if(stationEta() != other.stationEta()){
49  return stationEta() < other.stationEta();
50  }
51 
52  if(detectorType() != other.detectorType()){
53 
54  return detectorType() < other.detectorType();
55  }
56 
57  //for NSW order by multilayer for MMLS and STGCs for the large sectors
58  //MMLs and STLs will fall in this case
59  const Identifier& id = readoutEles().front()->identify();
60 
61  bool isNSW = (idHelperSvc()->isMM(id) || idHelperSvc()->issTgc(id));
62 
63  if(isNSW) {
64 
65  const Identifier& otherId = other.readoutEles().front()->identify();
66 
67  if (idHelperSvc()->isMM(id)) {
68  return idHelperSvc()->mmIdHelper().multilayer(id) < idHelperSvc()->mmIdHelper().multilayer(otherId);
69  } else {
70  //stgc case
71  return idHelperSvc()->stgcIdHelper().multilayer(id) < idHelperSvc()->stgcIdHelper().multilayer(otherId);
72  }
73 
74  }
75 
76  return false;
77 
78  }
79 
80  std::string Chamber::identString() const {
81  if(idHelperSvc()->isMM(readoutEles().front()->identify()) ||
82  idHelperSvc()->issTgc(readoutEles().front()->identify()) ) {
83  return std::format("MS chamber {:} station {:} eta {:02} phi {:02} ml {:02}",
85  idHelperSvc()->stationNameString(readoutEles().front()->identify()),
87  idHelperSvc()->isMM(readoutEles().front()->identify()) ?
88  idHelperSvc()->mmIdHelper().multilayer(readoutEles().front()->identify()) :
89  idHelperSvc()->stgcIdHelper().multilayer(readoutEles().front()->identify()));
90  }
91  return std::format("MS chamber {:} station {:} eta {:02} phi {:02}",
93  idHelperSvc()->stationNameString(readoutEles().front()->identify()),
94  stationEta(), stationPhi());
95  }
96  bool Chamber::barrel() const {
97  return !idHelperSvc()->isEndcap(readoutEles().front()->identify());
98  }
100  return readoutEles().front()->idHelperSvc();
101  }
103  return readoutEles().front()->chamberIndex();
104  }
105 
107  return readoutEles().front()->detectorType();
108  }
109  double Chamber::halfXLong() const { return m_args.bounds->get(BoundEnums::eHalfLengthXposY); }
110  double Chamber::halfXShort() const { return m_args.bounds->get(BoundEnums::eHalfLengthXnegY); }
111  double Chamber::halfY() const { return m_args.bounds->get(BoundEnums::eHalfLengthY); }
112  double Chamber::halfZ() const { return m_args.bounds->get(BoundEnums::eHalfLengthZ); }
113 
114  std::shared_ptr<Acts::Volume> Chamber::boundingVolume(const ActsTrk::GeometryContext& gctx) const {
115  return std::make_shared<Acts::Volume>(localToGlobalTrans(gctx), bounds());
116  }
117  std::shared_ptr<Acts::TrapezoidVolumeBounds> Chamber::bounds() const {
118  return m_args.bounds;
119  }
120  int Chamber::stationPhi() const{ return readoutEles().front()->stationPhi(); }
121  int Chamber::stationEta() const{ return readoutEles().front()->stationEta(); }
122  int Chamber::stationName() const{ return readoutEles().front()->stationName(); }
123  int8_t Chamber::side() const{ return readoutEles().front()->stationEta() > 0 ? 1 : -1; }
124  int Chamber::sector() const{ return idHelperSvc()->sector(readoutEles().front()->identify()); }
125  const Chamber::defineArgs& Chamber::parameters() const { return m_args; }
127  return m_args.detEles;
128  }
129  const Acts::PlaneSurface& Chamber::surface() const {
130  return *m_args.surface;
131  }
133  return surface().transform(gctx.context());
134  }
136  return localToGlobalTrans(gctx).inverse();
137  }
138  const SpectrometerSector* Chamber::parent() const { return m_parent; }
140 }
141 #endif
sTgcIdHelper::multilayer
int multilayer(const Identifier &id) const
Definition: sTgcIdHelper.cxx:1022
MuonGMR4::Chamber::defineArgs::surface
std::shared_ptr< const Acts::PlaneSurface > surface
Associated chamber surface.
Definition: Chamber.h:29
MuonGMR4::Chamber::identString
std::string identString() const
Define a string of the chamber used for debugging.
Definition: Chamber.cxx:80
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:95
MuonGMR4::Chamber::Chamber
Chamber(defineArgs &&args)
Standard constructor taking the defineArgs.
Definition: Chamber.cxx:29
MuonGMR4::Chamber::parent
const SpectrometerSector * parent() const
Returns the pointer to the MS sector enclosing the chamber.
Definition: Chamber.cxx:138
Muon::IMuonIdHelperSvc::stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const =0
access to TgcIdHelper
MuonGMR4::Chamber::defineArgs::detEles
ReadoutSet detEles
List of associated readout elements.
Definition: Chamber.h:31
MuonGMR4::SpectrometerSector
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Definition: SpectrometerSector.h:40
vtune_athena.format
format
Definition: vtune_athena.py:14
python.CaloAddPedShiftConfig.args
args
Definition: CaloAddPedShiftConfig.py:47
ActsTrk::DetectorType
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Definition: GeometryDefs.h:17
calibdata.chamber
chamber
Definition: calibdata.py:31
MuonGMR4::Chamber::halfY
double halfY() const
Extend of the chamber in the y-direction.
Definition: Chamber.cxx:111
MuonGMR4::Chamber::sector
int sector() const
Returns the MS sector of the chamber.
Definition: Chamber.cxx:124
MuonGMR4::Chamber::halfXShort
double halfXShort() const
Short extend of the chamber in the x-direction at negative Y.
Definition: Chamber.cxx:110
MuonGMR4::Chamber::m_parent
const SpectrometerSector * m_parent
Definition: Chamber.h:94
SpectrometerSector.h
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
MuonGMR4::BoundEnums
Acts::TrapezoidVolumeBounds::BoundValues BoundEnums
Definition: Chamber.cxx:13
MuonGMR4::Chamber::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the transformation chamber frame -> global transformation.
Definition: Chamber.cxx:132
MuonGMR4::Chamber::defineArgs
Definition: Chamber.h:27
MmIdHelper::multilayer
int multilayer(const Identifier &id) const
Definition: MmIdHelper.cxx:828
MuonGMR4::Chamber::side
int8_t side() const
Returns the side of the chamber.
Definition: Chamber.cxx:123
MuonGMR4::Chamber::stationEta
int stationEta() const
Returns the station eta of the chamber.
Definition: Chamber.cxx:121
MuonGMR4::Chamber
Definition: Chamber.h:23
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:19
MuonGMR4::Chamber::chamberIndex
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Definition: Chamber.cxx:102
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGMR4::Chamber::ReadoutSet
std::vector< const MuonReadoutElement * > ReadoutSet
Define the list of read out elements of the chamber.
Definition: Chamber.h:26
MuonGMR4::Chamber::globalToLocalTrans
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation.
Definition: Chamber.cxx:135
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::GeometryContext
Definition: GeometryContext.h:28
MuonGMR4::Chamber::stationPhi
int stationPhi() const
Returns the station phi of the chamber.
Definition: Chamber.cxx:120
MuonGMR4::Chamber::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the idHelperSvc.
Definition: Chamber.cxx:99
MuonGMR4::Chamber::readoutEles
const ReadoutSet & readoutEles() const
Returns the list of contained readout elements.
Definition: Chamber.cxx:126
Muon::IMuonIdHelperSvc::isMM
virtual bool isMM(const Identifier &id) const =0
returns whether this is a MM Identifier or not
MuonGMR4::Chamber::boundingVolume
std::shared_ptr< Acts::Volume > boundingVolume(const ActsTrk::GeometryContext &gctx) const
Returns the Acts::Volume representation of the chamber.
Definition: Chamber.cxx:114
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MuonGMR4::Chamber::operator<
bool operator<(const Chamber &other) const
Comparison operator for set ordering.
Definition: Chamber.cxx:37
Muon::IMuonIdHelperSvc::isEndcap
virtual bool isEndcap(const Identifier &id) const =0
returns whether this is an endcap Identifier or not
MuonGMR4::Chamber::m_args
defineArgs m_args
Definition: Chamber.h:93
Chamber.h
MuonGMR4::Chamber::surface
const Acts::PlaneSurface & surface() const
Returns the surface associated with the chamber.
Definition: Chamber.cxx:129
MuonGMR4::Chamber::barrel
bool barrel() const
Returns whether the chamber is placed in the barrel.
Definition: Chamber.cxx:96
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MuonGMR4::Chamber::halfXLong
double halfXLong() const
Long-extend of the chamber in the x-direction at positive Y.
Definition: Chamber.cxx:109
MuonGMR4::Chamber::bounds
std::shared_ptr< Acts::TrapezoidVolumeBounds > bounds() const
Returns the volume bounds.
Definition: Chamber.cxx:117
MuonGMR4::Chamber::detectorType
ActsTrk::DetectorType detectorType() const
Returns the first readout elements detectorType (sorted by techIdx)
Definition: Chamber.cxx:106
MuonGMR4::Chamber::parameters
const defineArgs & parameters() const
Returns the reference to the defining parameters of the chamber.
Definition: Chamber.cxx:125
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
MuonGMR4::Chamber::defineArgs::bounds
std::shared_ptr< Acts::TrapezoidVolumeBounds > bounds
Chamber volume bounds.
Definition: Chamber.h:33
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
Muon::IMuonIdHelperSvc::sector
virtual int sector(const Identifier &id) const =0
return sector number 1-16, odd=large, even=small
MuonGMR4::Chamber::stationName
int stationName() const
Returns an integer representing the stationName.
Definition: Chamber.cxx:122
MuonGMR4::Chamber::setParent
void setParent(const SpectrometerSector *parent)
Sets the connection to the MS sector enclosing the chamber.
Definition: Chamber.cxx:139
MuonGMR4::Chamber::halfZ
double halfZ() const
Thickness of the chamber in the z-direction.
Definition: Chamber.cxx:112
MuonGMR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition: Chamber.cxx:15
Muon::IMuonIdHelperSvc::issTgc
virtual bool issTgc(const Identifier &id) const =0
returns whether this is a sTGC Identifier or not
ActsTrk::GeometryContext::context
Acts::GeometryContext context() const
Definition: GeometryContext.h:46
Identifier
Definition: IdentifierFieldParser.cxx:14