File indexing completed on 2021-02-14 13:13:22
0001 #include "DQMOffline/Trigger/interface/DQMOfflineHLTEventInfoClient.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 <cstdio>
0010 #include <sstream>
0011 #include <cmath>
0012 #include <TProfile.h>
0013 #include <TProfile2D.h>
0014 #include <memory>
0015 #include <iostream>
0016 #include <iomanip>
0017 #include <map>
0018 #include <vector>
0019 #include <string>
0020 #include <fstream>
0021 #include "TROOT.h"
0022 #include "TRandom.h"
0023 #include <TH1F.h>
0024 #include <TH2F.h>
0025
0026 using namespace edm;
0027 using namespace std;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 DQMOfflineHLTEventInfoClient::DQMOfflineHLTEventInfoClient(const edm::ParameterSet& ps) {
0083 parameters_ = ps;
0084 initialize();
0085 }
0086
0087 DQMOfflineHLTEventInfoClient::~DQMOfflineHLTEventInfoClient() {
0088 if (verbose_)
0089 cout << "[TriggerDQM]: ending... " << endl;
0090 }
0091
0092
0093 void DQMOfflineHLTEventInfoClient::initialize() {
0094 counterLS_ = 0;
0095 counterEvt_ = 0;
0096
0097
0098 dbe_ = Service<DQMStore>().operator->();
0099
0100
0101 verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
0102
0103 prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
0104 if (verbose_)
0105 cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)" << endl;
0106
0107 prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
0108 if (verbose_)
0109 cout << "DQM event prescale = " << prescaleEvt_ << " events(s)" << endl;
0110
0111
0112 }
0113
0114
0115 void DQMOfflineHLTEventInfoClient::beginJob() {
0116 if (verbose_)
0117 cout << "[TriggerDQM]: Begin Job" << endl;
0118
0119 dbe_ = Service<DQMStore>().operator->();
0120
0121 dbe_->setCurrentFolder("HLT/EventInfo");
0122
0123 reportSummary_ = dbe_->bookFloat("reportSummary");
0124
0125 if (reportSummary_)
0126 reportSummary_->Fill(1);
0127
0128
0129 CertificationSummary_ = dbe_->bookFloat("CertificationSummary");
0130
0131 if (CertificationSummary_)
0132 CertificationSummary_->Fill(1);
0133
0134
0135 if (reportSummary_)
0136 reportSummary_->Fill(1);
0137
0138
0139
0140
0141 dbe_->setCurrentFolder("HLT/EventInfo");
0142
0143 reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 1, 1, 2, 6, 1, 7);
0144 reportSummaryMap_->setAxisTitle("", 1);
0145 reportSummaryMap_->setAxisTitle("", 2);
0146 reportSummaryMap_->setBinLabel(1, "Muon", 2);
0147 reportSummaryMap_->setBinLabel(2, "Electron", 2);
0148 reportSummaryMap_->setBinLabel(3, "Photon", 2);
0149 reportSummaryMap_->setBinLabel(4, "JetMET", 2);
0150 reportSummaryMap_->setBinLabel(5, "BJet", 2);
0151 reportSummaryMap_->setBinLabel(6, "Tau", 2);
0152 reportSummaryMap_->setBinLabel(1, " ", 1);
0153
0154 CertificationSummaryMap_ = dbe_->book2D("CertificationSummaryMap", "CertificationSummaryMap", 1, 1, 2, 6, 1, 7);
0155 CertificationSummaryMap_->setAxisTitle("", 1);
0156 CertificationSummaryMap_->setAxisTitle("", 2);
0157 CertificationSummaryMap_->setBinLabel(1, "Muon", 2);
0158 CertificationSummaryMap_->setBinLabel(2, "Electron", 2);
0159 CertificationSummaryMap_->setBinLabel(3, "Photon", 2);
0160 CertificationSummaryMap_->setBinLabel(4, "JetMET", 2);
0161 CertificationSummaryMap_->setBinLabel(5, "BJet", 2);
0162 CertificationSummaryMap_->setBinLabel(6, "Tau", 2);
0163 CertificationSummaryMap_->setBinLabel(1, " ", 1);
0164 }
0165
0166
0167 void DQMOfflineHLTEventInfoClient::beginRun(const Run& r, const EventSetup& context) {}
0168
0169
0170
0171
0172 void DQMOfflineHLTEventInfoClient::analyze(const Event& e, const EventSetup& context) {
0173 counterEvt_++;
0174 if (prescaleEvt_ < 1)
0175 return;
0176 if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
0177 return;
0178
0179 if (verbose_)
0180 cout << "DQMOfflineHLTEventInfoClient::analyze" << endl;
0181 }
0182
0183
0184 void DQMOfflineHLTEventInfoClient::endRun(const Run& r, const EventSetup& context) {
0185 float summarySum = 0;
0186 float reportSummary = 0;
0187
0188 dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
0189 MonitorElement* HLT_Muon = dbe_->get("HLT_Muon");
0190 if (HLT_Muon)
0191 reportSummaryContent_.push_back(HLT_Muon);
0192
0193 MonitorElement* HLT_Electron = dbe_->get("HLT_Electron");
0194 if (HLT_Electron)
0195 reportSummaryContent_.push_back(HLT_Electron);
0196
0197 MonitorElement* HLT_Photon = dbe_->get("HLT_Photon");
0198 if (HLT_Photon)
0199 reportSummaryContent_.push_back(HLT_Photon);
0200
0201 MonitorElement* HLT_Tau = dbe_->get("HLT_Tau");
0202 if (HLT_Tau)
0203 reportSummaryContent_.push_back(HLT_Tau);
0204
0205 int nSubsystems = reportSummaryContent_.size();
0206
0207 for (int m = 0; m < nSubsystems; m++) {
0208 summarySum += (reportSummaryContent_[m])->getFloatValue();
0209 }
0210
0211 if (nSubsystems > 0) {
0212 reportSummary = summarySum / nSubsystems;
0213 ;
0214 } else {
0215 reportSummary = 1;
0216 }
0217
0218 reportSummary_->Fill(reportSummary);
0219 CertificationSummary_->Fill(reportSummary);
0220
0221 float muonValue = 1;
0222 if (HLT_Muon)
0223 muonValue = HLT_Muon->getFloatValue();
0224
0225 float electronValue = 1;
0226 if (HLT_Electron)
0227 electronValue = HLT_Electron->getFloatValue();
0228
0229 float photonValue = 1;
0230 if (HLT_Photon)
0231 photonValue = HLT_Photon->getFloatValue();
0232
0233 float tauValue = 1;
0234 if (HLT_Tau)
0235 tauValue = HLT_Tau->getFloatValue();
0236
0237 reportSummaryMap_->setBinContent(1, 1, muonValue);
0238 reportSummaryMap_->setBinContent(1, 2, electronValue);
0239 reportSummaryMap_->setBinContent(1, 3, photonValue);
0240 reportSummaryMap_->setBinContent(1, 4, 1);
0241 reportSummaryMap_->setBinContent(1, 5, 1);
0242 reportSummaryMap_->setBinContent(1, 6, tauValue);
0243
0244 CertificationSummaryMap_->setBinContent(1, 1, muonValue);
0245 CertificationSummaryMap_->setBinContent(1, 2, electronValue);
0246 CertificationSummaryMap_->setBinContent(1, 3, photonValue);
0247 CertificationSummaryMap_->setBinContent(1, 4, 1);
0248 CertificationSummaryMap_->setBinContent(1, 5, 1);
0249 CertificationSummaryMap_->setBinContent(1, 6, tauValue);
0250 }