CMS 3D CMS Logo

L1TdeStage2EMTF.cc
Go to the documentation of this file.
1 #include <string>
2 
4 
5 
7  : dataToken(consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("dataSource"))),
8  emulToken(consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("emulSource"))),
9  monitorDir(ps.getUntrackedParameter<std::string>("monitorDir", "")),
10  verbose(ps.getUntrackedParameter<bool>("verbose", false)) {}
11 
13 
15 
16 
18 
20 
21  emtfComparenMuonsEvent = ibooker.book2D("emtfComparenMuonsEvent", "Number of EMTF Muon Cands per Event", 12, 0, 12, 12, 0, 12);
22  for (int axis = 1; axis <= 2; ++axis) {
23  std::string axisTitle = (axis == 1) ? "Data" : "Emulator";
24  emtfComparenMuonsEvent->setAxisTitle(axisTitle, axis);
25  for (int bin = 1; bin <= 12; ++bin) {
26  std::string binLabel = (bin == 12) ? "Overflow" : std::to_string(bin - 1);
27  emtfComparenMuonsEvent->setBinLabel(bin, binLabel, axis);
28  }
29  }
30 
31  emtfDataBX = ibooker.book1D("emtfDataBX", "EMTF Muon Cand BX", 7, -3, 4);
32  emtfDataBX->setAxisTitle("BX", 1);
33 
34  emtfEmulBX = ibooker.book1D("emtfEmulBX", "EMTF Emulated Muon Cand BX", 7, -3, 4);
35  emtfEmulBX->setAxisTitle("BX", 1);
36 
37  for (int bin = 1, bin_label = -3; bin <= 7; ++bin, ++bin_label) {
38  emtfDataBX->setBinLabel(bin, std::to_string(bin_label), 1);
39  emtfEmulBX->setBinLabel(bin, std::to_string(bin_label), 1);
40  }
41 
42  emtfDatahwPt = ibooker.book1D("emtfDatahwPt", "EMTF Muon Cand p_{T}", 512, 0, 512);
43  emtfDatahwPt->setAxisTitle("Hardware p_{T}", 1);
44 
45  emtfEmulhwPt = ibooker.book1D("emtfEmulhwPt", "EMTF Emulated Muon Cand p_{T}", 512, 0, 512);
46  emtfEmulhwPt->setAxisTitle("Hardware p_{T}", 1);
47 
48  emtfDatahwEta = ibooker.book1D("emtfDatahwEta", "EMTF Muon Cand #eta", 460, -230, 230);
49  emtfDatahwEta->setAxisTitle("Hardware #eta", 1);
50 
51  emtfEmulhwEta = ibooker.book1D("emtfEmulhwEta", "EMTF Emulated Muon Cand #eta", 460, -230, 230);
52  emtfEmulhwEta->setAxisTitle("Hardware #eta", 1);
53 
54  emtfDatahwPhi = ibooker.book1D("emtfDatahwPhi", "EMTF Muon Cand #phi", 125, -20, 105);
55  emtfDatahwPhi->setAxisTitle("Hardware #phi", 1);
56 
57  emtfEmulhwPhi = ibooker.book1D("emtfEmulhwPhi", "EMTF Emulated Muon Cand #phi", 125, -20, 105);
58  emtfEmulhwPhi->setAxisTitle("Hardware #phi", 1);
59 
60  emtfDatahwQual = ibooker.book1D("emtfDatahwQual", "EMTF Muon Cand Quality", 16, 0, 16);
61  emtfDatahwQual->setAxisTitle("Quality", 1);
62 
63  emtfEmulhwQual = ibooker.book1D("emtfEmulhwQual", "EMTF Emulated Muon Cand Quality", 16, 0, 16);
64  emtfEmulhwQual->setAxisTitle("Quality", 1);
65 
66  for (int bin = 1; bin <= 16; ++bin) {
67  emtfDatahwQual->setBinLabel(bin, std::to_string(bin - 1), 1);
68  emtfEmulhwQual->setBinLabel(bin, std::to_string(bin - 1), 1);
69  }
70 
71  // Comparison plots reserved for updated emulator.
72  /*emtfComparehwPt = ibooker.book2D("emtfComparehwPt", "EMTF Muon Cand p_{T}", 512, 0, 512, 512, 0, 512);
73  emtfComparehwPt->setAxisTitle("Hardware p_{T}", 1);
74  emtfComparehwPt->setAxisTitle("Emulator Hardware p_{T}", 2);
75 
76  emtfComparehwEta = ibooker.book2D("emtfComparehwEta", "EMTF Muon Cand #eta", 460, -230, 230, 460, -230, 230);
77  emtfComparehwEta->setAxisTitle("Hardware #eta", 1);
78  emtfComparehwEta->setAxisTitle("Emulator Hardware #eta", 2);
79 
80  emtfComparehwPhi = ibooker.book2D("emtfComparehwPhi", "EMTF Muon Cand #phi", 125, -20, 105, 125, -20, 105);
81  emtfComparehwPhi->setAxisTitle("Hardware #phi", 1);
82  emtfComparehwPhi->setAxisTitle("Emulator Hardware #phi", 2);
83 
84  emtfComparehwQual = ibooker.book2D("emtfComparehwQual", "EMTF Muon Cand Quality", 16, 0, 16, 16, 0, 16);
85  for (int axis = 1; axis <= 2; ++axis) {
86  std::string axisTitle = (axis == 1) ? "Quality" : "Emulator Quality";
87  emtfComparehwQual->setAxisTitle(axisTitle, axis);
88  for (int bin = 1; bin <= 16; ++bin) {
89  emtfComparehwQual->setBinLabel(bin, std::to_string(bin - 1), axis);
90  }
91  }*/
92 }
93 
95 
96  if (verbose) edm::LogInfo("L1TdeStage2EMTF") << "L1TdeStage2EMTF: analyze..." << std::endl;
97 
99  e.getByToken(dataToken, dataMuons);
100 
102  e.getByToken(emulToken, emulMuons);
103 
104  emtfComparenMuonsEvent->Fill(dataMuons->size(), emulMuons->size());
105 
106  for (int itBX = dataMuons->getFirstBX(); itBX <= dataMuons->getLastBX(); ++itBX) {
107  for (l1t::RegionalMuonCandBxCollection::const_iterator dataMuon = dataMuons->begin(itBX); dataMuon != dataMuons->end(itBX); ++dataMuon) {
108  emtfDataBX->Fill(itBX);
109  emtfDatahwPt->Fill(dataMuon->hwPt());
110  emtfDatahwEta->Fill(dataMuon->hwEta());
111  emtfDatahwPhi->Fill(dataMuon->hwPhi());
112  emtfDatahwQual->Fill(dataMuon->hwQual());
113  }
114  }
115 
116  for (int itBX = emulMuons->getFirstBX(); itBX <= emulMuons->getLastBX(); ++itBX) {
117  for (l1t::RegionalMuonCandBxCollection::const_iterator emulMuon = emulMuons->begin(itBX); emulMuon != emulMuons->end(itBX); ++emulMuon) {
118  emtfEmulBX->Fill(itBX);
119  emtfEmulhwPt->Fill(emulMuon->hwPt());
120  emtfEmulhwEta->Fill(emulMuon->hwEta());
121  emtfEmulhwPhi->Fill(emulMuon->hwPhi());
122  emtfEmulhwQual->Fill(emulMuon->hwQual());
123  }
124  }
125 }
126 
MonitorElement * emtfEmulhwEta
const_iterator end(int bx) const
MonitorElement * emtfDatahwPhi
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > dataToken
unsigned size(int bx) const
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * emtfDatahwEta
MonitorElement * emtfComparenMuonsEvent
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * emtfEmulhwPt
std::string monitorDir
delete x;
Definition: CaloConfig.h:22
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
void Fill(long long x)
MonitorElement * emtfDatahwQual
~L1TdeStage2EMTF() override
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * emtfEmulhwPhi
MonitorElement * emtfDataBX
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * emtfEmulhwQual
bin
set the eta bin as selection string.
int getFirstBX() const
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > emulToken
L1TdeStage2EMTF(const edm::ParameterSet &ps)
MonitorElement * emtfEmulBX
HLT enums.
MonitorElement * emtfDatahwPt
int getLastBX() const
const_iterator begin(int bx) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: Run.h:45
std::vector< RegionalMuonCand >::const_iterator const_iterator
Definition: BXVector.h:20