CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DQM/EcalEndcapMonitorTasks/src/EEIntegrityTask.cc

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