CMS 3D CMS Logo

TrackingRegionsSeedingLayerSets.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_TrackingRegionsSeedingLayerSets_H
2 #define RecoTracker_TkTrackingRegions_TrackingRegionsSeedingLayerSets_H
3 
6 
7 #include <vector>
8 #include <memory>
9 
11  class Element;
12 
13 public:
14  class RegionLayers {
15  public:
17 
20 
21  const TrackingRegion& region() const;
22  std::vector<SeedingLayerSet> layerPairs() const;
23 
24  private:
25  const Element* elem_;
27  };
28 
30  public:
31  using internal_iterator_type = std::vector<Element>::const_iterator;
33  using difference_type = internal_iterator_type::difference_type;
34 
37 
40  ++iter_;
41  return *this;
42  }
44  const_iterator clone(*this);
45  ++(*this);
46  return clone;
47  }
48 
49  bool operator==(const const_iterator& other) const { return iter_ == other.iter_; }
50  bool operator!=(const const_iterator& other) const { return !operator==(other); }
51 
52  private:
55  };
56 
65 
66  void reserve(size_t s) { regionLayers_.reserve(s); }
67 
68  // layerSets index points to a layer set within seedingLayerSetsHits_
69  void emplace_back(std::unique_ptr<TrackingRegion>&& region,
70  std::vector<SeedingLayerSetsHits::LayerSetIndex>&& layerSets) {
71  regionLayers_.emplace_back(std::move(region), std::move(layerSets));
72  }
73 
75  std::swap(seedingLayerSetsHits_, other.seedingLayerSetsHits_);
76  regionLayers_.swap(other.regionLayers_);
77  }
78 
80  size_t regionsSize() const { return regionLayers_.size(); }
81 
83  const_iterator cbegin() const { return begin(); }
85  const_iterator cend() const { return end(); }
86 
87 private:
88  class Element {
89  public:
90  Element(std::unique_ptr<TrackingRegion>&& region, std::vector<SeedingLayerSetsHits::LayerSetIndex>&& layerSets)
92  ~Element() = default;
93  Element(Element const&) = delete;
94  Element& operator=(Element const&) = delete;
95  Element(Element&&) = default;
96  Element& operator=(Element&&) = default;
97 
98  const TrackingRegion& region() const { return *region_; }
99  const std::vector<SeedingLayerSetsHits::LayerSetIndex>& layerSets() const { return layerSets_; }
100 
101  private:
102  std::unique_ptr<TrackingRegion> region_;
103  std::vector<SeedingLayerSetsHits::LayerSetIndex> layerSets_;
104  };
105 
107  std::vector<Element> regionLayers_;
108 };
109 
111 
112 inline std::vector<TrackingRegionsSeedingLayerSets::RegionLayers::SeedingLayerSet>
114  std::vector<SeedingLayerSet> ret; // TODO: get rid of the vector with more boilerplate code (sigh)
115 
116  const auto& layerSets = elem_->layerSets();
117  ret.reserve(layerSets.size());
118  for (const auto& ind : layerSets) {
119  ret.push_back((*seedingLayerSetsHits_)[ind]);
120  }
121  return ret;
122 }
123 
124 #endif
internal_iterator_type::difference_type difference_type
void emplace_back(std::unique_ptr< TrackingRegion > &&region, std::vector< SeedingLayerSetsHits::LayerSetIndex > &&layerSets)
ret
prodAgent to be discontinued
Element & operator=(Element const &)=delete
std::vector< Element >::const_iterator internal_iterator_type
const_iterator(internal_iterator_type iter, const SeedingLayerSetsHits *seedingLayerSetsHits)
TrackingRegionsSeedingLayerSets(const SeedingLayerSetsHits *seedingLayerSetsHits)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
void swap(TrackingRegionsSeedingLayerSets &other)
const std::vector< SeedingLayerSetsHits::LayerSetIndex > & layerSets() const
Element(std::unique_ptr< TrackingRegion > &&region, std::vector< SeedingLayerSetsHits::LayerSetIndex > &&layerSets)
TrackingRegionsSeedingLayerSets & operator=(TrackingRegionsSeedingLayerSets const &)=delete
std::vector< SeedingLayerSetsHits::LayerSetIndex > layerSets_
const SeedingLayerSetsHits & seedingLayerSetsHits() const
RegionLayers(const Element *elem, const SeedingLayerSetsHits *seedingLayerSetsHits)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
const SeedingLayerSetsHits * seedingLayerSetsHits_
def move(src, dest)
Definition: eostools.py:511