00001 #include "DQM/L1TMonitorClient/interface/L1TCSCTFClient.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 using namespace edm;
00013 using namespace std;
00014
00015 L1TCSCTFClient::L1TCSCTFClient(const edm::ParameterSet& ps){
00016 parameters=ps;
00017 initialize();
00018 }
00019
00020 L1TCSCTFClient::~L1TCSCTFClient(){}
00021
00022
00023 void L1TCSCTFClient::initialize(){
00024 counterLS = 0;
00025 counterEvt = 0;
00026
00027
00028 dbe = Service<DQMStore>().operator->();
00029
00030 input_dir = parameters.getUntrackedParameter<string>("input_dir","");
00031 output_dir = parameters.getUntrackedParameter<string>("output_dir","");
00032 prescaleLS = parameters.getUntrackedParameter<int>("prescaleLS",-1);
00033 prescaleEvt = parameters.getUntrackedParameter<int>("prescaleEvt",-1);
00034 }
00035
00036
00037 void L1TCSCTFClient::beginJob(const EventSetup& context){
00038
00039 dbe = Service<DQMStore>().operator->();
00040
00041
00042 dbe->setCurrentFolder(output_dir);
00043 csctferrors_ = dbe->book1D("csctferrors_","CSCTF Errors",6,0,6);
00044 dbe->setCurrentFolder(input_dir);
00045 }
00046
00047
00048 void L1TCSCTFClient::beginRun(const Run& r, const EventSetup& context) {}
00049
00050
00051 void L1TCSCTFClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
00052
00053 }
00054
00055 void L1TCSCTFClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
00056 vector<string> meVec = dbe->getMEs();
00057 for(vector<string>::const_iterator it=meVec.begin(); it!=meVec.end(); it++){
00058 string full_path = input_dir + "/" + (*it);
00059 MonitorElement *me =dbe->get(full_path);
00060 if( !me ){
00061 LogInfo("TriggerDQM")<<full_path<<" NOT FOUND.";
00062 continue;
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 if( (*it) != "CSCTF_errors" ) continue;
00092 TH1F *errors = me->getTH1F();
00093 csctferrors_->getTH1F()->Reset();
00094 if(!errors) continue;
00095 for(int bin=1; bin<=errors->GetXaxis()->GetNbins(); bin++)
00096 csctferrors_->Fill(bin-0.5,errors->GetBinContent(bin));
00097 }
00098 }
00099
00100
00101 void L1TCSCTFClient::analyze(const Event& e, const EventSetup& context){
00102 counterEvt++;
00103 if (prescaleEvt<1) return;
00104 if (prescaleEvt>0 && counterEvt%prescaleEvt!=0) return;
00105
00106
00107 vector<string> meVec = dbe->getMEs();
00108 for(vector<string>::const_iterator it=meVec.begin(); it!=meVec.end(); it++){
00109 string full_path = input_dir + "/" + (*it);
00110 MonitorElement *me =dbe->get(full_path);
00111 if( !me ){
00112 LogError("TriggerDQM")<<full_path<<" NOT FOUND.";
00113 continue;
00114 }
00115
00116 if( (*it) != "CSCTF_errors" ) continue;
00117 TH1F *errors = me->getTH1F();
00118 csctferrors_->getTH1F()->Reset();
00119 if(!errors) continue;
00120 for(int bin=1; bin<=errors->GetXaxis()->GetNbins(); bin++)
00121 csctferrors_->Fill(bin-0.5,errors->GetBinContent(bin));
00122 }
00123 }
00124
00125
00126 void L1TCSCTFClient::endRun(const Run& r, const EventSetup& context){}
00127
00128
00129 void L1TCSCTFClient::endJob(void){}