CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/EcalEndcapMonitorClient/src/EELedClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EELedClient.cc
00003  *
00004  * $Date: 2012/04/27 13:46:07 $
00005  * $Revision: 1.133 $
00006  * \author G. Della Ricca
00007  * \author G. Franzoni
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/MonLed1Dat.h"
00024 #include "OnlineDB/EcalCondDB/interface/MonLed2Dat.h"
00025 #include "OnlineDB/EcalCondDB/interface/MonPNLed1Dat.h"
00026 #include "OnlineDB/EcalCondDB/interface/MonPNLed2Dat.h"
00027 #include "OnlineDB/EcalCondDB/interface/MonTimingLed2CrystalDat.h"
00028 #include "OnlineDB/EcalCondDB/interface/MonTimingLed1CrystalDat.h"
00029 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00030 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00031 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00032 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00033 #include "DQM/EcalCommon/interface/LogicID.h"
00034 #endif
00035 
00036 #include "DQM/EcalCommon/interface/Masks.h"
00037 
00038 #include "DQM/EcalCommon/interface/UtilsClient.h"
00039 #include "DQM/EcalCommon/interface/Numbers.h"
00040 
00041 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00042 
00043 #include "DQM/EcalEndcapMonitorClient/interface/EELedClient.h"
00044 
00045 EELedClient::EELedClient(const edm::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<std::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<std::vector<int> >("superModules", superModules_);
00066 
00067   ledWavelengths_.reserve(2);
00068   for ( unsigned int i = 1; i <= 2; i++ ) ledWavelengths_.push_back(i);
00069   ledWavelengths_ = ps.getUntrackedParameter<std::vector<int> >("ledWavelengths", ledWavelengths_);
00070 
00071   if ( verbose_ ) {
00072     std::cout << " Led wavelengths:" << std::endl;
00073     for ( unsigned int i = 0; i < ledWavelengths_.size(); i++ ) {
00074       std::cout << " " << ledWavelengths_[i];
00075     }
00076     std::cout << std::endl;
00077   }
00078 
00079   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00080 
00081     int ism = superModules_[i];
00082 
00083     h01_[ism-1] = 0;
00084     h02_[ism-1] = 0;
00085     h03_[ism-1] = 0;
00086     h04_[ism-1] = 0;
00087 
00088     h09_[ism-1] = 0;
00089     h10_[ism-1] = 0;
00090 
00091     hs01_[ism-1] = 0;
00092     hs02_[ism-1] = 0;
00093 
00094     i01_[ism-1] = 0;
00095     i02_[ism-1] = 0;
00096 
00097     i05_[ism-1] = 0;
00098     i06_[ism-1] = 0;
00099 
00100     i09_[ism-1] = 0;
00101     i10_[ism-1] = 0;
00102 
00103     i13_[ism-1] = 0;
00104     i14_[ism-1] = 0;
00105 
00106   }
00107 
00108   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00109 
00110     int ism = superModules_[i];
00111 
00112     meg01_[ism-1] = 0;
00113     meg02_[ism-1] = 0;
00114 
00115     meg05_[ism-1] = 0;
00116     meg06_[ism-1] = 0;
00117 
00118     meg09_[ism-1] = 0;
00119     meg10_[ism-1] = 0;
00120 
00121     mea01_[ism-1] = 0;
00122     mea02_[ism-1] = 0;
00123 
00124     met01_[ism-1] = 0;
00125     met02_[ism-1] = 0;
00126 
00127     metav01_[ism-1] = 0;
00128     metav02_[ism-1] = 0;
00129 
00130     metrms01_[ism-1] = 0;
00131     metrms02_[ism-1] = 0;
00132 
00133     meaopn01_[ism-1] = 0;
00134     meaopn02_[ism-1] = 0;
00135 
00136     mepnprms01_[ism-1] = 0;
00137     mepnprms02_[ism-1] = 0;
00138 
00139     mepnprms05_[ism-1] = 0;
00140     mepnprms06_[ism-1] = 0;
00141 
00142     me_hs01_[ism-1] = 0;
00143     me_hs02_[ism-1] = 0;
00144 
00145   }
00146 
00147   percentVariation01_ = 999.; // not used nor not normalized VPTs
00148   percentVariation03_ = 999.; // not used nor not normalized VPTs
00149 
00150   amplitudeThreshold01_ = 2.;
00151   amplitudeThreshold03_ = 2.;
00152 
00153   rmsThreshold01_ = 10.;
00154   rmsThreshold03_ = 10.;
00155 
00156   amplitudeThresholdPnG01_ = 100.;
00157   amplitudeThresholdPnG16_ = 100.;
00158 
00159   pedPnExpectedMean_[0] = 750.0;
00160   pedPnExpectedMean_[1] = 750.0;
00161 
00162   pedPnDiscrepancyMean_[0] = 100.0;
00163   pedPnDiscrepancyMean_[1] = 100.0;
00164 
00165   pedPnRMSThreshold_[0] = 10.;
00166   pedPnRMSThreshold_[1] = 10.;
00167 
00168 }
00169 
00170 EELedClient::~EELedClient() {
00171 
00172 }
00173 
00174 void EELedClient::beginJob(void) {
00175 
00176   dqmStore_ = edm::Service<DQMStore>().operator->();
00177 
00178   if ( debug_ ) std::cout << "EELedClient: beginJob" << std::endl;
00179 
00180   ievt_ = 0;
00181   jevt_ = 0;
00182 
00183 }
00184 
00185 void EELedClient::beginRun(void) {
00186 
00187   if ( debug_ ) std::cout << "EELedClient: beginRun" << std::endl;
00188 
00189   jevt_ = 0;
00190 
00191   this->setup();
00192 
00193 }
00194 
00195 void EELedClient::endJob(void) {
00196 
00197   if ( debug_ ) std::cout << "EELedClient: endJob, ievt = " << ievt_ << std::endl;
00198 
00199   this->cleanup();
00200 
00201 }
00202 
00203 void EELedClient::endRun(void) {
00204 
00205   if ( debug_ ) std::cout << "EELedClient: endRun, jevt = " << jevt_ << std::endl;
00206 
00207   this->cleanup();
00208 
00209 }
00210 
00211 void EELedClient::setup(void) {
00212 
00213   std::string name;
00214 
00215   dqmStore_->setCurrentFolder( prefixME_ + "/EELedClient" );
00216 
00217   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00218 
00219     int ism = superModules_[i];
00220 
00221     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00222       if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00223       name = "EELDT led quality L1 " + Numbers::sEE(ism);
00224       meg01_[ism-1] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00225       meg01_[ism-1]->setAxisTitle("ix", 1);
00226       if ( ism >= 1 && ism <= 9 ) meg01_[ism-1]->setAxisTitle("101-ix", 1);
00227       meg01_[ism-1]->setAxisTitle("iy", 2);
00228     }
00229     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00230       if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00231       name = "EELDT led quality L2 " + Numbers::sEE(ism);
00232       meg02_[ism-1] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00233       meg02_[ism-1]->setAxisTitle("ix", 1);
00234       if ( ism >= 1 && ism <= 9 ) meg02_[ism-1]->setAxisTitle("101-ix", 1);
00235       meg02_[ism-1]->setAxisTitle("iy", 2);
00236     }
00237 
00238     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00239       if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00240       name = "EELDT led quality L1 PNs G01 " + Numbers::sEE(ism);
00241       meg05_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00242       meg05_[ism-1]->setAxisTitle("pseudo-strip", 1);
00243       meg05_[ism-1]->setAxisTitle("channel", 2);
00244     }
00245     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00246       if ( meg06_[ism-1] ) dqmStore_->removeElement( meg06_[ism-1]->getName() );
00247       name = "EELDT led quality L2 PNs G01 " + Numbers::sEE(ism);
00248       meg06_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00249       meg06_[ism-1]->setAxisTitle("pseudo-strip", 1);
00250       meg06_[ism-1]->setAxisTitle("channel", 2);
00251     }
00252 
00253     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00254       if ( meg09_[ism-1] ) dqmStore_->removeElement( meg09_[ism-1]->getName() );
00255       name = "EELDT led quality L1 PNs G16 " + Numbers::sEE(ism);
00256       meg09_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00257       meg09_[ism-1]->setAxisTitle("pseudo-strip", 1);
00258       meg09_[ism-1]->setAxisTitle("channel", 2);
00259     }
00260     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00261       if ( meg10_[ism-1] ) dqmStore_->removeElement( meg10_[ism-1]->getName() );
00262       name = "EELDT led quality L2 PNs G16 " + Numbers::sEE(ism);
00263       meg10_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00264       meg10_[ism-1]->setAxisTitle("pseudo-strip", 1);
00265       meg10_[ism-1]->setAxisTitle("channel", 2);
00266     }
00267 
00268     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00269       if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );;
00270       name = "EELDT amplitude L1 " + Numbers::sEE(ism);
00271       mea01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00272       mea01_[ism-1]->setAxisTitle("channel", 1);
00273       mea01_[ism-1]->setAxisTitle("amplitude", 2);
00274     }
00275     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00276       if ( mea02_[ism-1] ) dqmStore_->removeElement( mea02_[ism-1]->getName() );
00277       name = "EELDT amplitude L2 " + Numbers::sEE(ism);
00278       mea02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00279       mea02_[ism-1]->setAxisTitle("channel", 1);
00280       mea02_[ism-1]->setAxisTitle("amplitude", 2);
00281     }
00282 
00283     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00284       if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00285       name = "EELDT led timing L1 " + Numbers::sEE(ism);
00286       met01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00287       met01_[ism-1]->setAxisTitle("channel", 1);
00288       met01_[ism-1]->setAxisTitle("jitter", 2);
00289     }
00290     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00291       if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00292       name = "EELDT led timing L2 " + Numbers::sEE(ism);
00293       met02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00294       met02_[ism-1]->setAxisTitle("channel", 1);
00295       met02_[ism-1]->setAxisTitle("jitter", 2);
00296     }
00297 
00298     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00299       if ( metav01_[ism-1] ) dqmStore_->removeElement( metav01_[ism-1]->getName() );
00300       name = "EELDT led timing mean L1 " + Numbers::sEE(ism);
00301       metav01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00302       metav01_[ism-1]->setAxisTitle("mean", 1);
00303     }
00304     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00305       if ( metav02_[ism-1] ) dqmStore_->removeElement( metav02_[ism-1]->getName() );
00306       name = "EELDT led timing mean L2 " + Numbers::sEE(ism);
00307       metav02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00308       metav02_[ism-1]->setAxisTitle("mean", 1);
00309     }
00310 
00311     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00312       if ( metrms01_[ism-1] ) dqmStore_->removeElement( metrms01_[ism-1]->getName() );
00313       name = "EELDT led timing rms L1 " + Numbers::sEE(ism);
00314       metrms01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00315       metrms01_[ism-1]->setAxisTitle("rms", 1);
00316     }
00317     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00318       if ( metrms02_[ism-1] ) dqmStore_->removeElement( metrms02_[ism-1]->getName() );
00319       name = "EELDT led timing rms L2 " + Numbers::sEE(ism);
00320       metrms02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00321       metrms02_[ism-1]->setAxisTitle("rms", 1);
00322     }
00323 
00324     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00325       if ( meaopn01_[ism-1] ) dqmStore_->removeElement( meaopn01_[ism-1]->getName() );
00326       name = "EELDT amplitude over PN L1 " + Numbers::sEE(ism);
00327       meaopn01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00328       meaopn01_[ism-1]->setAxisTitle("channel", 1);
00329       meaopn01_[ism-1]->setAxisTitle("amplitude/PN", 2);
00330     }
00331     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00332       if ( meaopn02_[ism-1] ) dqmStore_->removeElement( meaopn02_[ism-1]->getName() );
00333       name = "EELDT amplitude over PN L2 " + Numbers::sEE(ism);
00334       meaopn02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00335       meaopn02_[ism-1]->setAxisTitle("channel", 1);
00336       meaopn02_[ism-1]->setAxisTitle("amplitude/PN", 2);
00337     }
00338 
00339     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00340       if ( mepnprms01_[ism-1] ) dqmStore_->removeElement( mepnprms01_[ism-1]->getName() );
00341       name = "EELDT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L1";
00342       mepnprms01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00343       mepnprms01_[ism-1]->setAxisTitle("rms", 1);
00344     }
00345     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00346       if ( mepnprms02_[ism-1] ) dqmStore_->removeElement( mepnprms02_[ism-1]->getName() );
00347       name = "EELDT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L2";
00348       mepnprms02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00349       mepnprms02_[ism-1]->setAxisTitle("rms", 1);
00350     }
00351 
00352     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00353       if ( mepnprms05_[ism-1] ) dqmStore_->removeElement( mepnprms05_[ism-1]->getName() );
00354       name = "EELDT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L1";
00355       mepnprms05_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00356       mepnprms05_[ism-1]->setAxisTitle("rms", 1);
00357     }
00358     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00359       if ( mepnprms06_[ism-1] ) dqmStore_->removeElement( mepnprms06_[ism-1]->getName() );
00360       name = "EELDT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L2";
00361       mepnprms06_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00362       mepnprms06_[ism-1]->setAxisTitle("rms", 1);
00363     }
00364 
00365     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00366       if ( me_hs01_[ism-1] ) dqmStore_->removeElement( me_hs01_[ism-1]->getName() );
00367       name = "EELDT led shape L1 " + Numbers::sEE(ism);
00368       me_hs01_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00369       me_hs01_[ism-1]->setAxisTitle("sample", 1);
00370       me_hs01_[ism-1]->setAxisTitle("amplitude", 2);
00371     }
00372     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00373       if ( me_hs02_[ism-1] ) dqmStore_->removeElement( me_hs02_[ism-1]->getName() );
00374       name = "EELDT led shape L2 " + Numbers::sEE(ism);
00375       me_hs02_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00376       me_hs02_[ism-1]->setAxisTitle("sample", 1);
00377       me_hs02_[ism-1]->setAxisTitle("amplitude", 2);
00378     }
00379 
00380   }
00381 
00382   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00383 
00384     int ism = superModules_[i];
00385 
00386     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00387     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00388 
00389     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00390     if ( meg06_[ism-1] ) meg06_[ism-1]->Reset();
00391 
00392     if ( meg09_[ism-1] ) meg09_[ism-1]->Reset();
00393     if ( meg10_[ism-1] ) meg10_[ism-1]->Reset();
00394 
00395     for ( int ix = 1; ix <= 50; ix++ ) {
00396       for ( int iy = 1; iy <= 50; iy++ ) {
00397 
00398         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 6. );
00399         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 6. );
00400 
00401         int jx = ix + Numbers::ix0EE(ism);
00402         int jy = iy + Numbers::iy0EE(ism);
00403 
00404         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00405 
00406         if ( Numbers::validEE(ism, jx, jy) ) {
00407           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2. );
00408           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 2. );
00409         }
00410 
00411       }
00412     }
00413 
00414     for ( int i = 1; i <= 10; i++ ) {
00415 
00416         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 6. );
00417         if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 6. );
00418 
00419         if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 6. );
00420         if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 6. );
00421 
00422         // non-existing mem
00423         if ( (ism >=  3 && ism <=  4) || (ism >=  7 && ism <=  9) ) continue;
00424         if ( (ism >= 12 && ism <= 13) || (ism >= 16 && ism <= 18) ) continue;
00425 
00426         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00427         if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 2. );
00428 
00429         if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 2. );
00430         if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 2. );
00431 
00432     }
00433 
00434     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
00435     if ( mea02_[ism-1] ) mea02_[ism-1]->Reset();
00436 
00437     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00438     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00439 
00440     if ( metav01_[ism-1] ) metav01_[ism-1]->Reset();
00441     if ( metav02_[ism-1] ) metav02_[ism-1]->Reset();
00442 
00443     if ( metrms01_[ism-1] ) metrms01_[ism-1]->Reset();
00444     if ( metrms02_[ism-1] ) metrms02_[ism-1]->Reset();
00445 
00446     if ( meaopn01_[ism-1] ) meaopn01_[ism-1]->Reset();
00447     if ( meaopn02_[ism-1] ) meaopn02_[ism-1]->Reset();
00448 
00449     if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Reset();
00450     if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Reset();
00451 
00452     if ( mepnprms05_[ism-1] ) mepnprms05_[ism-1]->Reset();
00453     if ( mepnprms06_[ism-1] ) mepnprms06_[ism-1]->Reset();
00454 
00455     if ( me_hs01_[ism-1] ) me_hs01_[ism-1]->Reset();
00456     if ( me_hs02_[ism-1] ) me_hs02_[ism-1]->Reset();
00457 
00458   }
00459 
00460 }
00461 
00462 void EELedClient::cleanup(void) {
00463 
00464   if ( ! enableCleanup_ ) return;
00465 
00466   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00467 
00468     int ism = superModules_[i];
00469 
00470     if ( cloneME_ ) {
00471       if ( h01_[ism-1] ) delete h01_[ism-1];
00472       if ( h02_[ism-1] ) delete h02_[ism-1];
00473       if ( h03_[ism-1] ) delete h03_[ism-1];
00474       if ( h04_[ism-1] ) delete h04_[ism-1];
00475 
00476       if ( h09_[ism-1] ) delete h09_[ism-1];
00477       if ( h10_[ism-1] ) delete h10_[ism-1];
00478 
00479       if ( hs01_[ism-1] ) delete hs01_[ism-1];
00480       if ( hs02_[ism-1] ) delete hs02_[ism-1];
00481 
00482       if ( i01_[ism-1] ) delete i01_[ism-1];
00483       if ( i02_[ism-1] ) delete i02_[ism-1];
00484 
00485       if ( i05_[ism-1] ) delete i05_[ism-1];
00486       if ( i06_[ism-1] ) delete i06_[ism-1];
00487 
00488       if ( i09_[ism-1] ) delete i09_[ism-1];
00489       if ( i10_[ism-1] ) delete i10_[ism-1];
00490 
00491       if ( i13_[ism-1] ) delete i13_[ism-1];
00492       if ( i14_[ism-1] ) delete i14_[ism-1];
00493     }
00494 
00495     h01_[ism-1] = 0;
00496     h02_[ism-1] = 0;
00497     h03_[ism-1] = 0;
00498     h04_[ism-1] = 0;
00499 
00500     h09_[ism-1] = 0;
00501     h10_[ism-1] = 0;
00502 
00503     hs01_[ism-1] = 0;
00504     hs02_[ism-1] = 0;
00505 
00506     i01_[ism-1] = 0;
00507     i02_[ism-1] = 0;
00508 
00509     i05_[ism-1] = 0;
00510     i06_[ism-1] = 0;
00511 
00512     i09_[ism-1] = 0;
00513     i10_[ism-1] = 0;
00514 
00515     i13_[ism-1] = 0;
00516     i14_[ism-1] = 0;
00517 
00518   }
00519 
00520   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00521 
00522     int ism = superModules_[i];
00523 
00524     dqmStore_->setCurrentFolder( prefixME_ + "/EELedClient" );
00525 
00526     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00527     meg01_[ism-1] = 0;
00528     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00529     meg02_[ism-1] = 0;
00530 
00531     if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00532     meg05_[ism-1] = 0;
00533     if ( meg06_[ism-1] ) dqmStore_->removeElement( meg06_[ism-1]->getName() );
00534     meg06_[ism-1] = 0;
00535 
00536     if ( meg09_[ism-1] ) dqmStore_->removeElement( meg09_[ism-1]->getName() );
00537     meg09_[ism-1] = 0;
00538     if ( meg10_[ism-1] ) dqmStore_->removeElement( meg10_[ism-1]->getName() );
00539     meg10_[ism-1] = 0;
00540 
00541     if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
00542     mea01_[ism-1] = 0;
00543     if ( mea02_[ism-1] ) dqmStore_->removeElement( mea02_[ism-1]->getName() );
00544     mea02_[ism-1] = 0;
00545 
00546     if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00547     met01_[ism-1] = 0;
00548     if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00549     met02_[ism-1] = 0;
00550 
00551     if ( metav01_[ism-1] ) dqmStore_->removeElement( metav01_[ism-1]->getName() );
00552     metav01_[ism-1] = 0;
00553     if ( metav02_[ism-1] ) dqmStore_->removeElement( metav02_[ism-1]->getName() );
00554     metav02_[ism-1] = 0;
00555 
00556     if ( metrms01_[ism-1] ) dqmStore_->removeElement( metrms01_[ism-1]->getName() );
00557     metrms01_[ism-1] = 0;
00558     if ( metrms02_[ism-1] ) dqmStore_->removeElement( metrms02_[ism-1]->getName() );
00559     metrms02_[ism-1] = 0;
00560 
00561     if ( meaopn01_[ism-1] ) dqmStore_->removeElement( meaopn01_[ism-1]->getName() );
00562     meaopn01_[ism-1] = 0;
00563     if ( meaopn02_[ism-1] ) dqmStore_->removeElement( meaopn02_[ism-1]->getName() );
00564     meaopn02_[ism-1] = 0;
00565 
00566     if ( mepnprms01_[ism-1] ) dqmStore_->removeElement( mepnprms01_[ism-1]->getName() );
00567     mepnprms01_[ism-1] = 0;
00568     if ( mepnprms02_[ism-1] ) dqmStore_->removeElement( mepnprms02_[ism-1]->getName() );
00569     mepnprms02_[ism-1] = 0;
00570 
00571     if ( mepnprms05_[ism-1] ) dqmStore_->removeElement( mepnprms05_[ism-1]->getName() );
00572     mepnprms05_[ism-1] = 0;
00573     if ( mepnprms06_[ism-1] ) dqmStore_->removeElement( mepnprms06_[ism-1]->getName() );
00574     mepnprms06_[ism-1] = 0;
00575 
00576     if ( me_hs01_[ism-1] ) dqmStore_->removeElement( me_hs01_[ism-1]->getName() );
00577     me_hs01_[ism-1] = 0;
00578     if ( me_hs02_[ism-1] ) dqmStore_->removeElement( me_hs02_[ism-1]->getName() );
00579     me_hs02_[ism-1] = 0;
00580 
00581   }
00582 
00583 }
00584 
00585 #ifdef WITH_ECAL_COND_DB
00586 bool EELedClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00587 
00588   status = true;
00589 
00590   EcalLogicID ecid;
00591 
00592   MonLed1Dat vpt_l1;
00593   std::map<EcalLogicID, MonLed1Dat> dataset1_l1;
00594   MonLed2Dat vpt_l2;
00595   std::map<EcalLogicID, MonLed2Dat> dataset1_l2;
00596 
00597   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00598 
00599     int ism = superModules_[i];
00600 
00601     if ( verbose_ ) {
00602       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00603       std::cout << std::endl;
00604     }
00605 
00606     if ( verbose_ ) {
00607       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00608         UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
00609       }
00610       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00611         UtilsClient::printBadChannels(meg02_[ism-1], h03_[ism-1]);
00612       }
00613     }
00614 
00615     for ( int ix = 1; ix <= 50; ix++ ) {
00616       for ( int iy = 1; iy <= 50; iy++ ) {
00617 
00618         int jx = ix + Numbers::ix0EE(ism);
00619         int jy = iy + Numbers::iy0EE(ism);
00620 
00621         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00622 
00623         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00624 
00625         bool update01;
00626         bool update02;
00627         bool update03;
00628         bool update04;
00629 
00630         float num01, num02, num03, num04;
00631         float mean01, mean02, mean03, mean04;
00632         float rms01, rms02, rms03, rms04;
00633 
00634         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
00635         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
00636         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
00637         update04 = UtilsClient::getBinStatistics(h04_[ism-1], ix, iy, num04, mean04, rms04);
00638 
00639         if ( update01 || update02 ) {
00640 
00641           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00642 
00643             if ( verbose_ ) {
00644               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00645               std::cout << "L1 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01 << " " << mean01 << " " << rms01 << std::endl;
00646               std::cout << std::endl;
00647             }
00648 
00649           }
00650 
00651           vpt_l1.setVPTMean(mean01);
00652           vpt_l1.setVPTRMS(rms01);
00653 
00654           vpt_l1.setVPTOverPNMean(mean02);
00655           vpt_l1.setVPTOverPNRMS(rms02);
00656 
00657           if ( UtilsClient::getBinStatus(meg01_[ism-1], ix, iy) ) {
00658             vpt_l1.setTaskStatus(true);
00659           } else {
00660             vpt_l1.setTaskStatus(false);
00661           }
00662 
00663           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ix, iy);
00664 
00665           int ic = Numbers::indexEE(ism, jx, jy);
00666 
00667           if ( ic == -1 ) continue;
00668 
00669           if ( econn ) {
00670             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00671             dataset1_l1[ecid] = vpt_l1;
00672           }
00673 
00674         }
00675 
00676         if ( update03 || update04 ) {
00677 
00678           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00679 
00680             if ( verbose_ ) {
00681               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00682               std::cout << "L2 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num03 << " " << mean03 << " " << rms03 << std::endl;
00683               std::cout << std::endl;
00684             }
00685 
00686           }
00687 
00688           vpt_l2.setVPTMean(mean03);
00689           vpt_l2.setVPTRMS(rms03);
00690 
00691           vpt_l2.setVPTOverPNMean(mean04);
00692           vpt_l2.setVPTOverPNRMS(rms04);
00693 
00694           if ( UtilsClient::getBinStatus(meg02_[ism-1], ix, iy) ) {
00695             vpt_l2.setTaskStatus(true);
00696           } else {
00697             vpt_l2.setTaskStatus(false);
00698           }
00699 
00700           status = status && UtilsClient::getBinQuality(meg02_[ism-1], ix, iy);
00701 
00702           int ic = Numbers::indexEE(ism, jx, jy);
00703 
00704           if ( ic == -1 ) continue;
00705 
00706           if ( econn ) {
00707             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00708             dataset1_l2[ecid] = vpt_l2;
00709           }
00710 
00711         }
00712 
00713       }
00714     }
00715 
00716   }
00717 
00718   if ( econn ) {
00719     try {
00720       if ( verbose_ ) std::cout << "Inserting MonLedDat ..." << std::endl;
00721       if ( dataset1_l1.size() != 0 ) econn->insertDataArraySet(&dataset1_l1, moniov);
00722       if ( dataset1_l2.size() != 0 ) econn->insertDataArraySet(&dataset1_l2, moniov);
00723       if ( verbose_ ) std::cout << "done." << std::endl;
00724     } catch (std::runtime_error &e) {
00725       std::cerr << e.what() << std::endl;
00726     }
00727   }
00728 
00729   if ( verbose_ ) std::cout << std::endl;
00730 
00731   MonPNLed1Dat pn_l1;
00732   std::map<EcalLogicID, MonPNLed1Dat> dataset2_l1;
00733   MonPNLed2Dat pn_l2;
00734   std::map<EcalLogicID, MonPNLed2Dat> dataset2_l2;
00735 
00736   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00737 
00738     int ism = superModules_[i];
00739 
00740     if ( verbose_ ) {
00741       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00742       std::cout << std::endl;
00743     }
00744 
00745     if ( verbose_ ) {
00746       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00747         UtilsClient::printBadChannels(meg05_[ism-1], i01_[ism-1]);
00748         UtilsClient::printBadChannels(meg05_[ism-1], i05_[ism-1]);
00749       }
00750       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00751         UtilsClient::printBadChannels(meg06_[ism-1], i02_[ism-1]);
00752         UtilsClient::printBadChannels(meg06_[ism-1], i06_[ism-1]);
00753       }
00754 
00755       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
00756         UtilsClient::printBadChannels(meg09_[ism-1], i09_[ism-1]);
00757         UtilsClient::printBadChannels(meg09_[ism-1], i13_[ism-1]);
00758       }
00759       if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
00760         UtilsClient::printBadChannels(meg10_[ism-1], i10_[ism-1]);
00761         UtilsClient::printBadChannels(meg10_[ism-1], i14_[ism-1]);
00762       }
00763     }
00764 
00765     for ( int i = 1; i <= 10; i++ ) {
00766 
00767       bool update01;
00768       bool update02;
00769 
00770       bool update05;
00771       bool update06;
00772 
00773       bool update09;
00774       bool update10;
00775 
00776       bool update13;
00777       bool update14;
00778 
00779       float num01, num02, num05, num06;
00780       float num09, num10, num13, num14;
00781       float mean01, mean02, mean05, mean06;
00782       float mean09, mean10, mean13, mean14;
00783       float rms01, rms02, rms05, rms06;
00784       float rms09, rms10, rms13, rms14;
00785 
00786       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
00787       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
00788 
00789       update05 = UtilsClient::getBinStatistics(i05_[ism-1], i, 0, num05, mean05, rms05);
00790       update06 = UtilsClient::getBinStatistics(i06_[ism-1], i, 0, num06, mean06, rms06);
00791 
00792       update09 = UtilsClient::getBinStatistics(i09_[ism-1], i, 0, num09, mean09, rms09);
00793       update10 = UtilsClient::getBinStatistics(i10_[ism-1], i, 0, num10, mean10, rms10);
00794 
00795       update13 = UtilsClient::getBinStatistics(i13_[ism-1], i, 0, num13, mean13, rms13);
00796       update14 = UtilsClient::getBinStatistics(i14_[ism-1], i, 0, num14, mean14, rms14);
00797 
00798       if ( update01 || update05 || update09 || update13 ) {
00799 
00800         if ( i == 1 ) {
00801 
00802           if ( verbose_ ) {
00803             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00804             std::cout << "PNs (" << i << ") L1 G01 " << num01  << " " << mean01 << " " << rms01  << std::endl;
00805             std::cout << "PNs (" << i << ") L1 G16 " << num09  << " " << mean09 << " " << rms09  << std::endl;
00806             std::cout << std::endl;
00807           }
00808 
00809         }
00810 
00811         pn_l1.setADCMeanG1(mean01);
00812         pn_l1.setADCRMSG1(rms01);
00813 
00814         pn_l1.setPedMeanG1(mean05);
00815         pn_l1.setPedRMSG1(rms05);
00816 
00817         pn_l1.setADCMeanG16(mean09);
00818         pn_l1.setADCRMSG16(rms09);
00819 
00820         pn_l1.setPedMeanG16(mean13);
00821         pn_l1.setPedRMSG16(rms13);
00822 
00823         if ( UtilsClient::getBinStatus(meg05_[ism-1], i, 1) ||
00824              UtilsClient::getBinStatus(meg09_[ism-1], i, 1) ) {
00825           pn_l1.setTaskStatus(true);
00826         } else {
00827           pn_l1.setTaskStatus(false);
00828         }
00829 
00830         status = status && ( UtilsClient::getBinQuality(meg05_[ism-1], i, 1) ||
00831                              UtilsClient::getBinQuality(meg09_[ism-1], i, 1) );
00832 
00833         if ( econn ) {
00834           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
00835           dataset2_l1[ecid] = pn_l1;
00836         }
00837 
00838       }
00839 
00840       if ( update02 || update06 || update10 || update14 ) {
00841 
00842         if ( i == 1 ) {
00843 
00844           if ( verbose_ ) {
00845             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00846             std::cout << "PNs (" << i << ") L2 G01 " << num02  << " " << mean02 << " " << rms02  << std::endl;
00847             std::cout << "PNs (" << i << ") L2 G16 " << num10  << " " << mean10 << " " << rms10  << std::endl;
00848             std::cout << std::endl;
00849           }
00850 
00851         }
00852 
00853         pn_l2.setADCMeanG1(mean02);
00854         pn_l2.setADCRMSG1(rms02);
00855 
00856         pn_l2.setPedMeanG1(mean06);
00857         pn_l2.setPedRMSG1(rms06);
00858 
00859         pn_l2.setADCMeanG16(mean10);
00860         pn_l2.setADCRMSG16(rms10);
00861 
00862         pn_l2.setPedMeanG16(mean14);
00863         pn_l2.setPedRMSG16(rms14);
00864 
00865         if ( UtilsClient::getBinStatus(meg06_[ism-1], i, 1) ||
00866              UtilsClient::getBinStatus(meg10_[ism-1], i, 1) ) {
00867           pn_l2.setTaskStatus(true);
00868         } else {
00869           pn_l2.setTaskStatus(false);
00870         }
00871 
00872         status = status && ( UtilsClient::getBinQuality(meg06_[ism-1], i, 1) ||
00873                              UtilsClient::getBinQuality(meg10_[ism-1], i, 1) );
00874 
00875         if ( econn ) {
00876           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
00877           dataset2_l2[ecid] = pn_l2;
00878         }
00879 
00880       }
00881 
00882     }
00883 
00884   }
00885 
00886   if ( econn ) {
00887     try {
00888       if ( verbose_ ) std::cout << "Inserting MonPnDat ..." << std::endl;
00889       if ( dataset2_l1.size() != 0 ) econn->insertDataArraySet(&dataset2_l1, moniov);
00890       if ( dataset2_l2.size() != 0 ) econn->insertDataArraySet(&dataset2_l2, moniov);
00891       if ( verbose_ ) std::cout << "done." << std::endl;
00892     } catch (std::runtime_error &e) {
00893       std::cerr << e.what() << std::endl;
00894     }
00895   }
00896 
00897   if ( verbose_ ) std::cout << std::endl;
00898 
00899   MonTimingLed1CrystalDat t_l1;
00900   std::map<EcalLogicID, MonTimingLed1CrystalDat> dataset3_l1;
00901   MonTimingLed2CrystalDat t_l2;
00902   std::map<EcalLogicID, MonTimingLed2CrystalDat> dataset3_l2;
00903 
00904   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00905 
00906     int ism = superModules_[i];
00907 
00908     if ( verbose_ ) {
00909       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00910       std::cout << std::endl;
00911     }
00912 
00913     for ( int ix = 1; ix <= 50; ix++ ) {
00914       for ( int iy = 1; iy <= 50; iy++ ) {
00915 
00916         int jx = ix + Numbers::ix0EE(ism);
00917         int jy = iy + Numbers::iy0EE(ism);
00918 
00919         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00920 
00921         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00922 
00923         bool update01;
00924         bool update02;
00925 
00926         float num01, num02;
00927         float mean01, mean02;
00928         float rms01, rms02;
00929 
00930         update01 = UtilsClient::getBinStatistics(h09_[ism-1], ix, iy, num01, mean01, rms01);
00931         update02 = UtilsClient::getBinStatistics(h10_[ism-1], ix, iy, num02, mean02, rms02);
00932 
00933         if ( update01 ) {
00934 
00935           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00936 
00937             if ( verbose_ ) {
00938               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00939               std::cout << "L1 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01  << " " << mean01 << " " << rms01  << std::endl;
00940               std::cout << std::endl;
00941             }
00942 
00943           }
00944 
00945           t_l1.setTimingMean(mean01);
00946           t_l1.setTimingRMS(rms01);
00947 
00948           if ( UtilsClient::getBinStatus(meg01_[ism-1], ix, iy) ) {
00949             t_l1.setTaskStatus(true);
00950           } else {
00951             t_l1.setTaskStatus(false);
00952           }
00953 
00954           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ix, iy);
00955 
00956           int ic = Numbers::indexEE(ism, jx, jy);
00957 
00958           if ( ic == -1 ) continue;
00959 
00960           if ( econn ) {
00961             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00962             dataset3_l1[ecid] = t_l1;
00963           }
00964 
00965         }
00966 
00967         if ( update02 ) {
00968 
00969           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00970 
00971             if ( verbose_ ) {
00972               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00973               std::cout << "L2 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num02  << " " << mean02 << " " << rms02  << std::endl;
00974               std::cout << std::endl;
00975             }
00976 
00977           }
00978 
00979           t_l2.setTimingMean(mean02);
00980           t_l2.setTimingRMS(rms02);
00981 
00982           if ( UtilsClient::getBinStatus(meg02_[ism-1], ix, iy) ) {
00983             t_l2.setTaskStatus(true);
00984           } else {
00985             t_l2.setTaskStatus(false);
00986           }
00987 
00988           status = status && UtilsClient::getBinQuality(meg02_[ism-1], ix, iy);
00989 
00990           int ic = Numbers::indexEE(ism, jx, jy);
00991 
00992           if ( ic == -1 ) continue;
00993 
00994           if ( econn ) {
00995             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00996             dataset3_l2[ecid] = t_l2;
00997           }
00998 
00999         }
01000 
01001       }
01002     }
01003 
01004   }
01005 
01006   if ( econn ) {
01007     try {
01008       if ( verbose_ ) std::cout << "Inserting MonTimingLaserCrystalDat ..." << std::endl;
01009       if ( dataset3_l1.size() != 0 ) econn->insertDataArraySet(&dataset3_l1, moniov);
01010       if ( dataset3_l2.size() != 0 ) econn->insertDataArraySet(&dataset3_l2, moniov);
01011       if ( verbose_ ) std::cout << "done." << std::endl;
01012     } catch (std::runtime_error &e) {
01013       std::cerr << e.what() << std::endl;
01014     }
01015   }
01016 
01017   return true;
01018 
01019 }
01020 #endif
01021 
01022 void EELedClient::analyze(void) {
01023 
01024   ievt_++;
01025   jevt_++;
01026   if ( ievt_ % 10 == 0 ) {
01027     if ( debug_ ) std::cout << "EELedClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
01028   }
01029 
01030   uint32_t bits01 = 0;
01031   bits01 |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
01032   bits01 |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
01033 
01034   uint32_t bits02 = 0;
01035   bits02 |= 1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR;
01036   bits02 |= 1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR;
01037 
01038   uint32_t bits03 = 0;
01039   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
01040   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
01041 
01042   uint32_t bits04 = 0;
01043   bits04 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
01044   bits04 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
01045 
01046   MonitorElement* me;
01047 
01048   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
01049 
01050     int ism = superModules_[i];
01051 
01052     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01053 
01054       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/EELDT amplitude " + Numbers::sEE(ism) + " L1" );
01055       h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
01056 
01057       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/EELDT amplitude over PN " + Numbers::sEE(ism) + " L1" );
01058       h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
01059 
01060     }
01061 
01062     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01063 
01064       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/EELDT amplitude " + Numbers::sEE(ism) + " L2" );
01065       h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
01066 
01067       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/EELDT amplitude over PN " + Numbers::sEE(ism) + " L2" );
01068       h04_[ism-1] = UtilsClient::getHisto( me, cloneME_, h04_[ism-1] );
01069 
01070     }
01071 
01072     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01073 
01074       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/EELDT timing " + Numbers::sEE(ism) + " L1" );
01075       h09_[ism-1] = UtilsClient::getHisto( me, cloneME_, h09_[ism-1] );
01076 
01077     }
01078 
01079     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01080 
01081       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/EELDT timing " + Numbers::sEE(ism) + " L2" );
01082       h10_[ism-1] = UtilsClient::getHisto( me, cloneME_, h10_[ism-1] );
01083 
01084     }
01085 
01086     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01087 
01088       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/EELDT shape " + Numbers::sEE(ism) + " L1" );
01089       hs01_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs01_[ism-1] );
01090 
01091     }
01092 
01093     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01094 
01095       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/EELDT shape " + Numbers::sEE(ism) + " L2" );
01096       hs02_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs02_[ism-1] );
01097 
01098     }
01099 
01100     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01101 
01102       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/PN/Gain01/EELDT PNs amplitude " + Numbers::sEE(ism) + " G01 L1" );
01103       i01_[ism-1] = UtilsClient::getHisto( me, cloneME_, i01_[ism-1] );
01104 
01105     }
01106 
01107     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01108 
01109       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/PN/Gain01/EELDT PNs amplitude " + Numbers::sEE(ism) + " G01 L2" );
01110       i02_[ism-1] = UtilsClient::getHisto( me, cloneME_, i02_[ism-1] );
01111 
01112     }
01113 
01114     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01115 
01116       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/PN/Gain01/EELDT PNs pedestal " + Numbers::sEE(ism) + " G01 L1" );
01117       i05_[ism-1] = UtilsClient::getHisto( me, cloneME_, i05_[ism-1] );
01118 
01119     }
01120 
01121     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01122 
01123       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/PN/Gain01/EELDT PNs pedestal " + Numbers::sEE(ism) + " G01 L2" );
01124       i06_[ism-1] = UtilsClient::getHisto( me, cloneME_, i06_[ism-1] );
01125 
01126     }
01127 
01128     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01129 
01130       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/PN/Gain16/EELDT PNs amplitude " + Numbers::sEE(ism) + " G16 L1" );
01131       i09_[ism-1] = UtilsClient::getHisto( me, cloneME_, i09_[ism-1] );
01132 
01133     }
01134 
01135     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01136 
01137       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/PN/Gain16/EELDT PNs amplitude " + Numbers::sEE(ism) + " G16 L2" );
01138       i10_[ism-1] = UtilsClient::getHisto( me, cloneME_, i10_[ism-1] );
01139 
01140     }
01141 
01142     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
01143 
01144       me = dqmStore_->get( prefixME_ + "/EELedTask/Led1/PN/Gain16/EELDT PNs pedestal " + Numbers::sEE(ism) + " G16 L1" );
01145       i13_[ism-1] = UtilsClient::getHisto( me, cloneME_, i13_[ism-1] );
01146 
01147     }
01148 
01149     if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
01150 
01151       me = dqmStore_->get( prefixME_ + "/EELedTask/Led2/PN/Gain16/EELDT PNs pedestal " + Numbers::sEE(ism) + " G16 L2" );
01152       i14_[ism-1] = UtilsClient::getHisto( me, cloneME_, i14_[ism-1] );
01153 
01154     }
01155 
01156     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
01157     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
01158 
01159     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
01160     if ( meg06_[ism-1] ) meg06_[ism-1]->Reset();
01161 
01162     if ( meg09_[ism-1] ) meg09_[ism-1]->Reset();
01163     if ( meg10_[ism-1] ) meg10_[ism-1]->Reset();
01164 
01165     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
01166     if ( mea02_[ism-1] ) mea02_[ism-1]->Reset();
01167 
01168     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
01169     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
01170 
01171     if ( metav01_[ism-1] ) metav01_[ism-1]->Reset();
01172     if ( metav02_[ism-1] ) metav02_[ism-1]->Reset();
01173 
01174     if ( metrms01_[ism-1] ) metrms01_[ism-1]->Reset();
01175     if ( metrms02_[ism-1] ) metrms02_[ism-1]->Reset();
01176 
01177     if ( meaopn01_[ism-1] ) meaopn01_[ism-1]->Reset();
01178     if ( meaopn02_[ism-1] ) meaopn02_[ism-1]->Reset();
01179 
01180     if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Reset();
01181     if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Reset();
01182 
01183     if ( me_hs01_[ism-1] ) me_hs01_[ism-1]->Reset();
01184     if ( me_hs02_[ism-1] ) me_hs02_[ism-1]->Reset();
01185 
01186     float meanAmplL1, meanAmplL2;
01187 
01188     int nCryL1, nCryL2;
01189 
01190     meanAmplL1 = meanAmplL2 = 0.;
01191 
01192     nCryL1 = nCryL2 = 0;
01193 
01194     for ( int ix = 1; ix <= 50; ix++ ) {
01195       for ( int iy = 1; iy <= 50; iy++ ) {
01196 
01197         bool update01;
01198         bool update02;
01199 
01200         float num01, num02;
01201         float mean01, mean02;
01202         float rms01, rms02;
01203 
01204         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
01205         update02 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num02, mean02, rms02);
01206 
01207         if ( update01 ) {
01208           meanAmplL1 += mean01;
01209           nCryL1++;
01210         }
01211 
01212         if ( update02 ) {
01213           meanAmplL2 += mean02;
01214           nCryL2++;
01215         }
01216 
01217       }
01218     }
01219 
01220     if ( nCryL1 > 0 ) meanAmplL1 /= float (nCryL1);
01221     if ( nCryL2 > 0 ) meanAmplL2 /= float (nCryL2);
01222 
01223     for ( int ix = 1; ix <= 50; ix++ ) {
01224       for ( int iy = 1; iy <= 50; iy++ ) {
01225 
01226         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 6.);
01227         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 6.);
01228 
01229         int jx = ix + Numbers::ix0EE(ism);
01230         int jy = iy + Numbers::iy0EE(ism);
01231 
01232         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
01233 
01234         if ( Numbers::validEE(ism, jx, jy) ) {
01235           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2.);
01236           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 2.);
01237         }
01238 
01239         bool update01;
01240         bool update02;
01241         bool update03;
01242         bool update04;
01243 
01244         bool update09;
01245         bool update10;
01246 
01247         float num01, num02, num03, num04;
01248         float num09, num10;
01249         float mean01, mean02, mean03, mean04;
01250         float mean09, mean10;
01251         float rms01, rms02, rms03, rms04;
01252         float rms09, rms10;
01253 
01254         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
01255         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
01256         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
01257         update04 = UtilsClient::getBinStatistics(h04_[ism-1], ix, iy, num04, mean04, rms04);
01258 
01259         update09 = UtilsClient::getBinStatistics(h09_[ism-1], ix, iy, num09, mean09, rms09);
01260         update10 = UtilsClient::getBinStatistics(h10_[ism-1], ix, iy, num10, mean10, rms10);
01261 
01262         if ( update01 ) {
01263 
01264           float val;
01265 
01266           val = 1.;
01267           if ( mean01 < amplitudeThreshold01_ || rms01 > rmsThreshold01_ )
01268             val = 0.;
01269           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, val );
01270 
01271           int ic = Numbers::icEE(ism, jx, jy);
01272 
01273           if ( ic != -1 ) {
01274             if ( mea01_[ism-1] ) {
01275               if ( mean01 > 0. ) {
01276                 mea01_[ism-1]->setBinContent( ic, mean01 );
01277                 mea01_[ism-1]->setBinError( ic, rms01 );
01278               } else {
01279                 mea01_[ism-1]->setEntries( 1.+mea01_[ism-1]->getEntries() );
01280               }
01281             }
01282           }
01283 
01284         }
01285 
01286         if ( update03 ) {
01287 
01288           float val;
01289 
01290           val = 1.;
01291           if (  mean03 < amplitudeThreshold03_ || rms03 > rmsThreshold03_ )
01292             val = 0.;
01293           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, val );
01294 
01295           int ic = Numbers::icEE(ism, jx, jy);
01296 
01297           if ( ic != -1 ) {
01298             if ( mea02_[ism-1] ) {
01299               if ( mean03 > 0. ) {
01300                 mea02_[ism-1]->setBinContent( ic, mean03 );
01301                 mea02_[ism-1]->setBinError( ic, rms03 );
01302               } else {
01303                 mea02_[ism-1]->setEntries( 1.+mea02_[ism-1]->getEntries() );
01304               }
01305             }
01306           }
01307 
01308         }
01309 
01310         if ( Masks::maskChannel(ism, ix, iy, bits01, EcalEndcap) ) {
01311           UtilsClient::maskBinContent( meg01_[ism-1], ix, iy );
01312           UtilsClient::maskBinContent( meg02_[ism-1], ix, iy );
01313         }
01314 
01315         if ( update02 ) {
01316 
01317           int ic = Numbers::icEE(ism, jx, jy);
01318 
01319           if ( ic != -1 ) {
01320             if ( meaopn01_[ism-1] ) {
01321               if ( mean02 > 0. ) {
01322                 meaopn01_[ism-1]->setBinContent( ic, mean02 );
01323                 meaopn01_[ism-1]->setBinError( ic, rms02 );
01324               } else {
01325                 meaopn01_[ism-1]->setEntries( 1.+meaopn01_[ism-1]->getEntries() );
01326               }
01327             }
01328           }
01329 
01330         }
01331 
01332         if ( update04 ) {
01333 
01334           int ic = Numbers::icEE(ism, jx, jy);
01335 
01336           if ( ic != -1 ) {
01337             if ( meaopn02_[ism-1] ) {
01338               if ( mean04 > 0. ) {
01339                 meaopn02_[ism-1]->setBinContent( ic, mean04 );
01340                 meaopn02_[ism-1]->setBinError( ic, rms04 );
01341               } else {
01342                 meaopn02_[ism-1]->setEntries( 1.+meaopn02_[ism-1]->getEntries() );
01343               }
01344             }
01345           }
01346 
01347         }
01348 
01349         if ( update09 ) {
01350 
01351           int ic = Numbers::icEE(ism, jx, jy);
01352 
01353           if ( ic != -1 ) {
01354             if ( met01_[ism-1] ) {
01355               if ( mean09 > 0. ) {
01356                 met01_[ism-1]->setBinContent( ic, mean09 );
01357                 met01_[ism-1]->setBinError( ic, rms09 );
01358               } else {
01359                 met01_[ism-1]->setEntries(1.+met01_[ism-1]->getEntries());
01360               }
01361             }
01362 
01363             if ( metav01_[ism-1] ) metav01_[ism-1] ->Fill(mean09);
01364             if ( metrms01_[ism-1] ) metrms01_[ism-1]->Fill(rms09);
01365           }
01366 
01367         }
01368 
01369         if ( update10 ) {
01370 
01371           int ic = Numbers::icEE(ism, jx, jy);
01372 
01373           if ( ic != -1 ) {
01374             if ( met02_[ism-1] ) {
01375               if ( mean10 > 0. ) {
01376                 met02_[ism-1]->setBinContent( ic, mean10 );
01377                 met02_[ism-1]->setBinError( ic, rms10 );
01378               } else {
01379                 met02_[ism-1]->setEntries(1.+met02_[ism-1]->getEntries());
01380               }
01381             }
01382 
01383             if ( metav02_[ism-1] ) metav02_[ism-1] ->Fill(mean10);
01384             if ( metrms02_[ism-1] ) metrms02_[ism-1]->Fill(rms10);
01385           }
01386 
01387         }
01388 
01389       }
01390     }
01391 
01392     for ( int i = 1; i <= 10; i++ ) {
01393 
01394       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 6. );
01395       if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 6. );
01396 
01397       if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 6. );
01398       if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 6. );
01399 
01400       // non-existing mem
01401       if ( (ism >=  3 && ism <=  4) || (ism >=  7 && ism <=  9) ) continue;
01402       if ( (ism >= 12 && ism <= 13) || (ism >= 16 && ism <= 18) ) continue;
01403 
01404       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
01405       if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 2. );
01406 
01407       if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 2. );
01408       if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 2. );
01409 
01410       bool update01;
01411       bool update02;
01412 
01413       bool update05;
01414       bool update06;
01415 
01416       bool update09;
01417       bool update10;
01418 
01419       bool update13;
01420       bool update14;
01421 
01422       float num01, num02, num05, num06;
01423       float num09, num10, num13, num14;
01424       float mean01, mean02, mean05, mean06;
01425       float mean09, mean10, mean13, mean14;
01426       float rms01, rms02, rms05, rms06;
01427       float rms09, rms10, rms13, rms14;
01428 
01429       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
01430       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
01431 
01432       update05 = UtilsClient::getBinStatistics(i05_[ism-1], i, 0, num05, mean05, rms05);
01433       update06 = UtilsClient::getBinStatistics(i06_[ism-1], i, 0, num06, mean06, rms06);
01434 
01435       update09 = UtilsClient::getBinStatistics(i09_[ism-1], i, 0, num09, mean09, rms09);
01436       update10 = UtilsClient::getBinStatistics(i10_[ism-1], i, 0, num10, mean10, rms10);
01437 
01438       update13 = UtilsClient::getBinStatistics(i13_[ism-1], i, 0, num13, mean13, rms13);
01439       update14 = UtilsClient::getBinStatistics(i14_[ism-1], i, 0, num14, mean14, rms14);
01440 
01441       if ( update01 && update05 ) {
01442 
01443         float val;
01444 
01445         val = 1.;
01446         if ( mean01 < amplitudeThresholdPnG01_ )
01447           val = 0.;
01448         if ( mean05 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
01449              pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean05)
01450           val = 0.;
01451         if ( rms05 > pedPnRMSThreshold_[0] )
01452           val = 0.;
01453 
01454         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent(i, 1, val);
01455         if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Fill(rms05);
01456 
01457       }
01458 
01459       if ( update02 && update06 ) {
01460 
01461         float val;
01462 
01463         val = 1.;
01464         if ( mean02 < amplitudeThresholdPnG01_ )
01465           val = 0.;
01466         if ( mean06 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
01467              pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean06)
01468           val = 0.;
01469         if ( rms06 > pedPnRMSThreshold_[0] )
01470           val = 0.;
01471 
01472         if ( meg06_[ism-1] )           meg06_[ism-1]->setBinContent(i, 1, val);
01473         if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Fill(rms06);
01474 
01475       }
01476 
01477       if ( update09 && update13 ) {
01478 
01479         float val;
01480 
01481         val = 1.;
01482         if ( mean09 < amplitudeThresholdPnG16_ )
01483           val = 0.;
01484         if ( mean13 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
01485              pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean13)
01486           val = 0.;
01487         if ( rms13 > pedPnRMSThreshold_[1] )
01488           val = 0.;
01489 
01490         if ( meg09_[ism-1] )           meg09_[ism-1]->setBinContent(i, 1, val);
01491         if ( mepnprms05_[ism-1] ) mepnprms05_[ism-1]->Fill(rms13);
01492 
01493       }
01494 
01495       if ( update10 && update14 ) {
01496 
01497         float val;
01498 
01499         val = 1.;
01500         if ( mean10 < amplitudeThresholdPnG16_ )
01501           val = 0.;
01502         //        if ( mean14 < pedestalThresholdPn_ )
01503        if ( mean14 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
01504             pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean14)
01505            val = 0.;
01506        if ( rms14 > pedPnRMSThreshold_[1] )
01507           val = 0.;
01508 
01509        if ( meg10_[ism-1] )           meg10_[ism-1]->setBinContent(i, 1, val);
01510        if ( mepnprms06_[ism-1] ) mepnprms06_[ism-1]->Fill(rms14);
01511 
01512       }
01513 
01514       if ( Masks::maskPn(ism, i, bits01|bits03, EcalEndcap) ) {
01515         UtilsClient::maskBinContent( meg05_[ism-1], i, 1 );
01516         UtilsClient::maskBinContent( meg06_[ism-1], i, 1 );
01517       }
01518 
01519       if ( Masks::maskPn(ism, i, bits01|bits04, EcalEndcap) ) {
01520         UtilsClient::maskBinContent( meg09_[ism-1], i, 1 );
01521         UtilsClient::maskBinContent( meg10_[ism-1], i, 1 );
01522       }
01523 
01524     }
01525 
01526     for ( int i = 1; i <= 10; i++ ) {
01527 
01528       if ( hs01_[ism-1] ) {
01529         int ic = UtilsClient::getFirstNonEmptyChannel( hs01_[ism-1] );
01530         if ( me_hs01_[ism-1] ) {
01531           me_hs01_[ism-1]->setBinContent( i, hs01_[ism-1]->GetBinContent(ic, i) );
01532           me_hs01_[ism-1]->setBinError( i, hs01_[ism-1]->GetBinError(ic, i) );
01533         }
01534       }
01535 
01536       if ( hs02_[ism-1] ) {
01537         int ic = UtilsClient::getFirstNonEmptyChannel( hs02_[ism-1] );
01538         if ( me_hs02_[ism-1] ) {
01539           me_hs02_[ism-1]->setBinContent( i, hs02_[ism-1]->GetBinContent(ic, i) );
01540           me_hs02_[ism-1]->setBinError( i, hs02_[ism-1]->GetBinError(ic, i) );
01541         }
01542       }
01543 
01544     }
01545 
01546   }
01547 
01548 }
01549