File indexing completed on 2024-04-06 12:09:53
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 usesResource("DQMStore");
0084 parameters_ = ps;
0085 initialize();
0086 }
0087
0088 DQMOfflineHLTEventInfoClient::~DQMOfflineHLTEventInfoClient() {
0089 if (verbose_)
0090 cout << "[TriggerDQM]: ending... " << endl;
0091 }
0092
0093
0094 void DQMOfflineHLTEventInfoClient::initialize() {
0095 counterLS_ = 0;
0096 counterEvt_ = 0;
0097
0098
0099 dbe_ = Service<DQMStore>().operator->();
0100
0101
0102 verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
0103
0104 prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
0105 if (verbose_)
0106 cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)" << endl;
0107
0108 prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
0109 if (verbose_)
0110 cout << "DQM event prescale = " << prescaleEvt_ << " events(s)" << endl;
0111
0112
0113 }
0114
0115
0116 void DQMOfflineHLTEventInfoClient::beginJob() {
0117 if (verbose_)
0118 cout << "[TriggerDQM]: Begin Job" << endl;
0119
0120 dbe_ = Service<DQMStore>().operator->();
0121
0122 dbe_->setCurrentFolder("HLT/EventInfo");
0123
0124 reportSummary_ = dbe_->bookFloat("reportSummary");
0125
0126 if (reportSummary_)
0127 reportSummary_->Fill(1);
0128
0129
0130 CertificationSummary_ = dbe_->bookFloat("CertificationSummary");
0131
0132 if (CertificationSummary_)
0133 CertificationSummary_->Fill(1);
0134
0135
0136 if (reportSummary_)
0137 reportSummary_->Fill(1);
0138
0139
0140
0141
0142 dbe_->setCurrentFolder("HLT/EventInfo");
0143
0144 reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 1, 1, 2, 6, 1, 7);
0145 reportSummaryMap_->setAxisTitle("", 1);
0146 reportSummaryMap_->setAxisTitle("", 2);
0147 reportSummaryMap_->setBinLabel(1, "Muon", 2);
0148 reportSummaryMap_->setBinLabel(2, "Electron", 2);
0149 reportSummaryMap_->setBinLabel(3, "Photon", 2);
0150 reportSummaryMap_->setBinLabel(4, "JetMET", 2);
0151 reportSummaryMap_->setBinLabel(5, "BJet", 2);
0152 reportSummaryMap_->setBinLabel(6, "Tau", 2);
0153 reportSummaryMap_->setBinLabel(1, " ", 1);
0154
0155 CertificationSummaryMap_ = dbe_->book2D("CertificationSummaryMap", "CertificationSummaryMap", 1, 1, 2, 6, 1, 7);
0156 CertificationSummaryMap_->setAxisTitle("", 1);
0157 CertificationSummaryMap_->setAxisTitle("", 2);
0158 CertificationSummaryMap_->setBinLabel(1, "Muon", 2);
0159 CertificationSummaryMap_->setBinLabel(2, "Electron", 2);
0160 CertificationSummaryMap_->setBinLabel(3, "Photon", 2);
0161 CertificationSummaryMap_->setBinLabel(4, "JetMET", 2);
0162 CertificationSummaryMap_->setBinLabel(5, "BJet", 2);
0163 CertificationSummaryMap_->setBinLabel(6, "Tau", 2);
0164 CertificationSummaryMap_->setBinLabel(1, " ", 1);
0165 }
0166
0167
0168 void DQMOfflineHLTEventInfoClient::beginRun(const Run& r, const EventSetup& context) {}
0169
0170
0171
0172
0173 void DQMOfflineHLTEventInfoClient::analyze(const Event& e, const EventSetup& context) {
0174 counterEvt_++;
0175 if (prescaleEvt_ < 1)
0176 return;
0177 if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
0178 return;
0179
0180 if (verbose_)
0181 cout << "DQMOfflineHLTEventInfoClient::analyze" << endl;
0182 }
0183
0184
0185 void DQMOfflineHLTEventInfoClient::endRun(const Run& r, const EventSetup& context) {
0186 float summarySum = 0;
0187 float reportSummary = 0;
0188
0189 dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
0190 MonitorElement* HLT_Muon = dbe_->get("HLT_Muon");
0191 if (HLT_Muon)
0192 reportSummaryContent_.push_back(HLT_Muon);
0193
0194 MonitorElement* HLT_Electron = dbe_->get("HLT_Electron");
0195 if (HLT_Electron)
0196 reportSummaryContent_.push_back(HLT_Electron);
0197
0198 MonitorElement* HLT_Photon = dbe_->get("HLT_Photon");
0199 if (HLT_Photon)
0200 reportSummaryContent_.push_back(HLT_Photon);
0201
0202 MonitorElement* HLT_Tau = dbe_->get("HLT_Tau");
0203 if (HLT_Tau)
0204 reportSummaryContent_.push_back(HLT_Tau);
0205
0206 int nSubsystems = reportSummaryContent_.size();
0207
0208 for (int m = 0; m < nSubsystems; m++) {
0209 summarySum += (reportSummaryContent_[m])->getFloatValue();
0210 }
0211
0212 if (nSubsystems > 0) {
0213 reportSummary = summarySum / nSubsystems;
0214 ;
0215 } else {
0216 reportSummary = 1;
0217 }
0218
0219 reportSummary_->Fill(reportSummary);
0220 CertificationSummary_->Fill(reportSummary);
0221
0222 float muonValue = 1;
0223 if (HLT_Muon)
0224 muonValue = HLT_Muon->getFloatValue();
0225
0226 float electronValue = 1;
0227 if (HLT_Electron)
0228 electronValue = HLT_Electron->getFloatValue();
0229
0230 float photonValue = 1;
0231 if (HLT_Photon)
0232 photonValue = HLT_Photon->getFloatValue();
0233
0234 float tauValue = 1;
0235 if (HLT_Tau)
0236 tauValue = HLT_Tau->getFloatValue();
0237
0238 reportSummaryMap_->setBinContent(1, 1, muonValue);
0239 reportSummaryMap_->setBinContent(1, 2, electronValue);
0240 reportSummaryMap_->setBinContent(1, 3, photonValue);
0241 reportSummaryMap_->setBinContent(1, 4, 1);
0242 reportSummaryMap_->setBinContent(1, 5, 1);
0243 reportSummaryMap_->setBinContent(1, 6, tauValue);
0244
0245 CertificationSummaryMap_->setBinContent(1, 1, muonValue);
0246 CertificationSummaryMap_->setBinContent(1, 2, electronValue);
0247 CertificationSummaryMap_->setBinContent(1, 3, photonValue);
0248 CertificationSummaryMap_->setBinContent(1, 4, 1);
0249 CertificationSummaryMap_->setBinContent(1, 5, 1);
0250 CertificationSummaryMap_->setBinContent(1, 6, tauValue);
0251 }
0252
0253 #include "FWCore/Framework/interface/MakerMacros.h"
0254 DEFINE_FWK_MODULE(DQMOfflineHLTEventInfoClient);