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