CMS 3D CMS Logo

EEPedestalClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEPedestalClient.cc
00003  *
00004  * $Date: 2008/10/08 10:27:50 $
00005  * $Revision: 1.84 $
00006  * \author G. Della Ricca
00007  * \author F. Cossutti
00008  *
00009 */
00010 
00011 #include <memory>
00012 #include <iostream>
00013 #include <fstream>
00014 #include <iomanip>
00015 #include <math.h>
00016 
00017 #include "TCanvas.h"
00018 #include "TStyle.h"
00019 #include "TGraph.h"
00020 #include "TLine.h"
00021 
00022 #include "DQMServices/Core/interface/DQMStore.h"
00023 
00024 #include "OnlineDB/EcalCondDB/interface/MonPedestalsDat.h"
00025 #include "OnlineDB/EcalCondDB/interface/MonPNPedDat.h"
00026 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00027 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00028 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00029 
00030 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00031 
00032 #include "CondTools/Ecal/interface/EcalErrorDictionary.h"
00033 
00034 #include "DQM/EcalCommon/interface/EcalErrorMask.h"
00035 #include "DQM/EcalCommon/interface/UtilsClient.h"
00036 #include "DQM/EcalCommon/interface/LogicID.h"
00037 #include "DQM/EcalCommon/interface/Numbers.h"
00038 
00039 #include <DQM/EcalEndcapMonitorClient/interface/EEPedestalClient.h>
00040 
00041 using namespace cms;
00042 using namespace edm;
00043 using namespace std;
00044 
00045 EEPedestalClient::EEPedestalClient(const ParameterSet& ps) {
00046 
00047   // cloneME switch
00048   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00049 
00050   // verbose switch
00051   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00052 
00053   // debug switch
00054   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00055 
00056   // prefixME path
00057   prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00058 
00059   // enableCleanup_ switch
00060   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00061 
00062   // vector of selected Super Modules (Defaults to all 18).
00063   superModules_.reserve(18);
00064   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00065   superModules_ = ps.getUntrackedParameter<vector<int> >("superModules", superModules_);
00066 
00067   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00068 
00069     int ism = superModules_[i];
00070 
00071     h01_[ism-1] = 0;
00072     h02_[ism-1] = 0;
00073     h03_[ism-1] = 0;
00074 
00075     j01_[ism-1] = 0;
00076     j02_[ism-1] = 0;
00077     j03_[ism-1] = 0;
00078 
00079     k01_[ism-1] = 0;
00080     k02_[ism-1] = 0;
00081     k03_[ism-1] = 0;
00082 
00083     i01_[ism-1] = 0;
00084     i02_[ism-1] = 0;
00085 
00086   }
00087 
00088   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00089 
00090     int ism = superModules_[i];
00091 
00092     meg01_[ism-1] = 0;
00093     meg02_[ism-1] = 0;
00094     meg03_[ism-1] = 0;
00095 
00096     meg04_[ism-1] = 0;
00097     meg05_[ism-1] = 0;
00098 
00099     mep01_[ism-1] = 0;
00100     mep02_[ism-1] = 0;
00101     mep03_[ism-1] = 0;
00102 
00103     mer01_[ism-1] = 0;
00104     mer02_[ism-1] = 0;
00105     mer03_[ism-1] = 0;
00106 
00107     mer04_[ism-1] = 0;
00108     mer05_[ism-1] = 0;
00109 
00110     mes01_[ism-1] = 0;
00111     mes02_[ism-1] = 0;
00112     mes03_[ism-1] = 0;
00113 
00114     met01_[ism-1] = 0;
00115     met02_[ism-1] = 0;
00116     met03_[ism-1] = 0;
00117 
00118   }
00119 
00120   expectedMean_[0] = 200.0;
00121   expectedMean_[1] = 200.0;
00122   expectedMean_[2] = 200.0;
00123 
00124   discrepancyMean_[0] = 25.0;
00125   discrepancyMean_[1] = 25.0;
00126   discrepancyMean_[2] = 25.0;
00127 
00128   RMSThreshold_[0] = 1.0;
00129   RMSThreshold_[1] = 1.5;
00130   RMSThreshold_[2] = 2.5;
00131 
00132   RMSThresholdInner_[0] = 2.0;
00133   RMSThresholdInner_[1] = 2.5;
00134   RMSThresholdInner_[2] = 3.5;
00135 
00136   expectedMeanPn_[0] = 750.0;
00137   expectedMeanPn_[1] = 750.0;
00138 
00139   discrepancyMeanPn_[0] = 100.0;
00140   discrepancyMeanPn_[1] = 100.0;
00141 
00142   RMSThresholdPn_[0] = 1.0;
00143   RMSThresholdPn_[1] = 3.0;
00144 
00145 }
00146 
00147 EEPedestalClient::~EEPedestalClient() {
00148 
00149 }
00150 
00151 void EEPedestalClient::beginJob(DQMStore* dqmStore) {
00152 
00153   dqmStore_ = dqmStore;
00154 
00155   if ( debug_ ) cout << "EEPedestalClient: beginJob" << endl;
00156 
00157   ievt_ = 0;
00158   jevt_ = 0;
00159 
00160 }
00161 
00162 void EEPedestalClient::beginRun(void) {
00163 
00164   if ( debug_ ) cout << "EEPedestalClient: beginRun" << endl;
00165 
00166   jevt_ = 0;
00167 
00168   this->setup();
00169 
00170 }
00171 
00172 void EEPedestalClient::endJob(void) {
00173 
00174   if ( debug_ ) cout << "EEPedestalClient: endJob, ievt = " << ievt_ << endl;
00175 
00176   this->cleanup();
00177 
00178 }
00179 
00180 void EEPedestalClient::endRun(void) {
00181 
00182   if ( debug_ ) cout << "EEPedestalClient: endRun, jevt = " << jevt_ << endl;
00183 
00184   this->cleanup();
00185 
00186 }
00187 
00188 void EEPedestalClient::setup(void) {
00189 
00190   char histo[200];
00191 
00192   dqmStore_->setCurrentFolder( prefixME_ + "/EEPedestalClient" );
00193 
00194   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00195 
00196     int ism = superModules_[i];
00197 
00198     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00199     sprintf(histo, "EEPT pedestal quality G01 %s", Numbers::sEE(ism).c_str());
00200     meg01_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00201     meg01_[ism-1]->setAxisTitle("jx", 1);
00202     meg01_[ism-1]->setAxisTitle("jy", 2);
00203     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00204     sprintf(histo, "EEPT pedestal quality G06 %s", Numbers::sEE(ism).c_str());
00205     meg02_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00206     meg02_[ism-1]->setAxisTitle("jx", 1);
00207     meg02_[ism-1]->setAxisTitle("jy", 2);
00208     if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00209     sprintf(histo, "EEPT pedestal quality G12 %s", Numbers::sEE(ism).c_str());
00210     meg03_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00211     meg03_[ism-1]->setAxisTitle("jx", 1);
00212     meg03_[ism-1]->setAxisTitle("jy", 2);
00213 
00214     if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00215     sprintf(histo, "EEPT pedestal quality PNs G01 %s", Numbers::sEE(ism).c_str());
00216     meg04_[ism-1] = dqmStore_->book2D(histo, histo, 10, 0., 10., 1, 0., 5.);
00217     meg04_[ism-1]->setAxisTitle("pseudo-strip", 1);
00218     meg04_[ism-1]->setAxisTitle("channel", 2);
00219     if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00220     sprintf(histo, "EEPT pedestal quality PNs G16 %s", Numbers::sEE(ism).c_str());
00221     meg05_[ism-1] = dqmStore_->book2D(histo, histo, 10, 0., 10., 1, 0., 5.);
00222     meg05_[ism-1]->setAxisTitle("pseudo-strip", 1);
00223     meg05_[ism-1]->setAxisTitle("channel", 2);
00224 
00225     if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00226     sprintf(histo, "EEPT pedestal mean G01 %s", Numbers::sEE(ism).c_str());
00227     mep01_[ism-1] = dqmStore_->book1D(histo, histo, 100, 150., 250.);
00228     mep01_[ism-1]->setAxisTitle("mean", 1);
00229     if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
00230     sprintf(histo, "EEPT pedestal mean G06 %s", Numbers::sEE(ism).c_str());
00231     mep02_[ism-1] = dqmStore_->book1D(histo, histo, 100, 150., 250.);
00232     mep02_[ism-1]->setAxisTitle("mean", 1);
00233     if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
00234     sprintf(histo, "EEPT pedestal mean G12 %s", Numbers::sEE(ism).c_str());
00235     mep03_[ism-1] = dqmStore_->book1D(histo, histo, 100, 150., 250.);
00236     mep03_[ism-1]->setAxisTitle("mean", 1);
00237 
00238     if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00239     sprintf(histo, "EEPT pedestal rms G01 %s", Numbers::sEE(ism).c_str());
00240     mer01_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00241     mer01_[ism-1]->setAxisTitle("rms", 1);
00242     if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
00243     sprintf(histo, "EEPT pedestal rms G06 %s", Numbers::sEE(ism).c_str());
00244     mer02_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00245     mer02_[ism-1]->setAxisTitle("rms", 1);
00246     if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
00247     sprintf(histo, "EEPT pedestal rms G12 %s", Numbers::sEE(ism).c_str());
00248     mer03_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00249     mer03_[ism-1]->setAxisTitle("rms", 1);
00250 
00251     if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
00252     sprintf(histo, "EEPDT PNs pedestal rms %s G01", Numbers::sEE(ism).c_str());
00253     mer04_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00254     mer04_[ism-1]->setAxisTitle("rms", 1);
00255     if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
00256     sprintf(histo, "EEPDT PNs pedestal rms %s G16", Numbers::sEE(ism).c_str());
00257     mer05_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00258     mer05_[ism-1]->setAxisTitle("rms", 1);
00259 
00260     if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
00261     sprintf(histo, "EEPT pedestal 3sum G01 %s", Numbers::sEE(ism).c_str());
00262     mes01_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00263     mes01_[ism-1]->setAxisTitle("jx", 1);
00264     mes01_[ism-1]->setAxisTitle("jy", 2);
00265     if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
00266     sprintf(histo, "EEPT pedestal 3sum G06 %s", Numbers::sEE(ism).c_str());
00267     mes02_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00268     mes02_[ism-1]->setAxisTitle("jx", 1);
00269     mes02_[ism-1]->setAxisTitle("jy", 2);
00270     if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
00271     sprintf(histo, "EEPT pedestal 3sum G12 %s", Numbers::sEE(ism).c_str());
00272     mes03_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00273     mes03_[ism-1]->setAxisTitle("jx", 1);
00274     mes03_[ism-1]->setAxisTitle("jy", 2);
00275 
00276     if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00277     sprintf(histo, "EEPT pedestal 5sum G01 %s", Numbers::sEE(ism).c_str());
00278     met01_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00279     met01_[ism-1]->setAxisTitle("jx", 1);
00280     met01_[ism-1]->setAxisTitle("jy", 2);
00281     if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00282     sprintf(histo, "EEPT pedestal 5sum G06 %s", Numbers::sEE(ism).c_str());
00283     met02_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00284     met02_[ism-1]->setAxisTitle("jx", 1);
00285     met02_[ism-1]->setAxisTitle("jy", 2);
00286     if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00287     sprintf(histo, "EEPT pedestal 5sum G12 %s", Numbers::sEE(ism).c_str());
00288     met03_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00289     met03_[ism-1]->setAxisTitle("jx", 1);
00290     met03_[ism-1]->setAxisTitle("jy", 2);
00291 
00292   }
00293 
00294   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00295 
00296     int ism = superModules_[i];
00297 
00298     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00299     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00300     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
00301 
00302     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
00303     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00304 
00305     for ( int ix = 1; ix <= 50; ix++ ) {
00306       for ( int iy = 1; iy <= 50; iy++ ) {
00307 
00308         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 6. );
00309         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 6. );
00310         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 6. );
00311 
00312         int jx = ix + Numbers::ix0EE(ism);
00313         int jy = iy + Numbers::iy0EE(ism);
00314 
00315         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00316 
00317         if ( Numbers::validEE(ism, jx, jy) ) {
00318           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2. );
00319           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 2. );
00320           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 2. );
00321         }
00322 
00323       }
00324     }
00325 
00326     for ( int i = 1; i <= 10; i++ ) {
00327 
00328         if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
00329         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00330 
00331     }
00332 
00333     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00334     if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
00335     if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
00336 
00337     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00338     if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
00339     if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
00340 
00341     if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
00342     if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
00343 
00344     if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
00345     if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
00346     if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
00347 
00348     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00349     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00350     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
00351 
00352     for ( int ix = 1; ix <= 50; ix++ ) {
00353       for ( int iy = 1; iy <= 50; iy++ ) {
00354 
00355         if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent( ix, iy, -999. );
00356         if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent( ix, iy, -999. );
00357         if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent( ix, iy, -999. );
00358 
00359         if ( met01_[ism-1] ) met01_[ism-1]->setBinContent( ix, iy, -999. );
00360         if ( met02_[ism-1] ) met02_[ism-1]->setBinContent( ix, iy, -999. );
00361         if ( met03_[ism-1] ) met03_[ism-1]->setBinContent( ix, iy, -999. );
00362 
00363       }
00364     }
00365 
00366   }
00367 
00368 }
00369 
00370 void EEPedestalClient::cleanup(void) {
00371 
00372   if ( ! enableCleanup_ ) return;
00373 
00374   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00375 
00376     int ism = superModules_[i];
00377 
00378     if ( cloneME_ ) {
00379       if ( h01_[ism-1] ) delete h01_[ism-1];
00380       if ( h02_[ism-1] ) delete h02_[ism-1];
00381       if ( h03_[ism-1] ) delete h03_[ism-1];
00382 
00383       if ( j01_[ism-1] ) delete j01_[ism-1];
00384       if ( j02_[ism-1] ) delete j02_[ism-1];
00385       if ( j03_[ism-1] ) delete j03_[ism-1];
00386 
00387       if ( k01_[ism-1] ) delete k01_[ism-1];
00388       if ( k02_[ism-1] ) delete k02_[ism-1];
00389       if ( k03_[ism-1] ) delete k03_[ism-1];
00390 
00391       if ( i01_[ism-1] ) delete i01_[ism-1];
00392       if ( i02_[ism-1] ) delete i02_[ism-1];
00393     }
00394 
00395     h01_[ism-1] = 0;
00396     h02_[ism-1] = 0;
00397     h03_[ism-1] = 0;
00398 
00399     j01_[ism-1] = 0;
00400     j02_[ism-1] = 0;
00401     j03_[ism-1] = 0;
00402 
00403     k01_[ism-1] = 0;
00404     k02_[ism-1] = 0;
00405     k03_[ism-1] = 0;
00406 
00407     i01_[ism-1] = 0;
00408     i02_[ism-1] = 0;
00409 
00410   }
00411 
00412   dqmStore_->setCurrentFolder( prefixME_ + "/EEPedestalClient" );
00413 
00414   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00415 
00416     int ism = superModules_[i];
00417 
00418     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00419     meg01_[ism-1] = 0;
00420     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00421     meg02_[ism-1] = 0;
00422     if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00423     meg03_[ism-1] = 0;
00424 
00425     if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00426     meg04_[ism-1] = 0;
00427     if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00428     meg05_[ism-1] = 0;
00429 
00430     if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00431     mep01_[ism-1] = 0;
00432     if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
00433     mep02_[ism-1] = 0;
00434     if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
00435     mep03_[ism-1] = 0;
00436 
00437     if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00438     mer01_[ism-1] = 0;
00439     if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
00440     mer02_[ism-1] = 0;
00441     if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
00442     mer03_[ism-1] = 0;
00443 
00444     if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
00445     mer04_[ism-1] = 0;
00446     if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
00447     mer05_[ism-1] = 0;
00448 
00449     if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
00450     mes01_[ism-1] = 0;
00451     if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
00452     mes02_[ism-1] = 0;
00453     if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
00454     mes03_[ism-1] = 0;
00455 
00456     if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00457     met01_[ism-1] = 0;
00458     if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00459     met02_[ism-1] = 0;
00460     if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00461     met03_[ism-1] = 0;
00462 
00463   }
00464 
00465 }
00466 
00467 bool EEPedestalClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status, bool flag) {
00468 
00469   status = true;
00470 
00471   if ( ! flag ) return false;
00472 
00473   EcalLogicID ecid;
00474 
00475   MonPedestalsDat p;
00476   map<EcalLogicID, MonPedestalsDat> dataset1;
00477 
00478   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00479 
00480     int ism = superModules_[i];
00481 
00482     if ( verbose_ ) {
00483       cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00484       cout << endl;
00485       UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
00486       UtilsClient::printBadChannels(meg02_[ism-1], h02_[ism-1]);
00487       UtilsClient::printBadChannels(meg03_[ism-1], h03_[ism-1]);
00488     }
00489 
00490     for ( int ix = 1; ix <= 50; ix++ ) {
00491       for ( int iy = 1; iy <= 50; iy++ ) {
00492 
00493         int jx = ix + Numbers::ix0EE(ism);
00494         int jy = iy + Numbers::iy0EE(ism);
00495 
00496         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00497 
00498         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00499 
00500         bool update01;
00501         bool update02;
00502         bool update03;
00503 
00504         float num01, num02, num03;
00505         float mean01, mean02, mean03;
00506         float rms01, rms02, rms03;
00507 
00508         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
00509         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
00510         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
00511 
00512         if ( update01 || update02 || update03 ) {
00513 
00514           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00515 
00516             if ( verbose_ ) {
00517               cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00518               cout << "G01 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01  << " " << mean01 << " " << rms01  << endl;
00519               cout << "G06 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num02  << " " << mean02 << " " << rms02  << endl;
00520               cout << "G12 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num03  << " " << mean03 << " " << rms03  << endl;
00521               cout << endl;
00522             }
00523 
00524           }
00525 
00526           p.setPedMeanG1(mean01);
00527           p.setPedRMSG1(rms01);
00528 
00529           p.setPedMeanG6(mean02);
00530           p.setPedRMSG6(rms02);
00531 
00532           p.setPedMeanG12(mean03);
00533           p.setPedRMSG12(rms03);
00534 
00535           if ( UtilsClient::getBinStatus(meg01_[ism-1], ix, iy) &&
00536                UtilsClient::getBinStatus(meg02_[ism-1], ix, iy) &&
00537                UtilsClient::getBinStatus(meg03_[ism-1], ix, iy) ) {
00538             p.setTaskStatus(true);
00539           } else {
00540             p.setTaskStatus(false);
00541           }
00542 
00543           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ix, iy) &&
00544                              UtilsClient::getBinQuality(meg02_[ism-1], ix, iy) &&
00545                              UtilsClient::getBinQuality(meg03_[ism-1], ix, iy);
00546 
00547           int ic = Numbers::indexEE(ism, jx, jy);
00548 
00549           if ( ic == -1 ) continue;
00550 
00551           if ( econn ) {
00552             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00553             dataset1[ecid] = p;
00554           }
00555 
00556         }
00557 
00558       }
00559     }
00560 
00561   }
00562 
00563   if ( econn ) {
00564     try {
00565       if ( verbose_ ) cout << "Inserting MonPedestalsDat ..." << endl;
00566       if ( dataset1.size() != 0 ) econn->insertDataArraySet(&dataset1, moniov);
00567       if ( verbose_ ) cout << "done." << endl;
00568     } catch (runtime_error &e) {
00569       cerr << e.what() << endl;
00570     }
00571   }
00572 
00573   if ( verbose_ ) cout << endl;
00574 
00575   MonPNPedDat pn;
00576   map<EcalLogicID, MonPNPedDat> dataset2;
00577 
00578   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00579 
00580     int ism = superModules_[i];
00581 
00582     if ( verbose_ ) {
00583       cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00584       cout << endl;
00585       UtilsClient::printBadChannels(meg04_[ism-1], i01_[ism-1]);
00586       UtilsClient::printBadChannels(meg05_[ism-1], i02_[ism-1]);
00587     }
00588 
00589     for ( int i = 1; i <= 10; i++ ) {
00590 
00591       bool update01;
00592       bool update02;
00593 
00594       float num01, num02;
00595       float mean01, mean02;
00596       float rms01, rms02;
00597 
00598       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
00599       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
00600 
00601       if ( update01 || update02 ) {
00602 
00603         if ( i == 1 ) {
00604 
00605           if ( verbose_ ) {
00606             cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << endl;
00607             cout << "PNs (" << i << ") G01 " << num01  << " " << mean01 << " " << rms01  << endl;
00608             cout << "PNs (" << i << ") G16 " << num01  << " " << mean01 << " " << rms01  << endl;
00609             cout << endl;
00610           }
00611 
00612         }
00613 
00614         pn.setPedMeanG1(mean01);
00615         pn.setPedRMSG1(rms01);
00616 
00617         pn.setPedMeanG16(mean02);
00618         pn.setPedRMSG16(rms02);
00619 
00620         if ( UtilsClient::getBinStatus(meg04_[ism-1], i, 1) &&
00621              UtilsClient::getBinStatus(meg05_[ism-1], i, 1) ) {
00622           pn.setTaskStatus(true);
00623         } else {
00624           pn.setTaskStatus(false);
00625         }
00626 
00627         status = status && UtilsClient::getBinQuality(meg04_[ism-1], i, 1) &&
00628                            UtilsClient::getBinQuality(meg05_[ism-1], i, 1);
00629 
00630         if ( econn ) {
00631           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
00632           dataset2[ecid] = pn;
00633         }
00634 
00635       }
00636 
00637     }
00638 
00639   }
00640 
00641   if ( econn ) {
00642     try {
00643       if ( verbose_ ) cout << "Inserting MonPNPedDat ..." << endl;
00644       if ( dataset2.size() != 0 ) econn->insertDataArraySet(&dataset2, moniov);
00645       if ( verbose_ ) cout << "done." << endl;
00646     } catch (runtime_error &e) {
00647       cerr << e.what() << endl;
00648     }
00649   }
00650 
00651   return true;
00652 
00653 }
00654 
00655 void EEPedestalClient::analyze(void) {
00656 
00657   ievt_++;
00658   jevt_++;
00659   if ( ievt_ % 10 == 0 ) {
00660     if ( debug_ ) cout << "EEPedestalClient: ievt/jevt = " << ievt_ << "/" << jevt_ << endl;
00661   }
00662 
00663   uint64_t bits01 = 0;
00664   bits01 |= EcalErrorDictionary::getMask("PEDESTAL_LOW_GAIN_MEAN_WARNING");
00665   bits01 |= EcalErrorDictionary::getMask("PEDESTAL_LOW_GAIN_RMS_WARNING");
00666   bits01 |= EcalErrorDictionary::getMask("PEDESTAL_LOW_GAIN_MEAN_ERROR");
00667   bits01 |= EcalErrorDictionary::getMask("PEDESTAL_LOW_GAIN_RMS_ERROR");
00668 
00669   uint64_t bits02 = 0;
00670   bits02 |= EcalErrorDictionary::getMask("PEDESTAL_MIDDLE_GAIN_MEAN_WARNING");
00671   bits02 |= EcalErrorDictionary::getMask("PEDESTAL_MIDDLE_GAIN_RMS_WARNING");
00672   bits02 |= EcalErrorDictionary::getMask("PEDESTAL_MIDDLE_GAIN_MEAN_ERROR");
00673   bits02 |= EcalErrorDictionary::getMask("PEDESTAL_MIDDLE_GAIN_RMS_ERROR");
00674 
00675   uint64_t bits03 = 0;
00676   bits03 |= EcalErrorDictionary::getMask("PEDESTAL_HIGH_GAIN_MEAN_WARNING");
00677   bits03 |= EcalErrorDictionary::getMask("PEDESTAL_HIGH_GAIN_RMS_WARNING");
00678   bits03 |= EcalErrorDictionary::getMask("PEDESTAL_HIGH_GAIN_MEAN_ERROR");
00679   bits03 |= EcalErrorDictionary::getMask("PEDESTAL_HIGH_GAIN_RMS_ERROR");
00680 
00681   map<EcalLogicID, RunCrystalErrorsDat> mask1;
00682   map<EcalLogicID, RunPNErrorsDat> mask2;
00683   map<EcalLogicID, RunTTErrorsDat> mask3;
00684 
00685   EcalErrorMask::fetchDataSet(&mask1);
00686   EcalErrorMask::fetchDataSet(&mask2);
00687   EcalErrorMask::fetchDataSet(&mask3);
00688 
00689   char histo[200];
00690 
00691   MonitorElement* me;
00692 
00693   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00694 
00695     int ism = superModules_[i];
00696 
00697     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain01/EEPT pedestal %s G01").c_str(), Numbers::sEE(ism).c_str());
00698     me = dqmStore_->get(histo);
00699     h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
00700 
00701     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain06/EEPT pedestal %s G06").c_str(), Numbers::sEE(ism).c_str());
00702     me = dqmStore_->get(histo);
00703     h02_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h02_[ism-1] );
00704 
00705     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain12/EEPT pedestal %s G12").c_str(), Numbers::sEE(ism).c_str());
00706     me = dqmStore_->get(histo);
00707     h03_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h03_[ism-1] );
00708 
00709     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain01/EEPT pedestal 3sum %s G01").c_str(), Numbers::sEE(ism).c_str());
00710     me = dqmStore_->get(histo);
00711     j01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, j01_[ism-1] );
00712 
00713     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain06/EEPT pedestal 3sum %s G06").c_str(), Numbers::sEE(ism).c_str());
00714     me = dqmStore_->get(histo);
00715     j02_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, j02_[ism-1] );
00716 
00717     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain12/EEPT pedestal 3sum %s G12").c_str(), Numbers::sEE(ism).c_str());
00718     me = dqmStore_->get(histo);
00719     j03_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, j03_[ism-1] );
00720 
00721     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain01/EEPT pedestal 5sum %s G01").c_str(), Numbers::sEE(ism).c_str());
00722     me = dqmStore_->get(histo);
00723     k01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, k01_[ism-1] );
00724 
00725     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain06/EEPT pedestal 5sum %s G06").c_str(), Numbers::sEE(ism).c_str());
00726     me = dqmStore_->get(histo);
00727     k02_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, k02_[ism-1] );
00728 
00729     sprintf(histo, (prefixME_ + "/EEPedestalTask/Gain12/EEPT pedestal 5sum %s G12").c_str(), Numbers::sEE(ism).c_str());
00730     me = dqmStore_->get(histo);
00731     k03_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, k03_[ism-1] );
00732 
00733     sprintf(histo, (prefixME_ + "/EEPedestalTask/PN/Gain01/EEPDT PNs pedestal %s G01").c_str(), Numbers::sEE(ism).c_str());
00734     me = dqmStore_->get(histo);
00735     i01_[ism-1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, i01_[ism-1] );
00736 
00737     sprintf(histo, (prefixME_ + "/EEPedestalTask/PN/Gain16/EEPDT PNs pedestal %s G16").c_str(), Numbers::sEE(ism).c_str());
00738     me = dqmStore_->get(histo);
00739     i02_[ism-1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, i02_[ism-1] );
00740 
00741     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00742     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00743     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
00744 
00745     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
00746     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00747 
00748     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00749     if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
00750     if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
00751 
00752     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00753     if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
00754     if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
00755 
00756     if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
00757     if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
00758 
00759     if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
00760     if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
00761     if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
00762 
00763     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00764     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00765     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
00766 
00767     for ( int ix = 1; ix <= 50; ix++ ) {
00768       for ( int iy = 1; iy <= 50; iy++ ) {
00769 
00770         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ix, iy, 6.);
00771         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ix, iy, 6.);
00772         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ix, iy, 6.);
00773 
00774         int jx = ix + Numbers::ix0EE(ism);
00775         int jy = iy + Numbers::iy0EE(ism);
00776 
00777         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00778 
00779         bool innerCrystals = fabs(jx-50) >= 5 && fabs(jx-50) <= 10 && fabs(jy-50) >= 5 && fabs(jy-50) <= 10; 
00780 
00781         if ( Numbers::validEE(ism, jx, jy) ) {
00782           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ix, iy, 2.);
00783           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ix, iy, 2.);
00784           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ix, iy, 2.);
00785         }
00786 
00787         bool update01;
00788         bool update02;
00789         bool update03;
00790 
00791         float num01, num02, num03;
00792         float mean01, mean02, mean03;
00793         float rms01, rms02, rms03;
00794 
00795         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
00796         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
00797         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
00798 
00799         if ( update01 ) {
00800 
00801           float val;
00802 
00803           val = 1.;
00804           if ( fabs(mean01 - expectedMean_[0]) > discrepancyMean_[0] )
00805             val = 0.;
00806           if ( (!innerCrystals && rms01 > RMSThreshold_[0]) ||
00807                (innerCrystals && rms01 > RMSThresholdInner_[0]) )
00808             val = 0.;
00809           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ix, iy, val);
00810 
00811           if ( mep01_[ism-1] ) mep01_[ism-1]->Fill(mean01);
00812           if ( mer01_[ism-1] ) mer01_[ism-1]->Fill(rms01);
00813 
00814         }
00815 
00816         if ( update02 ) {
00817 
00818           float val;
00819 
00820           val = 1.;
00821           if ( fabs(mean02 - expectedMean_[1]) > discrepancyMean_[1] )
00822             val = 0.;
00823           if ( (!innerCrystals && rms02 > RMSThreshold_[1]) ||
00824                (innerCrystals && rms02 > RMSThresholdInner_[1]) )
00825             val = 0.;
00826           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ix, iy, val);
00827 
00828           if ( mep02_[ism-1] ) mep02_[ism-1]->Fill(mean02);
00829           if ( mer02_[ism-1] ) mer02_[ism-1]->Fill(rms02);
00830 
00831         }
00832 
00833         if ( update03 ) {
00834 
00835           float val;
00836 
00837           val = 1.;
00838           if ( fabs(mean03 - expectedMean_[2]) > discrepancyMean_[2] )
00839             val = 0.;
00840           if ( (!innerCrystals && rms03 > RMSThreshold_[2]) ||
00841                (innerCrystals && rms03 > RMSThresholdInner_[2]) )
00842             val = 0.;
00843 
00844           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ix, iy, val);
00845 
00846           if ( mep03_[ism-1] ) mep03_[ism-1]->Fill(mean03);
00847           if ( mer03_[ism-1] ) mer03_[ism-1]->Fill(rms03);
00848 
00849         }
00850 
00851         // masking
00852 
00853         if ( mask1.size() != 0 ) {
00854           map<EcalLogicID, RunCrystalErrorsDat>::const_iterator m;
00855           for (m = mask1.begin(); m != mask1.end(); m++) {
00856 
00857             int jx = ix + Numbers::ix0EE(ism);
00858             int jy = iy + Numbers::iy0EE(ism);
00859 
00860             if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00861 
00862             if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00863 
00864             int ic = Numbers::indexEE(ism, jx, jy);
00865 
00866             if ( ic == -1 ) continue;
00867 
00868             EcalLogicID ecid = m->first;
00869 
00870             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic).getLogicID() ) {
00871               if ( (m->second).getErrorBits() & bits01 ) {
00872                 UtilsClient::maskBinContent( meg01_[ism-1], ix, iy );
00873               }
00874               if ( (m->second).getErrorBits() & bits02 ) {
00875                 UtilsClient::maskBinContent( meg02_[ism-1], ix, iy );
00876               }
00877               if ( (m->second).getErrorBits() & bits03 ) {
00878                 UtilsClient::maskBinContent( meg03_[ism-1], ix, iy );
00879               }
00880             }
00881 
00882           }
00883         }
00884 
00885         // TT masking
00886 
00887         if ( mask3.size() != 0 ) {
00888           map<EcalLogicID, RunTTErrorsDat>::const_iterator m;
00889           for (m = mask3.begin(); m != mask3.end(); m++) {
00890 
00891             EcalLogicID ecid = m->first;
00892 
00893             int itt = Numbers::iTT(ism, EcalEndcap, ix, iy);
00894 
00895             if ( ecid.getLogicID() == LogicID::getEcalLogicID("EE_readout_tower", Numbers::iSM(ism, EcalEndcap), itt).getLogicID() ) {
00896               if ( (m->second).getErrorBits() & bits01 ) {
00897                 UtilsClient::maskBinContent( meg01_[ism-1], ix, iy );
00898               }
00899               if ( (m->second).getErrorBits() & bits02 ) {
00900                 UtilsClient::maskBinContent( meg02_[ism-1], ix, iy );
00901               }
00902               if ( (m->second).getErrorBits() & bits03 ) {
00903                 UtilsClient::maskBinContent( meg03_[ism-1], ix, iy );
00904               }
00905             }
00906 
00907           }
00908         }
00909 
00910       }
00911     }
00912 
00913     // PN diodes
00914 
00915     for ( int i = 1; i <= 10; i++ ) {
00916 
00917       if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
00918       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00919 
00920       bool update01;
00921       bool update02;
00922 
00923       float num01, num02;
00924       float mean01, mean02;
00925       float rms01, rms02;
00926 
00927       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
00928       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
00929 
00930       // filling projections
00931       if ( mer04_[ism-1] )  mer04_[ism-1]->Fill(rms01);
00932       if ( mer05_[ism-1] )  mer05_[ism-1]->Fill(rms02);
00933 
00934       if ( update01 ) {
00935 
00936         float val;
00937 
00938         val = 1.;
00939         if ( mean01 < (expectedMeanPn_[0] - discrepancyMeanPn_[0])
00940              || (expectedMeanPn_[0] + discrepancyMeanPn_[0]) <  mean01)
00941            val = 0.;
00942         if ( rms01 >  RMSThresholdPn_[0])
00943           val = 0.;
00944 
00945         if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent(i, 1, val);
00946 
00947       }
00948 
00949       if ( update02 ) {
00950 
00951         float val;
00952 
00953         val = 1.;
00954         //        if ( mean02 < pedestalThresholdPn_ )
00955          if ( mean02 < (expectedMeanPn_[1] - discrepancyMeanPn_[1])
00956               || (expectedMeanPn_[1] + discrepancyMeanPn_[1]) <  mean02)
00957            val = 0.;
00958          if ( rms02 >  RMSThresholdPn_[1])
00959            val = 0.;
00960 
00961         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent(i, 1, val);
00962       }
00963 
00964       // masking
00965 
00966       if ( mask2.size() != 0 ) {
00967         map<EcalLogicID, RunPNErrorsDat>::const_iterator m;
00968         for (m = mask2.begin(); m != mask2.end(); m++) {
00969 
00970           EcalLogicID ecid = m->first;
00971 
00972           if ( ecid.getLogicID() == LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1).getLogicID() ) {
00973             if ( (m->second).getErrorBits() & bits01 ) {
00974               UtilsClient::maskBinContent( meg04_[ism-1], i, 1 );
00975             }
00976             if ( (m->second).getErrorBits() & bits03 ) {
00977               UtilsClient::maskBinContent( meg05_[ism-1], i, 1 );
00978             }
00979           }
00980 
00981         }
00982       }
00983 
00984     }
00985 
00986     for ( int ix = 1; ix <= 50; ix++ ) {
00987       for ( int iy = 1; iy <= 50; iy++ ) {
00988 
00989         float x3val01;
00990         float x3val02;
00991         float x3val03;
00992 
00993         float y3val01;
00994         float y3val02;
00995         float y3val03;
00996 
00997         float z3val01;
00998         float z3val02;
00999         float z3val03;
01000 
01001         float x5val01;
01002         float x5val02;
01003         float x5val03;
01004 
01005         float y5val01;
01006         float y5val02;
01007         float y5val03;
01008 
01009         float z5val01;
01010         float z5val02;
01011         float z5val03;
01012 
01013         if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ix, iy, -999.);
01014         if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ix, iy, -999.);
01015         if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ix, iy, -999.);
01016 
01017         if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ix, iy, -999.);
01018         if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ix, iy, -999.);
01019         if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ix, iy, -999.);
01020 
01021         int jx = ix + Numbers::ix0EE(ism);
01022         int jy = iy + Numbers::iy0EE(ism);
01023 
01024         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
01025 
01026         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
01027 
01028         if ( ix >= 2 && ix <= 49 && iy >= 2 && iy <= 49 ) {
01029 
01030           x3val01 = 0.;
01031           x3val02 = 0.;
01032           x3val03 = 0.;
01033           for ( int i = -1; i <= +1; i++ ) {
01034             for ( int j = -1; j <= +1; j++ ) {
01035 
01036               if ( h01_[ism-1] ) x3val01 = x3val01 + h01_[ism-1]->GetBinError(ix+i, iy+j) *
01037                                                      h01_[ism-1]->GetBinError(ix+i, iy+j);
01038 
01039               if ( h02_[ism-1] ) x3val02 = x3val02 + h02_[ism-1]->GetBinError(ix+i, iy+j) *
01040                                                      h02_[ism-1]->GetBinError(ix+i, iy+j);
01041 
01042               if ( h03_[ism-1] ) x3val03 = x3val03 + h03_[ism-1]->GetBinError(ix+i, iy+j) *
01043                                                      h03_[ism-1]->GetBinError(ix+i, iy+j);
01044 
01045             }
01046           }
01047           x3val01 = x3val01 / (9.*9.);
01048           x3val02 = x3val02 / (9.*9.);
01049           x3val03 = x3val03 / (9.*9.);
01050 
01051           y3val01 = 0.;
01052           if ( j01_[ism-1] ) y3val01 = j01_[ism-1]->GetBinError(ix, iy) *
01053                                        j01_[ism-1]->GetBinError(ix, iy);
01054 
01055           y3val02 = 0.;
01056           if ( j02_[ism-1] ) y3val02 = j02_[ism-1]->GetBinError(ix, iy) *
01057                                        j02_[ism-1]->GetBinError(ix, iy);
01058 
01059           y3val03 = 0.;
01060           if ( j03_[ism-1] ) y3val03 = j03_[ism-1]->GetBinError(ix, iy) *
01061                                        j03_[ism-1]->GetBinError(ix, iy);
01062 
01063           z3val01 = -999.;
01064           if ( x3val01 != 0 && y3val01 != 0 ) z3val01 = sqrt(fabs(x3val01 - y3val01));
01065           if ( (x3val01 - y3val01) < 0 ) z3val01 = -z3val01;
01066 
01067           if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ix, iy, z3val01);
01068 
01069           z3val02 = -999.;
01070           if ( x3val02 != 0 && y3val02 != 0 ) z3val02 = sqrt(fabs(x3val02 - y3val02));
01071           if ( (x3val02 - y3val02) < 0 ) z3val02 = -z3val02;
01072 
01073           if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ix, iy, z3val02);
01074 
01075           z3val03 = -999.;
01076           if ( x3val03 != 0 && y3val03 != 0 ) z3val03 = sqrt(fabs(x3val03 - y3val03));
01077           if ( (x3val03 - y3val03) < 0 ) z3val03 = -z3val03;
01078 
01079           if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ix, iy, z3val03);
01080 
01081         }
01082 
01083         if ( ix >= 3 && ix <= 48 && iy >= 3 && iy <= 48 ) {
01084 
01085           x5val01 = 0.;
01086           x5val02 = 0.;
01087           x5val03 = 0.;
01088           for ( int i = -2; i <= +2; i++ ) {
01089             for ( int j = -2; j <= +2; j++ ) {
01090 
01091               if ( h01_[ism-1] ) x5val01 = x5val01 + h01_[ism-1]->GetBinError(ix+i, iy+j) *
01092                                                      h01_[ism-1]->GetBinError(ix+i, iy+j);
01093 
01094               if ( h02_[ism-1] ) x5val02 = x5val02 + h02_[ism-1]->GetBinError(ix+i, iy+j) *
01095                                                      h02_[ism-1]->GetBinError(ix+i, iy+j);
01096 
01097               if ( h03_[ism-1] ) x5val03 = x5val03 + h03_[ism-1]->GetBinError(ix+i, iy+j) *
01098                                                      h03_[ism-1]->GetBinError(ix+i, iy+j);
01099 
01100             }
01101           }
01102           x5val01 = x5val01 / (25.*25.);
01103           x5val02 = x5val02 / (25.*25.);
01104           x5val03 = x5val03 / (25.*25.);
01105 
01106           y5val01 = 0.;
01107           if ( k01_[ism-1] ) y5val01 = k01_[ism-1]->GetBinError(ix, iy) *
01108                                        k01_[ism-1]->GetBinError(ix, iy);
01109 
01110           y5val02 = 0.;
01111           if ( k02_[ism-1] ) y5val02 = k02_[ism-1]->GetBinError(ix, iy) *
01112                                        k02_[ism-1]->GetBinError(ix, iy);
01113 
01114           y5val03 = 0.;
01115           if ( k03_[ism-1] ) y5val03 = k03_[ism-1]->GetBinError(ix, iy) *
01116                                        k03_[ism-1]->GetBinError(ix, iy);
01117 
01118           z5val01 = -999.;
01119           if ( x5val01 != 0 && y5val01 != 0 ) z5val01 = sqrt(fabs(x5val01 - y5val01));
01120           if ( (x5val01 - y5val01) < 0 ) z5val01 = -z5val01;
01121 
01122           if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ix, iy, z5val01);
01123 
01124           z5val02 = -999.;
01125           if ( x5val02 != 0 && y5val02 != 0 ) z5val02 = sqrt(fabs(x5val02 - y5val02));
01126           if ( (x5val02 - y5val02) < 0 ) z5val02 = -z5val02;
01127 
01128           if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ix, iy, z5val02);
01129 
01130           z5val03 = -999.;
01131           if ( x5val03 != 0 && y5val03 != 0 ) z5val03 = sqrt(fabs(x5val03 - y5val03));
01132           if ( (x5val03 - y5val03) < 0 ) z5val03 = -z5val03;
01133 
01134           if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ix, iy, z5val03);
01135 
01136         }
01137 
01138       }
01139     }
01140 
01141   }
01142 
01143 }
01144 
01145 void EEPedestalClient::softReset(bool flag) {
01146 
01147 }
01148 
01149 void EEPedestalClient::htmlOutput(int run, string& htmlDir, string& htmlName) {
01150 
01151   if ( verbose_ ) cout << "Preparing EEPedestalClient html output ..." << endl;
01152 
01153   ofstream htmlFile;
01154 
01155   htmlFile.open((htmlDir + htmlName).c_str());
01156 
01157   // html page header
01158   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
01159   htmlFile << "<html>  " << endl;
01160   htmlFile << "<head>  " << endl;
01161   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
01162   htmlFile << " https-equiv=\"content-type\">  " << endl;
01163   htmlFile << "  <title>Monitor:PedestalTask output</title> " << endl;
01164   htmlFile << "</head>  " << endl;
01165   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
01166   htmlFile << "<body>  " << endl;
01167   //htmlFile << "<br>  " << endl;
01168   htmlFile << "<a name=""top""></a>" << endl;
01169   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
01170   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
01171   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << run << "</span></h2>" << endl;
01172   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
01173   htmlFile << " style=\"color: rgb(0, 0, 153);\">PEDESTAL</span></h2> " << endl;
01174   htmlFile << "<hr>" << endl;
01175   htmlFile << "<table border=1><tr><td bgcolor=red>channel has problems in this task</td>" << endl;
01176   htmlFile << "<td bgcolor=lime>channel has NO problems</td>" << endl;
01177   htmlFile << "<td bgcolor=yellow>channel is missing</td></table>" << endl;
01178   htmlFile << "<br>" << endl;
01179   htmlFile << "<table border=1>" << std::endl;
01180   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
01181     htmlFile << "<td bgcolor=white><a href=""#"
01182              << Numbers::sEE(superModules_[i]) << ">"
01183              << setfill( '0' ) << setw(2) << superModules_[i] << "</a></td>";
01184   }
01185   htmlFile << std::endl << "</table>" << std::endl;
01186 
01187   // Produce the plots to be shown as .png files from existing histograms
01188 
01189   const int csize = 250;
01190 
01191   const double histMax = 1.e15;
01192 
01193   int pCol3[7] = { 301, 302, 303, 304, 305, 306, 307 };
01194 
01195   int pCol4[10];
01196   for ( int i = 0; i < 10; i++ ) pCol4[i] = 401+i;
01197 
01198   TH2S labelGrid("labelGrid","label grid", 100, -2., 98., 100, -2., 98.);
01199   for ( short j=0; j<400; j++ ) {
01200     int x = 5*(1 + j%20);
01201     int y = 5*(1 + j/20);
01202     labelGrid.SetBinContent(x, y, Numbers::inTowersEE[j]);
01203   }
01204   labelGrid.SetMarkerSize(1);
01205   labelGrid.SetMinimum(0.1);
01206 
01207   TH2C dummy1( "dummy1", "dummy1 for sm mem", 10, 0, 10, 5, 0, 5 );
01208   for ( short i=0; i<2; i++ ) {
01209     int a = 2 + i*5;
01210     int b = 2;
01211     dummy1.Fill( a, b, i+1+68 );
01212   }
01213   dummy1.SetMarkerSize(2);
01214   dummy1.SetMinimum(0.1);
01215 
01216   string imgNameQual[3], imgNameMean[3], imgNameRMS[3], imgName3Sum[3], imgName5Sum[3], imgNameMEPnQual[2], imgNameMEPnPed[2],imgNameMEPnPedRms[2], imgName, meName;
01217 
01218   TCanvas* cQual = new TCanvas("cQual", "Temp", 2*csize, 2*csize);
01219   TCanvas* cQualPN = new TCanvas("cQualPN", "Temp", 2*csize, csize);
01220   TCanvas* cMean = new TCanvas("cMean", "Temp", csize, csize);
01221   TCanvas* cRMS = new TCanvas("cRMS", "Temp", csize, csize);
01222   TCanvas* c3Sum = new TCanvas("c3Sum", "Temp", 2*csize, 2*csize);
01223   TCanvas* c5Sum = new TCanvas("c5Sum", "Temp", 2*csize, 2*csize);
01224   TCanvas* cPed = new TCanvas("cPed", "Temp", csize, csize);
01225 
01226   TH2F* obj2f;
01227   TH1F* obj1f;
01228   TProfile* objp;
01229 
01230   // Loop on endcap sectors
01231 
01232   for ( unsigned int i=0; i<superModules_.size(); i ++ ) {
01233 
01234     int ism = superModules_[i];
01235 
01236     // Loop on gains
01237 
01238     for ( int iCanvas = 1 ; iCanvas <= 3 ; iCanvas++ ) {
01239 
01240       // Quality plots
01241 
01242       imgNameQual[iCanvas-1] = "";
01243 
01244       obj2f = 0;
01245       switch ( iCanvas ) {
01246         case 1:
01247           obj2f = UtilsClient::getHisto<TH2F*>( meg01_[ism-1] );
01248           break;
01249         case 2:
01250           obj2f = UtilsClient::getHisto<TH2F*>( meg02_[ism-1] );
01251           break;
01252         case 3:
01253           obj2f = UtilsClient::getHisto<TH2F*>( meg03_[ism-1] );
01254           break;
01255         default:
01256           break;
01257       }
01258 
01259       if ( obj2f ) {
01260 
01261         meName = obj2f->GetName();
01262 
01263         replace(meName.begin(), meName.end(), ' ', '_');
01264         imgNameQual[iCanvas-1] = meName + ".png";
01265         imgName = htmlDir + imgNameQual[iCanvas-1];
01266 
01267         cQual->cd();
01268         gStyle->SetOptStat(" ");
01269         gStyle->SetPalette(7, pCol3);
01270         cQual->SetGridx();
01271         cQual->SetGridy();
01272         obj2f->GetXaxis()->SetLabelSize(0.02);
01273         obj2f->GetXaxis()->SetTitleSize(0.02);
01274         obj2f->GetYaxis()->SetLabelSize(0.02);
01275         obj2f->GetYaxis()->SetTitleSize(0.02);
01276         obj2f->SetMinimum(-0.00000001);
01277         obj2f->SetMaximum(7.0);
01278         obj2f->Draw("col");
01279         int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
01280         int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
01281         int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
01282         int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
01283         labelGrid.GetXaxis()->SetRange(x1, x2);
01284         labelGrid.GetYaxis()->SetRange(y1, y2);
01285         labelGrid.Draw("text,same");
01286         cQual->SetBit(TGraph::kClipFrame);
01287         TLine l;
01288         l.SetLineWidth(1);
01289         for ( int i=0; i<201; i=i+1) {
01290           if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
01291             l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
01292           }
01293         }
01294         cQual->Update();
01295         cQual->SaveAs(imgName.c_str());
01296 
01297       }
01298 
01299       // Mean distributions
01300 
01301       imgNameMean[iCanvas-1] = "";
01302 
01303       obj1f = 0;
01304       switch ( iCanvas ) {
01305         case 1:
01306           obj1f = UtilsClient::getHisto<TH1F*>( mep01_[ism-1] );
01307           break;
01308         case 2:
01309           obj1f = UtilsClient::getHisto<TH1F*>( mep02_[ism-1] );
01310           break;
01311         case 3:
01312           obj1f = UtilsClient::getHisto<TH1F*>( mep03_[ism-1] );
01313           break;
01314         default:
01315             break;
01316       }
01317 
01318       if ( obj1f ) {
01319 
01320         meName = obj1f->GetName();
01321 
01322         replace(meName.begin(), meName.end(), ' ', '_');
01323         imgNameMean[iCanvas-1] = meName + ".png";
01324         imgName = htmlDir + imgNameMean[iCanvas-1];
01325 
01326         cMean->cd();
01327         gStyle->SetOptStat("euomr");
01328         obj1f->SetStats(kTRUE);
01329         if ( obj1f->GetMaximum(histMax) > 0. ) {
01330           gPad->SetLogy(kTRUE);
01331         } else {
01332           gPad->SetLogy(kFALSE);
01333         }
01334         obj1f->Draw();
01335         cMean->Update();
01336         cMean->SaveAs(imgName.c_str());
01337         gPad->SetLogy(kFALSE);
01338 
01339       }
01340 
01341       // RMS distributions
01342 
01343       imgNameRMS[iCanvas-1] = "";
01344 
01345       obj1f = 0;
01346       switch ( iCanvas ) {
01347         case 1:
01348           obj1f = UtilsClient::getHisto<TH1F*>( mer01_[ism-1] );
01349           break;
01350         case 2:
01351           obj1f = UtilsClient::getHisto<TH1F*>( mer02_[ism-1] );
01352           break;
01353         case 3:
01354           obj1f = UtilsClient::getHisto<TH1F*>( mer03_[ism-1] );
01355           break;
01356         default:
01357           break;
01358       }
01359 
01360       if ( obj1f ) {
01361 
01362         meName = obj1f->GetName();
01363 
01364         replace(meName.begin(), meName.end(), ' ', '_');
01365         imgNameRMS[iCanvas-1] = meName + ".png";
01366         imgName = htmlDir + imgNameRMS[iCanvas-1];
01367 
01368         cRMS->cd();
01369         gStyle->SetOptStat("euomr");
01370         obj1f->SetStats(kTRUE);
01371         if ( obj1f->GetMaximum(histMax) > 0. ) {
01372           gPad->SetLogy(kTRUE);
01373         } else {
01374           gPad->SetLogy(kFALSE);
01375         }
01376         obj1f->Draw();
01377         cRMS->Update();
01378         cRMS->SaveAs(imgName.c_str());
01379         gPad->SetLogy(kFALSE);
01380 
01381       }
01382 
01383       // 3Sum distributions
01384 
01385       imgName3Sum[iCanvas-1] = "";
01386 
01387       obj2f = 0;
01388       switch ( iCanvas ) {
01389         case 1:
01390           obj2f = UtilsClient::getHisto<TH2F*>( mes01_[ism-1] );
01391           break;
01392         case 2:
01393           obj2f = UtilsClient::getHisto<TH2F*>( mes02_[ism-1] );
01394           break;
01395         case 3:
01396           obj2f = UtilsClient::getHisto<TH2F*>( mes03_[ism-1] );
01397           break;
01398         default:
01399           break;
01400       }
01401 
01402       if ( obj2f ) {
01403 
01404         meName = obj2f->GetName();
01405 
01406         replace(meName.begin(), meName.end(), ' ', '_');
01407         imgName3Sum[iCanvas-1] = meName + ".png";
01408         imgName = htmlDir + imgName3Sum[iCanvas-1];
01409 
01410         c3Sum->cd();
01411         gStyle->SetOptStat(" ");
01412         gStyle->SetPalette(10, pCol4);
01413         c3Sum->SetGridx();
01414         c3Sum->SetGridy();
01415         obj2f->GetXaxis()->SetLabelSize(0.02);
01416         obj2f->GetXaxis()->SetTitleSize(0.02);
01417         obj2f->GetYaxis()->SetLabelSize(0.02);
01418         obj2f->GetYaxis()->SetTitleSize(0.02);
01419         obj2f->GetZaxis()->SetLabelSize(0.02);
01420         obj2f->SetMinimum(-0.5);
01421         obj2f->SetMaximum(+0.5);
01422         obj2f->Draw("colz");
01423         int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
01424         int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
01425         int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
01426         int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
01427         labelGrid.GetXaxis()->SetRange(x1, x2);
01428         labelGrid.GetYaxis()->SetRange(y1, y2);
01429         labelGrid.Draw("text,same");
01430         c3Sum->SetBit(TGraph::kClipFrame);
01431         TLine l;
01432         l.SetLineWidth(1);
01433         for ( int i=0; i<201; i=i+1) {
01434           if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
01435             l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
01436           }
01437         }
01438         c3Sum->Update();
01439         c3Sum->SaveAs(imgName.c_str());
01440 
01441       }
01442 
01443       // 5Sum distributions
01444 
01445       imgName5Sum[iCanvas-1] = "";
01446 
01447       obj2f = 0;
01448       switch ( iCanvas ) {
01449         case 1:
01450           obj2f = UtilsClient::getHisto<TH2F*>( met01_[ism-1] );
01451           break;
01452         case 2:
01453           obj2f = UtilsClient::getHisto<TH2F*>( met02_[ism-1] );
01454           break;
01455         case 3:
01456           obj2f = UtilsClient::getHisto<TH2F*>( met03_[ism-1] );
01457           break;
01458         default:
01459           break;
01460       }
01461 
01462       if ( obj2f ) {
01463 
01464         meName = obj2f->GetName();
01465 
01466         replace(meName.begin(), meName.end(), ' ', '_');
01467         imgName5Sum[iCanvas-1] = meName + ".png";
01468         imgName = htmlDir + imgName5Sum[iCanvas-1];
01469 
01470         c5Sum->cd();
01471         gStyle->SetOptStat(" ");
01472         gStyle->SetPalette(10, pCol4);
01473         c5Sum->SetGridx();
01474         c5Sum->SetGridy();
01475         obj2f->GetXaxis()->SetLabelSize(0.02);
01476         obj2f->GetXaxis()->SetTitleSize(0.02);
01477         obj2f->GetYaxis()->SetLabelSize(0.02);
01478         obj2f->GetYaxis()->SetTitleSize(0.02);
01479         obj2f->GetZaxis()->SetLabelSize(0.02);
01480         obj2f->SetMinimum(-0.5);
01481         obj2f->SetMaximum(+0.5);
01482         obj2f->Draw("colz");
01483         int x1 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+0.);
01484         int x2 = labelGrid.GetXaxis()->FindFixBin(Numbers::ix0EE(ism)+50.);
01485         int y1 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+0.);
01486         int y2 = labelGrid.GetYaxis()->FindFixBin(Numbers::iy0EE(ism)+50.);
01487         labelGrid.GetXaxis()->SetRange(x1, x2);
01488         labelGrid.GetYaxis()->SetRange(y1, y2);
01489         labelGrid.Draw("text,same");
01490         c5Sum->SetBit(TGraph::kClipFrame);
01491         TLine l;
01492         l.SetLineWidth(1);
01493         for ( int i=0; i<201; i=i+1) {
01494           if ( (Numbers::ixSectorsEE[i]!=0 || Numbers::iySectorsEE[i]!=0) && (Numbers::ixSectorsEE[i+1]!=0 || Numbers::iySectorsEE[i+1]!=0) ) {
01495             l.DrawLine(Numbers::ixSectorsEE[i], Numbers::iySectorsEE[i], Numbers::ixSectorsEE[i+1], Numbers::iySectorsEE[i+1]);
01496           }
01497         }
01498         c5Sum->Update();
01499         c5Sum->SaveAs(imgName.c_str());
01500 
01501       }
01502 
01503     }
01504 
01505     // Loop on gains
01506 
01507     for ( int iCanvas = 1 ; iCanvas <= 2 ; iCanvas++ ) {
01508 
01509       // Monitoring elements plots
01510 
01511       imgNameMEPnQual[iCanvas-1] = "";
01512 
01513       obj2f = 0;
01514       switch ( iCanvas ) {
01515       case 1:
01516         obj2f = UtilsClient::getHisto<TH2F*>( meg04_[ism-1] );
01517         break;
01518       case 2:
01519         obj2f = UtilsClient::getHisto<TH2F*>( meg05_[ism-1] );
01520         break;
01521       default:
01522         break;
01523       }
01524 
01525       if ( obj2f ) {
01526 
01527         meName = obj2f->GetName();
01528 
01529         replace(meName.begin(), meName.end(), ' ', '_');
01530         imgNameMEPnQual[iCanvas-1] = meName + ".png";
01531         imgName = htmlDir + imgNameMEPnQual[iCanvas-1];
01532 
01533         cQualPN->cd();
01534         gStyle->SetOptStat(" ");
01535         gStyle->SetPalette(7, pCol3);
01536         obj2f->GetXaxis()->SetNdivisions(10);
01537         obj2f->GetYaxis()->SetNdivisions(5);
01538         cQualPN->SetGridx();
01539         cQualPN->SetGridy(0);
01540         obj2f->SetMinimum(-0.00000001);
01541         obj2f->SetMaximum(7.0);
01542         obj2f->Draw("col");
01543         dummy1.Draw("text,same");
01544         cQualPN->Update();
01545         cQualPN->SaveAs(imgName.c_str());
01546 
01547       }
01548 
01549       imgNameMEPnPed[iCanvas-1] = "";
01550 
01551       objp = 0;
01552       switch ( iCanvas ) {
01553         case 1:
01554           objp = i01_[ism-1];
01555           break;
01556         case 2:
01557           objp = i02_[ism-1];
01558           break;
01559         default:
01560           break;
01561       }
01562 
01563       if ( objp ) {
01564 
01565         meName = objp->GetName();
01566 
01567         replace(meName.begin(), meName.end(), ' ', '_');
01568         imgNameMEPnPed[iCanvas-1] = meName + ".png";
01569         imgName = htmlDir + imgNameMEPnPed[iCanvas-1];
01570 
01571         cPed->cd();
01572         gStyle->SetOptStat("euo");
01573         objp->SetStats(kTRUE);
01574 //        if ( objp->GetMaximum(histMax) > 0. ) {
01575 //          gPad->SetLogy(kTRUE);
01576 //        } else {
01577 //          gPad->SetLogy(kFALSE);
01578 //        }
01579         objp->SetMinimum(0.0);
01580         objp->Draw();
01581         cPed->Update();
01582         cPed->SaveAs(imgName.c_str());
01583         gPad->SetLogy(kFALSE);
01584 
01585       }
01586 
01587       imgNameMEPnPedRms[iCanvas-1] = "";
01588 
01589       obj1f = 0;
01590       switch ( iCanvas ) {
01591       case 1:
01592         if ( mer04_[ism-1] ) obj1f =  UtilsClient::getHisto<TH1F*>(mer04_[ism-1]);
01593         break;
01594       case 2:
01595         if ( mer05_[ism-1] ) obj1f =  UtilsClient::getHisto<TH1F*>(mer05_[ism-1]);
01596         break;
01597       default:
01598         break;
01599       }
01600 
01601       if ( obj1f ) {
01602 
01603         meName = obj1f->GetName();
01604 
01605         replace(meName.begin(), meName.end(), ' ', '_');
01606         imgNameMEPnPedRms[iCanvas-1] = meName + ".png";
01607         imgName = htmlDir + imgNameMEPnPedRms[iCanvas-1];
01608 
01609         cPed->cd();
01610         gStyle->SetOptStat("euomr");
01611         obj1f->SetStats(kTRUE);
01612         //        if ( obj1f->GetMaximum(histMax) > 0. ) {
01613         //          gPad->SetLogy(kTRUE);
01614         //        } else {
01615         //          gPad->SetLogy(kFALSE);
01616         //        }
01617         obj1f->Draw();
01618         cPed->Update();
01619         cPed->SaveAs(imgName.c_str());
01620         gPad->SetLogy(kFALSE);
01621       }
01622 
01623     }
01624 
01625     if( i>0 ) htmlFile << "<a href=""#top"">Top</a>" << std::endl;
01626     htmlFile << "<hr>" << std::endl;
01627     htmlFile << "<h3><a name="""
01628              << Numbers::sEE(ism) << """></a><strong>"
01629              << Numbers::sEE(ism) << "</strong></h3>" << endl;
01630     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01631     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01632     htmlFile << "<tr align=\"center\">" << endl;
01633 
01634     for ( int iCanvas = 1 ; iCanvas <= 3 ; iCanvas++ ) {
01635 
01636       if ( imgNameQual[iCanvas-1].size() != 0 )
01637         htmlFile << "<td colspan=\"2\"><img src=\"" << imgNameQual[iCanvas-1] << "\"></td>" << endl;
01638       else
01639         htmlFile << "<td colspan=\"2\"><img src=\"" << " " << "\"></td>" << endl;
01640 
01641     }
01642 
01643     htmlFile << "</tr>" << endl;
01644     htmlFile << "<tr>" << endl;
01645 
01646     for ( int iCanvas = 1 ; iCanvas <= 3 ; iCanvas++ ) {
01647 
01648       if ( imgNameMean[iCanvas-1].size() != 0 )
01649         htmlFile << "<td><img src=\"" << imgNameMean[iCanvas-1] << "\"></td>" << endl;
01650       else
01651         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01652 
01653       if ( imgNameRMS[iCanvas-1].size() != 0 )
01654         htmlFile << "<td><img src=\"" << imgNameRMS[iCanvas-1] << "\"></td>" << endl;
01655       else
01656         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01657 
01658     }
01659 
01660     htmlFile << "</tr>" << endl;
01661 
01662     htmlFile << "<tr align=\"center\"><td colspan=\"2\">Gain 1</td><td colspan=\"2\">Gain 6</td><td colspan=\"2\">Gain 12</td></tr>" << endl;
01663     htmlFile << "</table>" << endl;
01664     htmlFile << "<br>" << endl;
01665 
01666     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01667     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01668     htmlFile << "<tr align=\"center\">" << endl;
01669 
01670     for ( int iCanvas = 1 ; iCanvas <= 3 ; iCanvas++ ) {
01671 
01672       if ( imgName3Sum[iCanvas-1].size() != 0 )
01673         htmlFile << "<td><img src=\"" << imgName3Sum[iCanvas-1] << "\"></td>" << endl;
01674       else
01675         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01676 
01677     }
01678 
01679     htmlFile << "</tr>" << endl;
01680 
01681     htmlFile << "</table>" << endl;
01682     htmlFile << "<br>" << endl;
01683 
01684     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01685     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01686     htmlFile << "<tr align=\"center\">" << endl;
01687 
01688     for ( int iCanvas = 1 ; iCanvas <= 3 ; iCanvas++ ) {
01689 
01690       if ( imgName5Sum[iCanvas-1].size() != 0 )
01691         htmlFile << "<td><img src=\"" << imgName5Sum[iCanvas-1] << "\"></td>" << endl;
01692       else
01693         htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
01694 
01695     }
01696 
01697     htmlFile << "</tr>" << endl;
01698 
01699     htmlFile << "<tr align=\"center\"><td>Gain 1</td><td>Gain 6</td><td>Gain 12</td></tr>" << endl;
01700     htmlFile << "</table>" << endl;
01701     htmlFile << "<br>" << endl;
01702 
01703     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01704     htmlFile << "cellpadding=\"10\"> " << endl;
01705     htmlFile << "<tr align=\"center\">" << endl;
01706 
01707     for ( int iCanvas = 1 ; iCanvas <= 2 ; iCanvas++ ) {
01708 
01709       if ( imgNameMEPnQual[iCanvas-1].size() != 0 )
01710         htmlFile << "<td colspan=\"2\"><img src=\"" << imgNameMEPnQual[iCanvas-1] << "\"></td>" << endl;
01711       else
01712         htmlFile << "<td colspan=\"2\"><img src=\"" << " " << "\"></td>" << endl;
01713 
01714     }
01715 
01716     htmlFile << "</tr>" << endl;
01717     htmlFile << "</table>" << endl;
01718     htmlFile << "<br>" << endl;
01719 
01720     htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
01721     htmlFile << "cellpadding=\"10\" align=\"center\"> " << endl;
01722     htmlFile << "<tr align=\"center\">" << endl;
01723 
01724     for ( int iCanvas = 1 ; iCanvas <= 2 ; iCanvas++ ) {
01725 
01726       if ( imgNameMEPnPed[iCanvas-1].size() != 0 ) {
01727         htmlFile << "<td colspan=\"2\"><img src=\"" << imgNameMEPnPed[iCanvas-1] << "\"></td>" << endl;
01728 
01729         if ( imgNameMEPnPedRms[iCanvas-1].size() != 0 )
01730           htmlFile << "<td colspan=\"2\"><img src=\"" << imgNameMEPnPedRms[iCanvas-1] << "\"></td>" << endl;
01731         else
01732           htmlFile << "<td colspan=\"2\"><img src=\"" << " " << "\"></td>" << endl;
01733 
01734       }
01735 
01736       else{
01737         htmlFile << "<td colspan=\"2\"><img src=\"" << " " << "\"></td>" << endl;
01738 
01739         if ( imgNameMEPnPedRms[iCanvas-1].size() != 0 )
01740           htmlFile << "<td colspan=\"2\"><img src=\"" << imgNameMEPnPedRms[iCanvas-1] << "\"></td>" << endl;
01741         else
01742           htmlFile << "<td colspan=\"2\"><img src=\"" << " " << "\"></td>" << endl;
01743       }
01744 
01745     }
01746 
01747     htmlFile << "</tr>" << endl;
01748 
01749     htmlFile << "<tr align=\"right\"><td colspan=\"2\">Gain 1</td>  <td colspan=\"2\"> </td> <td colspan=\"2\">Gain 16</td></tr>" << endl;
01750     htmlFile << "</table>" << endl;
01751     htmlFile << "<br>" << endl;
01752 
01753    }
01754 
01755   delete cQual;
01756   delete cQualPN;
01757   delete cMean;
01758   delete cRMS;
01759   delete c3Sum;
01760   delete c5Sum;
01761   delete cPed;
01762 
01763   // html page footer
01764   htmlFile << "</body> " << endl;
01765   htmlFile << "</html> " << endl;
01766 
01767   htmlFile.close();
01768 
01769   }

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