CMS 3D CMS Logo

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

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