CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DQM/EcalEndcapMonitorTasks/src/EELaserTask.cc

Go to the documentation of this file.
00001 /*
00002  * \file EELaserTask.cc
00003  *
00004  * $Date: 2012/04/27 13:46:15 $
00005  * $Revision: 1.81 $
00006  * \author G. Della Ricca
00007  *
00008 */
00009 
00010 #include <iostream>
00011 #include <sstream>
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 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00026 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00027 
00028 #include "DQM/EcalCommon/interface/Numbers.h"
00029 #include "DQM/EcalCommon/interface/NumbersPn.h"
00030 
00031 #include "DQM/EcalEndcapMonitorTasks/interface/EELaserTask.h"
00032 
00033 EELaserTask::EELaserTask(const edm::ParameterSet& ps){
00034 
00035   init_ = false;
00036 
00037   dqmStore_ = edm::Service<DQMStore>().operator->();
00038 
00039   prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00040 
00041   enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00042 
00043   mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00044 
00045   EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00046   EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
00047   EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00048   EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection");
00049 
00050   // vector of enabled wavelengths (Default to all 4)
00051   laserWavelengths_.reserve(4);
00052   for ( unsigned int i = 1; i <= 4; i++ ) laserWavelengths_.push_back(i);
00053   laserWavelengths_ = ps.getUntrackedParameter<std::vector<int> >("laserWavelengths", laserWavelengths_);
00054 
00055   for (int i = 0; i < 18; i++) {
00056     meShapeMapL1_[i] = 0;
00057     meAmplMapL1_[i] = 0;
00058     meTimeMapL1_[i] = 0;
00059     meAmplPNMapL1_[i] = 0;
00060     mePnAmplMapG01L1_[i] = 0;
00061     mePnPedMapG01L1_[i] = 0;
00062     mePnAmplMapG16L1_[i] = 0;
00063     mePnPedMapG16L1_[i] = 0;
00064 
00065     meShapeMapL2_[i] = 0;
00066     meAmplMapL2_[i] = 0;
00067     meTimeMapL2_[i] = 0;
00068     meAmplPNMapL2_[i] = 0;
00069     mePnAmplMapG01L2_[i] = 0;
00070     mePnPedMapG01L2_[i] = 0;
00071     mePnAmplMapG16L2_[i] = 0;
00072     mePnPedMapG16L2_[i] = 0;
00073 
00074     meShapeMapL3_[i] = 0;
00075     meAmplMapL3_[i] = 0;
00076     meTimeMapL3_[i] = 0;
00077     meAmplPNMapL3_[i] = 0;
00078     mePnAmplMapG01L3_[i] = 0;
00079     mePnPedMapG01L3_[i] = 0;
00080     mePnAmplMapG16L3_[i] = 0;
00081     mePnPedMapG16L3_[i] = 0;
00082 
00083     meShapeMapL4_[i] = 0;
00084     meAmplMapL4_[i] = 0;
00085     meTimeMapL4_[i] = 0;
00086     meAmplPNMapL4_[i] = 0;
00087     mePnAmplMapG01L4_[i] = 0;
00088     mePnPedMapG01L4_[i] = 0;
00089     mePnAmplMapG16L4_[i] = 0;
00090     mePnPedMapG16L4_[i] = 0;
00091   }
00092 
00093   for(int i=0; i<2; i++){
00094     meAmplSummaryMapL1_[i] = 0;
00095     meAmplSummaryMapL2_[i] = 0;
00096     meAmplSummaryMapL3_[i] = 0;
00097     meAmplSummaryMapL4_[i] = 0;
00098   }
00099 
00100 }
00101 
00102 EELaserTask::~EELaserTask(){
00103 
00104 }
00105 
00106 void EELaserTask::beginJob(void){
00107 
00108   ievt_ = 0;
00109 
00110   if ( dqmStore_ ) {
00111     dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask");
00112     dqmStore_->rmdir(prefixME_ + "/EELaserTask");
00113   }
00114 
00115 }
00116 
00117 void EELaserTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00118 
00119   Numbers::initGeometry(c, false);
00120 
00121   if ( ! mergeRuns_ ) this->reset();
00122 
00123 }
00124 
00125 void EELaserTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00126 
00127 }
00128 
00129 void EELaserTask::reset(void) {
00130 
00131   for (int i = 0; i < 18; i++) {
00132     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00133       if ( meShapeMapL1_[i] )  meShapeMapL1_[i]->Reset();
00134       if ( meAmplMapL1_[i] ) meAmplMapL1_[i]->Reset();
00135       if ( meTimeMapL1_[i] ) meTimeMapL1_[i]->Reset();
00136       if ( meAmplPNMapL1_[i] ) meAmplPNMapL1_[i]->Reset();
00137     }
00138 
00139     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00140       if ( meShapeMapL2_[i] )  meShapeMapL2_[i]->Reset();
00141       if ( meAmplMapL2_[i] ) meAmplMapL2_[i]->Reset();
00142       if ( meTimeMapL2_[i] ) meTimeMapL2_[i]->Reset();
00143       if ( meAmplPNMapL2_[i] ) meAmplPNMapL2_[i]->Reset();
00144     }
00145 
00146     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00147       if ( meShapeMapL3_[i] )  meShapeMapL3_[i]->Reset();
00148       if ( meAmplMapL3_[i] ) meAmplMapL3_[i]->Reset();
00149       if ( meTimeMapL3_[i] ) meTimeMapL3_[i]->Reset();
00150       if ( meAmplPNMapL3_[i] ) meAmplPNMapL3_[i]->Reset();
00151     }
00152 
00153     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00154       if ( meShapeMapL4_[i] )  meShapeMapL4_[i]->Reset();
00155       if ( meAmplMapL4_[i] ) meAmplMapL4_[i]->Reset();
00156       if ( meTimeMapL4_[i] ) meTimeMapL4_[i]->Reset();
00157       if ( meAmplPNMapL4_[i] ) meAmplPNMapL4_[i]->Reset();
00158     }
00159 
00160     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00161       if ( mePnAmplMapG01L1_[i] ) mePnAmplMapG01L1_[i]->Reset();
00162       if ( mePnPedMapG01L1_[i] ) mePnPedMapG01L1_[i]->Reset();
00163 
00164       if ( mePnAmplMapG16L1_[i] ) mePnAmplMapG16L1_[i]->Reset();
00165       if ( mePnPedMapG16L1_[i] ) mePnPedMapG16L1_[i]->Reset();
00166     }
00167 
00168 
00169     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00170       if ( mePnAmplMapG01L2_[i] ) mePnAmplMapG01L2_[i]->Reset();
00171       if ( mePnPedMapG01L2_[i] ) mePnPedMapG01L2_[i]->Reset();
00172 
00173       if ( mePnAmplMapG16L2_[i] ) mePnAmplMapG16L2_[i]->Reset();
00174       if ( mePnPedMapG16L2_[i] ) mePnPedMapG16L2_[i]->Reset();
00175     }
00176 
00177     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00178       if ( mePnAmplMapG01L3_[i] ) mePnAmplMapG01L3_[i]->Reset();
00179       if ( mePnPedMapG01L3_[i] ) mePnPedMapG01L3_[i]->Reset();
00180 
00181       if ( mePnAmplMapG16L3_[i] ) mePnAmplMapG16L3_[i]->Reset();
00182       if ( mePnPedMapG16L3_[i] ) mePnPedMapG16L3_[i]->Reset();
00183     }
00184 
00185     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00186       if ( mePnAmplMapG01L4_[i] ) mePnAmplMapG01L4_[i]->Reset();
00187       if ( mePnPedMapG01L4_[i] ) mePnPedMapG01L4_[i]->Reset();
00188 
00189       if ( mePnAmplMapG16L4_[i] ) mePnAmplMapG16L4_[i]->Reset();
00190       if ( mePnPedMapG16L4_[i] ) mePnPedMapG16L4_[i]->Reset();
00191     }
00192 
00193   }
00194 
00195   for(int i=0; i<2; i++){
00196     if( meAmplSummaryMapL1_[i] ) meAmplSummaryMapL1_[i]->Reset();
00197     if( meAmplSummaryMapL2_[i] ) meAmplSummaryMapL2_[i]->Reset();
00198     if( meAmplSummaryMapL3_[i] ) meAmplSummaryMapL3_[i]->Reset();
00199     if( meAmplSummaryMapL4_[i] ) meAmplSummaryMapL4_[i]->Reset();
00200   }
00201 
00202 }
00203 
00204 void EELaserTask::setup(void){
00205 
00206   init_ = true;
00207 
00208   std::string name;
00209   std::stringstream LaserN, LN;
00210 
00211   if ( dqmStore_ ) {
00212     dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask");
00213 
00214     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00215 
00216       LaserN.str("");
00217       LaserN << "Laser" << 1;
00218       LN.str("");
00219       LN << "L" << 1;
00220 
00221       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str());
00222       for (int i = 0; i < 18; i++) {
00223         name = "EELT shape " + Numbers::sEE(i+1) + " " + LN.str(); 
00224         meShapeMapL1_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00225         meShapeMapL1_[i]->setAxisTitle("channel", 1);
00226         meShapeMapL1_[i]->setAxisTitle("sample", 2);
00227         meShapeMapL1_[i]->setAxisTitle("amplitude", 3);
00228         dqmStore_->tag(meShapeMapL1_[i], i+1);
00229 
00230         name = "EELT amplitude " + Numbers::sEE(i+1) + " " + LN.str(); 
00231         meAmplMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00232         meAmplMapL1_[i]->setAxisTitle("ix", 1);
00233         if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL1_[i]->setAxisTitle("101-ix", 1);
00234         meAmplMapL1_[i]->setAxisTitle("iy", 2);
00235         dqmStore_->tag(meAmplMapL1_[i], i+1);
00236 
00237         name = "EELT timing " + Numbers::sEE(i+1) + " " + LN.str(); 
00238         meTimeMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00239         meTimeMapL1_[i]->setAxisTitle("ix", 1);
00240         if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL1_[i]->setAxisTitle("101-ix", 1);
00241         meTimeMapL1_[i]->setAxisTitle("iy", 2);
00242         dqmStore_->tag(meTimeMapL1_[i], i+1);
00243 
00244         name = "EELT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
00245         meAmplPNMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00246         meAmplPNMapL1_[i]->setAxisTitle("ix", 1);
00247         if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL1_[i]->setAxisTitle("101-ix", 1);
00248         meAmplPNMapL1_[i]->setAxisTitle("iy", 2);
00249         dqmStore_->tag(meAmplPNMapL1_[i], i+1);
00250       }
00251 
00252       name = "EELT amplitude map " + LN.str() + " EE -";
00253       meAmplSummaryMapL1_[0] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00254       meAmplSummaryMapL1_[0]->setAxisTitle("ix", 1);
00255       meAmplSummaryMapL1_[0]->setAxisTitle("iy", 2);
00256 
00257       name = "EELT amplitude map " + LN.str() + " EE +";
00258       meAmplSummaryMapL1_[1] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00259       meAmplSummaryMapL1_[1]->setAxisTitle("ix", 1);
00260       meAmplSummaryMapL1_[1]->setAxisTitle("iy", 2);
00261 
00262       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN");
00263 
00264       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN/Gain01");
00265 
00266       for (int i = 0; i < 18; i++) {
00267         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00268         mePnAmplMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00269         mePnAmplMapG01L1_[i]->setAxisTitle("channel", 1);
00270         mePnAmplMapG01L1_[i]->setAxisTitle("amplitude", 2);
00271         dqmStore_->tag(mePnAmplMapG01L1_[i], i+1);
00272 
00273         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00274         mePnPedMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00275         mePnPedMapG01L1_[i]->setAxisTitle("channel", 1);
00276         mePnPedMapG01L1_[i]->setAxisTitle("pedestal", 2);
00277         dqmStore_->tag(mePnPedMapG01L1_[i], i+1);
00278       }
00279 
00280       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN/Gain16");
00281 
00282       for (int i = 0; i < 18; i++) {
00283         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
00284         mePnAmplMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00285         mePnAmplMapG16L1_[i]->setAxisTitle("channel", 1);
00286         mePnAmplMapG16L1_[i]->setAxisTitle("amplitude", 2);
00287         dqmStore_->tag(mePnAmplMapG16L1_[i], i+1);
00288 
00289         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
00290         mePnPedMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00291         mePnPedMapG16L1_[i]->setAxisTitle("channel", 1);
00292         mePnPedMapG16L1_[i]->setAxisTitle("pedestal", 2);
00293         dqmStore_->tag(mePnPedMapG16L1_[i], i+1);
00294       }
00295 
00296     }
00297 
00298     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00299 
00300       LaserN.str("");
00301       LaserN << "Laser" << 2;
00302       LN.str("");
00303       LN << "L" << 2;
00304 
00305       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str());
00306       for (int i = 0; i < 18; i++) {
00307         name = "EELT shape " + Numbers::sEE(i+1) + " " + LN.str(); 
00308         meShapeMapL2_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00309         meShapeMapL2_[i]->setAxisTitle("channel", 1);
00310         meShapeMapL2_[i]->setAxisTitle("sample", 2);
00311         meShapeMapL2_[i]->setAxisTitle("amplitude", 3);
00312         dqmStore_->tag(meShapeMapL2_[i], i+1);
00313 
00314         name = "EELT amplitude " + Numbers::sEE(i+1) + " " + LN.str(); 
00315         meAmplMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00316         meAmplMapL2_[i]->setAxisTitle("ix", 1);
00317         if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL2_[i]->setAxisTitle("101-ix", 1);
00318         meAmplMapL2_[i]->setAxisTitle("iy", 2);
00319         dqmStore_->tag(meAmplMapL2_[i], i+1);
00320 
00321         name = "EELT timing " + Numbers::sEE(i+1) + " " + LN.str(); 
00322         meTimeMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00323         meTimeMapL2_[i]->setAxisTitle("ix", 1);
00324         if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL2_[i]->setAxisTitle("101-ix", 1);
00325         meTimeMapL2_[i]->setAxisTitle("iy", 2);
00326         dqmStore_->tag(meTimeMapL2_[i], i+1);
00327 
00328         name = "EELT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
00329         meAmplPNMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00330         meAmplPNMapL2_[i]->setAxisTitle("ix", 1);
00331         if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL2_[i]->setAxisTitle("101-ix", 1);
00332         meAmplPNMapL2_[i]->setAxisTitle("iy", 2);
00333         dqmStore_->tag(meAmplPNMapL2_[i], i+1);
00334       }
00335 
00336       name = "EELT amplitude map " + LN.str() + " EE -";
00337       meAmplSummaryMapL2_[0] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00338       meAmplSummaryMapL2_[0]->setAxisTitle("ix", 1);
00339       meAmplSummaryMapL2_[0]->setAxisTitle("iy", 2);
00340 
00341       name = "EELT amplitude map " + LN.str() + " EE +";
00342       meAmplSummaryMapL2_[1] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00343       meAmplSummaryMapL2_[1]->setAxisTitle("ix", 1);
00344       meAmplSummaryMapL2_[1]->setAxisTitle("iy", 2);
00345 
00346       for (int i = 0; i < 18; i++) {
00347         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00348         mePnAmplMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00349         mePnAmplMapG01L2_[i]->setAxisTitle("channel", 1);
00350         mePnAmplMapG01L2_[i]->setAxisTitle("amplitude", 2);
00351         dqmStore_->tag(mePnAmplMapG01L2_[i], i+1);
00352 
00353         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00354         mePnPedMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00355         mePnPedMapG01L2_[i]->setAxisTitle("channel", 1);
00356         mePnPedMapG01L2_[i]->setAxisTitle("pedestal", 2);
00357         dqmStore_->tag(mePnPedMapG01L2_[i], i+1);
00358       }
00359 
00360       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN/Gain16");
00361 
00362       for (int i = 0; i < 18; i++) {
00363         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
00364         mePnAmplMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00365         mePnAmplMapG16L2_[i]->setAxisTitle("channel", 1);
00366         mePnAmplMapG16L2_[i]->setAxisTitle("amplitude", 2);
00367         dqmStore_->tag(mePnAmplMapG16L2_[i], i+1);
00368 
00369         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
00370         mePnPedMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00371         mePnPedMapG16L2_[i]->setAxisTitle("channel", 1);
00372         mePnPedMapG16L2_[i]->setAxisTitle("pedestal", 2);
00373         dqmStore_->tag(mePnPedMapG16L2_[i], i+1);
00374       }
00375 
00376     }
00377 
00378     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00379 
00380       LaserN.str("");
00381       LaserN << "Laser" << 3;
00382       LN.str("");
00383       LN << "L" << 3;
00384 
00385       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str());
00386       for (int i = 0; i < 18; i++) {
00387         name = "EELT shape " + Numbers::sEE(i+1) + " " + LN.str(); 
00388         meShapeMapL3_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00389         meShapeMapL3_[i]->setAxisTitle("channel", 1);
00390         meShapeMapL3_[i]->setAxisTitle("sample", 2);
00391         meShapeMapL3_[i]->setAxisTitle("amplitude", 3);
00392         dqmStore_->tag(meShapeMapL3_[i], i+1);
00393 
00394         name = "EELT amplitude " + Numbers::sEE(i+1) + " " + LN.str(); 
00395         meAmplMapL3_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00396         meAmplMapL3_[i]->setAxisTitle("ix", 1);
00397         if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL3_[i]->setAxisTitle("101-ix", 1);
00398         meAmplMapL3_[i]->setAxisTitle("iy", 2);
00399         dqmStore_->tag(meAmplMapL3_[i], i+1);
00400 
00401         name = "EELT timing " + Numbers::sEE(i+1) + " " + LN.str(); 
00402         meTimeMapL3_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00403         meTimeMapL3_[i]->setAxisTitle("ix", 1);
00404         if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL3_[i]->setAxisTitle("101-ix", 1);
00405         meTimeMapL3_[i]->setAxisTitle("iy", 2);
00406         dqmStore_->tag(meTimeMapL3_[i], i+1);
00407 
00408         name = "EELT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
00409         meAmplPNMapL3_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00410         meAmplPNMapL3_[i]->setAxisTitle("ix", 1);
00411         if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL3_[i]->setAxisTitle("101-ix", 1);
00412         meAmplPNMapL3_[i]->setAxisTitle("iy", 2);
00413         dqmStore_->tag(meAmplPNMapL3_[i], i+1);
00414       }
00415 
00416       name = "EELT amplitude map " + LN.str() + " EE -";
00417       meAmplSummaryMapL3_[0] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00418       meAmplSummaryMapL3_[0]->setAxisTitle("ix", 1);
00419       meAmplSummaryMapL3_[0]->setAxisTitle("iy", 2);
00420 
00421       name = "EELT amplitude map " + LN.str() + " EE +";
00422       meAmplSummaryMapL3_[1] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00423       meAmplSummaryMapL3_[1]->setAxisTitle("ix", 1);
00424       meAmplSummaryMapL3_[1]->setAxisTitle("iy", 2);
00425 
00426       for (int i = 0; i < 18; i++) {
00427         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00428         mePnAmplMapG01L3_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00429         mePnAmplMapG01L3_[i]->setAxisTitle("channel", 1);
00430         mePnAmplMapG01L3_[i]->setAxisTitle("amplitude", 2);
00431         dqmStore_->tag(mePnAmplMapG01L3_[i], i+1);
00432 
00433         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00434         mePnPedMapG01L3_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00435         mePnPedMapG01L3_[i]->setAxisTitle("channel", 1);
00436         mePnPedMapG01L3_[i]->setAxisTitle("pedestal", 2);
00437         dqmStore_->tag(mePnPedMapG01L3_[i], i+1);
00438       }
00439 
00440       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN/Gain16");
00441 
00442       for (int i = 0; i < 18; i++) {
00443         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
00444         mePnAmplMapG16L3_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00445         mePnAmplMapG16L3_[i]->setAxisTitle("channel", 1);
00446         mePnAmplMapG16L3_[i]->setAxisTitle("amplitude", 2);
00447         dqmStore_->tag(mePnAmplMapG16L3_[i], i+1);
00448 
00449         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
00450         mePnPedMapG16L3_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00451         mePnPedMapG16L3_[i]->setAxisTitle("channel", 1);
00452         mePnPedMapG16L3_[i]->setAxisTitle("pedestal", 2);
00453         dqmStore_->tag(mePnPedMapG16L3_[i], i+1);
00454       }
00455 
00456     }
00457 
00458     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00459 
00460       LaserN.str("");
00461       LaserN << "Laser" << 4;
00462       LN.str("");
00463       LN << "L" << 4;
00464 
00465       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str());
00466       for (int i = 0; i < 18; i++) {
00467         name = "EELT shape " + Numbers::sEE(i+1) + " " + LN.str(); 
00468         meShapeMapL4_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00469         meShapeMapL4_[i]->setAxisTitle("channel", 1);
00470         meShapeMapL4_[i]->setAxisTitle("sample", 2);
00471         meShapeMapL4_[i]->setAxisTitle("amplitude", 3);
00472         dqmStore_->tag(meShapeMapL4_[i], i+1);
00473 
00474         name = "EELT amplitude " + Numbers::sEE(i+1) + " " + LN.str(); 
00475         meAmplMapL4_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00476         meAmplMapL4_[i]->setAxisTitle("ix", 1);
00477         if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL4_[i]->setAxisTitle("101-ix", 1);
00478         meAmplMapL4_[i]->setAxisTitle("iy", 2);
00479         dqmStore_->tag(meAmplMapL4_[i], i+1);
00480 
00481         name = "EELT timing " + Numbers::sEE(i+1) + " " + LN.str(); 
00482         meTimeMapL4_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00483         meTimeMapL4_[i]->setAxisTitle("ix", 1);
00484         if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL4_[i]->setAxisTitle("101-ix", 1);
00485         meTimeMapL4_[i]->setAxisTitle("iy", 2);
00486         dqmStore_->tag(meTimeMapL4_[i], i+1);
00487 
00488         name = "EELT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
00489         meAmplPNMapL4_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00490         meAmplPNMapL4_[i]->setAxisTitle("ix", 1);
00491         if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL4_[i]->setAxisTitle("101-ix", 1);
00492         meAmplPNMapL4_[i]->setAxisTitle("iy", 2);
00493         dqmStore_->tag(meAmplPNMapL4_[i], i+1);
00494       }
00495 
00496       name = "EELT amplitude map " + LN.str() + " EE -";
00497       meAmplSummaryMapL4_[0] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00498       meAmplSummaryMapL4_[0]->setAxisTitle("ix", 1);
00499       meAmplSummaryMapL4_[0]->setAxisTitle("iy", 2);
00500 
00501       name = "EELT amplitude map " + LN.str() + " EE +";
00502       meAmplSummaryMapL4_[1] = dqmStore_->bookProfile2D(name, name, 20, 0., 100., 20, 0., 100., 0., 4096.);
00503       meAmplSummaryMapL4_[1]->setAxisTitle("ix", 1);
00504       meAmplSummaryMapL4_[1]->setAxisTitle("iy", 2);
00505 
00506       for (int i = 0; i < 18; i++) {
00507         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00508         mePnAmplMapG01L4_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00509         mePnAmplMapG01L4_[i]->setAxisTitle("channel", 1);
00510         mePnAmplMapG01L4_[i]->setAxisTitle("amplitude", 2);
00511         dqmStore_->tag(mePnAmplMapG01L4_[i], i+1);
00512 
00513         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str(); 
00514         mePnPedMapG01L4_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00515         mePnPedMapG01L4_[i]->setAxisTitle("channel", 1);
00516         mePnPedMapG01L4_[i]->setAxisTitle("pedestal", 2);
00517         dqmStore_->tag(mePnPedMapG01L4_[i], i+1);
00518       }
00519 
00520       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/" + LaserN.str() + "/PN/Gain16");
00521 
00522       for (int i = 0; i < 18; i++) {
00523         name = "EELT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
00524         mePnAmplMapG16L4_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00525         mePnAmplMapG16L4_[i]->setAxisTitle("channel", 1);
00526         mePnAmplMapG16L4_[i]->setAxisTitle("amplitude", 2);
00527         dqmStore_->tag(mePnAmplMapG16L4_[i], i+1);
00528 
00529         name = "EELT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
00530         mePnPedMapG16L4_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
00531         mePnPedMapG16L4_[i]->setAxisTitle("channel", 1);
00532         mePnPedMapG16L4_[i]->setAxisTitle("pedestal", 2);
00533         dqmStore_->tag(mePnPedMapG16L4_[i], i+1);
00534       }
00535 
00536     }
00537 
00538   }
00539 
00540 }
00541 
00542 void EELaserTask::cleanup(void){
00543 
00544   if ( ! init_ ) return;
00545 
00546   if ( dqmStore_ ) {
00547     dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask");
00548 
00549     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00550 
00551       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser1");
00552       for (int i = 0; i < 18; i++) {
00553         if ( meShapeMapL1_[i] )  dqmStore_->removeElement( meShapeMapL1_[i]->getName() );
00554         meShapeMapL1_[i] = 0;
00555         if ( meAmplMapL1_[i] ) dqmStore_->removeElement( meAmplMapL1_[i]->getName() );
00556         meAmplMapL1_[i] = 0;
00557         if ( meTimeMapL1_[i] ) dqmStore_->removeElement( meTimeMapL1_[i]->getName() );
00558         meTimeMapL1_[i] = 0;
00559         if ( meAmplPNMapL1_[i] ) dqmStore_->removeElement( meAmplPNMapL1_[i]->getName() );
00560         meAmplPNMapL1_[i] = 0;
00561       }
00562 
00563       for(int i=0; i<2; i++)
00564         if( meAmplSummaryMapL1_[i] ) dqmStore_->removeElement( meAmplSummaryMapL1_[i]->getName() );
00565     }
00566 
00567     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00568 
00569       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser2");
00570       for (int i = 0; i < 18; i++) {
00571         if ( meShapeMapL2_[i] )  dqmStore_->removeElement( meShapeMapL2_[i]->getName() );
00572         meShapeMapL2_[i] = 0;
00573         if ( meAmplMapL2_[i] ) dqmStore_->removeElement( meAmplMapL2_[i]->getName() );
00574         meAmplMapL2_[i] = 0;
00575         if ( meTimeMapL2_[i] ) dqmStore_->removeElement( meTimeMapL2_[i]->getName() );
00576         meTimeMapL2_[i] = 0;
00577         if ( meAmplPNMapL2_[i] ) dqmStore_->removeElement( meAmplPNMapL2_[i]->getName() );
00578         meAmplPNMapL2_[i] = 0;
00579       }
00580 
00581       for(int i=0; i<2; i++)
00582         if( meAmplSummaryMapL2_[i] ) dqmStore_->removeElement( meAmplSummaryMapL2_[i]->getName() );
00583 
00584     }
00585 
00586     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00587 
00588       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser3");
00589       for (int i = 0; i < 18; i++) {
00590         if ( meShapeMapL3_[i] )  dqmStore_->removeElement( meShapeMapL3_[i]->getName() );
00591         meShapeMapL3_[i] = 0;
00592         if ( meAmplMapL3_[i] ) dqmStore_->removeElement( meAmplMapL3_[i]->getName() );
00593         meAmplMapL3_[i] = 0;
00594         if ( meTimeMapL3_[i] ) dqmStore_->removeElement( meTimeMapL3_[i]->getName() );
00595         meTimeMapL3_[i] = 0;
00596         if ( meAmplPNMapL3_[i] ) dqmStore_->removeElement( meAmplPNMapL3_[i]->getName() );
00597         meAmplPNMapL3_[i] = 0;
00598       }
00599 
00600       for(int i=0; i<2; i++)
00601         if( meAmplSummaryMapL3_[i] ) dqmStore_->removeElement( meAmplSummaryMapL3_[i]->getName() );
00602 
00603     }
00604 
00605     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00606 
00607       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser4");
00608       for (int i = 0; i < 18; i++) {
00609         if ( meShapeMapL4_[i] )  dqmStore_->removeElement( meShapeMapL4_[i]->getName() );
00610         meShapeMapL4_[i] = 0;
00611         if ( meAmplMapL4_[i] ) dqmStore_->removeElement( meAmplMapL4_[i]->getName() );
00612         meAmplMapL4_[i] = 0;
00613         if ( meTimeMapL4_[i] ) dqmStore_->removeElement( meTimeMapL4_[i]->getName() );
00614         meTimeMapL4_[i] = 0;
00615         if ( meAmplPNMapL4_[i] ) dqmStore_->removeElement( meAmplPNMapL4_[i]->getName() );
00616         meAmplPNMapL4_[i] = 0;
00617       }
00618 
00619       for(int i=0; i<2; i++)
00620         if( meAmplSummaryMapL4_[i] ) dqmStore_->removeElement( meAmplSummaryMapL4_[i]->getName() );
00621 
00622     }
00623 
00624     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 1) != laserWavelengths_.end() ) {
00625 
00626       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser1/PN");
00627 
00628       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser1/PN/Gain01");
00629       for (int i = 0; i < 18; i++) {
00630         if ( mePnAmplMapG01L1_[i] ) dqmStore_->removeElement( mePnAmplMapG01L1_[i]->getName() );
00631         mePnAmplMapG01L1_[i] = 0;
00632         if ( mePnPedMapG01L1_[i] ) dqmStore_->removeElement( mePnPedMapG01L1_[i]->getName() );
00633         mePnPedMapG01L1_[i] = 0;
00634       }
00635 
00636       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser1/PN/Gain16");
00637       for (int i = 0; i < 18; i++) {
00638         if ( mePnAmplMapG16L1_[i] ) dqmStore_->removeElement( mePnAmplMapG16L1_[i]->getName() );
00639         mePnAmplMapG16L1_[i] = 0;
00640         if ( mePnPedMapG16L1_[i] ) dqmStore_->removeElement( mePnPedMapG16L1_[i]->getName() );
00641         mePnPedMapG16L1_[i] = 0;
00642       }
00643 
00644     }
00645 
00646     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 2) != laserWavelengths_.end() ) {
00647 
00648       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser2/PN");
00649 
00650       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser2/PN/Gain01");
00651       for (int i = 0; i < 18; i++) {
00652         if ( mePnAmplMapG01L2_[i] ) dqmStore_->removeElement( mePnAmplMapG01L2_[i]->getName() );
00653         mePnAmplMapG01L2_[i] = 0;
00654         if ( mePnPedMapG01L2_[i] ) dqmStore_->removeElement( mePnPedMapG01L2_[i]->getName() );
00655         mePnPedMapG01L2_[i] = 0;
00656       }
00657 
00658       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser2/PN/Gain16");
00659       for (int i = 0; i < 18; i++) {
00660         if ( mePnAmplMapG16L2_[i] ) dqmStore_->removeElement( mePnAmplMapG16L2_[i]->getName() );
00661         mePnAmplMapG16L2_[i] = 0;
00662         if ( mePnPedMapG16L2_[i] ) dqmStore_->removeElement( mePnPedMapG16L2_[i]->getName() );
00663         mePnPedMapG16L2_[i] = 0;
00664       }
00665 
00666     }
00667 
00668     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 3) != laserWavelengths_.end() ) {
00669 
00670       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser3/PN");
00671 
00672       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser3/PN/Gain01");
00673       for (int i = 0; i < 18; i++) {
00674         if ( mePnAmplMapG01L3_[i] ) dqmStore_->removeElement( mePnAmplMapG01L3_[i]->getName() );
00675         mePnAmplMapG01L3_[i] = 0;
00676         if ( mePnPedMapG01L3_[i] ) dqmStore_->removeElement( mePnPedMapG01L3_[i]->getName() );
00677         mePnPedMapG01L3_[i] = 0;
00678       }
00679 
00680       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser3/PN/Gain16");
00681       for (int i = 0; i < 18; i++) {
00682         if ( mePnAmplMapG16L3_[i] ) dqmStore_->removeElement( mePnAmplMapG16L3_[i]->getName() );
00683         mePnAmplMapG16L3_[i] = 0;
00684         if ( mePnPedMapG16L3_[i] ) dqmStore_->removeElement( mePnPedMapG16L3_[i]->getName() );
00685         mePnPedMapG16L3_[i] = 0;
00686       }
00687 
00688     }
00689 
00690     if ( find(laserWavelengths_.begin(), laserWavelengths_.end(), 4) != laserWavelengths_.end() ) {
00691 
00692       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser4/PN");
00693 
00694       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser4/PN/Gain01");
00695       for (int i = 0; i < 18; i++) {
00696         if ( mePnAmplMapG01L4_[i] ) dqmStore_->removeElement( mePnAmplMapG01L4_[i]->getName() );
00697         mePnAmplMapG01L4_[i] = 0;
00698         if ( mePnPedMapG01L4_[i] ) dqmStore_->removeElement( mePnPedMapG01L4_[i]->getName() );
00699         mePnPedMapG01L4_[i] = 0;
00700       }
00701 
00702       dqmStore_->setCurrentFolder(prefixME_ + "/EELaserTask/Laser4/PN/Gain16");
00703       for (int i = 0; i < 18; i++) {
00704         if ( mePnAmplMapG16L4_[i] ) dqmStore_->removeElement( mePnAmplMapG16L4_[i]->getName() );
00705         mePnAmplMapG16L4_[i] = 0;
00706         if ( mePnPedMapG16L4_[i] ) dqmStore_->removeElement( mePnPedMapG16L4_[i]->getName() );
00707         mePnPedMapG16L4_[i] = 0;
00708       }
00709 
00710     }
00711 
00712   }
00713 
00714   init_ = false;
00715 
00716 }
00717 
00718 void EELaserTask::endJob(void){
00719 
00720   edm::LogInfo("EELaserTask") << "analyzed " << ievt_ << " events";
00721 
00722   if ( enableCleanup_ ) this->cleanup();
00723 
00724 }
00725 
00726 void EELaserTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00727 
00728   bool enable = false;
00729   int runType[18];
00730   for (int i=0; i<18; i++) runType[i] = -1;
00731   unsigned rtHalf[18];
00732   for (int i=0; i<18; i++) rtHalf[i] = -1;
00733   int waveLength[18];
00734   for (int i=0; i<18; i++) waveLength[i] = -1;
00735 
00736   edm::Handle<EcalRawDataCollection> dcchs;
00737 
00738   if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00739 
00740     for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00741 
00742       if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00743 
00744       int ism = Numbers::iSM( *dcchItr, EcalEndcap );
00745 
00746       runType[ism-1] = dcchItr->getRunType();
00747       rtHalf[ism-1] = dcchItr->getRtHalf();
00748       waveLength[ism-1] = dcchItr->getEventSettings().wavelength;
00749 
00750       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LASER_STD ||
00751            dcchItr->getRunType() == EcalDCCHeaderBlock::LASER_GAP ) enable = true;
00752 
00753     }
00754 
00755   } else {
00756 
00757     edm::LogWarning("EELaserTask") << EcalRawDataCollection_ << " not available";
00758 
00759   }
00760 
00761   if ( ! enable ) return;
00762 
00763   if ( ! init_ ) this->setup();
00764 
00765   ievt_++;
00766 
00767   bool numPN[80];
00768   float adcPN[80];
00769   for ( int i = 0; i < 80; i++ ) {
00770     numPN[i] = false;
00771     adcPN[i] = 0.;
00772   }
00773 
00774   std::vector<int> PNs;
00775   PNs.reserve(12);
00776 
00777   edm::Handle<EEDigiCollection> digis;
00778 
00779   if ( e.getByLabel(EEDigiCollection_, digis) ) {
00780 
00781     int maxpos[10];
00782     for(int i(0); i < 10; i++)
00783       maxpos[i] = 0;
00784     int nReadouts(0);
00785 
00786     for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00787 
00788       EEDetId id = digiItr->id();
00789 
00790       int ism = Numbers::iSM( id );
00791 
00792       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LASER_STD ||
00793                runType[ism-1] == EcalDCCHeaderBlock::LASER_GAP ) ) continue;
00794 
00795       if ( rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
00796 
00797       nReadouts++;
00798 
00799       EEDataFrame dataframe = (*digiItr);
00800 
00801       int iMax(-1);
00802       float max(0.);
00803       float min(4096.);
00804       for (int i = 0; i < 10; i++) {
00805         int adc = dataframe.sample(i).adc();
00806         if(adc > max){
00807           max = adc;
00808           iMax = i;
00809         }
00810         if(adc < min)
00811           min = adc;
00812       }
00813       if(iMax >= 0 && max - min > 20.)
00814         maxpos[iMax] += 1;
00815 
00816     }
00817 
00818     int threshold(nReadouts / 2);
00819     enable = false;
00820     for(int i(0); i < 10; i++){
00821       if(maxpos[i] > threshold){
00822         enable = true;
00823         break;
00824       }
00825     }
00826 
00827     if(!enable) return;
00828 
00829     int need = digis->size();
00830     LogDebug("EELaserTask") << "event " << ievt_ << " digi collection size " << need;
00831 
00832     for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00833 
00834       EEDetId id = digiItr->id();
00835 
00836       int ix = id.ix();
00837       int iy = id.iy();
00838 
00839       int ism = Numbers::iSM( id );
00840 
00841       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LASER_STD ||
00842                runType[ism-1] == EcalDCCHeaderBlock::LASER_GAP ) ) continue;
00843 
00844       if ( rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
00845 
00846       int ic = Numbers::icEE(ism, ix, iy);
00847 
00848       EEDataFrame dataframe = (*digiItr);
00849 
00850       for (int i = 0; i < 10; i++) {
00851 
00852         int adc = dataframe.sample(i).adc();
00853 
00854         MonitorElement* meShapeMap = 0;
00855 
00856         if ( rtHalf[ism-1] == 0 || rtHalf[ism-1] == 1 ) {
00857 
00858           if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1_[ism-1];
00859           if ( waveLength[ism-1] == 1 ) meShapeMap = meShapeMapL2_[ism-1];
00860           if ( waveLength[ism-1] == 2 ) meShapeMap = meShapeMapL3_[ism-1];
00861           if ( waveLength[ism-1] == 3 ) meShapeMap = meShapeMapL4_[ism-1];
00862 
00863         } else {
00864 
00865           edm::LogWarning("EELaserTask") << " RtHalf = " << rtHalf[ism-1];
00866 
00867         }
00868 
00869         float xval = float(adc);
00870 
00871         if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
00872 
00873       }
00874 
00875       NumbersPn::getPNs( ism, ix, iy, PNs );
00876 
00877       for (unsigned int i=0; i<PNs.size(); i++) {
00878         int ipn = PNs[i];
00879         if ( ipn >= 0 && ipn < 80 ) numPN[ipn] = true;
00880       }
00881 
00882     }
00883 
00884   } else {
00885 
00886     edm::LogWarning("EELaserTask") << EEDigiCollection_ << " not available";
00887 
00888   }
00889 
00890   edm::Handle<EcalPnDiodeDigiCollection> pns;
00891 
00892   if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
00893 
00894     int nep = pns->size();
00895     LogDebug("EELaserTask") << "event " << ievt_ << " pns collection size " << nep;
00896 
00897     for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
00898 
00899       if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
00900 
00901       int ism = Numbers::iSM( pnItr->id() );
00902 
00903       int num = pnItr->id().iPnId();
00904 
00905       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LASER_STD ||
00906                runType[ism-1] == EcalDCCHeaderBlock::LASER_GAP ) ) continue;
00907 
00908       int ipn = NumbersPn::ipnEE( ism, num );
00909 
00910       if ( ipn >= 0 && ipn < 80 && numPN[ipn] == false ) continue;
00911 
00912       float xvalped = 0.;
00913 
00914       for (int i = 0; i < 4; i++) {
00915 
00916         int adc = pnItr->sample(i).adc();
00917 
00918         MonitorElement* mePNPed = 0;
00919 
00920         if ( pnItr->sample(i).gainId() == 0 ) {
00921           if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG01L1_[ism-1];
00922           if ( waveLength[ism-1] == 1 ) mePNPed = mePnPedMapG01L2_[ism-1];
00923           if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG01L3_[ism-1];
00924           if ( waveLength[ism-1] == 3 ) mePNPed = mePnPedMapG01L4_[ism-1];
00925         }
00926         if ( pnItr->sample(i).gainId() == 1 ) {
00927           if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG16L1_[ism-1];
00928           if ( waveLength[ism-1] == 1 ) mePNPed = mePnPedMapG16L2_[ism-1];
00929           if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG16L3_[ism-1];
00930           if ( waveLength[ism-1] == 3 ) mePNPed = mePnPedMapG16L4_[ism-1];
00931         }
00932 
00933         float xval = float(adc);
00934 
00935         if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
00936 
00937         xvalped = xvalped + xval;
00938 
00939       }
00940 
00941       xvalped = xvalped / 4;
00942 
00943       float xvalmax = 0.;
00944 
00945       MonitorElement* mePN = 0;
00946 
00947       for (int i = 0; i < 50; i++) {
00948 
00949         int adc = pnItr->sample(i).adc();
00950 
00951         float xval = float(adc);
00952 
00953         if ( xval >= xvalmax ) xvalmax = xval;
00954 
00955       }
00956 
00957       xvalmax = xvalmax - xvalped;
00958 
00959       if ( pnItr->sample(0).gainId() == 0 ) {
00960         if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG01L1_[ism-1];
00961         if ( waveLength[ism-1] == 1 ) mePN = mePnAmplMapG01L2_[ism-1];
00962         if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG01L3_[ism-1];
00963         if ( waveLength[ism-1] == 3 ) mePN = mePnAmplMapG01L4_[ism-1];
00964       }
00965       if ( pnItr->sample(0).gainId() == 1 ) {
00966         if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG16L1_[ism-1];
00967         if ( waveLength[ism-1] == 1 ) mePN = mePnAmplMapG16L2_[ism-1];
00968         if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG16L3_[ism-1];
00969         if ( waveLength[ism-1] == 3 ) mePN = mePnAmplMapG16L4_[ism-1];
00970       }
00971 
00972       if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
00973 
00974       if ( ipn >= 0 && ipn < 80 ) adcPN[ipn] = xvalmax;
00975 
00976     }
00977 
00978   } else {
00979 
00980     edm::LogWarning("EELaserTask") << EcalPnDiodeDigiCollection_ << " not available";
00981 
00982   }
00983 
00984   edm::Handle<EcalUncalibratedRecHitCollection> hits;
00985 
00986   if ( e.getByLabel(EcalUncalibratedRecHitCollection_, hits) ) {
00987 
00988     int neh = hits->size();
00989     LogDebug("EELaserTask") << "event " << ievt_ << " hits collection size " << neh;
00990 
00991     for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
00992 
00993       EEDetId id = hitItr->id();
00994 
00995       int ix = id.ix();
00996       int iy = id.iy();
00997       int iz;
00998 
00999       int ism = Numbers::iSM( id );
01000 
01001       if ( ism >= 1 && ism <= 9 ){
01002         ix = 101 - ix;
01003         iz = 0;
01004       }else{
01005         iz = 1;
01006       }
01007 
01008       float xix = ix - 0.5;
01009       float xiy = iy - 0.5;
01010 
01011       if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LASER_STD ||
01012                runType[ism-1] == EcalDCCHeaderBlock::LASER_GAP ) ) continue;
01013 
01014       if ( rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
01015 
01016       MonitorElement* meAmplMap = 0;
01017       MonitorElement* meTimeMap = 0;
01018       MonitorElement* meAmplPNMap = 0;
01019       MonitorElement* meAmplSummaryMap = 0;
01020 
01021       if ( rtHalf[ism-1] == 0 || rtHalf[ism-1] == 1 ) {
01022 
01023         if ( waveLength[ism-1] == 0 ) {
01024           meAmplMap = meAmplMapL1_[ism-1];
01025           meTimeMap = meTimeMapL1_[ism-1];
01026           meAmplPNMap = meAmplPNMapL1_[ism-1];
01027           meAmplSummaryMap = meAmplSummaryMapL1_[iz];
01028         }
01029         if ( waveLength[ism-1] == 1 ) {
01030           meAmplMap = meAmplMapL2_[ism-1];
01031           meTimeMap = meTimeMapL2_[ism-1];
01032           meAmplPNMap = meAmplPNMapL2_[ism-1];
01033           meAmplSummaryMap = meAmplSummaryMapL2_[iz];
01034         }
01035         if ( waveLength[ism-1] == 2 ) {
01036           meAmplMap = meAmplMapL3_[ism-1];
01037           meTimeMap = meTimeMapL3_[ism-1];
01038           meAmplPNMap = meAmplPNMapL3_[ism-1];
01039           meAmplSummaryMap = meAmplSummaryMapL3_[iz];
01040         }
01041         if ( waveLength[ism-1] == 3 ) {
01042           meAmplMap = meAmplMapL4_[ism-1];
01043           meTimeMap = meTimeMapL4_[ism-1];
01044           meAmplPNMap = meAmplPNMapL4_[ism-1];
01045           meAmplSummaryMap = meAmplSummaryMapL4_[iz];
01046         }
01047 
01048       } else {
01049 
01050         edm::LogWarning("EELaserTask") << " RtHalf = " << rtHalf[ism-1];
01051 
01052       }
01053 
01054       float xval = hitItr->amplitude();
01055       if ( xval <= 0. ) xval = 0.0;
01056       float yval = hitItr->jitter() + 5.0;
01057       if ( yval <= 0. ) yval = 0.0;
01058       float zval = hitItr->pedestal();
01059       if ( zval <= 0. ) zval = 0.0;
01060 
01061       if ( meAmplMap ) meAmplMap->Fill(xix, xiy, xval);
01062 
01063       if ( xval > 16. ) {
01064         if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval);
01065       }
01066 
01067       float wval = 0.;
01068 
01069       NumbersPn::getPNs( ism, ix, iy, PNs );
01070 
01071       if ( PNs.size() > 0 ) {
01072         int ipn = PNs[0];
01073         if ( ipn >= 0 && ipn < 80 ) {
01074           if ( adcPN[ipn] != 0. ) wval = xval / adcPN[ipn];
01075         }
01076       }
01077 
01078       if ( meAmplPNMap ) meAmplPNMap->Fill(xix, xiy, wval);
01079 
01080       if( meAmplSummaryMap ) meAmplSummaryMap->Fill(xix, xiy, xval);
01081 
01082     }
01083 
01084   } else {
01085 
01086     edm::LogWarning("EELaserTask") << EcalUncalibratedRecHitCollection_ << " not available";
01087 
01088   }
01089 
01090 }
01091