CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTInputEvent.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   class L1MuGMTInputEvent
00004 //
00005 //   Description:  
00006 //
00007 //   $Date: 2007/03/23 18:51:35 $
00008 //   $Revision: 1.2 $
00009 //
00010 //   Author :
00011 //   Tobias Noebauer              HEPHY Vienna
00012 //
00013 //   Migrated to CMSSW:
00014 //   I. Mikulec
00015 //
00016 //--------------------------------------------------
00017 
00018 //-----------------------
00019 // This Class's Header --
00020 //-----------------------
00021 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTInputEvent.h"
00022 
00023 //---------------
00024 // C++ Headers --
00025 //---------------
00026 #include <stdexcept>
00027 
00028 //-------------------------------
00029 // Collaborating Class Headers --
00030 //-------------------------------
00031 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatrix.h"
00032 //#include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
00033 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
00034 
00035 //----------------
00036 // Constructors --
00037 //----------------
00038 L1MuGMTInputEvent::L1MuGMTInputEvent() : 
00039                 m_runnr(0L), m_evtnr(0L), m_mip_bits(14,18), m_iso_bits(14,18) {
00040   std::vector<L1MuRegionalCand> empty_vec;
00041   m_inputmuons["INC"] = empty_vec;
00042   m_inputmuons["IND"] = empty_vec;
00043   m_inputmuons["INB"] = empty_vec;
00044   m_inputmuons["INF"] = empty_vec;
00045 
00046   //  m_inputmuons["INC"].reserve(L1MuGMTConfig::MAXCSC);
00047   //  m_inputmuons["IND"].reserve(L1MuGMTConfig::MAXDTBX);
00048   //  m_inputmuons["INB"].reserve(L1MuGMTConfig::MAXRPC);
00049   //  m_inputmuons["INF"].reserve(L1MuGMTConfig::MAXRPC);
00050   m_inputmuons["INC"].reserve(4);
00051   m_inputmuons["IND"].reserve(4);
00052   m_inputmuons["INB"].reserve(4);
00053   m_inputmuons["INF"].reserve(4);
00054   
00055   m_mip_bits.init(false);
00056   m_iso_bits.init(true); //this is more useful when reading a standalone input file
00057                          //since "not-quiet" bits are stored there
00058 }
00059 
00060 //--------------
00061 // Destructor --
00062 //--------------
00063 L1MuGMTInputEvent::~L1MuGMTInputEvent() {
00064 }
00065 
00066 //--------------
00067 // Operations --
00068 //--------------
00069 void L1MuGMTInputEvent::addInputMuon(const std::string chipid, 
00070                                      const L1MuRegionalCand& inMu) {
00071   if (m_inputmuons.count(chipid) == 0)
00072     throw std::runtime_error("L1MuGMTInputEvent::addInputMuon: invalid chipid:" + chipid);
00073   m_inputmuons[chipid].push_back(inMu);
00074 }
00075 
00076 void L1MuGMTInputEvent::reset() {
00077   m_runnr = 0L;
00078   m_evtnr = 0L;
00079 
00080   std::map<std::string, std::vector<L1MuRegionalCand> >::iterator it = m_inputmuons.begin();
00081   for (; it != m_inputmuons.end(); it++) {
00082     it->second.clear();
00083   }
00084 
00085   m_mip_bits.init(false);
00086   m_iso_bits.init(true); //see CTOR for info on this
00087 }
00088 
00089 const L1MuRegionalCand* L1MuGMTInputEvent::getInputMuon(std::string chipid, unsigned index) const {
00090 
00091   if (m_inputmuons.count(chipid) == 0 )
00092     throw std::runtime_error("L1GMTInputEvent::getInputMuon: invalid chipid:" + chipid);
00093   
00094   if (index >= m_inputmuons.find(chipid)->second.size()) return 0;
00095   return &(m_inputmuons.find(chipid)->second.at(index));
00096 }
00097 
00098 
00099 
00100 
00101