CMS 3D CMS Logo

EBIntegrityClient.cc

Go to the documentation of this file.
00001 
00002 /*
00003  * \file EBIntegrityClient.cc
00004  *
00005  * $Date: 2008/08/11 07:24:13 $
00006  * $Revision: 1.211 $
00007  * \author G. Della Ricca
00008  * \author G. Franzoni
00009  *
00010  */
00011 
00012 #include <memory>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <iomanip>
00016 
00017 #include "TCanvas.h"
00018 #include "TStyle.h"
00019 
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 
00022 #include "OnlineDB/EcalCondDB/interface/RunTag.h"
00023 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
00024 #include "OnlineDB/EcalCondDB/interface/MonCrystalConsistencyDat.h"
00025 #include "OnlineDB/EcalCondDB/interface/MonTTConsistencyDat.h"
00026 #include "OnlineDB/EcalCondDB/interface/MonMemChConsistencyDat.h"
00027 #include "OnlineDB/EcalCondDB/interface/MonMemTTConsistencyDat.h"
00028 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00029 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00030 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00031 #include "OnlineDB/EcalCondDB/interface/RunMemChErrorsDat.h"
00032 #include "OnlineDB/EcalCondDB/interface/RunMemTTErrorsDat.h"
00033 
00034 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00035 
00036 #include "CondTools/Ecal/interface/EcalErrorDictionary.h"
00037 
00038 #include "DQM/EcalCommon/interface/EcalErrorMask.h"
00039 #include "DQM/EcalCommon/interface/UtilsClient.h"
00040 #include "DQM/EcalCommon/interface/LogicID.h"
00041 #include "DQM/EcalCommon/interface/Numbers.h"
00042 
00043 #include <DQM/EcalBarrelMonitorClient/interface/EBIntegrityClient.h>
00044 
00045 using namespace cms;
00046 using namespace edm;
00047 using namespace std;
00048 
00049 EBIntegrityClient::EBIntegrityClient(const ParameterSet& ps) {
00050 
00051   // cloneME switch
00052   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00053 
00054   // verbose switch
00055   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00056 
00057   // debug switch
00058   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00059 
00060   // prefixME path
00061   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00062 
00063   // enableCleanup_ switch
00064   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00065 
00066   // vector of selected Super Modules (Defaults to all 36).
00067   superModules_.reserve(36);
00068   for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00069   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00070 
00071   h00_ = 0;
00072 
00073   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00074 
00075     int ism = superModules_[i];
00076 
00077     h_[ism-1] = 0;
00078     hmem_[ism-1] = 0;
00079 
00080     h01_[ism-1] = 0;
00081     h02_[ism-1] = 0;
00082     h03_[ism-1] = 0;
00083     h04_[ism-1] = 0;
00084     h05_[ism-1] = 0;
00085     h06_[ism-1] = 0;
00086     h07_[ism-1] = 0;
00087     h08_[ism-1] = 0;
00088     h09_[ism-1] = 0;
00089 
00090   }
00091 
00092   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00093 
00094     int ism = superModules_[i];
00095 
00096     // integrity summary histograms
00097     meg01_[ism-1] = 0;
00098     meg02_[ism-1] = 0;
00099 
00100   }
00101 
00102   threshCry_ = 0.;
00103 
00104 }
00105 
00106 EBIntegrityClient::~EBIntegrityClient() {
00107 
00108 }
00109 
00110 void EBIntegrityClient::beginJob(DQMStore* dqmStore) {
00111 
00112   dqmStore_ = dqmStore;
00113 
00114   if ( debug_ ) cout << "EBIntegrityClient: beginJob" << endl;
00115 
00116   ievt_ = 0;
00117   jevt_ = 0;
00118 
00119 }
00120 
00121 void EBIntegrityClient::beginRun(void) {
00122 
00123   if ( debug_ ) cout << "EBIntegrityClient: beginRun" << endl;
00124 
00125   jevt_ = 0;
00126 
00127   this->setup();
00128 
00129 }
00130 
00131 void EBIntegrityClient::endJob(void) {
00132 
00133   if ( debug_ ) cout << "EBIntegrityClient: endJob, ievt = " << ievt_ << endl;
00134 
00135   this->cleanup();
00136 
00137 }
00138 
00139 void EBIntegrityClient::endRun(void) {
00140 
00141   if ( debug_ ) cout << "EBIntegrityClient: endRun, jevt = " << jevt_ << endl;
00142 
00143   this->cleanup();
00144 
00145 }
00146 
00147 void EBIntegrityClient::setup(void) {
00148 
00149   char histo[200];
00150 
00151   dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient" );
00152 
00153   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00154 
00155     int ism = superModules_[i];
00156 
00157     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00158     sprintf(histo, "EBIT data integrity quality %s", Numbers::sEB(ism).c_str());
00159     meg01_[ism-1] = dqmStore_->book2D(histo, histo, 85, 0., 85., 20, 0., 20.);
00160     meg01_[ism-1]->setAxisTitle("ieta", 1);
00161     meg01_[ism-1]->setAxisTitle("iphi", 2);
00162 
00163     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00164     sprintf(histo, "EBIT data integrity quality MEM %s", Numbers::sEB(ism).c_str());
00165     meg02_[ism-1] = dqmStore_->book2D(histo, histo, 10, 0., 10., 5, 0.,5.);
00166     meg02_[ism-1]->setAxisTitle("pseudo-strip", 1);
00167     meg02_[ism-1]->setAxisTitle("channel", 2);
00168 
00169   }
00170 
00171   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00172 
00173     int ism = superModules_[i];
00174 
00175     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00176     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00177 
00178     for ( int ie = 1; ie <= 85; ie++ ) {
00179       for ( int ip = 1; ip <= 20; ip++ ) {
00180 
00181         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
00182 
00183       }
00184     }
00185 
00186     for ( int ie = 1; ie <= 10; ie++ ) {
00187       for ( int ip = 1; ip <= 5; ip++ ) {
00188 
00189         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
00190 
00191       }
00192     }
00193 
00194   }
00195 
00196 }
00197 
00198 void EBIntegrityClient::cleanup(void) {
00199 
00200   if ( ! enableCleanup_ ) return;
00201 
00202   if ( cloneME_ ) {
00203     if ( h00_ ) delete h00_;
00204   }
00205 
00206   h00_ = 0;
00207 
00208   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00209 
00210     int ism = superModules_[i];
00211 
00212     if ( cloneME_ ) {
00213       if ( h_[ism-1] )    delete h_[ism-1];
00214       if ( hmem_[ism-1] ) delete hmem_[ism-1];
00215 
00216       if ( h01_[ism-1] ) delete h01_[ism-1];
00217       if ( h02_[ism-1] ) delete h02_[ism-1];
00218       if ( h03_[ism-1] ) delete h03_[ism-1];
00219       if ( h04_[ism-1] ) delete h04_[ism-1];
00220       if ( h05_[ism-1] ) delete h05_[ism-1];
00221       if ( h06_[ism-1] ) delete h06_[ism-1];
00222       if ( h07_[ism-1] ) delete h07_[ism-1];
00223       if ( h08_[ism-1] ) delete h08_[ism-1];
00224       if ( h09_[ism-1] ) delete h09_[ism-1];
00225     }
00226 
00227     h_[ism-1] = 0;
00228     hmem_[ism-1] = 0;
00229 
00230     h01_[ism-1] = 0;
00231     h02_[ism-1] = 0;
00232     h03_[ism-1] = 0;
00233     h04_[ism-1] = 0;
00234     h05_[ism-1] = 0;
00235     h06_[ism-1] = 0;
00236     h07_[ism-1] = 0;
00237     h08_[ism-1] = 0;
00238     h09_[ism-1] = 0;
00239 
00240   }
00241 
00242   dqmStore_->setCurrentFolder( prefixME_ + "/EBIntegrityClient" );
00243 
00244   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00245 
00246     int ism = superModules_[i];
00247 
00248     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00249     meg01_[ism-1] = 0;
00250 
00251     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00252     meg02_[ism-1] = 0;
00253 
00254   }
00255 
00256 }
00257 
00258 bool EBIntegrityClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00259 
00260   status = true;
00261 
00262   if ( flag ) this->softReset(false);
00263 
00264   EcalLogicID ecid;
00265 
00266   MonCrystalConsistencyDat c1;
00267   map<EcalLogicID, MonCrystalConsistencyDat> dataset1;
00268   MonTTConsistencyDat c2;
00269   map<EcalLogicID, MonTTConsistencyDat> dataset2;
00270   MonMemChConsistencyDat c3;
00271   map<EcalLogicID, MonMemChConsistencyDat> dataset3;
00272   MonMemTTConsistencyDat c4;
00273   map<EcalLogicID, MonMemTTConsistencyDat> dataset4;
00274 
00275   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00276 
00277     int ism = superModules_[i];
00278 
00279     if ( h00_ && h00_->GetBinContent(ism) != 0 ) {
00280       cerr << " DCC failed " << h00_->GetBinContent(ism) << " times" << endl;
00281       cerr << endl;
00282     }
00283 
00284     if ( verbose_ ) {
00285       cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00286       cout << endl;
00287       UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1], true);
00288       UtilsClient::printBadChannels(meg01_[ism-1], h02_[ism-1], true);
00289       UtilsClient::printBadChannels(meg01_[ism-1], h03_[ism-1], true);
00290       UtilsClient::printBadChannels(meg01_[ism-1], h04_[ism-1], true);
00291       UtilsClient::printBadChannels(meg01_[ism-1], h05_[ism-1], true);
00292 
00293       UtilsClient::printBadChannels(meg02_[ism-1], h06_[ism-1], true);
00294       UtilsClient::printBadChannels(meg02_[ism-1], h07_[ism-1], true);
00295       UtilsClient::printBadChannels(meg02_[ism-1], h08_[ism-1], true);
00296       UtilsClient::printBadChannels(meg02_[ism-1], h09_[ism-1], true);
00297     }
00298 
00299     float num00;
00300 
00301     num00 = 0.;
00302 
00303     bool update0 = false;
00304 
00305     if ( h00_ ) {
00306       num00 = h00_->GetBinContent(ism);
00307       if ( num00 > 0 ) update0 = true;
00308     }
00309 
00310     float num01, num02, num03;
00311 
00312     for ( int ie = 1; ie <= 85; ie++ ) {
00313       for ( int ip = 1; ip <= 20; ip++ ) {
00314 
00315         num01 = num02 = num03 = 0.;
00316 
00317         bool update1 = false;
00318 
00319         float numTot = -1.;
00320 
00321         if ( h_[ism-1] ) numTot = h_[ism-1]->GetBinContent(ie, ip);
00322 
00323         if ( h01_[ism-1] ) {
00324           num01  = h01_[ism-1]->GetBinContent(ie, ip);
00325           if ( num01 > 0 ) update1 = true;
00326         }
00327 
00328         if ( h02_[ism-1] ) {
00329           num02  = h02_[ism-1]->GetBinContent(ie, ip);
00330           if ( num02 > 0 ) update1 = true;
00331         }
00332 
00333         if ( h03_[ism-1] ) {
00334           num03  = h03_[ism-1]->GetBinContent(ie, ip);
00335           if ( num03 > 0 ) update1 = true;
00336         }
00337 
00338         if ( update0 || update1 ) {
00339 
00340           if ( Numbers::icEB(ism, ie, ip) == 1 ) {
00341 
00342             if ( verbose_ ) {
00343               cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00344               cout << "(" << ie << "," << ip << ") " << num00 << " " << num01 << " " << num02 << " " << num03 << endl;
00345               cout << endl;
00346             }
00347 
00348           }
00349 
00350           c1.setProcessedEvents(int(numTot));
00351           c1.setProblematicEvents(int(num01+num02+num03));
00352           c1.setProblemsGainZero(int(num01));
00353           c1.setProblemsID(int(num02));
00354           c1.setProblemsGainSwitch(int(num03));
00355 
00356           bool val;
00357 
00358           val = true;
00359           if ( numTot > 0 ) {
00360             float errorRate1 = num00 / numTot;
00361             if ( errorRate1 > threshCry_ )
00362               val = false;
00363             errorRate1 = ( num01 + num02 + num03 ) / numTot / 4.;
00364             if ( errorRate1 > threshCry_ )
00365               val = false;
00366           } else {
00367             if ( num00 > 0 )
00368               val = false;
00369             if ( ( num01 + num02 + num03 ) > 0 )
00370               val = false;
00371           }
00372           c1.setTaskStatus(val);
00373 
00374           int ic = Numbers::indexEB(ism, ie, ip);
00375 
00376           if ( econn ) {
00377             ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic);
00378             dataset1[ecid] = c1;
00379           }
00380 
00381           status = status && val;
00382 
00383         }
00384 
00385       }
00386     }
00387 
00388     float num04, num05;
00389 
00390     for ( int iet = 1; iet <= 17; iet++ ) {
00391       for ( int ipt = 1; ipt <= 4; ipt++ ) {
00392 
00393         num04 = num05 = 0.;
00394 
00395         bool update1 = false;
00396 
00397         float numTot = -1.;
00398 
00399         if ( h_[ism-1] ) {
00400           numTot = 0.;
00401           for ( int ie = 1 + 5*(iet-1); ie <= 5*iet; ie++ ) {
00402             for ( int ip = 1 + 5*(ipt-1); ip <= 5*ipt; ip++ ) {
00403               numTot += h_[ism-1]->GetBinContent(ie, ip);
00404             }
00405           }
00406         }
00407 
00408         if ( h04_[ism-1] ) {
00409           num04  = h04_[ism-1]->GetBinContent(iet, ipt);
00410           if ( num04 > 0 ) update1 = true;
00411         }
00412 
00413         if ( h05_[ism-1] ) {
00414           num05  = h05_[ism-1]->GetBinContent(iet, ipt);
00415           if ( num05 > 0 ) update1 = true;
00416         }
00417 
00418         if ( update0 || update1 ) {
00419 
00420           if ( Numbers::iTT(ism, EcalBarrel, 1+5*(iet-1), 1+5*(ipt-1)) == 1 ) {
00421 
00422             if ( verbose_ ) {
00423               cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00424               cout << "(" << iet << "," << ipt << ") " << num00 << " " << num04 << " " << num05 << endl;
00425               cout << endl;
00426             }
00427 
00428           }
00429 
00430           c2.setProcessedEvents(int(numTot));
00431           c2.setProblematicEvents(int(num04+num05));
00432           c2.setProblemsID(int(num04));
00433           c2.setProblemsSize(int(num05));
00434           c2.setProblemsLV1(int(-1.));
00435           c2.setProblemsBunchX(int(-1.));
00436 
00437           bool val;
00438 
00439           val = true;
00440           if ( numTot > 0 ) {
00441             float errorRate2 = num00 / numTot;
00442             if ( errorRate2 > threshCry_ )
00443               val = false;
00444             errorRate2 = ( num04 + num05 ) / numTot / 2.;
00445             if ( errorRate2 > threshCry_ )
00446               val = false;
00447           } else {
00448             if ( num00 > 0 )
00449               val = false;
00450             if ( ( num04 + num05 ) > 0 )
00451               val = false;
00452           }
00453           c2.setTaskStatus(val);
00454 
00455           int itt = Numbers::iTT(ism, EcalBarrel, 1+5*(iet-1), 1+5*(ipt-1));
00456 
00457           if ( econn ) {
00458             ecid = LogicID::getEcalLogicID("EB_trigger_tower", Numbers::iSM(ism, EcalBarrel), itt);
00459             dataset2[ecid] = c2;
00460           }
00461 
00462           status = status && val;
00463 
00464         }
00465 
00466       }
00467     }
00468 
00469     float num06, num07;
00470 
00471     for ( int ie = 1; ie <= 10; ie++ ) {
00472       for ( int ip = 1; ip <= 5; ip++ ) {
00473 
00474         num06 = num07 = 0.;
00475 
00476         bool update1 = false;
00477 
00478         float numTot = -1.;
00479 
00480         if ( hmem_[ism-1] ) numTot = hmem_[ism-1]->GetBinContent(ie, ip);
00481 
00482         if ( h06_[ism-1] ) {
00483           num06  = h06_[ism-1]->GetBinContent(ie, ip);
00484           if ( num06 > 0 ) update1 = true;
00485         }
00486 
00487         if ( h07_[ism-1] ) {
00488           num07  = h07_[ism-1]->GetBinContent(ie, ip);
00489           if ( num07 > 0 ) update1 = true;
00490         }
00491 
00492         if ( update0 || update1 ) {
00493 
00494           if ( ie ==1 && ip == 1 ) {
00495 
00496             if ( verbose_ ) {
00497               cout << "Preparing dataset for mem of SM=" << ism << endl;
00498               cout << "(" << ie << "," << ip << ") " << num06 << " " << num07 << endl;
00499               cout << endl;
00500             }
00501 
00502           }
00503 
00504           c3.setProcessedEvents( int (numTot));
00505           c3.setProblematicEvents(int (num06+num07));
00506           c3.setProblemsID(int (num06) );
00507           c3.setProblemsGainZero(int (num07));
00508           // c3.setProblemsGainSwitch(int prob);
00509 
00510           bool val;
00511 
00512           val = true;
00513           if ( numTot > 0 ) {
00514             float errorRate1 = num00 / numTot;
00515             if ( errorRate1 > threshCry_ )
00516               val = false;
00517             errorRate1 = ( num06 + num07 ) / numTot / 2.;
00518             if ( errorRate1 > threshCry_ )
00519               val = false;
00520           } else {
00521             if ( num00 > 0 )
00522              val = false;
00523             if ( ( num06 + num07 ) > 0 )
00524               val = false;
00525           }
00526           c3. setTaskStatus(val);
00527 
00528           int ic = EBIntegrityClient::chNum[ (ie-1)%5 ][ (ip-1) ] + (ie-1)/5 * 25;
00529 
00530           if ( econn ) {
00531             ecid = LogicID::getEcalLogicID("EB_mem_channel", Numbers::iSM(ism, EcalBarrel), ic);
00532             dataset3[ecid] = c3;
00533           }
00534 
00535           status = status && val;
00536 
00537         }
00538 
00539       }
00540     }
00541 
00542     float num08, num09;
00543 
00544     for ( int iet = 1; iet <= 2; iet++ ) {
00545 
00546       num08 = num09 = 0.;
00547 
00548       bool update1 = false;
00549 
00550       float numTot = -1.;
00551 
00552       if ( hmem_[ism-1] ) {
00553         numTot = 0.;
00554         for ( int ie = 1 + 5*(iet-1); ie <= 5*iet; ie++ ) {
00555           for ( int ip = 1 ; ip <= 5; ip++ ) {
00556             numTot += hmem_[ism-1]->GetBinContent(ie, ip);
00557           }
00558         }
00559       }
00560 
00561       if ( h08_[ism-1] ) {
00562         num08  = h08_[ism-1]->GetBinContent(iet, 1);
00563         if ( num08 > 0 ) update1 = true;
00564       }
00565 
00566       if ( h09_[ism-1] ) {
00567         num09  = h09_[ism-1]->GetBinContent(iet, 1);
00568         if ( num09 > 0 ) update1 = true;
00569       }
00570 
00571       if ( update0 || update1 ) {
00572 
00573         if ( iet == 1 ) {
00574 
00575           if ( verbose_ ) {
00576             cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << endl;
00577             cout << "(" << iet <<  ") " << num08 << " " << num09 << endl;
00578             cout << endl;
00579           }
00580 
00581         }
00582 
00583         c4.setProcessedEvents( int(numTot) );
00584         c4.setProblematicEvents( int(num08 + num09) );
00585         c4.setProblemsID( int(num08) );
00586         c4.setProblemsSize(int (num09) );
00587         // setProblemsLV1(int LV1);
00588         // setProblemsBunchX(int bunchX);
00589 
00590         bool val;
00591 
00592         val = true;
00593         if ( numTot > 0 ) {
00594           float errorRate2 = num00 / numTot;
00595           if ( errorRate2 > threshCry_ )
00596             val = false;
00597           errorRate2 = ( num08 + num09 ) / numTot / 2.;
00598           if ( errorRate2 > threshCry_ )
00599             val = false;
00600         } else {
00601           if ( num00 > 0 )
00602             val = false;
00603           if ( ( num08 + num09 ) > 0 )
00604             val = false;
00605         }
00606         c4.setTaskStatus(val);
00607 
00608         int itt = 68 + iet;
00609 
00610         if ( econn ) {
00611           ecid = LogicID::getEcalLogicID("EB_mem_TT", Numbers::iSM(ism, EcalBarrel), itt);
00612           dataset4[ecid] = c4;
00613         }
00614 
00615         status = status && val;
00616 
00617       }
00618 
00619     }
00620 
00621   }
00622 
00623   if ( econn ) {
00624     try {
00625       if ( verbose_ ) cout << "Inserting MonConsistencyDat ..." << endl;
00626       if ( dataset1.size() != 0 ) econn->insertDataArraySet(&dataset1, moniov);
00627       if ( dataset2.size() != 0 ) econn->insertDataArraySet(&dataset2, moniov);
00628       if ( dataset3.size() != 0 ) econn->insertDataArraySet(&dataset3, moniov);
00629       if ( dataset4.size() != 0 ) econn->insertDataArraySet(&dataset4, moniov);
00630       if ( verbose_ ) cout << "done." << endl;
00631     } catch (runtime_error &e) {
00632       cerr << e.what() << endl;
00633     }
00634   }
00635 
00636   if ( ! flag ) this->softReset(true);
00637 
00638   return true;
00639 
00640 }
00641 
00642 void EBIntegrityClient::analyze(void) {
00643 
00644   ievt_++;
00645   jevt_++;
00646   if ( ievt_ % 10 == 0 ) {
00647     if ( debug_ ) cout << "EBIntegrityClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00648   }
00649 
00650   uint64_t bits01 = 0;
00651   bits01 |= EcalErrorDictionary::getMask("CH_ID_WARNING");
00652   bits01 |= EcalErrorDictionary::getMask("CH_GAIN_ZERO_WARNING");
00653   bits01 |= EcalErrorDictionary::getMask("CH_GAIN_SWITCH_WARNING");
00654   bits01 |= EcalErrorDictionary::getMask("CH_ID_ERROR");
00655   bits01 |= EcalErrorDictionary::getMask("CH_GAIN_ZERO_ERROR");
00656   bits01 |= EcalErrorDictionary::getMask("CH_GAIN_SWITCH_ERROR");
00657 
00658   uint64_t bits02 = 0;
00659   bits02 |= EcalErrorDictionary::getMask("TT_ID_WARNING");
00660   bits02 |= EcalErrorDictionary::getMask("TT_SIZE_WARNING");
00661   bits02 |= EcalErrorDictionary::getMask("TT_LV1_WARNING");
00662   bits02 |= EcalErrorDictionary::getMask("TT_BUNCH_X_WARNING");
00663   bits02 |= EcalErrorDictionary::getMask("TT_ID_ERROR");
00664   bits02 |= EcalErrorDictionary::getMask("TT_SIZE_ERROR");
00665   bits02 |= EcalErrorDictionary::getMask("TT_LV1_ERROR");
00666   bits02 |= EcalErrorDictionary::getMask("TT_BUNCH_X_ERROR");
00667 
00668   map<EcalLogicID, RunCrystalErrorsDat> mask1;
00669   map<EcalLogicID, RunTTErrorsDat> mask2;
00670   map<EcalLogicID, RunMemChErrorsDat> mask3;
00671   map<EcalLogicID, RunMemTTErrorsDat> mask4;
00672 
00673   EcalErrorMask::fetchDataSet(&mask1);
00674   EcalErrorMask::fetchDataSet(&mask2);
00675   EcalErrorMask::fetchDataSet(&mask3);
00676   EcalErrorMask::fetchDataSet(&mask4);
00677 
00678   char histo[200];
00679 
00680   MonitorElement* me;
00681 
00682   sprintf(histo, (prefixME_ + "/EBIntegrityTask/EBIT DCC size error").c_str());
00683   me = dqmStore_->get(histo);
00684   h00_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, h00_ );
00685 
00686   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00687 
00688     int ism = superModules_[i];
00689 
00690     sprintf(histo, (prefixME_ + "/EBOccupancyTask/EBOT digi occupancy %s").c_str(), Numbers::sEB(ism).c_str());
00691     me = dqmStore_->get(histo);
00692     h_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h_[ism-1] );
00693 
00694     sprintf(histo, (prefixME_ + "/EBOccupancyTask/EBOT MEM digi occupancy %s").c_str(), Numbers::sEB(ism).c_str());
00695     me = dqmStore_->get(histo);
00696     hmem_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, hmem_[ism-1] );
00697 
00698     sprintf(histo, (prefixME_ + "/EBIntegrityTask/Gain/EBIT gain %s").c_str(), Numbers::sEB(ism).c_str());
00699     me = dqmStore_->get(histo);
00700     h01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
00701 
00702     sprintf(histo, (prefixME_ + "/EBIntegrityTask/ChId/EBIT ChId %s").c_str(), Numbers::sEB(ism).c_str());
00703     me = dqmStore_->get(histo);
00704     h02_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h02_[ism-1] );
00705 
00706     sprintf(histo, (prefixME_ + "/EBIntegrityTask/GainSwitch/EBIT gain switch %s").c_str(), Numbers::sEB(ism).c_str());
00707     me = dqmStore_->get(histo);
00708     h03_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h03_[ism-1] );
00709 
00710     sprintf(histo, (prefixME_ + "/EBIntegrityTask/TTId/EBIT TTId %s").c_str(), Numbers::sEB(ism).c_str());
00711     me = dqmStore_->get(histo);
00712     h04_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h04_[ism-1] );
00713 
00714     sprintf(histo, (prefixME_ + "/EBIntegrityTask/TTBlockSize/EBIT TTBlockSize %s").c_str(), Numbers::sEB(ism).c_str());
00715     me = dqmStore_->get(histo);
00716     h05_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h05_[ism-1] );
00717 
00718     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemChId/EBIT MemChId %s").c_str(), Numbers::sEB(ism).c_str());
00719     me = dqmStore_->get(histo);
00720     h06_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h06_[ism-1] );
00721 
00722     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemGain/EBIT MemGain %s").c_str(), Numbers::sEB(ism).c_str());
00723     me = dqmStore_->get(histo);
00724     h07_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h07_[ism-1] );
00725 
00726     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemTTId/EBIT MemTTId %s").c_str(), Numbers::sEB(ism).c_str());
00727     me = dqmStore_->get(histo);
00728     h08_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h08_[ism-1] );
00729 
00730     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemSize/EBIT MemSize %s").c_str(), Numbers::sEB(ism).c_str());
00731     me = dqmStore_->get(histo);
00732     h09_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h09_[ism-1] );
00733 
00734     float num00;
00735 
00736     // integrity summary histograms
00737     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00738     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00739 
00740     num00 = 0.;
00741 
00742     bool update0 = false;
00743 
00744     // dcc size errors
00745     if ( h00_ ) {
00746       num00  = h00_->GetBinContent(ism);
00747       update0 = true;
00748     }
00749 
00750     float num01, num02, num03, num04, num05;
00751 
00752     for ( int ie = 1; ie <= 85; ie++ ) {
00753       for ( int ip = 1; ip <= 20; ip++ ) {
00754 
00755         num01 = num02 = num03 = num04 = num05 = 0.;
00756 
00757         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
00758 
00759         bool update1 = false;
00760         bool update2 = false;
00761 
00762         float numTot = -1.;
00763 
00764         if ( h_[ism-1] ) numTot = h_[ism-1]->GetBinContent(ie, ip);
00765 
00766         if ( h01_[ism-1] ) {
00767           num01  = h01_[ism-1]->GetBinContent(ie, ip);
00768           update1 = true;
00769         }
00770 
00771         if ( h02_[ism-1] ) {
00772           num02  = h02_[ism-1]->GetBinContent(ie, ip);
00773           update1 = true;
00774         }
00775 
00776         if ( h03_[ism-1] ) {
00777           num03  = h03_[ism-1]->GetBinContent(ie, ip);
00778           update1 = true;
00779         }
00780 
00781         int iet = 1 + ((ie-1)/5);
00782         int ipt = 1 + ((ip-1)/5);
00783 
00784         if ( h04_[ism-1] ) {
00785           num04  = h04_[ism-1]->GetBinContent(iet, ipt);
00786           update2 = true;
00787         }
00788 
00789         if ( h05_[ism-1] ) {
00790           num05  = h05_[ism-1]->GetBinContent(iet, ipt);
00791           update2 = true;
00792         }
00793 
00794         if ( update0 || update1 || update2 ) {
00795 
00796           float val;
00797 
00798           val = 1.;
00799           // number of events on a channel
00800           if ( numTot > 0 ) {
00801             float errorRate1 =  num00 / numTot;
00802             if ( errorRate1 > threshCry_ )
00803               val = 0.;
00804             errorRate1 = ( num01 + num02 + num03 ) / numTot / 4.;
00805             if ( errorRate1 > threshCry_ )
00806               val = 0.;
00807             float errorRate2 = ( num04 + num05 ) / numTot / 2.;
00808             if ( errorRate2 > threshCry_ )
00809               val = 0.;
00810           } else {
00811             val = 2.;
00812             if ( num00 > 0 )
00813               val = 0.;
00814             if ( ( num01 + num02 + num03 ) > 0 )
00815               val = 0.;
00816             if ( ( num04 + num05 ) > 0 )
00817               val = 0.;
00818           }
00819 
00820           // filling the summary for SM channels
00821           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, val );
00822 
00823         }
00824 
00825         // masking
00826 
00827         if ( mask1.size() != 0 ) {
00828           map<EcalLogicID, RunCrystalErrorsDat>::const_iterator m;
00829           for (m = mask1.begin(); m != mask1.end(); m++) {
00830 
00831             EcalLogicID ecid = m->first;
00832 
00833             int ic = Numbers::indexEB(ism, ie, ip);
00834 
00835             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic).getLogicID() ) {
00836               if ( (m->second).getErrorBits() & bits01 ) {
00837                 UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
00838               }
00839             }
00840 
00841           }
00842         }
00843 
00844         if ( mask2.size() != 0 ) {
00845           map<EcalLogicID, RunTTErrorsDat>::const_iterator m;
00846           for (m = mask2.begin(); m != mask2.end(); m++) {
00847 
00848             EcalLogicID ecid = m->first;
00849 
00850             int itt = Numbers::iTT(ism, EcalBarrel, ie, ip);
00851 
00852             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_trigger_tower", Numbers::iSM(ism, EcalBarrel), itt).getLogicID() ) {
00853               if ( (m->second).getErrorBits() & bits02 ) {
00854                 UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
00855               }
00856             }
00857 
00858           }
00859         }
00860 
00861       }
00862     }// end of loop on crystals to fill summary plot
00863 
00864     // summaries for mem channels
00865     float num06, num07, num08, num09;
00866 
00867     for ( int ie = 1; ie <= 10; ie++ ) {
00868       for ( int ip = 1; ip <= 5; ip++ ) {
00869 
00870         num06 = num07 = num08 = num09 = 0.;
00871 
00872         // initialize summary histo for mem
00873         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
00874 
00875         bool update1 = false;
00876         bool update2 = false;
00877 
00878         float numTotmem = -1.;
00879 
00880         if ( hmem_[ism-1] ) numTotmem = hmem_[ism-1]->GetBinContent(ie, ip);
00881 
00882         if ( h06_[ism-1] ) {
00883           num06  = h06_[ism-1]->GetBinContent(ie, ip);
00884           update1 = true;
00885         }
00886 
00887         if ( h07_[ism-1] ) {
00888           num07  = h07_[ism-1]->GetBinContent(ie, ip);
00889           update1 = true;
00890         }
00891 
00892         int iet = 1 + ((ie-1)/5);
00893         int ipt = 1;
00894 
00895         if ( h08_[ism-1] ) {
00896           num08  = h08_[ism-1]->GetBinContent(iet, ipt);
00897           update2 = true;
00898         }
00899 
00900         if ( h09_[ism-1] ) {
00901           num09  = h09_[ism-1]->GetBinContent(iet, ipt);
00902           update2 = true;
00903         }
00904 
00905 
00906         if ( update0 || update1 || update2 ) {
00907 
00908           float val;
00909 
00910           val = 1.;
00911           // number of events on a channel
00912           if ( numTotmem > 0 ) {
00913             float errorRate1 = ( num06 + num07 ) / numTotmem / 2.;
00914             if ( errorRate1 > threshCry_ )
00915               val = 0.;
00916             float errorRate2 = ( num08 + num09 ) / numTotmem / 2.;
00917             if ( errorRate2 > threshCry_ )
00918               val = 0.;
00919           } else {
00920             val = 2.;
00921             if ( ( num06 + num07 ) > 0 )
00922               val = 0.;
00923             if ( ( num08 + num09 ) > 0 )
00924               val = 0.;
00925           }
00926 
00927           // filling summary for mem channels
00928           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, val );
00929 
00930         }
00931 
00932         // masking
00933 
00934         if ( mask3.size() != 0 ) {
00935           map<EcalLogicID, RunMemChErrorsDat>::const_iterator m;
00936           for (m = mask3.begin(); m != mask3.end(); m++) {
00937 
00938             EcalLogicID ecid = m->first;
00939 
00940             int ic = EBIntegrityClient::chNum[ (ie-1)%5 ][ (ip-1) ] + (ie-1)/5 * 25;
00941 
00942             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_mem_channel", Numbers::iSM(ism, EcalBarrel), ic).getLogicID() ) {
00943               if ( (m->second).getErrorBits() & bits01 ) {
00944                 UtilsClient::maskBinContent( meg02_[ism-1], ie, ip );
00945               }
00946             }
00947           }
00948         }
00949 
00950         if ( mask4.size() != 0 ) {
00951           map<EcalLogicID, RunMemTTErrorsDat>::const_iterator m;
00952           for (m = mask4.begin(); m != mask4.end(); m++) {
00953 
00954             EcalLogicID ecid = m->first;
00955 
00956             int iet = 1 + ((ie-1)/5);
00957             int itt = 68 + iet;
00958 
00959             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EB_mem_TT", Numbers::iSM(ism, EcalBarrel), itt).getLogicID() ) {
00960               if ( (m->second).getErrorBits() & bits02 ) {
00961                 UtilsClient::maskBinContent( meg02_[ism-1], ie, ip );
00962               }
00963             }
00964           }
00965         }
00966 
00967       }
00968     }  // end loop on mem channels
00969 
00970   }// end loop on supermodules
00971 
00972 }
00973 
00974 void EBIntegrityClient::softReset(bool flag) {
00975 
00976   char histo[200];
00977 
00978   MonitorElement* me;
00979 
00980   sprintf(histo, (prefixME_ + "/EBIntegrityTask/EBIT DCC size error").c_str());
00981   me = dqmStore_->get(histo);
00982   if ( flag ) {
00983     if ( me ) dqmStore_->softReset( me );
00984   } else {
00985     //      if ( me ) dqmStore_->disableSoftReset( me );
00986   }
00987 
00988   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00989 
00990     int ism = superModules_[i];
00991     
00992     sprintf(histo, (prefixME_ + "/EBOccupancyTask/EBOT digi occupancy %s").c_str(), Numbers::sEB(ism).c_str());
00993     me = dqmStore_->get(histo);
00994     if ( flag ) {
00995       if ( me ) dqmStore_->softReset( me );
00996     } else {
00997 //      if ( me ) dqmStore_->disableSoftReset( me );
00998     }
00999 
01000     sprintf(histo, (prefixME_ + "/EBOccupancyTask/EBOT MEM digi occupancy %s").c_str(), Numbers::sEB(ism).c_str());
01001     me = dqmStore_->get(histo);
01002     if ( flag ) {
01003       if ( me ) dqmStore_->softReset( me );
01004     } else {
01005 //      if ( me ) dqmStore_->disableSoftReset( me );
01006     }
01007 
01008     sprintf(histo, (prefixME_ + "/EBIntegrityTask/Gain/EBIT gain %s").c_str(), Numbers::sEB(ism).c_str());
01009     me = dqmStore_->get(histo);
01010     if ( flag ) {
01011       if ( me ) dqmStore_->softReset( me );
01012     } else {
01013 //      if ( me ) dqmStore_->disableSoftReset( me );
01014     }
01015 
01016     sprintf(histo, (prefixME_ + "/EBIntegrityTask/ChId/EBIT ChId %s").c_str(), Numbers::sEB(ism).c_str());
01017     me = dqmStore_->get(histo);
01018     if ( flag ) {
01019       if ( me ) dqmStore_->softReset( me );
01020     } else {
01021 //      if ( me ) dqmStore_->disableSoftReset( me );
01022     }
01023 
01024     sprintf(histo, (prefixME_ + "/EBIntegrityTask/GainSwitch/EBIT gain switch %s").c_str(), Numbers::sEB(ism).c_str());
01025     me = dqmStore_->get(histo);
01026     if ( flag ) {
01027       if ( me ) dqmStore_->softReset( me );
01028     } else {
01029 //      if ( me ) dqmStore_->disableSoftReset( me );
01030     }
01031 
01032     sprintf(histo, (prefixME_ + "/EBIntegrityTask/TTId/EBIT TTId %s").c_str(), Numbers::sEB(ism).c_str());
01033     me = dqmStore_->get(histo);
01034     if ( flag ) {
01035       if ( me ) dqmStore_->softReset( me );
01036     } else {
01037 //      if ( me ) dqmStore_->disableSoftReset( me );
01038     }
01039 
01040     sprintf(histo, (prefixME_ + "/EBIntegrityTask/TTBlockSize/EBIT TTBlockSize %s").c_str(), Numbers::sEB(ism).c_str());
01041     me = dqmStore_->get(histo);
01042     if ( flag ) {
01043       if ( me ) dqmStore_->softReset( me );
01044     } else {
01045 //      if ( me ) dqmStore_->disableSoftReset( me );
01046     }
01047 
01048     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemChId/EBIT MemChId %s").c_str(), Numbers::sEB(ism).c_str());
01049     me = dqmStore_->get(histo);
01050     if ( flag ) {
01051       if ( me ) dqmStore_->softReset( me );
01052     } else {
01053 //      if ( me ) dqmStore_->disableSoftReset( me );
01054     }
01055 
01056     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemGain/EBIT MemGain %s").c_str(), Numbers::sEB(ism).c_str());
01057     me = dqmStore_->get(histo);
01058     if ( flag ) {
01059       if ( me ) dqmStore_->softReset( me );
01060     } else {
01061 //      if ( me ) dqmStore_->disableSoftReset( me );
01062     }
01063 
01064     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemTTId/EBIT MemTTId %s").c_str(), Numbers::sEB(ism).c_str());
01065     me = dqmStore_->get(histo);
01066     if ( flag ) {
01067       if ( me ) dqmStore_->softReset( me );
01068     } else {
01069 //      if ( me ) dqmStore_->disableSoftReset( me );
01070     }
01071 
01072     sprintf(histo, (prefixME_ + "/EBIntegrityTask/MemSize/EBIT MemSize %s").c_str(), Numbers::sEB(ism).c_str());
01073     me = dqmStore_->get(histo);
01074     if ( flag ) {
01075       if ( me ) dqmStore_->softReset( me );
01076     } else {
01077 //      if ( me ) dqmStore_->disableSoftReset( me );
01078     }
01079 
01080   }
01081 
01082 }
01083 
01084 void EBIntegrityClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
01085 
01086   if ( verbose_ ) cout << "Preparing EBIntegrityClient html output ..." << endl;
01087 
01088   ofstream htmlFile;
01089 
01090   htmlFile.open((htmlDir + htmlName).c_str());
01091 
01092   // html page header
01093   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
01094   htmlFile << "<html>  " << endl;
01095   htmlFile << "<head>  " << endl;
01096   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
01097   htmlFile << " https-equiv=\"content-type\">  " << endl;
01098   htmlFile << "  <title>Monitor:IntegrityTask output</title> " << endl;
01099   htmlFile << "</head>  " << endl;
01100   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
01101   htmlFile << "<body>  " << endl;
01102   //htmlFile << "<br>  " << endl;
01103   htmlFile << "<a name=""top""></a>" << endl;
01104   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
01105   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
01106   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << endl;
01107   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
01108   htmlFile << " style=\"color: rgb(0, 0, 153);\">INTEGRITY</span></h2> " << endl;
01109   htmlFile << "<hr>" << endl;
01110   htmlFile << "<table border=1><tr><td bgcolor=red>channel has problems in this task</td>" << endl;
01111   htmlFile << "<td bgcolor=lime>channel has NO problems</td>" << endl;
01112   htmlFile << "<td bgcolor=yellow>channel is missing</td></table>" << endl;
01113   htmlFile << "<br>" << endl;
01114   htmlFile << "<table border=1>" << std::endl;
01115   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
01116     htmlFile << "<td bgcolor=white><a href=""#"
01117              << Numbers::sEB(superModules_[i]) << ">"
01118              << setfill( '0' ) << setw(2) << superModules_[i] << "</a></td>";
01119   }
01120   htmlFile << std::endl << "</table>" << std::endl;
01121   htmlFile << "<hr>" << std::endl;
01122 
01123   // Produce the plots to be shown as .png files from existing histograms
01124 
01125   const int csize = 250;
01126 
01127   int pCol3[7] = { 301, 302, 303, 304, 305, 306, 307 };
01128   int pCol4[10];
01129   for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
01130   int pCol5[10];
01131   for ( int i = 0; i < 10; i++ ) pCol5[i] = 501+i;
01132 
01133   TH2C dummy1( "dummy1", "dummy1 for sm", 85, 0, 85, 20, 0, 20 );
01134   for ( short i=0; i<68; i++ ) {
01135     int a = 2 + ( i/4 ) * 5;
01136     int b = 2 + ( i%4 ) * 5;
01137     dummy1.Fill( a, b, i+1 );
01138   }
01139   dummy1.SetMarkerSize(2);
01140   dummy1.SetMinimum(0.1);
01141 
01142   TH2C dummy2( "dummy2", "dummy2 for sm", 17, 0, 17, 4, 0, 4 );
01143   for ( short i=0; i<68; i++ ) {
01144     int a = ( i/4 );
01145     int b = ( i%4 );
01146     dummy2.Fill( a, b, i+1 );
01147   }
01148   dummy2.SetMarkerSize(2);
01149   dummy2.SetMinimum(0.1);
01150 
01151   TH2C dummy3( "dummy3", "dummy3 for sm mem", 10, 0, 10, 5, 0, 5 );
01152   for ( short i=0; i<2; i++ ) {
01153     int a = 2 + i*5;
01154     int b = 2;
01155     dummy3.Fill( a, b, i+1+68 );
01156   }
01157   dummy3.SetMarkerSize(2);
01158   dummy3.SetMinimum(0.1);
01159 
01160   TH2C dummy4 ("dummy4", "dummy4 for sm mem", 2, 0, 2, 1, 0, 1 );
01161   for ( short i=0; i<2; i++ ) {
01162     int a =  i;
01163     int b = 0;
01164     dummy4.Fill( a, b, i+1+68 );
01165   }
01166   dummy4.SetMarkerSize(2);
01167   dummy4.SetMinimum(0.1);
01168 
01169   string imgNameDCC, imgNameOcc, imgNameQual,imgNameOccMem, imgNameQualMem, imgNameME[9], imgName, meName;
01170 
01171   TCanvas* cDCC = new TCanvas("cDCC", "Temp", 3*csize, csize);
01172   TCanvas* cOcc = new TCanvas("cOcc", "Temp", 3*csize, csize);
01173   TCanvas* cQual = new TCanvas("cQual", "Temp", 3*csize, csize);
01174   TCanvas* cMe = new TCanvas("cMe", "Temp", 3*csize, csize);
01175   TCanvas* cMeMem = new TCanvas("cMeMem", "Temp", 2*csize, csize);
01176 
01177   TH1F* obj1f;
01178   TH2F* obj2f;
01179 
01180   // DCC size error
01181 
01182   imgNameDCC = "";
01183 
01184   obj1f = h00_;
01185 
01186   if ( obj1f ) {
01187 
01188     meName = obj1f->GetName();
01189 
01190     replace(meName.begin(), meName.end(), ' ', '_');
01191     imgNameDCC = meName + ".png";
01192     imgName = htmlDir + imgNameDCC;
01193 
01194     cDCC->cd();
01195     gStyle->SetOptStat(" ");
01196     gPad->SetBottomMargin(0.2);
01197     obj1f->GetXaxis()->LabelsOption("v");
01198     obj1f->GetXaxis()->SetLabelSize(0.05);
01199     obj1f->Draw();
01200     cDCC->Update();
01201     cDCC->SaveAs(imgName.c_str());
01202 
01203   }
01204 
01205   htmlFile << "<h3><strong>DCC size error</strong></h3>" << endl;
01206 
01207   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01208   htmlFile << "cellpadding=\"10\"> " << endl;
01209   htmlFile << "<tr align=\"left\">" << endl;
01210 
01211   if ( imgNameDCC.size() != 0 )
01212     htmlFile << "<td><img src=\"" << imgNameDCC << "\"></td>" << endl;
01213   else
01214     htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01215 
01216   htmlFile << "</tr>" << endl;
01217   htmlFile << "</table>" << endl;
01218   htmlFile << "<br>" << endl;
01219 
01220   // Loop on barrel supermodules
01221 
01222   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
01223 
01224     int ism = superModules_[i];
01225 
01226     // Quality plots
01227 
01228     imgNameQual = "";
01229 
01230     obj2f = UtilsClient::getHisto<TH2F*>( meg01_[ism-1] );
01231 
01232     if ( obj2f ) {
01233 
01234       meName = obj2f->GetName();
01235 
01236       replace(meName.begin(), meName.end(), ' ', '_');
01237       imgNameQual = meName + ".png";
01238       imgName = htmlDir + imgNameQual;
01239 
01240       cQual->cd();
01241       gStyle->SetOptStat(" ");
01242       gStyle->SetPalette(7, pCol3);
01243       obj2f->GetXaxis()->SetNdivisions(17);
01244       obj2f->GetYaxis()->SetNdivisions(4);
01245       cQual->SetGridx();
01246       cQual->SetGridy();
01247       obj2f->SetMinimum(-0.00000001);
01248       obj2f->SetMaximum(7.0);
01249       obj2f->Draw("col");
01250       dummy1.Draw("text,same");
01251       cQual->Update();
01252       cQual->SaveAs(imgName.c_str());
01253 
01254     }
01255 
01256     // Occupancy plots
01257 
01258     imgNameOcc = "";
01259 
01260     obj2f = h_[ism-1];
01261 
01262     if ( obj2f ) {
01263 
01264       meName = obj2f->GetName();
01265 
01266       replace(meName.begin(), meName.end(), ' ', '_');
01267       imgNameOcc = meName + ".png";
01268       imgName = htmlDir + imgNameOcc;
01269 
01270       cOcc->cd();
01271       gStyle->SetOptStat(" ");
01272       gStyle->SetPalette(10, pCol4);
01273       obj2f->GetXaxis()->SetNdivisions(17);
01274       obj2f->GetYaxis()->SetNdivisions(4);
01275       cOcc->SetGridx();
01276       cOcc->SetGridy();
01277       obj2f->SetMinimum(0.0);
01278       obj2f->Draw("colz");
01279       dummy1.Draw("text,same");
01280       cOcc->Update();
01281       cOcc->SaveAs(imgName.c_str());
01282 
01283     }
01284 
01285     // Monitoring elements plots
01286 
01287     for ( int iCanvas = 1; iCanvas <= 5; iCanvas++ ) {
01288 
01289       imgNameME[iCanvas-1] = "";
01290 
01291       obj2f = 0;
01292       switch ( iCanvas ) {
01293       case 1:
01294         obj2f = h01_[ism-1];
01295         break;
01296       case 2:
01297         obj2f = h02_[ism-1];
01298         break;
01299       case 3:
01300         obj2f = h03_[ism-1];
01301         break;
01302       case 4:
01303         obj2f = h04_[ism-1];
01304         break;
01305       case 5:
01306         obj2f = h05_[ism-1];
01307         break;
01308       default:
01309         break;
01310       }
01311 
01312       if ( obj2f ) {
01313 
01314         meName = obj2f->GetName();
01315 
01316         replace(meName.begin(), meName.end(), ' ', '_');
01317         imgNameME[iCanvas-1] = meName + ".png";
01318         imgName = htmlDir + imgNameME[iCanvas-1];
01319 
01320         cMe->cd();
01321         gStyle->SetOptStat(" ");
01322         gStyle->SetPalette(10, pCol5);
01323         obj2f->GetXaxis()->SetNdivisions(17);
01324         obj2f->GetYaxis()->SetNdivisions(4);
01325         cMe->SetGridx();
01326         cMe->SetGridy();
01327         obj2f->SetMinimum(0.0);
01328         obj2f->Draw("colz");
01329         if ( iCanvas <= 3 )
01330           dummy1.Draw("text,same");
01331         else
01332           dummy2.Draw("text,same");
01333         cMe->Update();
01334         cMe->SaveAs(imgName.c_str());
01335 
01336       }
01337 
01338     }
01339 
01340     // MEM Quality plots
01341 
01342     imgNameQualMem = "";
01343 
01344     obj2f = UtilsClient::getHisto<TH2F*>( meg02_[ism-1] );
01345 
01346     if ( obj2f ) {
01347 
01348       meName = obj2f->GetName();
01349 
01350       replace(meName.begin(), meName.end(), ' ', '_');
01351       imgNameQualMem = meName + ".png";
01352       imgName = htmlDir + imgNameQualMem;
01353 
01354       cMeMem->cd();
01355       gStyle->SetOptStat(" ");
01356       gStyle->SetPalette(7, pCol3);
01357       obj2f->GetXaxis()->SetNdivisions(10);
01358       obj2f->GetYaxis()->SetNdivisions(5);
01359       cMeMem->SetGridx();
01360       cMeMem->SetGridy(0);
01361       obj2f->SetMinimum(-0.00000001);
01362       obj2f->SetMaximum(7.0);
01363       obj2f->Draw("col");
01364       dummy3.Draw("text,same");
01365       cMeMem->Update();
01366       cMeMem->SaveAs(imgName.c_str());
01367 
01368     }
01369 
01370     // MEM Occupancy plots
01371 
01372     imgNameOccMem = "";
01373 
01374     obj2f = hmem_[ism-1];
01375 
01376     if ( obj2f ) {
01377 
01378       meName = obj2f->GetName();
01379 
01380       replace(meName.begin(), meName.end(), ' ', '_');
01381       imgNameOccMem = meName + ".png";
01382       imgName = htmlDir + imgNameOccMem;
01383 
01384       cMeMem->cd();
01385       gStyle->SetOptStat(" ");
01386       gStyle->SetPalette(10, pCol4);
01387       obj2f->GetXaxis()->SetNdivisions(10);
01388       obj2f->GetYaxis()->SetNdivisions(5);
01389       cMeMem->SetGridx();
01390       cMeMem->SetGridy(0);
01391       obj2f->SetMinimum(0.0);
01392       obj2f->Draw("colz");
01393       dummy3.Draw("text,same");
01394       cMeMem->Update();
01395       cMeMem->SaveAs(imgName.c_str());
01396 
01397     }
01398 
01399     // MeM Monitoring elements plots
01400 
01401     for ( int iCanvas = 6; iCanvas <= 9; iCanvas++ ) {
01402 
01403       imgNameME[iCanvas-1] = "";
01404 
01405       obj2f = 0;
01406       switch ( iCanvas ) {
01407       case 6:
01408         obj2f = h06_[ism-1];
01409         break;
01410       case 7:
01411         obj2f = h07_[ism-1];
01412         break;
01413       case 8:
01414         obj2f = h08_[ism-1];
01415         break;
01416       case 9:
01417         obj2f = h09_[ism-1];
01418         break;
01419       default:
01420         break;
01421       }
01422 
01423       if ( obj2f ) {
01424 
01425         meName = obj2f->GetName();
01426 
01427         replace(meName.begin(), meName.end(), ' ', '_');
01428         imgNameME[iCanvas-1] = meName + ".png";
01429         imgName = htmlDir + imgNameME[iCanvas-1];
01430 
01431         cMeMem->cd();
01432         gStyle->SetOptStat(" ");
01433         gStyle->SetPalette(10, pCol5);
01434         obj2f->SetMinimum(0.0);
01435         obj2f->Draw("colz");
01436         if ( iCanvas <= 7 ) {
01437           obj2f->GetXaxis()->SetNdivisions(10);
01438           obj2f->GetYaxis()->SetNdivisions(5);
01439           cMeMem->SetGridx();
01440           cMeMem->SetGridy(0);
01441           dummy3.Draw("text,same");
01442         }
01443         else{
01444           obj2f->GetXaxis()->SetNdivisions(2);
01445           obj2f->GetYaxis()->SetNdivisions(1);
01446           cMeMem->SetGridx();
01447           cMeMem->SetGridy();
01448           dummy4.Draw("text,same");
01449         }
01450         cMeMem->Update();
01451         cMeMem->SaveAs(imgName.c_str());
01452 
01453       }
01454 
01455     }
01456 
01457     if( i>0 ) htmlFile << "<a href=""#top"">Top</a>" << std::endl;
01458     htmlFile << "<hr>" << std::endl;
01459     htmlFile << "<h3><a name="""
01460              << Numbers::sEB(ism) << """></a><strong>"
01461              << Numbers::sEB(ism) << "</strong></h3>" << endl;
01462     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01463     htmlFile << "cellpadding=\"10\"> " << endl;
01464     htmlFile << "<tr align=\"left\">" << endl;
01465 
01466     if ( imgNameQual.size() != 0 )
01467       htmlFile << "<td><img src=\"" << imgNameQual << "\"></td>" << endl;
01468     else
01469       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01470 
01471     if ( imgNameOcc.size() != 0 )
01472       htmlFile << "<td><img src=\"" << imgNameOcc << "\"></td>" << endl;
01473     else
01474       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01475 
01476     htmlFile << "</tr>" << endl;
01477     htmlFile << "</table>" << endl;
01478     htmlFile << "<br>" << endl;
01479 
01480     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01481     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01482     htmlFile << "<tr align=\"center\">" << endl;
01483 
01484     for ( int iCanvas = 1 ; iCanvas <= 2 ; iCanvas++ ) {
01485 
01486       if ( imgNameME[iCanvas-1].size() != 0 )
01487         htmlFile << "<td><img src=\"" << imgNameME[iCanvas-1] << "\"></td>" << endl;
01488       else
01489         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01490 
01491     }
01492 
01493     htmlFile << "</tr>" << endl;
01494     htmlFile << "</table>" << endl;
01495     htmlFile << "<br>" << endl;
01496 
01497     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01498     htmlFile << "cellpadding=\"10\"> " << endl;
01499     htmlFile << "<tr align=\"left\">" << endl;
01500 
01501     int iCanvas = 3;
01502 
01503     if ( imgNameME[iCanvas-1].size() != 0 )
01504       htmlFile << "<td><img src=\"" << imgNameME[iCanvas-1] << "\"></td>" << endl;
01505     else
01506       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01507 
01508     htmlFile << "</tr>" << endl;
01509     htmlFile << "</table>" << endl;
01510     htmlFile << "<br>" << endl;
01511 
01512     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01513     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01514     htmlFile << "<tr align=\"center\">" << endl;
01515 
01516     for ( int iCanvas = 4 ; iCanvas <= 5 ; iCanvas++ ) {
01517 
01518       if ( imgNameME[iCanvas-1].size() != 0 )
01519         htmlFile << "<td><img src=\"" << imgNameME[iCanvas-1] << "\"></td>" << endl;
01520       else
01521         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01522 
01523     }
01524 
01525     htmlFile << "</tr>" << endl;
01526     htmlFile << "</table>" << endl;
01527 
01528     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01529     htmlFile << "cellpadding=\"10\"> " << endl;
01530     htmlFile << "<tr align=\"left\">" << endl;
01531 
01532     if ( imgNameQualMem.size() != 0 )
01533       htmlFile << "<td><img src=\"" << imgNameQualMem << "\"></td>" << endl;
01534     else
01535       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01536 
01537     if ( imgNameOccMem.size() != 0 )
01538       htmlFile << "<td><img src=\"" << imgNameOccMem << "\"></td>" << endl;
01539     else
01540       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01541 
01542     htmlFile << "</tr>" << endl;
01543     htmlFile << "</table>" << endl;
01544     htmlFile << "<br>" << endl;
01545 
01546 
01547     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01548     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01549     htmlFile << "<tr>" << endl;
01550 
01551     for ( int iCanvas = 6 ; iCanvas <= 7 ; iCanvas++ ) {
01552 
01553       if ( imgNameME[iCanvas-1].size() != 0 )
01554         htmlFile << "<td><img src=\"" << imgNameME[iCanvas-1] << "\"></td>" << endl;
01555       else
01556         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01557 
01558     }
01559 
01560     htmlFile << "</tr>" << endl;
01561     htmlFile << "</table>" << endl;
01562     htmlFile << "<br>" << endl;
01563 
01564     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01565     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01566     htmlFile << "<tr>" << endl;
01567 
01568     for ( int iCanvas = 8 ; iCanvas <= 9 ; iCanvas++ ) {
01569 
01570       if ( imgNameME[iCanvas-1].size() != 0 )
01571         htmlFile << "<td><img src=\"" << imgNameME[iCanvas-1] << "\"></td>" << endl;
01572       else
01573         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01574 
01575     }
01576 
01577     htmlFile << "</tr>" << endl;
01578     htmlFile << "</table>" << endl;
01579     htmlFile << "<br>" << endl;
01580 
01581   }
01582 
01583   delete cDCC;
01584   delete cOcc;
01585   delete cQual;
01586   delete cMe;
01587   delete cMeMem;
01588 
01589   // html page footer
01590   htmlFile << "</body> " << endl;
01591   htmlFile << "</html> " << endl;
01592 
01593   htmlFile.close();
01594 
01595 }
01596 
01597 const int  EBIntegrityClient::chNum [5][5] = {
01598   { 1,  2,  3,  4,  5},
01599   {10,  9,  8,  7,  6},
01600   {11, 12, 13, 14, 15},
01601   {20, 19, 18, 17, 16},
01602   {21, 22, 23, 24, 25}
01603 };
01604 

Generated on Tue Jun 9 17:32:43 2009 for CMSSW by  doxygen 1.5.4