CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTOverallSummary.cc
Go to the documentation of this file.
1 #include <iostream>
2 
3 
4 
7 //
8 // Original Author: Jason Slaunwhite
9 //
10 // Created: Thu Jan 22 13:42:28CET 2009
11 // $Id: HLTOverallSummary.cc,v 1.6 2010/07/20 02:58:28 wmtan Exp $
12 //
13 
14 // system include files
15 #include <memory>
16 #include <vector>
17 
19 //
25 
26 //root include files
27 #include "TFile.h"
28 #include "TH1.h"
29 #include "TH2.h"
30 #include "TTree.h"
31 #include "TVector3.h"
32 #include "TProfile.h"
33 //
34 
35 
36 // user include files
39 
41 
44 
45 
46 //DQM services
50 
51 
52 
53 using namespace std;
54 
55 
56 //
57 // class decleration
58 //
59 
61 
62  public:
63  explicit HLTOverallSummary(const edm::ParameterSet& pset);
65 
66 
67  virtual void beginJob() ;
68  virtual void analyze(const edm::Event&, const edm::EventSetup&);
69  virtual void endJob() ;
70  virtual void beginRun(const edm::Run&, const edm::EventSetup&) ;
71  virtual void endRun(const edm::Run&, const edm::EventSetup&) ;
72 
73 
74 
75  private:
76 
79 
80  bool verbose_;
81 
82  // ----------member data ---------------------------
83 };
84 
85 
86 
88 
89 {
90 
91  using namespace edm;
92  dbe_ = 0;
94  if (!dbe_) {
95  LogInfo ("HLTMuonVal") << "Can't find DQMStore, no results will be saved"
96  << endl;
97  } else {
98  dbe_->setVerbose(0);
99  }
100 
101  parameters_ = pset;
102  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
103 
104  if(verbose_) LogInfo ("HLTMuonVal") << ">>> Constructor (HLTOverallSummary) <<<" << endl;
105 
106 }
107 
108 
110 {
111 }
112 
113 
114 //
115 // member functions
116 //
117 
118 // ------------ method called to for each event ------------
119 void
121 {
122  using namespace edm;
123 
124  if(verbose_) LogInfo ("HLTMuonVal") << ">>> Analyze (HLTOverallSummary) <<<" << std::endl;
125 
126 }
127 
128 // ------------ method called once each job just before starting event loop ------------
129 void
131 {
132 }
133 
134 // ------------ method called once each job just after ending the event loop ------------
135 void
137 {
138 }
139 
140 // ------------ method called just before starting a new run ------------
141 void
143 {
144 
145  using namespace edm;
146  if(verbose_) LogInfo ("HLTMuonVal") << ">>> BeginRun (HLTOverallSummary) <<<" << std::endl;
147  if(verbose_) LogInfo ("HLTMuonVal") << ">>> "<< run.id() << std::endl;
148 
149 }
150 
151 // ------------ method called right after a run ends ------------
152 void
154 {
155 
156  using namespace edm;
157  if(verbose_) LogInfo ("HLTMuonVal") << ">>> EndRun (HLTOverallSummary) <<<" << std::endl;
158 
159  if(!dbe_) {
160  LogInfo ("HLTMuonVal") << "No dqmstore... skipping processing step" << endl;
161  return;
162  }
163 
164  std::vector<string> histoNameVector;
165 
166 
167  //booking histograms according to naming conventions
168 
169  float defaultValueIfNotFound = 1.0;
170 
171  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContent");
172 
173 
174  //============ Unpack information ==========
175 
176 
177  MonitorElement* muonQualityBit = 0;
178  muonQualityBit = dbe_->get("HLT_Muon");
179 
180  if (!muonQualityBit) {
181  LogInfo ("HLTMuonVal") << "Can't find muonQuality bit... making a bit, setting it to zero" << endl;
182 
183  muonQualityBit = dbe_->bookFloat("HLT_Muon");
184  muonQualityBit->Fill(defaultValueIfNotFound);
185 
186  }
187 
188  MonitorElement* eleQualityBit = 0;
189  eleQualityBit = dbe_->get("HLT_Electron");
190 
191  if (!eleQualityBit) {
192  LogInfo ("HLTMuonVal") << "Can't find eleQuality bit... making a bit, setting it to zero" << endl;
193 
194  eleQualityBit = dbe_->bookFloat("HLT_Electron");
195  eleQualityBit->Fill(defaultValueIfNotFound);
196  }
197 
198  MonitorElement* photonQualityBit = 0;
199  photonQualityBit = dbe_->get("HLT_Photon");
200 
201  if (!photonQualityBit) {
202  LogInfo ("HLTMuonVal") << "Can't find photonQuality bit... making a bit, setting it to zero" << endl;
203 
204  photonQualityBit = dbe_->bookFloat("HLT_Photon");
205  photonQualityBit->Fill(defaultValueIfNotFound);
206  }
207 
208 
209  //============ Book new storage locations =============
210 
211  dbe_->setCurrentFolder("HLT/EventInfo");
212  MonitorElement* hltQualityBit = dbe_->bookFloat("reportSummary");
213 
214  MonitorElement* hltQualitySummaryWord = dbe_->bookInt ("HLT_SUMMARY_WORD");
215 
216  //for now these will hold values from eta/phi tests for spikes/holes
217  MonitorElement* reportSummaryMap = dbe_->book2D("reportSummaryMap","HLT: ReportSummaryMap",3,-0.5,2.5,1,-0.5,0.5);
218  MonitorElement* CertificationSummaryMap = dbe_->book2D("certificationSummaryMap","HLT: CertificationSummaryMap",3,-0.5,2.5,1,-0.5,0.5);
219 
220  TH2 * reportSummaryMapTH2 = reportSummaryMap->getTH2F();
221 
222  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1,"Muon");
223  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2,"Electron");
224  reportSummaryMapTH2->GetXaxis()->SetBinLabel(3,"Photon");
225 
226  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1,"Quality");
227 
228 
229  TH2 * CertificationSummaryMapTH2 = CertificationSummaryMap->getTH2F();
230 
231  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(1,"Muon");
232  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(2,"Electron");
233  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(3,"Photon");
234  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(1,"Quality");
235 
236 
237 
238  //=================== Interpret bits and store result
239 
240  float photonValue = photonQualityBit->getFloatValue();
241 
242  float electronValue = eleQualityBit->getFloatValue();
243 
244  float muonValue = muonQualityBit->getFloatValue();
245 
246  float hltOverallValue = 1.0;
247 
248  if ( (photonValue > 0.99)
249  && (electronValue > 0.99)
250  && (muonValue > 0.99) ) {
251 
252  hltOverallValue = 1.0;
253 
254  } else {
255 
256  hltOverallValue = 0.0;
257 
258  }
259 
260  hltQualityBit->Fill(hltOverallValue);
261 
262  unsigned int hltSummaryValue = 0x0; //
263 
264  unsigned int ELECTRON_MASK = 0x1;
265  unsigned int PHOTON_MASK = 0x2;
266  unsigned int MUON_MASK = 0x4;
267 
268  if (electronValue > 0.99) hltSummaryValue = hltSummaryValue | ELECTRON_MASK;
269  if (photonValue > 0.99) hltSummaryValue = hltSummaryValue | PHOTON_MASK;
270  if (muonValue > 0.99) hltSummaryValue = hltSummaryValue | MUON_MASK;
271 
272  hltQualitySummaryWord->Fill(hltSummaryValue);
273 
274  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(1,1), muonValue);
275  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(2,1), electronValue);
276  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(3,1), photonValue);
277 
278  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(1,1), muonValue);
279  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(2,1), electronValue);
280  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(3,1), photonValue);
281 
282 
283 
284 
285 
286 
287 
288 
289 
290 
291 }
292 
293 
T getUntrackedParameter(std::string const &, T const &) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
RunID const & id() const
Definition: RunBase.h:41
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endJob()
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
void beginJob()
Definition: Breakpoints.cc:15
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:243
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
DQMStore * dbe_
edm::ParameterSet parameters_
HLTOverallSummary(const edm::ParameterSet &pset)
TH2F * getTH2F(void) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
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:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
virtual void beginJob()