CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/EcalBarrelMonitorTasks/src/EBLaserTask.cc

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