CMS 3D CMS Logo

CSCTriggerContainer.h
Go to the documentation of this file.
1 #ifndef CSCCommonTrigger_CSCTriggerContainer_h
2 #define CSCCommonTrigger_CSCTriggerContainer_h
3 
20 #include <vector>
21 
22 template <class T>
24 public:
27  CSCTriggerContainer(const std::vector<T>&);
28 
30  CSCTriggerContainer& operator=(const std::vector<T>&);
31 
32  std::vector<T> get() const;
33  std::vector<T> get(const unsigned& endcap,
34  const unsigned& station,
35  const unsigned& tsector,
36  const unsigned& tsubsector,
37  const unsigned& cscid,
38  const int& BX) const;
39  std::vector<T> get(const unsigned& endcap,
41  const unsigned& station,
42  const unsigned& tsector,
43  const unsigned& tsubsector,
44  const int& BX) const;
45  std::vector<T> get(const unsigned& endcap,
46  const unsigned& sector,
47  const int& BX) const;
48  std::vector<T> get(const unsigned& endcap, const unsigned& sector) const;
49  std::vector<T> get(const int& BX) const;
50 
51  void push_back(const T& data) { _objs.push_back(data); }
52  void push_many(const std::vector<T>& data) { _objs.insert(_objs.end(), data.begin(), data.end()); }
54  std::vector<T> vec = data.get();
55  _objs.insert(_objs.end(), vec.begin(), vec.end());
56  }
57  void clear() { _objs.clear(); }
58 
59 private:
60  std::vector<T> _objs;
61 };
62 
63 template <class T>
65  _objs = parent;
66 }
67 
68 template <class T>
70  if (this != &rhs) {
71  _objs = rhs._objs;
72  }
73  return *this;
74 }
75 
76 template <class T>
78  _objs = rhs;
79  return *this;
80 }
81 
82 template <class T>
83 std::vector<T> CSCTriggerContainer<T>::get() const {
84  return _objs;
85 }
86 
87 template <class T>
88 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap,
89  const unsigned& station,
90  const unsigned& tsector,
91  const unsigned& tsubsector,
92  const unsigned& cscid,
93  const int& BX) const {
94  std::vector<T> result;
95 
96  for (unsigned i = 0; i < _objs.size(); i++)
97  if (_objs[i].endcap() == endcap && _objs[i].station() == station && _objs[i].sector() == tsector &&
98  (station != 1 || _objs[i].subsector() == tsubsector) && _objs[i].cscid() == cscid && _objs[i].BX() == BX)
99  result.push_back(_objs[i]);
100 
101  return result;
102 }
103 
104 template <class T>
105 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap,
106  const unsigned& station,
107  const unsigned& tsector,
108  const unsigned& tsubsector,
109  const int& BX) const {
110  std::vector<T> result;
111 
112  for (unsigned i = 0; i < _objs.size(); ++i)
113  if (_objs[i].endcap() == endcap && _objs[i].station() == station && _objs[i].sector() == tsector &&
114  (station != 1 || _objs[i].subsector() == tsubsector) && _objs[i].BX() == BX)
115  result.push_back(_objs[i]);
116 
117  return result;
118 }
119 
120 template <class T>
121 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& sector, const int& BX) const {
122  std::vector<T> result;
123 
124  for (unsigned i = 0; i < _objs.size(); ++i)
125  if (_objs[i].endcap() == endcap && _objs[i].sector() == sector && _objs[i].BX() == BX)
126  result.push_back(_objs[i]);
127 
128  return result;
129 }
130 
131 template <class T>
132 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& sector) const {
133  std::vector<T> result;
134 
135  for (unsigned i = 0; i < _objs.size(); ++i)
136  if (_objs[i].endcap() == endcap && _objs[i].sector() == sector)
137  result.push_back(_objs[i]);
138 
139  return result;
140 }
141 
142 template <class T>
143 std::vector<T> CSCTriggerContainer<T>::get(const int& BX) const {
144  std::vector<T> result;
145 
146  for (unsigned i = 0; i < _objs.size(); ++i)
147  if (_objs[i].BX() == BX)
148  result.push_back(_objs[i]);
149 
150  return result;
151 }
152 
153 #endif
CSCTriggerContainer::clear
void clear()
Definition: CSCTriggerContainer.h:57
mps_fire.i
i
Definition: mps_fire.py:428
relativeConstraints.station
station
Definition: relativeConstraints.py:67
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCTriggerContainer::push_many
void push_many(const std::vector< T > &data)
Definition: CSCTriggerContainer.h:52
CSCTriggerContainer::CSCTriggerContainer
CSCTriggerContainer(const CSCTriggerContainer &cpy)
Definition: CSCTriggerContainer.h:26
CSCTriggerContainer::operator=
CSCTriggerContainer & operator=(const CSCTriggerContainer &)
Definition: CSCTriggerContainer.h:69
CSCTriggerContainer::CSCTriggerContainer
CSCTriggerContainer()
Definition: CSCTriggerContainer.h:25
T
long double T
Definition: Basic3DVectorLD.h:48
CSCTriggerContainer
Definition: CSCTriggerContainer.h:23
CSCTriggerContainer::push_back
void push_back(const T &data)
Definition: CSCTriggerContainer.h:51
L1TStage2uGTEmulatorClient_cff.BX
BX
Definition: L1TStage2uGTEmulatorClient_cff.py:9
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:311
CSCTriggerContainer::push_many
void push_many(const CSCTriggerContainer< T > &data)
Definition: CSCTriggerContainer.h:53
CSCTriggerContainer::_objs
std::vector< T > _objs
Definition: CSCTriggerContainer.h:60
class-composition.parent
parent
Definition: class-composition.py:88
CSCTriggerContainer::get
std::vector< T > get() const
Definition: CSCTriggerContainer.h:83