CMS 3D CMS Logo

L1MuGMTReadoutCollection.h
Go to the documentation of this file.
1 //---------------------------------------------
2 //
3 // \class L1MuGMTReadoutCollection
4 //
5 // Description:
6 //
7 //
8 //
9 // Author :
10 // Hannes Sakulin HEPHY Vienna
11 // Ivan Mikulec HEPHY Vienna
12 //
13 //--------------------------------------------------
14 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
15 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
16 
17 //---------------
18 // C++ Headers --
19 //---------------
20 
21 #include <vector>
22 #include <map>
23 #include <iostream>
24 
25 //----------------------
26 // Base Class Headers --
27 //----------------------
28 
29 //------------------------------------
30 // Collaborating Class Declarations --
31 //------------------------------------
32 
34 
35 //---------------------
36 //-- Class Interface --
37 //---------------------
38 
40 public:
42  L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
43 
45 
46  void reset() {
47  for (unsigned int i = 0; i < m_Records.size(); i++)
48  m_Records[i].reset();
49  };
50 
51  // get record vector
52  std::vector<L1MuGMTReadoutRecord> const& getRecords() const { return m_Records; };
53 
54  // get record for a given bx
55  L1MuGMTReadoutRecord const& getRecord(int bx = 0) const {
56  std::vector<L1MuGMTReadoutRecord>::const_iterator iter;
57  for (iter = m_Records.begin(); iter != m_Records.end(); iter++) {
58  if ((*iter).getBxCounter() == bx)
59  return (*iter);
60  }
61  return getDefaultFor(bx);
62  };
63 
64  // add record
65  void addRecord(L1MuGMTReadoutRecord const& rec) { m_Records.push_back(rec); };
66 
67 private:
68  static L1MuGMTReadoutRecord const& getDefaultFor(int bx);
69 
70  std::vector<L1MuGMTReadoutRecord> m_Records;
71 };
72 
73 #endif // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
std::vector< L1MuGMTReadoutRecord > m_Records
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
void addRecord(L1MuGMTReadoutRecord const &rec)
L1MuGMTReadoutRecord const & getRecord(int bx=0) const
static L1MuGMTReadoutRecord const & getDefaultFor(int bx)