CMS 3D CMS Logo

SiPixelPhase1Summary.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1Summary
4 // Class: SiPixelPhase1Summary
5 //
13 //
14 // Original Author: Duncan Leggat
15 // Created: 5th December 2016
16 //
17 //
19 // Framework
23 // DQM Framework
26 // Geometry
32 // DataFormats
39 //
40 #include <string>
41 #include <cstdlib>
42 #include <iostream>
43 #include <fstream>
44 #include <sstream>
45 
46 using namespace std;
47 using namespace edm;
48 
49 SiPixelPhase1Summary::SiPixelPhase1Summary(const edm::ParameterSet& iConfig) : conf_(iConfig), firstLumi(true) {
50  LogInfo("PixelDQM") << "SiPixelPhase1Summary::SiPixelPhase1Summary: Got DQM BackEnd interface" << endl;
51  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
52  runOnEndLumi_ = conf_.getParameter<bool>("RunOnEndLumi");
53  runOnEndJob_ = conf_.getParameter<bool>("RunOnEndJob");
54 
55  std::vector<edm::ParameterSet> mapPSets = conf_.getParameter<std::vector<edm::ParameterSet> >("SummaryMaps");
56 
57  //Go through the configuration file and add in
58  for (auto const& mapPSet : mapPSets) {
59  summaryPlotName_[mapPSet.getParameter<std::string>("MapName")] = mapPSet.getParameter<std::string>("MapHist");
60  }
61  deadRocThresholds_ = conf_.getParameter<std::vector<double> >("DeadROCErrorThreshold");
62 }
63 
65  // do anything here that needs to be done at desctruction time
66  // (e.g. close files, deallocate resources etc.)
67  LogInfo("PixelDQM") << "SiPixelPhase1Summary::~SiPixelPhase1Summary: Destructor" << endl;
68 }
69 
71 
73  DQMStore::IGetter& iGetter,
74  const edm::LuminosityBlock& lumiSeg,
75  edm::EventSetup const& c) {
76  if (firstLumi) {
77  bookSummaries(iBooker);
78  bookTrendPlots(iBooker);
79  firstLumi = false;
80  }
81 
82  if (runOnEndLumi_) {
83  int lumiSec = lumiSeg.id().luminosityBlock();
84  fillTrendPlots(iBooker, iGetter, lumiSec);
85  fillSummaries(iBooker, iGetter);
86  }
87 
88  // iBooker.cd();
89 }
90 
91 //------------------------------------------------------------------
92 // Method called for every event
93 //------------------------------------------------------------------
95  if (firstLumi) { //Book the plots in the (maybe possible?) case that they aren't booked in the dqmEndLuminosityBlock method
96  bookSummaries(iBooker);
97  bookTrendPlots(iBooker);
98  firstLumi = false;
99  }
100  if (runOnEndJob_) {
101  if (!runOnEndLumi_)
103  iBooker,
104  iGetter); //If we're filling these plots at the end lumi step, it doesn't really make sense to also do them at the end job
105  fillSummaries(iBooker, iGetter);
106  }
107 }
108 
109 //------------------------------------------------------------------
110 // Used to book the summary plots
111 //------------------------------------------------------------------
113  iBooker.cd();
114 
115  std::vector<std::string> xAxisLabels_ = {"BMO",
116  "BMI",
117  "BPO ",
118  "BPI",
119  "HCMO_1",
120  "HCMO_2",
121  "HCMI_1",
122  "HCMI_2",
123  "HCPO_1",
124  "HCPO_2",
125  "HCPI_1",
126  "HCPI_2"}; // why not having a global variable !?!?!?!
127  std::vector<std::string> yAxisLabels_ = {
128  "1",
129  "2",
130  "3",
131  "4"}; // why not having a global variable ?!?!?!!? - I originally did, but was told not to by David Lange!
132 
133  iBooker.setCurrentFolder("PixelPhase1/Summary");
134  //Book the summary plots for the variables as described in the config file
135  for (auto mapInfo : summaryPlotName_) {
136  auto name = mapInfo.first;
137  summaryMap_[name] = iBooker.book2D("pixel" + name + "Summary", "Pixel " + name + " Summary", 12, 0, 12, 4, 0, 4);
138  }
139  //Make the new 6 bin ROC summary
140  deadROCSummary = iBooker.book2D("deadROCSummary", "Percentage of dead ROCs per layer/ring", 2, 0, 2, 4, 0, 4);
141  std::vector<std::string> xAxisLabelsReduced_ = {"Barrel", "Forward"};
142  deadROCSummary->setAxisTitle("Subdetector", 1);
143  for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++) {
144  deadROCSummary->setBinLabel(i + 1, xAxisLabelsReduced_[i]);
145  }
146 
147  //New residual plots for the PXBarrel separated by inner and outer modules per layer
148  iBooker.setCurrentFolder("PixelPhase1/Tracks/PXBarrel");
149  for (std::string layer : {"1", "2", "3", "4"}) {
150  float mean_range = 100.;
151  float rms_range = 200.;
152  if (layer == "1") {
153  mean_range = 200.;
154  rms_range = 1000.;
155  }
156  residuals_["residual_mean_x_Inner_PXLayer_" + layer] =
157  iBooker.book1D("residual_mean_x_Inner_PXLayer_" + layer,
158  "Mean Track Residuals X Inner Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
159  100,
160  -1 * mean_range,
161  mean_range);
162  residuals_["residual_mean_x_Outer_PXLayer_" + layer] =
163  iBooker.book1D("residual_mean_x_Outer_PXLayer_" + layer,
164  "Mean Track Residuals X Outer Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
165  100,
166  -1 * mean_range,
167  mean_range);
168  residuals_["residual_mean_y_Inner_PXLayer_" + layer] =
169  iBooker.book1D("residual_mean_y_Inner_PXLayer_" + layer,
170  "Mean Track Residuals Y Inner Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
171  100,
172  -1 * mean_range,
173  mean_range);
174  residuals_["residual_mean_y_Outer_PXLayer_" + layer] =
175  iBooker.book1D("residual_mean_y_Outer_PXLayer_" + layer,
176  "Mean Track Residuals Y Outer Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
177  100,
178  -1 * mean_range,
179  mean_range);
180 
181  residuals_["residual_rms_x_Inner_PXLayer_" + layer] =
182  iBooker.book1D("residual_rms_x_Inner_PXLayer_" + layer,
183  "RMS of Track Residuals X Inner Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
184  100,
185  0.,
186  rms_range);
187  residuals_["residual_rms_x_Outer_PXLayer_" + layer] =
188  iBooker.book1D("residual_rms_x_Outer_PXLayer_" + layer,
189  "RMS of Track Residuals X Outer Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
190  100,
191  0.,
192  rms_range);
193  residuals_["residual_rms_y_Inner_PXLayer_" + layer] =
194  iBooker.book1D("residual_rms_y_Inner_PXLayer_" + layer,
195  "RMS of Track Residuals Y Inner Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
196  100,
197  0.,
198  rms_range);
199  residuals_["residual_rms_y_Outer_PXLayer_" + layer] =
200  iBooker.book1D("residual_rms_y_Outer_PXLayer_" + layer,
201  "RMS of Track Residuals Y Outer Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
202  100,
203  0.,
204  rms_range);
205  }
206 
207  //New residual plots for the PXForward separated by inner and outer modules
208  iBooker.setCurrentFolder("PixelPhase1/Tracks/PXForward");
209  residuals_["residual_mean_x_Inner"] = iBooker.book1D(
210  "residual_mean_x_Inner", "Mean Track Residuals X Inner Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
211  residuals_["residual_mean_x_Outer"] = iBooker.book1D(
212  "residual_mean_x_Outer", "Mean Track Residuals X Outer Modules;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
213  residuals_["residual_mean_y_Inner"] = iBooker.book1D(
214  "residual_mean_y_Inner", "Mean Track Residuals Y Inner Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
215  residuals_["residual_mean_y_Outer"] = iBooker.book1D(
216  "residual_mean_y_Outer", "Mean Track Residuals Y Outer Modules;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
217 
218  residuals_["residual_rms_x_Inner"] = iBooker.book1D(
219  "residual_rms_x_Inner", "RMS of Track Residuals X Inner Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
220  residuals_["residual_rms_x_Outer"] = iBooker.book1D(
221  "residual_rms_x_Outer", "RMS of Track Residuals X Outer Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
222  residuals_["residual_rms_y_Inner"] = iBooker.book1D(
223  "residual_rms_y_Inner", "RMS of Track Residuals Y Inner Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
224  residuals_["residual_rms_y_Outer"] = iBooker.book1D(
225  "residual_rms_y_Outer", "RMS of Track Residuals Y Outer Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
226 
227  //New residual plots for the PXForward separated by positive and negative side
228  iBooker.setCurrentFolder("PixelPhase1/Tracks/PXForward");
229  residuals_["residual_mean_x_pos"] = iBooker.book1D(
230  "residual_mean_x_pos", "Mean Track Residuals X pos. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
231  residuals_["residual_mean_x_neg"] = iBooker.book1D(
232  "residual_mean_x_neg", "Mean Track Residuals X neg. Side;mean(x_rec-x_pred)[#mum]", 100, -100., 100.);
233  residuals_["residual_mean_y_pos"] = iBooker.book1D(
234  "residual_mean_y_pos", "Mean Track Residuals Y pos. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
235  residuals_["residual_mean_y_neg"] = iBooker.book1D(
236  "residual_mean_y_neg", "Mean Track Residuals Y neg. Side;mean(y_rec-y_pred)[#mum]", 100, -100., 100.);
237 
238  residuals_["residual_rms_x_pos"] =
239  iBooker.book1D("residual_rms_x_pos", "RMS of Track Residuals X pos. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
240  residuals_["residual_rms_x_neg"] =
241  iBooker.book1D("residual_rms_x_neg", "RMS of Track Residuals X neg. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
242  residuals_["residual_rms_y_pos"] =
243  iBooker.book1D("residual_rms_y_pos", "RMS of Track Residuals Y pos. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
244  residuals_["residual_rms_y_neg"] =
245  iBooker.book1D("residual_rms_y_neg", "RMS of Track Residuals Y neg. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
246 
247  //Book the summary plot
248  iBooker.setCurrentFolder("PixelPhase1/EventInfo");
249 
250  if (runOnEndLumi_) {
251  //New less granular summary plot - this is currently only done online
252  summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap", "Pixel Summary Map", 2, 0, 2, 4, 0, 4);
253  summaryMap_["Grand"]->setAxisTitle("Subdetector", 1);
254  for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++) {
255  summaryMap_["Grand"]->setBinLabel(i + 1, xAxisLabelsReduced_[i]);
256  for (unsigned int j = 0; j < 4; j++) {
257  summaryMap_["Grand"]->Fill(i, j, -1);
258  }
259  }
260  } else {
261  //Book the original summary plot, for now juts doing this one offline.
262  summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap", "Pixel Summary Map", 12, 0, 12, 4, 0, 4);
263  }
264 
265  reportSummary = iBooker.bookFloat("reportSummary");
266 
267  //Now set up axis and bin labels
268  for (auto summaryMapEntry : summaryMap_) {
269  if (summaryMapEntry.first == "Grand")
270  continue;
271  auto summaryMap = summaryMapEntry.second;
272  for (unsigned int i = 0; i < xAxisLabels_.size(); i++) {
273  summaryMap->setBinLabel(i + 1, xAxisLabels_[i], 1);
274  }
275  for (unsigned int i = 0; i < yAxisLabels_.size(); i++) {
276  summaryMap->setBinLabel(i + 1, yAxisLabels_[i], 2);
277  }
278  summaryMap->setAxisTitle("Subdetector", 1);
279  summaryMap->setAxisTitle("Layer/disk", 2);
280  for (int i = 0; i < summaryMap->getTH1()->GetXaxis()->GetNbins(); i++) { // !??!?!? xAxisLabels_.size() ?!?!
281  for (int j = 0; j < summaryMap->getTH1()->GetYaxis()->GetNbins(); j++) { // !??!?!? yAxisLabels_.size() ?!?!?!
282  summaryMap->Fill(i, j, -1.);
283  }
284  }
285  }
286  reportSummary->Fill(-1.);
287 
288  //Reset the iBooker
289  iBooker.setCurrentFolder("PixelPhase1/");
290 }
291 
292 //------------------------------------------------------------------
293 // Used to book the trend plots
294 //------------------------------------------------------------------
296  //We need different plots depending on if we're online (runOnEndLumi) or offline (!runOnEndLumi)
297  iBooker.setCurrentFolder("PixelPhase1/");
298  std::vector<string> binAxisLabels = {"Layer 1", "Layer 2", "Layer 3", "Layer 4", "Ring 1", "Ring 2"};
299  if (runOnEndLumi_) {
300  std::vector<trendPlots> histoOrder = {layer1, layer2, layer3, layer4, ring1, ring2};
301  std::vector<string> varName = {"Layer_1", "Layer_2", "Layer_3", "Layer_4", "Ring_1", "Ring_2"};
302  std::vector<int> yMax = {1536, 3584, 5632, 8192, 4224, 6528};
303  for (unsigned int i = 0; i < histoOrder.size(); i++) {
304  string varNameStr = "deadRocTrend" + varName[i];
305  string varTitle = binAxisLabels[i] + " dead ROC trend";
306  deadROCTrends_[histoOrder[i]] = iBooker.bookProfile(varNameStr, varTitle, 500, 0., 5000, 0., yMax[i], "");
307  varNameStr = "ineffRocTrend" + varName[i];
308  varTitle = binAxisLabels[i] + " inefficient ROC trend";
309  ineffROCTrends_[histoOrder[i]] = iBooker.bookProfile(varNameStr, varTitle, 500, 0., 5000, 0., yMax[i], "");
310  deadROCTrends_[histoOrder[i]]->setAxisTitle("Lumisection", 1);
311  ineffROCTrends_[histoOrder[i]]->setAxisTitle("Lumisection", 1);
312  }
313  } else {
314  deadROCTrends_[offline] = iBooker.bookProfile("deadRocTotal", "N dead ROCs", 6, 0., 6, 0., 8192, "");
315  ineffROCTrends_[offline] = iBooker.bookProfile("ineffRocTotal", "N inefficient ROCs", 6, 0., 6, 0., 8192, "");
316  deadROCTrends_[offline]->setAxisTitle("Subdetector", 1);
317  ineffROCTrends_[offline]->setAxisTitle("Subdetector", 1);
318  for (unsigned int i = 1; i <= binAxisLabels.size(); i++) {
319  deadROCTrends_[offline]->setBinLabel(i, binAxisLabels[i - 1]);
320  ineffROCTrends_[offline]->setBinLabel(i, binAxisLabels[i - 1]);
321  }
322  }
323 }
324 
325 //------------------------------------------------------------------
326 // Fill the summary histograms
327 //------------------------------------------------------------------
329  //Firstly, we will fill the regular summary maps.
330  for (auto mapInfo : summaryPlotName_) {
331  auto name = mapInfo.first;
332  std::ostringstream histNameStream;
333  std::string histName;
334 
335  for (int i = 0; i < 12; i++) { // !??!?!? xAxisLabels_.size() ?!?!
336  for (int j = 0; j < 4; j++) { // !??!?!? yAxisLabels_.size() ?!?!?!
337  if (i > 3 && j == 3)
338  continue;
339  bool minus = i < 2 || (i > 3 && i < 8); // bleah !
340  int iOver2 = floor(i / 2.);
341  bool outer = (i > 3) ? iOver2 % 2 == 0 : i % 2 == 0;
342  //Complicated expression that creates the name of the histogram we are interested in.
343  histNameStream.str("");
344  histNameStream << topFolderName_.c_str() << "PX" << ((i > 3) ? "Forward" : "Barrel") << "/"
345  << ((i > 3) ? "HalfCylinder" : "Shell") << "_" << (minus ? "m" : "p") << ((outer) ? "O" : "I")
346  << "/" << ((i > 3) ? ((i % 2 == 0) ? "PXRing_1/" : "PXRing_2/") : "")
347  << summaryPlotName_[name].c_str() << "_PX" << ((i > 3) ? "Disk" : "Layer") << "_"
348  << ((i > 3) ? ((minus) ? "-" : "+") : "") << (j + 1);
349  histName = histNameStream.str();
350  MonitorElement* me = iGetter.get(histName);
351 
352  if (!me) {
353  edm::LogWarning("SiPixelPhase1Summary") << "ME " << histName << " is not available !!";
354  continue; // Ignore non-existing MEs, as this can cause the whole thing to crash
355  }
356 
357  if (summaryMap_[name] == nullptr) {
358  edm::LogWarning("SiPixelPhase1Summary") << "Summary map " << name << " is not available !!";
359  continue; // Based on reported errors it seems possible that we're trying to access a non-existant summary map, so if the map doesn't exist but we're trying to access it here we'll skip it instead.
360  }
361  if (!(me->getQReports()).empty())
362  summaryMap_[name]->setBinContent(i + 1, j + 1, (me->getQReports())[0]->getQTresult());
363  else
364  summaryMap_[name]->setBinContent(i + 1, j + 1, -1);
365  }
366  }
367  }
368 
369  //Fill the dead ROC summary
370  std::vector<trendPlots> trendOrder = {layer1, layer2, layer3, layer4, ring1, ring2};
371  std::vector<int> nRocsPerTrend = {1536, 3584, 5632, 8192, 4224, 6528};
372  for (unsigned int i = 0; i < trendOrder.size(); i++) {
373  int xBin = i < 4 ? 1 : 2;
374  int yBin = i % 4 + 1;
375  float nROCs = 0.;
376  if (runOnEndLumi_) { //Online case
377  TH1* tempProfile = deadROCTrends_[trendOrder[i]]->getTH1();
378  nROCs = tempProfile->GetBinContent(tempProfile->FindLastBinAbove());
379  } else { //Offline case
380  TH1* tempProfile = deadROCTrends_[offline]->getTH1();
381  nROCs = tempProfile->GetBinContent(i + 1);
382  }
383  deadROCSummary->setBinContent(xBin, yBin, nROCs / nRocsPerTrend[i]);
384  }
385 
386  //Fill additional residuals plots
387  //PXBarrel
388 
389  constexpr int minHits = 30; //Miniminal number of hits needed for module to be filled in histograms
390 
391  for (std::string layer : {"1", "2", "3", "4"}) {
392  MonitorElement* me_x =
393  iGetter.get("PixelPhase1/Tracks/PXBarrel/residual_x_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
394  MonitorElement* me_y =
395  iGetter.get("PixelPhase1/Tracks/PXBarrel/residual_y_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
396 
397  for (int i = 1; i <= me_x->getNbinsY(); i++) {
398  if (i == (me_x->getNbinsY() / 2 + 1))
399  continue; //Middle bin of y axis is empty
400 
401  if (i <= me_x->getNbinsY() / 2) {
402  bool iAmInner = (i % 2 == 0); //Check whether current ladder is inner or outer ladder
403  if (iAmInner) {
404  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
405  if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
406  continue;
407  residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
408  residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
409  residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
410  residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
411  }
412  } else {
413  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
414  if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
415  continue;
416  residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
417  residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
418  residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
419  residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
420  }
421  }
422  } else {
423  bool iAmInner = (i % 2 == 1); //Check whether current ladder is inner or outer ladder
424  if (iAmInner) {
425  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
426  if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
427  continue;
428  residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
429  residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
430  residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
431  residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
432  }
433  } else {
434  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
435  if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
436  continue;
437  residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
438  residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
439  residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
440  residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
441  }
442  }
443  }
444  }
445  }
446 
447  //PXForward separating outer and inner modules as well as positive and negative side
448  for (std::string ring : {"1", "2"}) {
449  MonitorElement* me_x =
450  iGetter.get("PixelPhase1/Tracks/PXForward/residual_x_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
451  MonitorElement* me_y =
452  iGetter.get("PixelPhase1/Tracks/PXForward/residual_y_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
453  bool posSide = false;
454  for (int j = 1; j <= me_x->getNbinsX(); j++) {
455  if (j == 4)
456  continue; //fourth x-bin in profile plots is empty
457 
458  if (j == 5)
459  posSide = true; //change to postive side
460 
461  for (int i = 1; i <= me_x->getNbinsY(); i++) {
462  if (i == me_x->getNbinsY() / 2)
463  continue; //Middle bins of y axis is empty
464  if (i == (me_x->getNbinsY() / 2) + 1)
465  continue;
466  if (me_x->getBinEntries(j, i) < minHits) //Fill only if number of hits is above threshold
467  continue;
468 
469  bool iAmInner = (i % 2 == 0); //separate inner and outer modules
470  if (iAmInner) {
471  residuals_["residual_mean_x_Inner"]->Fill(me_x->getBinContent(j, i) * 1e4);
472  residuals_["residual_mean_y_Inner"]->Fill(me_y->getBinContent(j, i) * 1e4);
473  residuals_["residual_rms_x_Inner"]->Fill(me_x->getBinError(j, i) * 1e4);
474  residuals_["residual_rms_y_Inner"]->Fill(me_y->getBinError(j, i) * 1e4);
475  } else {
476  residuals_["residual_mean_x_Outer"]->Fill(me_x->getBinContent(j, i) * 1e4);
477  residuals_["residual_mean_y_Outer"]->Fill(me_y->getBinContent(j, i) * 1e4);
478  residuals_["residual_rms_x_Outer"]->Fill(me_x->getBinError(j, i) * 1e4);
479  residuals_["residual_rms_y_Outer"]->Fill(me_y->getBinError(j, i) * 1e4);
480  }
481 
482  if (!posSide) { //separate postive and negative side
483  residuals_["residual_mean_x_neg"]->Fill(me_x->getBinContent(j, i) * 1e4);
484  residuals_["residual_mean_y_neg"]->Fill(me_y->getBinContent(j, i) * 1e4);
485  residuals_["residual_rms_x_neg"]->Fill(me_x->getBinError(j, i) * 1e4);
486  residuals_["residual_rms_y_neg"]->Fill(me_y->getBinError(j, i) * 1e4);
487  } else {
488  residuals_["residual_mean_x_pos"]->Fill(me_x->getBinContent(j, i) * 1e4);
489  residuals_["residual_mean_y_pos"]->Fill(me_y->getBinContent(j, i) * 1e4);
490  residuals_["residual_rms_x_pos"]->Fill(me_x->getBinError(j, i) * 1e4);
491  residuals_["residual_rms_y_pos"]->Fill(me_y->getBinError(j, i) * 1e4);
492  }
493  }
494  }
495  }
496 
497  //Sum of non-negative bins for the reportSummary
498  float sumOfNonNegBins = 0.;
499  //Now we will use the other summary maps to create the overall map.
500  //For now we only want to do this offline
501  if (!runOnEndLumi_) {
502  for (int i = 0; i < 12; i++) { // !??!?!? xAxisLabels_.size() ?!?!
503  if (summaryMap_["Grand"] == nullptr) {
504  edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!";
505  break;
506  }
507  for (int j = 0; j < 4; j++) { // !??!?!? yAxisLabels_.size() ?!?!?!
508  summaryMap_["Grand"]->setBinContent(
509  i + 1,
510  j + 1,
511  1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries.
512  for (auto const& mapInfo : summaryPlotName_) { //Check summary maps
513  auto name = mapInfo.first;
514  if (summaryMap_[name] == nullptr) {
515  edm::LogWarning("SiPixelPhase1Summary") << "Summary " << name << " does not exist!";
516  continue;
517  }
518  if (summaryMap_["Grand"]->getBinContent(i + 1, j + 1) > summaryMap_[name]->getBinContent(i + 1, j + 1))
519  summaryMap_["Grand"]->setBinContent(i + 1, j + 1, summaryMap_[name]->getBinContent(i + 1, j + 1));
520  }
521  if (summaryMap_["Grand"]->getBinContent(i + 1, j + 1) > -0.1)
522  sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i + 1, j + 1);
523  }
524  }
525  reportSummary->Fill(sumOfNonNegBins / 40.); // The average of the 40 useful bins in the summary map.
526  }
527 
528  //Fill the new overall map
529  // if (!runOnEndLumi_) return;
530  else { //Do this for online only
531  for (int i = 0; i < 2; i++) {
532  if (summaryMap_["Grand"] == nullptr) {
533  edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!";
534  break;
535  }
536  for (int j = 0; j < 4; j++) { // !??!?!? yAxisLabels_.size() ?!?!?!
537  //Ignore the bins without detectors in them
538  if (i == 1 && j > 1)
539  continue;
540  summaryMap_["Grand"]->setBinContent(
541  i + 1,
542  j + 1,
543  1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries.
544  if (deadROCSummary->getBinContent(i + 1, j + 1) > deadRocThresholds_[i * 4 + j])
545  summaryMap_["Grand"]->setBinContent(i + 1, j + 1, 0);
546  sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i + 1, j + 1);
547  }
548  }
549  }
550 }
551 
552 //------------------------------------------------------------------
553 // Fill the trend plots
554 //------------------------------------------------------------------
556  // If we're running in online mode and the lumi section is not modulo 10, return. Offline running always uses lumiSec=0, so it will pass this test.
557  if (lumiSec % 10 != 0)
558  return;
559 
560  if (runOnEndLumi_) {
561  MonitorElement* nClustersAll = iGetter.get("PixelPhase1/Phase1_MechanicalView/num_clusters_per_Lumisection_PXAll");
562  if (nClustersAll == nullptr) {
563  edm::LogWarning("SiPixelPhase1Summary") << "All pixel cluster trend plot not available!!";
564  return;
565  }
566  if (nClustersAll->getTH1()->GetBinContent(lumiSec) < 100)
567  return;
568  }
569 
570  std::string histName;
571 
572  //Find the total number of filled bins and hi efficiency bins
573  std::vector<trendPlots> trendOrder = {layer1, layer2, layer3, layer4, ring1, ring2};
574  std::vector<int> nFilledROCs(trendOrder.size(), 0);
575  std::vector<int> hiEffROCs(trendOrder.size(), 0);
576  std::vector<int> nRocsPerTrend = {1536, 3584, 5632, 8192, 4224, 6528};
577  std::vector<string> trendNames = {};
578 
579  for (auto it : {1, 2, 3, 4}) {
580  histName = "PXBarrel/digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" + std::to_string(it);
581  trendNames.push_back(histName);
582  }
583  for (auto it : {1, 2}) {
584  histName = "PXForward/digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" + std::to_string(it);
585  trendNames.push_back(histName);
586  }
587  //Loop over layers. This will also do the rings, but we'll skip the ring calculation for
588  for (unsigned int trendIt = 0; trendIt < trendOrder.size(); trendIt++) {
589  iGetter.cd();
590  histName = "PixelPhase1/Phase1_MechanicalView/" + trendNames[trendIt];
591  MonitorElement* tempLayerME = iGetter.get(histName);
592  if (tempLayerME == nullptr)
593  continue;
594  float lowEffValue = 0.25 * (tempLayerME->getTH1()->Integral() / nRocsPerTrend[trendIt]);
595  for (int i = 1; i <= tempLayerME->getTH1()->GetXaxis()->GetNbins(); i++) {
596  for (int j = 1; j <= tempLayerME->getTH1()->GetYaxis()->GetNbins(); j++) {
597  if (tempLayerME->getBinContent(i, j) > 0.)
598  nFilledROCs[trendIt]++;
599  if (tempLayerME->getBinContent(i, j) > lowEffValue)
600  hiEffROCs[trendIt]++;
601  }
602  }
603  if (runOnEndLumi_) {
604  tempLayerME->Reset(); //If we're doing online monitoring, reset the digi maps.
605  }
606  } // Close layers/ring loop
607 
608  if (!runOnEndLumi_) { //offline
609  for (unsigned int i = 0; i < trendOrder.size(); i++) {
610  deadROCTrends_[offline]->Fill(i, nRocsPerTrend[i] - nFilledROCs[i]);
611  ineffROCTrends_[offline]->Fill(i, nFilledROCs[i] - hiEffROCs[i]);
612  }
613  } else { //online
614  for (unsigned int i = 0; i < trendOrder.size(); i++) {
615  deadROCTrends_[trendOrder[i]]->Fill(lumiSec - 1, nRocsPerTrend[i] - nFilledROCs[i]);
616  ineffROCTrends_[trendOrder[i]]->Fill(lumiSec - 1, nFilledROCs[i] - hiEffROCs[i]);
617  }
618  }
619 
620  if (!runOnEndLumi_)
621  return; // The following only occurs in the online
622  //Reset some MEs every 10LS here
623  for (auto it : {1, 2, 3, 4}) { //PXBarrel
624  histName = "PixelPhase1/Phase1_MechanicalView/PXBarrel/clusterposition_zphi_PXLayer_" + std::to_string(it);
625  MonitorElement* toReset = iGetter.get(histName);
626  if (toReset != nullptr) {
627  toReset->Reset();
628  }
629  }
630  for (auto it : {"-3", "-2", "-1", "+1", "+2", "+3"}) { //PXForward
631  histName = "PixelPhase1/Phase1_MechanicalView/PXForward/clusterposition_xy_PXDisk_" + std::string(it);
632  MonitorElement* toReset = iGetter.get(histName);
633  if (toReset != nullptr) {
634  toReset->Reset();
635  }
636  }
637 }
638 
639 //define this as a plug-in
SiPixelPhase1Summary::ineffROCTrends_
std::map< trendPlots, MonitorElement * > ineffROCTrends_
Definition: SiPixelPhase1Summary.h:78
SiPixelPhase1Summary::runOnEndLumi_
bool runOnEndLumi_
Definition: SiPixelPhase1Summary.h:60
dqm::impl::MonitorElement::getBinEntries
virtual double getBinEntries(int bin) const
get # of bin entries (for profiles)
Definition: MonitorElement.cc:645
mps_fire.i
i
Definition: mps_fire.py:355
PixelSubdetector.h
PixelBarrelName.h
SiPixelPhase1Summary::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
Definition: SiPixelPhase1Summary.cc:70
MessageLogger.h
TrackerGeometry.h
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
photonAnalyzer_cfi.xBin
xBin
Definition: photonAnalyzer_cfi.py:81
PixelTopology.h
SiPixelPhase1Summary::residuals_
std::map< std::string, MonitorElement * > residuals_
Definition: SiPixelPhase1Summary.h:71
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
SiPixelPhase1Summary::layer4
Definition: SiPixelPhase1Summary.h:64
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelPhase1Summary::reportSummary
MonitorElement * reportSummary
Definition: SiPixelPhase1Summary.h:72
SiPixelPhase1Summary.h
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiPixelPhase1Summary::runOnEndJob_
bool runOnEndJob_
Definition: SiPixelPhase1Summary.h:61
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
reco::HaloData::minus
Definition: HaloData.h:14
SiPixelPhase1Summary::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) override
Definition: SiPixelPhase1Summary.cc:72
SiPixelPhase1Summary::layer3
Definition: SiPixelPhase1Summary.h:64
SiPixelPhase1Summary
Definition: SiPixelPhase1Summary.h:40
SiPixelPhase1Summary::firstLumi
bool firstLumi
Definition: SiPixelPhase1Summary.h:67
SiPixelPhase1Summary::deadRocThresholds_
std::vector< double > deadRocThresholds_
Definition: SiPixelPhase1Summary.h:81
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiPixelPhase1Summary::bookTrendPlots
void bookTrendPlots(DQMStore::IBooker &iBooker)
Definition: SiPixelPhase1Summary.cc:295
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::impl::MonitorElement::Reset
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
Definition: MonitorElement.cc:354
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
SiPixelPhase1Summary::SiPixelPhase1Summary
SiPixelPhase1Summary(const edm::ParameterSet &conf)
Definition: SiPixelPhase1Summary.cc:49
multiplicitycorr_cfi.yMax
yMax
Definition: multiplicitycorr_cfi.py:6
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:474
SiPixelPhase1Summary::summaryPlotName_
std::map< std::string, std::string > summaryPlotName_
Definition: SiPixelPhase1Summary.h:74
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
SiPixelPhase1Summary::layer1
Definition: SiPixelPhase1Summary.h:64
SiPixelPhase1Summary::deadROCSummary
MonitorElement * deadROCSummary
Definition: SiPixelPhase1Summary.h:70
funct::true
true
Definition: Factorize.h:173
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:36
dqm::impl::MonitorElement::getNbinsY
virtual int getNbinsY() const
get # of bins in Y-axis
Definition: MonitorElement.cc:580
SiPixelPhase1Summary::fillSummaries
void fillSummaries(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
Definition: SiPixelPhase1Summary.cc:328
SiPixelPhase1Summary::bookSummaries
void bookSummaries(DQMStore::IBooker &iBooker)
Definition: SiPixelPhase1Summary.cc:112
SiPixelPhase1Summary::ring1
Definition: SiPixelPhase1Summary.h:64
SiPixelPhase1Summary::conf_
edm::ParameterSet conf_
Definition: SiPixelPhase1Summary.h:65
edm::LuminosityBlockID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockID.h:42
edm::LuminosityBlockBase::id
LuminosityBlockID id() const
Definition: LuminosityBlockBase.h:44
dqm::impl::MonitorElement::setBinLabel
virtual 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)
Definition: MonitorElement.cc:771
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiPixelPhase1Summary::ring2
Definition: SiPixelPhase1Summary.h:64
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
SiPixelPhase1Summary::layer2
Definition: SiPixelPhase1Summary.h:64
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
DetId.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
SiPixelPhase1Summary::topFolderName_
std::string topFolderName_
Definition: SiPixelPhase1Summary.h:59
SiPixelPhase1Summary::fillTrendPlots
void fillTrendPlots(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, int lumiSeg=0)
Definition: SiPixelPhase1Summary.cc:555
PixelGeomDetUnit.h
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
SiPixelPhase1Summary::~SiPixelPhase1Summary
~SiPixelPhase1Summary() override
Definition: SiPixelPhase1Summary.cc:64
PixelEndcapNameUpgrade.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiPixelFolderOrganizer.h
SiPixelPhase1Summary::summaryMap_
std::map< std::string, MonitorElement * > summaryMap_
Definition: SiPixelPhase1Summary.h:69
ParameterSet.h
SurfaceOrientation::outer
Definition: Surface.h:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
dqm::impl::MonitorElement::getBinError
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
Definition: MonitorElement.cc:610
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
PixelBarrelNameUpgrade.h
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
SiPixelPhase1Summary::dqmEndJob
void dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override
Definition: SiPixelPhase1Summary.cc:94
reco_skim_cfg_mod.minHits
minHits
Definition: reco_skim_cfg_mod.py:177
vertexPlots.e4
e4
Definition: vertexPlots.py:64
SiPixelPhase1Summary::offline
Definition: SiPixelPhase1Summary.h:64
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
PixelEndcapName.h
SiPixelPhase1Summary::deadROCTrends_
std::map< trendPlots, MonitorElement * > deadROCTrends_
Definition: SiPixelPhase1Summary.h:77