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