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 
41  public:
42 
44  L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
45 
47 
48  void reset() { for(unsigned int i=0; i<m_Records.size(); i++) m_Records[i].reset(); };
49 
50  // get record vector
51  std::vector<L1MuGMTReadoutRecord> const & getRecords() const { return m_Records; };
52 
53  // get record for a given bx
54  L1MuGMTReadoutRecord const & getRecord(int bx=0) const {
55  std::vector<L1MuGMTReadoutRecord>::const_iterator iter;
56  for (iter=m_Records.begin(); iter!=m_Records.end(); iter++) {
57  if ((*iter).getBxCounter() == bx) return (*iter);
58  }
59  return getDefaultFor(bx);
60  };
61 
62  // add record
63  void addRecord(L1MuGMTReadoutRecord const& rec) {
64  m_Records.push_back(rec);
65  };
66 
67  private:
68  static L1MuGMTReadoutRecord const& getDefaultFor(int bx);
69 
70  std::vector<L1MuGMTReadoutRecord> m_Records;
71 
72 };
73 
74 #endif // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
std::vector< L1MuGMTReadoutRecord > m_Records
void addRecord(L1MuGMTReadoutRecord const &rec)
static L1MuGMTReadoutRecord const & getDefaultFor(int bx)
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
L1MuGMTReadoutRecord const & getRecord(int bx=0) const