CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/EcalEndcapMonitorTasks/src/EEPedestalTask.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEPedestalTask.cc
00003  *
00004  * $Date: 2011/08/30 09:28:42 $
00005  * $Revision: 1.56 $
00006  * \author G. Della Ricca
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 
00027 #include "DQM/EcalCommon/interface/Numbers.h"
00028 
00029 #include "DQM/EcalEndcapMonitorTasks/interface/EEPedestalTask.h"
00030 
00031 // #define COMMON_NOISE_ANALYSIS
00032 
00033 EEPedestalTask::EEPedestalTask(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 
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 < 18; 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 EEPedestalTask::~EEPedestalTask(){
00076 
00077 }
00078 
00079 void EEPedestalTask::beginJob(void){
00080 
00081   ievt_ = 0;
00082 
00083   if ( dqmStore_ ) {
00084     dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask");
00085     dqmStore_->rmdir(prefixME_ + "/EEPedestalTask");
00086   }
00087 
00088 }
00089 
00090 void EEPedestalTask::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 EEPedestalTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00099 
00100 }
00101 
00102 void EEPedestalTask::reset(void) {
00103 
00104   for (int i = 0; i < 18; 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(), 16) != MGPAGainsPN_.end() ) {
00126       if ( mePnPedMapG16_[i] ) mePnPedMapG16_[i]->Reset();
00127     }
00128   }
00129 
00130 }
00131 
00132 void EEPedestalTask::setup(void){
00133 
00134   init_ = true;
00135 
00136   std::string name;
00137   std::stringstream GainN, GN;
00138 
00139   if ( dqmStore_ ) {
00140     dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask");
00141 
00142     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00143 
00144       GainN.str("");
00145       GainN << "Gain" << std::setw(2) << std::setfill('0') << 1;
00146       GN.str("");
00147       GN << "G" << std::setw(2) << std::setfill('0') << 1;
00148 
00149       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/" + GainN.str());
00150       for (int i = 0; i < 18; i++) {
00151         name = "EEPT pedestal " + Numbers::sEE(i+1) + " " + GN.str();
00152         mePedMapG01_[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., "s");
00153         mePedMapG01_[i]->setAxisTitle("ix", 1);
00154         if ( i+1 >= 1 && i+1 <= 9 ) mePedMapG01_[i]->setAxisTitle("101-ix", 1);
00155         mePedMapG01_[i]->setAxisTitle("iy", 2);
00156         dqmStore_->tag(mePedMapG01_[i], i+1);
00157 
00158 #ifdef COMMON_NOISE_ANALYSIS
00159         name = "EEPT pedestal 3sum " + Numbers::sEE(i+1) + " " + GN.str();
00160         mePed3SumMapG01_[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., "s");
00161         mePed3SumMapG01_[i]->setAxisTitle("ix", 1);
00162         if ( i+1 >= 1 && i+1 <= 9 ) mePed3SumMapG01_[i]->setAxisTitle("101-ix", 1);
00163         mePed3SumMapG01_[i]->setAxisTitle("iy", 2);
00164         dqmStore_->tag(mePed3SumMapG01_[i], i+1);
00165 
00166         name = "EEPT pedestal 5sum " + Numbers::sEE(i+1) + " " + GN.str();
00167         mePed5SumMapG01_[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., "s");
00168         mePed5SumMapG01_[i]->setAxisTitle("ix", 1);
00169         if ( i+1 >= 1 && i+1 <= 9 ) mePed5SumMapG01_[i]->setAxisTitle("101-ix", 1);
00170         mePed5SumMapG01_[i]->setAxisTitle("iy", 2);
00171         dqmStore_->tag(mePed5SumMapG01_[i], i+1);
00172 #endif
00173       }
00174 
00175     }
00176 
00177     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00178 
00179       GainN.str("");
00180       GainN << "Gain" << std::setw(2) << std::setfill('0') << 6;
00181       GN.str("");
00182       GN << "G" << std::setw(2) << std::setfill('0') << 6;
00183 
00184       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/" + GainN.str());
00185       for (int i = 0; i < 18; i++) {
00186         name = "EEPT pedestal " + Numbers::sEE(i+1) + " " + GN.str();
00187         mePedMapG06_[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., "s");
00188         mePedMapG06_[i]->setAxisTitle("ix", 1);
00189         if ( i+1 >= 1 && i+1 <= 9 ) mePedMapG06_[i]->setAxisTitle("101-ix", 1);
00190         mePedMapG06_[i]->setAxisTitle("iy", 2);
00191         dqmStore_->tag(mePedMapG06_[i], i+1);
00192 
00193 #ifdef COMMON_NOISE_ANALYSIS
00194         name = "EEPT pedestal 3sum " + Numbers::sEE(i+1) + " " + GN.str();
00195         mePed3SumMapG06_[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., "s");
00196         mePed3SumMapG06_[i]->setAxisTitle("ix", 1);
00197         if ( i+1 >= 1 && i+1 <= 9 ) mePed3SumMapG06_[i]->setAxisTitle("101-ix", 1);
00198         mePed3SumMapG06_[i]->setAxisTitle("iy", 2);
00199         dqmStore_->tag(mePed3SumMapG06_[i], i+1);
00200 
00201         name = "EEPT pedestal 5sum " + Numbers::sEE(i+1) + " " + GN.str();
00202         mePed5SumMapG06_[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., "s");
00203         mePed5SumMapG06_[i]->setAxisTitle("ix", 1);
00204         if ( i+1 >= 1 && i+1 <= 9 ) mePed5SumMapG06_[i]->setAxisTitle("101-ix", 1);
00205         mePed5SumMapG06_[i]->setAxisTitle("iy", 2);
00206         dqmStore_->tag(mePed5SumMapG06_[i], i+1);
00207 #endif
00208       }
00209 
00210     }
00211 
00212     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00213 
00214       GainN.str("");
00215       GainN << "Gain" << std::setw(2) << std::setfill('0') << 12;
00216       GN.str("");
00217       GN << "G" << std::setw(2) << std::setfill('0') << 12;
00218 
00219       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/" + GainN.str());
00220       for (int i = 0; i < 18; i++) {
00221         name = "EEPT pedestal " + Numbers::sEE(i+1) + " " + GN.str();
00222         mePedMapG12_[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., "s");
00223         mePedMapG12_[i]->setAxisTitle("ix", 1);
00224         if ( i+1 >= 1 && i+1 <= 9 ) mePedMapG12_[i]->setAxisTitle("101-ix", 1);
00225         mePedMapG12_[i]->setAxisTitle("iy", 2);
00226         dqmStore_->tag(mePedMapG12_[i], i+1);
00227 
00228 #ifdef COMMON_NOISE_ANALYSIS
00229         name = "EEPT pedestal 3sum " + Numbers::sEE(i+1) + " " + GN.str();
00230         mePed3SumMapG12_[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., "s");
00231         mePed3SumMapG12_[i]->setAxisTitle("ix", 1);
00232         if ( i+1 >= 1 && i+1 <= 9 ) mePed3SumMapG12_[i]->setAxisTitle("101-ix", 1);
00233         mePed3SumMapG12_[i]->setAxisTitle("iy", 2);
00234         dqmStore_->tag(mePed3SumMapG12_[i], i+1);
00235 
00236         name = "EEPT pedestal 5sum " + Numbers::sEE(i+1) + " " + GN.str();
00237         mePed5SumMapG12_[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., "s");
00238         mePed5SumMapG12_[i]->setAxisTitle("ix", 1);
00239         if ( i+1 >= 1 && i+1 <= 9 ) mePed5SumMapG12_[i]->setAxisTitle("101-ix", 1);
00240         mePed5SumMapG12_[i]->setAxisTitle("iy", 2);
00241         dqmStore_->tag(mePed5SumMapG12_[i], i+1);
00242 #endif
00243       }
00244 
00245     }
00246 
00247     dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN");
00248 
00249     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00250 
00251       GainN.str("");
00252       GainN << "Gain" << std::setw(2) << std::setfill('0') << 1;
00253       GN.str("");
00254       GN << "G" << std::setw(2) << std::setfill('0') << 1;
00255 
00256       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN/" + GainN.str());
00257       for (int i = 0; i < 18; i++) {
00258         name = "EEPDT PNs pedestal " + Numbers::sEE(i+1) + " " + GN.str();
00259         mePnPedMapG01_[i] =  dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00260         mePnPedMapG01_[i]->setAxisTitle("channel", 1);
00261         mePnPedMapG01_[i]->setAxisTitle("pedestal", 2);
00262         dqmStore_->tag(mePnPedMapG01_[i], i+1);
00263       }
00264 
00265     }
00266 
00267     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00268 
00269       GainN.str("");
00270       GainN << "Gain" << std::setw(2) << std::setfill('0') << 16;
00271       GN.str("");
00272       GN << "G" << std::setw(2) << std::setfill('0') << 16;
00273 
00274       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN/" + GainN.str());
00275       for (int i = 0; i < 18; i++) {
00276         name = "EEPDT PNs pedestal " + Numbers::sEE(i+1) + " " + GN.str();
00277         mePnPedMapG16_[i] =  dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00278         mePnPedMapG16_[i]->setAxisTitle("channel", 1);
00279         mePnPedMapG16_[i]->setAxisTitle("pedestal", 2);
00280         dqmStore_->tag(mePnPedMapG16_[i], i+1);
00281       }
00282 
00283     }
00284 
00285   }
00286 
00287 }
00288 
00289 void EEPedestalTask::cleanup(void){
00290 
00291   if ( ! init_ ) return;
00292 
00293   if ( dqmStore_ ) {
00294     dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask");
00295 
00296     if (find(MGPAGains_.begin(), MGPAGains_.end(), 1) != MGPAGains_.end() ) {
00297 
00298       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/Gain01");
00299       for ( int i = 0; i < 18; i++ ) {
00300         if ( mePedMapG01_[i] ) dqmStore_->removeElement( mePedMapG01_[i]->getName() );
00301         mePedMapG01_[i] = 0;
00302 #ifdef COMMON_NOISE_ANALYSIS
00303         if ( mePed3SumMapG01_[i] ) dqmStore_->removeElement( mePed3SumMapG01_[i]->getName() );
00304         mePed3SumMapG01_[i] = 0;
00305         if ( mePed5SumMapG01_[i] ) dqmStore_->removeElement( mePed5SumMapG01_[i]->getName() );
00306         mePed5SumMapG01_[i] = 0;
00307 #endif
00308       }
00309 
00310     }
00311 
00312     if (find(MGPAGains_.begin(), MGPAGains_.end(), 6) != MGPAGains_.end() ) {
00313 
00314       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/Gain06");
00315       for ( int i = 0; i < 18; i++ ) {
00316         if ( mePedMapG06_[i] ) dqmStore_->removeElement( mePedMapG06_[i]->getName() );
00317         mePedMapG06_[i] = 0;
00318 #ifdef COMMON_NOISE_ANALYSIS
00319         if ( mePed3SumMapG06_[i] ) dqmStore_->removeElement( mePed3SumMapG06_[i]->getName() );
00320         mePed3SumMapG06_[i] = 0;
00321         if ( mePed5SumMapG06_[i] ) dqmStore_->removeElement( mePed5SumMapG06_[i]->getName() );
00322         mePed5SumMapG06_[i] = 0;
00323 #endif
00324       }
00325 
00326     }
00327 
00328     if (find(MGPAGains_.begin(), MGPAGains_.end(), 12) != MGPAGains_.end() ) {
00329 
00330       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/Gain12");
00331       for ( int i = 0; i < 18; i++ ) {
00332         if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() );
00333         mePedMapG12_[i] = 0;
00334 #ifdef COMMON_NOISE_ANALYSIS
00335         if ( mePed3SumMapG12_[i] ) dqmStore_->removeElement( mePed3SumMapG12_[i]->getName() );
00336         mePed3SumMapG12_[i] = 0;
00337         if ( mePed5SumMapG12_[i] ) dqmStore_->removeElement( mePed5SumMapG12_[i]->getName() );
00338         mePed5SumMapG12_[i] = 0;
00339 #endif
00340       }
00341 
00342     }
00343 
00344     dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN");
00345 
00346     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 1) != MGPAGainsPN_.end() ) {
00347 
00348       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN/Gain01");
00349       for ( int i = 0; i < 18; i++ ) {
00350         if ( mePnPedMapG01_[i]) dqmStore_->removeElement( mePnPedMapG01_[i]->getName() );
00351         mePnPedMapG01_[i] = 0;
00352       }
00353 
00354     }
00355 
00356     if (find(MGPAGainsPN_.begin(), MGPAGainsPN_.end(), 16) != MGPAGainsPN_.end() ) {
00357 
00358       dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalTask/PN/Gain16");
00359       for ( int i = 0; i < 18; i++ ) {
00360         if ( mePnPedMapG16_[i]) dqmStore_->removeElement( mePnPedMapG16_[i]->getName() );
00361         mePnPedMapG16_[i] = 0;
00362       }
00363 
00364     }
00365 
00366   }
00367 
00368   init_ = false;
00369 
00370 }
00371 
00372 void EEPedestalTask::endJob(void){
00373 
00374   edm::LogInfo("EEPedestalTask") << "analyzed " << ievt_ << " events";
00375 
00376   if ( enableCleanup_ ) this->cleanup();
00377 
00378 }
00379 
00380 void EEPedestalTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00381 
00382   bool enable = false;
00383   int runType[18];
00384   for (int i=0; i<18; i++) runType[i] = -1;
00385 
00386   edm::Handle<EcalRawDataCollection> dcchs;
00387 
00388   if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00389 
00390     for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00391 
00392       if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00393 
00394       int ism = Numbers::iSM( *dcchItr, EcalEndcap );
00395 
00396       runType[ism-1] = dcchItr->getRunType();
00397 
00398       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_STD ||
00399            dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_GAP ) enable = true;
00400 
00401     }
00402 
00403   } else {
00404 
00405     edm::LogWarning("EEPedestalTask") << EcalRawDataCollection_ << " not available";
00406 
00407   }
00408 
00409   if ( ! enable ) return;
00410 
00411   if ( ! init_ ) this->setup();
00412 
00413   ievt_++;
00414 
00415   edm::Handle<EEDigiCollection> digis;
00416 
00417   if ( e.getByLabel(EEDigiCollection_, digis) ) {
00418 
00419     int need = digis->size();
00420     LogDebug("EEPedestalTask") << "event " << ievt_ << " digi collection size " << need;
00421 
00422     float xmap01[18][50][50];
00423     float xmap06[18][50][50];
00424     float xmap12[18][50][50];
00425 
00426     for ( int ism = 1; ism <= 18; ism++ ) {
00427       for ( int ix = 1; ix <= 50; ix++ ) {
00428         for ( int iy = 1; iy <= 50; iy++ ) {
00429 
00430           xmap01[ism-1][ix-1][iy-1] = 0.;
00431           xmap06[ism-1][ix-1][iy-1] = 0.;
00432           xmap12[ism-1][ix-1][iy-1] = 0.;
00433 
00434         }
00435       }
00436     }
00437 
00438     for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00439 
00440       EEDetId id = digiItr->id();
00441 
00442       int ix = id.ix();
00443       int iy = id.iy();
00444 
00445       int ism = Numbers::iSM( id );
00446 
00447       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00448 
00449       float xix = ix - 0.5;
00450       float xiy = iy - 0.5;
00451 
00452       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_STD ||
00453                runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_GAP ) ) continue;
00454 
00455       EEDataFrame dataframe = (*digiItr);
00456 
00457       for (int i = 0; i < 10; i++) {
00458 
00459         int adc = dataframe.sample(i).adc();
00460 
00461         MonitorElement* mePedMap = 0;
00462 
00463         if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
00464         if ( dataframe.sample(i).gainId() == 2 ) mePedMap = mePedMapG06_[ism-1];
00465         if ( dataframe.sample(i).gainId() == 3 ) mePedMap = mePedMapG01_[ism-1];
00466 
00467         float xval = float(adc);
00468 
00469         if ( mePedMap ) mePedMap->Fill(xix, xiy, xval);
00470 
00471         if ( dataframe.sample(i).gainId() == 1 ) xmap12[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] = xmap12[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] + xval;
00472         if ( dataframe.sample(i).gainId() == 2 ) xmap06[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] = xmap06[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] + xval;
00473         if ( dataframe.sample(i).gainId() == 3 ) xmap01[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] = xmap01[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)] + xval;
00474 
00475       }
00476 
00477       xmap12[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]=xmap12[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]/10.;
00478       xmap06[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]=xmap06[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]/10.;
00479       xmap01[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]=xmap01[ism-1][ix-1-Numbers::ix0EE(ism)][iy-1-Numbers::iy0EE(ism)]/10.;
00480 
00481     }
00482 
00483     // to be re-done using the 3x3 & 5x5 Selectors (if faster)
00484 
00485 #ifdef COMMON_NOISE_ANALYSIS
00486     for ( int ism = 1; ism <= 18; ism++ ) {
00487       for ( int ix = 1; ix <= 50; ix++ ) {
00488         for ( int iy = 1; iy <= 50; iy++ ) {
00489 
00490           int xix = ix + Numbers::ix0EE(ism);
00491           int xiy = iy + Numbers::iy0EE(ism);
00492 
00493           if ( ism >= 1 && ism <= 9 ) xix = 101 - xix;
00494 
00495           if ( ! Numbers::validEE(ism, xix, xiy) ) continue;
00496 
00497           float xix = ix - 0.5;
00498           float xiy = iy - 0.5;
00499 
00500           float x3val01;
00501           float x3val06;
00502           float x3val12;
00503 
00504           if ( ix >= 2 && ix <= 49 && iy >= 2 && iy <= 49 ) {
00505 
00506             x3val01 = 0.;
00507             x3val06 = 0.;
00508             x3val12 = 0.;
00509             for ( int i = -1; i <= +1; i++ ) {
00510               for ( int j = -1; j <= +1; j++ ) {
00511 
00512                 x3val01 = x3val01 + xmap01[ism-1][ix-1+i][iy-1+j];
00513                 x3val06 = x3val06 + xmap06[ism-1][ix-1+i][iy-1+j];
00514                 x3val12 = x3val12 + xmap12[ism-1][ix-1+i][iy-1+j];
00515 
00516               }
00517             }
00518             x3val01 = x3val01 / 9.;
00519             x3val06 = x3val06 / 9.;
00520             x3val12 = x3val12 / 9.;
00521             if ( mePed3SumMapG01_[ism-1] && x3val01 != 0. ) mePed3SumMapG01_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x3val01);
00522             if ( mePed3SumMapG06_[ism-1] && x3val06 != 0. ) mePed3SumMapG06_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x3val06);
00523             if ( mePed3SumMapG12_[ism-1] && x3val12 != 0. ) mePed3SumMapG12_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x3val12);
00524 
00525           }
00526 
00527           float x5val01;
00528           float x5val06;
00529           float x5val12;
00530 
00531           if ( ix >= 3 && ix <= 48 && iy >= 3 && iy <= 48 ) {
00532 
00533             x5val01 = 0.;
00534             x5val06 = 0.;
00535             x5val12 = 0.;
00536             for ( int i = -2; i <= +2; i++ ) {
00537               for ( int j = -2; j <= +2; j++ ) {
00538 
00539                 x5val01 = x5val01 + xmap01[ism-1][ix-1+i][iy-1+j];
00540                 x5val06 = x5val06 + xmap06[ism-1][ix-1+i][iy-1+j];
00541                 x5val12 = x5val12 + xmap12[ism-1][ix-1+i][iy-1+j];
00542 
00543               }
00544             }
00545             x5val01 = x5val01 / 25.;
00546             x5val06 = x5val06 / 25.;
00547             x5val12 = x5val12 / 25.;
00548             if ( mePed5SumMapG01_[ism-1] && x5val01 != 0. ) mePed5SumMapG01_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x5val01);
00549             if ( mePed5SumMapG06_[ism-1] && x5val06 != 0. ) mePed5SumMapG06_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x5val06);
00550             if ( mePed5SumMapG12_[ism-1] && x5val12 != 0. ) mePed5SumMapG12_[ism-1]->Fill(xix+Numbers::ix0EE(ism), xiy+Numbers::iy0EE(ism), x5val12);
00551 
00552           }
00553 
00554         }
00555       }
00556     }
00557 #endif
00558 
00559   } else {
00560 
00561     edm::LogWarning("EEPedestalTask") << EEDigiCollection_ << " not available";
00562 
00563   }
00564 
00565   edm::Handle<EcalPnDiodeDigiCollection> pns;
00566 
00567   if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
00568 
00569     int nep = pns->size();
00570     LogDebug("EEPedestalTask") << "event " << ievt_ << " pns collection size " << nep;
00571 
00572     for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
00573 
00574       if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
00575 
00576       int ism = Numbers::iSM( pnItr->id() );
00577 
00578       int num = pnItr->id().iPnId();
00579 
00580       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_STD ||
00581                runType[ism-1] == EcalDCCHeaderBlock::PEDESTAL_GAP ) ) continue;
00582 
00583       for (int i = 0; i < 50; i++) {
00584 
00585         int adc = pnItr->sample(i).adc();
00586 
00587         MonitorElement* mePNPed = 0;
00588 
00589         if ( pnItr->sample(i).gainId() == 0 ) mePNPed = mePnPedMapG01_[ism-1];
00590         if ( pnItr->sample(i).gainId() == 1 ) mePNPed = mePnPedMapG16_[ism-1];
00591 
00592         float xval = float(adc);
00593 
00594         if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
00595 
00596       }
00597 
00598     }
00599 
00600   } else {
00601 
00602     edm::LogWarning("EEPedestalTask") << EcalPnDiodeDigiCollection_ << " not available";
00603 
00604   }
00605 
00606 }
00607