00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <sstream>
00013 #include <iomanip>
00014 #include <vector>
00015
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020
00021 #include "DQMServices/Core/interface/DQMStore.h"
00022
00023 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00024 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00025 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
00026 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00027 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00028 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00029
00030 #include "DQM/EcalCommon/interface/Numbers.h"
00031
00032 #include "DQM/EcalBarrelMonitorTasks/interface/EBTestPulseTask.h"
00033
00034 EBTestPulseTask::EBTestPulseTask(const edm::ParameterSet& ps){
00035
00036 init_ = false;
00037
00038 dqmStore_ = edm::Service<DQMStore>().operator->();
00039
00040 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00041
00042 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00043
00044 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00045
00046 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00047 EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
00048 EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00049 EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection");
00050
00051 MGPAGains_.reserve(3);
00052 for ( unsigned int i = 1; i <= 3; i++ ) MGPAGains_.push_back(i);
00053 MGPAGains_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGains", MGPAGains_);
00054
00055 MGPAGainsPN_.reserve(2);
00056 for ( unsigned int i = 1; i <= 3; i++ ) MGPAGainsPN_.push_back(i);
00057 MGPAGainsPN_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGainsPN", MGPAGainsPN_);
00058
00059 for (int i = 0; i < 36; i++) {
00060 meShapeMapG01_[i] = 0;
00061 meAmplMapG01_[i] = 0;
00062 meShapeMapG06_[i] = 0;
00063 meAmplMapG06_[i] = 0;
00064 meShapeMapG12_[i] = 0;
00065 meAmplMapG12_[i] = 0;
00066 mePnAmplMapG01_[i] = 0;
00067 mePnPedMapG01_[i] = 0;
00068 mePnAmplMapG16_[i] = 0;
00069 mePnPedMapG16_[i] = 0;
00070 }
00071
00072
00073 }
00074
00075 EBTestPulseTask::~EBTestPulseTask(){
00076
00077 }
00078
00079 void EBTestPulseTask::beginJob(void){
00080
00081 ievt_ = 0;
00082
00083 if ( dqmStore_ ) {
00084 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask");
00085 dqmStore_->rmdir(prefixME_ + "/EBTestPulseTask");
00086 }
00087
00088 }
00089
00090 void EBTestPulseTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00091
00092 Numbers::initGeometry(c, false);
00093
00094 if ( ! mergeRuns_ ) this->reset();
00095
00096 }
00097
00098 void EBTestPulseTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00099
00100 }
00101
00102 void EBTestPulseTask::reset(void) {
00103
00104 for (int i = 0; i < 36; i++) {
00105 if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00106 if ( meShapeMapG01_[i] ) meShapeMapG01_[i]->Reset();
00107 if ( meAmplMapG01_[i] ) meAmplMapG01_[i]->Reset();
00108 }
00109 if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00110 if ( meShapeMapG06_[i] ) meShapeMapG06_[i]->Reset();
00111 if ( meAmplMapG06_[i] ) meAmplMapG06_[i]->Reset();
00112 }
00113 if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00114 if ( meShapeMapG12_[i] ) meShapeMapG12_[i]->Reset();
00115 if ( meAmplMapG12_[i] ) meAmplMapG12_[i]->Reset();
00116 }
00117 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00118 if ( mePnAmplMapG01_[i] ) mePnAmplMapG01_[i]->Reset();
00119 if ( mePnPedMapG01_[i] ) mePnPedMapG01_[i]->Reset();
00120 }
00121 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00122 if ( mePnAmplMapG16_[i] ) mePnAmplMapG16_[i]->Reset();
00123 if ( mePnPedMapG16_[i] ) mePnPedMapG16_[i]->Reset();
00124 }
00125 }
00126
00127 }
00128
00129 void EBTestPulseTask::setup(void){
00130
00131 init_ = true;
00132
00133 std::string name;
00134 std::stringstream GainN, GN;
00135
00136 if ( dqmStore_ ) {
00137 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask");
00138
00139 if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00140
00141 GainN.str("");
00142 GainN << "Gain" << std::setw(2) << std::setfill('0') << 1;
00143 GN.str("");
00144 GN << "G" << std::setw(2) << std::setfill('0') << 1;
00145
00146 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/" + GainN.str());
00147 for (int i = 0; i < 36; i++) {
00148 name = "EBTPT shape " + Numbers::sEB(i+1) + " " + GN.str();
00149 meShapeMapG01_[i] = dqmStore_->bookProfile2D(name, name, 1700, 0., 1700., 10, 0., 10., 4096, 0., 4096., "s");
00150 meShapeMapG01_[i]->setAxisTitle("channel", 1);
00151 meShapeMapG01_[i]->setAxisTitle("sample", 2);
00152 meShapeMapG01_[i]->setAxisTitle("amplitude", 3);
00153 dqmStore_->tag(meShapeMapG01_[i], i+1);
00154
00155 name = "EBTPT amplitude " + Numbers::sEB(i+1) + " " + GN.str(),
00156 meAmplMapG01_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096.*12., "s");
00157 meAmplMapG01_[i]->setAxisTitle("ieta", 1);
00158 meAmplMapG01_[i]->setAxisTitle("iphi", 2);
00159 dqmStore_->tag(meAmplMapG01_[i], i+1);
00160 }
00161
00162 }
00163
00164 if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00165
00166 GainN.str("");
00167 GainN << "Gain" << std::setw(2) << std::setfill('0') << 6;
00168 GN.str("");
00169 GN << "G" << std::setw(2) << std::setfill('0') << 6;
00170
00171 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/" + GainN.str());
00172 for (int i = 0; i < 36; i++) {
00173 name = "EBTPT shape " + Numbers::sEB(i+1) + " " + GN.str();
00174 meShapeMapG06_[i] = dqmStore_->bookProfile2D(name, name, 1700, 0., 1700., 10, 0., 10., 4096, 0., 4096., "s");
00175 meShapeMapG06_[i]->setAxisTitle("channel", 1);
00176 meShapeMapG06_[i]->setAxisTitle("sample", 2);
00177 meShapeMapG06_[i]->setAxisTitle("amplitude", 3);
00178 dqmStore_->tag(meShapeMapG06_[i], i+1);
00179
00180 name = "EBTPT amplitude " + Numbers::sEB(i+1) + " " + GN.str(),
00181 meAmplMapG06_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096.*12., "s");
00182 meAmplMapG06_[i]->setAxisTitle("ieta", 1);
00183 meAmplMapG06_[i]->setAxisTitle("iphi", 2);
00184 dqmStore_->tag(meAmplMapG06_[i], i+1);
00185 }
00186
00187 }
00188
00189 if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00190
00191 GainN.str("");
00192 GainN << "Gain" << std::setw(2) << std::setfill('0') << 12;
00193 GN.str("");
00194 GN << "G" << std::setw(2) << std::setfill('0') << 12;
00195
00196 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/" + GainN.str());
00197 for (int i = 0; i < 36; i++) {
00198 name = "EBTPT shape " + Numbers::sEB(i+1) + " " + GN.str();
00199 meShapeMapG12_[i] = dqmStore_->bookProfile2D(name, name, 1700, 0., 1700., 10, 0., 10., 4096, 0., 4096., "s");
00200 meShapeMapG12_[i]->setAxisTitle("channel", 1);
00201 meShapeMapG12_[i]->setAxisTitle("sample", 2);
00202 meShapeMapG12_[i]->setAxisTitle("amplitude", 3);
00203 dqmStore_->tag(meShapeMapG12_[i], i+1);
00204
00205 name = "EBTPT amplitude " + Numbers::sEB(i+1) + " " + GN.str(),
00206 meAmplMapG12_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096.*12., "s");
00207 meAmplMapG12_[i]->setAxisTitle("ieta", 1);
00208 meAmplMapG12_[i]->setAxisTitle("iphi", 2);
00209 dqmStore_->tag(meAmplMapG12_[i], i+1);
00210 }
00211
00212 }
00213
00214 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN");
00215
00216 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00217
00218 GainN.str("");
00219 GainN << "Gain" << std::setw(2) << std::setfill('0') << 1;
00220 GN.str("");
00221 GN << "G" << std::setw(2) << std::setfill('0') << 1;
00222
00223 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN/" + GainN.str());
00224 for (int i = 0; i < 36; i++) {
00225 name = "EBTPT PNs amplitude " + Numbers::sEB(i+1) + " " + GN.str();
00226 mePnAmplMapG01_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00227 mePnAmplMapG01_[i]->setAxisTitle("channel", 1);
00228 mePnAmplMapG01_[i]->setAxisTitle("amplitude", 2);
00229 dqmStore_->tag(mePnAmplMapG01_[i], i+1);
00230
00231 name = "EBTPT PNs pedestal " + Numbers::sEB(i+1) + " " + GN.str();
00232 mePnPedMapG01_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00233 mePnPedMapG01_[i]->setAxisTitle("channel", 1);
00234 mePnPedMapG01_[i]->setAxisTitle("pedestal", 2);
00235 dqmStore_->tag(mePnPedMapG01_[i], i+1);
00236 }
00237
00238 }
00239
00240 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00241
00242 GainN.str("");
00243 GainN << "Gain" << std::setw(2) << std::setfill('0') << 16;
00244 GN.str("");
00245 GN << "G" << std::setw(2) << std::setfill('0') << 16;
00246
00247 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN/" + GainN.str());
00248 for (int i = 0; i < 36; i++) {
00249 name = "EBTPT PNs amplitude " + Numbers::sEB(i+1) + " " + GN.str();
00250 mePnAmplMapG16_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00251 mePnAmplMapG16_[i]->setAxisTitle("channel", 1);
00252 mePnAmplMapG16_[i]->setAxisTitle("amplitude", 2);
00253 dqmStore_->tag(mePnAmplMapG16_[i], i+1);
00254
00255 name = "EBTPT PNs pedestal " + Numbers::sEB(i+1) + " " + GN.str();
00256 mePnPedMapG16_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00257 mePnPedMapG16_[i]->setAxisTitle("channel", 1);
00258 mePnPedMapG16_[i]->setAxisTitle("pedestal", 2);
00259 dqmStore_->tag(mePnPedMapG16_[i], i+1);
00260 }
00261
00262 }
00263
00264 }
00265
00266 }
00267
00268 void EBTestPulseTask::cleanup(void){
00269
00270 if ( ! init_ ) return;
00271
00272 if ( dqmStore_ ) {
00273 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask");
00274
00275 if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00276
00277 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/Gain01");
00278 for (int i = 0; i < 36; i++) {
00279 if ( meShapeMapG01_[i] ) dqmStore_->removeElement( meShapeMapG01_[i]->getName() );
00280 meShapeMapG01_[i] = 0;
00281 if ( meAmplMapG01_[i] ) dqmStore_->removeElement( meAmplMapG01_[i]->getName() );
00282 meAmplMapG01_[i] = 0;
00283 }
00284
00285 }
00286
00287 if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00288
00289 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/Gain06");
00290 for (int i = 0; i < 36; i++) {
00291 if ( meShapeMapG06_[i] ) dqmStore_->removeElement( meShapeMapG06_[i]->getName() );
00292 meShapeMapG06_[i] = 0;
00293 if ( meAmplMapG06_[i] ) dqmStore_->removeElement( meAmplMapG06_[i]->getName() );
00294 meAmplMapG06_[i] = 0;
00295 }
00296
00297 }
00298
00299 if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00300
00301 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/Gain12");
00302 for (int i = 0; i < 36; i++) {
00303 if ( meShapeMapG12_[i] ) dqmStore_->removeElement( meShapeMapG12_[i]->getName() );
00304 meShapeMapG12_[i] = 0;
00305 if ( meAmplMapG12_[i] ) dqmStore_->removeElement( meAmplMapG12_[i]->getName() );
00306 meAmplMapG12_[i] = 0;
00307 }
00308
00309 }
00310
00311 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN");
00312
00313 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00314
00315 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN/Gain01");
00316 for (int i = 0; i < 36; i++) {
00317 if ( mePnAmplMapG01_[i] ) dqmStore_->removeElement( mePnAmplMapG01_[i]->getName() );
00318 mePnAmplMapG01_[i] = 0;
00319 if ( mePnPedMapG01_[i] ) dqmStore_->removeElement( mePnPedMapG01_[i]->getName() );
00320 mePnPedMapG01_[i] = 0;
00321 }
00322
00323 }
00324
00325
00326 if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00327
00328 dqmStore_->setCurrentFolder(prefixME_ + "/EBTestPulseTask/PN/Gain16");
00329 for (int i = 0; i < 36; i++) {
00330 if ( mePnAmplMapG16_[i] ) dqmStore_->removeElement( mePnAmplMapG16_[i]->getName() );
00331 mePnAmplMapG16_[i] = 0;
00332 if ( mePnPedMapG16_[i] ) dqmStore_->removeElement( mePnPedMapG16_[i]->getName() );
00333 mePnPedMapG16_[i] = 0;
00334 }
00335
00336 }
00337
00338 }
00339
00340 init_ = false;
00341
00342 }
00343
00344 void EBTestPulseTask::endJob(void){
00345
00346 edm::LogInfo("EBTestPulseTask") << "analyzed " << ievt_ << " events";
00347
00348 if ( enableCleanup_ ) this->cleanup();
00349
00350 }
00351
00352 void EBTestPulseTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00353
00354 bool enable = false;
00355 int runType[36];
00356 for (int i=0; i<36; i++) runType[i] = -1;
00357 int mgpaGain[36];
00358 for (int i=0; i<36; i++) mgpaGain[i] = -1;
00359
00360 edm::Handle<EcalRawDataCollection> dcchs;
00361
00362 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00363
00364 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00365
00366 if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
00367
00368 int ism = Numbers::iSM( *dcchItr, EcalBarrel );
00369
00370 runType[ism-1] = dcchItr->getRunType();
00371 mgpaGain[ism-1] = dcchItr->getMgpaGain();
00372
00373 if ( dcchItr->getRunType() == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00374 dcchItr->getRunType() == EcalDCCHeaderBlock::TESTPULSE_GAP ) enable = true;
00375
00376 }
00377
00378 } else {
00379
00380 edm::LogWarning("EBTestPulseTask") << EcalRawDataCollection_ << " not available";
00381
00382 }
00383
00384 if ( ! enable ) return;
00385
00386 if ( ! init_ ) this->setup();
00387
00388 ievt_++;
00389
00390 edm::Handle<EBDigiCollection> digis;
00391
00392 if ( e.getByLabel(EBDigiCollection_, digis) ) {
00393
00394 int nebd = digis->size();
00395 LogDebug("EBTestPulseTask") << "event " << ievt_ << " digi collection size " << nebd;
00396
00397 for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00398
00399 EBDetId id = digiItr->id();
00400
00401 int ic = id.ic();
00402
00403 int ism = Numbers::iSM( id );
00404
00405 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00406 runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_GAP ) ) continue;
00407
00408 EBDataFrame dataframe = (*digiItr);
00409
00410 for (int i = 0; i < 10; i++) {
00411
00412 int adc = dataframe.sample(i).adc();
00413 float gain = 1.;
00414
00415 MonitorElement* meShapeMap = 0;
00416
00417 if ( dataframe.sample(i).gainId() == 1 ) gain = 1./12.;
00418 if ( dataframe.sample(i).gainId() == 2 ) gain = 1./ 6.;
00419 if ( dataframe.sample(i).gainId() == 3 ) gain = 1./ 1.;
00420
00421 if ( mgpaGain[ism-1] == 3 ) meShapeMap = meShapeMapG01_[ism-1];
00422 if ( mgpaGain[ism-1] == 2 ) meShapeMap = meShapeMapG06_[ism-1];
00423 if ( mgpaGain[ism-1] == 1 ) meShapeMap = meShapeMapG12_[ism-1];
00424
00425
00426 float xval = float(adc);
00427
00428 if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
00429
00430 }
00431
00432 }
00433
00434 } else {
00435
00436 edm::LogWarning("EBTestPulseTask") << EBDigiCollection_ << " not available";
00437
00438 }
00439
00440 edm::Handle<EcalUncalibratedRecHitCollection> hits;
00441
00442 if ( e.getByLabel(EcalUncalibratedRecHitCollection_, hits) ) {
00443
00444 int neh = hits->size();
00445 LogDebug("EBTestPulseTask") << "event " << ievt_ << " hits collection size " << neh;
00446
00447 for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
00448
00449 EBDetId id = hitItr->id();
00450
00451 int ic = id.ic();
00452 int ie = (ic-1)/20 + 1;
00453 int ip = (ic-1)%20 + 1;
00454
00455 int ism = Numbers::iSM( id );
00456
00457 float xie = ie - 0.5;
00458 float xip = ip - 0.5;
00459
00460 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00461 runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_GAP ) ) continue;
00462
00463 MonitorElement* meAmplMap = 0;
00464
00465 if ( mgpaGain[ism-1] == 3 ) meAmplMap = meAmplMapG01_[ism-1];
00466 if ( mgpaGain[ism-1] == 2 ) meAmplMap = meAmplMapG06_[ism-1];
00467 if ( mgpaGain[ism-1] == 1 ) meAmplMap = meAmplMapG12_[ism-1];
00468
00469 float xval = hitItr->amplitude();
00470 if ( xval <= 0. ) xval = 0.0;
00471
00472
00473
00474
00475
00476 if ( meAmplMap ) meAmplMap->Fill(xie, xip, xval);
00477
00478 }
00479
00480 } else {
00481
00482 edm::LogWarning("EBTestPulseTask") << EcalUncalibratedRecHitCollection_ << " not available";
00483
00484 }
00485
00486 edm::Handle<EcalPnDiodeDigiCollection> pns;
00487
00488 if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
00489
00490 int nep = pns->size();
00491 LogDebug("EBTestPulseTask") << "event " << ievt_ << " pns collection size " << nep;
00492
00493 for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
00494
00495 if ( Numbers::subDet( pnItr->id() ) != EcalBarrel ) continue;
00496
00497 int ism = Numbers::iSM( pnItr->id() );
00498
00499 int num = pnItr->id().iPnId();
00500
00501 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00502 runType[ism-1] == EcalDCCHeaderBlock::TESTPULSE_GAP ) ) continue;
00503
00504 float xvalped = 0.;
00505
00506 for (int i = 0; i < 4; i++) {
00507
00508 int adc = pnItr->sample(i).adc();
00509
00510 MonitorElement* mePNPed = 0;
00511
00512 if ( pnItr->sample(i).gainId() == 0 ) mePNPed = mePnPedMapG01_[ism-1];
00513 if ( pnItr->sample(i).gainId() == 1 ) mePNPed = mePnPedMapG16_[ism-1];
00514
00515 float xval = float(adc);
00516
00517 if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
00518
00519 xvalped = xvalped + xval;
00520
00521 }
00522
00523 xvalped = xvalped / 4;
00524
00525 float xvalmax = 0.;
00526
00527 MonitorElement* mePN = 0;
00528
00529 for (int i = 0; i < 50; i++) {
00530
00531 int adc = pnItr->sample(i).adc();
00532
00533 float xval = float(adc);
00534
00535 if ( xval >= xvalmax ) xvalmax = xval;
00536
00537 }
00538
00539 xvalmax = xvalmax - xvalped;
00540
00541 if ( pnItr->sample(0).gainId() == 0 ) mePN = mePnAmplMapG01_[ism-1];
00542 if ( pnItr->sample(0).gainId() == 1 ) mePN = mePnAmplMapG16_[ism-1];
00543
00544 if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
00545
00546 }
00547
00548 } else {
00549
00550 edm::LogWarning("EBTestPulseTask") << EcalPnDiodeDigiCollection_ << " not available";
00551
00552 }
00553
00554 }
00555