CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EBIntegrityClient.cc
Go to the documentation of this file.
1 
2 /*
3  * \file EBIntegrityClient.cc
4  *
5  * $Date: 2012/04/27 13:45:59 $
6  * $Revision: 1.235 $
7  * \author G. Della Ricca
8  * \author G. Franzoni
9  *
10  */
11 
12 #include <memory>
13 #include <iostream>
14 #include <fstream>
15 #include <iomanip>
16 
18 
21 
22 #ifdef WITH_ECAL_COND_DB
36 #endif
37 
39 
42 
44 
46 
47  // cloneME switch
48  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
49 
50  // verbose switch
51  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
52 
53  // debug switch
54  debug_ = ps.getUntrackedParameter<bool>("debug", false);
55 
56  // prefixME path
57  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
58 
59  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
60 
61  // enableCleanup_ switch
62  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
63 
64  // vector of selected Super Modules (Defaults to all 36).
65  superModules_.reserve(36);
66  for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
67  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
68 
69  h00_ = 0;
70 
71  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
72 
73  int ism = superModules_[i];
74 
75  h_[ism-1] = 0;
76  hmem_[ism-1] = 0;
77 
78  h01_[ism-1] = 0;
79  h02_[ism-1] = 0;
80  h03_[ism-1] = 0;
81  h04_[ism-1] = 0;
82  h05_[ism-1] = 0;
83  h06_[ism-1] = 0;
84  h07_[ism-1] = 0;
85  h08_[ism-1] = 0;
86  h09_[ism-1] = 0;
87 
88  }
89 
90  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
91 
92  int ism = superModules_[i];
93 
94  // integrity summary histograms
95  meg01_[ism-1] = 0;
96  meg02_[ism-1] = 0;
97 
98  }
99 
100  threshCry_ = 0.01;
101 
102 }
103 
105 
106 }
107 
109 
111 
112  if ( debug_ ) std::cout << "EBIntegrityClient: beginJob" << std::endl;
113 
114  ievt_ = 0;
115  jevt_ = 0;
116 
117 }
118 
120 
121  if ( debug_ ) std::cout << "EBIntegrityClient: beginRun" << std::endl;
122 
123  jevt_ = 0;
124 
125  this->setup();
126 
127 }
128 
130 
131  if ( debug_ ) std::cout << "EBIntegrityClient: endJob, ievt = " << ievt_ << std::endl;
132 
133  this->cleanup();
134 
135 }
136 
138 
139  if ( debug_ ) std::cout << "EBIntegrityClient: endRun, jevt = " << jevt_ << std::endl;
140 
141  this->cleanup();
142 
143 }
144 
146 
148 
149  dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient" );
150 
151  if(subfolder_.size())
152  dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient/" + subfolder_);
153 
154  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
155 
156  int ism = superModules_[i];
157 
158  if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
159  name = "EBIT data integrity quality " + Numbers::sEB(ism);
160  meg01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
161  meg01_[ism-1]->setAxisTitle("ieta", 1);
162  meg01_[ism-1]->setAxisTitle("iphi", 2);
163 
164  if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
165  name = "EBIT data integrity quality MEM " + Numbers::sEB(ism);
166  meg02_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 5, 0.,5.);
167  meg02_[ism-1]->setAxisTitle("pseudo-strip", 1);
168  meg02_[ism-1]->setAxisTitle("channel", 2);
169 
170  }
171 
172  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
173 
174  int ism = superModules_[i];
175 
176  if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
177  if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
178 
179  for ( int ie = 1; ie <= 85; ie++ ) {
180  for ( int ip = 1; ip <= 20; ip++ ) {
181 
182  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
183 
184  }
185  }
186 
187  for ( int ie = 1; ie <= 10; ie++ ) {
188  for ( int ip = 1; ip <= 5; ip++ ) {
189 
190  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
191 
192  }
193  }
194 
195  }
196 
197 }
198 
200 
201  if ( ! enableCleanup_ ) return;
202 
203  if ( cloneME_ ) {
204  if ( h00_ ) delete h00_;
205  }
206 
207  h00_ = 0;
208 
209  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
210 
211  int ism = superModules_[i];
212 
213  if ( cloneME_ ) {
214  if ( h_[ism-1] ) delete h_[ism-1];
215  if ( hmem_[ism-1] ) delete hmem_[ism-1];
216 
217  if ( h01_[ism-1] ) delete h01_[ism-1];
218  if ( h02_[ism-1] ) delete h02_[ism-1];
219  if ( h03_[ism-1] ) delete h03_[ism-1];
220  if ( h04_[ism-1] ) delete h04_[ism-1];
221  if ( h05_[ism-1] ) delete h05_[ism-1];
222  if ( h06_[ism-1] ) delete h06_[ism-1];
223  if ( h07_[ism-1] ) delete h07_[ism-1];
224  if ( h08_[ism-1] ) delete h08_[ism-1];
225  if ( h09_[ism-1] ) delete h09_[ism-1];
226  }
227 
228  h_[ism-1] = 0;
229  hmem_[ism-1] = 0;
230 
231  h01_[ism-1] = 0;
232  h02_[ism-1] = 0;
233  h03_[ism-1] = 0;
234  h04_[ism-1] = 0;
235  h05_[ism-1] = 0;
236  h06_[ism-1] = 0;
237  h07_[ism-1] = 0;
238  h08_[ism-1] = 0;
239  h09_[ism-1] = 0;
240 
241  }
242 
243  dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient" );
244 
245  if(subfolder_.size())
246  dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient/" + subfolder_);
247 
248  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
249 
250  int ism = superModules_[i];
251 
252  if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
253  meg01_[ism-1] = 0;
254 
255  if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
256  meg02_[ism-1] = 0;
257 
258  }
259 
260 }
261 
262 #ifdef WITH_ECAL_COND_DB
263 bool EBIntegrityClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
264 
265  status = true;
266 
267  EcalLogicID ecid;
268 
270  std::map<EcalLogicID, MonCrystalConsistencyDat> dataset1;
272  std::map<EcalLogicID, MonTTConsistencyDat> dataset2;
274  std::map<EcalLogicID, MonMemChConsistencyDat> dataset3;
276  std::map<EcalLogicID, MonMemTTConsistencyDat> dataset4;
277 
278  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
279 
280  int ism = superModules_[i];
281 
282  if ( h00_ && h00_->GetBinContent(ism) != 0 ) {
283  std::cerr << " DCC failed " << h00_->GetBinContent(ism) << " times" << std::endl;
284  std::cerr << std::endl;
285  }
286 
287  if ( verbose_ ) {
288  std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
289  std::cout << std::endl;
290  UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1], true);
291  UtilsClient::printBadChannels(meg01_[ism-1], h02_[ism-1], true);
292  UtilsClient::printBadChannels(meg01_[ism-1], h03_[ism-1], true);
293  UtilsClient::printBadChannels(meg01_[ism-1], h04_[ism-1], true);
294  UtilsClient::printBadChannels(meg01_[ism-1], h05_[ism-1], true);
295 
296  UtilsClient::printBadChannels(meg02_[ism-1], h06_[ism-1], true);
297  UtilsClient::printBadChannels(meg02_[ism-1], h07_[ism-1], true);
298  UtilsClient::printBadChannels(meg02_[ism-1], h08_[ism-1], true);
299  UtilsClient::printBadChannels(meg02_[ism-1], h09_[ism-1], true);
300  }
301 
302  float num00;
303 
304  num00 = 0.;
305 
306  bool update0 = false;
307 
308  if ( h00_ ) {
309  num00 = h00_->GetBinContent(ism);
310  if ( num00 > 0 ) update0 = true;
311  }
312 
313  float num01, num02, num03;
314 
315  for ( int ie = 1; ie <= 85; ie++ ) {
316  for ( int ip = 1; ip <= 20; ip++ ) {
317 
318  num01 = num02 = num03 = 0.;
319 
320  bool update1 = false;
321 
322  float numTot = -1.;
323 
324  if ( h_[ism-1] ) numTot = h_[ism-1]->GetBinContent(ie, ip);
325 
326  if ( h01_[ism-1] ) {
327  num01 = h01_[ism-1]->GetBinContent(ie, ip);
328  if ( num01 > 0 ) update1 = true;
329  }
330 
331  if ( h02_[ism-1] ) {
332  num02 = h02_[ism-1]->GetBinContent(ie, ip);
333  if ( num02 > 0 ) update1 = true;
334  }
335 
336  if ( h03_[ism-1] ) {
337  num03 = h03_[ism-1]->GetBinContent(ie, ip);
338  if ( num03 > 0 ) update1 = true;
339  }
340 
341  if ( update0 || update1 ) {
342 
343  if ( Numbers::icEB(ism, ie, ip) == 1 ) {
344 
345  if ( verbose_ ) {
346  std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
347  std::cout << "(" << ie << "," << ip << ") " << num00 << " " << num01 << " " << num02 << " " << num03 << std::endl;
348  std::cout << std::endl;
349  }
350 
351  }
352 
353  c1.setProcessedEvents(int(numTot));
354  c1.setProblematicEvents(int(num01+num02+num03));
355  c1.setProblemsGainZero(int(num01));
356  c1.setProblemsID(int(num02));
357  c1.setProblemsGainSwitch(int(num03));
358 
359  bool val;
360 
361  val = false;
362  if ( numTot > 0 ) {
363  float errorRate1 = num00 / ( numTot + num01 + num02 + num03 );
364  if ( errorRate1 > threshCry_ )
365  val = true;
366  errorRate1 = ( num01 + num02 + num03 ) / ( numTot + num01 + num02 + num03 ) / 3.;
367  if ( errorRate1 > threshCry_ )
368  val = true;
369  } else {
370  if ( num00 > 0 )
371  val = true;
372  if ( ( num01 + num02 + num03 ) > 0 )
373  val = true;
374  }
375  c1.setTaskStatus(val);
376 
377  int ic = Numbers::indexEB(ism, ie, ip);
378 
379  if ( econn ) {
380  ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic);
381  dataset1[ecid] = c1;
382  }
383 
384  status = status && !val;
385 
386  }
387 
388  }
389  }
390 
391  float num04, num05;
392 
393  for ( int iet = 1; iet <= 17; iet++ ) {
394  for ( int ipt = 1; ipt <= 4; ipt++ ) {
395 
396  num04 = num05 = 0.;
397 
398  bool update1 = false;
399 
400  float numTot = -1.;
401 
402  if ( h_[ism-1] ) {
403  numTot = 0.;
404  for ( int ie = 1 + 5*(iet-1); ie <= 5*iet; ie++ ) {
405  for ( int ip = 1 + 5*(ipt-1); ip <= 5*ipt; ip++ ) {
406  numTot += h_[ism-1]->GetBinContent(ie, ip);
407  }
408  }
409  }
410 
411  if ( h04_[ism-1] ) {
412  num04 = h04_[ism-1]->GetBinContent(iet, ipt);
413  if ( num04 > 0 ) update1 = true;
414  }
415 
416  if ( h05_[ism-1] ) {
417  num05 = h05_[ism-1]->GetBinContent(iet, ipt);
418  if ( num05 > 0 ) update1 = true;
419  }
420 
421  if ( update0 || update1 ) {
422 
423  if ( Numbers::iSC(ism, EcalBarrel, 1+5*(iet-1), 1+5*(ipt-1)) == 1 ) {
424 
425  if ( verbose_ ) {
426  std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
427  std::cout << "(" << iet << "," << ipt << ") " << num00 << " " << num04 << " " << num05 << std::endl;
428  std::cout << std::endl;
429  }
430 
431  }
432 
433  c2.setProcessedEvents(int(numTot));
434  c2.setProblematicEvents(int(num04+num05));
435  c2.setProblemsID(int(num04));
436  c2.setProblemsSize(int(num05));
437  c2.setProblemsLV1(int(-1.));
438  c2.setProblemsBunchX(int(-1.));
439 
440  bool val;
441 
442  val = false;
443  if ( numTot > 0 ) {
444  float errorRate2 = num00 / ( numTot/25. + num04 + num05 );
445  if ( errorRate2 > threshCry_ )
446  val = true;
447  errorRate2 = ( num04 + num05 ) / ( numTot/25. + num04 + num05 ) / 2.;
448  if ( errorRate2 > threshCry_ )
449  val = true;
450  } else {
451  if ( num00 > 0 )
452  val = true;
453  if ( ( num04 + num05 ) > 0 )
454  val = true;
455  }
456  c2.setTaskStatus(val);
457 
458  int itt = Numbers::iSC(ism, EcalBarrel, 1+5*(iet-1), 1+5*(ipt-1));
459 
460  if ( econn ) {
461  ecid = LogicID::getEcalLogicID("EB_trigger_tower", Numbers::iSM(ism, EcalBarrel), itt);
462  dataset2[ecid] = c2;
463  }
464 
465  status = status && !val;
466 
467  }
468 
469  }
470  }
471 
472  float num06, num07;
473 
474  for ( int ie = 1; ie <= 10; ie++ ) {
475  for ( int ip = 1; ip <= 5; ip++ ) {
476 
477  num06 = num07 = 0.;
478 
479  bool update1 = false;
480 
481  float numTot = -1.;
482 
483  if ( hmem_[ism-1] ) numTot = hmem_[ism-1]->GetBinContent(ie, ip);
484 
485  if ( h06_[ism-1] ) {
486  num06 = h06_[ism-1]->GetBinContent(ie, ip);
487  if ( num06 > 0 ) update1 = true;
488  }
489 
490  if ( h07_[ism-1] ) {
491  num07 = h07_[ism-1]->GetBinContent(ie, ip);
492  if ( num07 > 0 ) update1 = true;
493  }
494 
495  if ( update0 || update1 ) {
496 
497  if ( ie ==1 && ip == 1 ) {
498 
499  if ( verbose_ ) {
500  std::cout << "Preparing dataset for mem of SM=" << ism << std::endl;
501  std::cout << "(" << ie << "," << ip << ") " << num06 << " " << num07 << std::endl;
502  std::cout << std::endl;
503  }
504 
505  }
506 
507  c3.setProcessedEvents( int (numTot));
508  c3.setProblematicEvents(int (num06+num07));
509  c3.setProblemsID(int (num06) );
510  c3.setProblemsGainZero(int (num07));
511  // c3.setProblemsGainSwitch(int prob);
512 
513  bool val;
514 
515  val = false;
516  if ( numTot > 0 ) {
517  float errorRate1 = num00 / ( numTot + num06 + num07 );
518  if ( errorRate1 > threshCry_ )
519  val = true;
520  errorRate1 = ( num06 + num07 ) / ( numTot + num06 + num07 ) / 2.;
521  if ( errorRate1 > threshCry_ )
522  val = true;
523  } else {
524  if ( num00 > 0 )
525  val = true;
526  if ( ( num06 + num07 ) > 0 )
527  val = true;
528  }
529  c3. setTaskStatus(val);
530 
531  int ic = EBIntegrityClient::chNum[ (ie-1)%5 ][ (ip-1) ] + (ie-1)/5 * 25;
532 
533  if ( econn ) {
534  ecid = LogicID::getEcalLogicID("EB_mem_channel", Numbers::iSM(ism, EcalBarrel), ic);
535  dataset3[ecid] = c3;
536  }
537 
538  status = status && !val;
539 
540  }
541 
542  }
543  }
544 
545  float num08, num09;
546 
547  for ( int iet = 1; iet <= 2; iet++ ) {
548 
549  num08 = num09 = 0.;
550 
551  bool update1 = false;
552 
553  float numTot = -1.;
554 
555  if ( hmem_[ism-1] ) {
556  numTot = 0.;
557  for ( int ie = 1 + 5*(iet-1); ie <= 5*iet; ie++ ) {
558  for ( int ip = 1 ; ip <= 5; ip++ ) {
559  numTot += hmem_[ism-1]->GetBinContent(ie, ip);
560  }
561  }
562  }
563 
564  if ( h08_[ism-1] ) {
565  num08 = h08_[ism-1]->GetBinContent(iet, 1);
566  if ( num08 > 0 ) update1 = true;
567  }
568 
569  if ( h09_[ism-1] ) {
570  num09 = h09_[ism-1]->GetBinContent(iet, 1);
571  if ( num09 > 0 ) update1 = true;
572  }
573 
574  if ( update0 || update1 ) {
575 
576  if ( iet == 1 ) {
577 
578  if ( verbose_ ) {
579  std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
580  std::cout << "(" << iet << ") " << num08 << " " << num09 << std::endl;
581  std::cout << std::endl;
582  }
583 
584  }
585 
586  c4.setProcessedEvents( int(numTot) );
587  c4.setProblematicEvents( int(num08 + num09) );
588  c4.setProblemsID( int(num08) );
589  c4.setProblemsSize(int (num09) );
590  // setProblemsLV1(int LV1);
591  // setProblemsBunchX(int bunchX);
592 
593  bool val;
594 
595  val = false;
596  if ( numTot > 0 ) {
597  float errorRate2 = num00 / ( numTot/25. + num08 + num09 );
598  if ( errorRate2 > threshCry_ )
599  val = true;
600  errorRate2 = ( num08 + num09 ) / ( numTot/25. + num08 + num09 ) / 2.;
601  if ( errorRate2 > threshCry_ )
602  val = true;
603  } else {
604  if ( num00 > 0 )
605  val = true;
606  if ( ( num08 + num09 ) > 0 )
607  val = true;
608  }
609  c4.setTaskStatus(val);
610 
611  int itt = 68 + iet;
612 
613  if ( econn ) {
614  ecid = LogicID::getEcalLogicID("EB_mem_TT", Numbers::iSM(ism, EcalBarrel), itt);
615  dataset4[ecid] = c4;
616  }
617 
618  status = status && !val;
619 
620  }
621 
622  }
623 
624  }
625 
626  if ( econn ) {
627  try {
628  if ( verbose_ ) std::cout << "Inserting MonConsistencyDat ..." << std::endl;
629  if ( dataset1.size() != 0 ) econn->insertDataArraySet(&dataset1, moniov);
630  if ( dataset2.size() != 0 ) econn->insertDataArraySet(&dataset2, moniov);
631  if ( dataset3.size() != 0 ) econn->insertDataArraySet(&dataset3, moniov);
632  if ( dataset4.size() != 0 ) econn->insertDataArraySet(&dataset4, moniov);
633  if ( verbose_ ) std::cout << "done." << std::endl;
634  } catch (std::runtime_error &e) {
635  std::cerr << e.what() << std::endl;
636  }
637  }
638 
639  return true;
640 
641 }
642 #endif
643 
645 
646  ievt_++;
647  jevt_++;
648  if ( ievt_ % 10 == 0 ) {
649  if ( debug_ ) std::cout << "EBIntegrityClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
650  }
651 
652  uint32_t bits01 = 0;
653  bits01 |= 1 << EcalDQMStatusHelper::CH_ID_ERROR;
656  bits01 |= 1 << EcalDQMStatusHelper::TT_ID_ERROR;
657  bits01 |= 1 << EcalDQMStatusHelper::TT_SIZE_ERROR;
658 
659  std::string subdir(subfolder_.size() ? subfolder_ + "/" : "");
660 
661  MonitorElement* me;
662 
663  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "EBIT DCC size error" );
665 
666  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
667 
668  int ism = superModules_[i];
669 
670  me = dqmStore_->get( prefixME_ + "/EBOccupancyTask/" + subdir + "EBOT digi occupancy " + Numbers::sEB(ism) );
671  h_[ism-1] = UtilsClient::getHisto( me, cloneME_, h_[ism-1] );
672 
673  me = dqmStore_->get( prefixME_ + "/EBOccupancyTask/" + subdir + "EBOT MEM digi occupancy " + Numbers::sEB(ism) );
674  hmem_[ism-1] = UtilsClient::getHisto( me, cloneME_, hmem_[ism-1] );
675 
676  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "Gain/EBIT gain " + Numbers::sEB(ism) );
677  h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
678 
679  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "ChId/EBIT ChId " + Numbers::sEB(ism) );
680  h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
681 
682  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "GainSwitch/EBIT gain switch " + Numbers::sEB(ism) );
683  h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
684 
685  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "TTId/EBIT TTId " + Numbers::sEB(ism) );
686  h04_[ism-1] = UtilsClient::getHisto( me, cloneME_, h04_[ism-1] );
687 
688  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "TTBlockSize/EBIT TTBlockSize " + Numbers::sEB(ism) );
689  h05_[ism-1] = UtilsClient::getHisto( me, cloneME_, h05_[ism-1] );
690 
691  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "MemChId/EBIT MemChId " + Numbers::sEB(ism) );
692  h06_[ism-1] = UtilsClient::getHisto( me, cloneME_, h06_[ism-1] );
693 
694  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "MemGain/EBIT MemGain " + Numbers::sEB(ism) );
695  h07_[ism-1] = UtilsClient::getHisto( me, cloneME_, h07_[ism-1] );
696 
697  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "MemTTId/EBIT MemTTId " + Numbers::sEB(ism) );
698  h08_[ism-1] = UtilsClient::getHisto( me, cloneME_, h08_[ism-1] );
699 
700  me = dqmStore_->get( prefixME_ + "/EBIntegrityTask/" + subdir + "MemSize/EBIT MemSize " + Numbers::sEB(ism) );
701  h09_[ism-1] = UtilsClient::getHisto( me, cloneME_, h09_[ism-1] );
702 
703  float num00;
704 
705  // integrity summary histograms
706  if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
707  if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
708 
709  num00 = 0.;
710 
711  bool update0 = false;
712 
713  // dcc size errors
714  if ( h00_ ) {
715  num00 = h00_->GetBinContent(ism);
716  update0 = true;
717  }
718 
719  float num01, num02, num03, num04, num05;
720 
721  for ( int ie = 1; ie <= 85; ie++ ) {
722  for ( int ip = 1; ip <= 20; ip++ ) {
723 
724  num01 = num02 = num03 = num04 = num05 = 0.;
725 
726  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
727 
728  bool update1 = false;
729  bool update2 = false;
730 
731  float numTot = -1.;
732 
733  if ( h_[ism-1] ) numTot = h_[ism-1]->GetBinContent(ie, ip);
734 
735  if ( h01_[ism-1] ) {
736  num01 = h01_[ism-1]->GetBinContent(ie, ip);
737  update1 = true;
738  }
739 
740  if ( h02_[ism-1] ) {
741  num02 = h02_[ism-1]->GetBinContent(ie, ip);
742  update1 = true;
743  }
744 
745  if ( h03_[ism-1] ) {
746  num03 = h03_[ism-1]->GetBinContent(ie, ip);
747  update1 = true;
748  }
749 
750  int iet = 1 + ((ie-1)/5);
751  int ipt = 1 + ((ip-1)/5);
752 
753  if ( h04_[ism-1] ) {
754  num04 = h04_[ism-1]->GetBinContent(iet, ipt);
755  update2 = true;
756  }
757 
758  if ( h05_[ism-1] ) {
759  num05 = h05_[ism-1]->GetBinContent(iet, ipt);
760  update2 = true;
761  }
762 
763  if ( update0 || update1 || update2 ) {
764 
765  float val;
766 
767  val = 1.;
768  // number of events on a channel
769  if ( numTot > 0 ) {
770  float errorRate1 = num00 / ( numTot + num01 + num02 + num03 );
771  if ( errorRate1 > threshCry_ )
772  val = 0.;
773  errorRate1 = ( num01 + num02 + num03 ) / ( numTot + num01 + num02 + num03 ) / 3.;
774  if ( errorRate1 > threshCry_ )
775  val = 0.;
776  float errorRate2 = ( num04 + num05 ) / ( numTot/25. + num04 + num05 ) / 2.;
777  if ( errorRate2 > threshCry_ )
778  val = 0.;
779  } else {
780  val = 2.;
781  if ( num00 > 0 )
782  val = 0.;
783  if ( ( num01 + num02 + num03 ) > 0 )
784  val = 0.;
785  if ( ( num04 + num05 ) > 0 )
786  val = 0.;
787  }
788 
789  // filling the summary for SM channels
790  if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, val );
791 
792  }
793 
794  if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
795 
796  }
797  } // end of loop on crystals
798 
799  // summaries for mem channels
800  float num06, num07, num08, num09;
801 
802  for ( int ie = 1; ie <= 10; ie++ ) {
803  for ( int ip = 1; ip <= 5; ip++ ) {
804 
805  num06 = num07 = num08 = num09 = 0.;
806 
807  // initialize summary histo for mem
808  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
809 
810  bool update1 = false;
811  bool update2 = false;
812 
813  float numTotmem = -1.;
814 
815  if ( hmem_[ism-1] ) numTotmem = hmem_[ism-1]->GetBinContent(ie, ip);
816 
817  if ( h06_[ism-1] ) {
818  num06 = h06_[ism-1]->GetBinContent(ie, ip);
819  update1 = true;
820  }
821 
822  if ( h07_[ism-1] ) {
823  num07 = h07_[ism-1]->GetBinContent(ie, ip);
824  update1 = true;
825  }
826 
827  int iet = 1 + ((ie-1)/5);
828  int ipt = 1;
829 
830  if ( h08_[ism-1] ) {
831  num08 = h08_[ism-1]->GetBinContent(iet, ipt);
832  update2 = true;
833  }
834 
835  if ( h09_[ism-1] ) {
836  num09 = h09_[ism-1]->GetBinContent(iet, ipt);
837  update2 = true;
838  }
839 
840  if ( update0 || update1 || update2 ) {
841 
842  float val;
843 
844  val = 1.;
845  // number of events on a channel
846  if ( numTotmem > 0 ) {
847  float errorRate1 = ( num06 + num07 ) / ( numTotmem + num06 + num07 ) / 2.;
848  if ( errorRate1 > threshCry_ )
849  val = 0.;
850  float errorRate2 = ( num08 + num09 ) / ( numTotmem/25. + num08 + num09 ) / 2.;
851  if ( errorRate2 > threshCry_ )
852  val = 0.;
853  } else {
854  val = 2.;
855  if ( ( num06 + num07 ) > 0 )
856  val = 0.;
857  if ( ( num08 + num09 ) > 0 )
858  val = 0.;
859  }
860 
861  // filling summary for mem channels
862  if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, val );
863 
864  }
865 
866  if ( Masks::maskPn(ism, ie, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg02_[ism-1], ie, ip );
867 
868  }
869  } // end loop on mem channels
870 
871  } // end loop on supermodules
872 
873 }
874 
875 const int EBIntegrityClient::chNum[5][5] = {
876  { 1, 2, 3, 4, 5},
877  {10, 9, 8, 7, 6},
878  {11, 12, 13, 14, 15},
879  {20, 19, 18, 17, 16},
880  {21, 22, 23, 24, 25}
881 };
882 
Cache logicID vector from database.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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
void setProblematicEvents(int prob)
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0)
Returns the histogram contained by the Monitor Element.
Definition: UtilsClient.h:91
EBIntegrityClient(const edm::ParameterSet &ps)
Constructor.
virtual ~EBIntegrityClient()
Destructor.
Some &quot;id&quot; conversions.
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:94
void analyze(void)
Analyze.
void cleanup(void)
Cleanup.
void beginRun(void)
BeginRun.
void setProblemsLV1(int LV1)
void endRun(void)
EndRun.
static const int TT_SIZE_ERROR
static const int CH_GAIN_SWITCH_ERROR
void setProblemsSize(int size)
static unsigned icEB(const unsigned ism, const unsigned ix, const unsigned iy)
Definition: Numbers.cc:729
static void maskBinContent(const MonitorElement *me, const int ix, const int iy)
Mask the bin content.
Definition: UtilsClient.cc:231
static bool maskPn(int ism, int i1, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:112
std::vector< int > superModules_
void setProcessedEvents(int proc)
MonitorElement * meg01_[36]
static unsigned iSC(const EcalScDetId &id)
Definition: Numbers.cc:437
void removeElement(const std::string &name)
Definition: DQMStore.cc:2577
channel masking
static unsigned indexEB(const unsigned ism, const unsigned ie, const unsigned ip)
Definition: Numbers.cc:698
static const int chNum[5][5]
void setup(void)
Setup.
void setProblemsBunchX(int bunchX)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
Ecal Monitor Utils for Client.
void beginJob(void)
BeginJob.
static const int CH_GAIN_ZERO_ERROR
void endJob(void)
EndJob.
void setTaskStatus(bool status)
void setTaskStatus(bool status)
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
static const int TT_ID_ERROR
void insertDataArraySet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
tuple cout
Definition: gather_cfg.py:121
MonitorElement * meg02_[36]
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:850
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
static const int CH_ID_ERROR
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
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:434
std::string subfolder_