Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:42:45

0001 #include "DQM/L1TMonitorClient/interface/L1TdeStage2RegionalShowerClient.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 L1TdeStage2RegionalShowerClient::L1TdeStage2RegionalShowerClient(const edm::ParameterSet &ps)
0014     : monitorDir_(ps.getUntrackedParameter<string>("monitorDir")) {}
0015 
0016 L1TdeStage2RegionalShowerClient::~L1TdeStage2RegionalShowerClient() {}
0017 
0018 void L1TdeStage2RegionalShowerClient::dqmEndLuminosityBlock(DQMStore::IBooker &ibooker,
0019                                                             DQMStore::IGetter &igetter,
0020                                                             const edm::LuminosityBlock &lumiSeg,
0021                                                             const edm::EventSetup &c) {
0022   book(ibooker);
0023   processHistograms(igetter);
0024 }
0025 
0026 //--------------------------------------------------------
0027 void L1TdeStage2RegionalShowerClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0028   book(ibooker);
0029   processHistograms(igetter);
0030 }
0031 
0032 void L1TdeStage2RegionalShowerClient::book(DQMStore::IBooker &iBooker) {
0033   iBooker.setCurrentFolder(monitorDir_);
0034 
0035   emtfShowerDataSummary_eff_ = iBooker.book2D(
0036       "emtf_shower_data_summary_eff", "Efficiency of data EMTF shower being correctly emulated", 6, 1, 7, 4, 0, 4);
0037   emtfShowerEmulSummary_eff_ = iBooker.book2D(
0038       "emtf_shower_emul_summary_eff", "Fraction of emulated EMTF shower without matching data shower", 6, 1, 7, 4, 0, 4);
0039 
0040   // x labels
0041   emtfShowerDataSummary_eff_->setAxisTitle("Chamber", 1);
0042   emtfShowerEmulSummary_eff_->setAxisTitle("Chamber", 1);
0043 
0044   // plotting option
0045   emtfShowerDataSummary_eff_->setOption("colz");
0046   emtfShowerEmulSummary_eff_->setOption("colz");
0047 
0048   // y labels
0049   emtfShowerDataSummary_eff_->setBinLabel(1, "ME- Tight", 2);
0050   emtfShowerEmulSummary_eff_->setBinLabel(1, "ME- Tight", 2);
0051   emtfShowerDataSummary_eff_->setBinLabel(2, "ME- Nom", 2);
0052   emtfShowerEmulSummary_eff_->setBinLabel(2, "ME- Nom", 2);
0053   emtfShowerDataSummary_eff_->setBinLabel(3, "ME+ Nom", 2);
0054   emtfShowerEmulSummary_eff_->setBinLabel(3, "ME+ Nom", 2);
0055   emtfShowerDataSummary_eff_->setBinLabel(4, "ME+ Tight", 2);
0056   emtfShowerEmulSummary_eff_->setBinLabel(4, "ME+ Tight", 2);
0057 }
0058 
0059 void L1TdeStage2RegionalShowerClient::processHistograms(DQMStore::IGetter &igetter) {
0060   MonitorElement *emtfShowerDataSummary_denom_ = igetter.get(monitorDir_ + "/emtf_shower_data_summary_denom");
0061   MonitorElement *emtfShowerDataSummary_num_ = igetter.get(monitorDir_ + "/emtf_shower_data_summary_num");
0062 
0063   MonitorElement *emtfShowerEmulSummary_denom_ = igetter.get(monitorDir_ + "/emtf_shower_emul_summary_denom");
0064   MonitorElement *emtfShowerEmulSummary_num_ = igetter.get(monitorDir_ + "/emtf_shower_emul_summary_num");
0065 
0066   if (emtfShowerDataSummary_denom_ == nullptr or emtfShowerDataSummary_num_ == nullptr or
0067       emtfShowerEmulSummary_denom_ == nullptr or emtfShowerEmulSummary_num_ == nullptr) {
0068     edm::LogWarning("L1TdeStage2RegionalShowerClient")
0069         << __PRETTY_FUNCTION__ << " could not load the necessary histograms for the harvesting";
0070     return;
0071   }
0072 
0073   emtfShowerDataSummary_eff_->getTH2F()->Divide(
0074       emtfShowerDataSummary_num_->getTH2F(), emtfShowerDataSummary_denom_->getTH2F(), 1, 1, "");
0075   emtfShowerEmulSummary_eff_->getTH2F()->Divide(
0076       emtfShowerEmulSummary_num_->getTH2F(), emtfShowerEmulSummary_denom_->getTH2F(), 1, 1, "");
0077 }