CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/EcalBarrelMonitorClient/src/EBPedestalClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBPedestalClient.cc
00003  *
00004  * $Date: 2011/09/15 20:55:48 $
00005  * $Revision: 1.230 $
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 "FWCore/ServiceRegistry/interface/Service.h"
00018 
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020 #include "DQMServices/Core/interface/MonitorElement.h"
00021 
00022 #ifdef WITH_ECAL_COND_DB
00023 #include "OnlineDB/EcalCondDB/interface/MonPedestalsDat.h"
00024 #include "OnlineDB/EcalCondDB/interface/MonPNPedDat.h"
00025 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00026 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00027 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00028 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00029 #include "DQM/EcalCommon/interface/LogicID.h"
00030 #endif
00031 
00032 #include "DQM/EcalCommon/interface/Masks.h"
00033 
00034 #include "DQM/EcalCommon/interface/UtilsClient.h"
00035 #include "DQM/EcalCommon/interface/Numbers.h"
00036 
00037 #include "DQM/EcalBarrelMonitorClient/interface/EBPedestalClient.h"
00038 
00039 // #define COMMON_NOISE_ANALYSIS
00040 
00041 EBPedestalClient::EBPedestalClient(const edm::ParameterSet& ps) {
00042 
00043   // cloneME switch
00044   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00045 
00046   // verbose switch
00047   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00048 
00049   // debug switch
00050   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00051 
00052   // prefixME path
00053   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00054 
00055   // enableCleanup_ switch
00056   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00057 
00058   // vector of selected Super Modules (Defaults to all 36).
00059   superModules_.reserve(36);
00060   for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);
00061   superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00062 
00063   MGPAGains_.reserve(3);
00064   for ( unsigned int i = 1; i <= 3; i++ ) MGPAGains_.push_back(i);
00065   MGPAGains_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGains", MGPAGains_);
00066 
00067   MGPAGainsPN_.reserve(2);
00068   for ( unsigned int i = 1; i <= 3; i++ ) MGPAGainsPN_.push_back(i);
00069   MGPAGainsPN_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGainsPN", MGPAGainsPN_);
00070 
00071   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00072 
00073     int ism = superModules_[i];
00074 
00075     h01_[ism-1] = 0;
00076     h02_[ism-1] = 0;
00077     h03_[ism-1] = 0;
00078 
00079     j01_[ism-1] = 0;
00080     j02_[ism-1] = 0;
00081     j03_[ism-1] = 0;
00082 
00083     k01_[ism-1] = 0;
00084     k02_[ism-1] = 0;
00085     k03_[ism-1] = 0;
00086 
00087     i01_[ism-1] = 0;
00088     i02_[ism-1] = 0;
00089 
00090   }
00091 
00092   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00093 
00094     int ism = superModules_[i];
00095 
00096     meg01_[ism-1] = 0;
00097     meg02_[ism-1] = 0;
00098     meg03_[ism-1] = 0;
00099 
00100     meg04_[ism-1] = 0;
00101     meg05_[ism-1] = 0;
00102 
00103     mep01_[ism-1] = 0;
00104     mep02_[ism-1] = 0;
00105     mep03_[ism-1] = 0;
00106 
00107     mer01_[ism-1] = 0;
00108     mer02_[ism-1] = 0;
00109     mer03_[ism-1] = 0;
00110 
00111     mer04_[ism-1] = 0;
00112     mer05_[ism-1] = 0;
00113 
00114 #ifdef COMMON_NOISE_ANALYSIS
00115     mes01_[ism-1] = 0;
00116     mes02_[ism-1] = 0;
00117     mes03_[ism-1] = 0;
00118 
00119     met01_[ism-1] = 0;
00120     met02_[ism-1] = 0;
00121     met03_[ism-1] = 0;
00122 #endif
00123 
00124   }
00125 
00126   expectedMean_[0] = 200.0;
00127   expectedMean_[1] = 200.0;
00128   expectedMean_[2] = 200.0;
00129 
00130   discrepancyMean_[0] = 25.0;
00131   discrepancyMean_[1] = 25.0;
00132   discrepancyMean_[2] = 25.0;
00133 
00134   RMSThreshold_[0] = 1.0;
00135   RMSThreshold_[1] = 1.2;
00136   RMSThreshold_[2] = 2.0;
00137 
00138   expectedMeanPn_[0] = 750.0;
00139   expectedMeanPn_[1] = 750.0;
00140 
00141   discrepancyMeanPn_[0] = 100.0;
00142   discrepancyMeanPn_[1] = 100.0;
00143 
00144   RMSThresholdPn_[0] = 999.;
00145   RMSThresholdPn_[1] = 999.;
00146 
00147 }
00148 
00149 EBPedestalClient::~EBPedestalClient() {
00150 
00151 }
00152 
00153 void EBPedestalClient::beginJob(void) {
00154 
00155   dqmStore_ = edm::Service<DQMStore>().operator->();
00156 
00157   if ( debug_ ) std::cout << "EBPedestalClient: beginJob" << std::endl;
00158 
00159   ievt_ = 0;
00160   jevt_ = 0;
00161 
00162 }
00163 
00164 void EBPedestalClient::beginRun(void) {
00165 
00166   if ( debug_ ) std::cout << "EBPedestalClient: beginRun" << std::endl;
00167 
00168   jevt_ = 0;
00169 
00170   this->setup();
00171 
00172 }
00173 
00174 void EBPedestalClient::endJob(void) {
00175 
00176   if ( debug_ ) std::cout << "EBPedestalClient: endJob, ievt = " << ievt_ << std::endl;
00177 
00178   this->cleanup();
00179 
00180 }
00181 
00182 void EBPedestalClient::endRun(void) {
00183 
00184   if ( debug_ ) std::cout << "EBPedestalClient: endRun, jevt = " << jevt_ << std::endl;
00185 
00186   this->cleanup();
00187 
00188 }
00189 
00190 void EBPedestalClient::setup(void) {
00191 
00192   std::string name;
00193 
00194   dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalClient" );
00195 
00196   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00197 
00198     int ism = superModules_[i];
00199 
00200     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00201       if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00202       name = "EBPT pedestal quality G01 " + Numbers::sEB(ism);
00203       meg01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00204       meg01_[ism-1]->setAxisTitle("ieta", 1);
00205       meg01_[ism-1]->setAxisTitle("iphi", 2);
00206     }
00207     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00208       if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00209       name = "EBPT pedestal quality G06 " + Numbers::sEB(ism);
00210       meg02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00211       meg02_[ism-1]->setAxisTitle("ieta", 1);
00212       meg02_[ism-1]->setAxisTitle("iphi", 2);
00213     }
00214     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00215       if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00216       name = "EBPT pedestal quality G12 " + Numbers::sEB(ism);
00217       meg03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00218       meg03_[ism-1]->setAxisTitle("ieta", 1);
00219       meg03_[ism-1]->setAxisTitle("iphi", 2);
00220     }
00221 
00222     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00223       if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00224       name = "EBPT pedestal quality PNs G01 " + Numbers::sEB(ism);
00225       meg04_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00226       meg04_[ism-1]->setAxisTitle("pseudo-strip", 1);
00227       meg04_[ism-1]->setAxisTitle("channel", 2);
00228     }
00229     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00230       if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00231       name = "EBPT pedestal quality PNs G16 " + Numbers::sEB(ism);
00232       meg05_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00233       meg05_[ism-1]->setAxisTitle("pseudo-strip", 1);
00234       meg05_[ism-1]->setAxisTitle("channel", 2);
00235     }
00236 
00237     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00238       if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00239       name = "EBPT pedestal mean G01 " + Numbers::sEB(ism);
00240       mep01_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
00241       mep01_[ism-1]->setAxisTitle("mean", 1);
00242     }
00243     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00244       if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
00245       name = "EBPT pedestal mean G06 " + Numbers::sEB(ism);
00246       mep02_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
00247       mep02_[ism-1]->setAxisTitle("mean", 1);
00248     }
00249     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00250       if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
00251       name = "EBPT pedestal mean G12 " + Numbers::sEB(ism);
00252       mep03_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
00253       mep03_[ism-1]->setAxisTitle("mean", 1);
00254     }
00255 
00256     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00257       if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00258       name = "EBPT pedestal rms G01 " + Numbers::sEB(ism);
00259       mer01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00260       mer01_[ism-1]->setAxisTitle("rms", 1);
00261     }
00262     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00263       if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
00264       name = "EBPT pedestal rms G06 " + Numbers::sEB(ism);
00265       mer02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00266       mer02_[ism-1]->setAxisTitle("rms", 1);
00267     }
00268     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00269       if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
00270       name = "EBPT pedestal rms G12 " + Numbers::sEB(ism);
00271       mer03_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00272       mer03_[ism-1]->setAxisTitle("rms", 1);
00273     }
00274 
00275     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00276       if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
00277       name = "EBPDT PNs pedestal rms " + Numbers::sEB(ism) + " G01"; 
00278       mer04_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00279       mer04_[ism-1]->setAxisTitle("rms", 1);
00280     }
00281     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00282       if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
00283       name = "EBPDT PNs pedestal rms " + Numbers::sEB(ism) + " G16";
00284       mer05_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00285       mer05_[ism-1]->setAxisTitle("rms", 1);
00286     }
00287 
00288 #ifdef COMMON_NOISE_ANALYSIS
00289     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00290       if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
00291       name = "EBPT pedestal 3sum G01 " + Numbers::sEB(ism);
00292       mes01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00293       mes01_[ism-1]->setAxisTitle("ieta", 1);
00294       mes01_[ism-1]->setAxisTitle("iphi", 2);
00295     }
00296     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00297       if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
00298       name = "EBPT pedestal 3sum G06 " + Numbers::sEB(ism);
00299       mes02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00300       mes02_[ism-1]->setAxisTitle("ieta", 1);
00301       mes02_[ism-1]->setAxisTitle("iphi", 2);
00302     }
00303     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00304       if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
00305       name = "EBPT pedestal 3sum G12 " + Numbers::sEB(ism);
00306       mes03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00307       mes03_[ism-1]->setAxisTitle("ieta", 1);
00308       mes03_[ism-1]->setAxisTitle("iphi", 2);
00309     }
00310 
00311     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00312       if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00313       name = "EBPT pedestal 5sum G01 " + Numbers::sEB(ism);
00314       met01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00315       met01_[ism-1]->setAxisTitle("ieta", 1);
00316       met01_[ism-1]->setAxisTitle("iphi", 2);
00317     }
00318     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00319       if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00320       name = "EBPT pedestal 5sum G06 " + Numbers::sEB(ism);
00321       met02_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00322       met02_[ism-1]->setAxisTitle("ieta", 1);
00323       met02_[ism-1]->setAxisTitle("iphi", 2);
00324     }
00325     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00326       if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00327       name = "EBPT pedestal 5sum G12 " + Numbers::sEB(ism);
00328       met03_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
00329       met03_[ism-1]->setAxisTitle("ieta", 1);
00330       met03_[ism-1]->setAxisTitle("iphi", 2);
00331     }
00332 #endif
00333 
00334   }
00335 
00336   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00337 
00338     int ism = superModules_[i];
00339 
00340     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00341     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00342     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
00343 
00344     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
00345     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00346 
00347     for ( int ie = 1; ie <= 85; ie++ ) {
00348       for ( int ip = 1; ip <= 20; ip++ ) {
00349 
00350         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 2. );
00351         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ie, ip, 2. );
00352         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ie, ip, 2. );
00353 
00354       }
00355     }
00356 
00357     for ( int i = 1; i <= 10; i++ ) {
00358 
00359       if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
00360       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00361 
00362     }
00363 
00364     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00365     if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
00366     if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
00367 
00368     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00369     if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
00370     if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
00371 
00372     if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
00373     if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
00374 
00375 #ifdef COMMON_NOISE_ANALYSIS
00376     if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
00377     if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
00378     if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
00379 
00380     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00381     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00382     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
00383 
00384     for ( int ie = 1; ie <= 85; ie++ ) {
00385       for ( int ip = 1; ip <= 20; ip++ ) {
00386 
00387         if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent( ie, ip, -999. );
00388         if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent( ie, ip, -999. );
00389         if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent( ie, ip, -999. );
00390 
00391         if ( met01_[ism-1] ) met01_[ism-1]->setBinContent( ie, ip, -999. );
00392         if ( met02_[ism-1] ) met02_[ism-1]->setBinContent( ie, ip, -999. );
00393         if ( met03_[ism-1] ) met03_[ism-1]->setBinContent( ie, ip, -999. );
00394 
00395       }
00396     }
00397 #endif
00398 
00399   }
00400 
00401 }
00402 
00403 void EBPedestalClient::cleanup(void) {
00404 
00405   if ( ! enableCleanup_ ) return;
00406 
00407   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00408 
00409     int ism = superModules_[i];
00410 
00411     if ( cloneME_ ) {
00412       if ( h01_[ism-1] ) delete h01_[ism-1];
00413       if ( h02_[ism-1] ) delete h02_[ism-1];
00414       if ( h03_[ism-1] ) delete h03_[ism-1];
00415 
00416       if ( j01_[ism-1] ) delete j01_[ism-1];
00417       if ( j02_[ism-1] ) delete j02_[ism-1];
00418       if ( j03_[ism-1] ) delete j03_[ism-1];
00419 
00420       if ( k01_[ism-1] ) delete k01_[ism-1];
00421       if ( k02_[ism-1] ) delete k02_[ism-1];
00422       if ( k03_[ism-1] ) delete k03_[ism-1];
00423 
00424       if ( i01_[ism-1] ) delete i01_[ism-1];
00425       if ( i02_[ism-1] ) delete i02_[ism-1];
00426     }
00427 
00428     h01_[ism-1] = 0;
00429     h02_[ism-1] = 0;
00430     h03_[ism-1] = 0;
00431 
00432     j01_[ism-1] = 0;
00433     j02_[ism-1] = 0;
00434     j03_[ism-1] = 0;
00435 
00436     k01_[ism-1] = 0;
00437     k02_[ism-1] = 0;
00438     k03_[ism-1] = 0;
00439 
00440     i01_[ism-1] = 0;
00441     i02_[ism-1] = 0;
00442 
00443   }
00444 
00445   dqmStore_->setCurrentFolder( prefixME_ + "/EBPedestalClient" );
00446 
00447   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00448 
00449     int ism = superModules_[i];
00450 
00451     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00452     meg01_[ism-1] = 0;
00453     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00454     meg02_[ism-1] = 0;
00455     if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00456     meg03_[ism-1] = 0;
00457 
00458     if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00459     meg04_[ism-1] = 0;
00460     if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00461     meg05_[ism-1] = 0;
00462 
00463     if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
00464     mep01_[ism-1] = 0;
00465     if ( mep02_[ism-1] ) dqmStore_->removeElement( mep02_[ism-1]->getName() );
00466     mep02_[ism-1] = 0;
00467     if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
00468     mep03_[ism-1] = 0;
00469 
00470     if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
00471     mer01_[ism-1] = 0;
00472     if ( mer02_[ism-1] ) dqmStore_->removeElement( mer02_[ism-1]->getName() );
00473     mer02_[ism-1] = 0;
00474     if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
00475     mer03_[ism-1] = 0;
00476 
00477     if ( mer04_[ism-1] ) dqmStore_->removeElement( mer04_[ism-1]->getName() );
00478     mer04_[ism-1] = 0;
00479     if ( mer05_[ism-1] ) dqmStore_->removeElement( mer05_[ism-1]->getName() );
00480     mer05_[ism-1] = 0;
00481 
00482 #ifdef COMMON_NOISE_ANALYSIS
00483     if ( mes01_[ism-1] ) dqmStore_->removeElement( mes01_[ism-1]->getName() );
00484     mes01_[ism-1] = 0;
00485     if ( mes02_[ism-1] ) dqmStore_->removeElement( mes02_[ism-1]->getName() );
00486     mes02_[ism-1] = 0;
00487     if ( mes03_[ism-1] ) dqmStore_->removeElement( mes03_[ism-1]->getName() );
00488     mes03_[ism-1] = 0;
00489 
00490     if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00491     met01_[ism-1] = 0;
00492     if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00493     met02_[ism-1] = 0;
00494     if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00495     met03_[ism-1] = 0;
00496 #endif
00497 
00498   }
00499 
00500 }
00501 
00502 #ifdef WITH_ECAL_COND_DB
00503 bool EBPedestalClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00504 
00505   status = true;
00506 
00507   EcalLogicID ecid;
00508 
00509   MonPedestalsDat p;
00510   std::map<EcalLogicID, MonPedestalsDat> dataset1;
00511 
00512   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00513 
00514     int ism = superModules_[i];
00515 
00516     if ( verbose_ ) {
00517       std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
00518       std::cout << std::endl;
00519       if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00520         UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
00521       }
00522       if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00523         UtilsClient::printBadChannels(meg02_[ism-1], h02_[ism-1]);
00524       }
00525       if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00526         UtilsClient::printBadChannels(meg03_[ism-1], h03_[ism-1]);
00527       }
00528     }
00529 
00530     for ( int ie = 1; ie <= 85; ie++ ) {
00531       for ( int ip = 1; ip <= 20; ip++ ) {
00532 
00533         bool update01;
00534         bool update02;
00535         bool update03;
00536 
00537         float num01, num02, num03;
00538         float mean01, mean02, mean03;
00539         float rms01, rms02, rms03;
00540 
00541         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
00542         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ie, ip, num02, mean02, rms02);
00543         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03);
00544 
00545         if ( update01 || update02 || update03 ) {
00546 
00547           if ( Numbers::icEB(ism, ie, ip) == 1 ) {
00548 
00549             if ( verbose_ ) {
00550               std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
00551               std::cout << "G01 (" << ie << "," << ip << ") " << num01  << " " << mean01 << " " << rms01  << std::endl;
00552               std::cout << "G06 (" << ie << "," << ip << ") " << num02  << " " << mean02 << " " << rms02  << std::endl;
00553               std::cout << "G12 (" << ie << "," << ip << ") " << num03  << " " << mean03 << " " << rms03  << std::endl;
00554               std::cout << std::endl;
00555             }
00556 
00557           }
00558 
00559           p.setPedMeanG1(mean01);
00560           p.setPedRMSG1(rms01);
00561 
00562           p.setPedMeanG6(mean02);
00563           p.setPedRMSG6(rms02);
00564 
00565           p.setPedMeanG12(mean03);
00566           p.setPedRMSG12(rms03);
00567 
00568           if ( UtilsClient::getBinStatus(meg01_[ism-1], ie, ip) &&
00569                UtilsClient::getBinStatus(meg02_[ism-1], ie, ip) &&
00570                UtilsClient::getBinStatus(meg03_[ism-1], ie, ip) ) {
00571             p.setTaskStatus(true);
00572           } else {
00573             p.setTaskStatus(false);
00574           }
00575 
00576           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ie, ip) &&
00577             UtilsClient::getBinQuality(meg02_[ism-1], ie, ip) &&
00578             UtilsClient::getBinQuality(meg03_[ism-1], ie, ip);
00579 
00580           int ic = Numbers::indexEB(ism, ie, ip);
00581 
00582           if ( econn ) {
00583             ecid = LogicID::getEcalLogicID("EB_crystal_number", Numbers::iSM(ism, EcalBarrel), ic);
00584             dataset1[ecid] = p;
00585           }
00586 
00587         }
00588 
00589       }
00590     }
00591 
00592   }
00593 
00594   if ( econn ) {
00595     try {
00596       if ( verbose_ ) std::cout << "Inserting MonPedestalsDat ..." << std::endl;
00597       if ( dataset1.size() != 0 ) econn->insertDataArraySet(&dataset1, moniov);
00598       if ( verbose_ ) std::cout << "done." << std::endl;
00599     } catch (std::runtime_error &e) {
00600       std::cerr << e.what() << std::endl;
00601     }
00602   }
00603 
00604   if ( verbose_ ) std::cout << std::endl;
00605 
00606   MonPNPedDat pn;
00607   std::map<EcalLogicID, MonPNPedDat> dataset2;
00608 
00609   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00610 
00611     int ism = superModules_[i];
00612 
00613     if ( verbose_ ) {
00614       std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
00615       std::cout << std::endl;
00616       if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00617         UtilsClient::printBadChannels(meg04_[ism-1], i01_[ism-1]);
00618       }
00619       if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00620         UtilsClient::printBadChannels(meg05_[ism-1], i02_[ism-1]);
00621       }
00622     }
00623 
00624     for ( int i = 1; i <= 10; i++ ) {
00625 
00626       bool update01;
00627       bool update02;
00628 
00629       float num01, num02;
00630       float mean01, mean02;
00631       float rms01, rms02;
00632 
00633       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
00634       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
00635 
00636       if ( update01 || update02 ) {
00637 
00638         if ( i == 1 ) {
00639 
00640           if ( verbose_ ) {
00641             std::cout << "Preparing dataset for " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
00642             std::cout << "PNs (" << i << ") G01 " << num01  << " " << mean01 << " " << rms01  << std::endl;
00643             std::cout << "PNs (" << i << ") G16 " << num01  << " " << mean01 << " " << rms01  << std::endl;
00644             std::cout << std::endl;
00645           }
00646 
00647         }
00648 
00649         pn.setPedMeanG1(mean01);
00650         pn.setPedRMSG1(rms01);
00651 
00652         pn.setPedMeanG16(mean02);
00653         pn.setPedRMSG16(rms02);
00654 
00655         if ( UtilsClient::getBinStatus(meg04_[ism-1], i, 1) &&
00656              UtilsClient::getBinStatus(meg05_[ism-1], i, 1) ) {
00657           pn.setTaskStatus(true);
00658         } else {
00659           pn.setTaskStatus(false);
00660         }
00661 
00662         status = status && UtilsClient::getBinQuality(meg04_[ism-1], i, 1) &&
00663           UtilsClient::getBinQuality(meg05_[ism-1], i, 1);
00664 
00665         if ( econn ) {
00666           ecid = LogicID::getEcalLogicID("EB_LM_PN", Numbers::iSM(ism, EcalBarrel), i-1);
00667           dataset2[ecid] = pn;
00668         }
00669 
00670       }
00671 
00672     }
00673 
00674   }
00675 
00676   if ( econn ) {
00677     try {
00678       if ( verbose_ ) std::cout << "Inserting MonPNPedDat ..." << std::endl;
00679       if ( dataset2.size() != 0 ) econn->insertDataArraySet(&dataset2, moniov);
00680       if ( verbose_ ) std::cout << "done." << std::endl;
00681     } catch (std::runtime_error &e) {
00682       std::cerr << e.what() << std::endl;
00683     }
00684   }
00685 
00686   return true;
00687 
00688 }
00689 #endif
00690 
00691 void EBPedestalClient::analyze(void) {
00692 
00693   ievt_++;
00694   jevt_++;
00695   if ( ievt_ % 10 == 0 ) {
00696     if ( debug_ ) std::cout << "EBPedestalClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
00697   }
00698 
00699   uint32_t bits01 = 0;
00700   bits01 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
00701   bits01 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
00702 
00703   uint32_t bits02 = 0;
00704   bits02 |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR;
00705   bits02 |= 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR;
00706 
00707   uint32_t bits03 = 0;
00708   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
00709   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
00710 
00711   MonitorElement* me;
00712 
00713   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00714 
00715     int ism = superModules_[i];
00716 
00717     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00718 
00719       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal " + Numbers::sEB(ism) + " G01");
00720       h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
00721 
00722     }
00723 
00724     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00725 
00726       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal " + Numbers::sEB(ism) + " G06");
00727       h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
00728 
00729     }
00730 
00731     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00732 
00733       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal " + Numbers::sEB(ism) + " G12");
00734       h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
00735 
00736     }
00737 
00738 #ifdef COMMON_NOISE_ANALYSIS
00739     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00740 
00741       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G01");
00742       j01_[ism-1] = UtilsClient::getHisto( me, cloneME_, j01_[ism-1] );
00743 
00744     }
00745 
00746     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00747 
00748       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G06");
00749       j02_[ism-1] = UtilsClient::getHisto( me, cloneME_, j02_[ism-1] );
00750 
00751     }
00752 
00753     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00754 
00755       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal 3sum " + Numbers::sEB(ism) + " G12");
00756       j03_[ism-1] = UtilsClient::getHisto( me, cloneME_, j03_[ism-1] );
00757 
00758     }
00759 
00760     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00761 
00762       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain01/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G01");
00763       k01_[ism-1] = UtilsClient::getHisto( me, cloneME_, k01_[ism-1] );
00764 
00765     }
00766 
00767     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00768 
00769       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain06/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G06");
00770       k02_[ism-1] = UtilsClient::getHisto( me, cloneME_, k02_[ism-1] );
00771 
00772     }
00773 
00774     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00775 
00776       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/Gain12/EBPT pedestal 5sum " + Numbers::sEB(ism) + " G12");
00777       k03_[ism-1] = UtilsClient::getHisto( me, cloneME_, k03_[ism-1] );
00778 
00779     }
00780 #endif
00781 
00782     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00783 
00784       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/PN/Gain01/EBPDT PNs pedestal " + Numbers::sEB(ism) + " G01");
00785       i01_[ism-1] = UtilsClient::getHisto( me, cloneME_, i01_[ism-1] );
00786 
00787     }
00788 
00789     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00790 
00791       me = dqmStore_->get(prefixME_ + "/EBPedestalTask/PN/Gain16/EBPDT PNs pedestal " + Numbers::sEB(ism) + " G16");
00792       i02_[ism-1] = UtilsClient::getHisto( me, cloneME_, i02_[ism-1] );
00793 
00794     }
00795 
00796     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00797     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00798     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
00799 
00800     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
00801     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00802 
00803     if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
00804     if ( mep02_[ism-1] ) mep02_[ism-1]->Reset();
00805     if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
00806 
00807     if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();
00808     if ( mer02_[ism-1] ) mer02_[ism-1]->Reset();
00809     if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();
00810 
00811     if ( mer04_[ism-1] ) mer04_[ism-1]->Reset();
00812     if ( mer05_[ism-1] ) mer05_[ism-1]->Reset();
00813 
00814 #ifdef COMMON_NOISE_ANALYSIS
00815     if ( mes01_[ism-1] ) mes01_[ism-1]->Reset();
00816     if ( mes02_[ism-1] ) mes02_[ism-1]->Reset();
00817     if ( mes03_[ism-1] ) mes03_[ism-1]->Reset();
00818 
00819     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00820     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00821     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
00822 #endif
00823 
00824     for ( int ie = 1; ie <= 85; ie++ ) {
00825       for ( int ip = 1; ip <= 20; ip++ ) {
00826 
00827         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, 2.);
00828         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ie, ip, 2.);
00829         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, 2.);
00830 
00831         bool update01;
00832         bool update02;
00833         bool update03;
00834 
00835         float num01, num02, num03;
00836         float mean01, mean02, mean03;
00837         float rms01, rms02, rms03;
00838 
00839         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01);
00840         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ie, ip, num02, mean02, rms02);
00841         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ie, ip, num03, mean03, rms03);
00842 
00843         if ( update01 ) {
00844 
00845           float val;
00846 
00847           val = 1.;
00848           if ( std::abs(mean01 - expectedMean_[0]) > discrepancyMean_[0] )
00849             val = 0.;
00850           if ( rms01 > RMSThreshold_[0] )
00851             val = 0.;
00852           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, val);
00853 
00854           if ( mep01_[ism-1] ) mep01_[ism-1]->Fill(mean01);
00855           if ( mer01_[ism-1] ) mer01_[ism-1]->Fill(rms01);
00856 
00857         }
00858 
00859         if ( update02 ) {
00860 
00861           float val;
00862 
00863           val = 1.;
00864           if ( std::abs(mean02 - expectedMean_[1]) > discrepancyMean_[1] )
00865             val = 0.;
00866           if ( rms02 > RMSThreshold_[1] )
00867             val = 0.;
00868           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent(ie, ip, val);
00869 
00870           if ( mep02_[ism-1] ) mep02_[ism-1]->Fill(mean02);
00871           if ( mer02_[ism-1] ) mer02_[ism-1]->Fill(rms02);
00872 
00873         }
00874 
00875         if ( update03 ) {
00876 
00877           float val;
00878 
00879           val = 1.;
00880           if ( std::abs(mean03 - expectedMean_[2]) > discrepancyMean_[2] )
00881             val = 0.;
00882           if ( rms03 > RMSThreshold_[2] )
00883             val = 0.;
00884           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ie, ip, val);
00885 
00886           if ( mep03_[ism-1] ) mep03_[ism-1]->Fill(mean03);
00887           if ( mer03_[ism-1] ) mer03_[ism-1]->Fill(rms03);
00888 
00889         }
00890 
00891         if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );
00892         if ( Masks::maskChannel(ism, ie, ip, bits02, EcalBarrel) ) UtilsClient::maskBinContent( meg02_[ism-1], ie, ip );
00893         if ( Masks::maskChannel(ism, ie, ip, bits03, EcalBarrel) ) UtilsClient::maskBinContent( meg03_[ism-1], ie, ip );
00894 
00895       }
00896     }
00897 
00898     // PN diodes
00899 
00900     for ( int i = 1; i <= 10; i++ ) {
00901 
00902       if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( i, 1, 2. );
00903       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00904 
00905       bool update01;
00906       bool update02;
00907 
00908       float num01, num02;
00909       float mean01, mean02;
00910       float rms01, rms02;
00911 
00912       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
00913       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
00914 
00915       // filling projections
00916       if ( mer04_[ism-1] )  mer04_[ism-1]->Fill(rms01);
00917       if ( mer05_[ism-1] )  mer05_[ism-1]->Fill(rms02);
00918 
00919       if ( update01 ) {
00920 
00921         float val;
00922 
00923         val = 1.;
00924         if ( mean01 < (expectedMeanPn_[0] - discrepancyMeanPn_[0])
00925              || (expectedMeanPn_[0] + discrepancyMeanPn_[0]) <  mean01)
00926           val = 0.;
00927         if ( rms01 >  RMSThresholdPn_[0])
00928           val = 0.;
00929 
00930         if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent(i, 1, val);
00931 
00932       }
00933 
00934       if ( update02 ) {
00935 
00936         float val;
00937 
00938         val = 1.;
00939         if ( mean02 < (expectedMeanPn_[1] - discrepancyMeanPn_[1])
00940              || (expectedMeanPn_[1] + discrepancyMeanPn_[1]) <  mean02)
00941           val = 0.;
00942         if ( rms02 >  RMSThresholdPn_[1])
00943           val = 0.;
00944 
00945         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent(i, 1, val);
00946       }
00947 
00948       if ( Masks::maskPn(ism, i, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg04_[ism-1], i, 1 );
00949       if ( Masks::maskPn(ism, i, bits03, EcalBarrel) ) UtilsClient::maskBinContent( meg05_[ism-1], i, 1 );
00950 
00951     }
00952 
00953 #ifdef COMMON_NOISE_ANALYSIS
00954     for ( int ie = 1; ie <= 85; ie++ ) {
00955       for ( int ip = 1; ip <= 20; ip++ ) {
00956 
00957         float x3val01;
00958         float x3val02;
00959         float x3val03;
00960 
00961         float y3val01;
00962         float y3val02;
00963         float y3val03;
00964 
00965         float z3val01;
00966         float z3val02;
00967         float z3val03;
00968 
00969         float x5val01;
00970         float x5val02;
00971         float x5val03;
00972 
00973         float y5val01;
00974         float y5val02;
00975         float y5val03;
00976 
00977         float z5val01;
00978         float z5val02;
00979         float z5val03;
00980 
00981         if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ie, ip, -999.);
00982         if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ie, ip, -999.);
00983         if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ie, ip, -999.);
00984 
00985         if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ie, ip, -999.);
00986         if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ie, ip, -999.);
00987         if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ie, ip, -999.);
00988 
00989         if ( ie >= 2 && ie <= 84 && ip >= 2 && ip <= 19 ) {
00990 
00991           x3val01 = 0.;
00992           x3val02 = 0.;
00993           x3val03 = 0.;
00994           for ( int i = -1; i <= +1; i++ ) {
00995             for ( int j = -1; j <= +1; j++ ) {
00996 
00997               if ( h01_[ism-1] ) x3val01 = x3val01 + h01_[ism-1]->GetBinError(ie+i, ip+j) *
00998                                    h01_[ism-1]->GetBinError(ie+i, ip+j);
00999 
01000               if ( h02_[ism-1] ) x3val02 = x3val02 + h02_[ism-1]->GetBinError(ie+i, ip+j) *
01001                                    h02_[ism-1]->GetBinError(ie+i, ip+j);
01002 
01003               if ( h03_[ism-1] ) x3val03 = x3val03 + h03_[ism-1]->GetBinError(ie+i, ip+j) *
01004                                    h03_[ism-1]->GetBinError(ie+i, ip+j);
01005 
01006             }
01007           }
01008           x3val01 = x3val01 / (9.*9.);
01009           x3val02 = x3val02 / (9.*9.);
01010           x3val03 = x3val03 / (9.*9.);
01011 
01012           y3val01 = 0.;
01013           if ( j01_[ism-1] ) y3val01 = j01_[ism-1]->GetBinError(ie, ip) *
01014                                j01_[ism-1]->GetBinError(ie, ip);
01015 
01016           y3val02 = 0.;
01017           if ( j02_[ism-1] ) y3val02 = j02_[ism-1]->GetBinError(ie, ip) *
01018                                j02_[ism-1]->GetBinError(ie, ip);
01019 
01020           y3val03 = 0.;
01021           if ( j03_[ism-1] ) y3val03 = j03_[ism-1]->GetBinError(ie, ip) *
01022                                j03_[ism-1]->GetBinError(ie, ip);
01023 
01024           z3val01 = -999.;
01025           if ( x3val01 != 0 && y3val01 != 0 ) z3val01 = sqrt(std::abs(x3val01 - y3val01));
01026           if ( (x3val01 - y3val01) < 0 ) z3val01 = -z3val01;
01027 
01028           if ( mes01_[ism-1] ) mes01_[ism-1]->setBinContent(ie, ip, z3val01);
01029 
01030           z3val02 = -999.;
01031           if ( x3val02 != 0 && y3val02 != 0 ) z3val02 = sqrt(std::abs(x3val02 - y3val02));
01032           if ( (x3val02 - y3val02) < 0 ) z3val02 = -z3val02;
01033 
01034           if ( mes02_[ism-1] ) mes02_[ism-1]->setBinContent(ie, ip, z3val02);
01035 
01036           z3val03 = -999.;
01037           if ( x3val03 != 0 && y3val03 != 0 ) z3val03 = sqrt(std::abs(x3val03 - y3val03));
01038           if ( (x3val03 - y3val03) < 0 ) z3val03 = -z3val03;
01039 
01040           if ( mes03_[ism-1] ) mes03_[ism-1]->setBinContent(ie, ip, z3val03);
01041 
01042         }
01043 
01044         if ( ie >= 3 && ie <= 83 && ip >= 3 && ip <= 18 ) {
01045 
01046           x5val01 = 0.;
01047           x5val02 = 0.;
01048           x5val03 = 0.;
01049           for ( int i = -2; i <= +2; i++ ) {
01050             for ( int j = -2; j <= +2; j++ ) {
01051 
01052               if ( h01_[ism-1] ) x5val01 = x5val01 + h01_[ism-1]->GetBinError(ie+i, ip+j) *
01053                                    h01_[ism-1]->GetBinError(ie+i, ip+j);
01054 
01055               if ( h02_[ism-1] ) x5val02 = x5val02 + h02_[ism-1]->GetBinError(ie+i, ip+j) *
01056                                    h02_[ism-1]->GetBinError(ie+i, ip+j);
01057 
01058               if ( h03_[ism-1] ) x5val03 = x5val03 + h03_[ism-1]->GetBinError(ie+i, ip+j) *
01059                                    h03_[ism-1]->GetBinError(ie+i, ip+j);
01060 
01061             }
01062           }
01063           x5val01 = x5val01 / (25.*25.);
01064           x5val02 = x5val02 / (25.*25.);
01065           x5val03 = x5val03 / (25.*25.);
01066 
01067           y5val01 = 0.;
01068           if ( k01_[ism-1] ) y5val01 = k01_[ism-1]->GetBinError(ie, ip) *
01069                                k01_[ism-1]->GetBinError(ie, ip);
01070 
01071           y5val02 = 0.;
01072           if ( k02_[ism-1] ) y5val02 = k02_[ism-1]->GetBinError(ie, ip) *
01073                                k02_[ism-1]->GetBinError(ie, ip);
01074 
01075           y5val03 = 0.;
01076           if ( k03_[ism-1] ) y5val03 = k03_[ism-1]->GetBinError(ie, ip) *
01077                                k03_[ism-1]->GetBinError(ie, ip);
01078 
01079           z5val01 = -999.;
01080           if ( x5val01 != 0 && y5val01 != 0 ) z5val01 = sqrt(std::abs(x5val01 - y5val01));
01081           if ( (x5val01 - y5val01) < 0 ) z5val01 = -z5val01;
01082 
01083           if ( met01_[ism-1] ) met01_[ism-1]->setBinContent(ie, ip, z5val01);
01084 
01085           z5val02 = -999.;
01086           if ( x5val02 != 0 && y5val02 != 0 ) z5val02 = sqrt(std::abs(x5val02 - y5val02));
01087           if ( (x5val02 - y5val02) < 0 ) z5val02 = -z5val02;
01088 
01089           if ( met02_[ism-1] ) met02_[ism-1]->setBinContent(ie, ip, z5val02);
01090 
01091           z5val03 = -999.;
01092           if ( x5val03 != 0 && y5val03 != 0 ) z5val03 = sqrt(std::abs(x5val03 - y5val03));
01093           if ( (x5val03 - y5val03) < 0 ) z5val03 = -z5val03;
01094 
01095           if ( met03_[ism-1] ) met03_[ism-1]->setBinContent(ie, ip, z5val03);
01096 
01097         }
01098 
01099       }
01100     }
01101 #endif
01102 
01103   }
01104 
01105 }
01106