ATLAS Offline Software
SpacePointPerLayerSorter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
10 
11 namespace MuonR4 {
12 
13  unsigned int SpacePointPerLayerSorter::sectorLayerNum(const SpacePoint& sp) const {
14 
15  switch (sp.primaryMeasurement()->type()){
17  auto mdtMeas = static_cast<const xAOD::MdtDriftCircle*>(sp.primaryMeasurement());
18  return sp.msSector()->logicalLayerIdx(mdtMeas->readoutElement()).at(mdtMeas->tubeLayer()-1);
19  }
21  auto rpcMeas = static_cast<const xAOD::RpcMeasurement*>(sp.primaryMeasurement());
22  return sp.msSector()->logicalLayerIdx(rpcMeas->readoutElement()).at(rpcMeas->gasGap()-1);
23  }
25  auto tgcMeas = static_cast<const xAOD::TgcStrip*>(sp.primaryMeasurement());
26  return sp.msSector()->logicalLayerIdx(tgcMeas->readoutElement()).at(tgcMeas->gasGap()-1);
27  }
29  auto stgcMeas = static_cast<const xAOD::sTgcMeasurement*>(sp.primaryMeasurement());
30  return sp.msSector()->logicalLayerIdx(stgcMeas->readoutElement()).at(stgcMeas->gasGap()-1);
31  }
33  auto mmMeas = static_cast<const xAOD::MMCluster*>(sp.primaryMeasurement());
34  return sp.msSector()->logicalLayerIdx(mmMeas->readoutElement()).at(mmMeas->gasGap()-1);
35  }
36  default:
37  THROW_EXCEPTION("Unexpected Measurement Type in sectorLayerNum()");
38  }
39  }
40 
41  bool SpacePointPerLayerSorter::operator()(const SpacePoint& sp1, const SpacePoint& sp2) const {
42 
43  const unsigned int lay1 {sectorLayerNum(sp1)};
44  const unsigned int lay2 {sectorLayerNum(sp2)};
45 
46  if (lay1 == lay2) {
47  const double dy = sp1.positionInChamber().y() - sp2.positionInChamber().y();
48  if ( std::abs(dy) > 20 * Gaudi::Units::micrometer ){
49  return dy < 0;
50  }
51  return sp1.positionInChamber().x() < sp2.positionInChamber().x();
52  }
53  return lay1 < lay2;
54  }
55 
56  bool SpacePointPerLayerSorter::operator()(const std::shared_ptr<SpacePoint>& sp1, const std::shared_ptr<SpacePoint>& sp2) const {
57  return (*this)(*sp1, *sp2);
58  }
59 
60  bool SpacePointPerLayerSorter::operator()(const std::unique_ptr<SpacePoint>& sp1, const std::unique_ptr<SpacePoint>& sp2) const {
61  return (*this)(*sp1, *sp2);
62  }
63  bool SpacePointPerLayerSorter::operator()(const SpacePoint* sp1, const SpacePoint* sp2) const {
64  return (*this)(*sp1, *sp2);
65  }
66 
67 }
MuonR4::SpacePoint::msSector
const MuonGMR4::SpectrometerSector * msSector() const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:56
xAOD::RpcMeasurement_v1
RpcMeasurement_v1: Class storing the geneic.
Definition: RpcMeasurement_v1.h:21
xAOD::MMCluster_v1
Definition: MMCluster_v1.h:20
MuonR4::SpacePointPerLayerSorter::sectorLayerNum
unsigned int sectorLayerNum(const SpacePoint &sp) const
method returning the logic layer number
Definition: SpacePointPerLayerSorter.cxx:13
xAOD::TgcStrip_v1
Definition: TgcStrip_v1.h:19
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
MuonR4::SpacePoint::primaryMeasurement
const xAOD::UncalibratedMeasurement * primaryMeasurement() const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:47
MuonGMR4::SpectrometerSector::logicalLayerIdx
const std::vector< unsigned int > & logicalLayerIdx(const MuonReadoutElement *reEle) const
Returns the logic layer numbering of a given Readout Element.
Definition: SpectrometerSector.cxx:122
xAOD::UncalibratedMeasurement_v1::type
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
python.SystemOfUnits.micrometer
float micrometer
Definition: SystemOfUnits.py:80
MdtDriftCircle.h
MuonR4::SpacePoint
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePoint.h:19
TgcStrip.h
sTgcMeasurement.h
RpcMeasurement.h
MuonR4::SpacePointPerLayerSorter::operator()
bool operator()(const std::shared_ptr< SpacePoint > &sp1, const std::shared_ptr< SpacePoint > &sp2) const
Definition: SpacePointPerLayerSorter.cxx:56
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
MuonR4::SpacePoint::positionInChamber
const Amg::Vector3D & positionInChamber() const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:59
MMCluster.h
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
SpacePointPerLayerSorter.h
xAOD::sTgcMeasurement_v1
Definition: sTgcMeasurement_v1.h:21