CMS 3D CMS Logo

SeedingHitSet.h
Go to the documentation of this file.
1 #ifndef TkSeedingLayers_SeedingHitSet_H
2 #define TkSeedingLayers_SeedingHitSet_H
3 
6 
7 #include <vector>
8 #include <algorithm>
9 
11 public:
15 
16  static ConstRecHitPointer nullPtr() { return nullptr; }
17 
18  SeedingHitSet() = default;
19 
21 
23  : SeedingHitSet({one, two, three}) {}
24 
26  : SeedingHitSet({one, two, three, four}) {}
27 
28  SeedingHitSet(const std::vector<ConstRecHitPointer> &hits) {
29  if (hits.size() >= 2) {
30  auto end = std::find(hits.begin(), hits.end(), nullPtr());
31  auto size = std::distance(hits.begin(), end);
32  if (size >= 2) {
33  theRecHits.reserve(size);
34  std::copy(hits.begin(), end, std::back_inserter(theRecHits));
35  }
36  }
37  }
38 
39  SeedingHitSet(const std::initializer_list<ConstRecHitPointer> &hits) {
40  if (hits.size() >= 2) {
41  auto end = std::find(hits.begin(), hits.end(), nullPtr());
42  auto size = std::distance(hits.begin(), end);
43  if (size >= 2) {
44  theRecHits.reserve(size);
45  std::copy(hits.begin(), end, std::back_inserter(theRecHits));
46  }
47  }
48  }
49 
50  ConstRecHitPointer const *data() const { return theRecHits.data(); }
51 
52  unsigned int size() const { return theRecHits.size(); }
53 
54  ConstRecHitPointer get(unsigned int i) const { return theRecHits[i]; }
55  ConstRecHitPointer operator[](unsigned int i) const { return theRecHits[i]; }
56 
57 protected:
58  std::vector<ConstRecHitPointer> theRecHits;
59 };
60 
61 #endif
SeedingHitSet()=default
ConstRecHitPointer operator[](unsigned int i) const
Definition: SeedingHitSet.h:55
SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two, ConstRecHitPointer three, ConstRecHitPointer four)
Definition: SeedingHitSet.h:25
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two, ConstRecHitPointer three)
Definition: SeedingHitSet.h:22
std::vector< ConstRecHitPointer > theRecHits
Definition: SeedingHitSet.h:58
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
static ConstRecHitPointer nullPtr()
Definition: SeedingHitSet.h:16
SeedingHitSet(const std::initializer_list< ConstRecHitPointer > &hits)
Definition: SeedingHitSet.h:39
unsigned int size() const
Definition: SeedingHitSet.h:52
SeedingHitSet(const std::vector< ConstRecHitPointer > &hits)
Definition: SeedingHitSet.h:28
SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two)
Definition: SeedingHitSet.h:20
ConstRecHitPointer const * data() const
Definition: SeedingHitSet.h:50