CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DQMOffline/Ecal/src/EEClusterTaskExtras.cc

Go to the documentation of this file.
00001 /*
00002  * \file EEClusterTaskExtras.cc
00003  *
00004  * $Date: 2012/06/28 12:15:16 $
00005  * $Revision: 1.10 $
00006  * \author G. Della Ricca
00007  * \author E. Di Marco
00008  *
00009  */
00010 
00011 #include <iostream>
00012 #include <fstream>
00013 #include <vector>
00014 #include <math.h>
00015 
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020 
00021 #include "DQMServices/Core/interface/DQMStore.h"
00022 
00023 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00024 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00025 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00026 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00027 #include "FWCore/Framework/interface/ESHandle.h"
00028 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00029 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00030 #include "DataFormats/Math/interface/Point3D.h"
00031 
00032 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
00033 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
00034 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00035 #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h"
00036 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00037 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00038 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00039 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00040 
00041 #include <DQM/EcalCommon/interface/Numbers.h>
00042 
00043 #include <DQMOffline/Ecal/interface/EEClusterTaskExtras.h>
00044 
00045 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00046 
00047 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00048 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00049 
00050 using namespace cms;
00051 using namespace edm;
00052 using namespace std;
00053 using namespace reco;
00054 
00055 EEClusterTaskExtras::EEClusterTaskExtras(const ParameterSet& ps){
00056 
00057    init_ = false;
00058 
00059    dqmStore_ = Service<DQMStore>().operator->();
00060 
00061    prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00062 
00063    enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00064 
00065    mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00066 
00067    // parameters...
00068    SuperClusterCollection_ = ps.getParameter<edm::InputTag>("SuperClusterCollection");
00069    EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
00070    l1GTReadoutRecTag_ = ps.getParameter<edm::InputTag>("l1GlobalReadoutRecord");
00071    l1GMTReadoutRecTag_ = ps.getParameter<edm::InputTag>("l1GlobalMuonReadoutRecord");
00072 
00073    // histograms...
00074 #ifndef EECLUSTERTASKEXTRAS_DQMOFFLINE
00075    meSCSizCrystal_ = 0;
00076    meSCSizBC_ = 0;
00077 
00078    meSCSeedEne_ = 0;
00079    meSCEne2_ = 0;
00080    meSCEneLow_ = 0;
00081    meSCEneHigh_ = 0;
00082    meSCEneSingleCrystal_ = 0;
00083 
00084    for(int i=0;i!=2;++) {
00085       meSCSeedMapOccSingleCrystal_[i] = 0;
00086       meSCSeedMapOccSC_[i] = 0;
00087       meSCSeedMapOccHighEne_[i] = 0;
00088       meSCSeedMapTimeSC_[i] = 0;
00089       for(int j=0;j!=5;++j) {
00090          meSCSeedMapOccTrg_[i][j] = 0;
00091          meSCSeedMapOccTrgExcl_[i][j] = 0;
00092       }
00093    }
00094 
00095    meSCSeedTime_ = 0;
00096    meSCSeedTimeVsAmp_ = 0;
00097    meSCSeedTimeEEM_ = 0;
00098    meSCSeedTimeEEP_ = 0;
00099    for(int i=0;i!=18;++i)
00100       meSCSeedTimePerFed_[i] = 0;
00101 #endif
00102 
00103   meSCSizCrystalVsEne_ = 0;
00104 
00105    for(int i=0;i!=2;++i) {
00106       meSCSeedMapOcc_[i] = 0;
00107       meSCSeedMapOccHighEneSC_[i] = 0;
00108       for(int j=0;j!=5;++j) {
00109          meSCSeedMapTimeTrgSC_[i][j] = 0;
00110          meSCSeedMapOccTrgSC_[i][j] = 0;
00111          meSCSeedMapOccTrgExclSC_[i][j] = 0;
00112       }
00113    }
00114 
00115 }
00116 
00117 EEClusterTaskExtras::~EEClusterTaskExtras(){
00118 
00119 }
00120 
00121 void EEClusterTaskExtras::beginJob(){
00122 
00123    ievt_ = 0;
00124 
00125    if ( dqmStore_ ) {
00126       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras");
00127       dqmStore_->rmdir(prefixME_ + "/EEClusterTaskExtras");
00128    }
00129 
00130 }
00131 
00132 void EEClusterTaskExtras::beginRun(const Run& r, const EventSetup& c) {
00133 
00134    Numbers::initGeometry(c, false);
00135 
00136    if ( ! mergeRuns_ ) this->reset();
00137 
00138 }
00139 
00140 void EEClusterTaskExtras::endRun(const Run& r, const EventSetup& c) {
00141 
00142 }
00143 
00144 void EEClusterTaskExtras::reset(void) {
00145 #ifndef EECLUSTERTASKEXTRAS_DQMOFFLINE
00146    if ( meSCSizCrystal_ ) meSCSizCrystal_->Reset();
00147    if ( meSCSizBC_ ) meSCSizBC_->Reset(); 
00148 
00149    if ( meSCSeedEne_ ) meSCSeedEne_->Reset();
00150    if ( meSCEne2_ ) meSCEne2_->Reset();
00151    if ( meSCEneLow_ ) meSCEneLow_->Reset();
00152    if ( meSCEneHigh_ ) meSCEneHigh_->Reset();
00153    if ( meSCEneSingleCrystal_ ) meSCEneSingleCrystal_->Reset();
00154 
00155    for(int i=0;i!=2;++i) {
00156       if ( meSCSeedMapOccSingleCrystal_[i] ) meSCSeedMapOccSingleCrystal_[i]->Reset();
00157       if ( meSCSeedMapOccSC_[i] ) meSCSeedMapOccSC_[i]->Reset();
00158       if ( meSCSeedMapOccHighEne_[i] ) meSCSeedMapOccHighEne_[i]->Reset();
00159       if ( meSCSeedMapTimeSC_[i] ) meSCSeedMapTimeSC_[i]->Reset();
00160       for(int j=0;j!=5;++j) {
00161          if ( meSCSeedMapOccTrg_[i][j] ) meSCSeedMapOccTrg_[i][j]->Reset();
00162          if ( meSCSeedMapOccTrgExcl_[i][j] ) meSCSeedMapOccTrgExcl_[i][j]->Reset();
00163       }
00164    }
00165 
00166    if ( meSCSeedTime_ ) meSCSeedTime_->Reset();
00167    if ( meSCSeedTimeVsAmp_ ) meSCSeedTimeVsAmp_->Reset();
00168    if ( meSCSeedTimeEEM_ ) meSCSeedTimeEEM_->Reset();
00169    if ( meSCSeedTimeEEP_ ) meSCSeedTimeEEP_->Reset();
00170 
00171    for(int i=0;i!=18;++i) 
00172       if ( meSCSeedTimePerFed_[i] ) meSCSeedTimePerFed_[i]->Reset();
00173 #endif
00174 
00175    if ( meSCSizCrystalVsEne_ ) meSCSizCrystalVsEne_->Reset();
00176 
00177    for(int i=0;i!=2;++i) {
00178       if ( meSCSeedMapOcc_[i] ) meSCSeedMapOcc_[i]->Reset();
00179       if ( meSCSeedMapOccHighEneSC_[i] ) meSCSeedMapOccHighEneSC_[i]->Reset();
00180       for(int j=0; j!=5; ++j) {
00181          if ( meSCSeedMapOccTrgSC_[i][j] ) meSCSeedMapOccTrgSC_[i][j]->Reset();
00182          if ( meSCSeedMapOccTrgExclSC_[i][j] ) meSCSeedMapOccTrgExclSC_[i][j]->Reset();
00183          if ( meSCSeedMapTimeTrgSC_[i][j] ) meSCSeedMapTimeTrgSC_[i][j]->Reset();
00184       }
00185    }
00186    
00187 }
00188 
00189 void EEClusterTaskExtras::setup(void){
00190 
00191    init_ = true;
00192 
00193    std::string histo;
00194 
00195    if ( dqmStore_ ) {
00196       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras");
00197 
00198 #ifndef EECLUSTERTASKEXTRAS_DQMOFFLINE
00199       // Cluster hists
00200       histo = "EECLTE SC size (crystal)";
00201       meSCSizCrystal_ = dqmStore_->book1D(histo,histo,150,0,150);
00202       meSCSizCrystal_->setAxisTitle("super cluster size (crystal)", 1);
00203 
00204       histo = "EECLTE SC size (basic clusters)";
00205       meSCSizBC_ = dqmStore_->book1D(histo,histo,20,0,20);
00206       meSCSizBC_->setAxisTitle("super cluster size (basic clusters)", 1);
00207 
00208       histo = "EECLTE SC energy";
00209       meSCSeedEne_ = dqmStore_->book1D(histo,histo,200,0,1.8);
00210       meSCSeedEne_->setAxisTitle("energy (GeV)", 1);
00211 
00212       histo = "EECLTE SC + highest neighbor energy";
00213       meSCEne2_ = dqmStore_->book1D(histo,histo,200,0,1.8);
00214       meSCEne2_->setAxisTitle("+ highest neighbor energy (GeV)", 1);
00215 
00216       histo = "EECLTE SC energy low scale";
00217       meSCEneLow_ = dqmStore_->book1D(histo,histo,200,0,1.8);
00218       meSCEneLow_->setAxisTitle("energy (GeV)", 1);
00219 
00220       histo = "EECLTE SC energy high scale";
00221       meSCEneHigh_ = dqmStore_->book1D(histo,histo,200,0,200);
00222       meSCEneHigh_->setAxisTitle("energy (GeV)", 1);
00223 
00224       histo = "EECLTE SC single crystal cluster energy (GeV)";
00225       meSCEneSingleCrystal_ = dqmStore_->book1D(histo,histo,200,0,200);
00226       meSCEneSingleCrystal_->setAxisTitle("energy (GeV)", 1);
00227 
00228       histo = "EECLTE SC seed occupancy map super crystal binned EE -";
00229       meSCSeedMapOccSC_[0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00230       meSCSeedMapOccSC_[0]->setAxisTitle("jx", 1);
00231       meSCSeedMapOccSC_[0]->setAxisTitle("jy", 2);
00232 
00233       histo = "EECLTE SC seed occupancy map EE - (high energy clusters)";
00234       meSCSeedMapOccHighEne_[0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00235       meSCSeedMapOccHighEne_[0]->setAxisTitle("jx", 1);
00236       meSCSeedMapOccHighEne_[0]->setAxisTitle("jy", 2);
00237 
00238       histo = "EECLTE SC single crystal cluster seed occupancy map EE -";
00239       meSCSeedMapOccSingleCrystal_[0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00240       meSCSeedMapOccSingleCrystal_[0]->setAxisTitle("jx", 1);
00241       meSCSeedMapOccSingleCrystal_[0]->setAxisTitle("jy", 2);
00242 
00243       histo = "EECLTE SC seed occupancy map EE - (CSC triggered)";
00244       meSCSeedMapOccTrg_[0][0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00245       meSCSeedMapOccTrg_[0][0]->setAxisTitle("jx", 1);
00246       meSCSeedMapOccTrg_[0][0]->setAxisTitle("jy", 2);
00247 
00248       histo = "EECLTE SC seed occupancy map EE - (DT triggered)";
00249       meSCSeedMapOccTrg_[0][1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00250       meSCSeedMapOccTrg_[0][1]->setAxisTitle("jx", 1);
00251       meSCSeedMapOccTrg_[0][1]->setAxisTitle("jy", 2);
00252 
00253       histo = "EECLTE SC seed occupancy map EE - (ECAL triggered)";
00254       meSCSeedMapOccTrg_[0][2] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00255       meSCSeedMapOccTrg_[0][2]->setAxisTitle("jx", 1);
00256       meSCSeedMapOccTrg_[0][2]->setAxisTitle("jy", 2);
00257 
00258       histo = "EECLTE SC seed occupancy map EE - (HCAL triggered)";
00259       meSCSeedMapOccTrg_[0][3] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00260       meSCSeedMapOccTrg_[0][3]->setAxisTitle("jx", 1);
00261       meSCSeedMapOccTrg_[0][3]->setAxisTitle("jy", 2);
00262 
00263       histo = "EECLTE SC seed occupancy map EE - (RPC triggered)";
00264       meSCSeedMapOccTrg_[0][4] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00265       meSCSeedMapOccTrg_[0][4]->setAxisTitle("jx", 1);
00266       meSCSeedMapOccTrg_[0][4]->setAxisTitle("jy", 2);
00267 
00268       histo = "EECLTE SC seed occupancy map EE - (CSC exclusive triggered)";
00269       meSCSeedMapOccTrgExcl_[0][0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00270       meSCSeedMapOccTrgExcl_[0][0]->setAxisTitle("jx", 1);
00271       meSCSeedMapOccTrgExcl_[0][0]->setAxisTitle("jy", 2);
00272 
00273       histo = "EECLTE SC seed occupancy map EE - (DT exclusive triggered)";
00274       meSCSeedMapOccTrgExcl_[0][1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00275       meSCSeedMapOccTrgExcl_[0][1]->setAxisTitle("jx", 1);
00276       meSCSeedMapOccTrgExcl_[0][1]->setAxisTitle("jy", 2);
00277 
00278       histo = "EECLTE SC seed occupancy map EE - (ECAL exclusive triggered)";
00279       meSCSeedMapOccTrgExcl_[0][2] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00280       meSCSeedMapOccTrgExcl_[0][2]->setAxisTitle("jx", 1);
00281       meSCSeedMapOccTrgExcl_[0][2]->setAxisTitle("jy", 2);
00282 
00283       histo = "EECLTE SC seed occupancy map EE - (HCAL exclusive triggered)";
00284       meSCSeedMapOccTrgExcl_[0][3] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00285       meSCSeedMapOccTrgExcl_[0][3]->setAxisTitle("jx", 1);
00286       meSCSeedMapOccTrgExcl_[0][3]->setAxisTitle("jy", 2);
00287 
00288       histo = "EECLTE SC seed occupancy map EE - (RPC exclusive triggered)";
00289       meSCSeedMapOccTrgExcl_[0][4] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00290       meSCSeedMapOccTrgExcl_[0][4]->setAxisTitle("jx", 1);
00291       meSCSeedMapOccTrgExcl_[0][4]->setAxisTitle("jy", 2);
00292 
00293       histo = "EECLTE SC seed occupancy map super crystal binned EE +";
00294       meSCSeedMapOccSC_[1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00295       meSCSeedMapOccSC_[1]->setAxisTitle("jx", 1);
00296       meSCSeedMapOccSC_[1]->setAxisTitle("jy", 2);
00297 
00298       histo = "EECLTE SC seed occupancy map EE + (high energy clusters)";
00299       meSCSeedMapOccHighEne_[1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00300       meSCSeedMapOccHighEne_[1]->setAxisTitle("jx", 1);
00301       meSCSeedMapOccHighEne_[1]->setAxisTitle("jy", 2);
00302 
00303       histo = "EECLTE SC single crystal cluster seed occupancy map EE +";
00304       meSCSeedMapOccSingleCrystal_[1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00305       meSCSeedMapOccSingleCrystal_[1]->setAxisTitle("jx", 1);
00306       meSCSeedMapOccSingleCrystal_[1]->setAxisTitle("jy", 2);
00307 
00308       histo = "EECLTE SC seed occupancy map EE + (CSC triggered)";
00309       meSCSeedMapOccTrg_[1][0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00310       meSCSeedMapOccTrg_[1][0]->setAxisTitle("jx", 1);
00311       meSCSeedMapOccTrg_[1][0]->setAxisTitle("jy", 2);
00312 
00313       histo = "EECLTE SC seed occupancy map EE + (DT triggered)";
00314       meSCSeedMapOccTrg_[1][1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00315       meSCSeedMapOccTrg_[1][1]->setAxisTitle("jx", 1);
00316       meSCSeedMapOccTrg_[1][1]->setAxisTitle("jy", 2);
00317 
00318       histo = "EECLTE SC seed occupancy map EE + (ECAL triggered)";
00319       meSCSeedMapOccTrg_[1][2] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00320       meSCSeedMapOccTrg_[1][2]->setAxisTitle("jx", 1);
00321       meSCSeedMapOccTrg_[1][2]->setAxisTitle("jy", 2);
00322 
00323       histo = "EECLTE SC seed occupancy map EE + (HCAL triggered)";
00324       meSCSeedMapOccTrg_[1][3] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00325       meSCSeedMapOccTrg_[1][3]->setAxisTitle("jx", 1);
00326       meSCSeedMapOccTrg_[1][3]->setAxisTitle("jy", 2);
00327 
00328       histo = "EECLTE SC seed occupancy map EE + (RPC triggered)";
00329       meSCSeedMapOccTrg_[1][4] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00330       meSCSeedMapOccTrg_[1][4]->setAxisTitle("jx", 1);
00331       meSCSeedMapOccTrg_[1][4]->setAxisTitle("jy", 2);
00332 
00333       histo = "EECLTE SC seed occupancy map EE + (CSC exclusive triggered)";
00334       meSCSeedMapOccTrgExcl_[1][0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00335       meSCSeedMapOccTrgExcl_[1][0]->setAxisTitle("jx", 1);
00336       meSCSeedMapOccTrgExcl_[1][0]->setAxisTitle("jy", 2);
00337 
00338       histo = "EECLTE SC seed occupancy map EE + (DT exclusive triggered)";
00339       meSCSeedMapOccTrgExcl_[1][1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00340       meSCSeedMapOccTrgExcl_[1][1]->setAxisTitle("jx", 1);
00341       meSCSeedMapOccTrgExcl_[1][1]->setAxisTitle("jy", 2);
00342 
00343       histo = "EECLTE SC seed occupancy map EE + (ECAL exclusive triggered)";
00344       meSCSeedMapOccTrgExcl_[1][2] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00345       meSCSeedMapOccTrgExcl_[1][2]->setAxisTitle("jx", 1);
00346       meSCSeedMapOccTrgExcl_[1][2]->setAxisTitle("jy", 2);
00347 
00348       histo = "EECLTE SC seed occupancy map EE + (HCAL exclusive triggered)";
00349       meSCSeedMapOccTrgExcl_[1][3] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00350       meSCSeedMapOccTrgExcl_[1][3]->setAxisTitle("jx", 1);
00351       meSCSeedMapOccTrgExcl_[1][3]->setAxisTitle("jy", 2);
00352 
00353       histo = "EECLTE SC seed occupancy map EE + (RPC exclusive triggered)";
00354       meSCSeedMapOccTrgExcl_[1][4] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00355       meSCSeedMapOccTrgExcl_[1][4]->setAxisTitle("jx", 1);
00356       meSCSeedMapOccTrgExcl_[1][4]->setAxisTitle("jy", 2);
00357 
00358       histo = "EECLTE SC seed crystal timing map EE + super crystal binned";
00359       meSCSeedMapTimeSC_[1] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00360       meSCSeedMapTimeSC_[1]->setAxisTitle("jx", 1);
00361       meSCSeedMapTimeSC_[1]->setAxisTitle("jy", 2);
00362 
00363       histo = "EECLTE SC seed crystal timing map EE + super crystal binned";
00364       meSCSeedMapTimeSC_[1] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00365       meSCSeedMapTimeSC_[1]->setAxisTitle("jx", 1);
00366       meSCSeedMapTimeSC_[1]->setAxisTitle("jy", 2);
00367 
00368       histo = "EECLTE SC relative timing";
00369       meSCSeedTime_ = dqmStore_->book1D(histo,histo,78,0.,10.);
00370       meSCSeedTime_->setAxisTitle("seed crystal timing");
00371 
00372       histo = "EECLTE SC relative timing vs amplitude";
00373       meSCSeedTimeVsAmp_ = dqmStore_->bookProfile(histo, histo, 78, -7, 7, 200, 0, 1.8);
00374       meSCSeedTimeVsAmp_->setAxisTitle("seed crystal timing", 1);
00375       meSCSeedTimeVsAmp_->setAxisTitle("energy (GeV)", 2);
00376 
00377       histo = "EECLTE SC relative timing EE -";
00378       meSCSeedTimeEEM_ = dqmStore_->book1D(histo,histo,78,0.,10.);
00379       meSCSeedTimeEEM_->setAxisTitle("seed crystal timing");
00380 
00381       histo = "EECLTE SC relative timing EE +";
00382       meSCSeedTimeEEP_ = dqmStore_->book1D(histo,histo,78,0.,10.);
00383       meSCSeedTimeEEP_->setAxisTitle("seed crystal timing");
00384 
00385       std::stringstream ss;
00386       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras/EECLTE timing per super module");
00387       for(int i=0;i!=18;++i) {
00388         ss.str("");
00389         if((i+1) <= 9){
00390           ss << "EECLTE SC timing EE - " << i+1;
00391           histo = ss.str();
00392         }
00393         else{
00394           ss << "EECLTE SC timing EE + " << i+1-9;
00395           histo = ss.str();
00396         }
00397          meSCSeedTimePerFed_[i] = dqmStore_->book1D(histo,histo,78,0.,10.);
00398          meSCSeedTimePerFed_[i]->setAxisTitle("seed crystal timing", 1);
00399       }
00400 
00401       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras");
00402 
00403 #endif
00404 
00405       histo = "EECLTE SC size (crystal) vs energy (GeV)";
00406      meSCSizCrystalVsEne_ = dqmStore_->bookProfile(histo,histo,200,0.,10.,150,0,150);
00407      meSCSizCrystalVsEne_->setAxisTitle("energy (GeV)", 1);
00408      meSCSizCrystalVsEne_->setAxisTitle("super cluster size (crystal)", 2);
00409 
00410       histo = "EECLTE SC seed occupancy map EE -";
00411       meSCSeedMapOcc_[0] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00412       meSCSeedMapOcc_[0]->setAxisTitle("jx", 1);
00413       meSCSeedMapOcc_[0]->setAxisTitle("jy", 2);
00414 
00415       histo = "EECLTE SC seed occupancy map EE - (high energy clusters) super crystal binned";
00416       meSCSeedMapOccHighEneSC_[0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00417       meSCSeedMapOccHighEneSC_[0]->setAxisTitle("jx", 1);
00418       meSCSeedMapOccHighEneSC_[0]->setAxisTitle("jy", 2);
00419 
00420       histo = "EECLTE SC seed occupancy map EE - (CSC triggered) super crystal binned";
00421       meSCSeedMapOccTrgSC_[0][0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00422       meSCSeedMapOccTrgSC_[0][0]->setAxisTitle("jx", 1);
00423       meSCSeedMapOccTrgSC_[0][0]->setAxisTitle("jy", 2);
00424 
00425       histo = "EECLTE SC seed occupancy map EE - (DT triggered) super crystal binned";
00426       meSCSeedMapOccTrgSC_[0][1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00427       meSCSeedMapOccTrgSC_[0][1]->setAxisTitle("jx", 1);
00428       meSCSeedMapOccTrgSC_[0][1]->setAxisTitle("jy", 2);
00429 
00430       histo = "EECLTE SC seed occupancy map EE - (ECAL triggered) super crystal binned";
00431       meSCSeedMapOccTrgSC_[0][2] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00432       meSCSeedMapOccTrgSC_[0][2]->setAxisTitle("jx", 1);
00433       meSCSeedMapOccTrgSC_[0][2]->setAxisTitle("jy", 2);
00434 
00435       histo = "EECLTE SC seed occupancy map EE - (HCAL triggered) super crystal binned";
00436       meSCSeedMapOccTrgSC_[0][3] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00437       meSCSeedMapOccTrgSC_[0][3]->setAxisTitle("jx", 1);
00438       meSCSeedMapOccTrgSC_[0][3]->setAxisTitle("jy", 2);
00439 
00440       histo = "EECLTE SC seed occupancy map EE - (RPC triggered) super crystal binned";
00441       meSCSeedMapOccTrgSC_[0][4] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00442       meSCSeedMapOccTrgSC_[0][4]->setAxisTitle("jx", 1);
00443       meSCSeedMapOccTrgSC_[0][4]->setAxisTitle("jy", 2);
00444 
00445       histo = "EECLTE SC seed occupancy map EE - (CSC exclusive triggered) super crystal binned";
00446       meSCSeedMapOccTrgExclSC_[0][0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00447       meSCSeedMapOccTrgExclSC_[0][0]->setAxisTitle("jx", 1);
00448       meSCSeedMapOccTrgExclSC_[0][0]->setAxisTitle("jy", 2);
00449 
00450       histo = "EECLTE SC seed occupancy map EE - (DT exclusive triggered) super crystal binned";
00451       meSCSeedMapOccTrgExclSC_[0][1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00452       meSCSeedMapOccTrgExclSC_[0][1]->setAxisTitle("jx", 1);
00453       meSCSeedMapOccTrgExclSC_[0][1]->setAxisTitle("jy", 2);
00454 
00455       histo = "EECLTE SC seed occupancy map EE - (ECAL exclusive triggered) super crystal binned";
00456       meSCSeedMapOccTrgExclSC_[0][2] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00457       meSCSeedMapOccTrgExclSC_[0][2]->setAxisTitle("jx", 1);
00458       meSCSeedMapOccTrgExclSC_[0][2]->setAxisTitle("jy", 2);
00459 
00460       histo = "EECLTE SC seed occupancy map EE - (HCAL exclusive triggered) super crystal binned";
00461       meSCSeedMapOccTrgExclSC_[0][3] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00462       meSCSeedMapOccTrgExclSC_[0][3]->setAxisTitle("jx", 1);
00463       meSCSeedMapOccTrgExclSC_[0][3]->setAxisTitle("jy", 2);
00464 
00465       histo = "EECLTE SC seed occupancy map EE - (RPC exclusive triggered) super crystal binned";
00466       meSCSeedMapOccTrgExclSC_[0][4] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00467       meSCSeedMapOccTrgExclSC_[0][4]->setAxisTitle("jx", 1);
00468       meSCSeedMapOccTrgExclSC_[0][4]->setAxisTitle("jy", 2);
00469 
00470       histo = "EECLTE SC seed occupancy map EE +";
00471       meSCSeedMapOcc_[1] = dqmStore_->book2D(histo,histo,100,0,100,100,0,100);
00472       meSCSeedMapOcc_[1]->setAxisTitle("jx", 1);
00473       meSCSeedMapOcc_[1]->setAxisTitle("jy", 2);
00474 
00475       histo = "EECLTE SC seed occupancy map EE + (high energy clusters) super crystal binned";
00476       meSCSeedMapOccHighEneSC_[1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00477       meSCSeedMapOccHighEneSC_[1]->setAxisTitle("jx", 1);
00478       meSCSeedMapOccHighEneSC_[1]->setAxisTitle("jy", 2);
00479 
00480       histo = "EECLTE SC seed occupancy map EE + (CSC triggered) super crystal binned";
00481       meSCSeedMapOccTrgSC_[1][0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00482       meSCSeedMapOccTrgSC_[1][0]->setAxisTitle("jx", 1);
00483       meSCSeedMapOccTrgSC_[1][0]->setAxisTitle("jy", 2);
00484 
00485       histo = "EECLTE SC seed occupancy map EE + (DT triggered) super crystal binned";
00486       meSCSeedMapOccTrgSC_[1][1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00487       meSCSeedMapOccTrgSC_[1][1]->setAxisTitle("jx", 1);
00488       meSCSeedMapOccTrgSC_[1][1]->setAxisTitle("jy", 2);
00489 
00490       histo = "EECLTE SC seed occupancy map EE + (ECAL triggered) super crystal binned";
00491       meSCSeedMapOccTrgSC_[1][2] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00492       meSCSeedMapOccTrgSC_[1][2]->setAxisTitle("jx", 1);
00493       meSCSeedMapOccTrgSC_[1][2]->setAxisTitle("jy", 2);
00494 
00495       histo = "EECLTE SC seed occupancy map EE + (HCAL triggered) super crystal binned";
00496       meSCSeedMapOccTrgSC_[1][3] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00497       meSCSeedMapOccTrgSC_[1][3]->setAxisTitle("jx", 1);
00498       meSCSeedMapOccTrgSC_[1][3]->setAxisTitle("jy", 2);
00499 
00500       histo = "EECLTE SC seed occupancy map EE + (RPC triggered) super crystal binned";
00501       meSCSeedMapOccTrgSC_[1][4] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00502       meSCSeedMapOccTrgSC_[1][4]->setAxisTitle("jx", 1);
00503       meSCSeedMapOccTrgSC_[1][4]->setAxisTitle("jy", 2);
00504 
00505       histo = "EECLTE SC seed occupancy map EE + (CSC exclusive triggered) super crystal binned";
00506       meSCSeedMapOccTrgExclSC_[1][0] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00507       meSCSeedMapOccTrgExclSC_[1][0]->setAxisTitle("jx", 1);
00508       meSCSeedMapOccTrgExclSC_[1][0]->setAxisTitle("jy", 2);
00509 
00510       histo = "EECLTE SC seed occupancy map EE + (DT exclusive triggered) super crystal binned";
00511       meSCSeedMapOccTrgExclSC_[1][1] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00512       meSCSeedMapOccTrgExclSC_[1][1]->setAxisTitle("jx", 1);
00513       meSCSeedMapOccTrgExclSC_[1][1]->setAxisTitle("jy", 2);
00514 
00515       histo = "EECLTE SC seed occupancy map EE + (ECAL exclusive triggered) super crystal binned";
00516       meSCSeedMapOccTrgExclSC_[1][2] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00517       meSCSeedMapOccTrgExclSC_[1][2]->setAxisTitle("jx", 1);
00518       meSCSeedMapOccTrgExclSC_[1][2]->setAxisTitle("jy", 2);
00519 
00520       histo = "EECLTE SC seed occupancy map EE + (HCAL exclusive triggered) super crystal binned";
00521       meSCSeedMapOccTrgExclSC_[1][3] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00522       meSCSeedMapOccTrgExclSC_[1][3]->setAxisTitle("jx", 1);
00523       meSCSeedMapOccTrgExclSC_[1][3]->setAxisTitle("jy", 2);
00524 
00525       histo = "EECLTE SC seed occupancy map EE + (RPC exclusive triggered) super crystal binned";
00526       meSCSeedMapOccTrgExclSC_[1][4] = dqmStore_->book2D(histo,histo,20,0,100,20,0,100);
00527       meSCSeedMapOccTrgExclSC_[1][4]->setAxisTitle("jx", 1);
00528       meSCSeedMapOccTrgExclSC_[1][4]->setAxisTitle("jy", 2);
00529 
00530       histo = "EECLTE SC seed crystal timing map EE - (CSC exclusive triggered) super crystal binned";
00531       meSCSeedMapTimeTrgSC_[0][0] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00532       meSCSeedMapTimeTrgSC_[0][0]->setAxisTitle("jx", 1);
00533       meSCSeedMapTimeTrgSC_[0][0]->setAxisTitle("jy", 2);
00534 
00535       histo = "EECLTE SC seed crystal timing map EE - (DT exclusive triggered) super crystal binned";
00536       meSCSeedMapTimeTrgSC_[0][1] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00537       meSCSeedMapTimeTrgSC_[0][1]->setAxisTitle("jx", 1);
00538       meSCSeedMapTimeTrgSC_[0][1]->setAxisTitle("jy", 2);
00539 
00540       histo = "EECLTE SC seed crystal timing map EE - (ECAL exclusive triggered) super crystal binned";
00541       meSCSeedMapTimeTrgSC_[0][2] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00542       meSCSeedMapTimeTrgSC_[0][2]->setAxisTitle("jx", 1);
00543       meSCSeedMapTimeTrgSC_[0][2]->setAxisTitle("jy", 2);
00544 
00545       histo = "EECLTE SC seed crystal timing map EE - (HCAL exclusive triggered) super crystal binned";
00546       meSCSeedMapTimeTrgSC_[0][3] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00547       meSCSeedMapTimeTrgSC_[0][3]->setAxisTitle("jx", 1);
00548       meSCSeedMapTimeTrgSC_[0][3]->setAxisTitle("jy", 2);
00549 
00550       histo = "EECLTE SC seed crystal timing map EE - (RPC exclusive triggered) super crystal binned";
00551       meSCSeedMapTimeTrgSC_[0][4] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00552       meSCSeedMapTimeTrgSC_[0][4]->setAxisTitle("jx", 1);
00553       meSCSeedMapTimeTrgSC_[0][4]->setAxisTitle("jy", 2);
00554 
00555       histo = "EECLTE SC seed crystal timing map EE + (CSC exclusive triggered) super crystal binned";
00556       meSCSeedMapTimeTrgSC_[1][0] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00557       meSCSeedMapTimeTrgSC_[1][0]->setAxisTitle("jx", 1);
00558       meSCSeedMapTimeTrgSC_[1][0]->setAxisTitle("jy", 2);
00559 
00560       histo = "EECLTE SC seed crystal timing map EE + (DT exclusive triggered) super crystal binned";
00561       meSCSeedMapTimeTrgSC_[1][1] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00562       meSCSeedMapTimeTrgSC_[1][1]->setAxisTitle("jx", 1);
00563       meSCSeedMapTimeTrgSC_[1][1]->setAxisTitle("jy", 2);
00564 
00565       histo = "EECLTE SC seed crystal timing map EE + (ECAL exclusive triggered) super crystal binned";
00566       meSCSeedMapTimeTrgSC_[1][2] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00567       meSCSeedMapTimeTrgSC_[1][2]->setAxisTitle("jx", 1);
00568       meSCSeedMapTimeTrgSC_[1][2]->setAxisTitle("jy", 2);
00569 
00570       histo = "EECLTE SC seed crystal timing map EE + (HCAL exclusive triggered) super crystal binned";
00571       meSCSeedMapTimeTrgSC_[1][3] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00572       meSCSeedMapTimeTrgSC_[1][3]->setAxisTitle("jx", 1);
00573       meSCSeedMapTimeTrgSC_[1][3]->setAxisTitle("jy", 2);
00574 
00575       histo = "EECLTE SC seed crystal timing map EE + (RPC exclusive triggered) super crystal binned";
00576       meSCSeedMapTimeTrgSC_[1][4] = dqmStore_->bookProfile2D(histo,histo,20,0,100,20,0,100,78,0.,10.,"s");
00577       meSCSeedMapTimeTrgSC_[1][4]->setAxisTitle("jx", 1);
00578       meSCSeedMapTimeTrgSC_[1][4]->setAxisTitle("jy", 2);
00579    }
00580 }
00581 
00582 void EEClusterTaskExtras::cleanup(void){
00583 
00584    if ( ! init_ ) return;
00585 
00586    if ( dqmStore_ ) {
00587       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras");
00588 
00589 #ifndef EECLUSTERTASKEXTRAS_DQMOFFLINE
00590       if ( meSCSizCrystal_ ) dqmStore_->removeElement( meSCSizCrystal_->getName() );
00591       meSCSizCrystal_ = 0;
00592       if ( meSCSizBC_ ) dqmStore_->removeElement( meSCSizBC_->getName() );
00593       meSCSizBC_ = 0;
00594 
00595       if ( meSCSeedEne_ ) dqmStore_->removeElement( meSCSeedEne_->getName() );
00596       meSCSeedEne_ = 0;
00597       if ( meSCEne2_ ) dqmStore_->removeElement( meSCEne2_->getName() );
00598       meSCEne2_= 0;
00599       if ( meSCEneLow_ ) dqmStore_->removeElement( meSCEneLow_->getName() );
00600       meSCEneLow_ = 0;
00601       if ( meSCEneHigh_ ) dqmStore_->removeElement( meSCEneHigh_->getName() );
00602       meSCEneHigh_ = 0;
00603       if ( meSCEneSingleCrystal_ ) dqmStore_->removeElement( meSCEneSingleCrystal_->getName() );
00604       meSCEneSingleCrystal_ = 0;
00605 
00606       for(int i=0;i!=2;++i) {
00607          if ( meSCSeedMapOccSC_[i] ) dqmStore_->removeElement( meSCSeedMapOccSC_[i]->getName() );
00608          meSCSeedMapOccSC_[i] = 0;
00609          if ( meSCSeedMapOccHighEne_[i] ) dqmStore_->removeElement( meSCSeedMapOccHighEne_[i]->getName() );
00610          meSCSeedMapOccHighEne_[i] = 0;
00611          if ( meSCSeedMapOccSingleCrystal_[i] ) dqmStore_->removeElement( meSCSeedMapOccSingleCrystal_[i]->getName() );
00612          meSCSeedMapOccSingleCrystal_[i] = 0;
00613          if ( meSCSeedMapTimeSC_[i] ) dqmStore_->removeElement( meSCSeedMapTimeSC_[i]->getName() );
00614          meSCSeedMapTimeSC_[i] = 0;
00615          for(int j=0;j!=5;++j) {
00616             if ( meSCSeedMapOccTrg_[i][j] ) dqmStore_->removeElement( meSCSeedMapOccTrg_[i][j]->getName() );
00617             meSCSeedMapOccTrg_[i][j] = 0;
00618             if ( meSCSeedMapOccTrgExcl_[i][j] ) dqmStore_->removeElement( meSCSeedMapOccTrgExcl_[i][j]->getName() );
00619             meSCSeedMapOccTrgExcl_[i][j] = 0;
00620          }
00621       }
00622 
00623       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras/EECLTE timing per super module");
00624       for(int i=0; i!=18; ++i) {
00625          if( meSCSeedTimePerFed_[i] ) dqmStore_->removeElement( meSCSeedTimePerFed_[i]->getName() );
00626          meSCSeedTimePerFed_[i] = 0;
00627       }
00628       dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTaskExtras");
00629 
00630       if ( meSCSeedTime_ ) dqmStore_->removeElement( meSCSeedTime_->getName() );
00631       meSCSeedTime_ = 0;
00632       if ( meSCSeedTimeVsAmp_ ) dqmStore_->removeElement( meSCSeedTimeVsAmp_->getName() );
00633       meSCSeedTimeVsAmp_ = 0;
00634       if ( meSCSeedTimeEEM_ ) dqmStore_->removeElement( meSCSeedTimeEEM_->getName() );
00635       meSCSeedTimeEEM_ = 0;
00636       if ( meSCSeedTimeEEP_ ) dqmStore_->removeElement( meSCSeedTimeEEP_->getName() );
00637       meSCSeedTimeEEP_ = 0;
00638 
00639 #endif
00640 
00641       if (meSCSizCrystalVsEne_ ) dqmStore_->removeElement(meSCSizCrystalVsEne_->getName() );
00642      meSCSizCrystalVsEne_ = 0;
00643 
00644       for(int i=0;i!=2;++i) {
00645          if ( meSCSeedMapOcc_[i] ) dqmStore_->removeElement( meSCSeedMapOcc_[i]->getName() );
00646          meSCSeedMapOcc_[i] = 0;
00647          if ( meSCSeedMapOccHighEneSC_[i] ) dqmStore_->removeElement( meSCSeedMapOccHighEneSC_[i]->getName() );
00648          meSCSeedMapOccHighEneSC_[i] = 0;
00649 
00650          for(int j=0; j!=5; ++j) {
00651             if ( meSCSeedMapOccTrgSC_[i][j] ) dqmStore_->removeElement( meSCSeedMapOccTrgSC_[i][j]->getName() );
00652             meSCSeedMapOccTrgSC_[i][j] = 0;
00653             if ( meSCSeedMapOccTrgExclSC_[i][j] ) dqmStore_->removeElement( meSCSeedMapOccTrgExclSC_[i][j]->getName() );
00654             meSCSeedMapOccTrgExclSC_[i][j] = 0;
00655 
00656             if ( meSCSeedMapTimeTrgSC_[i][j] ) dqmStore_->removeElement( meSCSeedMapTimeTrgSC_[i][j]->getName() );
00657             meSCSeedMapTimeTrgSC_[i][j] = 0;
00658          }
00659       }
00660 
00661    }
00662 
00663    init_ = false;
00664 
00665 }
00666 
00667 void EEClusterTaskExtras::endJob(void){
00668 
00669    LogInfo("EEClusterTaskExtras") << "analyzed " << ievt_ << " events";
00670 
00671    if ( enableCleanup_ ) this->cleanup();
00672 
00673 }
00674 
00675 void EEClusterTaskExtras::analyze(const Event& e, const EventSetup& c) {
00676 
00677    using namespace std;
00678 
00679    if ( ! init_ ) this->setup();
00680 
00681    ievt_++;
00682 
00683    // --- Barrel Super Clusters ---
00684 
00685    Handle<SuperClusterCollection> pSuperClusters;
00686 
00687    if ( e.getByLabel(SuperClusterCollection_, pSuperClusters) ) {
00688 
00689       //int nscc = pSuperClusters->size();
00690 
00691       //TLorentzVector sc1_p(0,0,0,0);
00692       //TLorentzVector sc2_p(0,0,0,0);
00693 
00694       for ( SuperClusterCollection::const_iterator sCluster = pSuperClusters->begin(); sCluster != pSuperClusters->end(); ++sCluster ) {
00695 
00696          // seed and shapes
00697          edm::Handle< EcalRecHitCollection > pEERecHits;
00698          e.getByLabel( EcalRecHitCollection_, pEERecHits );
00699          if ( pEERecHits.isValid() ) {
00700             const EcalRecHitCollection *eeRecHits = pEERecHits.product();
00701 
00702             // Find the seed rec hit
00703             // <= CMSSW_3_0_X
00704             //std::vector<DetId> sIds = sCluster->getHitsByDetId();
00705             // >= CMSSW_3_1_X
00706             std::vector< std::pair<DetId,float> > sIds = sCluster->hitsAndFractions();
00707 
00708             EcalRecHitCollection::const_iterator seedItr = eeRecHits->begin();
00709             EcalRecHitCollection::const_iterator secondItr = eeRecHits->begin();
00710 
00711             // <= CMSSW_3_0_X
00712             //for(std::vector<DetId>::const_iterator idItr = sIds.begin(); idItr != sIds.end(); ++idItr) {
00713                //if(idItr->det() != DetId::Ecal) { continue; }
00714                //EcalRecHitCollection::const_iterator hitItr = eeRecHits->find((*idItr));
00715             // >= CMSSW_3_1_X
00716             for(std::vector< std::pair<DetId,float> >::const_iterator idItr = sIds.begin(); idItr != sIds.end(); ++idItr) {
00717                DetId id = idItr->first;
00718                if(id.det() != DetId::Ecal) { continue; }
00719                EcalRecHitCollection::const_iterator hitItr = eeRecHits->find(id);
00720                if(hitItr == eeRecHits->end()) { continue; }
00721                if(hitItr->energy() > secondItr->energy()) { secondItr = hitItr; }
00722                if(hitItr->energy() > seedItr->energy()) { std::swap(seedItr,secondItr); }
00723             }
00724 
00725             EEDetId seedId = (EEDetId) seedItr->id();
00726 
00727             // Prepare to fill maps
00728             int ism = Numbers::iSM(seedId);
00729             int eey = seedId.iy();
00730             int eex = seedId.ix();
00731             float xeey = eey - 0.5;
00732             float xeex = eex - 0.5;
00733 
00734             int side = (ism >=1 && ism <= 9) ? 0 : 1;
00735 
00736             edm::ESHandle<EcalADCToGeVConstant> pAgc;
00737             c.get<EcalADCToGeVConstantRcd>().get(pAgc);
00738 
00739             vector<bool> triggers = determineTriggers(e,c);
00740 
00741 #ifndef EECLUSTERTASKEXTRAS_DQMOFFLINE
00742             float eMax, e2nd;
00743             eMax = seedItr->energy();
00744             e2nd = secondItr->energy();
00745             // energy, size
00746             if(meSCEneLow_) meSCEneLow_->Fill( sCluster->energy() );
00747             if(meSCEneHigh_) meSCEneHigh_->Fill( sCluster->energy() );
00748             if(meSCSizBC_) meSCSizBC_->Fill( float(sCluster->clustersSize()) );
00749 
00750             if(meSCSizCrystal_) meSCSizCrystal_->Fill(sIds.size());
00751             if(meSCSeedEne_) meSCSeedEne_->Fill(eMax);
00752             if(meSCEne2_) meSCEne2_->Fill(eMax+e2nd);
00753             //if(meSCEneVsEMax_) meSCEneVsEMax_->Fill(eMax,sCluster->energy());
00754 
00755             if(meSCSeedMapOccSC_[side]) meSCSeedMapOccSC_[side]->Fill(xeex, xeey);
00756 
00757             if(sCluster->energy() > 2) {
00758                if(meSCSeedMapOccHighEne_[side]) meSCSeedMapOccHighEne_[side]->Fill(xeex, xeey);
00759                if(meSCSeedMapOccHighEneSC_[side]) meSCSeedMapOccHighEneSC_[side]->Fill(xeex, xeey);
00760             }
00761             if(sIds.size() == 1) {
00762                if(meSCEneSingleCrystal_) meSCEneSingleCrystal_->Fill(sCluster->energy());
00763                if(meSCSeedMapOccSingleCrystal_[side]) meSCSeedMapOccSingleCrystal_[side]->Fill(xeex, xeey);
00764             }
00765 
00766             if(meSCSeedMapOcc_[side]) meSCSeedMapOcc_[side]->Fill(xeex, xeey);
00767 
00768             if(pAgc.isValid()) {
00769                const EcalADCToGeVConstant* agc = pAgc.product();
00770                if(seedItr->energy() / agc->getEBValue() > 12) {
00771                   if(meSCSeedTime_) meSCSeedTime_->Fill(seedItr->time());
00772                   if(meSCSeedTimeVsAmp_) meSCSeedTimeVsAmp_->Fill(seedItr->time(),sCluster->energy());
00773                   if(!side)
00774                      if(meSCSeedTimeEEM_) meSCSeedTimeEEM_->Fill(seedItr->time());
00775                   if(side)
00776                      if(meSCSeedTimeEEP_) meSCSeedTimeEEP_->Fill(seedItr->time());
00777                   if(meSCSeedTimePerFed_[ism-1]) meSCSeedTimePerFed_[ism-1]->Fill(seedItr->time());
00778                   if(meSCSeedMapTimeSC_[side]) meSCSeedMapTimeSC_[side]->Fill(xeex,xeey,seedItr->time());
00779 
00780                }
00781             }
00782             else {
00783                LogWarning("EBClusterTaskExtras") << "EcalADCToGeVConstant not valid";
00784             }
00785             for(int i=0;i!=5;++i) {
00786                if(triggers[i]) {
00787                   if(meSCSeedMapOccTrg_[side][i]) meSCSeedMapOccTrg_[side][i]->Fill(xeex, xeey);
00788                   bool isExclusive = true;
00789                   for(int j=0;j!=5;++j) {
00790                      if(j != i && triggers[j])
00791                         isExclusive = false;
00792                   }
00793                   if(isExclusive) 
00794                      if(meSCSeedMapOccTrgExcl_[side][i]) meSCSeedMapOccTrgExcl_[side][i]->Fill(xeex, xeey);
00795                }
00796             }
00797 #endif
00798 
00799             if(meSCSizCrystalVsEne_) meSCSizCrystalVsEne_->Fill(sCluster->energy(),sIds.size());
00800 
00801             for(int i=0;i!=5;++i) {
00802                if(triggers[i]) {
00803                   if(meSCSeedMapOccTrgSC_[side][i]) meSCSeedMapOccTrgSC_[side][i]->Fill(xeex, xeey);
00804 
00805                   if(pAgc.isValid()) {
00806                      const EcalADCToGeVConstant* agc = pAgc.product();
00807                      if(seedItr->energy() / agc->getEBValue() > 12) {
00808                         if(meSCSeedMapTimeTrgSC_[side][i]) meSCSeedMapTimeTrgSC_[side][i]->Fill(xeex, xeey, seedItr->time());
00809                      }
00810                   }
00811                   else {
00812                      LogWarning("EBClusterTaskExtras") << "EcalADCToGeVConstant not valid";
00813                   }
00814 
00815                   bool isExclusive = true;
00816                   for(int j=0;j!=5;++j) {
00817                      if(j != i && triggers[j])
00818                         isExclusive = false;
00819                   }
00820                   if(isExclusive) 
00821                      if(meSCSeedMapOccTrgExclSC_[side][i]) meSCSeedMapOccTrgExclSC_[side][i]->Fill(xeex, xeey);
00822                }
00823             }
00824          }
00825          else {
00826             LogWarning("EEClusterTaskExtras") << pEERecHits << " not available";
00827          }
00828       }
00829 
00830    } else {
00831 
00832       LogWarning("EEClusterTaskExtras") << SuperClusterCollection_ << " not available";
00833 
00834    }
00835 
00836 }
00837 
00838 std::vector<bool> 
00839 EEClusterTaskExtras::determineTriggers(const edm::Event& iEvent, const edm::EventSetup& eventSetup) {
00840 
00841    using namespace edm;
00842    std::vector<bool> l1Triggers; //DT,CSC,RPC,HCAL,ECAL
00843    //0 , 1 , 2 , 3  , 4
00844    for(int i=0;i<5;i++)
00845       l1Triggers.push_back(false);
00846 
00847    // get the GMTReadoutCollection
00848    edm::Handle<L1MuGMTReadoutCollection> gmtrc_handle;
00849    iEvent.getByLabel(l1GMTReadoutRecTag_,gmtrc_handle);
00850    L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
00851    if (!(gmtrc_handle.isValid()))  
00852    {
00853       LogWarning("EcalCosmicsHists") << "l1MuGMTReadoutCollection" << " not available";
00854       return l1Triggers;
00855    }  
00856    // get hold of L1GlobalReadoutRecord
00857    edm::Handle<L1GlobalTriggerReadoutRecord> L1GTRR;
00858    iEvent.getByLabel(l1GTReadoutRecTag_,L1GTRR);
00859 
00860    //Ecal
00861    edm::ESHandle<L1GtTriggerMenu> menuRcd;
00862    eventSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
00863    const L1GtTriggerMenu* menu = menuRcd.product();
00864    edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord;
00865    iEvent.getByLabel( edm::InputTag("gtDigis"), gtRecord);
00866    // Get dWord after masking disabled bits
00867    const DecisionWord dWord = gtRecord->decisionWord();
00868 
00869    bool l1SingleEG2 = menu->gtAlgorithmResult("L1_SingleEG2", dWord);
00870    bool l1SingleEG5 = menu->gtAlgorithmResult("L1_SingleEG5", dWord);
00871    bool l1SingleEG8 = menu->gtAlgorithmResult("L1_SingleEG8", dWord);
00872    bool l1SingleEG10 = menu->gtAlgorithmResult("L1_SingleEG10", dWord);
00873    bool l1SingleEG12 = menu->gtAlgorithmResult("L1_SingleEG12", dWord);
00874    bool l1SingleEG15 = menu->gtAlgorithmResult("L1_SingleEG15", dWord);
00875    bool l1SingleEG20 = menu->gtAlgorithmResult("L1_SingleEG20", dWord);
00876    bool l1SingleEG25 = menu->gtAlgorithmResult("L1_SingleEG25", dWord);
00877    bool l1DoubleNoIsoEGBTBtight = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord);
00878    bool l1DoubleNoIsoEGBTBloose = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord);
00879    bool l1DoubleNoIsoEGTopBottom = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord);
00880    bool l1DoubleNoIsoEGTopBottomCen  = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord);
00881    bool l1DoubleNoIsoEGTopBottomCen2  = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord);
00882    bool l1DoubleNoIsoEGTopBottomCenVert  = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord);
00883 
00884    l1Triggers[ECAL_TRIGGER] = l1SingleEG2 || l1SingleEG5 || l1SingleEG8 || l1SingleEG10 || l1SingleEG12 || l1SingleEG15
00885       || l1SingleEG20 || l1SingleEG25 || l1DoubleNoIsoEGBTBtight || l1DoubleNoIsoEGBTBloose
00886       || l1DoubleNoIsoEGTopBottom || l1DoubleNoIsoEGTopBottomCen || l1DoubleNoIsoEGTopBottomCen2
00887       || l1DoubleNoIsoEGTopBottomCenVert;
00888 
00889    std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00890    std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
00891    for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
00892       std::vector<L1MuRegionalCand>::const_iterator iter1;
00893       std::vector<L1MuRegionalCand> rmc;
00894 
00895       //DT triggers
00896       int idt = 0;
00897       rmc = igmtrr->getDTBXCands();
00898       for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00899          if ( !(*iter1).empty() ) {
00900             idt++;
00901          }
00902       }
00903       //if(idt>0) std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = " 
00904       //  << igmtrr->getBxInEvent() << std::endl;
00905       if(igmtrr->getBxInEvent()==0 && idt>0) l1Triggers[DT_TRIGGER] = true;
00906 
00907       //RPC triggers
00908       int irpcb = 0;
00909       rmc = igmtrr->getBrlRPCCands();
00910       for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00911          if ( !(*iter1).empty() ) {
00912             irpcb++;
00913          }
00914       }
00915       //if(irpcb>0) std::cout << "Found " << irpcb << " valid RPC candidates in bx wrt. L1A = " 
00916       //  << igmtrr->getBxInEvent() << std::endl;
00917       if(igmtrr->getBxInEvent()==0 && irpcb>0) l1Triggers[RPC_TRIGGER] = true;
00918 
00919       //CSC Triggers
00920       int icsc = 0;
00921       rmc = igmtrr->getCSCCands();
00922       for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00923          if ( !(*iter1).empty() ) {
00924             icsc++;
00925          }
00926       }
00927       //if(icsc>0) std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = " 
00928       //  << igmtrr->getBxInEvent() << std::endl;
00929       if(igmtrr->getBxInEvent()==0 && icsc>0) l1Triggers[CSC_TRIGGER] = true;
00930    }
00931 
00932    L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
00933 
00934    for(int ibx=-1; ibx<=1; ibx++) {
00935       bool hcal_top = false;
00936       bool hcal_bot = false;
00937       const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d,ibx);
00938       std::vector<int> valid_x; 
00939       if((psb.aData(4)&0x3f) >= 1) {valid_x.push_back( (psb.aData(4)>>10)&0x1f ); }
00940       if((psb.bData(4)&0x3f) >= 1) {valid_x.push_back( (psb.bData(4)>>10)&0x1f ); }
00941       if((psb.aData(5)&0x3f) >= 1) {valid_x.push_back( (psb.aData(5)>>10)&0x1f ); }
00942       if((psb.bData(5)&0x3f) >= 1) {valid_x.push_back( (psb.bData(5)>>10)&0x1f ); }
00943       std::vector<int>::const_iterator ix;
00944       for(ix=valid_x.begin(); ix!=valid_x.end(); ix++) {
00945          //std::cout << "Found HCAL mip with x=" << *ix << " in bx wrt. L1A = " << ibx << std::endl;
00946          if(*ix<9) hcal_top=true;
00947          if(*ix>8) hcal_bot=true;
00948       }
00949       if(ibx==0 && hcal_top && hcal_bot) l1Triggers[HCAL_TRIGGER]=true;
00950    }     
00951    return l1Triggers;
00952 }