CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/EcalBarrelMonitorTasks/src/EBLaserTask.cc

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