CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/EcalEndcapMonitorClient/src/EELaserClient.cc

Go to the documentation of this file.
00001 /*
00002  * \file EELaserClient.cc
00003  *
00004  * $Date: 2012/04/27 13:46:07 $
00005  * $Revision: 1.146 $
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/MonLaserBlueDat.h"
00024 #include "OnlineDB/EcalCondDB/interface/MonLaserGreenDat.h"
00025 #include "OnlineDB/EcalCondDB/interface/MonLaserIRedDat.h"
00026 #include "OnlineDB/EcalCondDB/interface/MonLaserRedDat.h"
00027 #include "OnlineDB/EcalCondDB/interface/MonPNBlueDat.h"
00028 #include "OnlineDB/EcalCondDB/interface/MonPNGreenDat.h"
00029 #include "OnlineDB/EcalCondDB/interface/MonPNIRedDat.h"
00030 #include "OnlineDB/EcalCondDB/interface/MonPNRedDat.h"
00031 #include "OnlineDB/EcalCondDB/interface/MonTimingLaserBlueCrystalDat.h"
00032 #include "OnlineDB/EcalCondDB/interface/MonTimingLaserGreenCrystalDat.h"
00033 #include "OnlineDB/EcalCondDB/interface/MonTimingLaserIRedCrystalDat.h"
00034 #include "OnlineDB/EcalCondDB/interface/MonTimingLaserRedCrystalDat.h"
00035 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00036 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00037 #include "OnlineDB/EcalCondDB/interface/RunPNErrorsDat.h"
00038 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00039 #include "DQM/EcalCommon/interface/LogicID.h"
00040 #endif
00041 
00042 #include "DQM/EcalCommon/interface/Masks.h"
00043 
00044 #include "DQM/EcalCommon/interface/UtilsClient.h"
00045 #include "DQM/EcalCommon/interface/Numbers.h"
00046 
00047 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00048 
00049 #include "DQM/EcalEndcapMonitorClient/interface/EELaserClient.h"
00050 
00051 EELaserClient::EELaserClient(const edm::ParameterSet& ps) {
00052 
00053   // cloneME switch
00054   cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00055 
00056   // verbose switch
00057   verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
00058 
00059   // debug switch
00060   debug_ = ps.getUntrackedParameter<bool>("debug", false);
00061 
00062   // prefixME path
00063   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00064 
00065   // enableCleanup_ switch
00066   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00067 
00068   // vector of selected Super Modules (Defaults to all 18).
00069   superModules_.reserve(18);
00070   for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
00071   superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
00072 
00073   laserWavelengths_.reserve(4);
00074   for ( unsigned int i = 1; i <= 4; i++ ) laserWavelengths_.push_back(i);
00075   laserWavelengths_ = ps.getUntrackedParameter<std::vector<int> >("laserWavelengths", laserWavelengths_);
00076 
00077   if ( verbose_ ) {
00078     std::cout << " Laser wavelengths:" << std::endl;
00079     for ( unsigned int i = 0; i < laserWavelengths_.size(); i++ ) {
00080       std::cout << " " << laserWavelengths_[i];
00081     }
00082     std::cout << std::endl;
00083   }
00084 
00085   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00086 
00087     int ism = superModules_[i];
00088 
00089     h01_[ism-1] = 0;
00090     h02_[ism-1] = 0;
00091     h03_[ism-1] = 0;
00092     h04_[ism-1] = 0;
00093     h05_[ism-1] = 0;
00094     h06_[ism-1] = 0;
00095     h07_[ism-1] = 0;
00096     h08_[ism-1] = 0;
00097 
00098     h09_[ism-1] = 0;
00099     h10_[ism-1] = 0;
00100     h11_[ism-1] = 0;
00101     h12_[ism-1] = 0;
00102 
00103     hs01_[ism-1] = 0;
00104     hs02_[ism-1] = 0;
00105     hs03_[ism-1] = 0;
00106     hs04_[ism-1] = 0;
00107 
00108     i01_[ism-1] = 0;
00109     i02_[ism-1] = 0;
00110     i03_[ism-1] = 0;
00111     i04_[ism-1] = 0;
00112     i05_[ism-1] = 0;
00113     i06_[ism-1] = 0;
00114     i07_[ism-1] = 0;
00115     i08_[ism-1] = 0;
00116 
00117     i09_[ism-1] = 0;
00118     i10_[ism-1] = 0;
00119     i11_[ism-1] = 0;
00120     i12_[ism-1] = 0;
00121     i13_[ism-1] = 0;
00122     i14_[ism-1] = 0;
00123     i15_[ism-1] = 0;
00124     i16_[ism-1] = 0;
00125 
00126   }
00127 
00128   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00129 
00130     int ism = superModules_[i];
00131 
00132     meg01_[ism-1] = 0;
00133     meg02_[ism-1] = 0;
00134     meg03_[ism-1] = 0;
00135     meg04_[ism-1] = 0;
00136 
00137     meg05_[ism-1] = 0;
00138     meg06_[ism-1] = 0;
00139     meg07_[ism-1] = 0;
00140     meg08_[ism-1] = 0;
00141     meg09_[ism-1] = 0;
00142     meg10_[ism-1] = 0;
00143     meg11_[ism-1] = 0;
00144     meg12_[ism-1] = 0;
00145 
00146     mea01_[ism-1] = 0;
00147     mea02_[ism-1] = 0;
00148     mea03_[ism-1] = 0;
00149     mea04_[ism-1] = 0;
00150 
00151     met01_[ism-1] = 0;
00152     met02_[ism-1] = 0;
00153     met03_[ism-1] = 0;
00154     met04_[ism-1] = 0;
00155 
00156     metav01_[ism-1] = 0;
00157     metav02_[ism-1] = 0;
00158     metav03_[ism-1] = 0;
00159     metav04_[ism-1] = 0;
00160 
00161     metrms01_[ism-1] = 0;
00162     metrms02_[ism-1] = 0;
00163     metrms03_[ism-1] = 0;
00164     metrms04_[ism-1] = 0;
00165 
00166     meaopn01_[ism-1] = 0;
00167     meaopn02_[ism-1] = 0;
00168     meaopn03_[ism-1] = 0;
00169     meaopn04_[ism-1] = 0;
00170 
00171     mepnprms01_[ism-1] = 0;
00172     mepnprms02_[ism-1] = 0;
00173     mepnprms03_[ism-1] = 0;
00174     mepnprms04_[ism-1] = 0;
00175     mepnprms05_[ism-1] = 0;
00176     mepnprms06_[ism-1] = 0;
00177     mepnprms07_[ism-1] = 0;
00178     mepnprms08_[ism-1] = 0;
00179 
00180     me_hs01_[ism-1] = 0;
00181     me_hs02_[ism-1] = 0;
00182     me_hs03_[ism-1] = 0;
00183     me_hs04_[ism-1] = 0;
00184 
00185   }
00186 
00187   percentVariation_ = 999.; // not used nor not normalized VPTs
00188 
00189   amplitudeThreshold_ = 100.;
00190 
00191   rmsThresholdRelative_ = 0.3;
00192 
00193   amplitudeThresholdPnG01_ = 100.;
00194   amplitudeThresholdPnG16_ = 100.;
00195 
00196   pedPnExpectedMean_[0] = 750.0;
00197   pedPnExpectedMean_[1] = 750.0;
00198 
00199   pedPnDiscrepancyMean_[0] = 100.0;
00200   pedPnDiscrepancyMean_[1] = 100.0;
00201 
00202   pedPnRMSThreshold_[0] = 999.;
00203   pedPnRMSThreshold_[1] = 999.;
00204 
00205 }
00206 
00207 EELaserClient::~EELaserClient() {
00208 
00209 }
00210 
00211 void EELaserClient::beginJob(void) {
00212 
00213   dqmStore_ = edm::Service<DQMStore>().operator->();
00214 
00215   if ( debug_ ) std::cout << "EELaserClient: beginJob" << std::endl;
00216 
00217   ievt_ = 0;
00218   jevt_ = 0;
00219 
00220 }
00221 
00222 void EELaserClient::beginRun(void) {
00223 
00224   if ( debug_ ) std::cout << "EELaserClient: beginRun" << std::endl;
00225 
00226   jevt_ = 0;
00227 
00228   this->setup();
00229 
00230 }
00231 
00232 void EELaserClient::endJob(void) {
00233 
00234   if ( debug_ ) std::cout << "EELaserClient: endJob, ievt = " << ievt_ << std::endl;
00235 
00236   this->cleanup();
00237 
00238 }
00239 
00240 void EELaserClient::endRun(void) {
00241 
00242   if ( debug_ ) std::cout << "EELaserClient: endRun, jevt = " << jevt_ << std::endl;
00243 
00244   this->cleanup();
00245 
00246 }
00247 
00248 void EELaserClient::setup(void) {
00249 
00250   std::string name;
00251 
00252   dqmStore_->setCurrentFolder( prefixME_ + "/EELaserClient" );
00253 
00254   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00255 
00256     int ism = superModules_[i];
00257 
00258     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00259       if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00260       name = "EELT laser quality L1 " + Numbers::sEE(ism);
00261       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.);
00262       meg01_[ism-1]->setAxisTitle("ix", 1);
00263       if ( ism >= 1 && ism <= 9 ) meg01_[ism-1]->setAxisTitle("101-ix", 1);
00264       meg01_[ism-1]->setAxisTitle("iy", 2);
00265     }
00266     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00267       if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00268       name = "EELT laser quality L2 " + Numbers::sEE(ism);
00269       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.);
00270       meg02_[ism-1]->setAxisTitle("ix", 1);
00271       if ( ism >= 1 && ism <= 9 ) meg02_[ism-1]->setAxisTitle("101-ix", 1);
00272       meg02_[ism-1]->setAxisTitle("iy", 2);
00273     }
00274     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00275       if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00276       name = "EELT laser quality L3 " + Numbers::sEE(ism);
00277       meg03_[ism-1] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00278       meg03_[ism-1]->setAxisTitle("ix", 1);
00279       if ( ism >= 1 && ism <= 9 ) meg03_[ism-1]->setAxisTitle("101-ix", 1);
00280       meg03_[ism-1]->setAxisTitle("iy", 2);
00281     }
00282     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00283       if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00284       name = "EELT laser quality L4 " + Numbers::sEE(ism);
00285       meg04_[ism-1] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
00286       meg04_[ism-1]->setAxisTitle("ix", 1);
00287       if ( ism >= 1 && ism <= 9 ) meg04_[ism-1]->setAxisTitle("101-ix", 1);
00288       meg04_[ism-1]->setAxisTitle("iy", 2);
00289     }
00290     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00291       if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00292       name = "EELT laser quality L1 PNs G01 " + Numbers::sEE(ism);
00293       meg05_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00294       meg05_[ism-1]->setAxisTitle("pseudo-strip", 1);
00295       meg05_[ism-1]->setAxisTitle("channel", 2);
00296     }
00297     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00298       if ( meg06_[ism-1] ) dqmStore_->removeElement( meg06_[ism-1]->getName() );
00299       name = "EELT laser quality L2 PNs G01 " + Numbers::sEE(ism);
00300       meg06_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00301       meg06_[ism-1]->setAxisTitle("pseudo-strip", 1);
00302       meg06_[ism-1]->setAxisTitle("channel", 2);
00303     }
00304     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00305       if ( meg07_[ism-1] ) dqmStore_->removeElement( meg07_[ism-1]->getName() );
00306       name = "EELT laser quality L3 PNs G01 " + Numbers::sEE(ism);
00307       meg07_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00308       meg07_[ism-1]->setAxisTitle("pseudo-strip", 1);
00309       meg07_[ism-1]->setAxisTitle("channel", 2);
00310     }
00311     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00312       if ( meg08_[ism-1] ) dqmStore_->removeElement( meg08_[ism-1]->getName() );
00313       name = "EELT laser quality L4 PNs G01 " + Numbers::sEE(ism);
00314       meg08_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00315       meg08_[ism-1]->setAxisTitle("pseudo-strip", 1);
00316       meg08_[ism-1]->setAxisTitle("channel", 2);
00317     }
00318     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00319       if ( meg09_[ism-1] ) dqmStore_->removeElement( meg09_[ism-1]->getName() );
00320       name = "EELT laser quality L1 PNs G16 " + Numbers::sEE(ism);
00321       meg09_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00322       meg09_[ism-1]->setAxisTitle("pseudo-strip", 1);
00323       meg09_[ism-1]->setAxisTitle("channel", 2);
00324     }
00325     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00326       if ( meg10_[ism-1] ) dqmStore_->removeElement( meg10_[ism-1]->getName() );
00327       name = "EELT laser quality L2 PNs G16 " + Numbers::sEE(ism);
00328       meg10_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00329       meg10_[ism-1]->setAxisTitle("pseudo-strip", 1);
00330       meg10_[ism-1]->setAxisTitle("channel", 2);
00331     }
00332     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00333       if ( meg11_[ism-1] ) dqmStore_->removeElement( meg11_[ism-1]->getName() );
00334       name = "EELT laser quality L3 PNs G16 " + Numbers::sEE(ism);
00335       meg11_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00336       meg11_[ism-1]->setAxisTitle("pseudo-strip", 1);
00337       meg11_[ism-1]->setAxisTitle("channel", 2);
00338     }
00339     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00340       if ( meg12_[ism-1] ) dqmStore_->removeElement( meg12_[ism-1]->getName() );
00341       name = "EELT laser quality L4 PNs G16 " + Numbers::sEE(ism);
00342       meg12_[ism-1] = dqmStore_->book2D(name, name, 10, 0., 10., 1, 0., 5.);
00343       meg12_[ism-1]->setAxisTitle("pseudo-strip", 1);
00344       meg12_[ism-1]->setAxisTitle("channel", 2);
00345     }
00346 
00347     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00348       if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );;
00349       name = "EELT amplitude L1 " + Numbers::sEE(ism);
00350       mea01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00351       mea01_[ism-1]->setAxisTitle("channel", 1);
00352       mea01_[ism-1]->setAxisTitle("amplitude", 2);
00353     }
00354     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00355       if ( mea02_[ism-1] ) dqmStore_->removeElement( mea02_[ism-1]->getName() );
00356       name = "EELT amplitude L2 " + Numbers::sEE(ism);
00357       mea02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00358       mea02_[ism-1]->setAxisTitle("channel", 1);
00359       mea02_[ism-1]->setAxisTitle("amplitude", 2);
00360     }
00361     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00362       if ( mea03_[ism-1] ) dqmStore_->removeElement( mea03_[ism-1]->getName() );
00363       name = "EELT amplitude L3 " + Numbers::sEE(ism);
00364       mea03_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00365       mea03_[ism-1]->setAxisTitle("channel", 1);
00366       mea03_[ism-1]->setAxisTitle("amplitude", 2);
00367     }
00368     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00369       if ( mea04_[ism-1] ) dqmStore_->removeElement( mea04_[ism-1]->getName() );
00370       name = "EELT amplitude L4 " + Numbers::sEE(ism);
00371       mea04_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00372       mea04_[ism-1]->setAxisTitle("channel", 1);
00373       mea04_[ism-1]->setAxisTitle("amplitude", 2);
00374     }
00375 
00376     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00377       if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00378       name = "EELT laser timing L1 " + Numbers::sEE(ism);
00379       met01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00380       met01_[ism-1]->setAxisTitle("channel", 1);
00381       met01_[ism-1]->setAxisTitle("jitter", 2);
00382     }
00383     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00384       if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00385       name = "EELT laser timing L2 " + Numbers::sEE(ism);
00386       met02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00387       met02_[ism-1]->setAxisTitle("channel", 1);
00388       met02_[ism-1]->setAxisTitle("jitter", 2);
00389     }
00390     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00391       if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00392       name = "EELT laser timing L3 " + Numbers::sEE(ism);
00393       met03_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00394       met03_[ism-1]->setAxisTitle("channel", 1);
00395       met03_[ism-1]->setAxisTitle("jitter", 2);
00396     }
00397     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00398       if ( met04_[ism-1] ) dqmStore_->removeElement( met04_[ism-1]->getName() );
00399       name = "EELT laser timing L4 " + Numbers::sEE(ism);
00400       met04_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00401       met04_[ism-1]->setAxisTitle("channel", 1);
00402       met04_[ism-1]->setAxisTitle("jitter", 2);
00403     }
00404 
00405     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00406       if ( metav01_[ism-1] ) dqmStore_->removeElement( metav01_[ism-1]->getName() );
00407       name = "EELT laser timing mean L1 " + Numbers::sEE(ism);
00408       metav01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00409       metav01_[ism-1]->setAxisTitle("mean", 1);
00410     }
00411     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00412       if ( metav02_[ism-1] ) dqmStore_->removeElement( metav02_[ism-1]->getName() );
00413       name = "EELT laser timing mean L2 " + Numbers::sEE(ism);
00414       metav02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00415       metav02_[ism-1]->setAxisTitle("mean", 1);
00416     }
00417     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00418       if ( metav03_[ism-1] ) dqmStore_->removeElement( metav03_[ism-1]->getName() );
00419       name = "EELT laser timing mean L3 " + Numbers::sEE(ism);
00420       metav03_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00421       metav03_[ism-1]->setAxisTitle("mean", 1);
00422     }
00423     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00424       if ( metav04_[ism-1] ) dqmStore_->removeElement( metav04_[ism-1]->getName() );
00425       name = "EELT laser timing mean L4 " + Numbers::sEE(ism);
00426       metav04_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00427       metav04_[ism-1]->setAxisTitle("mean", 1);
00428     }
00429 
00430     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00431       if ( metrms01_[ism-1] ) dqmStore_->removeElement( metrms01_[ism-1]->getName() );
00432       name = "EELT laser timing rms L1 " + Numbers::sEE(ism);
00433       metrms01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00434       metrms01_[ism-1]->setAxisTitle("rms", 1);
00435     }
00436     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00437       if ( metrms02_[ism-1] ) dqmStore_->removeElement( metrms02_[ism-1]->getName() );
00438       name = "EELT laser timing rms L2 " + Numbers::sEE(ism);
00439       metrms02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00440       metrms02_[ism-1]->setAxisTitle("rms", 1);
00441     }
00442     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00443       if ( metrms03_[ism-1] ) dqmStore_->removeElement( metrms03_[ism-1]->getName() );
00444       name = "EELT laser timing rms L3 " + Numbers::sEE(ism);
00445       metrms03_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00446       metrms03_[ism-1]->setAxisTitle("rms", 1);
00447     }
00448     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00449       if ( metrms04_[ism-1] ) dqmStore_->removeElement( metrms04_[ism-1]->getName() );
00450       name = "EELT laser timing rms L4 " + Numbers::sEE(ism);
00451       metrms04_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 0.5);
00452       metrms04_[ism-1]->setAxisTitle("rms", 1);
00453     }
00454 
00455     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00456       if ( meaopn01_[ism-1] ) dqmStore_->removeElement( meaopn01_[ism-1]->getName() );
00457       name = "EELT amplitude over PN L1 " + Numbers::sEE(ism);
00458       meaopn01_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00459       meaopn01_[ism-1]->setAxisTitle("channel", 1);
00460       meaopn01_[ism-1]->setAxisTitle("amplitude/PN", 2);
00461     }
00462     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00463       if ( meaopn02_[ism-1] ) dqmStore_->removeElement( meaopn02_[ism-1]->getName() );
00464       name = "EELT amplitude over PN L2 " + Numbers::sEE(ism);
00465       meaopn02_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00466       meaopn02_[ism-1]->setAxisTitle("channel", 1);
00467       meaopn02_[ism-1]->setAxisTitle("amplitude/PN", 2);
00468     }
00469     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00470       if ( meaopn03_[ism-1] ) dqmStore_->removeElement( meaopn03_[ism-1]->getName() );
00471       name = "EELT amplitude over PN L3 " + Numbers::sEE(ism);
00472       meaopn03_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00473       meaopn03_[ism-1]->setAxisTitle("channel", 1);
00474       meaopn03_[ism-1]->setAxisTitle("amplitude/PN", 2);
00475     }
00476     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00477       if ( meaopn04_[ism-1] ) dqmStore_->removeElement( meaopn04_[ism-1]->getName() );
00478       name = "EELT amplitude over PN L4 " + Numbers::sEE(ism);
00479       meaopn04_[ism-1] = dqmStore_->book1D(name, name, 850, 0., 850.);
00480       meaopn04_[ism-1]->setAxisTitle("channel", 1);
00481       meaopn04_[ism-1]->setAxisTitle("amplitude/PN", 2);
00482     }
00483 
00484     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00485       if ( mepnprms01_[ism-1] ) dqmStore_->removeElement( mepnprms01_[ism-1]->getName() );
00486       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L1";
00487       mepnprms01_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00488       mepnprms01_[ism-1]->setAxisTitle("rms", 1);
00489     }
00490     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00491       if ( mepnprms02_[ism-1] ) dqmStore_->removeElement( mepnprms02_[ism-1]->getName() );
00492       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L2";
00493       mepnprms02_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00494       mepnprms02_[ism-1]->setAxisTitle("rms", 1);
00495     }
00496     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00497       if ( mepnprms03_[ism-1] ) dqmStore_->removeElement( mepnprms03_[ism-1]->getName() );
00498       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L3";
00499       mepnprms03_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00500       mepnprms03_[ism-1]->setAxisTitle("rms", 1);
00501     }
00502     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00503       if ( mepnprms04_[ism-1] ) dqmStore_->removeElement( mepnprms04_[ism-1]->getName() );
00504       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G01 L4";
00505       mepnprms04_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00506       mepnprms04_[ism-1]->setAxisTitle("rms", 1);
00507     }
00508     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00509       if ( mepnprms05_[ism-1] ) dqmStore_->removeElement( mepnprms05_[ism-1]->getName() );
00510       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L1";
00511       mepnprms05_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00512       mepnprms05_[ism-1]->setAxisTitle("rms", 1);
00513     }
00514     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00515       if ( mepnprms06_[ism-1] ) dqmStore_->removeElement( mepnprms06_[ism-1]->getName() );
00516       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L2";
00517       mepnprms06_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00518       mepnprms06_[ism-1]->setAxisTitle("rms", 1);
00519     }
00520     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00521       if ( mepnprms07_[ism-1] ) dqmStore_->removeElement( mepnprms07_[ism-1]->getName() );
00522       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L3";
00523       mepnprms07_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00524       mepnprms07_[ism-1]->setAxisTitle("rms", 1);
00525     }
00526     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00527       if ( mepnprms08_[ism-1] ) dqmStore_->removeElement( mepnprms08_[ism-1]->getName() );
00528       name = "EELT PNs pedestal rms " + Numbers::sEE(ism) + " G16 L4";
00529       mepnprms08_[ism-1] = dqmStore_->book1D(name, name, 100, 0., 10.);
00530       mepnprms08_[ism-1]->setAxisTitle("rms", 1);
00531     }
00532 
00533     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00534       if ( me_hs01_[ism-1] ) dqmStore_->removeElement( me_hs01_[ism-1]->getName() );
00535       name = "EELT laser shape L1 " + Numbers::sEE(ism);
00536       me_hs01_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00537       me_hs01_[ism-1]->setAxisTitle("sample", 1);
00538       me_hs01_[ism-1]->setAxisTitle("amplitude", 2);
00539     }
00540     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00541       if ( me_hs02_[ism-1] ) dqmStore_->removeElement( me_hs02_[ism-1]->getName() );
00542       name = "EELT laser shape L2 " + Numbers::sEE(ism);
00543       me_hs02_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00544       me_hs02_[ism-1]->setAxisTitle("sample", 1);
00545       me_hs02_[ism-1]->setAxisTitle("amplitude", 2);
00546     }
00547     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00548       if ( me_hs03_[ism-1] ) dqmStore_->removeElement( me_hs03_[ism-1]->getName() );
00549       name = "EELT laser shape L3 " + Numbers::sEE(ism);
00550       me_hs03_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00551       me_hs03_[ism-1]->setAxisTitle("sample", 1);
00552       me_hs03_[ism-1]->setAxisTitle("amplitude", 2);
00553     }
00554     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00555       if ( me_hs04_[ism-1] ) dqmStore_->removeElement( me_hs04_[ism-1]->getName() );
00556       name = "EELT laser shape L4 " + Numbers::sEE(ism);
00557       me_hs04_[ism-1] = dqmStore_->book1D(name, name, 10, 0., 10.);
00558       me_hs04_[ism-1]->setAxisTitle("sample", 1);
00559       me_hs04_[ism-1]->setAxisTitle("amplitude", 2);
00560     }
00561 
00562   }
00563 
00564   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00565 
00566     int ism = superModules_[i];
00567 
00568     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
00569     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
00570     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
00571     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
00572 
00573     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
00574     if ( meg06_[ism-1] ) meg06_[ism-1]->Reset();
00575     if ( meg07_[ism-1] ) meg07_[ism-1]->Reset();
00576     if ( meg08_[ism-1] ) meg08_[ism-1]->Reset();
00577     if ( meg09_[ism-1] ) meg09_[ism-1]->Reset();
00578     if ( meg10_[ism-1] ) meg10_[ism-1]->Reset();
00579     if ( meg11_[ism-1] ) meg11_[ism-1]->Reset();
00580     if ( meg12_[ism-1] ) meg12_[ism-1]->Reset();
00581 
00582     for ( int ix = 1; ix <= 50; ix++ ) {
00583       for ( int iy = 1; iy <= 50; iy++ ) {
00584 
00585         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 6. );
00586         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 6. );
00587         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 6. );
00588         if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( ix, iy, 6. );
00589 
00590         int jx = ix + Numbers::ix0EE(ism);
00591         int jy = iy + Numbers::iy0EE(ism);
00592 
00593         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00594 
00595         if ( Numbers::validEE(ism, jx, jy) ) {
00596           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2. );
00597           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 2. );
00598           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 2. );
00599           if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( ix, iy, 2. );
00600         }
00601 
00602       }
00603     }
00604 
00605     for ( int i = 1; i <= 10; i++ ) {
00606 
00607         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 6. );
00608         if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 6. );
00609         if ( meg07_[ism-1] ) meg07_[ism-1]->setBinContent( i, 1, 6. );
00610         if ( meg08_[ism-1] ) meg08_[ism-1]->setBinContent( i, 1, 6. );
00611         if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 6. );
00612         if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 6. );
00613         if ( meg11_[ism-1] ) meg11_[ism-1]->setBinContent( i, 1, 6. );
00614         if ( meg12_[ism-1] ) meg12_[ism-1]->setBinContent( i, 1, 6. );
00615 
00616         // non-existing mem
00617         if ( (ism >=  3 && ism <=  4) || (ism >=  7 && ism <=  9) ) continue;
00618         if ( (ism >= 12 && ism <= 13) || (ism >= 16 && ism <= 18) ) continue;
00619 
00620         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
00621         if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 2. );
00622         if ( meg07_[ism-1] ) meg07_[ism-1]->setBinContent( i, 1, 2. );
00623         if ( meg08_[ism-1] ) meg08_[ism-1]->setBinContent( i, 1, 2. );
00624         if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 2. );
00625         if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 2. );
00626         if ( meg11_[ism-1] ) meg11_[ism-1]->setBinContent( i, 1, 2. );
00627         if ( meg12_[ism-1] ) meg12_[ism-1]->setBinContent( i, 1, 2. );
00628 
00629     }
00630 
00631     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
00632     if ( mea02_[ism-1] ) mea02_[ism-1]->Reset();
00633     if ( mea03_[ism-1] ) mea03_[ism-1]->Reset();
00634     if ( mea04_[ism-1] ) mea04_[ism-1]->Reset();
00635 
00636     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
00637     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
00638     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
00639     if ( met04_[ism-1] ) met04_[ism-1]->Reset();
00640 
00641     if ( metav01_[ism-1] ) metav01_[ism-1]->Reset();
00642     if ( metav02_[ism-1] ) metav02_[ism-1]->Reset();
00643     if ( metav03_[ism-1] ) metav03_[ism-1]->Reset();
00644     if ( metav04_[ism-1] ) metav04_[ism-1]->Reset();
00645 
00646     if ( metrms01_[ism-1] ) metrms01_[ism-1]->Reset();
00647     if ( metrms02_[ism-1] ) metrms02_[ism-1]->Reset();
00648     if ( metrms03_[ism-1] ) metrms03_[ism-1]->Reset();
00649     if ( metrms04_[ism-1] ) metrms04_[ism-1]->Reset();
00650 
00651     if ( meaopn01_[ism-1] ) meaopn01_[ism-1]->Reset();
00652     if ( meaopn02_[ism-1] ) meaopn02_[ism-1]->Reset();
00653     if ( meaopn03_[ism-1] ) meaopn03_[ism-1]->Reset();
00654     if ( meaopn04_[ism-1] ) meaopn04_[ism-1]->Reset();
00655 
00656     if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Reset();
00657     if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Reset();
00658     if ( mepnprms03_[ism-1] ) mepnprms03_[ism-1]->Reset();
00659     if ( mepnprms04_[ism-1] ) mepnprms04_[ism-1]->Reset();
00660     if ( mepnprms05_[ism-1] ) mepnprms05_[ism-1]->Reset();
00661     if ( mepnprms06_[ism-1] ) mepnprms06_[ism-1]->Reset();
00662     if ( mepnprms07_[ism-1] ) mepnprms07_[ism-1]->Reset();
00663     if ( mepnprms08_[ism-1] ) mepnprms08_[ism-1]->Reset();
00664 
00665     if ( me_hs01_[ism-1] ) me_hs01_[ism-1]->Reset();
00666     if ( me_hs02_[ism-1] ) me_hs02_[ism-1]->Reset();
00667     if ( me_hs03_[ism-1] ) me_hs03_[ism-1]->Reset();
00668     if ( me_hs04_[ism-1] ) me_hs04_[ism-1]->Reset();
00669 
00670   }
00671 
00672 }
00673 
00674 void EELaserClient::cleanup(void) {
00675 
00676   if ( ! enableCleanup_ ) return;
00677 
00678   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00679 
00680     int ism = superModules_[i];
00681 
00682     if ( cloneME_ ) {
00683       if ( h01_[ism-1] ) delete h01_[ism-1];
00684       if ( h02_[ism-1] ) delete h02_[ism-1];
00685       if ( h03_[ism-1] ) delete h03_[ism-1];
00686       if ( h04_[ism-1] ) delete h04_[ism-1];
00687       if ( h05_[ism-1] ) delete h05_[ism-1];
00688       if ( h06_[ism-1] ) delete h06_[ism-1];
00689       if ( h07_[ism-1] ) delete h07_[ism-1];
00690       if ( h08_[ism-1] ) delete h08_[ism-1];
00691 
00692       if ( h09_[ism-1] ) delete h09_[ism-1];
00693       if ( h10_[ism-1] ) delete h10_[ism-1];
00694       if ( h11_[ism-1] ) delete h11_[ism-1];
00695       if ( h12_[ism-1] ) delete h12_[ism-1];
00696 
00697       if ( hs01_[ism-1] ) delete hs01_[ism-1];
00698       if ( hs02_[ism-1] ) delete hs02_[ism-1];
00699       if ( hs03_[ism-1] ) delete hs03_[ism-1];
00700       if ( hs04_[ism-1] ) delete hs04_[ism-1];
00701 
00702       if ( i01_[ism-1] ) delete i01_[ism-1];
00703       if ( i02_[ism-1] ) delete i02_[ism-1];
00704       if ( i03_[ism-1] ) delete i03_[ism-1];
00705       if ( i04_[ism-1] ) delete i04_[ism-1];
00706       if ( i05_[ism-1] ) delete i05_[ism-1];
00707       if ( i06_[ism-1] ) delete i06_[ism-1];
00708       if ( i07_[ism-1] ) delete i07_[ism-1];
00709       if ( i08_[ism-1] ) delete i08_[ism-1];
00710 
00711       if ( i09_[ism-1] ) delete i09_[ism-1];
00712       if ( i10_[ism-1] ) delete i10_[ism-1];
00713       if ( i11_[ism-1] ) delete i11_[ism-1];
00714       if ( i12_[ism-1] ) delete i12_[ism-1];
00715       if ( i13_[ism-1] ) delete i13_[ism-1];
00716       if ( i14_[ism-1] ) delete i14_[ism-1];
00717       if ( i15_[ism-1] ) delete i15_[ism-1];
00718       if ( i16_[ism-1] ) delete i16_[ism-1];
00719     }
00720 
00721     h01_[ism-1] = 0;
00722     h02_[ism-1] = 0;
00723     h03_[ism-1] = 0;
00724     h04_[ism-1] = 0;
00725     h05_[ism-1] = 0;
00726     h06_[ism-1] = 0;
00727     h07_[ism-1] = 0;
00728     h08_[ism-1] = 0;
00729 
00730     h09_[ism-1] = 0;
00731     h10_[ism-1] = 0;
00732     h11_[ism-1] = 0;
00733     h12_[ism-1] = 0;
00734 
00735     hs01_[ism-1] = 0;
00736     hs02_[ism-1] = 0;
00737     hs03_[ism-1] = 0;
00738     hs04_[ism-1] = 0;
00739 
00740     i01_[ism-1] = 0;
00741     i02_[ism-1] = 0;
00742     i03_[ism-1] = 0;
00743     i04_[ism-1] = 0;
00744     i05_[ism-1] = 0;
00745     i06_[ism-1] = 0;
00746     i07_[ism-1] = 0;
00747     i08_[ism-1] = 0;
00748 
00749     i09_[ism-1] = 0;
00750     i10_[ism-1] = 0;
00751     i11_[ism-1] = 0;
00752     i12_[ism-1] = 0;
00753     i13_[ism-1] = 0;
00754     i14_[ism-1] = 0;
00755     i15_[ism-1] = 0;
00756     i16_[ism-1] = 0;
00757 
00758   }
00759 
00760   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00761 
00762     int ism = superModules_[i];
00763 
00764     dqmStore_->setCurrentFolder( prefixME_ + "/EELaserClient" );
00765 
00766     if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
00767     meg01_[ism-1] = 0;
00768     if ( meg02_[ism-1] ) dqmStore_->removeElement( meg02_[ism-1]->getName() );
00769     meg02_[ism-1] = 0;
00770     if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
00771     meg03_[ism-1] = 0;
00772     if ( meg04_[ism-1] ) dqmStore_->removeElement( meg04_[ism-1]->getName() );
00773     meg04_[ism-1] = 0;
00774 
00775     if ( meg05_[ism-1] ) dqmStore_->removeElement( meg05_[ism-1]->getName() );
00776     meg05_[ism-1] = 0;
00777     if ( meg06_[ism-1] ) dqmStore_->removeElement( meg06_[ism-1]->getName() );
00778     meg06_[ism-1] = 0;
00779     if ( meg07_[ism-1] ) dqmStore_->removeElement( meg07_[ism-1]->getName() );
00780     meg07_[ism-1] = 0;
00781     if ( meg08_[ism-1] ) dqmStore_->removeElement( meg08_[ism-1]->getName() );
00782     meg08_[ism-1] = 0;
00783     if ( meg09_[ism-1] ) dqmStore_->removeElement( meg09_[ism-1]->getName() );
00784     meg09_[ism-1] = 0;
00785     if ( meg10_[ism-1] ) dqmStore_->removeElement( meg10_[ism-1]->getName() );
00786     meg10_[ism-1] = 0;
00787     if ( meg11_[ism-1] ) dqmStore_->removeElement( meg11_[ism-1]->getName() );
00788     meg11_[ism-1] = 0;
00789     if ( meg12_[ism-1] ) dqmStore_->removeElement( meg12_[ism-1]->getName() );
00790     meg12_[ism-1] = 0;
00791 
00792     if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
00793     mea01_[ism-1] = 0;
00794     if ( mea02_[ism-1] ) dqmStore_->removeElement( mea02_[ism-1]->getName() );
00795     mea02_[ism-1] = 0;
00796     if ( mea03_[ism-1] ) dqmStore_->removeElement( mea03_[ism-1]->getName() );
00797     mea03_[ism-1] = 0;
00798     if ( mea04_[ism-1] ) dqmStore_->removeElement( mea04_[ism-1]->getName() );
00799     mea04_[ism-1] = 0;
00800 
00801     if ( met01_[ism-1] ) dqmStore_->removeElement( met01_[ism-1]->getName() );
00802     met01_[ism-1] = 0;
00803     if ( met02_[ism-1] ) dqmStore_->removeElement( met02_[ism-1]->getName() );
00804     met02_[ism-1] = 0;
00805     if ( met03_[ism-1] ) dqmStore_->removeElement( met03_[ism-1]->getName() );
00806     met03_[ism-1] = 0;
00807     if ( met04_[ism-1] ) dqmStore_->removeElement( met04_[ism-1]->getName() );
00808     met04_[ism-1] = 0;
00809 
00810     if ( metav01_[ism-1] ) dqmStore_->removeElement( metav01_[ism-1]->getName() );
00811     metav01_[ism-1] = 0;
00812     if ( metav02_[ism-1] ) dqmStore_->removeElement( metav02_[ism-1]->getName() );
00813     metav02_[ism-1] = 0;
00814     if ( metav03_[ism-1] ) dqmStore_->removeElement( metav03_[ism-1]->getName() );
00815     metav03_[ism-1] = 0;
00816     if ( metav04_[ism-1] ) dqmStore_->removeElement( metav04_[ism-1]->getName() );
00817     metav04_[ism-1] = 0;
00818 
00819     if ( metrms01_[ism-1] ) dqmStore_->removeElement( metrms01_[ism-1]->getName() );
00820     metrms01_[ism-1] = 0;
00821     if ( metrms02_[ism-1] ) dqmStore_->removeElement( metrms02_[ism-1]->getName() );
00822     metrms02_[ism-1] = 0;
00823     if ( metrms03_[ism-1] ) dqmStore_->removeElement( metrms03_[ism-1]->getName() );
00824     metrms03_[ism-1] = 0;
00825     if ( metrms04_[ism-1] ) dqmStore_->removeElement( metrms04_[ism-1]->getName() );
00826     metrms04_[ism-1] = 0;
00827 
00828     if ( meaopn01_[ism-1] ) dqmStore_->removeElement( meaopn01_[ism-1]->getName() );
00829     meaopn01_[ism-1] = 0;
00830     if ( meaopn02_[ism-1] ) dqmStore_->removeElement( meaopn02_[ism-1]->getName() );
00831     meaopn02_[ism-1] = 0;
00832     if ( meaopn03_[ism-1] ) dqmStore_->removeElement( meaopn03_[ism-1]->getName() );
00833     meaopn03_[ism-1] = 0;
00834     if ( meaopn04_[ism-1] ) dqmStore_->removeElement( meaopn04_[ism-1]->getName() );
00835     meaopn04_[ism-1] = 0;
00836 
00837     if ( mepnprms01_[ism-1] ) dqmStore_->removeElement( mepnprms01_[ism-1]->getName() );
00838     mepnprms01_[ism-1] = 0;
00839     if ( mepnprms02_[ism-1] ) dqmStore_->removeElement( mepnprms02_[ism-1]->getName() );
00840     mepnprms02_[ism-1] = 0;
00841     if ( mepnprms03_[ism-1] ) dqmStore_->removeElement( mepnprms03_[ism-1]->getName() );
00842     mepnprms03_[ism-1] = 0;
00843     if ( mepnprms04_[ism-1] ) dqmStore_->removeElement( mepnprms04_[ism-1]->getName() );
00844     mepnprms04_[ism-1] = 0;
00845     if ( mepnprms05_[ism-1] ) dqmStore_->removeElement( mepnprms05_[ism-1]->getName() );
00846     mepnprms05_[ism-1] = 0;
00847     if ( mepnprms06_[ism-1] ) dqmStore_->removeElement( mepnprms06_[ism-1]->getName() );
00848     mepnprms06_[ism-1] = 0;
00849     if ( mepnprms07_[ism-1] ) dqmStore_->removeElement( mepnprms07_[ism-1]->getName() );
00850     mepnprms07_[ism-1] = 0;
00851     if ( mepnprms08_[ism-1] ) dqmStore_->removeElement( mepnprms08_[ism-1]->getName() );
00852     mepnprms08_[ism-1] = 0;
00853 
00854     if ( me_hs01_[ism-1] ) dqmStore_->removeElement( me_hs01_[ism-1]->getName() );
00855     me_hs01_[ism-1] = 0;
00856     if ( me_hs02_[ism-1] ) dqmStore_->removeElement( me_hs02_[ism-1]->getName() );
00857     me_hs02_[ism-1] = 0;
00858     if ( me_hs03_[ism-1] ) dqmStore_->removeElement( me_hs03_[ism-1]->getName() );
00859     me_hs03_[ism-1] = 0;
00860     if ( me_hs04_[ism-1] ) dqmStore_->removeElement( me_hs04_[ism-1]->getName() );
00861     me_hs04_[ism-1] = 0;
00862 
00863   }
00864 
00865 }
00866 
00867 #ifdef WITH_ECAL_COND_DB
00868 bool EELaserClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
00869 
00870   status = true;
00871 
00872   EcalLogicID ecid;
00873 
00874   MonLaserBlueDat apd_bl;
00875   std::map<EcalLogicID, MonLaserBlueDat> dataset1_bl;
00876   MonLaserGreenDat apd_gr;
00877   std::map<EcalLogicID, MonLaserGreenDat> dataset1_gr;
00878   MonLaserIRedDat apd_ir;
00879   std::map<EcalLogicID, MonLaserIRedDat> dataset1_ir;
00880   MonLaserRedDat apd_rd;
00881   std::map<EcalLogicID, MonLaserRedDat> dataset1_rd;
00882 
00883   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
00884 
00885     int ism = superModules_[i];
00886 
00887     if ( verbose_ ) {
00888       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00889       std::cout << std::endl;
00890       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00891         UtilsClient::printBadChannels(meg01_[ism-1], h01_[ism-1]);
00892       }
00893       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00894         UtilsClient::printBadChannels(meg02_[ism-1], h03_[ism-1]);
00895       }
00896       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00897         UtilsClient::printBadChannels(meg03_[ism-1], h05_[ism-1]);
00898       }
00899       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00900         UtilsClient::printBadChannels(meg04_[ism-1], h07_[ism-1]);
00901       }
00902     }
00903 
00904     for ( int ix = 1; ix <= 50; ix++ ) {
00905       for ( int iy = 1; iy <= 50; iy++ ) {
00906 
00907         int jx = ix + Numbers::ix0EE(ism);
00908         int jy = iy + Numbers::iy0EE(ism);
00909 
00910         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
00911 
00912         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
00913 
00914         bool update01;
00915         bool update02;
00916         bool update03;
00917         bool update04;
00918         bool update05;
00919         bool update06;
00920         bool update07;
00921         bool update08;
00922 
00923         float num01, num02, num03, num04, num05, num06, num07, num08;
00924         float mean01, mean02, mean03, mean04, mean05, mean06, mean07, mean08;
00925         float rms01, rms02, rms03, rms04, rms05, rms06, rms07, rms08;
00926 
00927         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
00928         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
00929         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
00930         update04 = UtilsClient::getBinStatistics(h04_[ism-1], ix, iy, num04, mean04, rms04);
00931         update05 = UtilsClient::getBinStatistics(h05_[ism-1], ix, iy, num05, mean05, rms05);
00932         update06 = UtilsClient::getBinStatistics(h06_[ism-1], ix, iy, num06, mean06, rms06);
00933         update07 = UtilsClient::getBinStatistics(h07_[ism-1], ix, iy, num07, mean07, rms07);
00934         update08 = UtilsClient::getBinStatistics(h08_[ism-1], ix, iy, num08, mean08, rms08);
00935 
00936         if ( update01 || update02 ) {
00937 
00938           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00939 
00940             if ( verbose_ ) {
00941               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00942               std::cout << "L1 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01 << " " << mean01 << " " << rms01 << std::endl;
00943               std::cout << std::endl;
00944             }
00945 
00946           }
00947 
00948           apd_bl.setAPDMean(mean01);
00949           apd_bl.setAPDRMS(rms01);
00950 
00951           apd_bl.setAPDOverPNMean(mean02);
00952           apd_bl.setAPDOverPNRMS(rms02);
00953 
00954           if ( UtilsClient::getBinStatus(meg01_[ism-1], ix, iy) ) {
00955             apd_bl.setTaskStatus(true);
00956           } else {
00957             apd_bl.setTaskStatus(false);
00958           }
00959 
00960           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ix, iy);
00961 
00962           int ic = Numbers::indexEE(ism, jx, jy);
00963 
00964           if ( ic == -1 ) continue;
00965 
00966           if ( econn ) {
00967             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
00968             dataset1_bl[ecid] = apd_bl;
00969           }
00970 
00971         }
00972 
00973         if ( update03 || update04 ) {
00974 
00975           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
00976 
00977             if ( verbose_ ) {
00978               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
00979               std::cout << "L2 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num03 << " " << mean03 << " " << rms03 << std::endl;
00980               std::cout << std::endl;
00981             }
00982 
00983           }
00984 
00985           apd_ir.setAPDMean(mean03);
00986           apd_ir.setAPDRMS(rms03);
00987 
00988           apd_ir.setAPDOverPNMean(mean04);
00989           apd_ir.setAPDOverPNRMS(rms04);
00990 
00991           if ( UtilsClient::getBinStatus(meg02_[ism-1], ix, iy) ) {
00992             apd_ir.setTaskStatus(true);
00993           } else {
00994             apd_ir.setTaskStatus(false);
00995           }
00996 
00997           status = status && UtilsClient::getBinQuality(meg02_[ism-1], ix, iy);
00998 
00999           int ic = Numbers::indexEE(ism, jx, jy);
01000 
01001           if ( ic == -1 ) continue;
01002 
01003           if ( econn ) {
01004             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01005             dataset1_ir[ecid] = apd_ir;
01006           }
01007 
01008         }
01009 
01010         if ( update05 || update06 ) {
01011 
01012           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01013 
01014             if ( verbose_ ) {
01015               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01016               std::cout << "L3 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num05 << " " << mean05 << " " << rms05 << std::endl;
01017               std::cout << std::endl;
01018             }
01019 
01020           }
01021 
01022           apd_gr.setAPDMean(mean05);
01023           apd_gr.setAPDRMS(rms05);
01024 
01025           apd_gr.setAPDOverPNMean(mean06);
01026           apd_gr.setAPDOverPNRMS(rms06);
01027 
01028           if ( UtilsClient::getBinStatus(meg03_[ism-1], ix, iy) ) {
01029             apd_gr.setTaskStatus(true);
01030           } else {
01031             apd_gr.setTaskStatus(false);
01032           }
01033 
01034           status = status && UtilsClient::getBinQuality(meg03_[ism-1], ix, iy);
01035 
01036           int ic = Numbers::indexEE(ism, jx, jy);
01037 
01038           if ( ic == -1 ) continue;
01039 
01040           if ( econn ) {
01041             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01042             dataset1_gr[ecid] = apd_gr;
01043           }
01044 
01045         }
01046 
01047         if ( update07 || update08 ) {
01048 
01049           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01050 
01051             if ( verbose_ ) {
01052               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01053               std::cout << "L4 (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num07 << " " << mean07 << " " << rms07 << std::endl;
01054               std::cout << std::endl;
01055             }
01056 
01057           }
01058 
01059           apd_rd.setAPDMean(mean07);
01060           apd_rd.setAPDRMS(rms07);
01061 
01062           apd_rd.setAPDOverPNMean(mean08);
01063           apd_rd.setAPDOverPNRMS(rms08);
01064 
01065           if ( UtilsClient::getBinStatus(meg04_[ism-1], ix, iy) ) {
01066             apd_rd.setTaskStatus(true);
01067           } else {
01068             apd_rd.setTaskStatus(false);
01069           }
01070 
01071           status = status && UtilsClient::getBinQuality(meg04_[ism-1], ix, iy);
01072 
01073           int ic = Numbers::indexEE(ism, jx, jy);
01074 
01075           if ( ic == -1 ) continue;
01076 
01077           if ( econn ) {
01078             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01079             dataset1_rd[ecid] = apd_rd;
01080           }
01081 
01082         }
01083 
01084       }
01085     }
01086 
01087   }
01088 
01089   if ( econn ) {
01090     try {
01091       if ( verbose_ ) std::cout << "Inserting MonLaserDat ..." << std::endl;
01092       if ( dataset1_bl.size() != 0 ) econn->insertDataArraySet(&dataset1_bl, moniov);
01093       if ( dataset1_ir.size() != 0 ) econn->insertDataArraySet(&dataset1_ir, moniov);
01094       if ( dataset1_gr.size() != 0 ) econn->insertDataArraySet(&dataset1_gr, moniov);
01095       if ( dataset1_rd.size() != 0 ) econn->insertDataArraySet(&dataset1_rd, moniov);
01096       if ( verbose_ ) std::cout << "done." << std::endl;
01097     } catch (std::runtime_error &e) {
01098       std::cerr << e.what() << std::endl;
01099     }
01100   }
01101 
01102   if ( verbose_ ) std::cout << std::endl;
01103 
01104   MonPNBlueDat pn_bl;
01105   std::map<EcalLogicID, MonPNBlueDat> dataset2_bl;
01106   MonPNGreenDat pn_gr;
01107   std::map<EcalLogicID, MonPNGreenDat> dataset2_gr;
01108   MonPNIRedDat pn_ir;
01109   std::map<EcalLogicID, MonPNIRedDat> dataset2_ir;
01110   MonPNRedDat pn_rd;
01111   std::map<EcalLogicID, MonPNRedDat> dataset2_rd;
01112 
01113   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
01114 
01115     int ism = superModules_[i];
01116 
01117     if ( verbose_ ) {
01118       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01119       std::cout << std::endl;
01120       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01121         UtilsClient::printBadChannels(meg05_[ism-1], i01_[ism-1]);
01122         UtilsClient::printBadChannels(meg05_[ism-1], i05_[ism-1]);
01123       }
01124       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01125         UtilsClient::printBadChannels(meg06_[ism-1], i02_[ism-1]);
01126         UtilsClient::printBadChannels(meg06_[ism-1], i06_[ism-1]);
01127       }
01128       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01129         UtilsClient::printBadChannels(meg07_[ism-1], i03_[ism-1]);
01130         UtilsClient::printBadChannels(meg07_[ism-1], i07_[ism-1]);
01131       }
01132       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01133         UtilsClient::printBadChannels(meg08_[ism-1], i04_[ism-1]);
01134         UtilsClient::printBadChannels(meg08_[ism-1], i08_[ism-1]);
01135       }
01136       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01137         UtilsClient::printBadChannels(meg09_[ism-1], i09_[ism-1]);
01138         UtilsClient::printBadChannels(meg09_[ism-1], i13_[ism-1]);
01139       }
01140       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01141         UtilsClient::printBadChannels(meg10_[ism-1], i10_[ism-1]);
01142         UtilsClient::printBadChannels(meg10_[ism-1], i14_[ism-1]);
01143       }
01144       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01145         UtilsClient::printBadChannels(meg11_[ism-1], i11_[ism-1]);
01146         UtilsClient::printBadChannels(meg11_[ism-1], i15_[ism-1]);
01147       }
01148       if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01149         UtilsClient::printBadChannels(meg12_[ism-1], i12_[ism-1]);
01150         UtilsClient::printBadChannels(meg12_[ism-1], i16_[ism-1]);
01151       }
01152     }
01153 
01154     for ( int i = 1; i <= 10; i++ ) {
01155 
01156       bool update01;
01157       bool update02;
01158       bool update03;
01159       bool update04;
01160       bool update05;
01161       bool update06;
01162       bool update07;
01163       bool update08;
01164       bool update09;
01165       bool update10;
01166       bool update11;
01167       bool update12;
01168       bool update13;
01169       bool update14;
01170       bool update15;
01171       bool update16;
01172 
01173       float num01, num02, num03, num04, num05, num06, num07, num08;
01174       float num09, num10, num11, num12, num13, num14, num15, num16;
01175       float mean01, mean02, mean03, mean04, mean05, mean06, mean07, mean08;
01176       float mean09, mean10, mean11, mean12, mean13, mean14, mean15, mean16;
01177       float rms01, rms02, rms03, rms04, rms05, rms06, rms07, rms08;
01178       float rms09, rms10, rms11, rms12, rms13, rms14, rms15, rms16;
01179 
01180       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
01181       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
01182       update03 = UtilsClient::getBinStatistics(i03_[ism-1], i, 0, num03, mean03, rms03);
01183       update04 = UtilsClient::getBinStatistics(i04_[ism-1], i, 0, num04, mean04, rms04);
01184       update05 = UtilsClient::getBinStatistics(i05_[ism-1], i, 0, num05, mean05, rms05);
01185       update06 = UtilsClient::getBinStatistics(i06_[ism-1], i, 0, num06, mean06, rms06);
01186       update07 = UtilsClient::getBinStatistics(i07_[ism-1], i, 0, num07, mean07, rms07);
01187       update08 = UtilsClient::getBinStatistics(i08_[ism-1], i, 0, num08, mean08, rms08);
01188       update09 = UtilsClient::getBinStatistics(i09_[ism-1], i, 0, num09, mean09, rms09);
01189       update10 = UtilsClient::getBinStatistics(i10_[ism-1], i, 0, num10, mean10, rms10);
01190       update11 = UtilsClient::getBinStatistics(i11_[ism-1], i, 0, num11, mean11, rms11);
01191       update12 = UtilsClient::getBinStatistics(i12_[ism-1], i, 0, num12, mean12, rms12);
01192       update13 = UtilsClient::getBinStatistics(i13_[ism-1], i, 0, num13, mean13, rms13);
01193       update14 = UtilsClient::getBinStatistics(i14_[ism-1], i, 0, num14, mean14, rms14);
01194       update15 = UtilsClient::getBinStatistics(i15_[ism-1], i, 0, num15, mean15, rms15);
01195       update16 = UtilsClient::getBinStatistics(i16_[ism-1], i, 0, num16, mean16, rms16);
01196 
01197       if ( update01 || update05 || update09 || update13 ) {
01198 
01199         if ( i == 1 ) {
01200 
01201           if ( verbose_ ) {
01202             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01203             std::cout << "PNs (" << i << ") L1 G01 " << num01  << " " << mean01 << " " << rms01  << std::endl;
01204             std::cout << "PNs (" << i << ") L1 G16 " << num09  << " " << mean09 << " " << rms09  << std::endl;
01205             std::cout << std::endl;
01206           }
01207 
01208         }
01209 
01210         pn_bl.setADCMeanG1(mean01);
01211         pn_bl.setADCRMSG1(rms01);
01212 
01213         pn_bl.setPedMeanG1(mean05);
01214         pn_bl.setPedRMSG1(rms05);
01215 
01216         pn_bl.setADCMeanG16(mean09);
01217         pn_bl.setADCRMSG16(rms09);
01218 
01219         pn_bl.setPedMeanG16(mean13);
01220         pn_bl.setPedRMSG16(rms13);
01221 
01222         if ( UtilsClient::getBinStatus(meg05_[ism-1], i, 1) ||
01223              UtilsClient::getBinStatus(meg09_[ism-1], i, 1) ) {
01224           pn_bl.setTaskStatus(true);
01225         } else {
01226           pn_bl.setTaskStatus(false);
01227         }
01228 
01229         status = status && ( UtilsClient::getBinQuality(meg05_[ism-1], i, 1) ||
01230                              UtilsClient::getBinQuality(meg09_[ism-1], i, 1) );
01231 
01232         if ( econn ) {
01233           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
01234           dataset2_bl[ecid] = pn_bl;
01235         }
01236 
01237       }
01238 
01239       if ( update02 || update06 || update10 || update14 ) {
01240 
01241         if ( i == 1 ) {
01242 
01243           if ( verbose_ ) {
01244             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01245             std::cout << "PNs (" << i << ") L2 G01 " << num02  << " " << mean02 << " " << rms02  << std::endl;
01246             std::cout << "PNs (" << i << ") L2 G16 " << num10  << " " << mean10 << " " << rms10  << std::endl;
01247             std::cout << std::endl;
01248           }
01249 
01250         }
01251 
01252         pn_ir.setADCMeanG1(mean02);
01253         pn_ir.setADCRMSG1(rms02);
01254 
01255         pn_ir.setPedMeanG1(mean06);
01256         pn_ir.setPedRMSG1(rms06);
01257 
01258         pn_ir.setADCMeanG16(mean10);
01259         pn_ir.setADCRMSG16(rms10);
01260 
01261         pn_ir.setPedMeanG16(mean14);
01262         pn_ir.setPedRMSG16(rms14);
01263 
01264         if ( UtilsClient::getBinStatus(meg06_[ism-1], i, 1) ||
01265              UtilsClient::getBinStatus(meg10_[ism-1], i, 1) ) {
01266           pn_ir.setTaskStatus(true);
01267         } else {
01268           pn_ir.setTaskStatus(false);
01269         }
01270 
01271         status = status && ( UtilsClient::getBinQuality(meg06_[ism-1], i, 1) ||
01272                              UtilsClient::getBinQuality(meg10_[ism-1], i, 1) );
01273 
01274         if ( econn ) {
01275           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
01276           dataset2_ir[ecid] = pn_ir;
01277         }
01278 
01279       }
01280 
01281       if ( update03 || update07 || update11 || update15 ) {
01282 
01283         if ( i == 1 ) {
01284 
01285           if ( verbose_ ) {
01286             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01287             std::cout << "PNs (" << i << ") L3 G01 " << num03  << " " << mean03 << " " << rms03  << std::endl;
01288             std::cout << "PNs (" << i << ") L3 G16 " << num11  << " " << mean11 << " " << rms11  << std::endl;
01289             std::cout << std::endl;
01290           }
01291 
01292         }
01293 
01294         pn_gr.setADCMeanG1(mean03);
01295         pn_gr.setADCRMSG1(rms03);
01296 
01297         pn_gr.setPedMeanG1(mean07);
01298         pn_gr.setPedRMSG1(rms07);
01299 
01300         pn_gr.setADCMeanG16(mean11);
01301         pn_gr.setADCRMSG16(rms11);
01302 
01303         pn_gr.setPedMeanG16(mean15);
01304         pn_gr.setPedRMSG16(rms15);
01305 
01306         if ( UtilsClient::getBinStatus(meg07_[ism-1], i, 1) ||
01307              UtilsClient::getBinStatus(meg11_[ism-1], i, 1) ) {
01308           pn_gr.setTaskStatus(true);
01309         } else {
01310           pn_gr.setTaskStatus(false);
01311         }
01312 
01313         status = status && ( UtilsClient::getBinQuality(meg07_[ism-1], i, 1) ||
01314                              UtilsClient::getBinQuality(meg11_[ism-1], i, 1) );
01315 
01316         if ( econn ) {
01317           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
01318           dataset2_gr[ecid] = pn_gr;
01319         }
01320 
01321       }
01322 
01323       if ( update04 || update08 || update12 || update16 ) {
01324 
01325         if ( i == 1 ) {
01326 
01327           if ( verbose_ ) {
01328             std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01329             std::cout << "PNs (" << i << ") L4 G01 " << num04  << " " << mean04 << " " << rms04  << std::endl;
01330             std::cout << "PNs (" << i << ") L4 G16 " << num12  << " " << mean12 << " " << rms12  << std::endl;
01331             std::cout << std::endl;
01332           }
01333 
01334         }
01335 
01336         pn_rd.setADCMeanG1(mean04);
01337         pn_rd.setADCRMSG1(rms04);
01338 
01339         pn_rd.setPedMeanG1(mean08);
01340         pn_rd.setPedRMSG1(mean08);
01341 
01342         pn_rd.setADCMeanG16(mean12);
01343         pn_rd.setADCRMSG16(rms12);
01344 
01345         pn_rd.setPedMeanG16(mean16);
01346         pn_rd.setPedRMSG16(rms16);
01347 
01348         if ( UtilsClient::getBinStatus(meg08_[ism-1], i, 1) ||
01349              UtilsClient::getBinStatus(meg12_[ism-1], i, 1) ) {
01350           pn_rd.setTaskStatus(true);
01351         } else {
01352           pn_rd.setTaskStatus(false);
01353         }
01354 
01355         status = status && ( UtilsClient::getBinQuality(meg08_[ism-1], i, 1) ||
01356                              UtilsClient::getBinQuality(meg12_[ism-1], i, 1) );
01357 
01358         if ( econn ) {
01359           ecid = LogicID::getEcalLogicID("EE_LM_PN", Numbers::iSM(ism, EcalEndcap), i-1);
01360           dataset2_rd[ecid] = pn_rd;
01361         }
01362 
01363       }
01364 
01365     }
01366 
01367   }
01368 
01369   if ( econn ) {
01370     try {
01371       if ( verbose_ ) std::cout << "Inserting MonPnDat ..." << std::endl;
01372       if ( dataset2_bl.size() != 0 ) econn->insertDataArraySet(&dataset2_bl, moniov);
01373       if ( dataset2_ir.size() != 0 ) econn->insertDataArraySet(&dataset2_ir, moniov);
01374       if ( dataset2_gr.size() != 0 ) econn->insertDataArraySet(&dataset2_gr, moniov);
01375       if ( dataset2_rd.size() != 0 ) econn->insertDataArraySet(&dataset2_rd, moniov);
01376       if ( verbose_ ) std::cout << "done." << std::endl;
01377     } catch (std::runtime_error &e) {
01378       std::cerr << e.what() << std::endl;
01379     }
01380   }
01381 
01382   if ( verbose_ ) std::cout << std::endl;
01383 
01384   MonTimingLaserBlueCrystalDat t_bl;
01385   std::map<EcalLogicID, MonTimingLaserBlueCrystalDat> dataset3_bl;
01386   MonTimingLaserGreenCrystalDat t_gr;
01387   std::map<EcalLogicID, MonTimingLaserGreenCrystalDat> dataset3_gr;
01388   MonTimingLaserIRedCrystalDat t_ir;
01389   std::map<EcalLogicID, MonTimingLaserIRedCrystalDat> dataset3_ir;
01390   MonTimingLaserRedCrystalDat t_rd;
01391   std::map<EcalLogicID, MonTimingLaserRedCrystalDat> dataset3_rd;
01392 
01393   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
01394 
01395     int ism = superModules_[i];
01396 
01397     if ( verbose_ ) {
01398       std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01399       std::cout << std::endl;
01400     }
01401 
01402     for ( int ix = 1; ix <= 50; ix++ ) {
01403       for ( int iy = 1; iy <= 50; iy++ ) {
01404 
01405         int jx = ix + Numbers::ix0EE(ism);
01406         int jy = iy + Numbers::iy0EE(ism);
01407 
01408         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
01409 
01410         if ( ! Numbers::validEE(ism, jx, jy) ) continue;
01411 
01412         bool update01;
01413         bool update02;
01414         bool update03;
01415         bool update04;
01416 
01417         float num01, num02, num03, num04;
01418         float mean01, mean02, mean03, mean04;
01419         float rms01, rms02, rms03, rms04;
01420 
01421         update01 = UtilsClient::getBinStatistics(h09_[ism-1], ix, iy, num01, mean01, rms01);
01422         update02 = UtilsClient::getBinStatistics(h10_[ism-1], ix, iy, num02, mean02, rms02);
01423         update03 = UtilsClient::getBinStatistics(h11_[ism-1], ix, iy, num03, mean03, rms03);
01424         update04 = UtilsClient::getBinStatistics(h12_[ism-1], ix, iy, num04, mean04, rms04);
01425 
01426         if ( update01 ) {
01427 
01428           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01429 
01430             if ( verbose_ ) {
01431               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01432               std::cout << "L1 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num01  << " " << mean01 << " " << rms01  << std::endl;
01433               std::cout << std::endl;
01434             }
01435 
01436           }
01437 
01438           t_bl.setTimingMean(mean01);
01439           t_bl.setTimingRMS(rms01);
01440 
01441           if ( UtilsClient::getBinStatus(meg01_[ism-1], ix, iy) ) {
01442             t_bl.setTaskStatus(true);
01443           } else {
01444             t_bl.setTaskStatus(false);
01445           }
01446 
01447           status = status && UtilsClient::getBinQuality(meg01_[ism-1], ix, iy);
01448 
01449           int ic = Numbers::indexEE(ism, jx, jy);
01450 
01451           if ( ic == -1 ) continue;
01452 
01453           if ( econn ) {
01454             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01455             dataset3_bl[ecid] = t_bl;
01456           }
01457 
01458         }
01459 
01460         if ( update02 ) {
01461 
01462           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01463 
01464             if ( verbose_ ) {
01465               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01466               std::cout << "L2 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num02  << " " << mean02 << " " << rms02  << std::endl;
01467               std::cout << std::endl;
01468             }
01469 
01470           }
01471 
01472           t_gr.setTimingMean(mean02);
01473           t_gr.setTimingRMS(rms02);
01474 
01475           if ( UtilsClient::getBinStatus(meg02_[ism-1], ix, iy) ) {
01476             t_gr.setTaskStatus(true);
01477           } else {
01478             t_gr.setTaskStatus(false);
01479           }
01480 
01481           status = status && UtilsClient::getBinQuality(meg02_[ism-1], ix, iy);
01482 
01483           int ic = Numbers::indexEE(ism, jx, jy);
01484 
01485           if ( ic == -1 ) continue;
01486 
01487           if ( econn ) {
01488             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01489             dataset3_gr[ecid] = t_gr;
01490           }
01491 
01492         }
01493 
01494         if ( update03 ) {
01495 
01496           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01497 
01498             if ( verbose_ ) {
01499               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01500               std::cout << "L3 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num03  << " " << mean03 << " " << rms03  << std::endl;
01501               std::cout << std::endl;
01502             }
01503 
01504           }
01505 
01506           t_ir.setTimingMean(mean03);
01507           t_ir.setTimingRMS(rms03);
01508 
01509           if ( UtilsClient::getBinStatus(meg03_[ism-1], ix, iy) ) {
01510             t_ir.setTaskStatus(true);
01511           } else {
01512             t_ir.setTaskStatus(false);
01513           }
01514 
01515           status = status && UtilsClient::getBinQuality(meg03_[ism-1], ix, iy);
01516 
01517           int ic = Numbers::indexEE(ism, jx, jy);
01518 
01519           if ( ic == -1 ) continue;
01520 
01521           if ( econn ) {
01522             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01523             dataset3_ir[ecid] = t_ir;
01524           }
01525 
01526         }
01527 
01528         if ( update04 ) {
01529 
01530           if ( Numbers::icEE(ism, jx, jy) == 1 ) {
01531 
01532             if ( verbose_ ) {
01533               std::cout << "Preparing dataset for " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
01534               std::cout << "L4 crystal (" << Numbers::ix0EE(i+1)+ix << "," << Numbers::iy0EE(i+1)+iy << ") " << num04  << " " << mean04 << " " << rms04  << std::endl;
01535               std::cout << std::endl;
01536             }
01537 
01538           }
01539 
01540           t_rd.setTimingMean(mean04);
01541           t_rd.setTimingRMS(rms04);
01542 
01543           if ( UtilsClient::getBinStatus(meg04_[ism-1], ix, iy) ) {
01544             t_rd.setTaskStatus(true);
01545           } else {
01546             t_rd.setTaskStatus(false);
01547           }
01548 
01549           status = status && UtilsClient::getBinQuality(meg04_[ism-1], ix, iy);
01550 
01551           int ic = Numbers::indexEE(ism, jx, jy);
01552 
01553           if ( ic == -1 ) continue;
01554 
01555           if ( econn ) {
01556             ecid = LogicID::getEcalLogicID("EE_crystal_number", Numbers::iSM(ism, EcalEndcap), ic);
01557             dataset3_rd[ecid] = t_rd;
01558           }
01559 
01560         }
01561 
01562       }
01563     }
01564 
01565   }
01566 
01567   if ( econn ) {
01568     try {
01569       if ( verbose_ ) std::cout << "Inserting MonTimingLaserCrystalDat ..." << std::endl;
01570       if ( dataset3_bl.size() != 0 ) econn->insertDataArraySet(&dataset3_bl, moniov);
01571       if ( dataset3_ir.size() != 0 ) econn->insertDataArraySet(&dataset3_ir, moniov);
01572       if ( dataset3_gr.size() != 0 ) econn->insertDataArraySet(&dataset3_gr, moniov);
01573       if ( dataset3_rd.size() != 0 ) econn->insertDataArraySet(&dataset3_rd, moniov);
01574       if ( verbose_ ) std::cout << "done." << std::endl;
01575     } catch (std::runtime_error &e) {
01576       std::cerr << e.what() << std::endl;
01577     }
01578   }
01579 
01580   return true;
01581 
01582 }
01583 #endif
01584 
01585 void EELaserClient::analyze(void) {
01586 
01587   ievt_++;
01588   jevt_++;
01589   if ( ievt_ % 10 == 0 ) {
01590     if ( debug_ ) std::cout << "EELaserClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
01591   }
01592 
01593   uint32_t bits01 = 0;
01594   bits01 |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
01595   bits01 |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
01596 
01597   uint32_t bits02 = 0;
01598   bits02 |= 1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR;
01599   bits02 |= 1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR;
01600 
01601   uint32_t bits03 = 0;
01602   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR;
01603   bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR;
01604 
01605   uint32_t bits04 = 0;
01606   bits04 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR;
01607   bits04 |= 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR;
01608 
01609   MonitorElement* me;
01610 
01611   for ( unsigned int i=0; i<superModules_.size(); i++ ) {
01612 
01613     int ism = superModules_[i];
01614 
01615     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01616 
01617       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/EELT amplitude " + Numbers::sEE(ism) + " L1" );
01618       h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
01619 
01620       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/EELT amplitude over PN " + Numbers::sEE(ism) + " L1" );
01621       h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
01622 
01623     }
01624 
01625     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01626 
01627       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/EELT amplitude " + Numbers::sEE(ism) + " L2" );
01628       h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
01629 
01630       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/EELT amplitude over PN " + Numbers::sEE(ism) + " L2" );
01631       h04_[ism-1] = UtilsClient::getHisto( me, cloneME_, h04_[ism-1] );
01632 
01633     }
01634 
01635     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01636 
01637       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/EELT amplitude " + Numbers::sEE(ism) + " L3" );
01638       h05_[ism-1] = UtilsClient::getHisto( me, cloneME_, h05_[ism-1] );
01639 
01640       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/EELT amplitude over PN " + Numbers::sEE(ism) + " L3" );
01641       h06_[ism-1] = UtilsClient::getHisto( me, cloneME_, h06_[ism-1] );
01642 
01643     }
01644 
01645     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01646 
01647       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/EELT amplitude " + Numbers::sEE(ism) + " L4" );
01648       h07_[ism-1] = UtilsClient::getHisto( me, cloneME_, h07_[ism-1] );
01649 
01650       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/EELT amplitude over PN " + Numbers::sEE(ism) + " L4" );
01651       h08_[ism-1] = UtilsClient::getHisto( me, cloneME_, h08_[ism-1] );
01652 
01653     }
01654 
01655     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01656 
01657       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/EELT timing " + Numbers::sEE(ism) + " L1" );
01658       h09_[ism-1] = UtilsClient::getHisto( me, cloneME_, h09_[ism-1] );
01659 
01660     }
01661 
01662     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01663 
01664       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/EELT timing " + Numbers::sEE(ism) + " L2" );
01665       h10_[ism-1] = UtilsClient::getHisto( me, cloneME_, h10_[ism-1] );
01666 
01667     }
01668 
01669     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01670 
01671       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/EELT timing " + Numbers::sEE(ism) + " L3" );
01672       h11_[ism-1] = UtilsClient::getHisto( me, cloneME_, h11_[ism-1] );
01673 
01674     }
01675 
01676     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01677 
01678       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/EELT timing " + Numbers::sEE(ism) + " L4" );
01679       h12_[ism-1] = UtilsClient::getHisto( me, cloneME_, h12_[ism-1] );
01680 
01681     }
01682 
01683     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01684 
01685       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/EELT shape " + Numbers::sEE(ism) + " L1" );
01686       hs01_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs01_[ism-1] );
01687 
01688     }
01689 
01690     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01691 
01692       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/EELT shape " + Numbers::sEE(ism) + " L2" );
01693       hs02_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs02_[ism-1] );
01694 
01695     }
01696 
01697     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01698 
01699       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/EELT shape " + Numbers::sEE(ism) + " L3" );
01700       hs03_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs03_[ism-1] );
01701 
01702     }
01703 
01704     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01705 
01706       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/EELT shape " + Numbers::sEE(ism) + " L4" );
01707       hs04_[ism-1] = UtilsClient::getHisto( me, cloneME_, hs04_[ism-1] );
01708 
01709     }
01710 
01711     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01712 
01713       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/PN/Gain01/EELT PNs amplitude " + Numbers::sEE(ism) + " G01 L1" );
01714       i01_[ism-1] = UtilsClient::getHisto( me, cloneME_, i01_[ism-1] );
01715 
01716     }
01717 
01718     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01719 
01720       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/PN/Gain01/EELT PNs amplitude " + Numbers::sEE(ism) + " G01 L2" );
01721       i02_[ism-1] = UtilsClient::getHisto( me, cloneME_, i02_[ism-1] );
01722 
01723     }
01724 
01725     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01726 
01727       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/PN/Gain01/EELT PNs amplitude " + Numbers::sEE(ism) + " G01 L3" );
01728       i03_[ism-1] = UtilsClient::getHisto( me, cloneME_, i03_[ism-1] );
01729 
01730     }
01731 
01732     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01733 
01734       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/PN/Gain01/EELT PNs amplitude " + Numbers::sEE(ism) + " G01 L4" );
01735       i04_[ism-1] = UtilsClient::getHisto( me, cloneME_, i04_[ism-1] );
01736 
01737     }
01738 
01739     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01740 
01741       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/PN/Gain01/EELT PNs pedestal " + Numbers::sEE(ism) + " G01 L1" );
01742       i05_[ism-1] = UtilsClient::getHisto( me, cloneME_, i05_[ism-1] );
01743 
01744     }
01745 
01746     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01747 
01748       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/PN/Gain01/EELT PNs pedestal " + Numbers::sEE(ism) + " G01 L2" );
01749       i06_[ism-1] = UtilsClient::getHisto( me, cloneME_, i06_[ism-1] );
01750 
01751     }
01752 
01753     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01754 
01755       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/PN/Gain01/EELT PNs pedestal " + Numbers::sEE(ism) + " G01 L3" );
01756       i07_[ism-1] = UtilsClient::getHisto( me, cloneME_, i07_[ism-1] );
01757 
01758     }
01759 
01760     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01761 
01762       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/PN/Gain01/EELT PNs pedestal " + Numbers::sEE(ism) + " G01 L4" );
01763       i08_[ism-1] = UtilsClient::getHisto( me, cloneME_, i08_[ism-1] );
01764 
01765     }
01766 
01767     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01768 
01769       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/PN/Gain16/EELT PNs amplitude " + Numbers::sEE(ism) + " G16 L1" );
01770       i09_[ism-1] = UtilsClient::getHisto( me, cloneME_, i09_[ism-1] );
01771 
01772     }
01773 
01774     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01775 
01776       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/PN/Gain16/EELT PNs amplitude " + Numbers::sEE(ism) + " G16 L2" );
01777       i10_[ism-1] = UtilsClient::getHisto( me, cloneME_, i10_[ism-1] );
01778 
01779     }
01780 
01781     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01782 
01783       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/PN/Gain16/EELT PNs amplitude " + Numbers::sEE(ism) + " G16 L3" );
01784       i11_[ism-1] = UtilsClient::getHisto( me, cloneME_, i11_[ism-1] );
01785 
01786     }
01787 
01788     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01789 
01790       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/PN/Gain16/EELT PNs amplitude " + Numbers::sEE(ism) + " G16 L4" );
01791       i12_[ism-1] = UtilsClient::getHisto( me, cloneME_, i12_[ism-1] );
01792 
01793     }
01794 
01795     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
01796 
01797       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser1/PN/Gain16/EELT PNs pedestal " + Numbers::sEE(ism) + " G16 L1" );
01798       i13_[ism-1] = UtilsClient::getHisto( me, cloneME_, i13_[ism-1] );
01799 
01800     }
01801 
01802     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
01803 
01804       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser2/PN/Gain16/EELT PNs pedestal " + Numbers::sEE(ism) + " G16 L2" );
01805       i14_[ism-1] = UtilsClient::getHisto( me, cloneME_, i14_[ism-1] );
01806 
01807     }
01808 
01809     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
01810 
01811       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser3/PN/Gain16/EELT PNs pedestal " + Numbers::sEE(ism) + " G16 L3" );
01812       i15_[ism-1] = UtilsClient::getHisto( me, cloneME_, i15_[ism-1] );
01813 
01814     }
01815 
01816     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
01817 
01818       me = dqmStore_->get( prefixME_ + "/EELaserTask/Laser4/PN/Gain16/EELT PNs pedestal " + Numbers::sEE(ism) + " G16 L4" );
01819       i16_[ism-1] = UtilsClient::getHisto( me, cloneME_, i16_[ism-1] );
01820 
01821     }
01822 
01823     if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
01824     if ( meg02_[ism-1] ) meg02_[ism-1]->Reset();
01825     if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
01826     if ( meg04_[ism-1] ) meg04_[ism-1]->Reset();
01827 
01828     if ( meg05_[ism-1] ) meg05_[ism-1]->Reset();
01829     if ( meg06_[ism-1] ) meg06_[ism-1]->Reset();
01830     if ( meg07_[ism-1] ) meg07_[ism-1]->Reset();
01831     if ( meg08_[ism-1] ) meg08_[ism-1]->Reset();
01832     if ( meg09_[ism-1] ) meg09_[ism-1]->Reset();
01833     if ( meg10_[ism-1] ) meg10_[ism-1]->Reset();
01834     if ( meg11_[ism-1] ) meg11_[ism-1]->Reset();
01835     if ( meg12_[ism-1] ) meg12_[ism-1]->Reset();
01836 
01837     if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
01838     if ( mea02_[ism-1] ) mea02_[ism-1]->Reset();
01839     if ( mea03_[ism-1] ) mea03_[ism-1]->Reset();
01840     if ( mea04_[ism-1] ) mea04_[ism-1]->Reset();
01841 
01842     if ( met01_[ism-1] ) met01_[ism-1]->Reset();
01843     if ( met02_[ism-1] ) met02_[ism-1]->Reset();
01844     if ( met03_[ism-1] ) met03_[ism-1]->Reset();
01845     if ( met04_[ism-1] ) met04_[ism-1]->Reset();
01846 
01847     if ( metav01_[ism-1] ) metav01_[ism-1]->Reset();
01848     if ( metav02_[ism-1] ) metav02_[ism-1]->Reset();
01849     if ( metav03_[ism-1] ) metav03_[ism-1]->Reset();
01850     if ( metav04_[ism-1] ) metav04_[ism-1]->Reset();
01851 
01852     if ( metrms01_[ism-1] ) metrms01_[ism-1]->Reset();
01853     if ( metrms02_[ism-1] ) metrms02_[ism-1]->Reset();
01854     if ( metrms03_[ism-1] ) metrms03_[ism-1]->Reset();
01855     if ( metrms04_[ism-1] ) metrms04_[ism-1]->Reset();
01856 
01857     if ( meaopn01_[ism-1] ) meaopn01_[ism-1]->Reset();
01858     if ( meaopn02_[ism-1] ) meaopn02_[ism-1]->Reset();
01859     if ( meaopn03_[ism-1] ) meaopn03_[ism-1]->Reset();
01860     if ( meaopn04_[ism-1] ) meaopn04_[ism-1]->Reset();
01861 
01862     if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Reset();
01863     if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Reset();
01864     if ( mepnprms03_[ism-1] ) mepnprms03_[ism-1]->Reset();
01865     if ( mepnprms04_[ism-1] ) mepnprms04_[ism-1]->Reset();
01866     if ( mepnprms05_[ism-1] ) mepnprms05_[ism-1]->Reset();
01867     if ( mepnprms06_[ism-1] ) mepnprms06_[ism-1]->Reset();
01868     if ( mepnprms07_[ism-1] ) mepnprms07_[ism-1]->Reset();
01869     if ( mepnprms08_[ism-1] ) mepnprms08_[ism-1]->Reset();
01870 
01871     if ( me_hs01_[ism-1] ) me_hs01_[ism-1]->Reset();
01872     if ( me_hs02_[ism-1] ) me_hs02_[ism-1]->Reset();
01873     if ( me_hs03_[ism-1] ) me_hs03_[ism-1]->Reset();
01874     if ( me_hs04_[ism-1] ) me_hs04_[ism-1]->Reset();
01875 
01876     float meanAmplL1, meanAmplL2, meanAmplL3, meanAmplL4;
01877 
01878     int nCryL1, nCryL2, nCryL3, nCryL4;
01879 
01880     meanAmplL1 = meanAmplL2 = meanAmplL3 = meanAmplL4 = 0.;
01881 
01882     nCryL1 = nCryL2 = nCryL3 = nCryL4 = 0;
01883 
01884     bool l1Data(false), l2Data(false), l3Data(false), l4Data(false);
01885 
01886     for ( int ix = 1; ix <= 50; ix++ ) {
01887       for ( int iy = 1; iy <= 50; iy++ ) {
01888 
01889         bool update01;
01890         bool update02;
01891         bool update03;
01892         bool update04;
01893 
01894         float num01, num02, num03, num04;
01895         float mean01, mean02, mean03, mean04;
01896         float rms01, rms02, rms03, rms04;
01897 
01898         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
01899         update02 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num02, mean02, rms02);
01900         update03 = UtilsClient::getBinStatistics(h05_[ism-1], ix, iy, num03, mean03, rms03);
01901         update04 = UtilsClient::getBinStatistics(h07_[ism-1], ix, iy, num04, mean04, rms04);
01902 
01903         if(update01) l1Data = true;
01904         if(update02) l2Data = true;
01905         if(update03) l3Data = true;
01906         if(update04) l4Data = true;
01907 
01908         if ( update01 ) {
01909           meanAmplL1 += mean01;
01910           nCryL1++;
01911         }
01912 
01913         if ( update02 ) {
01914           meanAmplL2 += mean02;
01915           nCryL2++;
01916         }
01917 
01918         if ( update03 ) {
01919           meanAmplL3 += mean03;
01920           nCryL3++;
01921         }
01922 
01923         if ( update04 ) {
01924           meanAmplL4 += mean04;
01925           nCryL4++;
01926         }
01927 
01928       }
01929     }
01930 
01931     if ( nCryL1 > 0 ) meanAmplL1 /= float (nCryL1);
01932     if ( nCryL2 > 0 ) meanAmplL2 /= float (nCryL2);
01933     if ( nCryL3 > 0 ) meanAmplL3 /= float (nCryL3);
01934     if ( nCryL4 > 0 ) meanAmplL4 /= float (nCryL4);
01935 
01936     for ( int ix = 1; ix <= 50; ix++ ) {
01937       for ( int iy = 1; iy <= 50; iy++ ) {
01938 
01939         if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 6.);
01940         if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 6.);
01941         if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 6.);
01942         if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( ix, iy, 6.);
01943 
01944         int jx = ix + Numbers::ix0EE(ism);
01945         int jy = iy + Numbers::iy0EE(ism);
01946 
01947         if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;
01948 
01949         if ( Numbers::validEE(ism, jx, jy) ) {
01950           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2.);
01951           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, 2.);
01952           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 2.);
01953           if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( ix, iy, 2.);
01954         }
01955 
01956         bool update01;
01957         bool update02;
01958         bool update03;
01959         bool update04;
01960         bool update05;
01961         bool update06;
01962         bool update07;
01963         bool update08;
01964         bool update09;
01965         bool update10;
01966         bool update11;
01967         bool update12;
01968 
01969         float num01, num02, num03, num04, num05, num06, num07, num08;
01970         float num09, num10, num11, num12;
01971         float mean01, mean02, mean03, mean04, mean05, mean06, mean07, mean08;
01972         float mean09, mean10, mean11, mean12;
01973         float rms01, rms02, rms03, rms04, rms05, rms06, rms07, rms08;
01974         float rms09, rms10, rms11, rms12;
01975 
01976         update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
01977         update02 = UtilsClient::getBinStatistics(h02_[ism-1], ix, iy, num02, mean02, rms02);
01978         update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);
01979         update04 = UtilsClient::getBinStatistics(h04_[ism-1], ix, iy, num04, mean04, rms04);
01980         update05 = UtilsClient::getBinStatistics(h05_[ism-1], ix, iy, num05, mean05, rms05);
01981         update06 = UtilsClient::getBinStatistics(h06_[ism-1], ix, iy, num06, mean06, rms06);
01982         update07 = UtilsClient::getBinStatistics(h07_[ism-1], ix, iy, num07, mean07, rms07);
01983         update08 = UtilsClient::getBinStatistics(h08_[ism-1], ix, iy, num08, mean08, rms08);
01984         update09 = UtilsClient::getBinStatistics(h09_[ism-1], ix, iy, num09, mean09, rms09);
01985         update10 = UtilsClient::getBinStatistics(h10_[ism-1], ix, iy, num10, mean10, rms10);
01986         update11 = UtilsClient::getBinStatistics(h11_[ism-1], ix, iy, num11, mean11, rms11);
01987         update12 = UtilsClient::getBinStatistics(h12_[ism-1], ix, iy, num12, mean12, rms12);
01988 
01989         if ( update01 ) {
01990 
01991           float val;
01992 
01993           val = 1.;
01994           if ( std::abs(mean01 - meanAmplL1) > std::abs(percentVariation_ * meanAmplL1) || mean01 < amplitudeThreshold_ || rms01 > rmsThresholdRelative_ * mean01 )
01995             val = 0.;
01996           if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, val );
01997 
01998           int ic = Numbers::icEE(ism, jx, jy);
01999 
02000           if ( ic != -1 ) {
02001             if ( mea01_[ism-1] ) {
02002               if ( mean01 > 0. ) {
02003                 mea01_[ism-1]->setBinContent( ic, mean01 );
02004                 mea01_[ism-1]->setBinError( ic, rms01 );
02005               } else {
02006                 mea01_[ism-1]->setEntries( 1.+mea01_[ism-1]->getEntries() );
02007               }
02008             }
02009           }
02010 
02011         }
02012 
02013         if ( update03 ) {
02014 
02015           float val;
02016 
02017           val = 1.;
02018           if ( std::abs(mean03 - meanAmplL2) > std::abs(percentVariation_ * meanAmplL2) || mean03 < amplitudeThreshold_ || rms03 > rmsThresholdRelative_ * mean03 )
02019             val = 0.;
02020           if ( meg02_[ism-1] ) meg02_[ism-1]->setBinContent( ix, iy, val );
02021 
02022           int ic = Numbers::icEE(ism, jx, jy);
02023 
02024           if ( ic != -1 ) {
02025             if ( mea02_[ism-1] ) {
02026               if ( mean03 > 0. ) {
02027                 mea02_[ism-1]->setBinContent( ic, mean03 );
02028                 mea02_[ism-1]->setBinError( ic, rms03 );
02029               } else {
02030                 mea02_[ism-1]->setEntries( 1.+mea02_[ism-1]->getEntries() );
02031               }
02032             }
02033           }
02034 
02035         }
02036 
02037         if ( update05 ) {
02038 
02039           float val;
02040 
02041           val = 1.;
02042           if ( std::abs(mean05 - meanAmplL3) > std::abs(percentVariation_ * meanAmplL3) || mean05 < amplitudeThreshold_ || rms05 > rmsThresholdRelative_ * mean05 )
02043             val = 0.;
02044           if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, val );
02045 
02046           int ic = Numbers::icEE(ism, jx, jy);
02047 
02048           if ( ic != -1 ) {
02049             if ( mea03_[ism-1] ) {
02050               if ( mean05 > 0. ) {
02051                 mea03_[ism-1]->setBinContent( ic, mean05 );
02052                 mea03_[ism-1]->setBinError( ic, rms05 );
02053               } else {
02054                 mea03_[ism-1]->setEntries( 1.+mea03_[ism-1]->getEntries() );
02055               }
02056             }
02057           }
02058 
02059         }
02060 
02061         if ( update07 ) {
02062 
02063           float val;
02064 
02065           val = 1.;
02066           if ( std::abs(mean07 - meanAmplL4) > std::abs(percentVariation_ * meanAmplL4) || mean07 < amplitudeThreshold_ || rms07 > rmsThresholdRelative_ * mean07 )
02067             val = 0.;
02068           if ( meg04_[ism-1] ) meg04_[ism-1]->setBinContent( ix, iy, val );
02069 
02070           int ic = Numbers::icEE(ism, jx, jy);
02071 
02072           if ( ic != -1 ) {
02073             if ( mea04_[ism-1] ) {
02074               if ( mean07 > 0. ) {
02075                 mea04_[ism-1]->setBinContent( ic, mean07 );
02076                 mea04_[ism-1]->setBinError( ic, rms07 );
02077               } else {
02078                 mea04_[ism-1]->setEntries( 1.+mea04_[ism-1]->getEntries() );
02079               }
02080             }
02081           }
02082 
02083         }
02084 
02085         if ( Masks::maskChannel(ism, ix, iy, bits01, EcalEndcap) ) {
02086           UtilsClient::maskBinContent( meg01_[ism-1], ix, iy );
02087           UtilsClient::maskBinContent( meg02_[ism-1], ix, iy );
02088           UtilsClient::maskBinContent( meg03_[ism-1], ix, iy );
02089           UtilsClient::maskBinContent( meg04_[ism-1], ix, iy );
02090         }
02091 
02092         if ( update02 ) {
02093 
02094           int ic = Numbers::icEE(ism, jx, jy);
02095 
02096           if ( ic != -1 ) {
02097             if ( meaopn01_[ism-1] ) {
02098               if ( mean02 > 0. ) {
02099                 meaopn01_[ism-1]->setBinContent( ic, mean02 );
02100                 meaopn01_[ism-1]->setBinError( ic, rms02 );
02101               } else {
02102                 meaopn01_[ism-1]->setEntries( 1.+meaopn01_[ism-1]->getEntries() );
02103               }
02104             }
02105           }
02106 
02107         }
02108 
02109         if ( update04 ) {
02110 
02111           int ic = Numbers::icEE(ism, jx, jy);
02112 
02113           if ( ic != -1 ) {
02114             if ( meaopn02_[ism-1] ) {
02115               if ( mean04 > 0. ) {
02116                 meaopn02_[ism-1]->setBinContent( ic, mean04 );
02117                 meaopn02_[ism-1]->setBinError( ic, rms04 );
02118               } else {
02119                 meaopn02_[ism-1]->setEntries( 1.+meaopn02_[ism-1]->getEntries() );
02120               }
02121             }
02122           }
02123 
02124         }
02125 
02126         if ( update06 ) {
02127 
02128           int ic = Numbers::icEE(ism, jx, jy);
02129 
02130           if ( ic != -1 ) {
02131             if ( meaopn03_[ism-1] ) {
02132               if ( mean06 > 0. ) {
02133                 meaopn03_[ism-1]->setBinContent( ic, mean06 );
02134                 meaopn03_[ism-1]->setBinError( ic, rms06 );
02135               } else {
02136                 meaopn03_[ism-1]->setEntries( 1.+meaopn03_[ism-1]->getEntries() );
02137               }
02138             }
02139           }
02140 
02141         }
02142 
02143         if ( update08 ) {
02144 
02145           int ic = Numbers::icEE(ism, jx, jy);
02146 
02147           if ( ic != -1 ) {
02148             if ( meaopn04_[ism-1] ) {
02149               if ( mean08 > 0. ) {
02150                 meaopn04_[ism-1]->setBinContent( ic, mean08 );
02151                 meaopn04_[ism-1]->setBinError( ic, rms08 );
02152               } else {
02153                 meaopn04_[ism-1]->setEntries( 1.+meaopn04_[ism-1]->getEntries() );
02154               }
02155             }
02156           }
02157 
02158         }
02159 
02160         if ( update09 ) {
02161 
02162           int ic = Numbers::icEE(ism, jx, jy);
02163 
02164           if ( ic != -1 ) {
02165             if ( met01_[ism-1] ) {
02166               if ( mean09 > 0. ) {
02167                 met01_[ism-1]->setBinContent( ic, mean09 );
02168                 met01_[ism-1]->setBinError( ic, rms09 );
02169               } else {
02170                 met01_[ism-1]->setEntries(1.+met01_[ism-1]->getEntries());
02171               }
02172             }
02173 
02174             if ( metav01_[ism-1] ) metav01_[ism-1] ->Fill(mean09);
02175             if ( metrms01_[ism-1] ) metrms01_[ism-1]->Fill(rms09);
02176           }
02177 
02178         }
02179 
02180         if ( update10 ) {
02181 
02182           int ic = Numbers::icEE(ism, jx, jy);
02183 
02184           if ( ic != -1 ) {
02185             if ( met02_[ism-1] ) {
02186               if ( mean10 > 0. ) {
02187                 met02_[ism-1]->setBinContent( ic, mean10 );
02188                 met02_[ism-1]->setBinError( ic, rms10 );
02189               } else {
02190                 met02_[ism-1]->setEntries(1.+met02_[ism-1]->getEntries());
02191               }
02192             }
02193 
02194             if ( metav02_[ism-1] ) metav02_[ism-1] ->Fill(mean10);
02195             if ( metrms02_[ism-1] ) metrms02_[ism-1]->Fill(rms10);
02196           }
02197 
02198         }
02199 
02200 
02201         if ( update11 ) {
02202 
02203           int ic = Numbers::icEE(ism, jx, jy);
02204 
02205           if ( ic != -1 ) {
02206             if ( met03_[ism-1] ) {
02207               if ( mean11 > 0. ) {
02208                 met03_[ism-1]->setBinContent( ic, mean11 );
02209                 met03_[ism-1]->setBinError( ic, rms11 );
02210               } else {
02211                 met03_[ism-1]->setEntries(1.+met03_[ism-1]->getEntries());
02212               }
02213             }
02214 
02215             if ( metav03_[ism-1] ) metav03_[ism-1] ->Fill(mean11);
02216             if ( metrms03_[ism-1] ) metrms03_[ism-1]->Fill(rms11);
02217           }
02218 
02219         }
02220 
02221         if ( update12 ) {
02222 
02223           int ic = Numbers::icEE(ism, jx, jy);
02224 
02225           if ( ic != -1 ) {
02226             if ( met04_[ism-1] ) {
02227               if ( mean12 > 0. ) {
02228                 met04_[ism-1]->setBinContent( ic, mean12 );
02229                 met04_[ism-1]->setBinError( ic, rms12 );
02230               } else {
02231                 met04_[ism-1]->setEntries(1.+met04_[ism-1]->getEntries());
02232               }
02233             }
02234 
02235             if ( metav04_[ism-1] ) metav04_[ism-1] ->Fill(mean12);
02236             if ( metrms04_[ism-1] ) metrms04_[ism-1]->Fill(rms12);
02237           }
02238 
02239         }
02240 
02241       }
02242     }
02243 
02244     for ( int i = 1; i <= 10; i++ ) {
02245 
02246       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 6. );
02247       if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 6. );
02248       if ( meg07_[ism-1] ) meg07_[ism-1]->setBinContent( i, 1, 6. );
02249       if ( meg08_[ism-1] ) meg08_[ism-1]->setBinContent( i, 1, 6. );
02250       if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 6. );
02251       if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 6. );
02252       if ( meg11_[ism-1] ) meg11_[ism-1]->setBinContent( i, 1, 6. );
02253       if ( meg12_[ism-1] ) meg12_[ism-1]->setBinContent( i, 1, 6. );
02254 
02255       // non-existing mem
02256       if ( (ism >=  3 && ism <=  4) || (ism >=  7 && ism <=  9) ) continue;
02257       if ( (ism >= 12 && ism <= 13) || (ism >= 16 && ism <= 18) ) continue;
02258 
02259       if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent( i, 1, 2. );
02260       if ( meg06_[ism-1] ) meg06_[ism-1]->setBinContent( i, 1, 2. );
02261       if ( meg07_[ism-1] ) meg07_[ism-1]->setBinContent( i, 1, 2. );
02262       if ( meg08_[ism-1] ) meg08_[ism-1]->setBinContent( i, 1, 2. );
02263       if ( meg09_[ism-1] ) meg09_[ism-1]->setBinContent( i, 1, 2. );
02264       if ( meg10_[ism-1] ) meg10_[ism-1]->setBinContent( i, 1, 2. );
02265       if ( meg11_[ism-1] ) meg11_[ism-1]->setBinContent( i, 1, 2. );
02266       if ( meg12_[ism-1] ) meg12_[ism-1]->setBinContent( i, 1, 2. );
02267 
02268       bool update01;
02269       bool update02;
02270       bool update03;
02271       bool update04;
02272       bool update05;
02273       bool update06;
02274       bool update07;
02275       bool update08;
02276       bool update09;
02277       bool update10;
02278       bool update11;
02279       bool update12;
02280       bool update13;
02281       bool update14;
02282       bool update15;
02283       bool update16;
02284 
02285       float num01, num02, num03, num04, num05, num06, num07, num08;
02286       float num09, num10, num11, num12, num13, num14, num15, num16;
02287       float mean01, mean02, mean03, mean04, mean05, mean06, mean07, mean08;
02288       float mean09, mean10, mean11, mean12, mean13, mean14, mean15, mean16;
02289       float rms01, rms02, rms03, rms04, rms05, rms06, rms07, rms08;
02290       float rms09, rms10, rms11, rms12, rms13, rms14, rms15, rms16;
02291 
02292       update01 = UtilsClient::getBinStatistics(i01_[ism-1], i, 0, num01, mean01, rms01);
02293       update02 = UtilsClient::getBinStatistics(i02_[ism-1], i, 0, num02, mean02, rms02);
02294       update03 = UtilsClient::getBinStatistics(i03_[ism-1], i, 0, num03, mean03, rms03);
02295       update04 = UtilsClient::getBinStatistics(i04_[ism-1], i, 0, num04, mean04, rms04);
02296       update05 = UtilsClient::getBinStatistics(i05_[ism-1], i, 0, num05, mean05, rms05);
02297       update06 = UtilsClient::getBinStatistics(i06_[ism-1], i, 0, num06, mean06, rms06);
02298       update07 = UtilsClient::getBinStatistics(i07_[ism-1], i, 0, num07, mean07, rms07);
02299       update08 = UtilsClient::getBinStatistics(i08_[ism-1], i, 0, num08, mean08, rms08);
02300       update09 = UtilsClient::getBinStatistics(i09_[ism-1], i, 0, num09, mean09, rms09);
02301       update10 = UtilsClient::getBinStatistics(i10_[ism-1], i, 0, num10, mean10, rms10);
02302       update11 = UtilsClient::getBinStatistics(i11_[ism-1], i, 0, num11, mean11, rms11);
02303       update12 = UtilsClient::getBinStatistics(i12_[ism-1], i, 0, num12, mean12, rms12);
02304       update13 = UtilsClient::getBinStatistics(i13_[ism-1], i, 0, num13, mean13, rms13);
02305       update14 = UtilsClient::getBinStatistics(i14_[ism-1], i, 0, num14, mean14, rms14);
02306       update15 = UtilsClient::getBinStatistics(i15_[ism-1], i, 0, num15, mean15, rms15);
02307       update16 = UtilsClient::getBinStatistics(i16_[ism-1], i, 0, num16, mean16, rms16);
02308 
02309       if ( update01 && update05 ) {
02310 
02311         float val;
02312 
02313         val = 1.;
02314         if ( mean01 < amplitudeThresholdPnG01_ )
02315           val = 0.;
02316         if ( mean05 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
02317              pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean05)
02318           val = 0.;
02319         if ( rms05 > pedPnRMSThreshold_[0] )
02320           val = 0.;
02321 
02322         if ( meg05_[ism-1] ) meg05_[ism-1]->setBinContent(i, 1, val);
02323         if ( mepnprms01_[ism-1] ) mepnprms01_[ism-1]->Fill(rms05);
02324 
02325       }
02326 
02327       if ( update02 && update06 ) {
02328 
02329         float val;
02330 
02331         val = 1.;
02332         if ( mean02 < amplitudeThresholdPnG01_ )
02333           val = 0.;
02334         if ( mean06 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
02335              pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean06)
02336           val = 0.;
02337         if ( rms06 > pedPnRMSThreshold_[0] )
02338           val = 0.;
02339 
02340         if ( meg06_[ism-1] )           meg06_[ism-1]->setBinContent(i, 1, val);
02341         if ( mepnprms02_[ism-1] ) mepnprms02_[ism-1]->Fill(rms06);
02342 
02343       }
02344 
02345       if ( update03 && update07 ) {
02346 
02347         float val;
02348 
02349         val = 1.;
02350         if ( mean03 < amplitudeThresholdPnG01_ )
02351           val = 0.;
02352       if ( mean07 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
02353            pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean07)
02354           val = 0.;
02355       if ( rms07 > pedPnRMSThreshold_[0] )
02356           val = 0.;
02357 
02358       if ( meg07_[ism-1] )           meg07_[ism-1]->setBinContent(i, 1, val);
02359       if ( mepnprms03_[ism-1] ) mepnprms03_[ism-1]->Fill(rms07);
02360 
02361       }
02362 
02363       if ( update04 && update08 ) {
02364 
02365         float val;
02366 
02367         val = 1.;
02368         if ( mean04 < amplitudeThresholdPnG01_ )
02369           val = 0.;
02370        if ( mean08 <  pedPnExpectedMean_[0] - pedPnDiscrepancyMean_[0] ||
02371             pedPnExpectedMean_[0] + pedPnDiscrepancyMean_[0] < mean08)
02372            val = 0.;
02373        if ( rms08 > pedPnRMSThreshold_[0] )
02374            val = 0.;
02375 
02376        if ( meg08_[ism-1] )           meg08_[ism-1]->setBinContent(i, 1, val);
02377        if ( mepnprms04_[ism-1] ) mepnprms04_[ism-1]->Fill(rms08);
02378 
02379       }
02380 
02381       if ( update09 && update13 ) {
02382 
02383         float val;
02384 
02385         val = 1.;
02386         if ( mean09 < amplitudeThresholdPnG16_ )
02387           val = 0.;
02388         if ( mean13 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
02389              pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean13)
02390           val = 0.;
02391         if ( rms13 > pedPnRMSThreshold_[1] )
02392           val = 0.;
02393 
02394         if ( meg09_[ism-1] )           meg09_[ism-1]->setBinContent(i, 1, val);
02395         if ( mepnprms05_[ism-1] ) mepnprms05_[ism-1]->Fill(rms13);
02396 
02397       }
02398       else if(l1Data){
02399         if ( meg09_[ism-1] )           meg09_[ism-1]->setBinContent(i, 1, 0.);
02400       }
02401 
02402       if ( update10 && update14 ) {
02403 
02404         float val;
02405 
02406         val = 1.;
02407         if ( mean10 < amplitudeThresholdPnG16_ )
02408           val = 0.;
02409         //        if ( mean14 < pedestalThresholdPn_ )
02410        if ( mean14 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
02411             pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean14)
02412            val = 0.;
02413        if ( rms14 > pedPnRMSThreshold_[1] )
02414           val = 0.;
02415 
02416        if ( meg10_[ism-1] )           meg10_[ism-1]->setBinContent(i, 1, val);
02417        if ( mepnprms06_[ism-1] ) mepnprms06_[ism-1]->Fill(rms14);
02418 
02419       }
02420       else if(l2Data){
02421         if ( meg10_[ism-1] )           meg10_[ism-1]->setBinContent(i, 1, 0.);
02422       }
02423 
02424       if ( update11 && update15 ) {
02425 
02426         float val;
02427 
02428         val = 1.;
02429         if ( mean11 < amplitudeThresholdPnG16_ )
02430           val = 0.;
02431         //        if ( mean15 < pedestalThresholdPn_ )
02432         if ( mean15 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
02433              pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean15)
02434           val = 0.;
02435         if ( rms15 > pedPnRMSThreshold_[1] )
02436           val = 0.;
02437 
02438         if ( meg11_[ism-1] ) meg11_[ism-1]->setBinContent(i, 1, val);
02439         if ( mepnprms07_[ism-1] ) mepnprms07_[ism-1]->Fill(rms15);
02440 
02441       }
02442       else if(l3Data){
02443         if ( meg11_[ism-1] )           meg11_[ism-1]->setBinContent(i, 1, 0.);
02444       }
02445 
02446       if ( update12 && update16 ) {
02447 
02448         float val;
02449 
02450         val = 1.;
02451         if ( mean12 < amplitudeThresholdPnG16_ )
02452           val = 0.;
02453         //        if ( mean16 < pedestalThresholdPn_ )
02454         if ( mean16 <  pedPnExpectedMean_[1] - pedPnDiscrepancyMean_[1] ||
02455                         pedPnExpectedMean_[1] + pedPnDiscrepancyMean_[1] < mean16)
02456           val = 0.;
02457         if ( rms16 > pedPnRMSThreshold_[1] )
02458           val = 0.;
02459 
02460         if ( meg12_[ism-1] ) meg12_[ism-1]->setBinContent(i, 1, val);
02461         if ( mepnprms08_[ism-1] ) mepnprms08_[ism-1]->Fill(rms16);
02462 
02463       }
02464       else if(l4Data){
02465         if ( meg12_[ism-1] )           meg12_[ism-1]->setBinContent(i, 1, 0.);
02466       }
02467 
02468       if ( Masks::maskPn(ism, i, bits01|bits03, EcalEndcap) ) {
02469         UtilsClient::maskBinContent( meg05_[ism-1], i, 1 );
02470         UtilsClient::maskBinContent( meg06_[ism-1], i, 1 );
02471         UtilsClient::maskBinContent( meg07_[ism-1], i, 1 );
02472         UtilsClient::maskBinContent( meg08_[ism-1], i, 1 );
02473       }
02474 
02475       if ( Masks::maskPn(ism, i, bits01|bits04, EcalEndcap) ) {
02476         UtilsClient::maskBinContent( meg09_[ism-1], i, 1 );
02477         UtilsClient::maskBinContent( meg10_[ism-1], i, 1 );
02478         UtilsClient::maskBinContent( meg11_[ism-1], i, 1 );
02479         UtilsClient::maskBinContent( meg12_[ism-1], i, 1 );
02480       }
02481 
02482     }
02483 
02484     for ( int i = 1; i <= 10; i++ ) {
02485 
02486       if ( hs01_[ism-1] ) {
02487         int ic = UtilsClient::getFirstNonEmptyChannel( hs01_[ism-1] );
02488         if ( me_hs01_[ism-1] ) {
02489           me_hs01_[ism-1]->setBinContent( i, hs01_[ism-1]->GetBinContent(ic, i) );
02490           me_hs01_[ism-1]->setBinError( i, hs01_[ism-1]->GetBinError(ic, i) );
02491         }
02492       }
02493 
02494       if ( hs02_[ism-1] ) {
02495         int ic = UtilsClient::getFirstNonEmptyChannel( hs02_[ism-1] );
02496         if ( me_hs02_[ism-1] ) {
02497           me_hs02_[ism-1]->setBinContent( i, hs02_[ism-1]->GetBinContent(ic, i) );
02498           me_hs02_[ism-1]->setBinError( i, hs02_[ism-1]->GetBinError(ic, i) );
02499         }
02500       }
02501 
02502       if ( hs03_[ism-1] ) {
02503         int ic = UtilsClient::getFirstNonEmptyChannel( hs03_[ism-1] );
02504         if ( me_hs03_[ism-1] ) {
02505           me_hs03_[ism-1]->setBinContent( i, hs03_[ism-1]->GetBinContent(ic, i) );
02506           me_hs03_[ism-1]->setBinError( i, hs03_[ism-1]->GetBinError(ic, i) );
02507         }
02508       }
02509 
02510       if ( hs04_[ism-1] ) {
02511         int ic = UtilsClient::getFirstNonEmptyChannel( hs04_[ism-1] );
02512         if ( me_hs04_[ism-1] ) {
02513           me_hs04_[ism-1]->setBinContent( i, hs04_[ism-1]->GetBinContent(ic, i) );
02514           me_hs04_[ism-1]->setBinError( i, hs04_[ism-1]->GetBinError(ic, i) );
02515         }
02516       }
02517 
02518     }
02519 
02520   }
02521 
02522 }
02523