ATLAS Offline Software
SpacePointPerLayerSorter.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 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::sort(hits, [](const SpacePoint* a, const SpacePoint*b){
25  return a->positionInChamber().z() < b->positionInChamber().z();
26  });
27  const Muon::IMuonIdHelperSvc* idHelperSvc{hits.front()->msSector()->idHelperSvc()};
28  m_mdtLayers.reserve(8);
29 
33  using LayerCounting = std::unordered_map<Identifier, unsigned int>;
34  LayerCounting mdtLayerCounting{}, stripLayerCounting{};
35  for (const SpacePoint* hit : hits) {
36  const Identifier& id {hit->identify()};
37  if (hit->type() == xAOD::UncalibMeasType::MdtDriftCircleType) {
38  const MdtIdHelper& idHelper{idHelperSvc->mdtIdHelper()};
39  const Identifier layId = idHelper.channelID(idHelper.stationName(id), 1, idHelper.stationPhi(id),
40  idHelper.multilayer(id), idHelper.tubeLayer(id), 1);
41 
42  const unsigned int layer = mdtLayerCounting.insert(std::make_pair(layId, mdtLayerCounting.size())).first->second;
43  if (layer >= m_mdtLayers.size()) {
44  m_mdtLayers.resize(layer + 1);
45  }
46  HitVec& pushTo{m_mdtLayers[layer]};
47  if (pushTo.capacity() == pushTo.size()){
48  pushTo.reserve(pushTo.size() + 5);
49  }
50  pushTo.push_back(hit);
51  ++m_nMdtHits;
52  if (!m_tubeLaySwitch && layer &&
53  m_mdtLayers[layer -1].front()->primaryMeasurement()->identifierHash() != hit->primaryMeasurement()->identifierHash()) {
54 
55  }
56  } else {
57  const Identifier layId = idHelperSvc->gasGapId(id);
58  const unsigned int layer = stripLayerCounting.insert(std::make_pair(layId, stripLayerCounting.size())).first->second;
59 
60  if (layer >= m_stripLayers.size()) {
61  m_stripLayers.resize(layer + 1);
62  }
63  HitVec& pushTo{m_stripLayers[layer]};
64  if (pushTo.capacity() == pushTo.size()){
65  pushTo.reserve(pushTo.size() + 5);
66  }
67  pushTo.push_back(hit);
68  ++m_nStripHits;
69  }
70  }
71  }
72 }
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
MuonR4::HitVec
SpacePointPerLayerSorter::HitVec HitVec
Definition: SpacePointPerLayerSorter.cxx:9
MuonR4::stripSmartPtr
HitVec stripSmartPtr(const SpacePointBucket &bucket)
Definition: SpacePointPerLayerSorter.cxx:10
MuonR4::SpacePointPerLayerSorter::m_stripLayers
HitLayVec m_stripLayers
Sorted Strip hits per gasGap strip
Definition: SpacePointPerLayerSorter.h:46
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
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
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
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:26
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
SpacePointPerLayerSorter.h
IMuonIdHelperSvc.h
Identifier
Definition: IdentifierFieldParser.cxx:14