CMS 3D CMS Logo

DetGroup.h
Go to the documentation of this file.
1 #ifndef DetLayers_DetGroup_h
2 #define DetLayers_DetGroup_h
3 
6 #include <vector>
7 #include <utility>
8 #include <algorithm>
9 
11 public:
12  typedef std::pair<const GeomDet*, TrajectoryStateOnSurface> DetWithState;
13  typedef GeomDet Det;
14 
15  DetGroupElement(const DetWithState& dws) : det_(dws.first), state_(dws.second) {}
16 
17  DetGroupElement(const Det* d, const TrajectoryStateOnSurface& s) : det_(d), state_(s) {}
18 
19  DetGroupElement(DetGroupElement const& rhs) : det_(rhs.det_), state_(rhs.state_) {}
22  det_ = rhs.det_;
23  state_ = rhs.state_;
24  return *this;
25  }
27  det_ = rhs.det_;
28  state_ = std::move(rhs.state_);
29  return *this;
30  }
32 
33  const Det* det() const { return det_; }
34  const TrajectoryStateOnSurface& trajectoryState() const { return state_; }
35 
36 private:
37  const Det* det_;
39 };
40 
41 class DetGroup : public std::vector<DetGroupElement> {
42 public:
43  typedef std::vector<DetGroupElement> Base;
45 
46  DetGroup() {}
47  DetGroup(DetGroup const& rhs) : Base(rhs), index_(rhs.index_), indexSize_(rhs.indexSize_) {}
48  DetGroup(DetGroup&& rhs) noexcept : Base(std::forward<Base>(rhs)), index_(rhs.index_), indexSize_(rhs.indexSize_) {}
49  DetGroup& operator=(DetGroup const& rhs) {
50  Base::operator=(rhs);
51  index_ = rhs.index_;
52  indexSize_ = rhs.indexSize_;
53  return *this;
54  }
56  Base::operator=(std::forward<Base>(rhs));
57  index_ = rhs.index_;
58  indexSize_ = rhs.indexSize_;
59  return *this;
60  }
61 
62  DetGroup(int ind, int indSize) : index_(ind), indexSize_(indSize) {}
63 
64  DetGroup(const std::vector<DetWithState>& vec) {
65  reserve(vec.size());
66  for (std::vector<DetWithState>::const_iterator i = vec.begin(); i != vec.end(); i++) {
67  push_back(DetGroupElement(*i));
68  }
69  }
70 
71  int index() const { return index_; }
72 
73  int indexSize() const { return indexSize_; }
74 
75  void setIndexSize(int newSize) { indexSize_ = newSize; }
76 
77  void incrementIndex(int incr) {
78  // for (iterator i=begin(); i!=end(); i++) i->incrementIndex(incr);
79  index_ += incr;
80  indexSize_ += incr;
81  }
82 
83 private:
84  int index_;
86 };
87 
88 #endif
void incrementIndex(int incr)
Definition: DetGroup.h:77
const Det * det() const
Definition: DetGroup.h:33
const Det * det_
Definition: DetGroup.h:37
DetGroup(DetGroup const &rhs)
Definition: DetGroup.h:47
DetGroup(const std::vector< DetWithState > &vec)
Definition: DetGroup.h:64
DetGroup(int ind, int indSize)
Definition: DetGroup.h:62
DetGroupElement & operator=(DetGroupElement &&rhs)
Definition: DetGroup.h:26
DetGroup & operator=(DetGroup &&rhs)
Definition: DetGroup.h:55
DetGroupElement::DetWithState DetWithState
Definition: DetGroup.h:44
GeomDet Det
Definition: DetGroup.h:13
DetGroupElement(const Det *d, TrajectoryStateOnSurface &&s)
Definition: DetGroup.h:31
U second(std::pair< T, U > const &p)
DetGroup(DetGroup &&rhs)
Definition: DetGroup.h:48
DetGroup()
Definition: DetGroup.h:46
DetGroupElement & operator=(DetGroupElement const &rhs)
Definition: DetGroup.h:21
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: DetGroup.h:12
DetGroupElement(DetGroupElement const &rhs)
Definition: DetGroup.h:19
d
Definition: ztail.py:151
#define noexcept
int index() const
Definition: DetGroup.h:71
int indexSize_
Definition: DetGroup.h:85
int indexSize() const
Definition: DetGroup.h:73
DetGroup & operator=(DetGroup const &rhs)
Definition: DetGroup.h:49
DetGroupElement(DetGroupElement &&rhs)
Definition: DetGroup.h:20
void setIndexSize(int newSize)
Definition: DetGroup.h:75
DetGroupElement(const Det *d, const TrajectoryStateOnSurface &s)
Definition: DetGroup.h:17
TrajectoryStateOnSurface state_
Definition: DetGroup.h:38
const TrajectoryStateOnSurface & trajectoryState() const
Definition: DetGroup.h:34
DetGroupElement(const DetWithState &dws)
Definition: DetGroup.h:15
std::vector< DetGroupElement > Base
Definition: DetGroup.h:43
def move(src, dest)
Definition: eostools.py:511
int index_
Definition: DetGroup.h:84