CMS 3D CMS Logo

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>
10 
13 #include <limits>
14 
15 namespace edm {
16  class Event;
17  class EventSetup;
18  class ConsumesCollector;
19 } // namespace edm
20 
21 namespace ctfseeding {
22 
23  class HitExtractor {
24  public:
26  using TkHitRef = BaseTrackerRecHit const&;
28  using Hits = std::vector<HitPointer>;
29 
30  virtual ~HitExtractor() {}
32 
33  virtual Hits hits(const TkTransientTrackingRecHitBuilder& ttrhBuilder,
34  const edm::Event&,
35  const edm::EventSetup&) const = 0;
36  virtual HitExtractor* clone() const = 0;
37 
38  //skip clusters
40  skipClusters = true;
41  maskCluster = true;
42  useSkipClusters_(m, iC);
43  }
44  bool skipClusters = false;
45  bool filterCluster = false;
46  bool maskCluster = false;
47  float minGoodCharge = 0;
48 
49  protected:
50  virtual void useSkipClusters_(const edm::InputTag& m, edm::ConsumesCollector& iC) = 0;
51  };
52 
53  template <typename DSTV, typename A, typename B>
54  inline void range2SeedingHits(DSTV const& dstv, HitExtractor::Hits& v, std::pair<A, B> const& sel) {
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  for (auto const& h : (*id))
62  v.emplace_back(h);
63  }
64  }
65 } // namespace ctfseeding
66 #endif
void range2SeedingHits(DSTV const &dstv, HitExtractor::Hits &v, std::pair< A, B > const &sel)
Definition: HitExtractor.h:54
std::vector< HitPointer > Hits
Definition: HitExtractor.h:28
PixelRecoRange< float > Range
BaseTrackerRecHit const & TkHitRef
Definition: HitExtractor.h:26
virtual HitExtractor * clone() const =0
HLT enums.
virtual Hits hits(const TkTransientTrackingRecHitBuilder &ttrhBuilder, const edm::Event &, const edm::EventSetup &) const =0
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void useSkipClusters(const edm::InputTag &m, edm::ConsumesCollector &iC)
Definition: HitExtractor.h:39
virtual void useSkipClusters_(const edm::InputTag &m, edm::ConsumesCollector &iC)=0