File indexing completed on 2024-04-06 12:07:51
0001 #include <string>
0002
0003 #include "DQM/L1TMonitor/interface/L1TdeStage2EMTF.h"
0004
0005 L1TdeStage2EMTF::L1TdeStage2EMTF(const edm::ParameterSet& ps)
0006 : dataToken(consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("dataSource"))),
0007 emulToken(consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("emulSource"))),
0008 monitorDir(ps.getUntrackedParameter<std::string>("monitorDir", "")),
0009 verbose(ps.getUntrackedParameter<bool>("verbose", false)) {}
0010
0011 L1TdeStage2EMTF::~L1TdeStage2EMTF() {}
0012
0013 void L1TdeStage2EMTF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {
0014 ibooker.setCurrentFolder(monitorDir);
0015
0016 emtfComparenMuonsEvent =
0017 ibooker.book2D("emtfComparenMuonsEvent", "Number of EMTF Muon Cands per Event", 12, 0, 12, 12, 0, 12);
0018 for (int axis = 1; axis <= 2; ++axis) {
0019 std::string axisTitle = (axis == 1) ? "Data" : "Emulator";
0020 emtfComparenMuonsEvent->setAxisTitle(axisTitle, axis);
0021 for (int bin = 1; bin <= 12; ++bin) {
0022 std::string binLabel = (bin == 12) ? "Overflow" : std::to_string(bin - 1);
0023 emtfComparenMuonsEvent->setBinLabel(bin, binLabel, axis);
0024 }
0025 }
0026
0027 emtfDataBX = ibooker.book1D("emtfDataBX", "EMTF Muon Cand BX", 7, -3, 4);
0028 emtfDataBX->setAxisTitle("BX", 1);
0029
0030 emtfEmulBX = ibooker.book1D("emtfEmulBX", "EMTF Emulated Muon Cand BX", 7, -3, 4);
0031 emtfEmulBX->setAxisTitle("BX", 1);
0032
0033 for (int bin = 1, bin_label = -3; bin <= 7; ++bin, ++bin_label) {
0034 emtfDataBX->setBinLabel(bin, std::to_string(bin_label), 1);
0035 emtfEmulBX->setBinLabel(bin, std::to_string(bin_label), 1);
0036 }
0037
0038 emtfDatahwPt = ibooker.book1D("emtfDatahwPt", "EMTF Muon Cand p_{T}", 512, 0, 512);
0039 emtfDatahwPt->setAxisTitle("Hardware p_{T}", 1);
0040
0041 emtfEmulhwPt = ibooker.book1D("emtfEmulhwPt", "EMTF Emulated Muon Cand p_{T}", 512, 0, 512);
0042 emtfEmulhwPt->setAxisTitle("Hardware p_{T}", 1);
0043
0044 emtfDatahwEta = ibooker.book1D("emtfDatahwEta", "EMTF Muon Cand #eta", 460, -230, 230);
0045 emtfDatahwEta->setAxisTitle("Hardware #eta", 1);
0046
0047 emtfEmulhwEta = ibooker.book1D("emtfEmulhwEta", "EMTF Emulated Muon Cand #eta", 460, -230, 230);
0048 emtfEmulhwEta->setAxisTitle("Hardware #eta", 1);
0049
0050 emtfDatahwPhi = ibooker.book1D("emtfDatahwPhi", "EMTF Muon Cand #phi", 125, -20, 105);
0051 emtfDatahwPhi->setAxisTitle("Hardware #phi", 1);
0052
0053 emtfEmulhwPhi = ibooker.book1D("emtfEmulhwPhi", "EMTF Emulated Muon Cand #phi", 125, -20, 105);
0054 emtfEmulhwPhi->setAxisTitle("Hardware #phi", 1);
0055
0056 emtfDatahwQual = ibooker.book1D("emtfDatahwQual", "EMTF Muon Cand Quality", 16, 0, 16);
0057 emtfDatahwQual->setAxisTitle("Quality", 1);
0058
0059 emtfEmulhwQual = ibooker.book1D("emtfEmulhwQual", "EMTF Emulated Muon Cand Quality", 16, 0, 16);
0060 emtfEmulhwQual->setAxisTitle("Quality", 1);
0061
0062 for (int bin = 1; bin <= 16; ++bin) {
0063 emtfDatahwQual->setBinLabel(bin, std::to_string(bin - 1), 1);
0064 emtfEmulhwQual->setBinLabel(bin, std::to_string(bin - 1), 1);
0065 }
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 }
0089
0090 void L1TdeStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {
0091 if (verbose)
0092 edm::LogInfo("L1TdeStage2EMTF") << "L1TdeStage2EMTF: analyze..." << std::endl;
0093
0094 edm::Handle<l1t::RegionalMuonCandBxCollection> dataMuons;
0095 e.getByToken(dataToken, dataMuons);
0096
0097 edm::Handle<l1t::RegionalMuonCandBxCollection> emulMuons;
0098 e.getByToken(emulToken, emulMuons);
0099
0100 emtfComparenMuonsEvent->Fill(dataMuons->size(), emulMuons->size());
0101
0102 for (int itBX = dataMuons->getFirstBX(); itBX <= dataMuons->getLastBX(); ++itBX) {
0103 for (l1t::RegionalMuonCandBxCollection::const_iterator dataMuon = dataMuons->begin(itBX);
0104 dataMuon != dataMuons->end(itBX);
0105 ++dataMuon) {
0106 emtfDataBX->Fill(itBX);
0107 emtfDatahwPt->Fill(dataMuon->hwPt());
0108 emtfDatahwEta->Fill(dataMuon->hwEta());
0109 emtfDatahwPhi->Fill(dataMuon->hwPhi());
0110 emtfDatahwQual->Fill(dataMuon->hwQual());
0111 }
0112 }
0113
0114 for (int itBX = emulMuons->getFirstBX(); itBX <= emulMuons->getLastBX(); ++itBX) {
0115 for (l1t::RegionalMuonCandBxCollection::const_iterator emulMuon = emulMuons->begin(itBX);
0116 emulMuon != emulMuons->end(itBX);
0117 ++emulMuon) {
0118 emtfEmulBX->Fill(itBX);
0119 emtfEmulhwPt->Fill(emulMuon->hwPt());
0120 emtfEmulhwEta->Fill(emulMuon->hwEta());
0121 emtfEmulhwPhi->Fill(emulMuon->hwPhi());
0122 emtfEmulhwQual->Fill(emulMuon->hwQual());
0123 }
0124 }
0125 }