CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h

Go to the documentation of this file.
00001 //---------------------------------------------
00002 //
00003 //   \class L1MuGMTReadoutCollection
00004 //
00005 //   Description: 
00006 //
00007 //
00008 //   $Date: 2007/04/02 15:44:08 $
00009 //   $Revision: 1.5 $
00010 //
00011 //   Author :
00012 //   Hannes Sakulin                  HEPHY Vienna
00013 //   Ivan Mikulec                    HEPHY Vienna
00014 //
00015 //--------------------------------------------------
00016 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
00017 #define DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h
00018 
00019 //---------------
00020 // C++ Headers --
00021 //---------------
00022 
00023 #include <vector>
00024 #include <iostream>
00025 
00026 //----------------------
00027 // Base Class Headers --
00028 //----------------------
00029 
00030 //------------------------------------
00031 // Collaborating Class Declarations --
00032 //------------------------------------
00033 
00034 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutRecord.h"
00035 
00036 //---------------------
00037 //-- Class Interface --
00038 //---------------------
00039 
00040 class L1MuGMTReadoutCollection {
00041 
00042  public:
00043 
00044   L1MuGMTReadoutCollection() {};
00045   L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
00046 
00047   virtual ~L1MuGMTReadoutCollection() {};
00048 
00049   void reset() { for(unsigned int i=0; i<m_Records.size(); i++) m_Records[i].reset(); };
00050 
00051   // get record vector
00052   std::vector<L1MuGMTReadoutRecord> getRecords() const { return m_Records; };
00053 
00054   // get record for a given bx
00055   L1MuGMTReadoutRecord const& getRecord(int bx=0) const {
00056     std::vector<L1MuGMTReadoutRecord>::const_iterator iter;
00057     for(iter=m_Records.begin(); iter!=m_Records.end(); iter++) {
00058       if((*iter).getBxCounter() == bx) return (*iter);
00059     }
00060     // if bx not found return empty readout record
00061     return *(new L1MuGMTReadoutRecord(bx));
00062   };
00063 
00064   // add record
00065   void addRecord(L1MuGMTReadoutRecord const& rec) {
00066     m_Records.push_back(rec);
00067   };
00068 
00069  private:
00070 
00071   std::vector<L1MuGMTReadoutRecord> m_Records;
00072 
00073 };
00074 
00075 #endif // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h