Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:49

0001 #include "DQM/L1TMonitorClient/interface/L1TCSCTFClient.h"
0002 
0003 #include "FWCore/ServiceRegistry/interface/Service.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 #include "TRandom.h"
0010 using namespace edm;
0011 using namespace std;
0012 
0013 L1TCSCTFClient::L1TCSCTFClient(const edm::ParameterSet &ps) {
0014   parameters = ps;
0015   initialize();
0016 }
0017 
0018 L1TCSCTFClient::~L1TCSCTFClient() {}
0019 
0020 //--------------------------------------------------------
0021 void L1TCSCTFClient::initialize() {
0022   counterLS = 0;
0023   counterEvt = 0;
0024 
0025   input_dir = parameters.getUntrackedParameter<string>("input_dir", "");
0026   output_dir = parameters.getUntrackedParameter<string>("output_dir", "");
0027   prescaleLS = parameters.getUntrackedParameter<int>("prescaleLS", -1);
0028   prescaleEvt = parameters.getUntrackedParameter<int>("prescaleEvt", -1);
0029 
0030   m_runInEventLoop = parameters.getUntrackedParameter<bool>("runInEventLoop", false);
0031   m_runInEndLumi = parameters.getUntrackedParameter<bool>("runInEndLumi", false);
0032   m_runInEndRun = parameters.getUntrackedParameter<bool>("runInEndRun", false);
0033   m_runInEndJob = parameters.getUntrackedParameter<bool>("runInEndJob", false);
0034 }
0035 
0036 void L1TCSCTFClient::dqmEndLuminosityBlock(DQMStore::IBooker &,
0037                                            DQMStore::IGetter &igetter,
0038                                            const edm::LuminosityBlock &lumiSeg,
0039                                            const edm::EventSetup &c) {}
0040 
0041 //--------------------------------------------------------
0042 void L1TCSCTFClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0043   ibooker.setCurrentFolder(output_dir);
0044   csctferrors_ = ibooker.book1D("csctferrors_", "CSCTF Errors", 6, 0, 6);
0045 
0046   processHistograms(igetter);
0047 }
0048 
0049 //--------------------------------------------------------
0050 void L1TCSCTFClient::processHistograms(DQMStore::IGetter &igetter) {
0051   igetter.setCurrentFolder(input_dir);
0052 
0053   vector<string> meVec = igetter.getMEs();
0054   for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
0055     string full_path = input_dir + "/" + (*it);
0056     MonitorElement *me = igetter.get(full_path);
0057     if (!me) {
0058       LogInfo("TriggerDQM") << full_path << " NOT FOUND.";
0059       continue;
0060     }
0061 
0062     //  But for now we only do a simple workaround
0063     if ((*it) != "CSCTF_errors")
0064       continue;
0065     TH1F *errors = me->getTH1F();
0066     csctferrors_->getTH1F()->Reset();
0067     if (!errors)
0068       continue;
0069     for (int bin = 1; bin <= errors->GetXaxis()->GetNbins(); bin++)
0070       csctferrors_->Fill(bin - 0.5, errors->GetBinContent(bin));
0071   }
0072 }