Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:53

0001 //---------------------------------------------
0002 //
0003 //   \class L1MuGMTReadoutCollection
0004 //
0005 //   Description:
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   Hannes Sakulin                  HEPHY Vienna
0011 //   Ivan Mikulec                    HEPHY Vienna
0012 //
0013 //--------------------------------------------------
0014 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
0015 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
0016 
0017 //---------------
0018 // C++ Headers --
0019 //---------------
0020 
0021 #include <vector>
0022 #include <map>
0023 #include <iostream>
0024 
0025 //----------------------
0026 // Base Class Headers --
0027 //----------------------
0028 
0029 //------------------------------------
0030 // Collaborating Class Declarations --
0031 //------------------------------------
0032 
0033 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutRecord.h"
0034 
0035 //---------------------
0036 //-- Class Interface --
0037 //---------------------
0038 
0039 class L1MuGMTReadoutCollection {
0040 public:
0041   L1MuGMTReadoutCollection() {}
0042   L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); }
0043 
0044   virtual ~L1MuGMTReadoutCollection() {}
0045 
0046   void reset() {
0047     for (unsigned int i = 0; i < m_Records.size(); i++)
0048       m_Records[i].reset();
0049   };
0050 
0051   // get record vector
0052   std::vector<L1MuGMTReadoutRecord> const& getRecords() const { return m_Records; };
0053 
0054   // get record for a given bx
0055   L1MuGMTReadoutRecord const& getRecord(int bx = 0) const {
0056     std::vector<L1MuGMTReadoutRecord>::const_iterator iter;
0057     for (iter = m_Records.begin(); iter != m_Records.end(); iter++) {
0058       if ((*iter).getBxCounter() == bx)
0059         return (*iter);
0060     }
0061     return getDefaultFor(bx);
0062   };
0063 
0064   // add record
0065   void addRecord(L1MuGMTReadoutRecord const& rec) { m_Records.push_back(rec); };
0066 
0067 private:
0068   static L1MuGMTReadoutRecord const& getDefaultFor(int bx);
0069 
0070   std::vector<L1MuGMTReadoutRecord> m_Records;
0071 };
0072 
0073 #endif  // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h