CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EBPedestalClient.cc
Go to the documentation of this file.
1 /*
2  * \file EBPedestalClient.cc
3  *
4  * \author G. Della Ricca
5  * \author F. Cossutti
6  *
7 */
8 
9 #include <memory>
10 #include <iostream>
11 #include <fstream>
12 #include <iomanip>
13 #include <math.h>
14 
16 
19 
20 #ifdef WITH_ECAL_COND_DB
28 #endif
29 
31 
34 
36 
37 // #define COMMON_NOISE_ANALYSIS
38 
40 
41  // cloneME switch
42  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
43 
44  // verbose switch
45  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
46 
47  // debug switch
48  debug_ = ps.getUntrackedParameter<bool>("debug", false);
49 
50  // prefixME path
51  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
52 
53  // enableCleanup_ switch
54  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
55 
56  // vector of selected Super Modules (Defaults to all 36).
57  superModules_.reserve(36);
58  for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
59  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
60 
61  MGPAGains_.reserve(3);
62  for ( unsigned int i = 1; i <= 3; i++ ) MGPAGains_.push_back(i);
63  MGPAGains_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGains", MGPAGains_);
64 
65  MGPAGainsPN_.reserve(2);
66  for ( unsigned int i = 1; i <= 3; i++ ) MGPAGainsPN_.push_back(i);
67  MGPAGainsPN_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGainsPN", MGPAGainsPN_);
68 
69  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
70 
71  int ism = superModules_[i];
72 
73  h01_[ism-1] = 0;
74  h02_[ism-1] = 0;
75  h03_[ism-1] = 0;
76 
77  j01_[ism-1] = 0;
78  j02_[ism-1] = 0;
79  j03_[ism-1] = 0;
80 
81  k01_[ism-1] = 0;
82  k02_[ism-1] = 0;
83  k03_[ism-1] = 0;
84 
85  i01_[ism-1] = 0;
86  i02_[ism-1] = 0;
87 
88  }
89 
90  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
91 
92  int ism = superModules_[i];
93 
94  meg01_[ism-1] = 0;
95  meg02_[ism-1] = 0;
96  meg03_[ism-1] = 0;
97 
98  meg04_[ism-1] = 0;
99  meg05_[ism-1] = 0;
100 
101  mep01_[ism-1] = 0;
102  mep02_[ism-1] = 0;
103  mep03_[ism-1] = 0;
104 
105  mer01_[ism-1] = 0;
106  mer02_[ism-1] = 0;
107  mer03_[ism-1] = 0;
108 
109  mer04_[ism-1] = 0;
110  mer05_[ism-1] = 0;
111 
112 #ifdef COMMON_NOISE_ANALYSIS
113  mes01_[ism-1] = 0;
114  mes02_[ism-1] = 0;
115  mes03_[ism-1] = 0;
116 
117  met01_[ism-1] = 0;
118  met02_[ism-1] = 0;
119  met03_[ism-1] = 0;
120 #endif
121 
122  }
123 
124  expectedMean_[0] = 200.0;
125  expectedMean_[1] = 200.0;
126  expectedMean_[2] = 200.0;
127 
128  discrepancyMean_[0] = 25.0;
129  discrepancyMean_[1] = 25.0;
130  discrepancyMean_[2] = 25.0;
131 
132  RMSThreshold_[0] = 1.0;
133  RMSThreshold_[1] = 1.2;
134  RMSThreshold_[2] = 2.0;
135 
136  expectedMeanPn_[0] = 750.0;
137  expectedMeanPn_[1] = 750.0;
138 
139  discrepancyMeanPn_[0] = 100.0;
140  discrepancyMeanPn_[1] = 100.0;
141 
142  RMSThresholdPn_[0] = 999.;
143  RMSThresholdPn_[1] = 999.;
144 
145 }
146 
148 
149 }
150 
152 
154 
155  if ( debug_ ) std::cout << "EBPedestalClient: beginJob" << std::endl;
156 
157  ievt_ = 0;
158  jevt_ = 0;
159 
160 }
161 
163 
164  if ( debug_ ) std::cout << "EBPedestalClient: beginRun" << std::endl;
165 
166  jevt_ = 0;
167 
168  this->setup();
169 
170 }
171 
173 
174  if ( debug_ ) std::cout << "EBPedestalClient: endJob, ievt = " << ievt_ << std::endl;
175 
176  this->cleanup();
177 
178 }
179 
181 
182  if ( debug_ ) std::cout << "EBPedestalClient: endRun, jevt = " << jevt_ << std::endl;
183 
184  this->cleanup();
185 
186 }
187 
189 
191 
192  dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalClient" );
193 
194  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
195 
196  int ism = superModules_[i];
197 
198  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
199  if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
200  name = "EBPT pedestal quality G01 " + Numbers::sEB(ism);
201  meg01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
202  meg01_[ism-1]->setAxisTitle("ieta", 1);
203  meg01_[ism-1]->setAxisTitle("iphi", 2);
204  }
205  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
206  if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
207  name = "EBPT pedestal quality G06 " + Numbers::sEB(ism);
208  meg02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
209  meg02_[ism-1]->setAxisTitle("ieta", 1);
210  meg02_[ism-1]->setAxisTitle("iphi", 2);
211  }
212  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
213  if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
214  name = "EBPT pedestal quality G12 " + Numbers::sEB(ism);
215  meg03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
216  meg03_[ism-1]->setAxisTitle("ieta", 1);
217  meg03_[ism-1]->setAxisTitle("iphi", 2);
218  }
219 
220  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
221  if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
222  name = "EBPT pedestal quality PNs G01 " + Numbers::sEB(ism);
223  meg04_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
224  meg04_[ism-1]->setAxisTitle("pseudo-strip", 1);
225  meg04_[ism-1]->setAxisTitle("channel", 2);
226  }
227  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
228  if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
229  name = "EBPT pedestal quality PNs G16 " + Numbers::sEB(ism);
230  meg05_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
231  meg05_[ism-1]->setAxisTitle("pseudo-strip", 1);
232  meg05_[ism-1]->setAxisTitle("channel", 2);
233  }
234 
235  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
236  if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
237  name = "EBPT pedestal mean G01 " + Numbers::sEB(ism);
238  mep01_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
239  mep01_[ism-1]->setAxisTitle("mean", 1);
240  }
241  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
242  if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
243  name = "EBPT pedestal mean G06 " + Numbers::sEB(ism);
244  mep02_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
245  mep02_[ism-1]->setAxisTitle("mean", 1);
246  }
247  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
248  if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
249  name = "EBPT pedestal mean G12 " + Numbers::sEB(ism);
250  mep03_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
251  mep03_[ism-1]->setAxisTitle("mean", 1);
252  }
253 
254  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
255  if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
256  name = "EBPT pedestal rms G01 " + Numbers::sEB(ism);
257  mer01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
258  mer01_[ism-1]->setAxisTitle("rms", 1);
259  }
260  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
261  if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
262  name = "EBPT pedestal rms G06 " + Numbers::sEB(ism);
263  mer02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
264  mer02_[ism-1]->setAxisTitle("rms", 1);
265  }
266  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
267  if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
268  name = "EBPT pedestal rms G12 " + Numbers::sEB(ism);
269  mer03_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
270  mer03_[ism-1]->setAxisTitle("rms", 1);
271  }
272 
273  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
274  if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
275  name = "EBPDT PNs pedestal rms " + Numbers::sEB(ism) + " G01";
276  mer04_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
277  mer04_[ism-1]->setAxisTitle("rms", 1);
278  }
279  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
280  if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
281  name = "EBPDT PNs pedestal rms " + Numbers::sEB(ism) + " G16";
282  mer05_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
283  mer05_[ism-1]->setAxisTitle("rms", 1);
284  }
285 
286 #ifdef COMMON_NOISE_ANALYSIS
287  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
288  if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
289  name = "EBPT pedestal 3sum G01 " + Numbers::sEB(ism);
290  mes01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
291  mes01_[ism-1]->setAxisTitle("ieta", 1);
292  mes01_[ism-1]->setAxisTitle("iphi", 2);
293  }
294  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
295  if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
296  name = "EBPT pedestal 3sum G06 " + Numbers::sEB(ism);
297  mes02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
298  mes02_[ism-1]->setAxisTitle("ieta", 1);
299  mes02_[ism-1]->setAxisTitle("iphi", 2);
300  }
301  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
302  if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
303  name = "EBPT pedestal 3sum G12 " + Numbers::sEB(ism);
304  mes03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
305  mes03_[ism-1]->setAxisTitle("ieta", 1);
306  mes03_[ism-1]->setAxisTitle("iphi", 2);
307  }
308 
309  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
310  if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
311  name = "EBPT pedestal 5sum G01 " + Numbers::sEB(ism);
312  met01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
313  met01_[ism-1]->setAxisTitle("ieta", 1);
314  met01_[ism-1]->setAxisTitle("iphi", 2);
315  }
316  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
317  if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
318  name = "EBPT pedestal 5sum G06 " + Numbers::sEB(ism);
319  met02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
320  met02_[ism-1]->setAxisTitle("ieta", 1);
321  met02_[ism-1]->setAxisTitle("iphi", 2);
322  }
323  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
324  if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
325  name = "EBPT pedestal 5sum G12 " + Numbers::sEB(ism);
326  met03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
327  met03_[ism-1]->setAxisTitle("ieta", 1);
328  met03_[ism-1]->setAxisTitle("iphi", 2);
329  }
330 #endif
331 
332  }
333 
334  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
335 
336  int ism = superModules_[i];
337 
338  if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
339  if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
340  if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
341 
342  if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
343  if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
344 
345  for ( int ie = 1; ie <= 85; ie++ ) {
346  for ( int ip = 1; ip <= 20; ip++ ) {
347 
348  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
349  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
350  if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ie, ip, 2. );
351 
352  }
353  }
354 
355  for ( int i = 1; i <= 10; i++ ) {
356 
357  if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
358  if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
359 
360  }
361 
362  if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
363  if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
364  if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
365 
366  if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
367  if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
368  if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
369 
370  if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
371  if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
372 
373 #ifdef COMMON_NOISE_ANALYSIS
374  if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
375  if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
376  if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
377 
378  if ( met01_[ism-1] ) met01_[ism-1]->Reset();
379  if ( met02_[ism-1] ) met02_[ism-1]->Reset();
380  if ( met03_[ism-1] ) met03_[ism-1]->Reset();
381 
382  for ( int ie = 1; ie <= 85; ie++ ) {
383  for ( int ip = 1; ip <= 20; ip++ ) {
384 
385  if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent( ie, ip, -999. );
386  if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent( ie, ip, -999. );
387  if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent( ie, ip, -999. );
388 
389  if ( met01_[ism-1] ) met01_[ism-1]->setBinContent( ie, ip, -999. );
390  if ( met02_[ism-1] ) met02_[ism-1]->setBinContent( ie, ip, -999. );
391  if ( met03_[ism-1] ) met03_[ism-1]->setBinContent( ie, ip, -999. );
392 
393  }
394  }
395 #endif
396 
397  }
398 
399 }
400 
402 
403  if ( ! enableCleanup_ ) return;
404 
405  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
406 
407  int ism = superModules_[i];
408 
409  if ( cloneME_ ) {
410  if ( h01_[ism-1] ) delete h01_[ism-1];
411  if ( h02_[ism-1] ) delete h02_[ism-1];
412  if ( h03_[ism-1] ) delete h03_[ism-1];
413 
414  if ( j01_[ism-1] ) delete j01_[ism-1];
415  if ( j02_[ism-1] ) delete j02_[ism-1];
416  if ( j03_[ism-1] ) delete j03_[ism-1];
417 
418  if ( k01_[ism-1] ) delete k01_[ism-1];
419  if ( k02_[ism-1] ) delete k02_[ism-1];
420  if ( k03_[ism-1] ) delete k03_[ism-1];
421 
422  if ( i01_[ism-1] ) delete i01_[ism-1];
423  if ( i02_[ism-1] ) delete i02_[ism-1];
424  }
425 
426  h01_[ism-1] = 0;
427  h02_[ism-1] = 0;
428  h03_[ism-1] = 0;
429 
430  j01_[ism-1] = 0;
431  j02_[ism-1] = 0;
432  j03_[ism-1] = 0;
433 
434  k01_[ism-1] = 0;
435  k02_[ism-1] = 0;
436  k03_[ism-1] = 0;
437 
438  i01_[ism-1] = 0;
439  i02_[ism-1] = 0;
440 
441  }
442 
443  dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalClient" );
444 
445  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
446 
447  int ism = superModules_[i];
448 
449  if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
450  meg01_[ism-1] = 0;
451  if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
452  meg02_[ism-1] = 0;
453  if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
454  meg03_[ism-1] = 0;
455 
456  if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
457  meg04_[ism-1] = 0;
458  if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
459  meg05_[ism-1] = 0;
460 
461  if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
462  mep01_[ism-1] = 0;
463  if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
464  mep02_[ism-1] = 0;
465  if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
466  mep03_[ism-1] = 0;
467 
468  if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
469  mer01_[ism-1] = 0;
470  if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
471  mer02_[ism-1] = 0;
472  if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
473  mer03_[ism-1] = 0;
474 
475  if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
476  mer04_[ism-1] = 0;
477  if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
478  mer05_[ism-1] = 0;
479 
480 #ifdef COMMON_NOISE_ANALYSIS
481  if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
482  mes01_[ism-1] = 0;
483  if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
484  mes02_[ism-1] = 0;
485  if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
486  mes03_[ism-1] = 0;
487 
488  if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
489  met01_[ism-1] = 0;
490  if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
491  met02_[ism-1] = 0;
492  if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
493  met03_[ism-1] = 0;
494 #endif
495 
496  }
497 
498 }
499 
500 #ifdef WITH_ECAL_COND_DB
501 bool EBPedestalClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
502 
503  status = true;
504 
505  EcalLogicID ecid;
506 
508  std::map<EcalLogicID, MonPedestalsDat> dataset1;
509 
510  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
511 
512  int ism = superModules_[i];
513 
514  if ( verbose_ ) {
515  std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
516  std::cout << std::endl;
517  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
518  UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
519  }
520  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
521  UtilsClient::printBadChannels(meg02_[ism-1], h02_[ism-1]);
522  }
523  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
524  UtilsClient::printBadChannels(meg03_[ism-1], h03_[ism-1]);
525  }
526  }
527 
528  for ( int ie = 1; ie <= 85; ie++ ) {
529  for ( int ip = 1; ip <= 20; ip++ ) {
530 
531  bool update01;
532  bool update02;
533  bool update03;
534 
535  float num01, num02, num03;
536  float mean01, mean02, mean03;
537  float rms01, rms02, rms03;
538 
539  update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
540  update02 = UtilsClient::getBinStatistics(h02_[ism-1], ie, ip, num02, mean02, rms02);
541  update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03);
542 
543  if ( update01 || update02 || update03 ) {
544 
545  if ( Numbers::icEB(ism, ie, ip) == 1 ) {
546 
547  if ( verbose_ ) {
548  std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
549  std::cout << "G01 (" << ie << "," << ip << ") " << num01 << " " << mean01 << " " << rms01 << std::endl;
550  std::cout << "G06 (" << ie << "," << ip << ") " << num02 << " " << mean02 << " " << rms02 << std::endl;
551  std::cout << "G12 (" << ie << "," << ip << ") " << num03 << " " << mean03 << " " << rms03 << std::endl;
552  std::cout << std::endl;
553  }
554 
555  }
556 
557  p.setPedMeanG1(mean01);
558  p.setPedRMSG1(rms01);
559 
560  p.setPedMeanG6(mean02);
561  p.setPedRMSG6(rms02);
562 
563  p.setPedMeanG12(mean03);
564  p.setPedRMSG12(rms03);
565 
566  if ( UtilsClient::getBinStatus(meg01_[ism-1], ie, ip) &&
567  UtilsClient::getBinStatus(meg02_[ism-1], ie, ip) &&
568  UtilsClient::getBinStatus(meg03_[ism-1], ie, ip) ) {
569  p.setTaskStatus(true);
570  } else {
571  p.setTaskStatus(false);
572  }
573 
574  status = status && UtilsClient::getBinQuality(meg01_[ism-1], ie, ip) &&
575  UtilsClient::getBinQuality(meg02_[ism-1], ie, ip) &&
576  UtilsClient::getBinQuality(meg03_[ism-1], ie, ip);
577 
578  int ic = Numbers::indexEB(ism, ie, ip);
579 
580  if ( econn ) {
581  ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic);
582  dataset1[ecid] = p;
583  }
584 
585  }
586 
587  }
588  }
589 
590  }
591 
592  if ( econn ) {
593  try {
594  if ( verbose_ ) std::cout << "Inserting MonPedestalsDat ..." << std::endl;
595  if ( dataset1.size() != 0 ) econn->insertDataArraySet(&dataset1, moniov);
596  if ( verbose_ ) std::cout << "done." << std::endl;
597  } catch (std::runtime_error &e) {
598  std::cerr << e.what() << std::endl;
599  }
600  }
601 
602  if ( verbose_ ) std::cout << std::endl;
603 
604  MonPNPedDat pn;
605  std::map<EcalLogicID, MonPNPedDat> dataset2;
606 
607  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
608 
609  int ism = superModules_[i];
610 
611  if ( verbose_ ) {
612  std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
613  std::cout << std::endl;
614  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
615  UtilsClient::printBadChannels(meg04_[ism-1], i01_[ism-1]);
616  }
617  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
618  UtilsClient::printBadChannels(meg05_[ism-1], i02_[ism-1]);
619  }
620  }
621 
622  for ( int i = 1; i <= 10; i++ ) {
623 
624  bool update01;
625  bool update02;
626 
627  float num01, num02;
628  float mean01, mean02;
629  float rms01, rms02;
630 
631  update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
632  update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
633 
634  if ( update01 || update02 ) {
635 
636  if ( i == 1 ) {
637 
638  if ( verbose_ ) {
639  std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
640  std::cout << "PNs (" << i << ") G01 " << num01 << " " << mean01 << " " << rms01 << std::endl;
641  std::cout << "PNs (" << i << ") G16 " << num01 << " " << mean01 << " " << rms01 << std::endl;
642  std::cout << std::endl;
643  }
644 
645  }
646 
647  pn.setPedMeanG1(mean01);
648  pn.setPedRMSG1(rms01);
649 
650  pn.setPedMeanG16(mean02);
651  pn.setPedRMSG16(rms02);
652 
653  if ( UtilsClient::getBinStatus(meg04_[ism-1], i, 1) &&
654  UtilsClient::getBinStatus(meg05_[ism-1], i, 1) ) {
655  pn.setTaskStatus(true);
656  } else {
657  pn.setTaskStatus(false);
658  }
659 
660  status = status && UtilsClient::getBinQuality(meg04_[ism-1], i, 1) &&
661  UtilsClient::getBinQuality(meg05_[ism-1], i, 1);
662 
663  if ( econn ) {
664  ecid = LogicID::getEcalLogicID("EB_LM_PN", Numbers::iSM(ism, EcalBarrel), i-1);
665  dataset2[ecid] = pn;
666  }
667 
668  }
669 
670  }
671 
672  }
673 
674  if ( econn ) {
675  try {
676  if ( verbose_ ) std::cout << "Inserting MonPNPedDat ..." << std::endl;
677  if ( dataset2.size() != 0 ) econn->insertDataArraySet(&dataset2, moniov);
678  if ( verbose_ ) std::cout << "done." << std::endl;
679  } catch (std::runtime_error &e) {
680  std::cerr << e.what() << std::endl;
681  }
682  }
683 
684  return true;
685 
686 }
687 #endif
688 
690 
691  ievt_++;
692  jevt_++;
693  if ( ievt_ % 10 == 0 ) {
694  if ( debug_ ) std::cout << "EBPedestalClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
695  }
696 
697  uint32_t bits01 = 0;
700 
701  uint32_t bits02 = 0;
704 
705  uint32_t bits03 = 0;
708 
709  MonitorElement* me;
710 
711  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
712 
713  int ism = superModules_[i];
714 
715  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
716 
717  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal " + Numbers::sEB(ism) + " G01");
718  h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
719 
720  }
721 
722  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
723 
724  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal " + Numbers::sEB(ism) + " G06");
725  h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
726 
727  }
728 
729  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
730 
731  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal " + Numbers::sEB(ism) + " G12");
732  h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
733 
734  }
735 
736 #ifdef COMMON_NOISE_ANALYSIS
737  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
738 
739  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G01");
740  j01_[ism-1] = UtilsClient::getHisto( me, cloneME_, j01_[ism-1] );
741 
742  }
743 
744  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
745 
746  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G06");
747  j02_[ism-1] = UtilsClient::getHisto( me, cloneME_, j02_[ism-1] );
748 
749  }
750 
751  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
752 
753  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G12");
754  j03_[ism-1] = UtilsClient::getHisto( me, cloneME_, j03_[ism-1] );
755 
756  }
757 
758  if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
759 
760  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G01");
761  k01_[ism-1] = UtilsClient::getHisto( me, cloneME_, k01_[ism-1] );
762 
763  }
764 
765  if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
766 
767  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G06");
768  k02_[ism-1] = UtilsClient::getHisto( me, cloneME_, k02_[ism-1] );
769 
770  }
771 
772  if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
773 
774  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G12");
775  k03_[ism-1] = UtilsClient::getHisto( me, cloneME_, k03_[ism-1] );
776 
777  }
778 #endif
779 
780  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
781 
782  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/PN/Gain01/EBPDT PNs pedestal " + Numbers::sEB(ism) + " G01");
783  i01_[ism-1] = UtilsClient::getHisto( me, cloneME_, i01_[ism-1] );
784 
785  }
786 
787  if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
788 
789  me = dqmStore_->get(prefixME_ + "/EBPedestalTask/PN/Gain16/EBPDT PNs pedestal " + Numbers::sEB(ism) + " G16");
790  i02_[ism-1] = UtilsClient::getHisto( me, cloneME_, i02_[ism-1] );
791 
792  }
793 
794  if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
795  if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
796  if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
797 
798  if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
799  if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
800 
801  if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
802  if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
803  if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
804 
805  if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
806  if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
807  if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
808 
809  if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
810  if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
811 
812 #ifdef COMMON_NOISE_ANALYSIS
813  if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
814  if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
815  if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
816 
817  if ( met01_[ism-1] ) met01_[ism-1]->Reset();
818  if ( met02_[ism-1] ) met02_[ism-1]->Reset();
819  if ( met03_[ism-1] ) met03_[ism-1]->Reset();
820 #endif
821 
822  for ( int ie = 1; ie <= 85; ie++ ) {
823  for ( int ip = 1; ip <= 20; ip++ ) {
824 
825  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, 2.);
826  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ie, ip, 2.);
827  if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, 2.);
828 
829  bool update01;
830  bool update02;
831  bool update03;
832 
833  float num01, num02, num03;
834  float mean01, mean02, mean03;
835  float rms01, rms02, rms03;
836 
837  update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
838  update02 = UtilsClient::getBinStatistics(h02_[ism-1], ie, ip, num02, mean02, rms02);
839  update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03);
840 
841  if ( update01 ) {
842 
843  float val;
844 
845  val = 1.;
846  if ( std::abs(mean01 - expectedMean_[0]) > discrepancyMean_[0] )
847  val = 0.;
848  if ( rms01 > RMSThreshold_[0] )
849  val = 0.;
850  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, val);
851 
852  if ( mep01_[ism-1] ) mep01_[ism-1]->Fill(mean01);
853  if ( mer01_[ism-1] ) mer01_[ism-1]->Fill(rms01);
854 
855  }
856 
857  if ( update02 ) {
858 
859  float val;
860 
861  val = 1.;
862  if ( std::abs(mean02 - expectedMean_[1]) > discrepancyMean_[1] )
863  val = 0.;
864  if ( rms02 > RMSThreshold_[1] )
865  val = 0.;
866  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ie, ip, val);
867 
868  if ( mep02_[ism-1] ) mep02_[ism-1]->Fill(mean02);
869  if ( mer02_[ism-1] ) mer02_[ism-1]->Fill(rms02);
870 
871  }
872 
873  if ( update03 ) {
874 
875  float val;
876 
877  val = 1.;
878  if ( std::abs(mean03 - expectedMean_[2]) > discrepancyMean_[2] )
879  val = 0.;
880  if ( rms03 > RMSThreshold_[2] )
881  val = 0.;
882  if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, val);
883 
884  if ( mep03_[ism-1] ) mep03_[ism-1]->Fill(mean03);
885  if ( mer03_[ism-1] ) mer03_[ism-1]->Fill(rms03);
886 
887  }
888 
889  if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
890  if ( Masks::maskChannel(ism, ie, ip, bits02, EcalBarrel) ) UtilsClient::maskBinContent( meg02_[ism-1], ie, ip );
891  if ( Masks::maskChannel(ism, ie, ip, bits03, EcalBarrel) ) UtilsClient::maskBinContent( meg03_[ism-1], ie, ip );
892 
893  }
894  }
895 
896  // PN diodes
897 
898  for ( int i = 1; i <= 10; i++ ) {
899 
900  if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
901  if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
902 
903  bool update01;
904  bool update02;
905 
906  float num01, num02;
907  float mean01, mean02;
908  float rms01, rms02;
909 
910  update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
911  update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
912 
913  // filling projections
914  if ( mer04_[ism-1] ) mer04_[ism-1]->Fill(rms01);
915  if ( mer05_[ism-1] ) mer05_[ism-1]->Fill(rms02);
916 
917  if ( update01 ) {
918 
919  float val;
920 
921  val = 1.;
922  if ( mean01 < (expectedMeanPn_[0] - discrepancyMeanPn_[0])
923  || (expectedMeanPn_[0] + discrepancyMeanPn_[0]) < mean01)
924  val = 0.;
925  if ( rms01 > RMSThresholdPn_[0])
926  val = 0.;
927 
928  if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent(i, 1, val);
929 
930  }
931 
932  if ( update02 ) {
933 
934  float val;
935 
936  val = 1.;
937  if ( mean02 < (expectedMeanPn_[1] - discrepancyMeanPn_[1])
938  || (expectedMeanPn_[1] + discrepancyMeanPn_[1]) < mean02)
939  val = 0.;
940  if ( rms02 > RMSThresholdPn_[1])
941  val = 0.;
942 
943  if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent(i, 1, val);
944  }
945 
946  if ( Masks::maskPn(ism, i, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg04_[ism-1], i, 1 );
947  if ( Masks::maskPn(ism, i, bits03, EcalBarrel) ) UtilsClient::maskBinContent( meg05_[ism-1], i, 1 );
948 
949  }
950 
951 #ifdef COMMON_NOISE_ANALYSIS
952  for ( int ie = 1; ie <= 85; ie++ ) {
953  for ( int ip = 1; ip <= 20; ip++ ) {
954 
955  float x3val01;
956  float x3val02;
957  float x3val03;
958 
959  float y3val01;
960  float y3val02;
961  float y3val03;
962 
963  float z3val01;
964  float z3val02;
965  float z3val03;
966 
967  float x5val01;
968  float x5val02;
969  float x5val03;
970 
971  float y5val01;
972  float y5val02;
973  float y5val03;
974 
975  float z5val01;
976  float z5val02;
977  float z5val03;
978 
979  if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ie, ip, -999.);
980  if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ie, ip, -999.);
981  if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ie, ip, -999.);
982 
983  if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ie, ip, -999.);
984  if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ie, ip, -999.);
985  if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ie, ip, -999.);
986 
987  if ( ie >= 2 && ie <= 84 && ip >= 2 && ip <= 19 ) {
988 
989  x3val01 = 0.;
990  x3val02 = 0.;
991  x3val03 = 0.;
992  for ( int i = -1; i <= +1; i++ ) {
993  for ( int j = -1; j <= +1; j++ ) {
994 
995  if ( h01_[ism-1] ) x3val01 = x3val01 + h01_[ism-1]->GetBinError(ie+i, ip+j) *
996  h01_[ism-1]->GetBinError(ie+i, ip+j);
997 
998  if ( h02_[ism-1] ) x3val02 = x3val02 + h02_[ism-1]->GetBinError(ie+i, ip+j) *
999  h02_[ism-1]->GetBinError(ie+i, ip+j);
1000 
1001  if ( h03_[ism-1] ) x3val03 = x3val03 + h03_[ism-1]->GetBinError(ie+i, ip+j) *
1002  h03_[ism-1]->GetBinError(ie+i, ip+j);
1003 
1004  }
1005  }
1006  x3val01 = x3val01 / (9.*9.);
1007  x3val02 = x3val02 / (9.*9.);
1008  x3val03 = x3val03 / (9.*9.);
1009 
1010  y3val01 = 0.;
1011  if ( j01_[ism-1] ) y3val01 = j01_[ism-1]->GetBinError(ie, ip) *
1012  j01_[ism-1]->GetBinError(ie, ip);
1013 
1014  y3val02 = 0.;
1015  if ( j02_[ism-1] ) y3val02 = j02_[ism-1]->GetBinError(ie, ip) *
1016  j02_[ism-1]->GetBinError(ie, ip);
1017 
1018  y3val03 = 0.;
1019  if ( j03_[ism-1] ) y3val03 = j03_[ism-1]->GetBinError(ie, ip) *
1020  j03_[ism-1]->GetBinError(ie, ip);
1021 
1022  z3val01 = -999.;
1023  if ( x3val01 != 0 && y3val01 != 0 ) z3val01 = sqrt(std::abs(x3val01 - y3val01));
1024  if ( (x3val01 - y3val01) < 0 ) z3val01 = -z3val01;
1025 
1026  if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ie, ip, z3val01);
1027 
1028  z3val02 = -999.;
1029  if ( x3val02 != 0 && y3val02 != 0 ) z3val02 = sqrt(std::abs(x3val02 - y3val02));
1030  if ( (x3val02 - y3val02) < 0 ) z3val02 = -z3val02;
1031 
1032  if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ie, ip, z3val02);
1033 
1034  z3val03 = -999.;
1035  if ( x3val03 != 0 && y3val03 != 0 ) z3val03 = sqrt(std::abs(x3val03 - y3val03));
1036  if ( (x3val03 - y3val03) < 0 ) z3val03 = -z3val03;
1037 
1038  if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ie, ip, z3val03);
1039 
1040  }
1041 
1042  if ( ie >= 3 && ie <= 83 && ip >= 3 && ip <= 18 ) {
1043 
1044  x5val01 = 0.;
1045  x5val02 = 0.;
1046  x5val03 = 0.;
1047  for ( int i = -2; i <= +2; i++ ) {
1048  for ( int j = -2; j <= +2; j++ ) {
1049 
1050  if ( h01_[ism-1] ) x5val01 = x5val01 + h01_[ism-1]->GetBinError(ie+i, ip+j) *
1051  h01_[ism-1]->GetBinError(ie+i, ip+j);
1052 
1053  if ( h02_[ism-1] ) x5val02 = x5val02 + h02_[ism-1]->GetBinError(ie+i, ip+j) *
1054  h02_[ism-1]->GetBinError(ie+i, ip+j);
1055 
1056  if ( h03_[ism-1] ) x5val03 = x5val03 + h03_[ism-1]->GetBinError(ie+i, ip+j) *
1057  h03_[ism-1]->GetBinError(ie+i, ip+j);
1058 
1059  }
1060  }
1061  x5val01 = x5val01 / (25.*25.);
1062  x5val02 = x5val02 / (25.*25.);
1063  x5val03 = x5val03 / (25.*25.);
1064 
1065  y5val01 = 0.;
1066  if ( k01_[ism-1] ) y5val01 = k01_[ism-1]->GetBinError(ie, ip) *
1067  k01_[ism-1]->GetBinError(ie, ip);
1068 
1069  y5val02 = 0.;
1070  if ( k02_[ism-1] ) y5val02 = k02_[ism-1]->GetBinError(ie, ip) *
1071  k02_[ism-1]->GetBinError(ie, ip);
1072 
1073  y5val03 = 0.;
1074  if ( k03_[ism-1] ) y5val03 = k03_[ism-1]->GetBinError(ie, ip) *
1075  k03_[ism-1]->GetBinError(ie, ip);
1076 
1077  z5val01 = -999.;
1078  if ( x5val01 != 0 && y5val01 != 0 ) z5val01 = sqrt(std::abs(x5val01 - y5val01));
1079  if ( (x5val01 - y5val01) < 0 ) z5val01 = -z5val01;
1080 
1081  if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ie, ip, z5val01);
1082 
1083  z5val02 = -999.;
1084  if ( x5val02 != 0 && y5val02 != 0 ) z5val02 = sqrt(std::abs(x5val02 - y5val02));
1085  if ( (x5val02 - y5val02) < 0 ) z5val02 = -z5val02;
1086 
1087  if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ie, ip, z5val02);
1088 
1089  z5val03 = -999.;
1090  if ( x5val03 != 0 && y5val03 != 0 ) z5val03 = sqrt(std::abs(x5val03 - y5val03));
1091  if ( (x5val03 - y5val03) < 0 ) z5val03 = -z5val03;
1092 
1093  if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ie, ip, z5val03);
1094 
1095  }
1096 
1097  }
1098  }
1099 #endif
1100 
1101  }
1102 
1103 }
1104 
MonitorElement * mer01_[36]
void beginRun(void)
begin of run method
Cache logicID vector from database.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void setPedMeanG1(float mean)
static const int PEDESTAL_MIDDLE_GAIN_RMS_ERROR
void setBinContent(int binx, double content)
set content of bin (1-D)
static bool maskChannel(int ism, int i1, int i2, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:57
MonitorElement * mer02_[36]
MonitorElement * meg03_[36]
MonitorElement * meg02_[36]
MonitorElement * met03_[36]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
std::string prefixME_
MonitorElement * met02_[36]
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0)
Returns the histogram contained by the Monitor Element.
Definition: UtilsClient.h:89
Some &quot;id&quot; conversions.
TProfile2D * k03_[36]
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:91
void setPedRMSG16(float mean)
Definition: MonPNPedDat.h:30
static const int PEDESTAL_HIGH_GAIN_MEAN_ERROR
std::vector< int > MGPAGains_
static bool getBinQuality(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin quality is good or masked.
Definition: UtilsClient.cc:201
MonitorElement * mes02_[36]
TProfile * i01_[36]
virtual ~EBPedestalClient()
Destructor.
MonitorElement * mep02_[36]
MonitorElement * meg01_[36]
void setPedRMSG1(float mean)
Definition: MonPNPedDat.h:24
static const int PEDESTAL_LOW_GAIN_RMS_ERROR
void setPedMeanG1(float mean)
Definition: MonPNPedDat.h:21
static unsigned icEB(const unsigned ism, const unsigned ix, const unsigned iy)
Definition: Numbers.cc:726
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static void maskBinContent(const MonitorElement *me, const int ix, const int iy)
Mask the bin content.
Definition: UtilsClient.cc:231
void setPedRMSG6(float rms)
MonitorElement * meg04_[36]
static const int PEDESTAL_HIGH_GAIN_RMS_ERROR
static bool maskPn(int ism, int i1, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:109
void setTaskStatus(bool status)
void Fill(long long x)
static bool getBinStatus(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin status is red/dark red.
Definition: UtilsClient.cc:216
void cleanup(void)
clean up method
MonitorElement * mep03_[36]
MonitorElement * mes03_[36]
TProfile2D * h02_[36]
MonitorElement * mer03_[36]
T sqrt(T t)
Definition: SSEVec.h:48
MonitorElement * mer05_[36]
void setPedMeanG6(float mean)
void removeElement(const std::string &name)
Definition: DQMStore.cc:2772
TProfile2D * j01_[36]
void endJob(void)
end of job method
std::vector< int > superModules_
channel masking
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
static unsigned indexEB(const unsigned ism, const unsigned ie, const unsigned ip)
Definition: Numbers.cc:695
MonitorElement * mer04_[36]
DQMStore * dqmStore_
EBPedestalClient(const edm::ParameterSet &ps)
Constructor.
void analyze(void)
Analyze.
void setPedMeanG16(float mean)
Definition: MonPNPedDat.h:27
std::vector< int > MGPAGainsPN_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
void endRun(void)
end of run method
void beginJob(void)
begin of job method
Ecal Monitor Utils for Client.
static const int PEDESTAL_LOW_GAIN_MEAN_ERROR
TProfile * i02_[36]
MonitorElement * mep01_[36]
void setPedRMSG1(float rms)
static bool getBinStatistics(TH1 *histo, const int ix, const int iy, float &num, float &mean, float &rms, float minEntries=1.)
Returns true if the bin contains good statistical data.
Definition: UtilsClient.cc:74
MonitorElement * met01_[36]
TProfile2D * k01_[36]
void setup(void)
Setup.
TProfile2D * j03_[36]
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:243
TProfile2D * j02_[36]
float discrepancyMeanPn_[2]
void setPedMeanG12(float mean)
void setTaskStatus(bool status)
Definition: MonPNPedDat.h:33
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
tuple cout
Definition: gather_cfg.py:121
TProfile2D * k02_[36]
MonitorElement * meg05_[36]
static const int PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
tuple status
Definition: ntuplemaker.py:245
MonitorElement * mes01_[36]
TProfile2D * h03_[36]
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
static EcalLogicID getEcalLogicID(const char *name, const int id1=EcalLogicID::NULLID, const int id2=EcalLogicID::NULLID, const int id3=EcalLogicID::NULLID)
Definition: LogicID.h:29
Definition: RunIOV.h:13
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
TProfile2D * h01_[36]
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
static void printBadChannels(const MonitorElement *me, TH1 *hi, bool positive_only=false)
Print the bad channels.
Definition: UtilsClient.cc:14
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void setPedRMSG12(float rms)