ATLAS Offline Software
Loading...
Searching...
No Matches
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
11namespace MuonR4 {
12
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.localPosition().y() - sp2.localPosition().y();
48 if ( std::abs(dy) > 20 * Gaudi::Units::micrometer ){
49 return dy < 0;
50 }
51 return sp1.localPosition().x() < sp2.localPosition().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}
static Double_t sp
bool operator()(const std::shared_ptr< SpacePoint > &sp1, const std::shared_ptr< SpacePoint > &sp2) const
unsigned int sectorLayerNum(const SpacePoint &sp) const
method returning the logic layer number
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
This header ties the generic definitions in this package.
MdtDriftCircle_v1 MdtDriftCircle
TgcStrip_v1 TgcStrip
Definition TgcStripFwd.h:9
RpcMeasurement_v1 RpcMeasurement
MMCluster_v1 MMCluster
sTgcMeasurement_v1 sTgcMeasurement
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10