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 
18 
19  DetGroupElement(DetGroupElement const& rhs) : det_(rhs.det_), state_(rhs.state_) {}
20  DetGroupElement(DetGroupElement&& rhs) noexcept : det_(rhs.det_), state_(std::move(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  }
55  DetGroup& operator=(DetGroup&& rhs) noexcept {
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
DetGroup::DetGroup
DetGroup(DetGroup const &rhs)
Definition: DetGroup.h:47
DetGroup::Base
std::vector< DetGroupElement > Base
Definition: DetGroup.h:43
DetGroup::DetGroup
DetGroup(const std::vector< DetWithState > &vec)
Definition: DetGroup.h:64
TrajectoryStateOnSurface.h
mps_fire.i
i
Definition: mps_fire.py:428
DetGroupElement::Det
GeomDet Det
Definition: DetGroup.h:13
DetGroup::DetGroup
DetGroup(int ind, int indSize)
Definition: DetGroup.h:62
GeomDet
Definition: GeomDet.h:27
DetGroup::incrementIndex
void incrementIndex(int incr)
Definition: DetGroup.h:77
DetGroupElement::DetGroupElement
DetGroupElement(const Det *d, TrajectoryStateOnSurface &&s) noexcept
Definition: DetGroup.h:31
DetGroup::DetWithState
DetGroupElement::DetWithState DetWithState
Definition: DetGroup.h:44
DetGroup::operator=
DetGroup & operator=(DetGroup &&rhs) noexcept
Definition: DetGroup.h:55
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DetGroup::DetGroup
DetGroup()
Definition: DetGroup.h:46
DetGroupElement::det
const Det * det() const
Definition: DetGroup.h:33
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DetGroupElement::DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: DetGroup.h:12
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DetGroup::indexSize
int indexSize() const
Definition: DetGroup.h:73
DetGroupElement::DetGroupElement
DetGroupElement(const Det *d, const TrajectoryStateOnSurface &s)
Definition: DetGroup.h:17
DetGroupElement::DetGroupElement
DetGroupElement(const DetWithState &dws)
Definition: DetGroup.h:15
DetGroupElement::operator=
DetGroupElement & operator=(DetGroupElement const &rhs)
Definition: DetGroup.h:21
DetGroup::index
int index() const
Definition: DetGroup.h:71
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
DetGroupElement
Definition: DetGroup.h:10
DetGroupElement::trajectoryState
const TrajectoryStateOnSurface & trajectoryState() const
Definition: DetGroup.h:34
DetGroupElement::DetGroupElement
DetGroupElement(DetGroupElement const &rhs)
Definition: DetGroup.h:19
DetGroupElement::operator=
DetGroupElement & operator=(DetGroupElement &&rhs) noexcept
Definition: DetGroup.h:26
DetGroupElement::state_
TrajectoryStateOnSurface state_
Definition: DetGroup.h:38
GeomDet.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetGroupElement::det_
const Det * det_
Definition: DetGroup.h:37
DetGroup::operator=
DetGroup & operator=(DetGroup const &rhs)
Definition: DetGroup.h:49
DetGroup::index_
int index_
Definition: DetGroup.h:84
DetGroup::indexSize_
int indexSize_
Definition: DetGroup.h:85
DetGroup
Definition: DetGroup.h:41
ztail.d
d
Definition: ztail.py:151
DetGroupElement::DetGroupElement
DetGroupElement(DetGroupElement &&rhs) noexcept
Definition: DetGroup.h:20
DetGroup::setIndexSize
void setIndexSize(int newSize)
Definition: DetGroup.h:75
DetGroup::DetGroup
DetGroup(DetGroup &&rhs) noexcept
Definition: DetGroup.h:48