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