CMS 3D CMS Logo

DQMOfflineHLTEventInfoClient.cc
Go to the documentation of this file.
2 
9 #include <cstdio>
10 #include <sstream>
11 #include <cmath>
12 #include <TProfile.h>
13 #include <TProfile2D.h>
14 #include <memory>
15 #include <iostream>
16 #include <iomanip>
17 #include <map>
18 #include <vector>
19 #include <string>
20 #include <fstream>
21 #include "TROOT.h"
22 #include "TRandom.h"
23 #include <TH1F.h>
24 #include <TH2F.h>
25 
26 using namespace edm;
27 using namespace std;
28 
29 /*
30 class DQMOfflineHLTEventInfoClient: public edm::EDAnalyzer {
31 
32 public:
33 
35  DQMOfflineHLTEventInfoClient(const edm::ParameterSet& ps);
36 
38  virtual ~DQMOfflineHLTEventInfoClient();
39 
40 protected:
41 
43  void beginJob();
44 
46  void beginRun(const edm::Run& r, const edm::EventSetup& c);
47 
49  void analyze(const edm::Event& e, const edm::EventSetup& c) ;
50 
51  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
52  const edm::EventSetup& context) ;
53 
55  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
56  const edm::EventSetup& c);
57 
59  void endRun(const edm::Run& r, const edm::EventSetup& c);
60 
61 private:
62 
63  void initialize();
64  edm::ParameterSet parameters_;
65 
66  DQMStore* dbe_;
67  bool verbose_;
68  int counterLS_; ///counter
69  int counterEvt_; ///counter
70  int prescaleLS_; ///units of lumi sections
71  int prescaleEvt_; ///prescale on number of events
72  // -------- member data --------
73 
74  MonitorElement * reportSummary_;
75  std::vector<MonitorElement*> reportSummaryContent_;
76  MonitorElement * reportSummaryMap_;
77 
78 
79 };
80 */
81 
83  parameters_ = ps;
84  initialize();
85 }
86 
88  if (verbose_)
89  cout << "[TriggerDQM]: ending... " << endl;
90 }
91 
92 //--------------------------------------------------------
94  counterLS_ = 0;
95  counterEvt_ = 0;
96 
97  // get back-end interface
98  dbe_ = Service<DQMStore>().operator->();
99 
100  // base folder for the contents of this job
101  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
102 
103  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
104  if (verbose_)
105  cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)" << endl;
106 
107  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
108  if (verbose_)
109  cout << "DQM event prescale = " << prescaleEvt_ << " events(s)" << endl;
110  /*
111  */
112 }
113 
114 //--------------------------------------------------------
116  if (verbose_)
117  cout << "[TriggerDQM]: Begin Job" << endl;
118  // get backendinterface
119  dbe_ = Service<DQMStore>().operator->();
120 
121  dbe_->setCurrentFolder("HLT/EventInfo");
122 
123  reportSummary_ = dbe_->bookFloat("reportSummary");
124  //initialize reportSummary to 1
125  if (reportSummary_)
126  reportSummary_->Fill(1);
127 
128  // CertificationSummary
129  CertificationSummary_ = dbe_->bookFloat("CertificationSummary");
130  //initialize CertificationSummary to 1
131  if (CertificationSummary_)
132  CertificationSummary_->Fill(1);
133 
134  //initialize reportSummary to 1
135  if (reportSummary_)
136  reportSummary_->Fill(1);
137 
138  // OK HERE
139 
140  // reportSummaryMap
141  dbe_->setCurrentFolder("HLT/EventInfo");
142 
143  reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 1, 1, 2, 6, 1, 7);
144  reportSummaryMap_->setAxisTitle("", 1);
145  reportSummaryMap_->setAxisTitle("", 2);
146  reportSummaryMap_->setBinLabel(1, "Muon", 2);
147  reportSummaryMap_->setBinLabel(2, "Electron", 2);
148  reportSummaryMap_->setBinLabel(3, "Photon", 2);
149  reportSummaryMap_->setBinLabel(4, "JetMET", 2);
150  reportSummaryMap_->setBinLabel(5, "BJet", 2);
151  reportSummaryMap_->setBinLabel(6, "Tau", 2);
152  reportSummaryMap_->setBinLabel(1, " ", 1);
153 
154  CertificationSummaryMap_ = dbe_->book2D("CertificationSummaryMap", "CertificationSummaryMap", 1, 1, 2, 6, 1, 7);
155  CertificationSummaryMap_->setAxisTitle("", 1);
156  CertificationSummaryMap_->setAxisTitle("", 2);
157  CertificationSummaryMap_->setBinLabel(1, "Muon", 2);
158  CertificationSummaryMap_->setBinLabel(2, "Electron", 2);
159  CertificationSummaryMap_->setBinLabel(3, "Photon", 2);
160  CertificationSummaryMap_->setBinLabel(4, "JetMET", 2);
161  CertificationSummaryMap_->setBinLabel(5, "BJet", 2);
162  CertificationSummaryMap_->setBinLabel(6, "Tau", 2);
163  CertificationSummaryMap_->setBinLabel(1, " ", 1);
164 }
165 
166 //--------------------------------------------------------
168 
169 //--------------------------------------------------------
170 
171 //--------------------------------------------------------
173  counterEvt_++;
174  if (prescaleEvt_ < 1)
175  return;
176  if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
177  return;
178 
179  if (verbose_)
180  cout << "DQMOfflineHLTEventInfoClient::analyze" << endl;
181 }
182 
183 //--------------------------------------------------------
185  float summarySum = 0;
186  float reportSummary = 0;
187 
188  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
189  MonitorElement* HLT_Muon = dbe_->get("HLT_Muon");
190  if (HLT_Muon)
191  reportSummaryContent_.push_back(HLT_Muon);
192 
193  MonitorElement* HLT_Electron = dbe_->get("HLT_Electron");
194  if (HLT_Electron)
195  reportSummaryContent_.push_back(HLT_Electron);
196 
197  MonitorElement* HLT_Photon = dbe_->get("HLT_Photon");
198  if (HLT_Photon)
199  reportSummaryContent_.push_back(HLT_Photon);
200 
201  MonitorElement* HLT_Tau = dbe_->get("HLT_Tau");
202  if (HLT_Tau)
203  reportSummaryContent_.push_back(HLT_Tau);
204 
205  int nSubsystems = reportSummaryContent_.size();
206 
207  for (int m = 0; m < nSubsystems; m++) {
208  summarySum += (reportSummaryContent_[m])->getFloatValue();
209  }
210 
211  if (nSubsystems > 0) {
212  reportSummary = summarySum / nSubsystems;
213  ;
214  } else {
215  reportSummary = 1;
216  }
217 
218  reportSummary_->Fill(reportSummary);
219  CertificationSummary_->Fill(reportSummary);
220 
221  float muonValue = 1;
222  if (HLT_Muon)
223  muonValue = HLT_Muon->getFloatValue();
224 
225  float electronValue = 1;
226  if (HLT_Electron)
227  electronValue = HLT_Electron->getFloatValue();
228 
229  float photonValue = 1;
230  if (HLT_Photon)
231  photonValue = HLT_Photon->getFloatValue();
232 
233  float tauValue = 1;
234  if (HLT_Tau)
235  tauValue = HLT_Tau->getFloatValue();
236 
237  reportSummaryMap_->setBinContent(1, 1, muonValue); //Muon
238  reportSummaryMap_->setBinContent(1, 2, electronValue); //Electron
239  reportSummaryMap_->setBinContent(1, 3, photonValue); //Photon
240  reportSummaryMap_->setBinContent(1, 4, 1); //JetMET
241  reportSummaryMap_->setBinContent(1, 5, 1); //BJet
242  reportSummaryMap_->setBinContent(1, 6, tauValue); //Tau
243 
244  CertificationSummaryMap_->setBinContent(1, 1, muonValue); //Muon
245  CertificationSummaryMap_->setBinContent(1, 2, electronValue); //Electron
246  CertificationSummaryMap_->setBinContent(1, 3, photonValue); //Photon
247  CertificationSummaryMap_->setBinContent(1, 4, 1); //JetMET
248  CertificationSummaryMap_->setBinContent(1, 5, 1); //BJet
249  CertificationSummaryMap_->setBinContent(1, 6, tauValue); //Tau
250 }
static AlgebraicMatrix initialize()
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
void endRun(const edm::Run &r, const edm::EventSetup &c) override
EndRun.
void Fill(long long x)
DQMOfflineHLTEventInfoClient(const edm::ParameterSet &ps)
Constructor.
virtual double getFloatValue() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Fake Analyze.
HLT enums.
Definition: Run.h:45
~DQMOfflineHLTEventInfoClient() override
Destructor.