CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HitExtractor.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkSeedingLayers_HitExtractor_H
2 #define RecoTracker_TkSeedingLayers_HitExtractor_H
3 
4 #include <vector>
5 #include <iterator>
8 
9 namespace edm { class Event; class EventSetup; }
10 namespace ctfseeding { class SeedingLayer; }
11 
12 namespace ctfseeding {
13 
14 class HitExtractor {
15 public:
16  typedef std::vector<TransientTrackingRecHit::ConstRecHitPointer> Hits;
17  virtual ~HitExtractor(){}
18  virtual Hits hits(const SeedingLayer & sl, const edm::Event& , const edm::EventSetup& ) const =0;
19 };
20 
21 class HitConv {
22 public:
23  HitConv(const SeedingLayer &sl, const edm::EventSetup &es) : sl_(sl), es_(es) {}
24  template<typename H>
26  const TrackingRecHit* trh = &hit;
27  return sl_.hitBuilder()->build(trh); }
28 private:
29  const SeedingLayer &sl_;
31 };
32 
33  template <typename DSTV, typename A, typename B>
34  inline void range2SeedingHits(DSTV const & dstv,
36  std::pair<A,B> const & sel,
37  const SeedingLayer &sl, const edm::EventSetup &es) {
38  typename DSTV::Range range = dstv.equal_range(sel.first,sel.second);
39  size_t ts = v.size();
40  for(typename DSTV::const_iterator id=range.first; id!=range.second; id++)
41  ts += std::distance((*id).begin(), (*id).end());
42  v.reserve(ts);
43  for(typename DSTV::const_iterator id=range.first; id!=range.second; id++){
44  std::transform((*id).begin(), (*id).end(), std::back_inserter(v), HitConv(sl,es));
45  }
46  }
47 
48 }
49 
50 #endif
virtual Hits hits(const SeedingLayer &sl, const edm::Event &, const edm::EventSetup &) const =0
void range2SeedingHits(DSTV const &dstv, HitExtractor::Hits &v, std::pair< A, B > const &sel, const SeedingLayer &sl, const edm::EventSetup &es)
Definition: HitExtractor.h:34
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
const SeedingLayer & sl_
Definition: HitExtractor.h:29
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: SeedingLayer.cc:85
PixelRecoRange< float > Range
HitConv(const SeedingLayer &sl, const edm::EventSetup &es)
Definition: HitExtractor.h:23
TransientTrackingRecHit::ConstRecHitPointer operator()(const H &hit)
Definition: HitExtractor.h:25
const edm::EventSetup & es_
Definition: HitExtractor.h:30
mathSSE::Vec4< T > v
std::vector< TransientTrackingRecHit::ConstRecHitPointer > Hits
Definition: HitExtractor.h:16