CMS 3D CMS Logo

PedsFullNoiseSummaryFactory.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <sstream>
7 
8 using namespace sistrip;
9 
10 // -----------------------------------------------------------------------------
11 //
13  PedsFullNoiseAnalysis* anal = dynamic_cast<PedsFullNoiseAnalysis*>(iter->second);
14  if (!anal) {
15  return;
16  }
17 
18  std::vector<float> temp(128, 1. * sistrip::invalid_);
19  std::vector<uint16_t> temp2(128, sistrip::invalid_);
20 
21  std::vector<std::vector<float> > value(2, temp);
22  std::vector<std::vector<float> > peds(2, temp);
23  std::vector<std::vector<float> > noise(2, temp);
24  std::vector<std::vector<float> > adProbab(2, temp);
25  std::vector<std::vector<float> > ksProbab(2, temp);
26  std::vector<std::vector<float> > jbProbab(2, temp);
27  std::vector<std::vector<float> > chi2Probab(2, temp);
28  std::vector<std::vector<float> > residualRMS(2, temp);
29  std::vector<std::vector<float> > residualGaus(2, temp);
30  std::vector<std::vector<float> > noiseSignificance(2, temp);
31  std::vector<std::vector<float> > residualMean(2, temp);
32  std::vector<std::vector<float> > residualSkewness(2, temp);
33  std::vector<std::vector<float> > residualKurtosis(2, temp);
34  std::vector<std::vector<float> > residualIntegralNsigma(2, temp);
35  std::vector<std::vector<float> > residualIntegral(2, temp);
36  std::vector<std::vector<uint16_t> > badStripBit(2, temp2);
37  std::vector<std::vector<uint16_t> > deadStripBit(2, temp2);
38 
39  // pedestal values
40  peds[0] = anal->peds()[0];
41  peds[1] = anal->peds()[1];
42  // noise values
43  noise[0] = anal->noise()[0];
44  noise[1] = anal->noise()[1];
45  // AD probab
46  adProbab[0] = anal->adProbab()[0];
47  adProbab[1] = anal->adProbab()[1];
48  // KS probab
49  ksProbab[0] = anal->ksProbab()[0];
50  ksProbab[1] = anal->ksProbab()[1];
51  // JB probab
52  jbProbab[0] = anal->jbProbab()[0];
53  jbProbab[1] = anal->jbProbab()[1];
54  // CHI2 probab
55  chi2Probab[0] = anal->chi2Probab()[0];
56  chi2Probab[1] = anal->chi2Probab()[1];
57  // noise RMS
58  chi2Probab[0] = anal->chi2Probab()[0];
59  chi2Probab[1] = anal->chi2Probab()[1];
60  // residual RMS
61  residualRMS[0] = anal->residualRMS()[0];
62  residualRMS[1] = anal->residualRMS()[1];
63  // residual Sigma
64  residualGaus[0] = anal->residualSigmaGaus()[0];
65  residualGaus[1] = anal->residualSigmaGaus()[1];
66  // noise Significance
67  noiseSignificance[0] = anal->noiseSignificance()[0];
68  noiseSignificance[1] = anal->noiseSignificance()[1];
69  // residual mean
70  residualMean[0] = anal->residualMean()[0];
71  residualMean[1] = anal->residualMean()[1];
72  // noise Skweness
73  residualSkewness[0] = anal->residualSkewness()[0];
74  residualSkewness[1] = anal->residualSkewness()[1];
75  // noise Kurtosis
76  residualKurtosis[0] = anal->residualKurtosis()[0];
77  residualKurtosis[1] = anal->residualKurtosis()[1];
78  // noise integral N sigma
79  residualIntegralNsigma[0] = anal->residualIntegralNsigma()[0];
80  residualIntegralNsigma[1] = anal->residualIntegralNsigma()[1];
81  // noise integral N sigma
82  residualIntegral[0] = anal->residualIntegral()[0];
83  residualIntegral[1] = anal->residualIntegral()[1];
84  // bit to indicate if a strip is flagged as bad or not
85  residualIntegral[0] = anal->residualIntegral()[0];
86  residualIntegral[1] = anal->residualIntegral()[1];
87  // bit to indicate if a strip is bad (1) or not (0)
88  badStripBit[0] = anal->badStripBit()[0];
89  badStripBit[1] = anal->badStripBit()[1];
90  // bit to indicate if a strip is dead (1) or not (0)
91  deadStripBit[0] = anal->deadStripBit()[0];
92  deadStripBit[1] = anal->deadStripBit()[1];
93 
94  bool all_strips = false;
95  // Monitor pedestals value for each strip
96  if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
97  all_strips = true;
98  uint16_t bins = peds[0].size();
99  if (peds[0].size() < peds[1].size()) {
100  bins = peds[1].size();
101  }
102  for (uint16_t iped = 0; iped < bins; iped++) {
103  value[0][iped] = peds[0][iped];
104  value[1][iped] = peds[1][iped];
105  }
106  }
107  // Monitor noise value for each strip
108  else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
109  all_strips = true;
110  uint16_t bins = noise[0].size();
111  if (noise[0].size() < noise[1].size()) {
112  bins = noise[1].size();
113  }
114  for (uint16_t inoise = 0; inoise < bins; inoise++) {
115  value[0][inoise] = noise[0][inoise];
116  value[1][inoise] = noise[1][inoise];
117  }
118  }
119  // Monitor pedestals aD probability for each strip
120  else if (mon_ == sistrip::AD_PROBAB_ALL_STRIPS) {
121  all_strips = true;
122  uint16_t bins = adProbab[0].size();
123  if (adProbab[0].size() < adProbab[1].size()) {
124  bins = adProbab[1].size();
125  }
126  for (uint16_t iad = 0; iad < bins; iad++) {
127  value[0][iad] = adProbab[0][iad];
128  value[1][iad] = adProbab[1][iad];
129  }
130  }
131  // Monitor pedestals KS probability for each strip
132  else if (mon_ == sistrip::KS_PROBAB_ALL_STRIPS) {
133  all_strips = true;
134  uint16_t bins = ksProbab[0].size();
135  if (ksProbab[0].size() < ksProbab[1].size()) {
136  bins = ksProbab[1].size();
137  }
138  for (uint16_t iks = 0; iks < bins; iks++) {
139  value[0][iks] = ksProbab[0][iks];
140  value[1][iks] = ksProbab[1][iks];
141  }
142  }
143  // Monitor pedestals JB probability for each strip
144  else if (mon_ == sistrip::JB_PROBAB_ALL_STRIPS) {
145  all_strips = true;
146  uint16_t bins = jbProbab[0].size();
147  if (jbProbab[0].size() < jbProbab[1].size()) {
148  bins = jbProbab[1].size();
149  }
150  for (uint16_t iks = 0; iks < bins; iks++) {
151  value[0][iks] = jbProbab[0][iks];
152  value[1][iks] = jbProbab[1][iks];
153  }
154  }
155  // Monitor pedestals Chi2 probability for each strip
156  else if (mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS) {
157  all_strips = true;
158  uint16_t bins = chi2Probab[0].size();
159  if (chi2Probab[0].size() < chi2Probab[1].size()) {
160  bins = chi2Probab[1].size();
161  }
162  for (uint16_t iks = 0; iks < bins; iks++) {
163  value[0][iks] = chi2Probab[0][iks];
164  value[1][iks] = chi2Probab[1][iks];
165  }
166  }
167  // Monitor pedestals RMS residual for each strip
168  else if (mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) {
169  all_strips = true;
170  uint16_t bins = residualRMS[0].size();
171  if (residualRMS[0].size() < residualRMS[1].size()) {
172  bins = residualRMS[1].size();
173  }
174  for (uint16_t iks = 0; iks < bins; iks++) {
175  value[0][iks] = residualRMS[0][iks];
176  value[1][iks] = residualRMS[1][iks];
177  }
178  }
179  // Monitor pedestals sigma from gaussian firt for each strip
180  else if (mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) {
181  all_strips = true;
182  uint16_t bins = residualGaus[0].size();
183  if (residualGaus[0].size() < residualGaus[1].size()) {
184  bins = residualGaus[1].size();
185  }
186  for (uint16_t iks = 0; iks < bins; iks++) {
187  value[0][iks] = residualGaus[0][iks];
188  value[1][iks] = residualGaus[1][iks];
189  }
190  }
191  // Monitor pedestals noise significance for each strip
192  else if (mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) {
193  all_strips = true;
194  uint16_t bins = noiseSignificance[0].size();
195  if (noiseSignificance[0].size() < noiseSignificance[1].size()) {
196  bins = noiseSignificance[1].size();
197  }
198  for (uint16_t iks = 0; iks < bins; iks++) {
199  value[0][iks] = noiseSignificance[0][iks];
200  value[1][iks] = noiseSignificance[1][iks];
201  }
202  }
203  // Monitor mean residual for each strip
204  else if (mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) {
205  all_strips = true;
206  uint16_t bins = residualMean[0].size();
207  if (residualMean[0].size() < residualMean[1].size()) {
208  bins = residualMean[1].size();
209  }
210  for (uint16_t iks = 0; iks < bins; iks++) {
211  value[0][iks] = residualMean[0][iks];
212  value[1][iks] = residualMean[1][iks];
213  }
214  }
215  // Monitor skweness for each strip
216  else if (mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) {
217  all_strips = true;
218  uint16_t bins = residualSkewness[0].size();
219  if (residualSkewness[0].size() < residualSkewness[1].size()) {
220  bins = residualSkewness[1].size();
221  }
222  for (uint16_t iks = 0; iks < bins; iks++) {
223  value[0][iks] = residualSkewness[0][iks];
224  value[1][iks] = residualSkewness[1][iks];
225  }
226  }
227  // Monitor Kurtosis for each strip
228  else if (mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) {
229  all_strips = true;
230  uint16_t bins = residualKurtosis[0].size();
231  if (residualKurtosis[0].size() < residualKurtosis[1].size()) {
232  bins = residualKurtosis[1].size();
233  }
234  for (uint16_t iks = 0; iks < bins; iks++) {
235  value[0][iks] = residualKurtosis[0][iks];
236  value[1][iks] = residualKurtosis[1][iks];
237  }
238  }
239  // Monitor Integral above N sigma for each strip
241  all_strips = true;
242  uint16_t bins = residualIntegralNsigma[0].size();
243  if (residualIntegralNsigma[0].size() < residualIntegralNsigma[1].size()) {
244  bins = residualIntegralNsigma[1].size();
245  }
246  for (uint16_t iks = 0; iks < bins; iks++) {
247  value[0][iks] = residualIntegralNsigma[0][iks];
248  value[1][iks] = residualIntegralNsigma[1][iks];
249  }
250  }
251  // Monitor integral for each strip
252  else if (mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) {
253  all_strips = true;
254  uint16_t bins = residualIntegral[0].size();
255  if (residualIntegral[0].size() < residualIntegral[1].size()) {
256  bins = residualIntegral[1].size();
257  }
258  for (uint16_t iks = 0; iks < bins; iks++) {
259  value[0][iks] = residualIntegral[0][iks];
260  value[1][iks] = residualIntegral[1][iks];
261  }
262  }
263 
264  // Monitor BadStrip bit
265  else if (mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) {
266  all_strips = true;
267  uint16_t bins = badStripBit[0].size();
268  if (badStripBit[0].size() < badStripBit[1].size()) {
269  bins = badStripBit[1].size();
270  }
271  for (uint16_t iks = 0; iks < bins; iks++) {
272  value[0][iks] = 1. * badStripBit[0][iks];
273  value[1][iks] = 1. * badStripBit[1][iks];
274  }
275  }
276  // Dead strip bit
277  else if (mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) {
278  all_strips = true;
279  uint16_t bins = deadStripBit[0].size();
280  if (deadStripBit[0].size() < deadStripBit[1].size()) {
281  bins = deadStripBit[1].size();
282  }
283  for (uint16_t iks = 0; iks < bins; iks++) {
284  value[0][iks] = 1. * deadStripBit[0][iks];
285  value[1][iks] = 1. * deadStripBit[1][iks];
286  }
287  }
288 
289  // Per APV information: pedsMean
290  else if (mon_ == sistrip::PEDESTALS_MEAN) {
291  value[0][0] = anal->pedsMean()[0];
292  value[1][0] = anal->pedsMean()[1];
293  }
294 
295  // Per APV information: pedsSpread
296  else if (mon_ == sistrip::PEDESTALS_SPREAD) {
297  value[0][0] = anal->pedsSpread()[0];
298  value[1][0] = anal->pedsSpread()[1];
299  }
300 
301  // Per APV information: pedsMax
302  else if (mon_ == sistrip::PEDESTALS_MAX) {
303  value[0][0] = anal->pedsMax()[0];
304  value[1][0] = anal->pedsMax()[1];
305  }
306 
307  // Per APV information: pedsMin
308  else if (mon_ == sistrip::PEDESTALS_MIN) {
309  value[0][0] = anal->pedsMin()[0];
310  value[1][0] = anal->pedsMin()[1];
311  }
312 
313  // Per APV information: noiseMean
314  else if (mon_ == sistrip::NOISE_MEAN) {
315  value[0][0] = anal->noiseMean()[0];
316  value[1][0] = anal->noiseMean()[1];
317  }
318  // Per APV information: noiseSpread
319  else if (mon_ == sistrip::NOISE_SPREAD) {
320  value[0][0] = anal->noiseSpread()[0];
321  value[1][0] = anal->noiseSpread()[1];
322  }
323  // Per APV information: noiseMax
324  else if (mon_ == sistrip::NOISE_MAX) {
325  value[0][0] = anal->noiseMax()[0];
326  value[1][0] = anal->noiseMax()[1];
327  }
328  // Per APV information: noiseMin
329  else if (mon_ == sistrip::NOISE_MIN) {
330  value[0][0] = anal->noiseMin()[0];
331  value[1][0] = anal->noiseMin()[1];
332  }
333 
334  // BAD channels per APV
335  else if (mon_ == sistrip::NUM_OF_DEAD) {
336  value[0][0] = 1. * anal->deadStrip()[0].size();
337  value[1][0] = 1. * anal->deadStrip()[1].size();
338  } else if (mon_ == sistrip::NUM_OF_BAD) {
339  value[0][0] = 1. * anal->badStrip()[0].size();
340  value[1][0] = 1. * anal->badStrip()[1].size();
341  } else if (mon_ == sistrip::NUM_OF_BAD_SHIFTED) {
342  value[0][0] = 1. * anal->shiftedStrip()[0].size();
343  value[1][0] = 1. * anal->shiftedStrip()[1].size();
344  } else if (mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) {
345  value[0][0] = 1. * anal->lowNoiseStrip()[0].size();
346  value[1][0] = 1. * anal->lowNoiseStrip()[1].size();
347  } else if (mon_ == sistrip::NUM_OF_BAD_LARGE_NOISE) {
348  value[0][0] = 1. * anal->largeNoiseStrip()[0].size();
349  value[1][0] = 1. * anal->largeNoiseStrip()[1].size();
350  } else if (mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) {
351  value[0][0] = 1. * anal->largeNoiseSignificance()[0].size();
352  value[1][0] = 1. * anal->largeNoiseSignificance()[1].size();
353  } else if (mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) {
354  value[0][0] = 1. * anal->badFitStatus()[0].size();
355  value[1][0] = 1. * anal->badFitStatus()[1].size();
356  } else if (mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) {
357  value[0][0] = 1. * anal->badADProbab()[0].size();
358  value[1][0] = 1. * anal->badADProbab()[1].size();
359  } else if (mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) {
360  value[0][0] = 1. * anal->badKSProbab()[0].size();
361  value[1][0] = 1. * anal->badKSProbab()[1].size();
362  } else if (mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) {
363  value[0][0] = 1. * anal->badJBProbab()[0].size();
364  value[1][0] = 1. * anal->badJBProbab()[1].size();
365  } else if (mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) {
366  value[0][0] = 1. * anal->badChi2Probab()[0].size();
367  value[1][0] = 1. * anal->badChi2Probab()[1].size();
368  } else if (mon_ == sistrip::NUM_OF_BAD_TAIL) {
369  value[0][0] = 1. * anal->badTailStrip()[0].size();
370  value[1][0] = 1. * anal->badTailStrip()[1].size();
371  } else if (mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) {
372  value[0][0] = 1. * anal->badDoublePeakStrip()[0].size();
373  value[1][0] = 1. * anal->badDoublePeakStrip()[1].size();
374  } else {
375  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
376  << " Unexpected monitorable: "
378  return;
379  }
380 
381  if (!all_strips) {
384 
387 
388  } else {
389  for (uint16_t istr = 0; istr < value[0].size(); istr++) {
392  }
393 
394  for (uint16_t istr = 0; istr < value[1].size(); istr++) {
397  }
398  }
399 }
400 
401 // -----------------------------------------------------------------------------
402 //
404  if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
405  generator_->axisLabel("Pedestal value [adc]");
406  } else if (mon_ == sistrip::PEDESTALS_MEAN) {
407  } else if (mon_ == sistrip::PEDESTALS_SPREAD) {
408  } else if (mon_ == sistrip::PEDESTALS_MAX) {
409  } else if (mon_ == sistrip::PEDESTALS_MIN) {
410  } else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
411  generator_->axisLabel("Noise [adc]");
412  } else if (mon_ == sistrip::NOISE_MEAN) {
413  } else if (mon_ == sistrip::NOISE_SPREAD) {
414  } else if (mon_ == sistrip::NOISE_MAX) {
415  } else if (mon_ == sistrip::NOISE_MIN) {
416  } else if (mon_ == sistrip::AD_PROBAB_ALL_STRIPS) {
417  generator_->axisLabel("Anderson-Darling p-value");
418  } else if (mon_ == sistrip::KS_PROBAB_ALL_STRIPS) {
419  generator_->axisLabel("Kolmogorov-Smirnov p-value");
420  } else if (mon_ == sistrip::JB_PROBAB_ALL_STRIPS) {
421  generator_->axisLabel("Jacque-Bera p-value");
422  } else if (mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS) {
423  generator_->axisLabel("Chi2 p-value");
424  } else if (mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) {
425  generator_->axisLabel("Residual RMS [adc]");
426  } else if (mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) {
427  generator_->axisLabel("Residual Gaus [adc]");
428  } else if (mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) {
429  generator_->axisLabel("Noise Significance");
430  } else if (mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) {
431  generator_->axisLabel("Residual Mean [adc]");
432  } else if (mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) {
433  generator_->axisLabel("Residual Skewness [adc]");
434  } else if (mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) {
435  generator_->axisLabel("Residual Kurtosis [adc]");
436  } else if (mon_ == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS) {
437  generator_->axisLabel("Residual Integral at N sigma");
438  } else if (mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) {
439  generator_->axisLabel("Residual Integral");
440  } else if (mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) {
441  generator_->axisLabel("Bad Strip Bit");
442  } else if (mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) {
443  generator_->axisLabel("Dead Strip Bit");
444  } else if (mon_ == sistrip::NUM_OF_DEAD) {
445  } else if (mon_ == sistrip::NUM_OF_BAD) {
446  } else if (mon_ == sistrip::NUM_OF_BAD_SHIFTED) {
447  } else if (mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) {
448  } else if (mon_ == sistrip::NUM_OF_BAD_LARGE_NOISE) {
449  } else if (mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) {
450  } else if (mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) {
451  } else if (mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) {
452  } else if (mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) {
453  } else if (mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) {
454  } else if (mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) {
455  } else if (mon_ == sistrip::NUM_OF_BAD_TAIL) {
456  } else if (mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) {
457  }
458 
459  else {
460  edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
461  << " Unexpected SummaryHisto value:"
463  }
464 }
size
Write out results.
static std::string monitorable(const sistrip::Monitorable &)
sistrip::Monitorable mon_
sistrip classes
Histogram-based analysis for pedestal run.
void fillMap(const std::string &top_level_dir, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error=0.)
Definition: value.py:1
sistrip::Granularity gran_
static const char mlSummaryPlots_[]
SummaryGenerator * generator_
static const uint16_t invalid_
Definition: Constants.h:16
Log< level::Warning, false > LogWarning