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