Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:56

0001 //-------------------------------------------------
0002 //
0003 //   class L1MuGMTInputEvent
0004 //
0005 //   Description:
0006 //
0007 //
0008 //   Author :
0009 //   Tobias Noebauer              HEPHY Vienna
0010 //
0011 //   Migrated to CMSSW:
0012 //   I. Mikulec
0013 //
0014 //--------------------------------------------------
0015 
0016 //-----------------------
0017 // This Class's Header --
0018 //-----------------------
0019 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTInputEvent.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 #include <stdexcept>
0025 
0026 //-------------------------------
0027 // Collaborating Class Headers --
0028 //-------------------------------
0029 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatrix.h"
0030 //#include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0031 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
0032 
0033 //----------------
0034 // Constructors --
0035 //----------------
0036 L1MuGMTInputEvent::L1MuGMTInputEvent()
0037     : m_runnr(0L),
0038       m_evtnr(0L),
0039       m_mip_bits(14, 18, false),
0040       m_iso_bits(14, 18, true)  //this is more useful when reading a standalone input file
0041                                 //since "not-quiet" bits are stored there
0042 {
0043   std::vector<L1MuRegionalCand> empty_vec;
0044   m_inputmuons["INC"] = empty_vec;
0045   m_inputmuons["IND"] = empty_vec;
0046   m_inputmuons["INB"] = empty_vec;
0047   m_inputmuons["INF"] = empty_vec;
0048 
0049   //  m_inputmuons["INC"].reserve(L1MuGMTConfig::MAXCSC);
0050   //  m_inputmuons["IND"].reserve(L1MuGMTConfig::MAXDTBX);
0051   //  m_inputmuons["INB"].reserve(L1MuGMTConfig::MAXRPC);
0052   //  m_inputmuons["INF"].reserve(L1MuGMTConfig::MAXRPC);
0053   m_inputmuons["INC"].reserve(4);
0054   m_inputmuons["IND"].reserve(4);
0055   m_inputmuons["INB"].reserve(4);
0056   m_inputmuons["INF"].reserve(4);
0057 }
0058 
0059 //--------------
0060 // Destructor --
0061 //--------------
0062 L1MuGMTInputEvent::~L1MuGMTInputEvent() {}
0063 
0064 //--------------
0065 // Operations --
0066 //--------------
0067 void L1MuGMTInputEvent::addInputMuon(const std::string chipid, const L1MuRegionalCand& inMu) {
0068   if (m_inputmuons.count(chipid) == 0)
0069     throw std::runtime_error("L1MuGMTInputEvent::addInputMuon: invalid chipid:" + chipid);
0070   m_inputmuons[chipid].push_back(inMu);
0071 }
0072 
0073 void L1MuGMTInputEvent::reset() {
0074   m_runnr = 0L;
0075   m_evtnr = 0L;
0076 
0077   std::map<std::string, std::vector<L1MuRegionalCand> >::iterator it = m_inputmuons.begin();
0078   for (; it != m_inputmuons.end(); it++) {
0079     it->second.clear();
0080   }
0081 
0082   m_mip_bits.reset(false);
0083   m_iso_bits.reset(true);  //see CTOR for info on this
0084 }
0085 
0086 const L1MuRegionalCand* L1MuGMTInputEvent::getInputMuon(std::string chipid, unsigned index) const {
0087   if (m_inputmuons.count(chipid) == 0)
0088     throw std::runtime_error("L1GMTInputEvent::getInputMuon: invalid chipid:" + chipid);
0089 
0090   if (index >= m_inputmuons.find(chipid)->second.size())
0091     return nullptr;
0092   return &(m_inputmuons.find(chipid)->second.at(index));
0093 }