CMS 3D CMS Logo

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

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