CMS 3D CMS Logo

RegionsSeedingHitSets.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkHitPairs_RegionsSeedingHitSets_H
2 #define RecoTracker_TkHitPairs_RegionsSeedingHitSets_H
3 
6 
13 public:
16 
19 
22 
24  class RegionFiller {
25  public:
26  RegionFiller() : obj_(nullptr) {}
28 
30  if (obj_)
31  obj_->regions_.back().setLayerSetsEnd(obj_->hitSets_.size());
32  }
33 
34  bool valid() const { return obj_ != nullptr; }
35 
36  template <typename... Args>
37  void emplace_back(Args&&... args) {
38  obj_->hitSets_.emplace_back(std::forward<Args>(args)...);
39  }
40 
41  private:
43  };
44 
45  // allows declaring local variables with auto
46  static RegionFiller dummyFiller() { return RegionFiller(); }
47 
48  // constructors
49  RegionsSeedingHitSets() = default;
54  ~RegionsSeedingHitSets() = default;
55 
56  void reserve(size_t nregions, size_t nhitsets) {
57  regions_.reserve(nregions);
58  hitSets_.reserve(nhitsets);
59  }
60 
61  void shrink_to_fit() {
62  regions_.shrink_to_fit();
63  hitSets_.shrink_to_fit();
64  }
65 
67  regions_.emplace_back(region, hitSets_.size());
68  return RegionFiller(this);
69  }
70 
71  bool empty() const { return regions_.empty(); }
72  size_t regionSize() const { return regions_.size(); }
73  size_t size() const { return hitSets_.size(); }
74 
75  const_iterator begin() const { return const_iterator(this, regions_.begin()); }
76  const_iterator cbegin() const { return begin(); }
77  const_iterator end() const { return const_iterator(this, regions_.end()); }
78  const_iterator cend() const { return end(); }
79 
80  // used internally by the helper classes
81  std::vector<SeedingHitSet>::const_iterator layerSetsBegin() const { return hitSets_.begin(); }
82  std::vector<SeedingHitSet>::const_iterator layerSetsEnd() const { return hitSets_.end(); }
83 
84 private:
85  std::vector<RegionIndex> regions_;
86  std::vector<SeedingHitSet> hitSets_;
87 };
88 
89 #endif
RegionsSeedingHitSets::RegionFiller::~RegionFiller
~RegionFiller()
Definition: RegionsSeedingHitSets.h:29
writedatasetfile.args
args
Definition: writedatasetfile.py:18
IntermediateHitDoublets.h
RegionsSeedingHitSets::RegionFiller::RegionFiller
RegionFiller()
Definition: RegionsSeedingHitSets.h:26
RegionsSeedingHitSets::end
const_iterator end() const
Definition: RegionsSeedingHitSets.h:77
ihd::RegionLayerSets
Definition: IntermediateHitDoublets.h:48
RegionsSeedingHitSets::cbegin
const_iterator cbegin() const
Definition: RegionsSeedingHitSets.h:76
RegionsSeedingHitSets::RegionsSeedingHitSets
RegionsSeedingHitSets()=default
SeedingHitSet.h
RegionsSeedingHitSets::RegionFiller::emplace_back
void emplace_back(Args &&... args)
Definition: RegionsSeedingHitSets.h:37
RegionsSeedingHitSets
Definition: RegionsSeedingHitSets.h:12
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
RegionsSeedingHitSets::dummyFiller
static RegionFiller dummyFiller()
Definition: RegionsSeedingHitSets.h:46
RegionsSeedingHitSets::regions_
std::vector< RegionIndex > regions_
Definition: RegionsSeedingHitSets.h:85
RegionsSeedingHitSets::layerSetsEnd
std::vector< SeedingHitSet >::const_iterator layerSetsEnd() const
Definition: RegionsSeedingHitSets.h:82
RegionsSeedingHitSets::regionSize
size_t regionSize() const
Definition: RegionsSeedingHitSets.h:72
RegionsSeedingHitSets::empty
bool empty() const
Definition: RegionsSeedingHitSets.h:71
RegionsSeedingHitSets::shrink_to_fit
void shrink_to_fit()
Definition: RegionsSeedingHitSets.h:61
RegionsSeedingHitSets::begin
const_iterator begin() const
Definition: RegionsSeedingHitSets.h:75
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
RegionsSeedingHitSets::operator=
RegionsSeedingHitSets & operator=(const RegionsSeedingHitSets &)=delete
RegionsSeedingHitSets::RegionFiller::RegionFiller
RegionFiller(RegionsSeedingHitSets *obj)
Definition: RegionsSeedingHitSets.h:27
RegionsSeedingHitSets::cend
const_iterator cend() const
Definition: RegionsSeedingHitSets.h:78
RegionsSeedingHitSets::RegionFiller::obj_
RegionsSeedingHitSets * obj_
Definition: RegionsSeedingHitSets.h:42
RegionsSeedingHitSets::const_iterator
ihd::const_iterator< RegionSeedingHitSets, RegionsSeedingHitSets > const_iterator
Iterator over regions.
Definition: RegionsSeedingHitSets.h:21
RegionsSeedingHitSets::reserve
void reserve(size_t nregions, size_t nhitsets)
Definition: RegionsSeedingHitSets.h:56
RegionsSeedingHitSets::layerSetsBegin
std::vector< SeedingHitSet >::const_iterator layerSetsBegin() const
Definition: RegionsSeedingHitSets.h:81
RegionsSeedingHitSets::RegionFiller
Helper class enforcing correct way of filling the doublets of a region.
Definition: RegionsSeedingHitSets.h:24
RegionsSeedingHitSets::beginRegion
RegionFiller beginRegion(const TrackingRegion *region)
Definition: RegionsSeedingHitSets.h:66
RegionsSeedingHitSets::size
size_t size() const
Definition: RegionsSeedingHitSets.h:73
RegionsSeedingHitSets::~RegionsSeedingHitSets
~RegionsSeedingHitSets()=default
ihd::const_iterator
Definition: IntermediateHitDoublets.h:85
RegionsSeedingHitSets::RegionFiller::valid
bool valid() const
Definition: RegionsSeedingHitSets.h:34
TrackingRegion
Definition: TrackingRegion.h:41
RegionsSeedingHitSets::hitSets_
std::vector< SeedingHitSet > hitSets_
Container of regions, each element has indices pointing to hitSets_.
Definition: RegionsSeedingHitSets.h:86
ihd::RegionIndex
Definition: IntermediateHitDoublets.h:16