CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTReadoutCollection.h
Go to the documentation of this file.
1 //---------------------------------------------
2 //
3 // \class L1MuGMTReadoutCollection
4 //
5 // Description:
6 //
7 //
8 // $Date: 2011/11/10 17:02:05 $
9 // $Revision: 1.6 $
10 //
11 // Author :
12 // Hannes Sakulin HEPHY Vienna
13 // Ivan Mikulec HEPHY Vienna
14 //
15 //--------------------------------------------------
16 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
17 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 
23 #include <vector>
24 #include <map>
25 #include <iostream>
26 
27 //----------------------
28 // Base Class Headers --
29 //----------------------
30 
31 //------------------------------------
32 // Collaborating Class Declarations --
33 //------------------------------------
34 
36 
37 //---------------------
38 //-- Class Interface --
39 //---------------------
40 
42 
43  public:
44 
46  L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
47 
49 
50  void reset() { for(unsigned int i=0; i<m_Records.size(); i++) m_Records[i].reset(); };
51 
52  // get record vector
53  std::vector<L1MuGMTReadoutRecord> const & getRecords() const { return m_Records; };
54 
55  // get record for a given bx
56  L1MuGMTReadoutRecord const & getRecord(int bx=0) const {
57  std::vector<L1MuGMTReadoutRecord>::const_iterator iter;
58  for (iter=m_Records.begin(); iter!=m_Records.end(); iter++) {
59  if ((*iter).getBxCounter() == bx) return (*iter);
60  }
61  // if bx not found return empty readout record
62  static std::map<int, L1MuGMTReadoutRecord> empty_record_cache;
63  if (empty_record_cache.find(bx) == empty_record_cache.end())
64  empty_record_cache.insert( std::make_pair(bx, L1MuGMTReadoutRecord(bx)) );
65  return empty_record_cache[bx];
66  };
67 
68  // add record
69  void addRecord(L1MuGMTReadoutRecord const& rec) {
70  m_Records.push_back(rec);
71  };
72 
73  private:
74 
75  std::vector<L1MuGMTReadoutRecord> m_Records;
76 
77 };
78 
79 #endif // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
int i
Definition: DBlmapReader.cc:9
std::vector< L1MuGMTReadoutRecord > m_Records
void addRecord(L1MuGMTReadoutRecord const &rec)
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
L1MuGMTReadoutRecord const & getRecord(int bx=0) const