CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/EcalBarrelMonitorClient/src/EBTestPulseClient.cc

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