CMS 3D CMS Logo

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

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