ATLAS Offline Software
MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONSPACEPOINT_MUONSPACEPOINTCONTAINER_H
5 #define MUONSPACEPOINT_MUONSPACEPOINTCONTAINER_H
6 
9 #include "GaudiKernel/SystemOfUnits.h"
11 #include <vector>
12 namespace MuonR4{
21  public std::vector<std::shared_ptr<SpacePoint>> {
22  public:
25  using std::vector<std::shared_ptr<SpacePoint>>::vector;
27  void setCoveredRange(double min, double max){
28  m_min = min;
29  m_max = max;
30  }
32  double coveredMin() const { return m_min; }
34  double coveredMax() const { return m_max; }
37  return empty() ? nullptr : front()->msSector();
38  }
42  void setBucketId(unsigned int id) {
43  m_bucketId = id;
44  }
46  unsigned int bucketId() const { return m_bucketId; }
47  bool operator<(const SpacePointBucket& other) const {
49  static const ChamberSorter sorter{};
50  int chambCompare = -sorter(msSector(), other.msSector()) +
51  sorter(other.msSector(), msSector());
52  if (chambCompare) return chambCompare < 0;
53  return bucketId() < other.bucketId();
54  }
58  if (!msSector()){
59  std::cerr << "SpacePointContainer::populateChamberLocations can only be called once we have a valid hit"<<std::endl;
60  return;
61  }
62  chamberLocation closestRight{1e8,1e8,1e8,1e8};
63  // loop over all chambers in the sector
64  for (auto & chamber : msSector()->chamberLocations()){
65  // truncate to the bucket volume
66  double left = std::max(m_min, chamber.yLeft);
67  double right = std::min(m_max, chamber.yRight);
68  // only keep one chamber outside the bucket - the right-hand side
69  // neighbour (for shallow tracks)
70  if (left > right){
71  if (chamber.yLeft - m_max < closestRight.yLeft - m_max){
72  closestRight = chamber;
73  }
74  }
75  // keep all chambers inside the bucket
76  else{
77  m_chamberLocs.push_back(chamber);
78  }
79  }
80  // add the closest right hand side chamber, if there is one
81  if (closestRight.yLeft < 1e8) m_chamberLocs.push_back(closestRight);
82  }
84  const std::vector<chamberLocation> & chamberLocations() const{
85  return m_chamberLocs;
86  }
87  private:
88  unsigned int m_bucketId{0};
89  double m_min{-20. *Gaudi::Units::m};
90  double m_max{20. * Gaudi::Units::m};
91  std::vector<chamberLocation> m_chamberLocs;
92  };
93 
95 }
96 #include "AthenaKernel/CLASS_DEF.h"
98 
99 #endif
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MuonGMR4::SpectrometerSector
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Definition: SpectrometerSector.h:40
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::SpacePointBucket::msSector
const MuonGMR4::SpectrometerSector * msSector() const
returns th associated muonChamber
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:36
MuonR4::SpacePointBucket::coveredMin
double coveredMin() const
lower interval value covered by the bucket
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:32
calibdata.chamber
chamber
Definition: calibdata.py:32
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
MuonR4::SpacePointBucket::bucketId
unsigned int bucketId() const
Returns the Identifier in the context of the MuonChamber.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:46
MuonR4::SpacePointBucket::populateChamberLocations
void populateChamberLocations()
populate the chamber location list.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:57
MuonR4::SpacePointBucket::setCoveredRange
void setCoveredRange(double min, double max)
set the range in the precision plane covered by the bucket
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:27
SpacePoint.h
postInclude.sorter
sorter
Definition: postInclude.SortInput.py:23
MuonR4::SpacePointBucket::coveredMax
double coveredMax() const
upper interval value covered by the bucket
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:34
MuonR4::SpacePointBucket::setBucketId
void setBucketId(unsigned int id)
sets the Identifier of the MuonSpacePointBucket in context of the associated muonChamber
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:42
MuonR4::SpacePointBucket::m_bucketId
unsigned int m_bucketId
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:88
MuonR4::SpacePointBucket::m_max
double m_max
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:90
vector
Definition: MultiHisto.h:13
MuonDetectorManager.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
MuonGMR4::MuonDetectorManager::MSEnvelopeSorter
Helper struct to ensure that the spectrometer sectors & chambers are sorted.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:109
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
MuonR4::SpacePointBucket::operator<
bool operator<(const SpacePointBucket &other) const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:47
MuonR4::SpacePointBucket::chamberLocations
const std::vector< chamberLocation > & chamberLocations() const
returns the list of all tracking chambers in the bucket for fast navigation
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:84
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::SpacePointBucket::m_chamberLocs
std::vector< chamberLocation > m_chamberLocs
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:91
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MuonR4::SpacePointBucket::m_min
double m_min
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePointContainer.h:89
CLASS_DEF
CLASS_DEF(MuonR4::SpacePointContainer, 1138818003, 1)
MuonGMR4::SpectrometerSector::chamberLocation
: Helper struct for fast approximate navigation.
Definition: SpectrometerSector.h:48
CLASS_DEF.h
macros to associate a CLID to a type