CMS 3D CMS Logo

SiPixelPhase1ResidualsExtra.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelPhase1ResidualsExtra
4 // Class: SiPixelPhase1ResidualsExtra
5 //
12 //
13 // Original Author: Alessandro Rossi
14 // Created: 25th May 2021
15 //
16 //
17 
18 // system includes
19 #include <string>
20 #include <cstdlib>
21 #include <iostream>
22 #include <fstream>
23 #include <sstream>
24 
25 // user includes
49 
50 using namespace std;
51 using namespace edm;
52 
54 public:
55  explicit SiPixelPhase1ResidualsExtra(const edm::ParameterSet& conf);
56  ~SiPixelPhase1ResidualsExtra() override;
57 
58  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
59 
60 protected:
61  // BeginRun
62  void beginRun(edm::Run const& run, edm::EventSetup const& eSetup) override;
63 
64  // EndJob
65  void dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) override;
66 
67 private:
70  const int minHits_;
71 
72  std::map<std::string, MonitorElement*> residuals_;
73  std::map<std::string, MonitorElement*> DRnR_;
74 
75  //Book Monitoring Elements
76  void bookMEs(DQMStore::IBooker& iBooker);
77 
78  //Fill Monitoring Elements
79  void fillMEs(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter);
80 };
81 
83  : DQMEDHarvester(iConfig),
84  topFolderName_(iConfig.getParameter<std::string>("TopFolderName")),
85  inputFolderName_(iConfig.getParameter<std::string>("InputFolderName")),
86  minHits_(iConfig.getParameter<int>("MinHits")) {
87  LogInfo("PixelDQM") << "SiPixelPhase1ResidualsExtra::SiPixelPhase1ResidualsExtra: Got DQM BackEnd interface" << endl;
88 }
89 
91  LogInfo("PixelDQM") << "SiPixelPhase1ResidualsExtra::~SiPixelPhase1ResidualsExtra: Destructor" << endl;
92 }
93 
95 
97  bookMEs(iBooker);
98  fillMEs(iBooker, iGetter);
99 }
100 
101 //------------------------------------------------------------------
102 // Used to book the MEs
103 //------------------------------------------------------------------
105  iBooker.cd();
106 
107  //New residual plots for the PXBarrel separated by inner and outer modules per layer
108  iBooker.setCurrentFolder(topFolderName_ + "/PXBarrel");
109 
110  for (std::string layer : {"1", "2", "3", "4"}) {
111  float mean_range = 20.;
112  float rms_range = 200.;
113  if (layer == "1") {
114  mean_range = 50.;
115  rms_range = 1000.;
116  }
117  residuals_["residual_mean_x_Inner_PXLayer_" + layer] =
118  iBooker.book1D("residual_mean_x_Inner_PXLayer_" + layer,
119  "Mean of Track Residuals X Inner Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
120  100,
121  -1 * mean_range,
122  mean_range);
123  residuals_["residual_mean_x_Outer_PXLayer_" + layer] =
124  iBooker.book1D("residual_mean_x_Outer_PXLayer_" + layer,
125  "Mean of Track Residuals X Outer Modules for Layer " + layer + ";mean(x_rec-x_pred)[#mum]",
126  100,
127  -1 * mean_range,
128  mean_range);
129  residuals_["residual_mean_y_Inner_PXLayer_" + layer] =
130  iBooker.book1D("residual_mean_y_Inner_PXLayer_" + layer,
131  "Mean of Track Residuals Y Inner Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
132  100,
133  -1 * mean_range,
134  mean_range);
135  residuals_["residual_mean_y_Outer_PXLayer_" + layer] =
136  iBooker.book1D("residual_mean_y_Outer_PXLayer_" + layer,
137  "Mean of Track Residuals Y Outer Modules for Layer " + layer + ";mean(y_rec-y_pred)[#mum]",
138  100,
139  -1 * mean_range,
140  mean_range);
141 
142  residuals_["residual_rms_x_Inner_PXLayer_" + layer] =
143  iBooker.book1D("residual_rms_x_Inner_PXLayer_" + layer,
144  "RMS of Track Residuals X Inner Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
145  100,
146  0.,
147  rms_range);
148  residuals_["residual_rms_x_Outer_PXLayer_" + layer] =
149  iBooker.book1D("residual_rms_x_Outer_PXLayer_" + layer,
150  "RMS of Track Residuals X Outer Modules for Layer " + layer + ";rms(x_rec-x_pred)[#mum]",
151  100,
152  0.,
153  rms_range);
154  residuals_["residual_rms_y_Inner_PXLayer_" + layer] =
155  iBooker.book1D("residual_rms_y_Inner_PXLayer_" + layer,
156  "RMS of Track Residuals Y Inner Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
157  100,
158  0.,
159  rms_range);
160  residuals_["residual_rms_y_Outer_PXLayer_" + layer] =
161  iBooker.book1D("residual_rms_y_Outer_PXLayer_" + layer,
162  "RMS of Track Residuals Y Outer Modules for Layer " + layer + ";rms(y_rec-y_pred)[#mum]",
163  100,
164  0.,
165  rms_range);
167  DRnR_["NormRes_mean_x_Inner_PXLayer_" + layer] = iBooker.book1D(
168  "NormRes_mean_x_Inner_PXLayer_" + layer,
169  "Mean of Normalized Track Residuals X Inner Modules for Layer " + layer + ";mean((x_rec-x_pred)/x_err)",
170  100,
171  -1 * 1,
172  1);
173  DRnR_["NormRes_mean_x_Outer_PXLayer_" + layer] = iBooker.book1D(
174  "NormRes_mean_x_Outer_PXLayer_" + layer,
175  "Mean of Normalized Track Residuals X Outer Modules for Layer " + layer + ";mean((x_rec-x_pred)/x_err)",
176  100,
177  -1 * 1,
178  1);
179  DRnR_["NormRes_mean_y_Inner_PXLayer_" + layer] = iBooker.book1D(
180  "NormRes_mean_y_Inner_PXLayer_" + layer,
181  "Mean of Normalized Track Residuals Y Inner Modules for Layer " + layer + ";mean((y_rec-y_pred)/y_err)",
182  100,
183  -1 * 1,
184  1);
185  DRnR_["NormRes_mean_y_Outer_PXLayer_" + layer] = iBooker.book1D(
186  "NormRes_mean_y_Outer_PXLayer_" + layer,
187  "Mean of Normalized Track Residuals Y Outer Modules for Layer " + layer + ";mean((y_rec-y_pred)/y_err)",
188  100,
189  -1 * 1,
190  1);
191 
192  DRnR_["DRnR_x_Inner_PXLayer_" + layer] = iBooker.book1D(
193  "DRnR_x_Inner_PXLayer_" + layer,
194  "RMS of Normalized Track Residuals X Inner Modules for Layer " + layer + ";rms((x_rec-x_pred)/x_err)",
195  100,
196  0.,
197  2);
198  DRnR_["DRnR_x_Outer_PXLayer_" + layer] = iBooker.book1D(
199  "DRnR_x_Outer_PXLayer_" + layer,
200  "RMS of Normalized Track Residuals X Outer Modules for Layer " + layer + ";rms((x_rec-x_pred)/x_err)",
201  100,
202  0.,
203  2);
204  DRnR_["DRnR_y_Inner_PXLayer_" + layer] = iBooker.book1D(
205  "DRnR_y_Inner_PXLayer_" + layer,
206  "RMS of Normalized Track Residuals Y Inner Modules for Layer " + layer + ";rms((y_rec-y_pred)/y_err)",
207  100,
208  0.,
209  2);
210  DRnR_["DRnR_y_Outer_PXLayer_" + layer] = iBooker.book1D(
211  "DRnR_y_Outer_PXLayer_" + layer,
212  "RMS of Normalized Track Residuals Y Outer Modules for Layer " + layer + ";rms((y_rec-y_pred)/y_err)",
213  100,
214  0.,
215  2);
216  }
217 
218  //New residual plots for the PXForward separated by inner and outer modules
219  iBooker.setCurrentFolder(topFolderName_ + "/PXForward");
220 
221  residuals_["residual_mean_x_Inner"] = iBooker.book1D(
222  "residual_mean_x_Inner", "Mean of Track Residuals X Inner Modules;mean(x_rec-x_pred)[#mum]", 100, -20., 20.);
223  residuals_["residual_mean_x_Outer"] = iBooker.book1D(
224  "residual_mean_x_Outer", "Mean of Track Residuals X Outer Modules;mean(x_rec-x_pred)[#mum]", 100, -20., 20.);
225  residuals_["residual_mean_y_Inner"] = iBooker.book1D(
226  "residual_mean_y_Inner", "Mean of Track Residuals Y Inner Modules;mean(y_rec-y_pred)[#mum]", 100, -20., 20.);
227  residuals_["residual_mean_y_Outer"] = iBooker.book1D(
228  "residual_mean_y_Outer", "Mean of Track Residuals Y Outer Modules;mean(y_rec-y_pred)[#mum]", 100, -20., 20.);
229 
230  residuals_["residual_rms_x_Inner"] = iBooker.book1D(
231  "residual_rms_x_Inner", "RMS of Track Residuals X Inner Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
232  residuals_["residual_rms_x_Outer"] = iBooker.book1D(
233  "residual_rms_x_Outer", "RMS of Track Residuals X Outer Modules;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
234  residuals_["residual_rms_y_Inner"] = iBooker.book1D(
235  "residual_rms_y_Inner", "RMS of Track Residuals Y Inner Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
236  residuals_["residual_rms_y_Outer"] = iBooker.book1D(
237  "residual_rms_y_Outer", "RMS of Track Residuals Y Outer Modules;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
238  //Normalize Residuals inner/outer
239  DRnR_["NormRes_mean_x_Inner"] =
240  iBooker.book1D("NormRes_mean_x_Inner",
241  "Mean of Normalized Track Residuals X Inner Modules;mean((x_rec-x_pred)/x_err)",
242  100,
243  -1.,
244  1.);
245  DRnR_["NormRes_mean_x_Outer"] =
246  iBooker.book1D("NormRes_mean_x_Outer",
247  "Mean of Normalized Track Residuals X Outer Modules;mean((x_rec-x_pred)/x_err)",
248  100,
249  -1.,
250  1.);
251  DRnR_["NormRes_mean_y_Inner"] =
252  iBooker.book1D("NormRes_mean_y_Inner",
253  "Mean of Normalized Track Residuals Y Inner Modules;mean((y_rec-y_pred)/y_err)",
254  100,
255  -1.,
256  1.);
257  DRnR_["NormRes_mean_y_Outer"] =
258  iBooker.book1D("NormRes_mean_y_Outer",
259  "Mean of Normalized Track Residuals Y Outer Modules;mean((y_rec-y_pred)/y_err)",
260  100,
261  -1.,
262  1.);
263 
264  DRnR_["DRnR_x_Inner"] = iBooker.book1D(
265  "DRnR_x_Inner", "RMS of Normalized Track Residuals X Inner Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 2.);
266  DRnR_["DRnR_x_Outer"] = iBooker.book1D(
267  "DRnR_x_Outer", "RMS of Normalized Track Residuals X Outer Modules;rms((x_rec-x_pred)/x_err)", 100, 0., 2.);
268  DRnR_["DRnR_y_Inner"] = iBooker.book1D(
269  "DRnR_y_Inner", "RMS of Normalized Track Residuals Y Inner Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 2.);
270  DRnR_["DRnR_y_Outer"] = iBooker.book1D(
271  "DRnR_y_Outer", "RMS of Normalized Track Residuals Y Outer Modules;rms((y_rec-y_pred)/y_err)", 100, 0., 2.);
272 
273  //New residual plots for the PXForward separated by positive and negative side
274  iBooker.setCurrentFolder(topFolderName_ + "/PXForward");
275 
276  residuals_["residual_mean_x_pos"] = iBooker.book1D(
277  "residual_mean_x_pos", "Mean of Track Residuals X pos. Side;mean(x_rec-x_pred)[#mum]", 100, -20., 20.);
278  residuals_["residual_mean_x_neg"] = iBooker.book1D(
279  "residual_mean_x_neg", "Mean of Track Residuals X neg. Side;mean(x_rec-x_pred)[#mum]", 100, -20., 20.);
280  residuals_["residual_mean_y_pos"] = iBooker.book1D(
281  "residual_mean_y_pos", "Mean of Track Residuals Y pos. Side;mean(y_rec-y_pred)[#mum]", 100, -20., 20.);
282  residuals_["residual_mean_y_neg"] = iBooker.book1D(
283  "residual_mean_y_neg", "Mean of Track Residuals Y neg. Side;mean(y_rec-y_pred)[#mum]", 100, -20., 20.);
284 
285  residuals_["residual_rms_x_pos"] =
286  iBooker.book1D("residual_rms_x_pos", "RMS of Track Residuals X pos. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
287  residuals_["residual_rms_x_neg"] =
288  iBooker.book1D("residual_rms_x_neg", "RMS of Track Residuals X neg. Side;rms(x_rec-x_pred)[#mum]", 100, 0., 200.);
289  residuals_["residual_rms_y_pos"] =
290  iBooker.book1D("residual_rms_y_pos", "RMS of Track Residuals Y pos. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
291  residuals_["residual_rms_y_neg"] =
292  iBooker.book1D("residual_rms_y_neg", "RMS of Track Residuals Y neg. Side;rms(y_rec-y_pred)[#mum]", 100, 0., 200.);
293  //Normalized Residuals pos/neg
294  DRnR_["NormRes_mean_x_pos"] = iBooker.book1D(
295  "NormRes_mean_x_pos", "Mean of Normalized Track Residuals X pos. Side;mean((x_rec-x_pred)/x_err)", 100, -1., 1.);
296  DRnR_["NormRes_mean_x_neg"] = iBooker.book1D(
297  "NormRes_mean_x_neg", "Mean of Normalized Track Residuals X neg. Side;mean((x_rec-x_pred)/x_err)", 100, -1., 1.);
298  DRnR_["NormRes_mean_y_pos"] = iBooker.book1D(
299  "NormRes_mean_y_pos", "Mean of Normalized Track Residuals Y pos. Side;mean((y_rec-y_pred)/y_err)", 100, -1., 1.);
300  DRnR_["NormRes_mean_y_neg"] = iBooker.book1D(
301  "NormRes_mean_y_neg", "Mean of Normalized Track Residuals Y neg. Side;mean((y_rec-y_pred)/y_err)", 100, -1., 1.);
302 
303  DRnR_["DRnR_x_pos"] = iBooker.book1D(
304  "DRnR_x_pos", "RMS of Normalized Track Residuals X pos. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 2.);
305  DRnR_["DRnR_x_neg"] = iBooker.book1D(
306  "DRnR_x_neg", "RMS of Normalized Track Residuals X neg. Side;rms((x_rec-x_pred)/x_err)", 100, 0., 2.);
307  DRnR_["DRnR_y_pos"] = iBooker.book1D(
308  "DRnR_y_pos", "RMS of Normalized Track Residuals Y pos. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 2.);
309  DRnR_["DRnR_y_neg"] = iBooker.book1D(
310  "DRnR_y_neg", "RMS of Normalized Track Residuals Y neg. Side;rms((y_rec-y_pred)/y_err)", 100, 0., 2.);
311 
312  //Reset the iBooker
313  iBooker.setCurrentFolder("PixelPhase1/");
314 }
315 
316 //------------------------------------------------------------------
317 // Fill the MEs
318 //------------------------------------------------------------------
320  //Fill additional residuals plots
321  //PXBarrel
322 
323  //constexpr int minHits_ = 30; //Miniminal number of hits needed for module to be filled in histograms
324 
325  for (std::string layer : {"1", "2", "3", "4"}) {
326  MonitorElement* me_x =
327  iGetter.get(inputFolderName_ + "/PXBarrel/residual_x_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
328  MonitorElement* me_y =
329  iGetter.get(inputFolderName_ + "/PXBarrel/residual_y_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
330  MonitorElement* me2_x = iGetter.get(
331  inputFolderName_ + "/ResidualsExtra/PXBarrel/DRnR_x_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
332  MonitorElement* me2_y = iGetter.get(
333  inputFolderName_ + "/ResidualsExtra/PXBarrel/DRnR_y_per_SignedModule_per_SignedLadder_PXLayer_" + layer);
334 
335  if (me_x == nullptr || me_y == nullptr || me2_x == nullptr || me2_y == nullptr) {
336  edm::LogWarning("SiPixelPhase1ResidualsExtra")
337  << "Residuals plots for Pixel BPIX Layer" << layer << " not found. Skipping ResidualsExtra plots generation.";
338  continue;
339  }
340 
341  for (int i = 1; i <= me_x->getNbinsY(); i++) {
342  if (i == (me_x->getNbinsY() / 2 + 1))
343  continue; //Middle bin of y axis is empty
344 
345  if (i <= me_x->getNbinsY() / 2) {
346  bool iAmInner = (i % 2 == 0); //Check whether current ladder is inner or outer ladder
347  if (iAmInner) {
348  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
349  if (me_x->getBinEntries(j, i) < minHits_) //Fill only if number of hits is above threshold
350  continue;
351  residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
352  residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
353  residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
354  residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
355  DRnR_["NormRes_mean_x_Inner_PXLayer_" + layer]->Fill(me2_x->getBinContent(j, i));
356  DRnR_["NormRes_mean_y_Inner_PXLayer_" + layer]->Fill(me2_y->getBinContent(j, i));
357  DRnR_["DRnR_x_Inner_PXLayer_" + layer]->Fill(me2_x->getBinError(j, i));
358  DRnR_["DRnR_y_Inner_PXLayer_" + layer]->Fill(me2_y->getBinError(j, i));
359  }
360  } else {
361  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
362  if (me_x->getBinEntries(j, i) < minHits_) //Fill only if number of hits is above threshold
363  continue;
364  residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
365  residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
366  residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
367  residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
368  DRnR_["NormRes_mean_x_Outer_PXLayer_" + layer]->Fill(me2_x->getBinContent(j, i));
369  DRnR_["NormRes_mean_y_Outer_PXLayer_" + layer]->Fill(me2_y->getBinContent(j, i));
370  DRnR_["DRnR_x_Outer_PXLayer_" + layer]->Fill(me2_x->getBinError(j, i));
371  DRnR_["DRnR_y_Outer_PXLayer_" + layer]->Fill(me2_y->getBinError(j, i));
372  }
373  }
374  } else {
375  bool iAmInner = (i % 2 == 1); //Check whether current ladder is inner or outer ladder
376  if (iAmInner) {
377  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
378  if (me_x->getBinEntries(j, i) < minHits_) //Fill only if number of hits is above threshold
379  continue;
380  residuals_["residual_mean_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
381  residuals_["residual_mean_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
382  residuals_["residual_rms_x_Inner_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
383  residuals_["residual_rms_y_Inner_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
384  DRnR_["NormRes_mean_x_Inner_PXLayer_" + layer]->Fill(me2_x->getBinContent(j, i));
385  DRnR_["NormRes_mean_y_Inner_PXLayer_" + layer]->Fill(me2_y->getBinContent(j, i));
386  DRnR_["DRnR_x_Inner_PXLayer_" + layer]->Fill(me2_x->getBinError(j, i));
387  DRnR_["DRnR_y_Inner_PXLayer_" + layer]->Fill(me2_y->getBinError(j, i));
388  }
389  } else {
390  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
391  if (me_x->getBinEntries(j, i) < minHits_) //Fill only if number of hits is above threshold
392  continue;
393  residuals_["residual_mean_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinContent(j, i) * 1e4);
394  residuals_["residual_mean_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinContent(j, i) * 1e4);
395  residuals_["residual_rms_x_Outer_PXLayer_" + layer]->Fill(me_x->getBinError(j, i) * 1e4);
396  residuals_["residual_rms_y_Outer_PXLayer_" + layer]->Fill(me_y->getBinError(j, i) * 1e4);
397  DRnR_["NormRes_mean_x_Outer_PXLayer_" + layer]->Fill(me2_x->getBinContent(j, i));
398  DRnR_["NormRes_mean_y_Outer_PXLayer_" + layer]->Fill(me2_y->getBinContent(j, i));
399  DRnR_["DRnR_x_Outer_PXLayer_" + layer]->Fill(me2_x->getBinError(j, i));
400  DRnR_["DRnR_y_Outer_PXLayer_" + layer]->Fill(me2_y->getBinError(j, i));
401  }
402  }
403  }
404  for (int j : {1, 2, 3, 4, 6, 7, 8, 9}) {
405  if (me_x->getBinEntries(j, i) < minHits_) {
406  me2_x->setBinContent(j, i, 0);
407  me2_y->setBinContent(j, i, 0);
408  me2_x->setBinEntries(me2_x->getBin(j, i), 0);
409  me2_y->setBinEntries(me2_y->getBin(j, i), 0);
410  } else {
411  me2_x->setBinContent(j, i, me2_x->getBinError(j, i));
412  me2_y->setBinContent(j, i, me2_y->getBinError(j, i));
413  me2_x->setBinEntries(me2_x->getBin(j, i), 1);
414  me2_y->setBinEntries(me2_y->getBin(j, i), 1);
415  }
416  }
417  }
418  }
419 
420  //PXForward separating outer and inner modules as well as positive and negative side
421  for (std::string ring : {"1", "2"}) {
422  MonitorElement* me_x =
423  iGetter.get(inputFolderName_ + "/PXForward/residual_x_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
424  MonitorElement* me_y =
425  iGetter.get(inputFolderName_ + "/PXForward/residual_y_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
426  MonitorElement* me2_x = iGetter.get(
427  inputFolderName_ + "/ResidualsExtra/PXForward/DRnR_x_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
428  MonitorElement* me2_y = iGetter.get(
429  inputFolderName_ + "/ResidualsExtra/PXForward/DRnR_y_per_PXDisk_per_SignedBladePanel_PXRing_" + ring);
430 
431  if (me_x == nullptr || me_y == nullptr || me2_x == nullptr || me2_y == nullptr) {
432  edm::LogWarning("SiPixelPhase1ResidualsExtra")
433  << "Residuals plots for Pixel FPIX Ring" << ring << " not found. Skipping ResidualsExtra plots generation.";
434  continue;
435  }
436 
437  bool posSide = false;
438  for (int j = 1; j <= me_x->getNbinsX(); j++) {
439  if (j == 4)
440  continue; //fourth x-bin in profile plots is empty
441 
442  if (j == 5)
443  posSide = true; //change to postive side
444 
445  for (int i = 1; i <= me_x->getNbinsY(); i++) {
446  if (i == me_x->getNbinsY() / 2)
447  continue; //Middle bins of y axis is empty
448  if (i == (me_x->getNbinsY() / 2) + 1)
449  continue;
450  if (me_x->getBinEntries(j, i) >= minHits_) { //Fill only if number of hits is above threshold
451 
452  bool iAmInner = (i % 2 == 0); //separate inner and outer modules
453  if (iAmInner) {
454  residuals_["residual_mean_x_Inner"]->Fill(me_x->getBinContent(j, i) * 1e4);
455  residuals_["residual_mean_y_Inner"]->Fill(me_y->getBinContent(j, i) * 1e4);
456  residuals_["residual_rms_x_Inner"]->Fill(me_x->getBinError(j, i) * 1e4);
457  residuals_["residual_rms_y_Inner"]->Fill(me_y->getBinError(j, i) * 1e4);
458  DRnR_["NormRes_mean_x_Inner"]->Fill(me2_x->getBinContent(j, i));
459  DRnR_["NormRes_mean_y_Inner"]->Fill(me2_y->getBinContent(j, i));
460  DRnR_["DRnR_x_Inner"]->Fill(me2_x->getBinError(j, i));
461  DRnR_["DRnR_y_Inner"]->Fill(me2_y->getBinError(j, i));
462  } else {
463  residuals_["residual_mean_x_Outer"]->Fill(me_x->getBinContent(j, i) * 1e4);
464  residuals_["residual_mean_y_Outer"]->Fill(me_y->getBinContent(j, i) * 1e4);
465  residuals_["residual_rms_x_Outer"]->Fill(me_x->getBinError(j, i) * 1e4);
466  residuals_["residual_rms_y_Outer"]->Fill(me_y->getBinError(j, i) * 1e4);
467  DRnR_["NormRes_mean_x_Outer"]->Fill(me2_x->getBinContent(j, i));
468  DRnR_["NormRes_mean_y_Outer"]->Fill(me2_y->getBinContent(j, i));
469  DRnR_["DRnR_x_Outer"]->Fill(me2_x->getBinError(j, i));
470  DRnR_["DRnR_y_Outer"]->Fill(me2_y->getBinError(j, i));
471  }
472 
473  if (!posSide) { //separate postive and negative side
474  residuals_["residual_mean_x_neg"]->Fill(me_x->getBinContent(j, i) * 1e4);
475  residuals_["residual_mean_y_neg"]->Fill(me_y->getBinContent(j, i) * 1e4);
476  residuals_["residual_rms_x_neg"]->Fill(me_x->getBinError(j, i) * 1e4);
477  residuals_["residual_rms_y_neg"]->Fill(me_y->getBinError(j, i) * 1e4);
478  DRnR_["NormRes_mean_x_neg"]->Fill(me2_x->getBinContent(j, i));
479  DRnR_["NormRes_mean_y_neg"]->Fill(me2_y->getBinContent(j, i));
480  DRnR_["DRnR_x_neg"]->Fill(me2_x->getBinError(j, i));
481  DRnR_["DRnR_y_neg"]->Fill(me2_y->getBinError(j, i));
482  } else {
483  residuals_["residual_mean_x_pos"]->Fill(me_x->getBinContent(j, i) * 1e4);
484  residuals_["residual_mean_y_pos"]->Fill(me_y->getBinContent(j, i) * 1e4);
485  residuals_["residual_rms_x_pos"]->Fill(me_x->getBinError(j, i) * 1e4);
486  residuals_["residual_rms_y_pos"]->Fill(me_y->getBinError(j, i) * 1e4);
487  DRnR_["NormRes_mean_x_pos"]->Fill(me2_x->getBinContent(j, i));
488  DRnR_["NormRes_mean_y_pos"]->Fill(me2_y->getBinContent(j, i));
489  DRnR_["DRnR_x_pos"]->Fill(me2_x->getBinError(j, i));
490  DRnR_["DRnR_y_pos"]->Fill(me2_y->getBinError(j, i));
491  }
492  me2_x->setBinContent(j, i, me2_x->getBinError(j, i));
493  me2_y->setBinContent(j, i, me2_y->getBinError(j, i));
494  me2_x->setBinEntries(me2_x->getBin(j, i), 1);
495  me2_y->setBinEntries(me2_y->getBin(j, i), 1);
496  } else {
497  me2_x->setBinContent(j, i, 0);
498  me2_y->setBinContent(j, i, 0);
499  me2_x->setBinEntries(me2_x->getBin(j, i), 0);
500  me2_y->setBinEntries(me2_y->getBin(j, i), 0);
501  }
502  }
503  }
504  }
505 }
506 
509  desc.add<std::string>("TopFolderName", "PixelPhase1/Tracks/ResidualsExtra")
510  ->setComment("Folder in which to write output histograms");
511  desc.add<std::string>("InputFolderName", "")->setComment("Folder from which to fetch in the input MEs");
512  desc.add<int>("MinHits", 30)->setComment("minimum number of hits per module to fill the DRnR plots");
513  descriptions.addWithDefaultLabel(desc);
514 }
515 
516 //define this as a plug-in
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
virtual double getBinEntries(int bin) const
get # of bin entries (for profiles)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::map< std::string, MonitorElement * > DRnR_
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
void bookMEs(DQMStore::IBooker &iBooker)
std::map< std::string, MonitorElement * > residuals_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiPixelPhase1ResidualsExtra(const edm::ParameterSet &conf)
virtual int getNbinsY() const
get # of bins in Y-axis
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void setBinEntries(int bin, double nentries)
set # of bin entries (to be used for profiles)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void fillMEs(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
void dqmEndJob(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override
HLT enums.
virtual int getBin(int binx, int biny) const
get global bin number (for 2-D profiles)
virtual int getNbinsX() const
get # of bins in X-axis
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45
virtual double getBinContent(int binx) const
get content of bin (1-D)