CMS 3D CMS Logo

TempMeasurements.h
Go to the documentation of this file.
1 #ifndef Tracking_TempMeasurements_H
2 #define Tracking_TempMeasurements_H
4 
5 #include <vector>
6 #include <algorithm>
7 
8 namespace tracking {
9  // the return type from a MeasurementDet
13  typedef std::vector<float> Distances;
14 
15  void clear() {
16  hits.clear();
17  distances.clear();
18  }
19  bool empty() const { return hits.empty(); }
20  std::size_t size() const { return hits.size(); }
21 
22  inline void sortIndex(int* index) const {
23  float const* d = &distances.front(); // do not trust capture
24  for (std::size_t i = 0; i != size(); ++i) {
25  index[i] = i;
26  std::push_heap(index, index + i + 1, [d](int j, int k) { return d[j] < d[k]; });
27  }
28  std::make_heap(index, index + size(), [d](int j, int k) { return d[j] < d[k]; });
29  }
30 
31  void add(ConstRecHitPointer const& h, float d) {
32  hits.push_back(h);
33  distances.push_back(d);
34  }
35  void add(ConstRecHitPointer&& h, float d) {
36  hits.push_back(std::move(h));
37  distances.push_back(d);
38  }
39 
42  };
43 } // namespace tracking
44 
45 #endif // Tracking_TempMeas_H
mps_fire.i
i
Definition: mps_fire.py:428
tracking::TempMeasurements::size
std::size_t size() const
Definition: TempMeasurements.h:20
tracking::TempMeasurements::empty
bool empty() const
Definition: TempMeasurements.h:19
tracking
Definition: TempMeasurements.h:8
TransientTrackingRecHit.h
tracking::TempMeasurements::ConstRecHitPointer
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: TempMeasurements.h:12
tracking::TempMeasurements
Definition: TempMeasurements.h:10
tracking::TempMeasurements::clear
void clear()
Definition: TempMeasurements.h:15
tracking::TempMeasurements::Distances
std::vector< float > Distances
Definition: TempMeasurements.h:13
h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
tracking::TempMeasurements::sortIndex
void sortIndex(int *index) const
Definition: TempMeasurements.h:22
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
TrackingRecHit::ConstRecHitPointer
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
Definition: TrackingRecHit.h:25
tracking::TempMeasurements::RecHitContainer
TrackingRecHit::ConstRecHitContainer RecHitContainer
Definition: TempMeasurements.h:11
tracking::TempMeasurements::add
void add(ConstRecHitPointer const &h, float d)
Definition: TempMeasurements.h:31
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ztail.d
d
Definition: ztail.py:151
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
tracking::TempMeasurements::distances
Distances distances
Definition: TempMeasurements.h:41
tracking::TempMeasurements::add
void add(ConstRecHitPointer &&h, float d)
Definition: TempMeasurements.h:35
tracking::TempMeasurements::hits
RecHitContainer hits
Definition: TempMeasurements.h:40