00001 #ifndef Tracking_TempMeasurements_H 00002 #define Tracking_TempMeasurements_H 00003 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 00004 #include "FWCore/Utilities/interface/GCC11Compatibility.h" 00005 00006 #include<vector> 00007 #include<algorithm> 00008 00009 namespace tracking { 00010 // the return type from a MeasurementDet 00011 struct TempMeasurements { 00012 typedef TransientTrackingRecHit::ConstRecHitContainer RecHitContainer; 00013 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer; 00014 typedef std::vector<float> Distances; 00015 00016 void clear() { hits.clear(); distances.clear();} 00017 bool empty() const {return hits.empty();} 00018 std::size_t size() const { return hits.size();} 00019 00020 inline void sortIndex(int * index) const { 00021 float const * d = &distances.front(); // do not trust capture 00022 for (std::size_t i=0; i!=size(); ++i) { 00023 index[i]=i; 00024 std::push_heap(index,index+i+1,[d](int j,int k){return d[j]<d[k];}); 00025 } 00026 std::make_heap(index,index+size(),[d](int j,int k){return d[j]<d[k];}); 00027 } 00028 00029 void add(ConstRecHitPointer const & h, float d) { 00030 hits.push_back(h); distances.push_back(d); 00031 } 00032 void add(ConstRecHitPointer && h, float d) { 00033 hits.push_back(std::move(h)); distances.push_back(d); 00034 } 00035 00036 00037 RecHitContainer hits; 00038 Distances distances; 00039 00040 }; 00041 } 00042 00043 00044 #endif // Tracking_TempMeas_H 00045 00046 00047 00048