ATLAS Offline Software
MDT_SortedHitVector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MDT_DIGITIZATION_MDT_SORTEDHITVECTOR_H
6 #define MDT_DIGITIZATION_MDT_SORTEDHITVECTOR_H
8 class mdt_hit_info {
9 public:
10  mdt_hit_info(Identifier i, double t, double a, double r, const TimedHitPtr<MDTSimHit>* aHit) :
11  id(i), time(t), adc(a), radius(r), simhit(aHit) {}
12  mdt_hit_info(Identifier i, double t, double a) : id(i), time(t), adc(a) {}
13  mdt_hit_info() : time(0.), adc(0.) {}
15  double time;
16  double adc;
17  double radius;
19  bool operator<(const mdt_hit_info& aInfo) const {
20  if (id < aInfo.id)
21  return true;
22  else if (id == aInfo.id)
23  return time < aInfo.time;
24  return false;
25  }
26 };
27 
28 // instead of using a map we use a sorted vector to temporary store the hits.
29 
30 typedef std::vector<mdt_hit_info> HitVector;
32 
34 public:
36  void insert(const mdt_hit_info& hit);
37  void sort();
38  bool isSorted() { return m_isSorted; }
39 
40 private:
41  bool m_isSorted;
42 };
44  std::stable_sort(HitVector::begin(), HitVector::end());
45  m_isSorted = true;
46 }
47 inline void MDT_SortedHitVector::insert(const mdt_hit_info& hit) {
48  push_back(hit);
49  m_isSorted = false;
50 }
51 
52 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
beamspotman.r
def r
Definition: beamspotman.py:676
MDT_SortedHitVector::isSorted
bool isSorted()
Definition: MDT_SortedHitVector.h:38
mdt_hit_info::simhit
const TimedHitPtr< MDTSimHit > * simhit
Definition: MDT_SortedHitVector.h:18
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
MDT_SortedHitVector::sort
void sort()
Definition: MDT_SortedHitVector.h:43
HitVector
std::vector< mdt_hit_info > HitVector
Definition: MDT_SortedHitVector.h:30
mdt_hit_info::mdt_hit_info
mdt_hit_info(Identifier i, double t, double a, double r, const TimedHitPtr< MDTSimHit > *aHit)
Definition: MDT_SortedHitVector.h:10
TimedHitPtr< MDTSimHit >
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
MDT_SortedHitVector::MDT_SortedHitVector
MDT_SortedHitVector()
Definition: MDT_SortedHitVector.h:35
mdt_hit_info::mdt_hit_info
mdt_hit_info(Identifier i, double t, double a)
Definition: MDT_SortedHitVector.h:12
mdt_hit_info::operator<
bool operator<(const mdt_hit_info &aInfo) const
Definition: MDT_SortedHitVector.h:19
MDTSimHit.h
MDT_SortedHitVector
Definition: MDT_SortedHitVector.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
mdt_hit_info::time
double time
Definition: MDT_SortedHitVector.h:15
MDT_SortedHitVector::m_isSorted
bool m_isSorted
Definition: MDT_SortedHitVector.h:41
mdt_hit_info
Definition: MDT_SortedHitVector.h:8
mdt_hit_info::mdt_hit_info
mdt_hit_info()
Definition: MDT_SortedHitVector.h:13
HitIt
HitVector::iterator HitIt
Definition: MDT_SortedHitVector.h:31
mdt_hit_info::id
Identifier id
Definition: MDT_SortedHitVector.h:14
a
TList * a
Definition: liststreamerinfos.cxx:10
mdt_hit_info::adc
double adc
Definition: MDT_SortedHitVector.h:16
MDT_SortedHitVector::insert
void insert(const mdt_hit_info &hit)
Definition: MDT_SortedHitVector.h:47
mdt_hit_info::radius
double radius
Definition: MDT_SortedHitVector.h:17