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 
62  void endJob();
63 
64 private:
65 
66  void initialize();
67  edm::ParameterSet parameters_;
68 
69  DQMStore* dbe_;
70  bool verbose_;
71  int counterLS_; ///counter
72  int counterEvt_; ///counter
73  int prescaleLS_; ///units of lumi sections
74  int prescaleEvt_; ///prescale on number of events
75  // -------- member data --------
76 
77  MonitorElement * reportSummary_;
78  std::vector<MonitorElement*> reportSummaryContent_;
79  MonitorElement * reportSummaryMap_;
80 
81 
82 };
83 */
84 
86  parameters_ = ps;
87  initialize();
88 }
89 
91  if (verbose_)
92  cout << "[TriggerDQM]: ending... " << endl;
93 }
94 
95 //--------------------------------------------------------
97  counterLS_ = 0;
98  counterEvt_ = 0;
99 
100  // get back-end interface
101  dbe_ = Service<DQMStore>().operator->();
102 
103  // base folder for the contents of this job
104  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
105 
106  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
107  if (verbose_)
108  cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)" << endl;
109 
110  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
111  if (verbose_)
112  cout << "DQM event prescale = " << prescaleEvt_ << " events(s)" << endl;
113  /*
114  */
115 }
116 
117 //--------------------------------------------------------
119  if (verbose_)
120  cout << "[TriggerDQM]: Begin Job" << endl;
121  // get backendinterface
122  dbe_ = Service<DQMStore>().operator->();
123 
124  dbe_->setCurrentFolder("HLT/EventInfo");
125 
126  reportSummary_ = dbe_->bookFloat("reportSummary");
127  //initialize reportSummary to 1
128  if (reportSummary_)
129  reportSummary_->Fill(1);
130 
131  // CertificationSummary
132  CertificationSummary_ = dbe_->bookFloat("CertificationSummary");
133  //initialize CertificationSummary to 1
134  if (CertificationSummary_)
135  CertificationSummary_->Fill(1);
136 
137  //initialize reportSummary to 1
138  if (reportSummary_)
139  reportSummary_->Fill(1);
140 
141  // OK HERE
142 
143  // reportSummaryMap
144  dbe_->setCurrentFolder("HLT/EventInfo");
145 
146  reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 1, 1, 2, 6, 1, 7);
147  reportSummaryMap_->setAxisTitle("", 1);
148  reportSummaryMap_->setAxisTitle("", 2);
149  reportSummaryMap_->setBinLabel(1, "Muon", 2);
150  reportSummaryMap_->setBinLabel(2, "Electron", 2);
151  reportSummaryMap_->setBinLabel(3, "Photon", 2);
152  reportSummaryMap_->setBinLabel(4, "JetMET", 2);
153  reportSummaryMap_->setBinLabel(5, "BJet", 2);
154  reportSummaryMap_->setBinLabel(6, "Tau", 2);
155  reportSummaryMap_->setBinLabel(1, " ", 1);
156 
157  CertificationSummaryMap_ = dbe_->book2D("CertificationSummaryMap", "CertificationSummaryMap", 1, 1, 2, 6, 1, 7);
158  CertificationSummaryMap_->setAxisTitle("", 1);
159  CertificationSummaryMap_->setAxisTitle("", 2);
160  CertificationSummaryMap_->setBinLabel(1, "Muon", 2);
161  CertificationSummaryMap_->setBinLabel(2, "Electron", 2);
162  CertificationSummaryMap_->setBinLabel(3, "Photon", 2);
163  CertificationSummaryMap_->setBinLabel(4, "JetMET", 2);
164  CertificationSummaryMap_->setBinLabel(5, "BJet", 2);
165  CertificationSummaryMap_->setBinLabel(6, "Tau", 2);
166  CertificationSummaryMap_->setBinLabel(1, " ", 1);
167 }
168 
169 //--------------------------------------------------------
171 
172 //--------------------------------------------------------
173 
174 //--------------------------------------------------------
176  counterEvt_++;
177  if (prescaleEvt_ < 1)
178  return;
179  if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
180  return;
181 
182  if (verbose_)
183  cout << "DQMOfflineHLTEventInfoClient::analyze" << endl;
184 }
185 
186 //--------------------------------------------------------
187 void DQMOfflineHLTEventInfoClient::endRun(const Run& r, const EventSetup& context) {
188  float summarySum = 0;
189  float reportSummary = 0;
190 
191  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
192  MonitorElement* HLT_Muon = dbe_->get("HLT_Muon");
193  if (HLT_Muon)
194  reportSummaryContent_.push_back(HLT_Muon);
195 
196  MonitorElement* HLT_Electron = dbe_->get("HLT_Electron");
197  if (HLT_Electron)
198  reportSummaryContent_.push_back(HLT_Electron);
199 
200  MonitorElement* HLT_Photon = dbe_->get("HLT_Photon");
201  if (HLT_Photon)
202  reportSummaryContent_.push_back(HLT_Photon);
203 
204  MonitorElement* HLT_Tau = dbe_->get("HLT_Tau");
205  if (HLT_Tau)
206  reportSummaryContent_.push_back(HLT_Tau);
207 
208  int nSubsystems = reportSummaryContent_.size();
209 
210  for (int m = 0; m < nSubsystems; m++) {
211  summarySum += (reportSummaryContent_[m])->getFloatValue();
212  }
213 
214  if (nSubsystems > 0) {
215  reportSummary = summarySum / nSubsystems;
216  ;
217  } else {
218  reportSummary = 1;
219  }
220 
221  reportSummary_->Fill(reportSummary);
222  CertificationSummary_->Fill(reportSummary);
223 
224  float muonValue = 1;
225  if (HLT_Muon)
226  muonValue = HLT_Muon->getFloatValue();
227 
228  float electronValue = 1;
229  if (HLT_Electron)
230  electronValue = HLT_Electron->getFloatValue();
231 
232  float photonValue = 1;
233  if (HLT_Photon)
234  photonValue = HLT_Photon->getFloatValue();
235 
236  float tauValue = 1;
237  if (HLT_Tau)
238  tauValue = HLT_Tau->getFloatValue();
239 
240  reportSummaryMap_->setBinContent(1, 1, muonValue); //Muon
241  reportSummaryMap_->setBinContent(1, 2, electronValue); //Electron
242  reportSummaryMap_->setBinContent(1, 3, photonValue); //Photon
243  reportSummaryMap_->setBinContent(1, 4, 1); //JetMET
244  reportSummaryMap_->setBinContent(1, 5, 1); //BJet
245  reportSummaryMap_->setBinContent(1, 6, tauValue); //Tau
246 
247  CertificationSummaryMap_->setBinContent(1, 1, muonValue); //Muon
248  CertificationSummaryMap_->setBinContent(1, 2, electronValue); //Electron
249  CertificationSummaryMap_->setBinContent(1, 3, photonValue); //Photon
250  CertificationSummaryMap_->setBinContent(1, 4, 1); //JetMET
251  CertificationSummaryMap_->setBinContent(1, 5, 1); //BJet
252  CertificationSummaryMap_->setBinContent(1, 6, tauValue); //Tau
253 }
254 
255 //--------------------------------------------------------
MessageLogger.h
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
ESHandle.h
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DQMOfflineHLTEventInfoClient::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Fake Analyze.
Definition: DQMOfflineHLTEventInfoClient.cc:175
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
DQMOfflineHLTEventInfoClient::beginJob
void beginJob() override
BeginJob.
Definition: DQMOfflineHLTEventInfoClient.cc:118
DQMOfflineHLTEventInfoClient::endJob
void endJob() override
Endjob.
Definition: DQMOfflineHLTEventInfoClient.cc:256
Service.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
dbe_
dqm::legacy::DQMStore * dbe_
Definition: PFJetBenchmarkAnalyzer.cc:77
dqm::impl::MonitorElement::getFloatValue
virtual double getFloatValue() const
Definition: MonitorElement.cc:917
edm::ParameterSet
Definition: ParameterSet.h:36
DQMOfflineHLTEventInfoClient::~DQMOfflineHLTEventInfoClient
~DQMOfflineHLTEventInfoClient() override
Destructor.
Definition: DQMOfflineHLTEventInfoClient.cc:90
edm::Service
Definition: Service.h:30
DQMOfflineHLTEventInfoClient::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
Definition: DQMOfflineHLTEventInfoClient.cc:170
edm::EventSetup
Definition: EventSetup.h:57
DQMOfflineHLTEventInfoClient::initialize
void initialize()
Definition: DQMOfflineHLTEventInfoClient.cc:96
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
EventSetup.h
DQMOfflineHLTEventInfoClient.h
DQMOfflineHLTEventInfoClient::endRun
void endRun(const edm::Run &r, const edm::EventSetup &c) override
EndRun.
Definition: DQMOfflineHLTEventInfoClient.cc:187
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
ParameterSet.h
DQMOfflineHLTEventInfoClient::DQMOfflineHLTEventInfoClient
DQMOfflineHLTEventInfoClient(const edm::ParameterSet &ps)
Constructor.
Definition: DQMOfflineHLTEventInfoClient.cc:85
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37