CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DQM/EcalBarrelMonitorClient/src/EBLaserClient.cc

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