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 public:
13  class RegionLayers {
14  public:
16 
18  elem_(elem), seedingLayerSetsHits_(seedingLayerSetsHits) {}
19 
20  const TrackingRegion& region() const;
21  std::vector<SeedingLayerSet> layerPairs() const;
22 
23  private:
24  const Element *elem_;
26  };
27 
29  public:
30  using internal_iterator_type = std::vector<Element>::const_iterator;
32  using difference_type = internal_iterator_type::difference_type;
33 
35  iter_(iter), seedingLayerSetsHits_(seedingLayerSetsHits) {}
36 
37  value_type operator*() const { return RegionLayers(&(*iter_), seedingLayerSetsHits_); }
38  const_iterator& operator++() { ++iter_; return *this; }
40  const_iterator clone(*this);
41  ++(*this);
42  return clone;
43  }
44 
45  bool operator==(const const_iterator& other) const { return iter_ == other.iter_; }
46  bool operator!=(const const_iterator& other) const { return !operator==(other); }
47  private:
50  };
51 
54  seedingLayerSetsHits_(seedingLayerSetsHits)
55  {}
61 
62  void reserve(size_t s) { regionLayers_.reserve(s); }
63 
64  // layerSets index points to a layer set within seedingLayerSetsHits_
65  void emplace_back(std::unique_ptr<TrackingRegion>&& region,
66  std::vector<SeedingLayerSetsHits::LayerSetIndex>&& layerSets) {
67  regionLayers_.emplace_back(std::move(region), std::move(layerSets));
68  }
69 
72  regionLayers_.swap(other.regionLayers_);
73  }
74 
76  size_t regionsSize() const { return regionLayers_.size(); }
77 
79  const_iterator cbegin() const { return begin(); }
81  const_iterator cend() const { return end(); }
82 
83 private:
84  class Element {
85  public:
86  Element(std::unique_ptr<TrackingRegion>&& region, std::vector<SeedingLayerSetsHits::LayerSetIndex>&& layerSets):
87  region_(std::move(region)), layerSets_(std::move(layerSets)) {}
88  ~Element() = default;
89  Element(Element const&)=delete;
90  Element& operator=(Element const&)=delete;
91  Element(Element &&)=default;
92  Element& operator=(Element &&)=default;
93 
94  const TrackingRegion& region() const { return *region_; }
95  const std::vector<SeedingLayerSetsHits::LayerSetIndex>& layerSets() const { return layerSets_; }
96 
97  private:
98  std::unique_ptr<TrackingRegion> region_;
99  std::vector<SeedingLayerSetsHits::LayerSetIndex> layerSets_;
100  };
101 
103  std::vector<Element> regionLayers_;
104 };
105 
106 inline
108  return elem_->region();
109 }
110 
111 inline
112 std::vector<TrackingRegionsSeedingLayerSets::RegionLayers::SeedingLayerSet> TrackingRegionsSeedingLayerSets::RegionLayers::layerPairs() const {
113  std::vector<SeedingLayerSet> ret; // TODO: get rid of the vector with more boilerplate code (sigh)
114 
115  const auto& layerSets = elem_->layerSets();
116  ret.reserve(layerSets.size());
117  for(const auto& ind: layerSets) {
118  ret.push_back((*seedingLayerSetsHits_)[ind]);
119  }
120  return ret;
121 }
122 
123 #endif
internal_iterator_type::difference_type difference_type
void emplace_back(std::unique_ptr< TrackingRegion > &&region, std::vector< SeedingLayerSetsHits::LayerSetIndex > &&layerSets)
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