CMS 3D CMS Logo

L1TStage2CaloLayer2DEClientSummary.cc
Go to the documentation of this file.
2 
4  const edm::ParameterSet& ps):
5  monitor_dir_(ps.getUntrackedParameter<std::string>("monitorDir","")),
6  hlSummary(nullptr),
7  jetSummary(nullptr),
8  egSummary(nullptr),
9  tauSummary(nullptr),
10  sumSummary(nullptr)
11 {}
12 
14 
16  DQMStore::IBooker &ibooker,
17  DQMStore::IGetter &igetter,
18  const edm::LuminosityBlock& lumiSeg,
19  const edm::EventSetup& c) {
20 
21  book(ibooker);
22  processHistograms(igetter);
23 }
24 
26  DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
27 
28  book(ibooker);
29  processHistograms(igetter);
30 }
31 
33 
35  if (hlSummary == nullptr) {
36  hlSummary = ibooker.book1D(
37  "High level summary", "Event by event comparison summary", 5, 1, 6);
38  hlSummary->setBinLabel(1, "good events");
39  hlSummary->setBinLabel(2, "good jets");
40  hlSummary->setBinLabel(3, "good e/gs");
41  hlSummary->setBinLabel(4, "good taus");
42  hlSummary->setBinLabel(5, "good sums");
43  } else {
44  hlSummary->Reset();
45  }
46 
47  if (jetSummary == nullptr) {
48  jetSummary = ibooker.book1D(
49  "Jet Agreement Summary", "Jet Agreement Summary", 3, 1, 4);
50  jetSummary->setBinLabel(1, "good jets");
51  jetSummary->setBinLabel(2, "jets pos off only");
52  jetSummary->setBinLabel(3, "jets Et off only ");
53  } else {
54  jetSummary->Reset();
55  }
56 
57  if (egSummary == nullptr) {
58  egSummary = ibooker.book1D(
59  "EG Agreement Summary", "EG Agreement Summary", 6, 1, 7);
60  egSummary->setBinLabel(1, "good non-iso e/gs");
61  egSummary->setBinLabel(2, "non-iso e/gs pos off");
62  egSummary->setBinLabel(3, "non-iso e/gs Et off");
63  egSummary->setBinLabel(4, "good iso e/gs");
64  egSummary->setBinLabel(5, "iso e/gs pos off");
65  egSummary->setBinLabel(6, "iso e/gs Et off");
66  } else {
67  egSummary->Reset();
68  }
69 
70  if (tauSummary == nullptr) {
71  tauSummary = ibooker.book1D(
72  "Tau Agreement Summary", "Tau Agremeent Summary", 6, 1, 7);
73  tauSummary->setBinLabel(1, "good non-iso taus");
74  tauSummary->setBinLabel(2, "non-iso taus pos off");
75  tauSummary->setBinLabel(3, "non-iso taus Et off");
76  tauSummary->setBinLabel(4, "good iso taus");
77  tauSummary->setBinLabel(5, "iso taus pos off");
78  tauSummary->setBinLabel(6, "iso taus Et off");
79  } else {
80  tauSummary->Reset();
81  }
82 
83  if (sumSummary == nullptr) {
84  sumSummary = ibooker.book1D(
85  "Energy Sum Agreement Summary", "Sum Agreement Summary", 9, 1, 10);
86  sumSummary->setBinLabel(1, "good sums");
87  sumSummary->setBinLabel(2, "good ETT sums");
88  sumSummary->setBinLabel(3, "good HTT sums");
89  sumSummary->setBinLabel(4, "good MET sums");
90  sumSummary->setBinLabel(5, "good MHT sums");
91  sumSummary->setBinLabel(6, "good MBHF sums");
92  sumSummary->setBinLabel(7, "good TowCount sums");
93  sumSummary->setBinLabel(8, "good AsymCount sums");
94  sumSummary->setBinLabel(9, "good CentrCount sums");
95  } else {
96  sumSummary->Reset();
97  }
98 
99 }
100 
102 
103  // get reference to relevant summary MonitorElement instances
104  // - high level summary
105  // - eg agreement summary
106  // - energy sum agreement summary
107  // - jet agreement summary
108  // - tau agreement summary
109 
110  // TH1F * hist;
111  // TH1F * newHist;
112 
113  MonitorElement * hlSummary_ = igetter.get(
114  monitor_dir_+"/expert/CaloL2 Object Agreement Summary");
115  MonitorElement * jetSummary_ = igetter.get(
116  monitor_dir_+"/expert/Jet Agreement Summary");
117  MonitorElement * egSummary_ = igetter.get(
118  monitor_dir_+"/expert/EG Agreement Summary");
119  MonitorElement * tauSummary_ = igetter.get(
120  monitor_dir_+"/expert/Tau Agreement Summary");
121  MonitorElement * sumSummary_ = igetter.get(
122  monitor_dir_+"/expert/Energy Sum Agreement Summary");
123 
124  // check for existance of object
125  if (hlSummary_) {
126 
127  // reference the histogram in MonitorElement
128  // hist = hlSummary_->getTH1F();
129  // newHist = hlSummary->getTH1F();
130 
131  // double totalEvents = 0, goodEvents = 0, totalJets = 0, goodJets = 0,
132  // totalEg = 0, goodEg = 0, totalTau = 0, goodTau = 0, totalSums = 0,
133  // goodSums = 0;
134 
135  // by default show 0% agreement (for edge case when no objects are found)
136  double evtRatio = 0, jetRatio = 0, egRatio = 0, tauRatio = 0, sumRatio = 0;
137 
138  double totalEvents = hlSummary_->getBinContent(1);
139  double goodEvents = hlSummary_->getBinContent(2);
140  double totalJets = hlSummary_->getBinContent(3);
141  double goodJets = hlSummary_->getBinContent(4);
142  double totalEg = hlSummary_->getBinContent(5);
143  double goodEg = hlSummary_->getBinContent(6);
144  double totalTau = hlSummary_->getBinContent(7);
145  double goodTau = hlSummary_->getBinContent(8);
146  double totalSums = hlSummary_->getBinContent(9);
147  double goodSums = hlSummary_->getBinContent(10);
148 
149  if (totalEvents != 0)
150  evtRatio = goodEvents / totalEvents;
151 
152  if (totalJets != 0)
153  jetRatio = goodJets / totalJets;
154 
155  if (totalEg != 0)
156  egRatio = goodEg / totalEg;
157 
158  if (totalTau != 0)
159  tauRatio = goodTau / totalTau;
160 
161  if (totalSums != 0)
162  sumRatio = goodSums / totalSums;
163 
164  hlSummary->setBinContent(1, evtRatio);
165  hlSummary->setBinContent(2, jetRatio);
166  hlSummary->setBinContent(3, egRatio);
167  hlSummary->setBinContent(4, tauRatio);
168  hlSummary->setBinContent(5, sumRatio);
169  }
170 
171  if (jetSummary_) {
172 
173  // double totalJets = 0, goodJets = 0, jetPosOff = 0, jetEtOff = 0;
174 
175  // by default show 0% agreement (for edge case when no objects are found)
176  double goodRatio = 0, posOffRatio = 0, etOffRatio = 0;
177 
178  // hist = jetSummary_->getTH1F();
179  // newHist = jetSummary->getTH1F();
180 
181  double totalJets = jetSummary_->getBinContent(1);
182  double goodJets = jetSummary_->getBinContent(2);
183  double jetPosOff = jetSummary_->getBinContent(3);
184  double jetEtOff = jetSummary_->getBinContent(4);
185 
186  if (totalJets != 0) {
187  goodRatio = goodJets / totalJets;
188  posOffRatio = jetPosOff / totalJets;
189  etOffRatio = jetEtOff / totalJets;
190  }
191 
192  jetSummary->setBinContent(1, goodRatio);
193  jetSummary->setBinContent(2, posOffRatio);
194  jetSummary->setBinContent(3, etOffRatio);
195  }
196 
197  if (egSummary_) {
198 
199  // double totalEgs = 0, goodEgs = 0, egPosOff = 0, egEtOff = 0,
200  // totalIsoEgs = 0, goodIsoEgs = 0, isoEgPosOff = 0, isoEgEtOff = 0;
201 
202  // by default show 0% agreement (for edge case when no objects are found)
203  double goodEgRatio = 0, egPosOffRatio = 0, egEtOffRatio = 0,
204  goodIsoEgRatio = 0, isoEgPosOffRatio = 0, isoEgEtOffRatio = 0;
205 
206  // hist = egSummary_->getTH1F();
207  // newHist = egSummary->getTH1F();
208 
209  double totalEgs = egSummary_->getBinContent(1);
210  double goodEgs = egSummary_->getBinContent(2);
211  double egPosOff = egSummary_->getBinContent(3);
212  double egEtOff = egSummary_->getBinContent(4);
213 
214  double totalIsoEgs = egSummary_->getBinContent(5);
215  double goodIsoEgs = egSummary_->getBinContent(6);
216  double isoEgPosOff = egSummary_->getBinContent(7);
217  double isoEgEtOff = egSummary_->getBinContent(8);
218 
219  if (totalEgs != 0) {
220  goodEgRatio = goodEgs / totalEgs;
221  egPosOffRatio = egPosOff / totalEgs;
222  egEtOffRatio = egEtOff / totalEgs;
223  }
224 
225  if (totalIsoEgs != 0) {
226  goodIsoEgRatio = goodIsoEgs / totalIsoEgs;
227  isoEgPosOffRatio = isoEgPosOff / totalIsoEgs;
228  isoEgEtOffRatio = isoEgEtOff / totalIsoEgs;
229  }
230 
231  egSummary->setBinContent(1, goodEgRatio);
232  egSummary->setBinContent(2, egPosOffRatio);
233  egSummary->setBinContent(3, egEtOffRatio);
234 
235  egSummary->setBinContent(4, goodIsoEgRatio);
236  egSummary->setBinContent(5, isoEgPosOffRatio);
237  egSummary->setBinContent(6, isoEgEtOffRatio);
238  }
239 
240  if (tauSummary_) {
241 
242  // double totalTaus = 0, goodTaus = 0, tauPosOff = 0, tauEtOff = 0,
243  // totalIsoTaus = 0, goodIsoTaus = 0, isoTauPosOff = 0, isoTauEtOff = 0;
244 
245  // by default show 0% agreement (for edge case when no objects are found)
246  double goodTauRatio = 0, tauPosOffRatio = 0, tauEtOffRatio = 0,
247  goodIsoTauRatio = 0, isoTauPosOffRatio= 0, isoTauEtOffRatio = 0;
248 
249  // hist = tauSummary_->getTH1F();
250  // newHist = tauSummary->getTH1F();
251 
252  double totalTaus = tauSummary_->getBinContent(1);
253  double goodTaus = tauSummary_->getBinContent(2);
254  double tauPosOff = tauSummary_->getBinContent(3);
255  double tauEtOff = tauSummary_->getBinContent(4);
256 
257  double totalIsoTaus = tauSummary_->getBinContent(5);
258  double goodIsoTaus = tauSummary_->getBinContent(6);
259  double isoTauPosOff = tauSummary_->getBinContent(7);
260  double isoTauEtOff = tauSummary_->getBinContent(8);
261 
262  if (totalTaus != 0) {
263  goodTauRatio = goodTaus / totalTaus;
264  tauPosOffRatio = tauPosOff / totalTaus;
265  tauEtOffRatio = tauEtOff / totalTaus;
266  }
267 
268  if (totalIsoTaus != 0) {
269  goodIsoTauRatio = goodIsoTaus / totalIsoTaus;
270  isoTauPosOffRatio = isoTauPosOff / totalIsoTaus;
271  isoTauEtOffRatio = isoTauEtOff / totalIsoTaus;
272  }
273 
274  tauSummary->setBinContent(1, goodTauRatio);
275  tauSummary->setBinContent(2, tauPosOffRatio);
276  tauSummary->setBinContent(3, tauEtOffRatio);
277 
278  tauSummary->setBinContent(4, goodIsoTauRatio);
279  tauSummary->setBinContent(5, isoTauPosOffRatio);
280  tauSummary->setBinContent(6, isoTauEtOffRatio);
281  }
282 
283  if (sumSummary_) {
284 
285  // double totalSums = 0, goodSums = 0, totalETT = 0, goodETT = 0, totalHTT = 0,
286  // goodHTT = 0, totalMET = 0, goodMET = 0, totalMHT = 0, goodMHT = 0,
287  // totalMBHF = 0, goodMBHF = 0, totalTowCount = 0, goodTowCount = 0
288 
289  // by default show 0% agreement (for edge case when no objects are found)
290  double goodSumRatio = 0, goodETTRatio = 0, goodHTTRatio = 0,
291  goodMETRatio = 0, goodMHTRatio = 0, goodMBHFRatio = 0,
292  goodTowCountRatio = 0, goodAsymCountRatio = 0, goodCentrCountRatio = 0;
293 
294  double totalSums = sumSummary_->getBinContent(1);
295  double goodSums = sumSummary_->getBinContent(2);
296  double totalETT = sumSummary_->getBinContent(3);
297  double goodETT = sumSummary_->getBinContent(4);
298  double totalHTT = sumSummary_->getBinContent(5);
299  double goodHTT = sumSummary_->getBinContent(6);
300  double totalMET = sumSummary_->getBinContent(7);
301  double goodMET = sumSummary_->getBinContent(8);
302  double totalMHT = sumSummary_->getBinContent(9);
303  double goodMHT = sumSummary_->getBinContent(10);
304  double totalMBHF = sumSummary_->getBinContent(11);
305  double goodMBHF = sumSummary_->getBinContent(12);
306  double totalTowCount = sumSummary_->getBinContent(13);
307  double goodTowCount = sumSummary_->getBinContent(14);
308  double totalAsymCount= sumSummary_->getBinContent(15);
309  double goodAsymCount = sumSummary_->getBinContent(16);
310  double totalCentrCount= sumSummary_->getBinContent(17);
311  double goodCentrCount = sumSummary_->getBinContent(18);
312  if (totalSums)
313  goodSumRatio = goodSums / totalSums;
314 
315  if (totalETT)
316  goodETTRatio = goodETT / totalETT;
317 
318  if (totalHTT)
319  goodHTTRatio = goodHTT / totalHTT;
320 
321  if (totalMET)
322  goodMETRatio = goodMET / totalMET;
323 
324  if (totalMHT)
325  goodMHTRatio = goodMHT / totalMHT;
326 
327  if (totalMBHF)
328  goodMBHFRatio = goodMBHF / totalMBHF;
329 
330  if (totalTowCount)
331  goodTowCountRatio = goodTowCount / totalTowCount;
332 
333  if (totalAsymCount)
334  goodAsymCountRatio = goodAsymCount / totalAsymCount;
335 
336  if (totalCentrCount)
337  goodCentrCountRatio = goodCentrCount / totalCentrCount;
338 
339  sumSummary->setBinContent(1, goodSumRatio);
340  sumSummary->setBinContent(2, goodETTRatio);
341  sumSummary->setBinContent(3, goodHTTRatio);
342  sumSummary->setBinContent(4, goodMETRatio);
343  sumSummary->setBinContent(5, goodMHTRatio);
344  sumSummary->setBinContent(6, goodMBHFRatio);
345  sumSummary->setBinContent(7, goodTowCountRatio);
346  sumSummary->setBinContent(8, goodAsymCountRatio);
347  sumSummary->setBinContent(9, goodCentrCountRatio);
348  }
349 
350  }
void setBinContent(int binx, double content)
set content of bin (1-D)
#define nullptr
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)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
L1TStage2CaloLayer2DEClientSummary(const edm::ParameterSet &)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
double getBinContent(int binx) const
get content of bin (1-D)
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override