CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DQMOffline/Ecal/src/EBClusterTaskExtras.cc

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