Go to the documentation of this file.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 m_runInEventLoop = parameters.getUntrackedParameter<bool>("runInEventLoop", false);
00036 m_runInEndLumi = parameters.getUntrackedParameter<bool>("runInEndLumi", false);
00037 m_runInEndRun = parameters.getUntrackedParameter<bool>("runInEndRun", false);
00038 m_runInEndJob = parameters.getUntrackedParameter<bool>("runInEndJob", false);
00039
00040 }
00041
00042
00043 void L1TCSCTFClient::beginJob(void){
00044
00045 dbe = Service<DQMStore>().operator->();
00046
00047
00048 dbe->setCurrentFolder(output_dir);
00049 csctferrors_ = dbe->book1D("csctferrors_","CSCTF Errors",6,0,6);
00050 dbe->setCurrentFolder(input_dir);
00051 }
00052
00053
00054 void L1TCSCTFClient::beginRun(const Run& r, const EventSetup& context) {}
00055
00056
00057 void L1TCSCTFClient::beginLuminosityBlock(const LuminosityBlock& lumiSeg, const EventSetup& context) {
00058
00059 }
00060
00061 void L1TCSCTFClient::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c){
00062
00063 if (m_runInEndLumi) {
00064
00065 processHistograms();
00066 }
00067
00068 }
00069
00070
00071 void L1TCSCTFClient::analyze(const Event& e, const EventSetup& context){
00072
00073 counterEvt++;
00074 if (prescaleEvt<1) return;
00075 if (prescaleEvt>0 && counterEvt%prescaleEvt!=0) return;
00076
00077
00078
00079
00080 if (m_runInEventLoop) {
00081
00082 processHistograms();
00083 }
00084
00085 }
00086
00087
00088 void L1TCSCTFClient::endRun(const Run& r, const EventSetup& context) {
00089
00090 if (m_runInEndRun) {
00091
00092 processHistograms();
00093 }
00094
00095 }
00096
00097
00098 void L1TCSCTFClient::endJob(void){
00099
00100 if (m_runInEndJob) {
00101
00102 processHistograms();
00103 }
00104
00105 }
00106
00107
00108 void L1TCSCTFClient::processHistograms() {
00109
00110 dbe->setCurrentFolder(input_dir);
00111
00112 vector<string> meVec = dbe->getMEs();
00113 for(vector<string>::const_iterator it=meVec.begin(); it!=meVec.end(); it++){
00114 string full_path = input_dir + "/" + (*it);
00115 MonitorElement *me =dbe->get(full_path);
00116 if( !me ){
00117 LogInfo("TriggerDQM")<<full_path<<" NOT FOUND.";
00118 continue;
00119 }
00120
00121
00122 if( (*it) != "CSCTF_errors" ) continue;
00123 TH1F *errors = me->getTH1F();
00124 csctferrors_->getTH1F()->Reset();
00125 if(!errors) continue;
00126 for(int bin=1; bin<=errors->GetXaxis()->GetNbins(); bin++)
00127 csctferrors_->Fill(bin-0.5,errors->GetBinContent(bin));
00128 }
00129
00130 }
00131