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