Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-27 06:44:05

0001 #include "DQM/L1TMonitorClient/interface/L1TdeCSCTPGShowerClient.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 L1TdeCSCTPGShowerClient::L1TdeCSCTPGShowerClient(const edm::ParameterSet &ps)
0014     : monitorDir_(ps.getUntrackedParameter<string>("monitorDir")) {}
0015 
0016 L1TdeCSCTPGShowerClient::~L1TdeCSCTPGShowerClient() {}
0017 
0018 void L1TdeCSCTPGShowerClient::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 L1TdeCSCTPGShowerClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0028   book(ibooker);
0029   processHistograms(igetter);
0030 }
0031 
0032 void L1TdeCSCTPGShowerClient::book(DQMStore::IBooker &iBooker) {
0033   iBooker.setCurrentFolder(monitorDir_);
0034 
0035   lctShowerDataNomSummary_eff_ = iBooker.book2D("lct_cscshower_data_nom_summary_eff",
0036                                                 "Efficiency of data LCT Nominal shower being correctly emulated",
0037                                                 36,
0038                                                 1,
0039                                                 37,
0040                                                 18,
0041                                                 0,
0042                                                 18);
0043   alctShowerDataNomSummary_eff_ = iBooker.book2D("alct_cscshower_data_nom_summary_eff",
0044                                                  "Efficiency of data ALCT Nominal shower being correctly emulated",
0045                                                  36,
0046                                                  1,
0047                                                  37,
0048                                                  18,
0049                                                  0,
0050                                                  18);
0051   clctShowerDataNomSummary_eff_ = iBooker.book2D("clct_cscshower_data_nom_summary_eff",
0052                                                  "Efficiency of data CLCT Nominal shower being correctly emulated",
0053                                                  36,
0054                                                  1,
0055                                                  37,
0056                                                  18,
0057                                                  0,
0058                                                  18);
0059 
0060   lctShowerEmulNomSummary_eff_ = iBooker.book2D("lct_cscshower_emul_nom_summary_eff",
0061                                                 "Fraction of emulated LCT Nominal shower without matching data LCT",
0062                                                 36,
0063                                                 1,
0064                                                 37,
0065                                                 18,
0066                                                 0,
0067                                                 18);
0068   alctShowerEmulNomSummary_eff_ = iBooker.book2D("alct_cscshower_emul_nom_summary_eff",
0069                                                  "Fraction of emulated ALCT Nominal shower without matching data ALCT",
0070                                                  36,
0071                                                  1,
0072                                                  37,
0073                                                  18,
0074                                                  0,
0075                                                  18);
0076   clctShowerEmulNomSummary_eff_ = iBooker.book2D("clct_cscshower_emul_nom_summary_eff",
0077                                                  "Fraction of emulated CLCT Nominal shower without matching data CLCT",
0078                                                  36,
0079                                                  1,
0080                                                  37,
0081                                                  18,
0082                                                  0,
0083                                                  18);
0084 
0085   lctShowerDataTightSummary_eff_ = iBooker.book2D("lct_cscshower_data_tight_summary_eff",
0086                                                   "Efficiency of data LCT Tight shower being correctly emulated",
0087                                                   36,
0088                                                   1,
0089                                                   37,
0090                                                   18,
0091                                                   0,
0092                                                   18);
0093   alctShowerDataTightSummary_eff_ = iBooker.book2D("alct_cscshower_data_tight_summary_eff",
0094                                                    "Efficiency of data ALCT Tight shower being correctly emulated",
0095                                                    36,
0096                                                    1,
0097                                                    37,
0098                                                    18,
0099                                                    0,
0100                                                    18);
0101   clctShowerDataTightSummary_eff_ = iBooker.book2D("clct_cscshower_data_tight_summary_eff",
0102                                                    "Efficiency of data CLCT Tight shower being correctly emulated",
0103                                                    36,
0104                                                    1,
0105                                                    37,
0106                                                    18,
0107                                                    0,
0108                                                    18);
0109 
0110   lctShowerEmulTightSummary_eff_ = iBooker.book2D("lct_cscshower_emul_tight_summary_eff",
0111                                                   "Fraction of emulated LCT Tight shower without matching data LCT",
0112                                                   36,
0113                                                   1,
0114                                                   37,
0115                                                   18,
0116                                                   0,
0117                                                   18);
0118   alctShowerEmulTightSummary_eff_ = iBooker.book2D("alct_cscshower_emul_tight_summary_eff",
0119                                                    "Fraction of emulated ALCT Tight shower without matching data ALCT",
0120                                                    36,
0121                                                    1,
0122                                                    37,
0123                                                    18,
0124                                                    0,
0125                                                    18);
0126   clctShowerEmulTightSummary_eff_ = iBooker.book2D("clct_cscshower_emul_tight_summary_eff",
0127                                                    "Fraction of emulated CLCT Tight shower without matching data CLCT",
0128                                                    36,
0129                                                    1,
0130                                                    37,
0131                                                    18,
0132                                                    0,
0133                                                    18);
0134 
0135   // x labels
0136   lctShowerDataNomSummary_eff_->setAxisTitle("Chamber", 1);
0137   alctShowerDataNomSummary_eff_->setAxisTitle("Chamber", 1);
0138   clctShowerDataNomSummary_eff_->setAxisTitle("Chamber", 1);
0139 
0140   lctShowerEmulNomSummary_eff_->setAxisTitle("Chamber", 1);
0141   alctShowerEmulNomSummary_eff_->setAxisTitle("Chamber", 1);
0142   clctShowerEmulNomSummary_eff_->setAxisTitle("Chamber", 1);
0143 
0144   lctShowerDataTightSummary_eff_->setAxisTitle("Chamber", 1);
0145   alctShowerDataTightSummary_eff_->setAxisTitle("Chamber", 1);
0146   clctShowerDataTightSummary_eff_->setAxisTitle("Chamber", 1);
0147 
0148   lctShowerEmulTightSummary_eff_->setAxisTitle("Chamber", 1);
0149   alctShowerEmulTightSummary_eff_->setAxisTitle("Chamber", 1);
0150   clctShowerEmulTightSummary_eff_->setAxisTitle("Chamber", 1);
0151 
0152   // plotting option
0153   lctShowerDataNomSummary_eff_->setOption("colz");
0154   alctShowerDataNomSummary_eff_->setOption("colz");
0155   clctShowerDataNomSummary_eff_->setOption("colz");
0156 
0157   lctShowerEmulNomSummary_eff_->setOption("colz");
0158   alctShowerEmulNomSummary_eff_->setOption("colz");
0159   clctShowerEmulNomSummary_eff_->setOption("colz");
0160 
0161   lctShowerDataTightSummary_eff_->setOption("colz");
0162   alctShowerDataTightSummary_eff_->setOption("colz");
0163   clctShowerDataTightSummary_eff_->setOption("colz");
0164 
0165   lctShowerEmulTightSummary_eff_->setOption("colz");
0166   alctShowerEmulTightSummary_eff_->setOption("colz");
0167   clctShowerEmulTightSummary_eff_->setOption("colz");
0168 
0169   // summary plots
0170   const std::array<std::string, 9> suffix_label{{"4/2", "4/1", "3/2", "3/1", " 2/2", "2/1", "1/3", "1/2", "1/1"}};
0171 
0172   // y labels
0173   for (int ybin = 1; ybin <= 9; ++ybin) {
0174     lctShowerDataNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0175     alctShowerDataNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0176     clctShowerDataNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0177 
0178     lctShowerEmulNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0179     alctShowerEmulNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0180     clctShowerEmulNomSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0181 
0182     lctShowerDataNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0183     alctShowerDataNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0184     clctShowerDataNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0185 
0186     lctShowerEmulNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0187     alctShowerEmulNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0188     clctShowerEmulNomSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0189 
0190     lctShowerDataTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0191     alctShowerDataTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0192     clctShowerDataTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0193 
0194     lctShowerEmulTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0195     alctShowerEmulTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0196     clctShowerEmulTightSummary_eff_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0197 
0198     lctShowerDataTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0199     alctShowerDataTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0200     clctShowerDataTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0201 
0202     lctShowerEmulTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0203     alctShowerEmulTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0204     clctShowerEmulTightSummary_eff_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0205   }
0206 }
0207 
0208 void L1TdeCSCTPGShowerClient::processHistograms(DQMStore::IGetter &igetter) {
0209   MonitorElement *lctShowerDataNomSummary_denom_ = igetter.get(monitorDir_ + "/lct_cscshower_data_nom_summary_denom");
0210   MonitorElement *lctShowerDataNomSummary_num_ = igetter.get(monitorDir_ + "/lct_cscshower_data_nom_summary_num");
0211   MonitorElement *alctShowerDataNomSummary_denom_ = igetter.get(monitorDir_ + "/alct_cscshower_data_nom_summary_denom");
0212   MonitorElement *alctShowerDataNomSummary_num_ = igetter.get(monitorDir_ + "/alct_cscshower_data_nom_summary_num");
0213   MonitorElement *clctShowerDataNomSummary_denom_ = igetter.get(monitorDir_ + "/clct_cscshower_data_nom_summary_denom");
0214   MonitorElement *clctShowerDataNomSummary_num_ = igetter.get(monitorDir_ + "/clct_cscshower_data_nom_summary_num");
0215 
0216   if (lctShowerDataNomSummary_denom_ == nullptr or lctShowerDataNomSummary_num_ == nullptr or
0217       alctShowerDataNomSummary_denom_ == nullptr or alctShowerDataNomSummary_num_ == nullptr or
0218       clctShowerDataNomSummary_denom_ == nullptr or clctShowerDataNomSummary_num_ == nullptr) {
0219     edm::LogWarning("L1TdeCSCTPGShowerClient")
0220         << __PRETTY_FUNCTION__ << " could not load the necessary shower data histograms for harvesting";
0221     return;
0222   }
0223 
0224   MonitorElement *lctShowerEmulNomSummary_denom_ = igetter.get(monitorDir_ + "/lct_cscshower_emul_nom_summary_denom");
0225   MonitorElement *lctShowerEmulNomSummary_num_ = igetter.get(monitorDir_ + "/lct_cscshower_emul_nom_summary_num");
0226   MonitorElement *alctShowerEmulNomSummary_denom_ = igetter.get(monitorDir_ + "/alct_cscshower_emul_nom_summary_denom");
0227   MonitorElement *alctShowerEmulNomSummary_num_ = igetter.get(monitorDir_ + "/alct_cscshower_emul_nom_summary_num");
0228   MonitorElement *clctShowerEmulNomSummary_denom_ = igetter.get(monitorDir_ + "/clct_cscshower_emul_nom_summary_denom");
0229   MonitorElement *clctShowerEmulNomSummary_num_ = igetter.get(monitorDir_ + "/clct_cscshower_emul_nom_summary_num");
0230 
0231   if (lctShowerEmulNomSummary_denom_ == nullptr or lctShowerEmulNomSummary_num_ == nullptr or
0232       alctShowerEmulNomSummary_denom_ == nullptr or alctShowerEmulNomSummary_num_ == nullptr or
0233       clctShowerEmulNomSummary_denom_ == nullptr or clctShowerEmulNomSummary_num_ == nullptr) {
0234     edm::LogWarning("L1TdeCSCTPGShowerClient")
0235         << __PRETTY_FUNCTION__ << " could not load the necessary shower emulation histograms for harvesting";
0236     return;
0237   }
0238 
0239   MonitorElement *lctShowerDataTightSummary_denom_ =
0240       igetter.get(monitorDir_ + "/lct_cscshower_data_tight_summary_denom");
0241   MonitorElement *lctShowerDataTightSummary_num_ = igetter.get(monitorDir_ + "/lct_cscshower_data_tight_summary_num");
0242   MonitorElement *alctShowerDataTightSummary_denom_ =
0243       igetter.get(monitorDir_ + "/alct_cscshower_data_tight_summary_denom");
0244   MonitorElement *alctShowerDataTightSummary_num_ = igetter.get(monitorDir_ + "/alct_cscshower_data_tight_summary_num");
0245   MonitorElement *clctShowerDataTightSummary_denom_ =
0246       igetter.get(monitorDir_ + "/clct_cscshower_data_tight_summary_denom");
0247   MonitorElement *clctShowerDataTightSummary_num_ = igetter.get(monitorDir_ + "/clct_cscshower_data_tight_summary_num");
0248 
0249   if (lctShowerDataTightSummary_denom_ == nullptr or lctShowerDataTightSummary_num_ == nullptr or
0250       alctShowerDataTightSummary_denom_ == nullptr or alctShowerDataTightSummary_num_ == nullptr or
0251       clctShowerDataTightSummary_denom_ == nullptr or clctShowerDataTightSummary_num_ == nullptr) {
0252     edm::LogWarning("L1TdeCSCTPGShowerClient")
0253         << __PRETTY_FUNCTION__ << " could not load the necessary shower data (tight) histograms for harvesting";
0254     return;
0255   }
0256 
0257   MonitorElement *lctShowerEmulTightSummary_denom_ =
0258       igetter.get(monitorDir_ + "/lct_cscshower_emul_tight_summary_denom");
0259   MonitorElement *lctShowerEmulTightSummary_num_ = igetter.get(monitorDir_ + "/lct_cscshower_emul_tight_summary_num");
0260   MonitorElement *alctShowerEmulTightSummary_denom_ =
0261       igetter.get(monitorDir_ + "/alct_cscshower_emul_tight_summary_denom");
0262   MonitorElement *alctShowerEmulTightSummary_num_ = igetter.get(monitorDir_ + "/alct_cscshower_emul_tight_summary_num");
0263   MonitorElement *clctShowerEmulTightSummary_denom_ =
0264       igetter.get(monitorDir_ + "/clct_cscshower_emul_tight_summary_denom");
0265   MonitorElement *clctShowerEmulTightSummary_num_ = igetter.get(monitorDir_ + "/clct_cscshower_emul_tight_summary_num");
0266 
0267   if (lctShowerEmulTightSummary_denom_ == nullptr or lctShowerEmulTightSummary_num_ == nullptr or
0268       alctShowerEmulTightSummary_denom_ == nullptr or alctShowerEmulTightSummary_num_ == nullptr or
0269       clctShowerEmulTightSummary_denom_ == nullptr or clctShowerEmulTightSummary_num_ == nullptr) {
0270     edm::LogWarning("L1TdeCSCTPGShowerClient")
0271         << __PRETTY_FUNCTION__ << " could not load the necessary shower emulation (tight) histograms for harvesting";
0272     return;
0273   }
0274 
0275   lctShowerDataNomSummary_eff_->getTH2F()->Divide(
0276       lctShowerDataNomSummary_num_->getTH2F(), lctShowerDataNomSummary_denom_->getTH2F(), 1, 1, "");
0277   alctShowerDataNomSummary_eff_->getTH2F()->Divide(
0278       alctShowerDataNomSummary_num_->getTH2F(), alctShowerDataNomSummary_denom_->getTH2F(), 1, 1, "");
0279   clctShowerDataNomSummary_eff_->getTH2F()->Divide(
0280       clctShowerDataNomSummary_num_->getTH2F(), clctShowerDataNomSummary_denom_->getTH2F(), 1, 1, "");
0281 
0282   lctShowerEmulNomSummary_eff_->getTH2F()->Divide(
0283       lctShowerEmulNomSummary_num_->getTH2F(), lctShowerEmulNomSummary_denom_->getTH2F(), 1, 1, "");
0284   alctShowerEmulNomSummary_eff_->getTH2F()->Divide(
0285       alctShowerEmulNomSummary_num_->getTH2F(), alctShowerEmulNomSummary_denom_->getTH2F(), 1, 1, "");
0286   clctShowerEmulNomSummary_eff_->getTH2F()->Divide(
0287       clctShowerEmulNomSummary_num_->getTH2F(), clctShowerEmulNomSummary_denom_->getTH2F(), 1, 1, "");
0288 
0289   lctShowerDataTightSummary_eff_->getTH2F()->Divide(
0290       lctShowerDataTightSummary_num_->getTH2F(), lctShowerDataTightSummary_denom_->getTH2F(), 1, 1, "");
0291   alctShowerDataTightSummary_eff_->getTH2F()->Divide(
0292       alctShowerDataTightSummary_num_->getTH2F(), alctShowerDataTightSummary_denom_->getTH2F(), 1, 1, "");
0293   clctShowerDataTightSummary_eff_->getTH2F()->Divide(
0294       clctShowerDataTightSummary_num_->getTH2F(), clctShowerDataTightSummary_denom_->getTH2F(), 1, 1, "");
0295 
0296   lctShowerEmulTightSummary_eff_->getTH2F()->Divide(
0297       lctShowerEmulTightSummary_num_->getTH2F(), lctShowerEmulTightSummary_denom_->getTH2F(), 1, 1, "");
0298   alctShowerEmulTightSummary_eff_->getTH2F()->Divide(
0299       alctShowerEmulTightSummary_num_->getTH2F(), alctShowerEmulTightSummary_denom_->getTH2F(), 1, 1, "");
0300   clctShowerEmulTightSummary_eff_->getTH2F()->Divide(
0301       clctShowerEmulTightSummary_num_->getTH2F(), clctShowerEmulTightSummary_denom_->getTH2F(), 1, 1, "");
0302 
0303   lctShowerDataNomSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0304   alctShowerDataNomSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0305   clctShowerDataNomSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0306 
0307   lctShowerDataTightSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0308   alctShowerDataTightSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0309   clctShowerDataTightSummary_eff_->getTH2F()->GetZaxis()->SetRangeUser(0.95, 1);
0310 }