Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-31 22:35:52

0001 // Original Author:  Anna Cimmino
0002 #include "DQM/RPCMonitorClient/interface/RPCRecHitProbabilityClient.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include <string>
0006 #include <fmt/format.h>
0007 
0008 RPCRecHitProbabilityClient::RPCRecHitProbabilityClient(const edm::ParameterSet &iConfig) {
0009   edm::LogVerbatim("rpcdqmclient") << "[RPCRecHitProbabilityClient]: Constructor";
0010 
0011   const std::string subsystemFolder = iConfig.getUntrackedParameter<std::string>("RPCFolder", "RPC");
0012   const std::string recHitTypeFolder = iConfig.getUntrackedParameter<std::string>("MuonFolder", "Muon");
0013 
0014   const std::string summaryFolder = iConfig.getUntrackedParameter<std::string>("GlobalFolder", "SummaryHistograms");
0015 
0016   globalFolder_ = subsystemFolder + "/" + recHitTypeFolder + "/" + summaryFolder;
0017 }
0018 
0019 void RPCRecHitProbabilityClient::beginJob() {
0020   edm::LogVerbatim("rpcrechitprobabilityclient") << "[RPCRecHitProbabilityClient]: Begin Job";
0021 }
0022 
0023 void RPCRecHitProbabilityClient::dqmEndLuminosityBlock(DQMStore::IBooker &,
0024                                                        DQMStore::IGetter &,
0025                                                        edm::LuminosityBlock const &,
0026                                                        edm::EventSetup const &) {}
0027 
0028 void RPCRecHitProbabilityClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0029   edm::LogVerbatim("rpcrechitprobabilityclient") << "[RPCRecHitProbabilityClient]: End Run";
0030 
0031   MonitorElement *NumberOfMuonEta = igetter.get(globalFolder_ + "/NumberOfMuonEta");
0032   MonitorElement *NumberOfMuonPt_B = igetter.get(globalFolder_ + "/NumberOfMuonPt_Barrel");
0033   MonitorElement *NumberOfMuonPt_EP = igetter.get(globalFolder_ + "/NumberOfMuonPt_EndcapP");
0034   MonitorElement *NumberOfMuonPt_EM = igetter.get(globalFolder_ + "/NumberOfMuonPt_EndcapM");
0035   MonitorElement *NumberOfMuonPhi_B = igetter.get(globalFolder_ + "/NumberOfMuonPhi_Barrel");
0036   MonitorElement *NumberOfMuonPhi_EP = igetter.get(globalFolder_ + "/NumberOfMuonPhi_EndcapP");
0037   MonitorElement *NumberOfMuonPhi_EM = igetter.get(globalFolder_ + "/NumberOfMuonPhi_EndcapM");
0038 
0039   if (NumberOfMuonEta == nullptr || NumberOfMuonPt_B == nullptr || NumberOfMuonPt_EP == nullptr ||
0040       NumberOfMuonPt_EM == nullptr || NumberOfMuonPhi_B == nullptr || NumberOfMuonPhi_EP == nullptr ||
0041       NumberOfMuonPhi_EM == nullptr)
0042     return;
0043 
0044   TH1F *NumberOfMuonEtaTH1F = NumberOfMuonEta->getTH1F();
0045   TH1F *NumberOfMuonPtBTH1F = NumberOfMuonPt_B->getTH1F();
0046   TH1F *NumberOfMuonPtEPTH1F = NumberOfMuonPt_EP->getTH1F();
0047   TH1F *NumberOfMuonPtEMTH1F = NumberOfMuonPt_EM->getTH1F();
0048   TH1F *NumberOfMuonPhiBTH1F = NumberOfMuonPhi_B->getTH1F();
0049   TH1F *NumberOfMuonPhiEPTH1F = NumberOfMuonPhi_EP->getTH1F();
0050   TH1F *NumberOfMuonPhiEMTH1F = NumberOfMuonPhi_EM->getTH1F();
0051 
0052   MonitorElement *recHit;
0053   for (int i = 1; i <= 6; i++) {
0054     recHit = igetter.get(fmt::format("{}/{}RecHitMuonEta", globalFolder_, i));
0055     if (recHit)
0056       recHit->getTH1F()->Divide(NumberOfMuonEtaTH1F);
0057 
0058     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPtB", globalFolder_, i));
0059     if (recHit) {
0060       recHit->getTH1F()->Divide(NumberOfMuonPtBTH1F);
0061     }
0062 
0063     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPhiB", globalFolder_, i));
0064     if (recHit) {
0065       recHit->getTH1F()->Divide(NumberOfMuonPhiBTH1F);
0066     }
0067 
0068     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPtEP", globalFolder_, i));
0069     if (recHit) {
0070       recHit->getTH1F()->Divide(NumberOfMuonPtEPTH1F);
0071     }
0072 
0073     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPhiEP", globalFolder_, i));
0074     if (recHit) {
0075       recHit->getTH1F()->Divide(NumberOfMuonPhiEPTH1F);
0076     }
0077 
0078     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPtEM", globalFolder_, i));
0079     if (recHit) {
0080       recHit->getTH1F()->Divide(NumberOfMuonPtEMTH1F);
0081     }
0082 
0083     recHit = igetter.get(fmt::format("{}/{}RecHitMuonPhiEM", globalFolder_, i));
0084     if (recHit) {
0085       recHit->getTH1F()->Divide(NumberOfMuonPhiEMTH1F);
0086     }
0087   }
0088 }