test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMOfflineHLTEventInfoClient.cc
Go to the documentation of this file.
2 
11 #include <stdio.h>
12 #include <sstream>
13 #include <math.h>
14 #include <TProfile.h>
15 #include <TProfile2D.h>
16 #include <memory>
17 #include <iostream>
18 #include <iomanip>
19 #include <map>
20 #include <vector>
21 #include <string>
22 #include <fstream>
23 #include "TROOT.h"
24 #include "TRandom.h"
25 #include <TH1F.h>
26 #include <TH2F.h>
27 
28 using namespace edm;
29 using namespace std;
30 
31 /*
32 class DQMOfflineHLTEventInfoClient: public edm::EDAnalyzer {
33 
34 public:
35 
37  DQMOfflineHLTEventInfoClient(const edm::ParameterSet& ps);
38 
40  virtual ~DQMOfflineHLTEventInfoClient();
41 
42 protected:
43 
45  void beginJob();
46 
48  void beginRun(const edm::Run& r, const edm::EventSetup& c);
49 
51  void analyze(const edm::Event& e, const edm::EventSetup& c) ;
52 
53  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
54  const edm::EventSetup& context) ;
55 
57  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
58  const edm::EventSetup& c);
59 
61  void endRun(const edm::Run& r, const edm::EventSetup& c);
62 
64  void endJob();
65 
66 private:
67 
68  void initialize();
69  edm::ParameterSet parameters_;
70 
71  DQMStore* dbe_;
72  bool verbose_;
73  int counterLS_; ///counter
74  int counterEvt_; ///counter
75  int prescaleLS_; ///units of lumi sections
76  int prescaleEvt_; ///prescale on number of events
77  // -------- member data --------
78 
79  MonitorElement * reportSummary_;
80  std::vector<MonitorElement*> reportSummaryContent_;
81  MonitorElement * reportSummaryMap_;
82 
83 
84 };
85 */
86 
87 
89 {
90  parameters_=ps;
91  initialize();
92 }
93 
95  if(verbose_) cout <<"[TriggerDQM]: ending... " << endl;
96 }
97 
98 //--------------------------------------------------------
100 
101  counterLS_=0;
102  counterEvt_=0;
103 
104  // get back-end interface
106 
107  // base folder for the contents of this job
108  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
109 
110  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
111  if(verbose_) cout << "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
112 
113  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
114  if(verbose_) cout << "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
115  /*
116  */
117 
118 }
119 
120 //--------------------------------------------------------
122 
123  if(verbose_) cout <<"[TriggerDQM]: Begin Job" << endl;
124  // get backendinterface
126 
127  dbe_->setCurrentFolder("HLT/EventInfo");
128 
129  // reportSummary
130  reportSummary_ = dbe_->get("HLT/EventInfo/reportSummary");
131 
132  if ( reportSummary_ ) {
133  dbe_->removeElement(reportSummary_->getName());
134  }
135 
136  reportSummary_ = dbe_->bookFloat("reportSummary");
137  //initialize reportSummary to 1
138  if (reportSummary_) reportSummary_->Fill(1);
139 
140  // CertificationSummary
141  CertificationSummary_ = dbe_->get("HLT/EventInfo/CertificationSummary");
142 
143  if ( CertificationSummary_ ) {
144  dbe_->removeElement(CertificationSummary_->getName());
145  }
146 
147  CertificationSummary_ = dbe_->bookFloat("CertificationSummary");
148  //initialize CertificationSummary to 1
149  if (CertificationSummary_) CertificationSummary_->Fill(1);
150 
151  //initialize reportSummary to 1
152  if (reportSummary_) reportSummary_->Fill(1);
153 
154  // OK HERE
155 
156  // reportSummaryMap
157  dbe_->setCurrentFolder("HLT/EventInfo");
158 
159  reportSummaryMap_ = dbe_->get("HLT/EventInfo/reportSummaryMap");
160  if ( reportSummaryMap_ ) {
161  dbe_->removeElement(reportSummaryMap_->getName());
162  }
163 
164 
165  reportSummaryMap_ = dbe_->book2D("reportSummaryMap", "reportSummaryMap", 1, 1, 2, 6, 1, 7);
166  reportSummaryMap_->setAxisTitle("", 1);
167  reportSummaryMap_->setAxisTitle("", 2);
168  reportSummaryMap_->setBinLabel(1,"Muon",2);
169  reportSummaryMap_->setBinLabel(2,"Electron",2);
170  reportSummaryMap_->setBinLabel(3,"Photon",2);
171  reportSummaryMap_->setBinLabel(4,"JetMET",2);
172  reportSummaryMap_->setBinLabel(5,"BJet",2);
173  reportSummaryMap_->setBinLabel(6,"Tau",2);
174  reportSummaryMap_->setBinLabel(1," ",1);
175 
176 
177  CertificationSummaryMap_ = dbe_->get("HLT/EventInfo/CertificationSummaryMap");
178  if ( CertificationSummaryMap_ ) {
179  dbe_->removeElement(CertificationSummaryMap_->getName());
180  }
181 
182 
183  CertificationSummaryMap_ = dbe_->book2D("CertificationSummaryMap", "CertificationSummaryMap", 1, 1, 2, 6, 1, 7);
184  CertificationSummaryMap_->setAxisTitle("", 1);
185  CertificationSummaryMap_->setAxisTitle("", 2);
186  CertificationSummaryMap_->setBinLabel(1,"Muon",2);
187  CertificationSummaryMap_->setBinLabel(2,"Electron",2);
188  CertificationSummaryMap_->setBinLabel(3,"Photon",2);
189  CertificationSummaryMap_->setBinLabel(4,"JetMET",2);
190  CertificationSummaryMap_->setBinLabel(5,"BJet",2);
191  CertificationSummaryMap_->setBinLabel(6,"Tau",2);
192  CertificationSummaryMap_->setBinLabel(1," ",1);
193 
194 }
195 
196 //--------------------------------------------------------
198 }
199 
200 //--------------------------------------------------------
202  // optionally reset histograms here
203 }
204 
206  const edm::EventSetup& c){
207 }
208 
209 //--------------------------------------------------------
211 
212  counterEvt_++;
213  if (prescaleEvt_<1) return;
214  if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
215 
216  if(verbose_) cout << "DQMOfflineHLTEventInfoClient::analyze" << endl;
217 
218 
219 }
220 
221 //--------------------------------------------------------
223 
224  float summarySum = 0;
225  float reportSummary = 0;
226 
227  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents");
228  MonitorElement* HLT_Muon = dbe_->get("HLT_Muon");
229  if(HLT_Muon) reportSummaryContent_.push_back(HLT_Muon);
230 
231  MonitorElement * HLT_Electron = dbe_->get("HLT_Electron");
232  if(HLT_Electron) reportSummaryContent_.push_back(HLT_Electron);
233 
234  MonitorElement * HLT_Photon = dbe_->get("HLT_Photon");
235  if(HLT_Photon) reportSummaryContent_.push_back(HLT_Photon);
236 
237  MonitorElement * HLT_Tau = dbe_->get("HLT_Tau");
238  if(HLT_Tau) reportSummaryContent_.push_back(HLT_Tau);
239 
240 
241  int nSubsystems = reportSummaryContent_.size();
242 
243  for (int m = 0; m < nSubsystems; m++) {
244  summarySum += (reportSummaryContent_[m])->getFloatValue();
245  }
246 
247 
248  if(nSubsystems > 0) {
249  reportSummary = summarySum / nSubsystems;;
250  }
251  else {
252  reportSummary = 1;
253  }
254 
255  reportSummary_->Fill(reportSummary);
256  CertificationSummary_->Fill(reportSummary);
257 
258  float muonValue = 1;
259  if(HLT_Muon) muonValue = HLT_Muon->getFloatValue();
260 
261  float electronValue = 1;
262  if(HLT_Electron) electronValue = HLT_Electron->getFloatValue();
263 
264  float photonValue = 1;
265  if(HLT_Photon) photonValue = HLT_Photon->getFloatValue();
266 
267  float tauValue = 1;
268  if(HLT_Tau) tauValue = HLT_Tau->getFloatValue();
269 
270  reportSummaryMap_->setBinContent(1,1,muonValue);//Muon
271  reportSummaryMap_->setBinContent(1,2,electronValue);//Electron
272  reportSummaryMap_->setBinContent(1,3,photonValue);//Photon
273  reportSummaryMap_->setBinContent(1,4,1);//JetMET
274  reportSummaryMap_->setBinContent(1,5,1);//BJet
275  reportSummaryMap_->setBinContent(1,6,tauValue);//Tau
276 
277  CertificationSummaryMap_->setBinContent(1,1,muonValue);//Muon
278  CertificationSummaryMap_->setBinContent(1,2,electronValue);//Electron
279  CertificationSummaryMap_->setBinContent(1,3,photonValue);//Photon
280  CertificationSummaryMap_->setBinContent(1,4,1);//JetMET
281  CertificationSummaryMap_->setBinContent(1,5,1);//BJet
282  CertificationSummaryMap_->setBinContent(1,6,tauValue);//Tau
283 }
284 
285 //--------------------------------------------------------
287 }
288 
static AlgebraicMatrix initialize()
string reportSummary
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:891
void Fill(long long x)
DQMOfflineHLTEventInfoClient(const edm::ParameterSet &ps)
Constructor.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Fake Analyze.
void removeElement(const std::string &name)
Definition: DQMStore.cc:3143
double getFloatValue(void) const
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
DQMStore * dbe_
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
DQM Client Diagnostic.
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
virtual ~DQMOfflineHLTEventInfoClient()
Destructor.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
Definition: Run.h:41
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)