File indexing completed on 2024-04-06 12:19:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021 #include <vector>
0022
0023
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031
0032 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
0033 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
0034
0035
0036
0037
0038 class L1GmtTriggerSource : public edm::one::EDAnalyzer<> {
0039 public:
0040 explicit L1GmtTriggerSource(const edm::ParameterSet&);
0041 ~L1GmtTriggerSource() override;
0042
0043 private:
0044 void beginJob() override;
0045 void analyze(const edm::Event&, const edm::EventSetup&) override;
0046 void endJob() override;
0047
0048
0049 edm::InputTag m_GMTInputTag;
0050 };
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 L1GmtTriggerSource::L1GmtTriggerSource(const edm::ParameterSet& ps)
0064
0065 {
0066
0067 m_GMTInputTag = ps.getParameter<edm::InputTag>("GMTInputTag");
0068 }
0069
0070 L1GmtTriggerSource::~L1GmtTriggerSource() {
0071
0072
0073 }
0074
0075
0076
0077
0078
0079
0080 void L1GmtTriggerSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0081 using namespace edm;
0082
0083 edm::Handle<L1MuGMTReadoutCollection> gmtrc_handle;
0084 iEvent.getByLabel(m_GMTInputTag, gmtrc_handle);
0085 L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
0086
0087 bool dt_l1a = false;
0088 bool csc_l1a = false;
0089 bool halo_l1a = false;
0090 bool rpcb_l1a = false;
0091 bool rpcf_l1a = false;
0092
0093 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
0094 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
0095
0096 for (igmtrr = gmt_records.begin(); igmtrr != gmt_records.end(); igmtrr++) {
0097 std::vector<L1MuRegionalCand>::const_iterator iter1;
0098 std::vector<L1MuRegionalCand> rmc;
0099
0100
0101 int idt = 0;
0102 rmc = igmtrr->getDTBXCands();
0103 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0104 if (!(*iter1).empty()) {
0105 idt++;
0106 }
0107 }
0108
0109 if (idt > 0)
0110 std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = " << igmtrr->getBxInEvent() << std::endl;
0111 if (igmtrr->getBxInEvent() == 0 && idt > 0)
0112 dt_l1a = true;
0113
0114
0115 int icsc = 0;
0116 int ihalo = 0;
0117 rmc = igmtrr->getCSCCands();
0118 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0119 if (!(*iter1).empty()) {
0120 if ((*iter1).isFineHalo()) {
0121 ihalo++;
0122 } else {
0123 icsc++;
0124 }
0125 }
0126 }
0127
0128 if (icsc > 0)
0129 std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = " << igmtrr->getBxInEvent() << std::endl;
0130 if (ihalo > 0)
0131 std::cout << "Found " << ihalo << " valid CSC halo candidates in bx wrt. L1A = " << igmtrr->getBxInEvent()
0132 << std::endl;
0133 if (igmtrr->getBxInEvent() == 0 && icsc > 0)
0134 csc_l1a = true;
0135 if (igmtrr->getBxInEvent() == 0 && ihalo > 0)
0136 halo_l1a = true;
0137
0138
0139 int irpcb = 0;
0140 rmc = igmtrr->getBrlRPCCands();
0141 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0142 if (!(*iter1).empty()) {
0143 irpcb++;
0144 }
0145 }
0146
0147 if (irpcb > 0)
0148 std::cout << "Found " << irpcb << " valid barrel RPC candidates in bx wrt. L1A = " << igmtrr->getBxInEvent()
0149 << std::endl;
0150 if (igmtrr->getBxInEvent() == 0 && irpcb > 0)
0151 rpcb_l1a = true;
0152
0153
0154 int irpcf = 0;
0155 rmc = igmtrr->getFwdRPCCands();
0156 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
0157 if (!(*iter1).empty()) {
0158 irpcf++;
0159 }
0160 }
0161
0162 if (irpcf > 0)
0163 std::cout << "Found " << irpcf << " valid endcap RPC candidates in bx wrt. L1A = " << igmtrr->getBxInEvent()
0164 << std::endl;
0165 if (igmtrr->getBxInEvent() == 0 && irpcf > 0)
0166 rpcf_l1a = true;
0167 }
0168
0169 std::cout << "**** L1 Muon Trigger Source ****" << std::endl;
0170 if (dt_l1a)
0171 std::cout << "DT" << std::endl;
0172 if (csc_l1a)
0173 std::cout << "CSC" << std::endl;
0174 if (halo_l1a)
0175 std::cout << "CSC halo" << std::endl;
0176 if (rpcb_l1a)
0177 std::cout << "barrel RPC" << std::endl;
0178 if (rpcf_l1a)
0179 std::cout << "endcap RPC" << std::endl;
0180 std::cout << "************************" << std::endl;
0181 }
0182
0183
0184 void L1GmtTriggerSource::beginJob() {}
0185
0186
0187 void L1GmtTriggerSource::endJob() {}
0188
0189
0190 DEFINE_FWK_MODULE(L1GmtTriggerSource);