CMS 3D CMS Logo

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