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