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