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 
19  : elem_(elem), seedingLayerSetsHits_(seedingLayerSetsHits) {}
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 
36  : iter_(iter), seedingLayerSetsHits_(seedingLayerSetsHits) {}
37 
38  value_type operator*() const { return RegionLayers(&(*iter_), seedingLayerSetsHits_); }
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 
59  : seedingLayerSetsHits_(seedingLayerSetsHits) {}
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 
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)
91  : region_(std::move(region)), layerSets_(std::move(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
std::vector< Element >::const_iterator internal_iterator_type
const_iterator(internal_iterator_type iter, const SeedingLayerSetsHits *seedingLayerSetsHits)
TrackingRegionsSeedingLayerSets(const SeedingLayerSetsHits *seedingLayerSetsHits)
void swap(TrackingRegionsSeedingLayerSets &other)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Element(std::unique_ptr< TrackingRegion > &&region, std::vector< SeedingLayerSetsHits::LayerSetIndex > &&layerSets)
TrackingRegionsSeedingLayerSets & operator=(TrackingRegionsSeedingLayerSets const &)=delete
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
std::vector< SeedingLayerSetsHits::LayerSetIndex > layerSets_
RegionLayers(const Element *elem, const SeedingLayerSetsHits *seedingLayerSetsHits)
const std::vector< SeedingLayerSetsHits::LayerSetIndex > & layerSets() const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
const SeedingLayerSetsHits & seedingLayerSetsHits() const
const SeedingLayerSetsHits * seedingLayerSetsHits_
def move(src, dest)
Definition: eostools.py:511