CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/DQM/EcalBarrelMonitorClient/src/EBTestPulseClient.cc

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