Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SpacePointPerLayerSorter.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
7 
8 namespace MuonR4 {
10  inline HitVec stripSmartPtr(const SpacePointBucket& bucket) {
11  HitVec hits{};
12  hits.reserve(bucket.size());
13  std::transform(bucket.begin(),bucket.end(),std::back_inserter(hits),
14  [](const SpacePointBucket::value_type& hit){return hit.get();});
15  return hits;
16  }
19 
21  if (hits.empty()) return;
22 
24  std::ranges::stable_sort(hits, [](const SpacePoint* a, const SpacePoint*b){
25  const double dZ = a->positionInChamber().z() - b->positionInChamber().z();
26  if (std::abs(dZ) > 50.*Gaudi::Units::micrometer) {
27  return dZ < 0.;
28  }
29  return a->positionInChamber().y() < b->positionInChamber().y();
30  });
31  const Muon::IMuonIdHelperSvc* idHelperSvc{hits.front()->msSector()->idHelperSvc()};
32  m_mdtLayers.reserve(8);
33 
37  using LayerCounting = std::unordered_map<Identifier, unsigned int>;
38  LayerCounting mdtLayerCounting{}, stripLayerCounting{};
39 
40  auto push_StripHit = [this, &stripLayerCounting](const Identifier& layId, const SpacePoint* hit) {
41  const unsigned int layer = stripLayerCounting.insert(std::make_pair(layId,stripLayerCounting.size())).first->second;
42 
43  if (layer >= m_stripLayers.size()) {
44  m_stripLayers.resize(layer + 1);
45  }
46  HitVec& pushTo{m_stripLayers[layer]};
47  if (pushTo.capacity() == pushTo.size()){
48  pushTo.reserve(pushTo.size() + 5);
49  }
50  pushTo.push_back(hit);
51  ++m_nStripHits;
52  };
53 
54  for (const SpacePoint* hit : hits) {
55  const Identifier& id {hit->identify()};
56  switch (hit->type()) {
58  const MdtIdHelper& idHelper{idHelperSvc->mdtIdHelper()};
59  const Identifier layId = idHelper.channelID(idHelper.stationName(id), 1, idHelper.stationPhi(id),
60  idHelper.multilayer(id), idHelper.tubeLayer(id), 1);
61 
62  const unsigned int layer = mdtLayerCounting.insert(std::make_pair(layId, mdtLayerCounting.size())).first->second;
63  if (layer >= m_mdtLayers.size()) {
64  m_mdtLayers.resize(layer + 1);
65  }
66  HitVec& pushTo{m_mdtLayers[layer]};
67  if (pushTo.capacity() == pushTo.size()){
68  pushTo.reserve(pushTo.size() + 5);
69  }
70  pushTo.push_back(hit);
71  ++m_nMdtHits;
72  if (!m_tubeLaySwitch && layer &&
73  m_mdtLayers[layer -1].front()->primaryMeasurement()->identifierHash() !=
74  hit->primaryMeasurement()->identifierHash()) {
76  }
77  break;
79  const RpcIdHelper& idHelper{idHelperSvc->rpcIdHelper()};
81  const Identifier layId = idHelper.panelID(idHelper.stationName(id), 1, idHelper.stationPhi(id),
82  idHelper.doubletR(id), 1, 1, idHelper.gasGap(id), false);
83  push_StripHit(layId, hit);
84  break;
86  const TgcIdHelper& idHelper{idHelperSvc->tgcIdHelper()};
87  const Identifier layId = idHelper.channelID(idHelper.stationName(id), 1, 1, idHelper.gasGap(id), false, 1);
88  push_StripHit(layId, hit);
89  break;
91  const sTgcIdHelper& idHelper{idHelperSvc->stgcIdHelper()};
92  const Identifier layId = idHelper.channelID(idHelper.stationName(id), 1, 1,
93  idHelper.multilayer(id), idHelper.gasGap(id),
94  sTgcIdHelper::sTgcChannelTypes::Strip, 1);
95  push_StripHit(layId, hit);
96  break;
98  const MmIdHelper& idHelper{idHelperSvc->mmIdHelper()};
99  const Identifier layId = idHelper.channelID(idHelper.stationName(id), 1, 1,
100  idHelper.multilayer(id), idHelper.gasGap(id), 500);
101  push_StripHit(layId, hit);
102  break;
103  } default: {
104  break;
105  }
106  }
107  }
108  }
109 }
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
MuonR4::SpacePointPerLayerSorter::m_nMdtHits
unsigned int m_nMdtHits
Number of all Mdt tube hits
Definition: SpacePointPerLayerSorter.h:48
MuonR4::SpacePointBucket
: The muon space point bucket represents a collection of points that will bre processed together in t...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:21
MuonR4::SpacePointPerLayerSorter
The SpacePointPerLayerSorter groups the space points by their layer Identifier.
Definition: SpacePointPerLayerSorter.h:14
TgcIdHelper
Definition: TgcIdHelper.h:50
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
MuonR4::HitVec
SpacePointPerLayerSorter::HitVec HitVec
Definition: SpacePointPerLayerSorter.cxx:9
MuonR4::stripSmartPtr
HitVec stripSmartPtr(const SpacePointBucket &bucket)
Definition: SpacePointPerLayerSorter.cxx:10
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
MuonR4::SpacePointPerLayerSorter::m_stripLayers
HitLayVec m_stripLayers
Sorted Strip hits per gasGap strip
Definition: SpacePointPerLayerSorter.h:46
RpcIdHelper
Definition: RpcIdHelper.h:51
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
MuonR4::SpacePointPerLayerSorter::SpacePointPerLayerSorter
SpacePointPerLayerSorter(const SpacePointBucket &bucket)
Constructor taking a complete bucket
Definition: SpacePointPerLayerSorter.cxx:17
z
#define z
MuonR4::SpacePointPerLayerSorter::HitVec
std::vector< const SpacePoint * > HitVec
Definition: SpacePointPerLayerSorter.h:16
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
MdtIdHelper
Definition: MdtIdHelper.h:61
MuonR4::SpacePointPerLayerSorter::m_nStripHits
unsigned int m_nStripHits
Number of all strip hits.
Definition: SpacePointPerLayerSorter.h:50
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
MuonR4::SpacePointPerLayerSorter::m_tubeLaySwitch
unsigned int m_tubeLaySwitch
Index of the first tube-layer from the second multilayer.
Definition: SpacePointPerLayerSorter.h:52
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:18
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
sTgcIdHelper
Definition: sTgcIdHelper.h:55
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::SpacePointPerLayerSorter::m_mdtLayers
HitLayVec m_mdtLayers
Sorted Mdt hits per tube layer.
Definition: SpacePointPerLayerSorter.h:44
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
MmIdHelper
Definition: MmIdHelper.h:54
DeMoScan.first
bool first
Definition: DeMoScan.py:536
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
SpacePointPerLayerSorter.h
IMuonIdHelperSvc.h
Identifier
Definition: IdentifierFieldParser.cxx:14