CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
25  public:
26 
29  CSCTriggerContainer(const std::vector<T>&);
30 
32  CSCTriggerContainer& operator=(const std::vector<T>&);
33 
34  std::vector<T> get() const;
35  std::vector<T> get(const unsigned& endcap, const unsigned& station, const unsigned& tsector,
36  const unsigned& tsubsector, const unsigned& cscid, const int& BX) const;
37  std::vector<T> get(const unsigned& endcap, const unsigned& station, const unsigned& tsector,
39  const unsigned& tsubsector, const int& BX) const;
40  std::vector<T> get(const unsigned& endcap, const unsigned& sector, const int& BX) const;
41  std::vector<T> get(const unsigned& endcap, const unsigned& sector) const;
42  std::vector<T> get(const int& BX) const;
43 
44  void push_back(const T data) { _objs.push_back(data); }
45  void push_many(const std::vector<T> data) { _objs.insert(_objs.end(), data.begin(), data.end()); }
46  void push_many(const CSCTriggerContainer<T> data) { std::vector<T> vec = data.get(); _objs.insert(_objs.end(), vec.begin(), vec.end()); }
47  void clear() { _objs.clear(); }
48 
49  private:
50 
51  std::vector<T> _objs;
52 };
53 
54 template<class T>
56 {
57  _objs = parent;
58 }
59 
60 template<class T>
62 {
63  if(this != &rhs)
64  {
65  _objs = rhs._objs;
66  }
67  return *this;
68 }
69 
70 template<class T>
72 {
73  _objs = rhs;
74  return *this;
75 }
76 
77 template<class T>
78 std::vector<T> CSCTriggerContainer<T>::get() const
79 {
80  return _objs;
81 }
82 
83 template<class T>
84 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& station,
85  const unsigned& tsector,const unsigned& tsubsector,
86  const unsigned& cscid, const int& BX) const
87 {
88  std::vector<T> result;
89 
90  for(unsigned i = 0; i < _objs.size(); i++)
91  if(_objs[i].endcap() == endcap && _objs[i].station() == station &&
92  _objs[i].sector() == tsector && (station != 1 || _objs[i].subsector() == tsubsector) &&
93  _objs[i].cscid() == cscid && _objs[i].BX() == BX)
94  result.push_back(_objs[i]);
95 
96  return result;
97 }
98 
99 template<class T>
100 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& station,
101  const unsigned& tsector,const unsigned& tsubsector,
102  const int& BX) const
103 {
104  std::vector<T> result;
105 
106  for(unsigned i = 0; i < _objs.size(); ++i)
107  if(_objs[i].endcap() == endcap && _objs[i].station() == station &&
108  _objs[i].sector() == tsector && (station != 1 || _objs[i].subsector() == tsubsector)
109  && _objs[i].BX() == BX)
110  result.push_back(_objs[i]);
111 
112  return result;
113 }
114 
115 template<class T>
116 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& sector,
117  const int& BX) const
118 {
119  std::vector<T> result;
120 
121  for(unsigned i = 0; i < _objs.size(); ++i)
122  if(_objs[i].endcap() == endcap && _objs[i].sector() == sector && _objs[i].BX() == BX)
123  result.push_back(_objs[i]);
124 
125  return result;
126 }
127 
128 template<class T>
129 std::vector<T> CSCTriggerContainer<T>::get(const unsigned& endcap, const unsigned& sector) const
130 {
131  std::vector<T> result;
132 
133  for(unsigned i = 0; i < _objs.size(); ++i)
134  if(_objs[i].endcap() == endcap && _objs[i].sector() == sector)
135  result.push_back(_objs[i]);
136 
137  return result;
138 }
139 
140 template<class T>
141 std::vector<T> CSCTriggerContainer<T>::get(const int& BX) const
142 {
143  std::vector<T> result;
144 
145  for(unsigned i = 0; i < _objs.size(); ++i)
146  if(_objs[i].BX() == BX) result.push_back(_objs[i]);
147 
148  return result;
149 }
150 
151 #endif
int i
Definition: DBlmapReader.cc:9
std::vector< T > get() const
CSCTriggerContainer(const CSCTriggerContainer &cpy)
list parent
Definition: dbtoconf.py:74
void push_back(const T data)
std::vector< T > _objs
void push_many(const std::vector< T > data)
tuple result
Definition: query.py:137
CSCTriggerContainer & operator=(const CSCTriggerContainer &)
long double T
void push_many(const CSCTriggerContainer< T > data)