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>
12 
13 namespace edm { class Event; class EventSetup; class ConsumesCollector;}
14 namespace ctfseeding { class SeedingLayer; }
15 
16 namespace ctfseeding {
17 
18 class HitExtractor {
19 public:
20  typedef std::vector<TransientTrackingRecHit::ConstRecHitPointer> Hits;
21  virtual ~HitExtractor(){}
23  skipClusters=false;}
24  virtual Hits hits(const TransientTrackingRecHitBuilder& ttrhBuilder, const edm::Event& , const edm::EventSetup& ) const =0;
25  virtual HitExtractor * clone() const = 0;
26 
27  //skip clusters
29  skipClusters=true;
30  useSkipClusters_(m, iC);
31  }
33 protected:
34  virtual void useSkipClusters_(const edm::InputTag & m, edm::ConsumesCollector& iC) = 0;
35 };
36 
37 class HitConv {
38 public:
39  HitConv(const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::EventSetup &es) : ttrhBuilder_(ttrhBuilder), es_(es) {}
40  template<typename H>
42  const TrackingRecHit* trh = &hit;
43  return ttrhBuilder_.build(trh); }
44 private:
47 
48 };
49 
50  template <typename DSTV, typename A, typename B>
51  inline void range2SeedingHits(DSTV const & dstv,
53  std::pair<A,B> const & sel,
54  const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::EventSetup &es) {
55  typename DSTV::Range range = dstv.equal_range(sel.first,sel.second);
56  size_t ts = v.size();
57  for(typename DSTV::const_iterator id=range.first; id!=range.second; id++)
58  ts += std::distance((*id).begin(), (*id).end());
59  v.reserve(ts);
60  for(typename DSTV::const_iterator id=range.first; id!=range.second; id++){
61  std::transform((*id).begin(), (*id).end(), std::back_inserter(v), HitConv(ttrhBuilder, es));
62  }
63  }
64 
65 }
66 
67 #endif
const TransientTrackingRecHitBuilder & ttrhBuilder_
Definition: HitExtractor.h:45
virtual Hits hits(const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::Event &, const edm::EventSetup &) const =0
virtual HitExtractor * clone() const =0
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PixelRecoRange< float > Range
void range2SeedingHits(DSTV const &dstv, HitExtractor::Hits &v, std::pair< A, B > const &sel, const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::EventSetup &es)
Definition: HitExtractor.h:51
TransientTrackingRecHit::ConstRecHitPointer operator()(const H &hit)
Definition: HitExtractor.h:41
const edm::EventSetup & es_
Definition: HitExtractor.h:46
HitConv(const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::EventSetup &es)
Definition: HitExtractor.h:39
void useSkipClusters(const edm::InputTag &m, edm::ConsumesCollector &iC)
Definition: HitExtractor.h:28
virtual void useSkipClusters_(const edm::InputTag &m, edm::ConsumesCollector &iC)=0
std::vector< TransientTrackingRecHit::ConstRecHitPointer > Hits
Definition: HitExtractor.h:20