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