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 
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()),
59  stationEta(), stationPhi());
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  }
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 readoutEles().front()->stationEta() > 0 ? 1 : -1; }
87  int Chamber::sector() const{ return idHelperSvc()->sector(readoutEles().front()->identify()); }
88  const Chamber::defineArgs& Chamber::parameters() const { return m_args; }
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
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:51
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:26
MuonGMR4::Chamber::parent
const SpectrometerSector * parent() const
Returns the pointer to the MS sector enclosing the chamber.
Definition: Chamber.cxx:101
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
MuonGMR4::Chamber::defineArgs::bounds
std::shared_ptr< Acts::VolumeBounds > bounds
Chamber volume bounds.
Definition: Chamber.h:33
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:76
MuonGMR4::halfXhighY
double halfXhighY(const Acts::VolumeBounds &bounds)
Returns the half-Y length @ posiive Y for the parsed volume bounds (Trapezoid/ Cuboid)
Definition: MuonDetectorDefs.cxx:28
MuonGMR4::Chamber::sector
int sector() const
Returns the MS sector of the chamber.
Definition: Chamber.cxx:87
MuonGMR4::Chamber::halfXShort
double halfXShort() const
Short extend of the chamber in the x-direction at negative Y.
Definition: Chamber.cxx:75
MuonGMR4::halfY
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid)
Definition: MuonDetectorDefs.cxx:44
MuonGMR4::Chamber::m_parent
const SpectrometerSector * m_parent
Definition: Chamber.h:94
MuonGMR4::halfZ
double halfZ(const Acts::VolumeBounds &bounds)
Returns the half-Z length for the parsed volume bounds (Trapezoid/ Cuboid)
Definition: MuonDetectorDefs.cxx:61
ActsTrk::DetectorType::sTgc
@ sTgc
Micromegas (NSW)
SpectrometerSector.h
MuonGMR4::Chamber::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the transformation chamber frame -> global transformation.
Definition: Chamber.cxx:95
MuonGMR4::halfXlowY
double halfXlowY(const Acts::VolumeBounds &bounds)
Returns the half-X length @ negative Y for the parsed volume bounds (Trapezoid/ Cuboid)
Definition: MuonDetectorDefs.cxx:12
MuonGMR4::Chamber::defineArgs
Definition: Chamber.h:27
MuonGMR4::Chamber::side
int8_t side() const
Returns the side of the chamber.
Definition: Chamber.cxx:86
MuonGMR4::Chamber::stationEta
int stationEta() const
Returns the station eta of the chamber.
Definition: Chamber.cxx:84
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
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
ActsTrk::DetectorType::Mm
@ Mm
Maybe not needed in the migration.
MuonGMR4::Chamber::chamberIndex
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Definition: Chamber.cxx:67
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:98
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:83
MuonGMR4::Chamber::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the idHelperSvc.
Definition: Chamber.cxx:64
MuonGMR4::Chamber::readoutEles
const ReadoutSet & readoutEles() const
Returns the list of contained readout elements.
Definition: Chamber.cxx:89
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:79
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:34
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:92
MuonGMR4::Chamber::barrel
bool barrel() const
Returns whether the chamber is placed in the barrel.
Definition: Chamber.cxx:61
MuonGMR4::Chamber::bounds
std::shared_ptr< Acts::VolumeBounds > bounds() const
Returns the volume bounds.
Definition: Chamber.cxx:82
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:74
MuonGMR4::Chamber::detectorType
ActsTrk::DetectorType detectorType() const
Returns the first readout elements detectorType (sorted by techIdx)
Definition: Chamber.cxx:71
MuonGMR4::Chamber::parameters
const defineArgs & parameters() const
Returns the reference to the defining parameters of the chamber.
Definition: Chamber.cxx:88
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
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:85
MuonGMR4::Chamber::setParent
void setParent(const SpectrometerSector *parent)
Sets the connection to the MS sector enclosing the chamber.
Definition: Chamber.cxx:102
MuonGMR4::Chamber::halfZ
double halfZ() const
Thickness of the chamber in the z-direction.
Definition: Chamber.cxx:77
MuonGMR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
Definition: Chamber.cxx:14
ActsTrk::GeometryContext::context
Acts::GeometryContext context() const
Definition: GeometryContext.h:46