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