CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
17  det_(dws.first), state_(dws.second) {}
18 
20  det_(d), state_(s) {}
21 
22 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
23  DetGroupElement(DetGroupElement const & rhs) : det_(rhs.det_), state_(rhs.state_){}
24  DetGroupElement(DetGroupElement && rhs) noexcept : det_(rhs.det_), state_(std::move(rhs.state_)){}
25  DetGroupElement & operator=(DetGroupElement const & rhs) {
26  det_=rhs.det_;
27  state_ = rhs.state_;
28  return *this;
29  }
30  DetGroupElement & operator=(DetGroupElement && rhs) noexcept {
31  det_=rhs.det_;
32  state_ = std::move(rhs.state_);
33  return *this;
34  }
36  det_(d), state_(std::move(s)) {}
37 
38 #endif
39 
40  const Det* det() const {return det_;}
42 
43 private:
44 
45  const Det* det_;
47 
48 };
49 
50 
51 class DetGroup : public std::vector< DetGroupElement> {
52 public:
53 
54  typedef std::vector< DetGroupElement> Base;
56 
57  DetGroup() {}
58 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
59  DetGroup(DetGroup const & rhs) : Base(rhs), index_(rhs.index_), indexSize_(rhs.indexSize_) {}
60  DetGroup(DetGroup && rhs) noexcept : Base(std::forward<Base>(rhs)), index_(rhs.index_), indexSize_(rhs.indexSize_) {}
61  DetGroup & operator=(DetGroup const & rhs) {
62  Base::operator=(rhs);
63  index_ = rhs.index_;
64  indexSize_ = rhs.indexSize_;
65  return *this;
66  }
67  DetGroup & operator=(DetGroup && rhs) noexcept {
68  Base::operator=(std::forward<Base>(rhs));
69  index_ = rhs.index_;
70  indexSize_ = rhs.indexSize_;
71  return *this;
72  }
73 #endif
74 
75 
76  DetGroup(int ind, int indSize) : index_(ind), indexSize_(indSize) {}
77 
78  DetGroup(const std::vector<DetWithState>& vec) {
79  reserve( vec.size());
80  for (std::vector<DetWithState>::const_iterator i=vec.begin(); i!=vec.end(); i++) {
81  push_back(DetGroupElement(*i));
82  }
83  }
84 
85  int index() const {return index_;}
86 
87  int indexSize() const {return indexSize_;}
88 
89  void setIndexSize( int newSize) {indexSize_ = newSize;}
90 
91  void incrementIndex( int incr) {
92  // for (iterator i=begin(); i!=end(); i++) i->incrementIndex(incr);
93  index_ += incr;
94  indexSize_ += incr;
95  }
96 
97 private:
98 
99  int index_;
101 
102 };
103 
104 #endif
void incrementIndex(int incr)
Definition: DetGroup.h:91
int i
Definition: DBlmapReader.cc:9
const Det * det() const
Definition: DetGroup.h:40
const Det * det_
Definition: DetGroup.h:45
DetGroup(const std::vector< DetWithState > &vec)
Definition: DetGroup.h:78
DetGroup(int ind, int indSize)
Definition: DetGroup.h:76
DetGroupElement::DetWithState DetWithState
Definition: DetGroup.h:55
#define noexcept
GeomDet Det
Definition: DetGroup.h:13
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: DetGroup.h:12
U second(std::pair< T, U > const &p)
tuple d
Definition: ztail.py:151
DetGroup()
Definition: DetGroup.h:57
std::vector< DetGroupElement > Base
Definition: DetGroup.h:54
def move
Definition: eostools.py:510
int index() const
Definition: DetGroup.h:85
int indexSize_
Definition: DetGroup.h:100
int indexSize() const
Definition: DetGroup.h:87
void setIndexSize(int newSize)
Definition: DetGroup.h:89
DetGroupElement(const Det *d, const TrajectoryStateOnSurface &s)
Definition: DetGroup.h:19
TrajectoryStateOnSurface state_
Definition: DetGroup.h:46
const TrajectoryStateOnSurface & trajectoryState() const
Definition: DetGroup.h:41
DetGroupElement(const DetWithState &dws)
Definition: DetGroup.h:16
int index_
Definition: DetGroup.h:99