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