CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/L1TMonitorClient/src/L1TEventInfoClient.cc

Go to the documentation of this file.
00001 #include "DQM/L1TMonitorClient/interface/L1TEventInfoClient.h"
00002 
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/EventSetup.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "DQMServices/Core/interface/QReport.h"
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "DQMServices/Core/interface/MonitorElement.h"
00011 #include "TRandom.h"
00012 #include <TF1.h>
00013 #include <stdio.h>
00014 #include <sstream>
00015 #include <math.h>
00016 #include <TProfile.h>
00017 #include <TProfile2D.h>
00018 #include <memory>
00019 #include <iostream>
00020 #include <iomanip>
00021 #include <map>
00022 #include <vector>
00023 #include <string>
00024 #include <fstream>
00025 #include "TROOT.h"
00026 
00027 using namespace edm;
00028 using namespace std;
00029 
00030 L1TEventInfoClient::L1TEventInfoClient(const edm::ParameterSet& ps)
00031 {
00032   parameters_=ps;
00033   initialize();
00034 }
00035 
00036 L1TEventInfoClient::~L1TEventInfoClient(){
00037  if(verbose_) cout <<"[TriggerDQM]: ending... " << endl;
00038 }
00039 
00040 //--------------------------------------------------------
00041 void L1TEventInfoClient::initialize(){ 
00042 
00043   counterLS_=0; 
00044   counterEvt_=0; 
00045   
00046   // get back-end interface
00047   dbe_ = Service<DQMStore>().operator->();
00048   
00049   // base folder for the contents of this job
00050   verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
00051   
00052   monitorDir_ = parameters_.getUntrackedParameter<string>("monitorDir","");
00053   if(verbose_) cout << "Monitor dir = " << monitorDir_ << endl;
00054     
00055   prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
00056   if(verbose_) cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
00057   
00058   prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
00059   if(verbose_) cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
00060     
00061   thresholdLS_ = parameters_.getUntrackedParameter<int>("thresholdLS", 1);
00062   if(verbose_) cout << "Minimum LS required to perform QTests = " << thresholdLS_ << " lumi section(s)"<< endl;
00063 
00064   GCT_NonIsoEm_threshold_ = parameters_.getUntrackedParameter<double>("GCT_NonIsoEm_threshold",100000);
00065   GCT_IsoEm_threshold_ = parameters_.getUntrackedParameter<double>("GCT_IsoEm_threshold",1000000);
00066   GCT_TauJets_threshold_ = parameters_.getUntrackedParameter<double>("GCT_TauJets_threshold",100000);
00067   GCT_AllJets_threshold_ = parameters_.getUntrackedParameter<double>("GCT_AllJets_threshold",100000);
00068   GMT_Muons_threshold_ = parameters_.getUntrackedParameter<double>("GMT_Muons_threshold",100000);
00069 
00070   if(verbose_){
00071     cout << " Thresholds are as follows:" << endl;
00072     cout << " \t GCT_NonIsoEm_threshold_: " << GCT_NonIsoEm_threshold_ << endl;
00073     cout << " \t GCT_IsoEm_threshold_:    " << GCT_IsoEm_threshold_ << endl;
00074     cout << " \t GCT_TauJets_threshold_:  " << GCT_TauJets_threshold_ << endl;
00075     cout << " \t GCT_AllJets_threshold_:  " << GCT_AllJets_threshold_ << endl;
00076     cout << " \t GMT_Muons_threshold_:    " << GMT_Muons_threshold_ << endl;
00077   }
00078 
00079   std::vector<string> emptyMask;
00080 
00081   dataMask = parameters_.getUntrackedParameter<std::vector<string> >("dataMaskedSystems", emptyMask);
00082   emulMask = parameters_.getUntrackedParameter<std::vector<string> >("emulatorMaskedSystems", emptyMask);
00083 
00084   s_mapDataValues["EMPTY"]    = data_empty;
00085   s_mapDataValues["ALL"]      = data_all;
00086   s_mapDataValues["GT"]       = data_gt;
00087   s_mapDataValues["MUONS"]    = data_muons;
00088   s_mapDataValues["JETS"]     = data_jets;
00089   s_mapDataValues["TAUJETS"]  = data_taujets;
00090   s_mapDataValues["ISOEM"]    = data_isoem;
00091   s_mapDataValues["NONISOEM"] = data_nonisoem;
00092   s_mapDataValues["MET"]      = data_met;
00093 
00094   s_mapEmulValues["EMPTY"]  = emul_empty;
00095   s_mapEmulValues["ALL"]    = emul_all;
00096   s_mapEmulValues["DTTF"]   = emul_dtf;
00097   s_mapEmulValues["DTTPG"]  = emul_dtp;
00098   s_mapEmulValues["CSCTF"]  = emul_ctf;
00099   s_mapEmulValues["CSCTPG"] = emul_ctp;
00100   s_mapEmulValues["RPC"]    = emul_rpc;
00101   s_mapEmulValues["GMT"]    = emul_gmt;
00102   s_mapEmulValues["ECAL"]   = emul_etp;
00103   s_mapEmulValues["HCAL"]   = emul_htp;
00104   s_mapEmulValues["RCT"]    = emul_rct;
00105   s_mapEmulValues["GCT"]    = emul_gct;
00106   s_mapEmulValues["GLT"]    = emul_glt;
00107 
00108 }
00109 
00110 //--------------------------------------------------------
00111 void L1TEventInfoClient::beginJob(void){
00112 
00113   if(verbose_) cout <<"[TriggerDQM]: Begin Job" << endl;
00114   // get backendinterface  
00115   dbe_ = Service<DQMStore>().operator->();
00116 
00117   dbe_->setCurrentFolder("L1T/EventInfo");
00118 
00119   if( (reportSummary_ = dbe_->get("L1T/EventInfo/reportSumamry")) ) {
00120       dbe_->removeElement(reportSummary_->getName()); 
00121    }
00122   
00123   reportSummary_ = dbe_->bookFloat("reportSummary");
00124 
00125   //initialize reportSummary to 1
00126   if (reportSummary_) reportSummary_->Fill(1);
00127 
00128   dbe_->setCurrentFolder("L1T/EventInfo/reportSummaryContents");
00129 
00130   
00131   char histo[100];
00132   
00133   for (int n = 0; n < nsys_; n++) {    
00134 
00135     switch(n){
00136     case 0 :   sprintf(histo,"L1T_MET");      break;
00137     case 1 :   sprintf(histo,"L1T_NonIsoEM"); break;
00138     case 2 :   sprintf(histo,"L1T_IsoEM");    break;
00139     case 3 :   sprintf(histo,"L1T_TauJets");  break;
00140     case 4 :   sprintf(histo,"L1T_Jets");     break;
00141     case 5 :   sprintf(histo,"L1T_Muons");    break;
00142     case 6 :   sprintf(histo,"L1T_GT");       break;
00143     case 7 :   sprintf(histo,"L1TEMU_GLT");   break;
00144     case 8 :   sprintf(histo,"L1TEMU_GMT");   break;
00145     case 9 :   sprintf(histo,"L1TEMU_RPC");   break;
00146     case 10:   sprintf(histo,"L1TEMU_CTP");   break;
00147     case 11:   sprintf(histo,"L1TEMU_CTF");   break;
00148     case 12:   sprintf(histo,"L1TEMU_DTP");   break;
00149     case 13:   sprintf(histo,"L1TEMU_DTF");   break;
00150     case 14:   sprintf(histo,"L1TEMU_HTP");   break;
00151     case 15:   sprintf(histo,"L1TEMU_ETP");   break;
00152     case 16:   sprintf(histo,"L1TEMU_GCT");   break;
00153     case 17:   sprintf(histo,"L1TEMU_RCT");   break;
00154     }  
00155     
00156     reportSummaryContent_[n] = dbe_->bookFloat(histo);
00157   }
00158 
00159   //initialize reportSummaryContents to 0
00160   for (int k = 0; k < nsys_; k++) {
00161     summaryContent[k] = 0;
00162     reportSummaryContent_[k]->Fill(0.);
00163   }  
00164 
00165 
00166   dbe_->setCurrentFolder("L1T/EventInfo");
00167 
00168   if( (reportSummaryMap_ = dbe_->get("L1T/EventInfo/reportSummaryMap")) ){
00169     dbe_->removeElement(reportSummaryMap_->getName());
00170   }
00171 
00172   reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 2, 1, 3, 11, 1, 12);
00173   reportSummaryMap_->setAxisTitle("", 1);
00174   reportSummaryMap_->setAxisTitle("", 2);
00175 
00176   reportSummaryMap_->setBinLabel(1," ",1);
00177   reportSummaryMap_->setBinLabel(2," ",1);
00178 
00179   reportSummaryMap_->setBinLabel(1," ",2);
00180   reportSummaryMap_->setBinLabel(2," ",2);
00181   reportSummaryMap_->setBinLabel(3," ",2);
00182   reportSummaryMap_->setBinLabel(4," ",2);
00183   reportSummaryMap_->setBinLabel(5," ",2);
00184   reportSummaryMap_->setBinLabel(6," ",2);
00185   reportSummaryMap_->setBinLabel(7," ",2);
00186   reportSummaryMap_->setBinLabel(8," ",2);
00187   reportSummaryMap_->setBinLabel(9," ",2);
00188   reportSummaryMap_->setBinLabel(10," ",2);
00189   reportSummaryMap_->setBinLabel(11," ",2);
00190 
00191 }
00192 
00193 //--------------------------------------------------------
00194 void L1TEventInfoClient::beginRun(const Run& r, const EventSetup& context) {
00195 }
00196 
00197 //--------------------------------------------------------
00198 void L1TEventInfoClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
00199    // optionally reset histograms here
00200 }
00201 
00202 void L1TEventInfoClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00203                           const edm::EventSetup& c){   
00204 
00205 
00206   counterLS_++;
00207 
00208   MonitorElement *GMT_QHist = dbe_->get("L1T/L1TGMT/GMT_etaphi");
00209   MonitorElement *GCT_IsoEm_QHist = dbe_->get("L1T/L1TGCT/IsoEmRankEtaPhi");
00210   MonitorElement *GCT_NonIsoEm_QHist = dbe_->get("L1T/L1TGCT/NonIsoEmRankEtaPhi");
00211   MonitorElement *GCT_AllJets_QHist = dbe_->get("L1T/L1TGCT/AllJetsEtEtaPhi");
00212   MonitorElement *GCT_TauJets_QHist = dbe_->get("L1T/L1TGCT/TauJetsEtEtaPhi");
00213   MonitorElement *GT_AlgoBits_QHist = dbe_->get("L1T/L1TGT/algo_bits");
00214   MonitorElement *GT_TechBits_QHist = dbe_->get("L1T/L1TGT/tt_bits");
00215 
00216 
00217 
00218   for (int k = 0; k < nsys_; k++) {
00219     summaryContent[k] = 0;
00220     reportSummaryContent_[k]->Fill(0.);
00221   }
00222   summarySum = 0;
00223 
00224   
00225   int GCT_IsoEm_nXCh = 0,GCT_IsoEm_nYCh=0,GCT_NonIsoEm_nXCh = 0,GCT_NonIsoEm_nYCh=0,GCT_AllJets_nXCh = 0,GCT_AllJets_nYCh=0,GCT_TauJets_nXCh = 0,GCT_TauJets_nYCh=0,GMT_nXCh=0,GMT_nYCh=0;
00226 
00227 
00228   if(GCT_IsoEm_QHist){
00229     GCT_IsoEm_nXCh = GCT_IsoEm_QHist->getNbinsX(); 
00230     GCT_IsoEm_nYCh = GCT_IsoEm_QHist->getNbinsY();
00231   }
00232   if(GCT_NonIsoEm_QHist){
00233     GCT_NonIsoEm_nXCh = GCT_NonIsoEm_QHist->getNbinsX(); 
00234     GCT_NonIsoEm_nYCh = GCT_NonIsoEm_QHist->getNbinsY();
00235   }
00236   if(GCT_AllJets_QHist){
00237     GCT_AllJets_nXCh = GCT_AllJets_QHist->getNbinsX(); 
00238     GCT_AllJets_nYCh = GCT_AllJets_QHist->getNbinsY();
00239   }
00240   if(GCT_TauJets_QHist){
00241     GCT_TauJets_nXCh = GCT_TauJets_QHist->getNbinsX(); 
00242     GCT_TauJets_nYCh = GCT_TauJets_QHist->getNbinsY();
00243   }
00244   if(GMT_QHist){
00245     GMT_nXCh = GMT_QHist->getNbinsX(); 
00246     GMT_nYCh = GMT_QHist->getNbinsY();
00247   }
00248 
00249 
00250   int GCT_IsoEm_nCh=0,GCT_NonIsoEm_nCh=0,GCT_AllJets_nCh=0,GCT_TauJets_nCh=0,GMT_nCh=0;
00251   
00252   if(GCT_IsoEm_nYCh) 
00253     GCT_IsoEm_nCh = GCT_IsoEm_nXCh*GCT_IsoEm_nYCh;
00254   if(GCT_NonIsoEm_nYCh) 
00255     GCT_NonIsoEm_nCh = GCT_NonIsoEm_nXCh*GCT_NonIsoEm_nYCh;
00256   if(GCT_AllJets_nYCh) 
00257     GCT_AllJets_nCh = GCT_AllJets_nXCh*GCT_AllJets_nYCh;
00258   if(GCT_TauJets_nYCh) 
00259     GCT_TauJets_nCh = GCT_TauJets_nXCh*GCT_TauJets_nYCh;
00260   if(GMT_nYCh) 
00261     GMT_nCh = GMT_nXCh*GMT_nYCh;
00262 
00263 
00264 
00265 
00266 
00267   //
00268   // 00  MET Quality Tests
00269   //
00270 
00271 
00272 
00273   // GCT uninstrumented regions for IsoEm, NonIsoEm, and TauJets
00274   int nCh_no_inst = 144;
00275 
00276   //
00277   // 01  NonIsoEM Quality Tests
00278   //
00279   if (GCT_NonIsoEm_QHist){
00280     const QReport *GCT_NonIsoEm_DeadCh_QReport = GCT_NonIsoEm_QHist->getQReport("DeadChannels_GCT_2D_loose");
00281     const QReport *GCT_NonIsoEm_HotCh_QReport  = GCT_NonIsoEm_QHist->getQReport("HotChannels_GCT_2D");
00282 
00283     int GCT_NonIsoEm_nBadCh = 0;
00284 
00285     if (GCT_NonIsoEm_DeadCh_QReport) {
00286       int GCT_NonIsoEm_nDeadCh = GCT_NonIsoEm_DeadCh_QReport->getBadChannels().size();
00287       if( verbose_ ) cout << "  GCT_NonIsoEm_nDeadCh: "  << GCT_NonIsoEm_nDeadCh 
00288                           << ", GCT_NonIsoEm_nCh: " << GCT_NonIsoEm_nCh 
00289                           << ", GCT_NonIsoEm_DeadCh_efficiency: " << 1 - (float)GCT_NonIsoEm_nDeadCh/(float)GCT_NonIsoEm_nCh 
00290                           << " GCT_NonIsoEm_DeadCh QTResult = " << GCT_NonIsoEm_DeadCh_QReport->getQTresult() << std::endl;
00291 
00292       GCT_NonIsoEm_nBadCh+=GCT_NonIsoEm_nDeadCh;
00293     } 
00294 
00295     if (GCT_NonIsoEm_HotCh_QReport) {
00296       int GCT_NonIsoEm_nHotCh = GCT_NonIsoEm_HotCh_QReport->getBadChannels().size();
00297       if( verbose_ ) cout << "  GCT_NonIsoEm_nHotCh: "  << GCT_NonIsoEm_nHotCh 
00298                           << ", GCT_NonIsoEm_nCh: " << GCT_NonIsoEm_nCh 
00299                           << ", GCT_NonIsoEm_HotCh_efficiency: " << 1 - (float)GCT_NonIsoEm_nHotCh/(float)GCT_NonIsoEm_nCh 
00300                           << " GCT_NonIsoEm_HotCh QTResult = " << GCT_NonIsoEm_HotCh_QReport->getQTresult() << std::endl;
00301 
00302       GCT_NonIsoEm_nBadCh+=GCT_NonIsoEm_nHotCh;
00303     }
00304 
00305     if( verbose_ ) std::cout << "    GCT_NonIsoEm total efficiency = " << 1 - (float)GCT_NonIsoEm_nBadCh/(float)GCT_NonIsoEm_nCh << std::endl;
00306 
00307     double GCT_NonIsoEm_nentries = GCT_NonIsoEm_QHist->getEntries();
00308     float nonisoResult = -1;
00309     if( (counterLS_>=1000 && GCT_NonIsoEm_nentries==0) ) nonisoResult = 0;
00310     if( (GCT_NonIsoEm_nentries>GCT_NonIsoEm_threshold_) ) nonisoResult = 1 - (float)(GCT_NonIsoEm_nBadCh-nCh_no_inst)/(float)(GCT_NonIsoEm_nCh-nCh_no_inst);
00311     summaryContent[1] = ( nonisoResult < (1.0+1e-10) ) ? nonisoResult : 1.0;
00312   }
00313 
00314 
00315 
00316 
00317   //
00318   // 02  IsoEM Quality Tests
00319   //
00320   if (GCT_IsoEm_QHist){
00321     const QReport *GCT_IsoEm_DeadCh_QReport = GCT_IsoEm_QHist->getQReport("DeadChannels_GCT_2D_loose");
00322     const QReport *GCT_IsoEm_HotCh_QReport = GCT_IsoEm_QHist->getQReport("HotChannels_GCT_2D");
00323 
00324     int GCT_IsoEm_nBadCh = 0;
00325 
00326     if (GCT_IsoEm_DeadCh_QReport) {
00327       int GCT_IsoEm_nDeadCh = GCT_IsoEm_DeadCh_QReport->getBadChannels().size();
00328       if( verbose_ ) cout << "  GCT_IsoEm_nDeadCh: "  << GCT_IsoEm_nDeadCh 
00329                           << ", GCT_IsoEm_nCh: " << GCT_IsoEm_nCh 
00330                           << ", GCT_IsoEm_DeadCh_efficiency: " << 1 - (float)GCT_IsoEm_nDeadCh/(float)GCT_IsoEm_nCh 
00331                           << " GCT_IsoEm_DeadCh QTResult = " << GCT_IsoEm_DeadCh_QReport->getQTresult() << std::endl;
00332 
00333       GCT_IsoEm_nBadCh+=GCT_IsoEm_nDeadCh;
00334     } 
00335 
00336     if (GCT_IsoEm_HotCh_QReport) {
00337       int GCT_IsoEm_nHotCh = GCT_IsoEm_HotCh_QReport->getBadChannels().size();
00338       if( verbose_ ) cout << "  GCT_IsoEm_nHotCh: "  << GCT_IsoEm_nHotCh 
00339                           << ", GCT_IsoEm_nCh: " << GCT_IsoEm_nCh 
00340                           << ", GCT_IsoEm_HotCh_efficiency: " << 1 - (float)GCT_IsoEm_nHotCh/(float)GCT_IsoEm_nCh 
00341                           << " GCT_IsoEm_HotCh QTResult = " << GCT_IsoEm_HotCh_QReport->getQTresult() << std::endl;
00342 
00343       GCT_IsoEm_nBadCh+=GCT_IsoEm_nHotCh;
00344     }
00345 
00346     if( verbose_ ) std::cout << "    GCT_IsoEm total efficiency = " << 1 - (float)GCT_IsoEm_nBadCh/(float)GCT_IsoEm_nCh << std::endl;
00347 
00348     double GCT_IsoEm_nentries = GCT_IsoEm_QHist->getEntries();
00349     float isoResult = -1;
00350     if( (counterLS_>=thresholdLS_ && GCT_IsoEm_nentries==0) ) isoResult = 0;
00351     if( (GCT_IsoEm_nentries>GCT_IsoEm_threshold_) ) isoResult = 1 - (float)(GCT_IsoEm_nBadCh-nCh_no_inst)/(float)(GCT_IsoEm_nCh-nCh_no_inst);
00352     summaryContent[2] = ( isoResult < (1.0+1e-10) ) ? isoResult : 1.0;
00353   }
00354 
00355 
00356 
00357 
00358   //
00359   // 03  TauJets Quality Tests
00360   //
00361   if (GCT_TauJets_QHist){
00362     const QReport *GCT_TauJets_DeadCh_QReport = GCT_TauJets_QHist->getQReport("DeadChannels_GCT_2D_loose");
00363     const QReport *GCT_TauJets_HotCh_QReport = GCT_TauJets_QHist->getQReport("HotChannels_GCT_2D");
00364 
00365     int GCT_TauJets_nBadCh = 0;
00366 
00367     if (GCT_TauJets_DeadCh_QReport) {
00368       int GCT_TauJets_nDeadCh = GCT_TauJets_DeadCh_QReport->getBadChannels().size();
00369       if( verbose_ ) cout << "  GCT_TauJets_nDeadCh: "  << GCT_TauJets_nDeadCh 
00370                           << ", GCT_TauJets_nCh: " << GCT_TauJets_nCh 
00371                           << ", GCT_TauJets_DeadCh_efficiency: " << 1 - (float)GCT_TauJets_nDeadCh/(float)GCT_TauJets_nCh 
00372                           << " GCT_TauJets_DeadCh QTResult = " << GCT_TauJets_DeadCh_QReport->getQTresult() << std::endl;
00373 
00374       GCT_TauJets_nBadCh+=GCT_TauJets_nDeadCh;
00375     } 
00376 
00377     if (GCT_TauJets_HotCh_QReport) {
00378       int GCT_TauJets_nHotCh = GCT_TauJets_HotCh_QReport->getBadChannels().size();
00379       if( verbose_ ) cout << "  GCT_TauJets_nHotCh: "  << GCT_TauJets_nHotCh 
00380                           << ", GCT_TauJets_nCh: " << GCT_TauJets_nCh 
00381                           << ", GCT_TauJets_HotCh_efficiency: " << 1 - (float)GCT_TauJets_nHotCh/(float)GCT_TauJets_nCh 
00382                           << " GCT_TauJets_HotCh QTResult = " << GCT_TauJets_HotCh_QReport->getQTresult() << std::endl;
00383 
00384       GCT_TauJets_nBadCh+=GCT_TauJets_nHotCh;
00385     }
00386 
00387     if( verbose_ ) std::cout << "    GCT_TauJets total efficiency = " << 1 - (float)GCT_TauJets_nBadCh/(float)GCT_TauJets_nCh << std::endl;
00388 
00389     double GCT_TauJets_nentries = GCT_TauJets_QHist->getEntries();
00390     float taujetsResult = -1;
00391     if( (counterLS_>=thresholdLS_ && GCT_TauJets_nentries==0) ) taujetsResult = 0;
00392     if( (GCT_TauJets_nentries>GCT_TauJets_threshold_) ) taujetsResult = 1 - (float)(GCT_TauJets_nBadCh-nCh_no_inst)/(float)(GCT_TauJets_nCh-nCh_no_inst);
00393     summaryContent[3] = ( taujetsResult < (1.0+1e-10) ) ? taujetsResult : 1.0;
00394   }
00395 
00396 
00397 
00398 
00399   //
00400   // 04  Jets Quality Tests
00401   //
00402   if (GCT_AllJets_QHist){
00403     const QReport *GCT_AllJets_DeadCh_QReport = GCT_AllJets_QHist->getQReport("DeadChannels_GCT_2D_tight");
00404     const QReport *GCT_AllJets_HotCh_QReport = GCT_AllJets_QHist->getQReport("HotChannels_GCT_2D");
00405 
00406     int GCT_AllJets_nBadCh = 0;
00407 
00408     if (GCT_AllJets_DeadCh_QReport) {
00409       int GCT_AllJets_nDeadCh = GCT_AllJets_DeadCh_QReport->getBadChannels().size();
00410       if( verbose_ ) cout << "  GCT_AllJets_nDeadCh: "  << GCT_AllJets_nDeadCh 
00411                           << ", GCT_AllJets_nCh: " << GCT_AllJets_nCh 
00412                           << ", GCT_AllJets_DeadCh_efficiency: " << 1 - (float)GCT_AllJets_nDeadCh/(float)GCT_AllJets_nCh 
00413                           << " GCT_AllJets_DeadCh QTResult = " << GCT_AllJets_DeadCh_QReport->getQTresult() << std::endl;
00414 
00415       GCT_AllJets_nBadCh+=GCT_AllJets_nDeadCh;
00416     } 
00417 
00418     if (GCT_AllJets_HotCh_QReport) {
00419       int GCT_AllJets_nHotCh = GCT_AllJets_HotCh_QReport->getBadChannels().size();
00420       if( verbose_ ) cout << "  GCT_AllJets_nHotCh: "  << GCT_AllJets_nHotCh 
00421                           << ", GCT_AllJets_nCh: " << GCT_AllJets_nCh 
00422                           << ", GCT_AllJets_HotCh_efficiency: " << 1 - (float)GCT_AllJets_nHotCh/(float)GCT_AllJets_nCh 
00423                           << " GCT_AllJets_HotCh QTResult = " << GCT_AllJets_HotCh_QReport->getQTresult() << std::endl;
00424 
00425       GCT_AllJets_nBadCh+=GCT_AllJets_nHotCh;
00426     }
00427 
00428     if( verbose_ ) std::cout << "    GCT_AllJets total efficiency = " << 1 - (float)GCT_AllJets_nBadCh/(float)GCT_AllJets_nCh << std::endl;
00429 
00430     double GCT_AllJets_nentries = GCT_AllJets_QHist->getEntries();
00431     float jetsResult = -1;
00432     if( (counterLS_>=thresholdLS_ && GCT_AllJets_nentries==0) ) jetsResult = 0;
00433     if( (GCT_AllJets_nentries>GCT_AllJets_threshold_) ) jetsResult = 1 - (float)GCT_AllJets_nBadCh/(float)GCT_AllJets_nCh;
00434     summaryContent[4] = ( jetsResult < (1.0+1e-10) ) ? jetsResult : 1.0;
00435   }
00436 
00437 
00438 
00439 
00440   //
00441   // 05  Muon Quality Tests
00442   //
00443 
00444   if (GMT_QHist){
00445     const QReport *GMT_DeadCh_QReport = GMT_QHist->getQReport("DeadChannels_GMT_2D");
00446     const QReport *GMT_HotCh_QReport  = GMT_QHist->getQReport("HotChannels_GMT_2D");
00447 
00448     int GMT_nBadCh = 0;
00449 
00450     if (GMT_DeadCh_QReport) {
00451       int GMT_nDeadCh = GMT_DeadCh_QReport->getBadChannels().size();
00452       if( verbose_ ) cout << "  GMT_nDeadCh: "  << GMT_nDeadCh 
00453                           << ", GMT_nCh: " << GMT_nCh 
00454                           << ", GMT_DeadCh_efficiency: " << 1 - (float)GMT_nDeadCh/(float)GMT_nCh 
00455                           << " GMT_DeadCh QTResult = " << GMT_DeadCh_QReport->getQTresult() << std::endl;
00456 
00457       GMT_nBadCh+=GMT_nDeadCh;
00458     } 
00459 
00460     if (GMT_HotCh_QReport) {
00461       int GMT_nHotCh = GMT_HotCh_QReport->getBadChannels().size();
00462       if( verbose_ ) cout << "  GMT_nHotCh: "  << GMT_nHotCh 
00463                           << ", GMT_nCh: " << GMT_nCh 
00464                           << ", GMT_HotCh_efficiency: " << 1 - (float)GMT_nHotCh/(float)GMT_nCh 
00465                           << " GMT_HotCh QTResult = " << GMT_HotCh_QReport->getQTresult() << std::endl;
00466 
00467       GMT_nBadCh+=GMT_nHotCh;
00468     }
00469 
00470     if( verbose_ ) std::cout << "    GMT total efficiency = " << 1 - (float)GMT_nBadCh/(float)GMT_nCh << std::endl;
00471 
00472     double GMT_nentries = GMT_QHist->getEntries();
00473     float muonResult = -1;
00474     if( (counterLS_>=thresholdLS_ && GMT_nentries==0) ) muonResult = 0;
00475     if( (GMT_nentries>GMT_Muons_threshold_) ) muonResult = 1.5*(1 - (float)GMT_nBadCh/(float)GMT_nCh);
00476     summaryContent[5] = ( muonResult < (1.0+1e-10) ) ? muonResult : 1.0;
00477   }
00478 
00479 
00480 
00481   //
00482   // 06  GT Quality Tests
00483   //
00484   double gt_algobits_prob = 0;
00485   double gt_techbits_prob = 0;
00486 
00487   if (GT_AlgoBits_QHist){
00488     gt_algobits_prob = 1;
00489     const QReport *GT_AlgoBits_QReport = GT_AlgoBits_QHist->getQReport("CompareHist_GT");
00490     if (GT_AlgoBits_QReport) gt_algobits_prob = GT_AlgoBits_QReport->getQTresult();
00491   }
00492   if (GT_TechBits_QHist){
00493     gt_techbits_prob = 1;
00494     const QReport *GT_TechBits_QReport = GT_TechBits_QHist->getQReport("CompareHist_GT");
00495     if (GT_TechBits_QReport) gt_techbits_prob = GT_TechBits_QReport->getQTresult();
00496   }
00497 
00498   if( gt_algobits_prob!=-1 && gt_techbits_prob!=-1 ) summaryContent[6] = 0.5*( gt_algobits_prob + gt_techbits_prob );
00499   else if( GT_AlgoBits_QHist && GT_TechBits_QHist  ) summaryContent[6] = 1;
00500   else summaryContent[6] = 0;
00501 
00502 
00503 
00504 
00505   //
00506   // 07 - 17  L1T EMU Quality Tests
00507   //
00508 
00509 
00510 
00511   //
00512   // Apply masks for data and emulator
00513   //
00514 
00515   //  Data Mask
00516   unsigned int NumDataMask = dataMask.size();
00517   std::vector<string> maskedData;
00518   for( unsigned int i=0; i<NumDataMask; i++ ){
00519     std::string mask_sys_tmp  = dataMask[i];
00520     std::string mask_sys = StringToUpper(mask_sys_tmp);
00521     switch(s_mapDataValues[mask_sys])
00522       {
00523       case data_empty:
00524         break;
00525       case data_all:
00526         for( int m=0; m<7; m++ ) summaryContent[m] = -2;
00527         maskedData.push_back(mask_sys_tmp);
00528         break;
00529       case data_gt:
00530         summaryContent[6]=-2;
00531         maskedData.push_back(mask_sys_tmp);
00532         break;
00533       case data_muons:
00534         summaryContent[5]=-2;
00535         maskedData.push_back(mask_sys_tmp);
00536         break;
00537       case data_jets:
00538         summaryContent[4]=-2;
00539         maskedData.push_back(mask_sys_tmp);
00540         break;
00541       case data_taujets:
00542         summaryContent[3]=-2;
00543         maskedData.push_back(mask_sys_tmp);
00544         break;
00545       case data_isoem:
00546         summaryContent[2]=-2;
00547         maskedData.push_back(mask_sys_tmp);
00548         break;
00549       case data_nonisoem:
00550         summaryContent[1]=-2;
00551         maskedData.push_back(mask_sys_tmp);
00552         break;
00553       case data_met:
00554         summaryContent[0]=-2;
00555         maskedData.push_back(mask_sys_tmp);
00556         break;
00557       default:
00558         if( verbose_ ) cout << "   User input mask '" << mask_sys_tmp << "' is not recognized." << endl;
00559         break;
00560       }
00561   }
00562 
00563   //  Emulator Mask
00564   unsigned int NumEmulMask = emulMask.size();
00565   std::vector<string> maskedEmul;
00566   for( unsigned int i=0; i<NumEmulMask; i++ ){
00567     std::string mask_sys_tmp  = emulMask[i];
00568     std::string mask_sys = StringToUpper(mask_sys_tmp);
00569     switch(s_mapEmulValues[mask_sys])
00570       {
00571       case emul_empty:
00572         break;
00573       case emul_all:
00574         for( int m=7; m<18; m++ ) summaryContent[m] = -2;
00575         maskedEmul.push_back(mask_sys_tmp);
00576         break;
00577       case emul_glt:
00578         summaryContent[7]=-2;
00579         maskedEmul.push_back(mask_sys_tmp);
00580         break;
00581       case emul_gmt:
00582         summaryContent[8]=-2;
00583         maskedEmul.push_back(mask_sys_tmp);
00584         break;
00585       case emul_rpc:
00586         summaryContent[9]=-2;
00587         maskedEmul.push_back(mask_sys_tmp);
00588         break;
00589       case emul_ctp:
00590         summaryContent[10]=-2;
00591         maskedEmul.push_back(mask_sys_tmp);
00592         break;
00593       case emul_ctf:
00594         summaryContent[11]=-2;
00595         maskedEmul.push_back(mask_sys_tmp);
00596         break;
00597       case emul_dtp:
00598         summaryContent[12]=-2;
00599         maskedEmul.push_back(mask_sys_tmp);
00600         break;
00601       case emul_dtf:
00602         summaryContent[13]=-2;
00603         maskedEmul.push_back(mask_sys_tmp);
00604         break;
00605       case emul_htp:
00606         summaryContent[14]=-2;
00607         maskedEmul.push_back(mask_sys_tmp);
00608         break;
00609       case emul_etp:
00610         summaryContent[15]=-2;
00611         maskedEmul.push_back(mask_sys_tmp);
00612         break;
00613       case emul_gct:
00614         summaryContent[16]=-2;
00615         maskedEmul.push_back(mask_sys_tmp);
00616         break;
00617       case emul_rct:
00618         summaryContent[17]=-2;
00619         maskedEmul.push_back(mask_sys_tmp);
00620         break;
00621       default:
00622         if( verbose_ ) cout << "   User input mask '" << mask_sys_tmp << "' is not recognized." << endl;
00623         break;
00624       }
00625   }
00626 
00627 
00628   int numUnMaskedSystems = 0;
00629   for( int m=0; m<nsys_; m++ ){
00630     if( summaryContent[m]>-1e-5){
00631       if( m<7 ){
00632         summarySum += summaryContent[m];
00633         numUnMaskedSystems++;
00634       }
00635 
00636       reportSummaryContent_[m]->Fill( summaryContent[m] );
00637     }
00638   }
00639 
00640 
00641 
00642   // For now, only use L1T for reportSummary value
00643   reportSummary = summarySum/float(numUnMaskedSystems);
00644   if (reportSummary_) reportSummary_->Fill(reportSummary);
00645   
00646 
00647   //L1T summary map
00648   reportSummaryMap_->setBinContent(1,11,summaryContent[6]); // GT
00649   reportSummaryMap_->setBinContent(1,10,summaryContent[5]); // Muons
00650   reportSummaryMap_->setBinContent(1,9, summaryContent[4]); // Jets
00651   reportSummaryMap_->setBinContent(1,8, summaryContent[3]); // TauJets
00652   reportSummaryMap_->setBinContent(1,7, summaryContent[2]); // IsoEM
00653   reportSummaryMap_->setBinContent(1,6, summaryContent[1]); // NonIsoEM
00654   reportSummaryMap_->setBinContent(1,5, summaryContent[0]); // MET
00655 
00656   //L1TEMU summary map
00657   reportSummaryMap_->setBinContent(2,11,summaryContent[7]); // GLT
00658   reportSummaryMap_->setBinContent(2,10,summaryContent[8]); // GMT
00659   reportSummaryMap_->setBinContent(2,9, summaryContent[9]); // RPC
00660   reportSummaryMap_->setBinContent(2,8, summaryContent[10]);// CTP
00661   reportSummaryMap_->setBinContent(2,7, summaryContent[11]);// CTF
00662   reportSummaryMap_->setBinContent(2,6, summaryContent[12]);// DTP
00663   reportSummaryMap_->setBinContent(2,5, summaryContent[13]);// DTF
00664   reportSummaryMap_->setBinContent(2,4, summaryContent[14]);// HTP
00665   reportSummaryMap_->setBinContent(2,3, summaryContent[15]);// ETP
00666   reportSummaryMap_->setBinContent(2,2, summaryContent[16]);// GCT
00667   reportSummaryMap_->setBinContent(2,1, summaryContent[17]);// RCT
00668 
00669 
00670   if( verbose_ ){
00671     if( maskedData.size()>0 ){
00672       std::cout << "  Masked Data Systems = ";
00673       for( unsigned int i=0; i<maskedData.size(); i++ ){
00674         if( i!=maskedData.size()-1 ){
00675           std::cout << maskedData[i] << ", ";
00676         }
00677         else {
00678           std::cout << maskedData[i] << std::endl;
00679         }
00680       }
00681     }
00682     if( maskedEmul.size()>0 ){
00683       std::cout << "  Masked Emul Systems = ";
00684       for( unsigned int i=0; i<maskedEmul.size(); i++ ){
00685         if( i!=maskedEmul.size()-1 ){
00686           std::cout << maskedEmul[i] << ", ";
00687         }
00688         else {
00689           std::cout << maskedEmul[i] << std::endl;
00690         }
00691       }
00692     }
00693 
00694     std::cout << "  L1T " << std::endl;
00695     std::cout << "     summaryContent[0]  = MET      = " << summaryContent[0] << std::endl;
00696     std::cout << "     summaryContent[1]  = NonIsoEM = " << summaryContent[1] << std::endl;
00697     std::cout << "     summaryContent[2]  = IsoEM    = " << summaryContent[2] << std::endl;
00698     std::cout << "     summaryContent[3]  = TauJets  = " << summaryContent[3] << std::endl;
00699     std::cout << "     summaryContent[4]  = Jets     = " << summaryContent[4] << std::endl;
00700     std::cout << "     summaryContent[5]  = Muons    = " << summaryContent[5] << std::endl;
00701     std::cout << "     summaryContent[6]  = GT       = " << summaryContent[6] << std::endl;
00702     std::cout << "  L1T EMU" << std::endl;
00703     std::cout << "     summaryContent[7]  = GLT      = " << summaryContent[7] << std::endl;
00704     std::cout << "     summaryContent[8]  = GMT      = " << summaryContent[8] << std::endl;
00705     std::cout << "     summaryContent[9]  = RPC      = " << summaryContent[9] << std::endl;
00706     std::cout << "     summaryContent[10] = CTP      = " << summaryContent[10] << std::endl;
00707     std::cout << "     summaryContent[11] = CTF      = " << summaryContent[11] << std::endl;
00708     std::cout << "     summaryContent[12] = DTP      = " << summaryContent[12] << std::endl;
00709     std::cout << "     summaryContent[13] = DTF      = " << summaryContent[13] << std::endl;
00710     std::cout << "     summaryContent[14] = HTP      = " << summaryContent[14] << std::endl;
00711     std::cout << "     summaryContent[15] = ETP      = " << summaryContent[15] << std::endl;
00712     std::cout << "     summaryContent[16] = GCT      = " << summaryContent[16] << std::endl;
00713     std::cout << "     summaryContent[17] = RCT      = " << summaryContent[17] << std::endl;
00714   }
00715 
00716 } 
00717 
00718 
00719 
00720 //--------------------------------------------------------
00721 void L1TEventInfoClient::analyze(const Event& e, const EventSetup& context){
00722    
00723   counterEvt_++;
00724   if (prescaleEvt_<1) return;
00725   if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
00726   
00727   if(verbose_) cout << "L1TEventInfoClient::analyze" << endl;
00728 
00729   
00730 
00731 
00732   //reportSummary = average of report summaries of each system
00733   
00734  
00735 }
00736 
00737 //--------------------------------------------------------
00738 void L1TEventInfoClient::endRun(const Run& r, const EventSetup& context){
00739 }
00740 
00741 //--------------------------------------------------------
00742 void L1TEventInfoClient::endJob(){
00743 }
00744 
00745 
00746 
00747 TH1F * L1TEventInfoClient::get1DHisto(string meName, DQMStore * dbi)
00748 {
00749 
00750   MonitorElement * me_ = dbi->get(meName);
00751 
00752   if (!me_) { 
00753     if(verbose_) cout << "ME NOT FOUND." << endl;
00754     return NULL;
00755   }
00756 
00757   return me_->getTH1F();
00758 }
00759 
00760 TH2F * L1TEventInfoClient::get2DHisto(string meName, DQMStore * dbi)
00761 {
00762 
00763 
00764   MonitorElement * me_ = dbi->get(meName);
00765 
00766   if (!me_) { 
00767     if(verbose_) cout << "ME NOT FOUND." << endl;
00768     return NULL;
00769   }
00770 
00771   return me_->getTH2F();
00772 }
00773 
00774 
00775 
00776 TProfile2D *  L1TEventInfoClient::get2DProfile(string meName, DQMStore * dbi)
00777 {
00778 
00779 
00780   MonitorElement * me_ = dbi->get(meName);
00781 
00782   if (!me_) { 
00783      if(verbose_) cout << "ME NOT FOUND." << endl;
00784    return NULL;
00785   }
00786 
00787   return me_->getTProfile2D();
00788 }
00789 
00790 
00791 TProfile *  L1TEventInfoClient::get1DProfile(string meName, DQMStore * dbi)
00792 {
00793 
00794 
00795   MonitorElement * me_ = dbi->get(meName);
00796 
00797   if (!me_) { 
00798     if(verbose_) cout << "ME NOT FOUND." << endl;
00799     return NULL;
00800   }
00801 
00802   return me_->getTProfile();
00803 }
00804 
00805 string L1TEventInfoClient::StringToUpper(string strToConvert)
00806 {//change each element of the string to upper case
00807    for(unsigned int i=0;i<strToConvert.length();i++)
00808    {
00809       strToConvert[i] = toupper(strToConvert[i]);
00810    }
00811    return strToConvert;//return the converted string
00812 }
00813 
00814 
00815 
00816 
00817 
00818 
00819