CMS 3D CMS Logo

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

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