CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DQM/EcalBarrelMonitorTasks/src/EBPedestalTask.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBPedestalTask.cc
00003  *
00004  * $Date: 2010/08/08 08:46:05 $
00005  * $Revision: 1.101 $
00006  * \author G. Della Ricca
00007  *
00008 */
00009 
00010 #include <iostream>
00011 #include <fstream>
00012 #include <vector>
00013 #include <algorithm>
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/EBDetId.h"
00024 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
00025 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00026 
00027 #include "DQM/EcalCommon/interface/Numbers.h"
00028 
00029 #include "DQM/EcalBarrelMonitorTasks/interface/EBPedestalTask.h"
00030 
00031 // #define COMMON_NOISE_ANALYSIS
00032 
00033 EBPedestalTask::EBPedestalTask(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   EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
00047   EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00048 
00049   MGPAGains_.reserve(3);
00050   for ( unsigned int i = 1; i <= 3; i++ ) MGPAGains_.push_back(i);
00051   MGPAGains_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGains", MGPAGains_);
00052 
00053   MGPAGainsPN_.reserve(2);
00054   for ( unsigned int i = 1; i <= 3; i++ ) MGPAGainsPN_.push_back(i);
00055   MGPAGainsPN_ = ps.getUntrackedParameter<std::vector<int> >("MGPAGainsPN", MGPAGainsPN_);
00056 
00057   for (int i = 0; i < 36; i++) {
00058     mePedMapG01_[i] = 0;
00059     mePedMapG06_[i] = 0;
00060     mePedMapG12_[i] = 0;
00061 #ifdef COMMON_NOISE_ANALYSIS
00062     mePed3SumMapG01_[i] = 0;
00063     mePed3SumMapG06_[i] = 0;
00064     mePed3SumMapG12_[i] = 0;
00065     mePed5SumMapG01_[i] = 0;
00066     mePed5SumMapG06_[i] = 0;
00067     mePed5SumMapG12_[i] = 0;
00068 #endif
00069     mePnPedMapG01_[i] = 0;
00070     mePnPedMapG16_[i] = 0;
00071   }
00072 
00073 }
00074 
00075 EBPedestalTask::~EBPedestalTask(){
00076 
00077 }
00078 
00079 void EBPedestalTask::beginJob(void){
00080 
00081   ievt_ = 0;
00082 
00083   if ( dqmStore_ ) {
00084     dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask");
00085     dqmStore_->rmdir(prefixME_ + "/EBPedestalTask");
00086   }
00087 
00088 }
00089 
00090 void EBPedestalTask::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 EBPedestalTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00099 
00100 }
00101 
00102 void EBPedestalTask::reset(void) {
00103 
00104   for (int i = 0; i < 36; i++) {
00105     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00106       if ( mePedMapG01_[i] ) mePedMapG01_[i]->Reset();
00107     }
00108     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00109       if ( mePedMapG06_[i] ) mePedMapG06_[i]->Reset();
00110     }
00111     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00112       if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset();
00113     }
00114 #ifdef COMMON_NOISE_ANALYSIS
00115     if ( mePed3SumMapG01_[i] ) mePed3SumMapG01_[i]->Reset();
00116     if ( mePed3SumMapG06_[i] ) mePed3SumMapG06_[i]->Reset();
00117     if ( mePed3SumMapG12_[i] ) mePed3SumMapG12_[i]->Reset();
00118     if ( mePed5SumMapG01_[i] ) mePed5SumMapG01_[i]->Reset();
00119     if ( mePed5SumMapG06_[i] ) mePed5SumMapG06_[i]->Reset();
00120     if ( mePed5SumMapG12_[i] ) mePed5SumMapG12_[i]->Reset();
00121 #endif
00122     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00123       if ( mePnPedMapG01_[i] ) mePnPedMapG01_[i]->Reset();
00124     }
00125     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 12) != MGPAGainsPN_.end() ) {
00126       if ( mePnPedMapG16_[i] ) mePnPedMapG16_[i]->Reset();
00127     }
00128   }
00129 
00130 }
00131 
00132 void EBPedestalTask::setup(void){
00133 
00134   init_ = true;
00135 
00136   char histo[200];
00137 
00138   if ( dqmStore_ ) {
00139     dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask");
00140 
00141     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00142 
00143       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain01");
00144       for (int i = 0; i < 36; i++) {
00145         sprintf(histo, "EBPT pedestal %s G01", Numbers::sEB(i+1).c_str());
00146         mePedMapG01_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00147         mePedMapG01_[i]->setAxisTitle("ieta", 1);
00148         mePedMapG01_[i]->setAxisTitle("iphi", 2);
00149         dqmStore_->tag(mePedMapG01_[i], i+1);
00150 #ifdef COMMON_NOISE_ANALYSIS
00151         sprintf(histo, "EBPT pedestal 3sum %s G01", Numbers::sEB(i+1).c_str());
00152         mePed3SumMapG01_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00153         mePed3SumMapG01_[i]->setAxisTitle("ieta", 1);
00154         mePed3SumMapG01_[i]->setAxisTitle("iphi", 2);
00155         dqmStore_->tag(mePed3SumMapG01_[i], i+1);
00156         sprintf(histo, "EBPT pedestal 5sum %s G01", Numbers::sEB(i+1).c_str());
00157         mePed5SumMapG01_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00158         mePed5SumMapG01_[i]->setAxisTitle("ieta", 1);
00159         mePed5SumMapG01_[i]->setAxisTitle("iphi", 2);
00160         dqmStore_->tag(mePed5SumMapG01_[i], i+1);
00161 #endif
00162       }
00163 
00164     }
00165 
00166     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00167 
00168       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain06");
00169       for (int i = 0; i < 36; i++) {
00170         sprintf(histo, "EBPT pedestal %s G06", Numbers::sEB(i+1).c_str());
00171         mePedMapG06_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00172         mePedMapG06_[i]->setAxisTitle("ieta", 1);
00173         mePedMapG06_[i]->setAxisTitle("iphi", 2);
00174         dqmStore_->tag(mePedMapG06_[i], i+1);
00175 #ifdef COMMON_NOISE_ANALYSIS
00176         sprintf(histo, "EBPT pedestal 3sum %s G06", Numbers::sEB(i+1).c_str());
00177         mePed3SumMapG06_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00178         mePed3SumMapG06_[i]->setAxisTitle("ieta", 1);
00179         mePed3SumMapG06_[i]->setAxisTitle("iphi", 2);
00180         dqmStore_->tag(mePed3SumMapG06_[i], i+1);
00181         sprintf(histo, "EBPT pedestal 5sum %s G06", Numbers::sEB(i+1).c_str());
00182         mePed5SumMapG06_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00183         mePed5SumMapG06_[i]->setAxisTitle("ieta", 1);
00184         mePed5SumMapG06_[i]->setAxisTitle("iphi", 2);
00185         dqmStore_->tag(mePed5SumMapG06_[i], i+1);
00186 #endif
00187       }
00188 
00189     }
00190 
00191     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00192 
00193       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain12");
00194       for (int i = 0; i < 36; i++) {
00195         sprintf(histo, "EBPT pedestal %s G12", Numbers::sEB(i+1).c_str());
00196         mePedMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00197         mePedMapG12_[i]->setAxisTitle("ieta", 1);
00198         mePedMapG12_[i]->setAxisTitle("iphi", 2);
00199         dqmStore_->tag(mePedMapG12_[i], i+1);
00200         sprintf(histo, "EBPT pedestal 3sum %s G12", Numbers::sEB(i+1).c_str());
00201         mePed3SumMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00202         mePed3SumMapG12_[i]->setAxisTitle("ieta", 1);
00203         mePed3SumMapG12_[i]->setAxisTitle("iphi", 2);
00204         dqmStore_->tag(mePed3SumMapG12_[i], i+1);
00205 #ifdef COMMON_NOISE_ANALYSIS
00206         sprintf(histo, "EBPT pedestal 5sum %s G12", Numbers::sEB(i+1).c_str());
00207         mePed5SumMapG12_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
00208         mePed5SumMapG12_[i]->setAxisTitle("ieta", 1);
00209         mePed3SumMapG12_[i]->setAxisTitle("iphi", 2);
00210         dqmStore_->tag(mePed5SumMapG12_[i], i+1);
00211 #endif
00212       }
00213 
00214     }
00215 
00216 
00217     dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN");
00218 
00219     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00220 
00221       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN/Gain01");
00222       for (int i = 0; i < 36; i++) {
00223         sprintf(histo, "EBPDT PNs pedestal %s G01", Numbers::sEB(i+1).c_str());
00224         mePnPedMapG01_[i] =  dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00225         mePnPedMapG01_[i]->setAxisTitle("channel", 1);
00226         mePnPedMapG01_[i]->setAxisTitle("pedestal", 2);
00227         dqmStore_->tag(mePnPedMapG01_[i], i+1);
00228       }
00229 
00230     }
00231 
00232     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00233 
00234       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN/Gain16");
00235       for (int i = 0; i < 36; i++) {
00236         sprintf(histo, "EBPDT PNs pedestal %s G16", Numbers::sEB(i+1).c_str());
00237         mePnPedMapG16_[i] =  dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00238         mePnPedMapG16_[i]->setAxisTitle("channel", 1);
00239         mePnPedMapG16_[i]->setAxisTitle("pedestal", 2);
00240         dqmStore_->tag(mePnPedMapG16_[i], i+1);
00241       }
00242 
00243     }
00244 
00245   }
00246 
00247 }
00248 
00249 void EBPedestalTask::cleanup(void){
00250 
00251   if ( ! init_ ) return;
00252 
00253   if ( dqmStore_ ) {
00254     dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask");
00255 
00256     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00257 
00258       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain01");
00259       for ( int i = 0; i < 36; i++ ) {
00260         if ( mePedMapG01_[i] ) dqmStore_->removeElement( mePedMapG01_[i]->getName() );
00261         mePedMapG01_[i] = 0;
00262 #ifdef COMMON_NOISE_ANALYSIS
00263         if ( mePed3SumMapG01_[i] ) dqmStore_->removeElement( mePed3SumMapG01_[i]->getName() );
00264         mePed3SumMapG01_[i] = 0;
00265         if ( mePed5SumMapG01_[i] ) dqmStore_->removeElement( mePed5SumMapG01_[i]->getName() );
00266         mePed5SumMapG01_[i] = 0;
00267 #endif
00268       }
00269 
00270     }
00271 
00272     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00273 
00274       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain06");
00275       for ( int i = 0; i < 36; i++ ) {
00276         if ( mePedMapG06_[i] ) dqmStore_->removeElement( mePedMapG06_[i]->getName() );
00277         mePedMapG06_[i] = 0;
00278 #ifdef COMMON_NOISE_ANALYSIS
00279         if ( mePed3SumMapG06_[i] ) dqmStore_->removeElement( mePed3SumMapG06_[i]->getName() );
00280         mePed3SumMapG06_[i] = 0;
00281         if ( mePed5SumMapG06_[i] ) dqmStore_->removeElement( mePed5SumMapG06_[i]->getName() );
00282         mePed5SumMapG06_[i] = 0;
00283 #endif
00284       }
00285 
00286     }
00287 
00288     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00289 
00290       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/Gain12");
00291       for ( int i = 0; i < 36; i++ ) {
00292         if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() );
00293         mePedMapG12_[i] = 0;
00294 #ifdef COMMON_NOISE_ANALYSIS
00295         if ( mePed3SumMapG12_[i] ) dqmStore_->removeElement( mePed3SumMapG12_[i]->getName() );
00296         mePed3SumMapG12_[i] = 0;
00297         if ( mePed5SumMapG12_[i] ) dqmStore_->removeElement( mePed5SumMapG12_[i]->getName() );
00298         mePed5SumMapG12_[i] = 0;
00299 #endif
00300       }
00301 
00302     }
00303 
00304     dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN");
00305 
00306     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00307 
00308       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN/Gain01");
00309       for ( int i = 0; i < 36; i++ ) {
00310         if ( mePnPedMapG01_[i]) dqmStore_->removeElement( mePnPedMapG01_[i]->getName() );
00311         mePnPedMapG01_[i] = 0;
00312       }
00313 
00314     }
00315 
00316     if (find(MGPAGains_.begin(), MGPAGains_.end(), 16) != MGPAGains_.end() ) {
00317 
00318       dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalTask/PN/Gain16");
00319       for ( int i = 0; i < 36; i++ ) {
00320         if ( mePnPedMapG16_[i]) dqmStore_->removeElement( mePnPedMapG16_[i]->getName() );
00321         mePnPedMapG16_[i] = 0;
00322       }
00323 
00324     }
00325 
00326   }
00327 
00328   init_ = false;
00329 
00330 }
00331 
00332 void EBPedestalTask::endJob(void){
00333 
00334   edm::LogInfo("EBPedestalTask") << "analyzed " << ievt_ << " events";
00335 
00336   if ( enableCleanup_ ) this->cleanup();
00337 
00338 }
00339 
00340 void EBPedestalTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00341 
00342   bool enable = false;
00343   int runType[36];
00344   for (int i=0; i<36; i++) runType[i] = -1;
00345 
00346   edm::Handle<EcalRawDataCollection> dcchs;
00347 
00348   if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00349 
00350     for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00351 
00352       if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
00353 
00354       int ism = Numbers::iSM( *dcchItr, EcalBarrel );
00355 
00356       runType[ism-1] = dcchItr->getRunType();
00357 
00358       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_STD ||
00359            dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_GAP ) enable = true;
00360 
00361     }
00362 
00363   } else {
00364 
00365     edm::LogWarning("EBPedestalTask") << EcalRawDataCollection_ << " not available";
00366 
00367   }
00368 
00369   if ( ! enable ) return;
00370 
00371   if ( ! init_ ) this->setup();
00372 
00373   ievt_++;
00374 
00375   edm::Handle<EBDigiCollection> digis;
00376 
00377   if ( e.getByLabel(EBDigiCollection_, digis) ) {
00378 
00379     int nebd = digis->size();
00380     LogDebug("EBPedestalTask") << "event " << ievt_ << " digi collection size " << nebd;
00381 
00382     float xmap01[36][85][20];
00383     float xmap06[36][85][20];
00384     float xmap12[36][85][20];
00385 
00386     for ( int ism = 1; ism <= 36; ism++ ) {
00387       for ( int ie = 1; ie <= 85; ie++ ) {
00388         for ( int ip = 1; ip <= 20; ip++ ) {
00389 
00390           xmap01[ism-1][ie-1][ip-1] = 0.;
00391           xmap06[ism-1][ie-1][ip-1] = 0.;
00392           xmap12[ism-1][ie-1][ip-1] = 0.;
00393 
00394         }
00395       }
00396     }
00397 
00398     for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00399 
00400       EBDetId id = digiItr->id();
00401 
00402       int ic = id.ic();
00403       int ie = (ic-1)/20 + 1;
00404       int ip = (ic-1)%20 + 1;
00405 
00406       int ism = Numbers::iSM( id );
00407 
00408       float xie = ie - 0.5;
00409       float xip = ip - 0.5;
00410 
00411       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_STD ||
00412                runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_GAP ) ) continue;
00413 
00414       EBDataFrame dataframe = (*digiItr);
00415 
00416       for (int i = 0; i < 10; i++) {
00417 
00418         int adc = dataframe.sample(i).adc();
00419 
00420         MonitorElement* mePedMap = 0;
00421 
00422         if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
00423         if ( dataframe.sample(i).gainId() == 2 ) mePedMap = mePedMapG06_[ism-1];
00424         if ( dataframe.sample(i).gainId() == 3 ) mePedMap = mePedMapG01_[ism-1];
00425 
00426         float xval = float(adc);
00427 
00428         if ( mePedMap ) mePedMap->Fill(xie, xip, xval);
00429 
00430         if ( dataframe.sample(i).gainId() == 1 ) xmap12[ism-1][ie-1][ip-1] = xmap12[ism-1][ie-1][ip-1] + xval;
00431         if ( dataframe.sample(i).gainId() == 2 ) xmap06[ism-1][ie-1][ip-1] = xmap06[ism-1][ie-1][ip-1] + xval;
00432         if ( dataframe.sample(i).gainId() == 3 ) xmap01[ism-1][ie-1][ip-1] = xmap01[ism-1][ie-1][ip-1] + xval;
00433 
00434       }
00435 
00436       xmap12[ism-1][ie-1][ip-1]=xmap12[ism-1][ie-1][ip-1]/10.;
00437       xmap06[ism-1][ie-1][ip-1]=xmap06[ism-1][ie-1][ip-1]/10.;
00438       xmap01[ism-1][ie-1][ip-1]=xmap01[ism-1][ie-1][ip-1]/10.;
00439 
00440     }
00441 
00442     // to be re-done using the 3x3 & 5x5 Selectors (if faster)
00443 
00444 #ifdef COMMON_NOISE_ANALYSIS
00445     for ( int ism = 1; ism <= 36; ism++ ) {
00446       for ( int ie = 1; ie <= 85; ie++ ) {
00447         for ( int ip = 1; ip <= 20; ip++ ) {
00448 
00449           float xie = ie - 0.5;
00450           float xip = ip - 0.5;
00451 
00452           float x3val01;
00453           float x3val06;
00454           float x3val12;
00455 
00456           if ( ie >= 2 && ie <= 84 && ip >= 2 && ip <= 19 ) {
00457 
00458             x3val01 = 0.;
00459             x3val06 = 0.;
00460             x3val12 = 0.;
00461             for ( int i = -1; i <= +1; i++ ) {
00462               for ( int j = -1; j <= +1; j++ ) {
00463 
00464                 x3val01 = x3val01 + xmap01[ism-1][ie-1+i][ip-1+j];
00465                 x3val06 = x3val06 + xmap06[ism-1][ie-1+i][ip-1+j];
00466                 x3val12 = x3val12 + xmap12[ism-1][ie-1+i][ip-1+j];
00467 
00468               }
00469             }
00470             x3val01 = x3val01 / 9.;
00471             x3val06 = x3val06 / 9.;
00472             x3val12 = x3val12 / 9.;
00473             if ( mePed3SumMapG01_[ism-1] && x3val01 != 0. ) mePed3SumMapG01_[ism-1]->Fill(xie, xip, x3val01);
00474             if ( mePed3SumMapG06_[ism-1] && x3val06 != 0. ) mePed3SumMapG06_[ism-1]->Fill(xie, xip, x3val06);
00475             if ( mePed3SumMapG12_[ism-1] && x3val12 != 0. ) mePed3SumMapG12_[ism-1]->Fill(xie, xip, x3val12);
00476 
00477           }
00478 
00479           float x5val01;
00480           float x5val06;
00481           float x5val12;
00482 
00483           if ( ie >= 3 && ie <= 83 && ip >= 3 && ip <= 18 ) {
00484 
00485             x5val01 = 0.;
00486             x5val06 = 0.;
00487             x5val12 = 0.;
00488             for ( int i = -2; i <= +2; i++ ) {
00489               for ( int j = -2; j <= +2; j++ ) {
00490 
00491                 x5val01 = x5val01 + xmap01[ism-1][ie-1+i][ip-1+j];
00492                 x5val06 = x5val06 + xmap06[ism-1][ie-1+i][ip-1+j];
00493                 x5val12 = x5val12 + xmap12[ism-1][ie-1+i][ip-1+j];
00494 
00495               }
00496             }
00497             x5val01 = x5val01 / 25.;
00498             x5val06 = x5val06 / 25.;
00499             x5val12 = x5val12 / 25.;
00500             if ( mePed5SumMapG01_[ism-1] && x5val01 != 0. ) mePed5SumMapG01_[ism-1]->Fill(xie, xip, x5val01);
00501             if ( mePed5SumMapG06_[ism-1] && x5val06 != 0. ) mePed5SumMapG06_[ism-1]->Fill(xie, xip, x5val06);
00502             if ( mePed5SumMapG12_[ism-1] && x5val12 != 0. ) mePed5SumMapG12_[ism-1]->Fill(xie, xip, x5val12);
00503 
00504           }
00505 
00506         }
00507       }
00508     }
00509 #endif
00510 
00511   } else {
00512 
00513     edm::LogWarning("EBPedestalTask") << EBDigiCollection_ << " not available";
00514 
00515   }
00516 
00517   edm::Handle<EcalPnDiodeDigiCollection> pns;
00518 
00519   if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
00520 
00521     int nep = pns->size();
00522     LogDebug("EBPedestalTask") << "event " << ievt_ << " pns collection size " << nep;
00523 
00524     for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
00525 
00526       if ( Numbers::subDet( pnItr->id() ) != EcalBarrel ) continue;
00527 
00528       int ism = Numbers::iSM( pnItr->id() );
00529 
00530       int num = pnItr->id().iPnId();
00531 
00532       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_STD ||
00533                runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_GAP ) ) continue;
00534 
00535       for (int i = 0; i < 50; i++) {
00536 
00537         int adc = pnItr->sample(i).adc();
00538 
00539         MonitorElement* mePNPed = 0;
00540 
00541         if ( pnItr->sample(i).gainId() == 0 ) mePNPed = mePnPedMapG01_[ism-1];
00542         if ( pnItr->sample(i).gainId() == 1 ) mePNPed = mePnPedMapG16_[ism-1];
00543 
00544         float xval = float(adc);
00545 
00546         if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
00547 
00548       }
00549 
00550     }
00551 
00552   } else {
00553 
00554     edm::LogWarning("EBPedestalTask") << EcalPnDiodeDigiCollection_ << " not available";
00555 
00556   }
00557 
00558 }
00559