CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/EcalEndcapMonitorTasks/src/EEIntegrityTask.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEIntegrityTask.cc
00003  *
00004  * $Date: 2012/04/27 13:46:15 $
00005  * $Revision: 1.61 $
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/EcalDetId/interface/EEDetId.h"
00022 
00023 #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
00024 
00025 #include "DQM/EcalCommon/interface/Numbers.h"
00026 
00027 #include "DQM/EcalEndcapMonitorTasks/interface/EEIntegrityTask.h"
00028 
00029 EEIntegrityTask::EEIntegrityTask(const edm::ParameterSet& ps){
00030 
00031   init_ = false;
00032 
00033   dqmStore_ = edm::Service<DQMStore>().operator->();
00034 
00035   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00036 
00037   subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
00038 
00039   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00040 
00041   mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00042 
00043   EEDetIdCollection0_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection0");
00044   EEDetIdCollection1_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection1");
00045   EEDetIdCollection2_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection2");
00046   EEDetIdCollection3_ =  ps.getParameter<edm::InputTag>("EEDetIdCollection3");
00047   EcalElectronicsIdCollection1_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection1");
00048   EcalElectronicsIdCollection2_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection2");
00049   EcalElectronicsIdCollection3_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection3");
00050   EcalElectronicsIdCollection4_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection4");
00051   EcalElectronicsIdCollection5_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection5");
00052   EcalElectronicsIdCollection6_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection6");
00053 
00054   meIntegrityDCCSize = 0;
00055   for (int i = 0; i < 18; i++) {
00056     meIntegrityGain[i] = 0;
00057     meIntegrityChId[i] = 0;
00058     meIntegrityGainSwitch[i] = 0;
00059     meIntegrityTTId[i] = 0;
00060     meIntegrityTTBlockSize[i] = 0;
00061     meIntegrityMemChId[i] = 0;
00062     meIntegrityMemGain[i] = 0;
00063     meIntegrityMemTTId[i] = 0;
00064     meIntegrityMemTTBlockSize[i] = 0;
00065   }
00066   meIntegrityErrorsByLumi = 0;
00067 }
00068 
00069 
00070 EEIntegrityTask::~EEIntegrityTask(){
00071 
00072 }
00073 
00074 void EEIntegrityTask::beginJob(void){
00075 
00076   ievt_ = 0;
00077 
00078   if ( dqmStore_ ) {
00079     dqmStore_->setCurrentFolder(prefixME_ + "/EEIntegrityTask");
00080     if(subfolder_.size())
00081       dqmStore_->setCurrentFolder(prefixME_ + "/EEIntegrityTask/" + subfolder_);
00082     dqmStore_->rmdir(prefixME_ + "/EEIntegrityTask");
00083   }
00084 
00085 }
00086 
00087 void EEIntegrityTask::beginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const  edm::EventSetup& iSetup) {
00088 
00089   if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Reset();
00090 
00091 }
00092 
00093 void EEIntegrityTask::endLuminosityBlock(const edm::LuminosityBlock&  lumiBlock, const  edm::EventSetup& iSetup) {
00094 }
00095 
00096 void EEIntegrityTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00097 
00098   Numbers::initGeometry(c, false);
00099 
00100   if ( ! mergeRuns_ ) this->reset();
00101 
00102 }
00103 
00104 void EEIntegrityTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00105 
00106 }
00107 
00108 void EEIntegrityTask::reset(void) {
00109 
00110   if ( meIntegrityDCCSize ) meIntegrityDCCSize->Reset();
00111   for (int i = 0; i < 18; i++) {
00112     if ( meIntegrityGain[i] ) meIntegrityGain[i]->Reset();
00113     if ( meIntegrityChId[i] ) meIntegrityChId[i]->Reset();
00114     if ( meIntegrityGainSwitch[i] ) meIntegrityGainSwitch[i]->Reset();
00115     if ( meIntegrityTTId[i] ) meIntegrityTTId[i]->Reset();
00116     if ( meIntegrityTTBlockSize[i] ) meIntegrityTTBlockSize[i]->Reset();
00117     if ( meIntegrityMemChId[i] ) meIntegrityMemChId[i]->Reset();
00118     if ( meIntegrityMemGain[i] ) meIntegrityMemGain[i]->Reset();
00119     if ( meIntegrityMemTTId[i] ) meIntegrityMemTTId[i]->Reset();
00120     if ( meIntegrityMemTTBlockSize[i] ) meIntegrityMemTTBlockSize[i]->Reset();
00121   }
00122   if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Reset();
00123 
00124 }
00125 
00126 void EEIntegrityTask::setup(void){
00127 
00128   init_ = true;
00129 
00130   std::string name;
00131   std::string dir;
00132 
00133   if ( dqmStore_ ) {
00134 
00135     dir = prefixME_ + "/EEIntegrityTask";
00136     if(subfolder_.size())
00137       dir += "/" + subfolder_;
00138 
00139     dqmStore_->setCurrentFolder(dir);
00140 
00141     // checking when number of towers in data different than expected from header
00142     name = "EEIT DCC size error";
00143     meIntegrityDCCSize = dqmStore_->book1D(name, name, 18, 1., 19.);
00144     for (int i = 0; i < 18; i++) {
00145       meIntegrityDCCSize->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00146     }
00147 
00148     // checking the number of integrity errors in each DCC for each lumi
00149     // crystal integrity error is weighted by 1/850
00150     // tower integrity error is weighted by 1/34
00151     // bin 0 contains the number of processed events in the lumi (for normalization)
00152     name = "EEIT weighted integrity errors by lumi";
00153     meIntegrityErrorsByLumi = dqmStore_->book1D(name, name, 18, 1., 19.);
00154     meIntegrityErrorsByLumi->setLumiFlag();
00155     for (int i = 0; i < 18; i++) {
00156       meIntegrityErrorsByLumi->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00157     }
00158 
00159     // checking when the gain is 0
00160     dqmStore_->setCurrentFolder(dir + "/Gain");
00161     for (int i = 0; i < 18; i++) {
00162       name = "EEIT gain " + Numbers::sEE(i+1);
00163       meIntegrityGain[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00164       meIntegrityGain[i]->setAxisTitle("ix", 1);
00165       if ( i+1 >= 1 && i+1 <= 9 ) meIntegrityGain[i]->setAxisTitle("101-ix", 1);
00166       meIntegrityGain[i]->setAxisTitle("iy", 2);
00167       dqmStore_->tag(meIntegrityGain[i], i+1);
00168     }
00169 
00170     // checking when channel has unexpected or invalid ID
00171     dqmStore_->setCurrentFolder(dir + "/ChId");
00172     for (int i = 0; i < 18; i++) {
00173       name = "EEIT ChId " + Numbers::sEE(i+1);
00174       meIntegrityChId[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00175       meIntegrityChId[i]->setAxisTitle("ix", 1);
00176       if ( i+1 >= 1 && i+1 <= 9 ) meIntegrityChId[i]->setAxisTitle("101-ix", 1);
00177       meIntegrityChId[i]->setAxisTitle("iy", 2);
00178       dqmStore_->tag(meIntegrityChId[i], i+1);
00179     }
00180 
00181     // checking when channel has unexpected or invalid ID
00182     dqmStore_->setCurrentFolder(dir + "/GainSwitch");
00183     for (int i = 0; i < 18; i++) {
00184       name = "EEIT gain switch " + Numbers::sEE(i+1);
00185       meIntegrityGainSwitch[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00186       meIntegrityGainSwitch[i]->setAxisTitle("ix", 1);
00187       if ( i+1 >= 1 && i+1 <= 9 ) meIntegrityGainSwitch[i]->setAxisTitle("101-ix", 1);
00188       meIntegrityGainSwitch[i]->setAxisTitle("iy", 2);
00189       dqmStore_->tag(meIntegrityGainSwitch[i], i+1);
00190     }
00191 
00192     // checking when trigger tower has unexpected or invalid ID
00193     dqmStore_->setCurrentFolder(dir + "/TTId");
00194     for (int i = 0; i < 18; i++) {
00195       name = "EEIT TTId " + Numbers::sEE(i+1);
00196       meIntegrityTTId[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00197       meIntegrityTTId[i]->setAxisTitle("ix", 1);
00198       if ( i+1 >= 1 && i+1 <= 9 ) meIntegrityTTId[i]->setAxisTitle("101-ix", 1);
00199       meIntegrityTTId[i]->setAxisTitle("iy", 2);
00200       dqmStore_->tag(meIntegrityTTId[i], i+1);
00201     }
00202 
00203     // checking when trigger tower has unexpected or invalid size
00204     dqmStore_->setCurrentFolder(dir + "/TTBlockSize");
00205     for (int i = 0; i < 18; i++) {
00206       name = "EEIT TTBlockSize " + Numbers::sEE(i+1);
00207       meIntegrityTTBlockSize[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00208       meIntegrityTTBlockSize[i]->setAxisTitle("ix", 1);
00209       if ( i+1 >= 1 && i+1 <= 9 ) meIntegrityTTBlockSize[i]->setAxisTitle("101-ix", 1);
00210       meIntegrityTTBlockSize[i]->setAxisTitle("iy", 2);
00211       dqmStore_->tag(meIntegrityTTBlockSize[i], i+1);
00212     }
00213 
00214     // checking when mem channels have unexpected ID
00215     dqmStore_->setCurrentFolder(dir + "/MemChId");
00216     for (int i = 0; i < 18; i++) {
00217       name = "EEIT MemChId " + Numbers::sEE(i+1);
00218       meIntegrityMemChId[i] = dqmStore_->book2D(name, name, 10, 0., 10., 5, 0., 5.);
00219       meIntegrityMemChId[i]->setAxisTitle("pseudo-strip", 1);
00220       meIntegrityMemChId[i]->setAxisTitle("channel", 2);
00221       dqmStore_->tag(meIntegrityMemChId[i], i+1);
00222     }
00223 
00224     // checking when mem samples have second bit encoding the gain different from 0
00225     // note: strictly speaking, this does not corrupt the mem sample gain value (since only first bit is considered)
00226     // but indicates that data are not completely correct
00227     dqmStore_->setCurrentFolder(dir + "/MemGain");
00228     for (int i = 0; i < 18; i++) {
00229       name = "EEIT MemGain " + Numbers::sEE(i+1);
00230       meIntegrityMemGain[i] = dqmStore_->book2D(name, name, 10, 0., 10., 5, 0., 5.);
00231       meIntegrityMemGain[i]->setAxisTitle("pseudo-strip", 1);
00232       meIntegrityMemGain[i]->setAxisTitle("channel", 2);
00233       dqmStore_->tag(meIntegrityMemGain[i], i+1);
00234     }
00235 
00236     // checking when mem tower block has unexpected ID
00237     dqmStore_->setCurrentFolder(dir + "/MemTTId");
00238     for (int i = 0; i < 18; i++) {
00239       name = "EEIT MemTTId " + Numbers::sEE(i+1);
00240       meIntegrityMemTTId[i] = dqmStore_->book2D(name, name, 2, 0., 2., 1, 0., 1.);
00241       meIntegrityMemTTId[i]->setAxisTitle("pseudo-strip", 1);
00242       meIntegrityMemTTId[i]->setAxisTitle("channel", 2);
00243       dqmStore_->tag(meIntegrityMemTTId[i], i+1);
00244     }
00245 
00246     // checking when mem tower block has invalid size
00247     dqmStore_->setCurrentFolder(dir + "/MemSize");
00248     for (int i = 0; i < 18; i++) {
00249       name = "EEIT MemSize " + Numbers::sEE(i+1);
00250       meIntegrityMemTTBlockSize[i] = dqmStore_->book2D(name, name, 2, 0., 2., 1, 0., 1.);
00251       meIntegrityMemTTBlockSize[i]->setAxisTitle("pseudo-strip", 1);
00252       meIntegrityMemTTBlockSize[i]->setAxisTitle("channel", 2);
00253       dqmStore_->tag(meIntegrityMemTTBlockSize[i], i+1);
00254     }
00255 
00256   }
00257 
00258 }
00259 
00260 void EEIntegrityTask::cleanup(void){
00261 
00262   if ( ! init_ ) return;
00263 
00264   if ( dqmStore_ ) {
00265 
00266     std::string dir;
00267 
00268     dir = prefixME_ + "/EEIntegrityTask";
00269     if(subfolder_.size())
00270       dir += "/" + subfolder_;
00271 
00272     dqmStore_->setCurrentFolder(dir + "");
00273 
00274     if ( meIntegrityDCCSize ) dqmStore_->removeElement( meIntegrityDCCSize->getName() );
00275     meIntegrityDCCSize = 0;
00276 
00277     if ( meIntegrityErrorsByLumi ) dqmStore_->removeElement( meIntegrityErrorsByLumi->getName() );
00278     meIntegrityErrorsByLumi = 0;
00279 
00280     dqmStore_->setCurrentFolder(dir + "/Gain");
00281     for (int i = 0; i < 18; i++) {
00282       if ( meIntegrityGain[i] ) dqmStore_->removeElement( meIntegrityGain[i]->getName() );
00283       meIntegrityGain[i] = 0;
00284     }
00285 
00286     dqmStore_->setCurrentFolder(dir + "/ChId");
00287     for (int i = 0; i < 18; i++) {
00288       if ( meIntegrityChId[i] ) dqmStore_->removeElement( meIntegrityChId[i]->getName() );
00289       meIntegrityChId[i] = 0;
00290     }
00291 
00292     dqmStore_->setCurrentFolder(dir + "/GainSwitch");
00293     for (int i = 0; i < 18; i++) {
00294       if ( meIntegrityGainSwitch[i] ) dqmStore_->removeElement( meIntegrityGainSwitch[i]->getName() );
00295       meIntegrityGainSwitch[i] = 0;
00296     }
00297 
00298     dqmStore_->setCurrentFolder(dir + "/TTId");
00299     for (int i = 0; i < 18; i++) {
00300       if ( meIntegrityTTId[i] ) dqmStore_->removeElement( meIntegrityTTId[i]->getName() );
00301       meIntegrityTTId[i] = 0;
00302     }
00303 
00304     dqmStore_->setCurrentFolder(dir + "/TTBlockSize");
00305     for (int i = 0; i < 18; i++) {
00306       if ( meIntegrityTTBlockSize[i] ) dqmStore_->removeElement( meIntegrityTTBlockSize[i]->getName() );
00307       meIntegrityTTBlockSize[i] = 0;
00308     }
00309 
00310     dqmStore_->setCurrentFolder(dir + "/MemChId");
00311     for (int i = 0; i < 18; i++) {
00312       if ( meIntegrityMemChId[i] ) dqmStore_->removeElement( meIntegrityMemChId[i]->getName() );
00313       meIntegrityMemChId[i] = 0;
00314     }
00315 
00316     dqmStore_->setCurrentFolder(dir + "/MemGain");
00317     for (int i = 0; i < 18; i++) {
00318       if ( meIntegrityMemGain[i] ) dqmStore_->removeElement( meIntegrityMemGain[i]->getName() );
00319       meIntegrityMemGain[i] = 0;
00320     }
00321 
00322     dqmStore_->setCurrentFolder(dir + "/MemTTId");
00323     for (int i = 0; i < 18; i++) {
00324       if ( meIntegrityMemTTId[i] ) dqmStore_->removeElement( meIntegrityMemTTId[i]->getName() );
00325       meIntegrityMemTTId[i] = 0;
00326     }
00327 
00328     dqmStore_->setCurrentFolder(dir + "/MemSize");
00329     for (int i = 0; i < 18; i++) {
00330       if ( meIntegrityMemTTBlockSize[i] ) dqmStore_->removeElement( meIntegrityMemTTBlockSize[i]->getName() );
00331       meIntegrityMemTTBlockSize[i] = 0;
00332     }
00333 
00334   }
00335 
00336   init_ = false;
00337 
00338 }
00339 
00340 void EEIntegrityTask::endJob(void){
00341 
00342   edm::LogInfo("EEIntegrityTask") << "analyzed " << ievt_ << " events";
00343 
00344   if ( enableCleanup_ ) this->cleanup();
00345 
00346 }
00347 
00348 void EEIntegrityTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00349 
00350   if ( ! init_ ) this->setup();
00351 
00352   ievt_++;
00353 
00354   // fill bin 0 with number of events in the lumi
00355   if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(0.);
00356 
00357   edm::Handle<EEDetIdCollection> ids0;
00358 
00359   if ( e.getByLabel(EEDetIdCollection0_, ids0) ) {
00360 
00361     for ( EEDetIdCollection::const_iterator idItr = ids0->begin(); idItr != ids0->end(); ++idItr ) {
00362 
00363       int ism = Numbers::iSM( *idItr );
00364 
00365       float xism = ism + 0.5;
00366 
00367       if ( meIntegrityDCCSize ) meIntegrityDCCSize->Fill(xism);
00368 
00369     }
00370 
00371   } else {
00372 
00373 //    edm::LogWarning("EEIntegrityTask") << EEDetIdCollection0_ << " not available";
00374 
00375   }
00376 
00377   edm::Handle<EEDetIdCollection> ids1;
00378 
00379   if ( e.getByLabel(EEDetIdCollection1_, ids1) ) {
00380 
00381     for ( EEDetIdCollection::const_iterator idItr = ids1->begin(); idItr != ids1->end(); ++idItr ) {
00382 
00383       EEDetId id = (*idItr);
00384 
00385       int ix = id.ix();
00386       int iy = id.iy();
00387 
00388       int ism = Numbers::iSM( id );
00389       float xism = ism + 0.5;
00390 
00391       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00392 
00393       float xix = ix - 0.5;
00394       float xiy = iy - 0.5;
00395 
00396       if ( meIntegrityGain[ism-1] ) meIntegrityGain[ism-1]->Fill(xix, xiy);
00397       if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(xism, 1./850.);
00398 
00399     }
00400 
00401   } else {
00402 
00403     edm::LogWarning("EEIntegrityTask") << EEDetIdCollection1_ << " not available";
00404 
00405   }
00406 
00407   edm::Handle<EEDetIdCollection> ids2;
00408 
00409   if ( e.getByLabel(EEDetIdCollection2_, ids2) ) {
00410 
00411     for ( EEDetIdCollection::const_iterator idItr = ids2->begin(); idItr != ids2->end(); ++idItr ) {
00412 
00413       EEDetId id = (*idItr);
00414 
00415       int ix = id.ix();
00416       int iy = id.iy();
00417 
00418       int ism = Numbers::iSM( id );
00419       float xism = ism + 0.5;
00420 
00421       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00422 
00423       float xix = ix - 0.5;
00424       float xiy = iy - 0.5;
00425 
00426       if ( meIntegrityChId[ism-1] ) meIntegrityChId[ism-1]->Fill(xix, xiy);
00427       if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(xism, 1./850.);
00428 
00429     }
00430 
00431   } else {
00432 
00433     edm::LogWarning("EEIntegrityTask") << EEDetIdCollection2_ << " not available";
00434 
00435   }
00436 
00437   edm::Handle<EEDetIdCollection> ids3;
00438 
00439   if ( e.getByLabel(EEDetIdCollection3_, ids3) ) {
00440 
00441     for ( EEDetIdCollection::const_iterator idItr = ids3->begin(); idItr != ids3->end(); ++idItr ) {
00442 
00443       EEDetId id = (*idItr);
00444 
00445       int ix = id.ix();
00446       int iy = id.iy();
00447 
00448       int ism = Numbers::iSM( id );
00449       float xism = ism + 0.5;
00450 
00451       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00452 
00453       float xix = ix - 0.5;
00454       float xiy = iy - 0.5;
00455 
00456       if ( meIntegrityGainSwitch[ism-1] ) meIntegrityGainSwitch[ism-1]->Fill(xix, xiy);
00457       if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(xism, 1./850.);
00458 
00459     }
00460 
00461   } else {
00462 
00463     edm::LogWarning("EEIntegrityTask") << EEDetIdCollection3_ << " not available";
00464 
00465   }
00466 
00467   edm::Handle<EcalElectronicsIdCollection> ids4;
00468 
00469   if ( e.getByLabel(EcalElectronicsIdCollection1_, ids4) ) {
00470 
00471     for ( EcalElectronicsIdCollection::const_iterator idItr = ids4->begin(); idItr != ids4->end(); ++idItr ) {
00472 
00473       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00474 
00475       int ism = Numbers::iSM( *idItr );
00476       float xism = ism + 0.5;
00477 
00478       std::vector<DetId>* crystals = Numbers::crystals( *idItr );
00479 
00480       for ( unsigned int i=0; i<crystals->size(); i++ ) {
00481 
00482       EEDetId id = (*crystals)[i];
00483 
00484       int ix = id.ix();
00485       int iy = id.iy();
00486 
00487       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00488 
00489       float xix = ix - 0.5;
00490       float xiy = iy - 0.5;
00491 
00492       if ( meIntegrityTTId[ism-1] ) meIntegrityTTId[ism-1]->Fill(xix, xiy);
00493       if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(xism, 1./34./crystals->size());
00494 
00495       }
00496 
00497     }
00498 
00499   } else {
00500 
00501     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection1_ << " not available";
00502 
00503   }
00504 
00505   edm::Handle<EcalElectronicsIdCollection> ids5;
00506 
00507   if ( e.getByLabel(EcalElectronicsIdCollection2_, ids5) ) {
00508 
00509     for ( EcalElectronicsIdCollection::const_iterator idItr = ids5->begin(); idItr != ids5->end(); ++idItr ) {
00510 
00511       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00512 
00513       int ism = Numbers::iSM( *idItr );
00514       float xism = ism + 0.5;
00515 
00516       std::vector<DetId>* crystals = Numbers::crystals( *idItr );
00517 
00518       for ( unsigned int i=0; i<crystals->size(); i++ ) {
00519 
00520       EEDetId id = (*crystals)[i];
00521 
00522       int ix = id.ix();
00523       int iy = id.iy();
00524 
00525       if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00526 
00527       float xix = ix - 0.5;
00528       float xiy = iy - 0.5;
00529 
00530       if ( meIntegrityTTBlockSize[ism-1] ) meIntegrityTTBlockSize[ism-1]->Fill(xix, xiy);
00531       if ( meIntegrityErrorsByLumi ) meIntegrityErrorsByLumi->Fill(xism, 1./34./crystals->size());
00532 
00533       }
00534 
00535     }
00536 
00537   } else {
00538 
00539     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection2_ << " not available";
00540 
00541   }
00542 
00543   edm::Handle<EcalElectronicsIdCollection> ids6;
00544 
00545   if ( e.getByLabel(EcalElectronicsIdCollection3_, ids6) ) {
00546 
00547     for ( EcalElectronicsIdCollection::const_iterator idItr = ids6->begin(); idItr != ids6->end(); ++idItr ) {
00548 
00549       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00550 
00551       int ism = Numbers::iSM( *idItr );
00552 
00553       int itt   = idItr->towerId();
00554       float iTt = itt + 0.5 - 69;
00555 
00556       if ( meIntegrityMemTTId[ism-1] ) meIntegrityMemTTId[ism-1]->Fill(iTt,0);
00557 
00558     }
00559 
00560   } else {
00561 
00562     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection3_ << " not available";
00563 
00564   }
00565 
00566   edm::Handle<EcalElectronicsIdCollection> ids7;
00567 
00568   if ( e.getByLabel(EcalElectronicsIdCollection4_, ids7) ) {
00569 
00570     for ( EcalElectronicsIdCollection::const_iterator idItr = ids7->begin(); idItr != ids7->end(); ++idItr ) {
00571 
00572       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00573 
00574       int ism = Numbers::iSM( *idItr );
00575 
00576       int itt   = idItr->towerId();
00577       float iTt = itt + 0.5 - 69;
00578 
00579       if ( meIntegrityMemTTBlockSize[ism-1] ) meIntegrityMemTTBlockSize[ism-1]->Fill(iTt,0);
00580 
00581     }
00582 
00583   } else {
00584 
00585     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection4_ << " not available";
00586 
00587   }
00588 
00589   edm::Handle<EcalElectronicsIdCollection> ids8;
00590 
00591   if (  e.getByLabel(EcalElectronicsIdCollection5_, ids8) ) {
00592 
00593     for ( EcalElectronicsIdCollection::const_iterator idItr = ids8->begin(); idItr != ids8->end(); ++idItr ) {
00594 
00595       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00596 
00597       int ism = Numbers::iSM( *idItr );
00598 
00599       int chid = idItr->channelId();
00600       int ie = EEIntegrityTask::chMemAbscissa[chid-1];
00601       int ip = EEIntegrityTask::chMemOrdinate[chid-1];
00602 
00603       int itt = idItr->towerId();
00604       ie += (itt-69)*5;
00605 
00606       float xix = ie - 0.5;
00607       float xiy = ip - 0.5;
00608 
00609       if ( meIntegrityMemChId[ism-1] ) meIntegrityMemChId[ism-1]->Fill(xix,xiy);
00610 
00611     }
00612 
00613   } else {
00614 
00615     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection5_ << " not available";
00616 
00617   }
00618 
00619   edm::Handle<EcalElectronicsIdCollection> ids9;
00620 
00621   if ( e.getByLabel(EcalElectronicsIdCollection6_, ids9) ) {
00622 
00623     for ( EcalElectronicsIdCollection::const_iterator idItr = ids9->begin(); idItr != ids9->end(); ++idItr ) {
00624 
00625       if ( Numbers::subDet( *idItr ) != EcalEndcap ) continue;
00626 
00627       int ism = Numbers::iSM( *idItr );
00628 
00629       int chid = idItr->channelId();
00630       int ie = EEIntegrityTask::chMemAbscissa[chid-1];
00631       int ip = EEIntegrityTask::chMemOrdinate[chid-1];
00632 
00633       int itt = idItr->towerId();
00634       ie += (itt-69)*5;
00635 
00636       float xix = ie - 0.5;
00637       float xiy = ip - 0.5;
00638 
00639       if ( meIntegrityMemGain[ism-1] ) meIntegrityMemGain[ism-1]->Fill(xix,xiy);
00640 
00641     }
00642 
00643   } else {
00644 
00645     edm::LogWarning("EEIntegrityTask") << EcalElectronicsIdCollection6_ << " not available";
00646 
00647   }
00648 
00649 }//  end analyze
00650 
00651 const int  EEIntegrityTask::chMemAbscissa [25] = {
00652     1, 1, 1, 1, 1,
00653     2, 2, 2, 2, 2,
00654     3, 3, 3, 3, 3,
00655     4, 4, 4, 4, 4,
00656     5, 5, 5, 5, 5
00657 };
00658 
00659 const int  EEIntegrityTask::chMemOrdinate [25] = {
00660     1, 2, 3, 4, 5,
00661     5, 4, 3, 2, 1,
00662     1, 2, 3, 4, 5,
00663     5, 4, 3, 2, 1,
00664     1, 2, 3, 4, 5
00665 };
00666