File indexing completed on 2023-03-17 11:11:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTInputEvent.h"
0020
0021
0022
0023
0024 #include <stdexcept>
0025
0026
0027
0028
0029 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatrix.h"
0030
0031 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
0032
0033
0034
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)
0041
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
0050
0051
0052
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
0061
0062 L1MuGMTInputEvent::~L1MuGMTInputEvent() {}
0063
0064
0065
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);
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 }