CMS 3D CMS Logo

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