CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLTOverallSummary.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 //
6 // Original Author: Jason Slaunwhite
7 //
8 // Created: Thu Jan 22 13:42:28CET 2009
9 //
10 
11 // system include files
12 #include <memory>
13 #include <vector>
14 
16 //
22 
23 //root include files
24 #include "TFile.h"
25 #include "TH1.h"
26 #include "TH2.h"
27 #include "TTree.h"
28 #include "TVector3.h"
29 #include "TProfile.h"
30 //
31 
32 // user include files
35 
37 
40 
41 //DQM services
44 
45 using namespace std;
46 
47 //
48 // class decleration
49 //
50 
52 public:
55 
56  explicit HLTOverallSummary(const edm::ParameterSet& pset);
57  ~HLTOverallSummary() override;
58 
59  void analyze(const edm::Event&, const edm::EventSetup&) override;
60  void beginRun(const edm::Run&, const edm::EventSetup&) override;
61  void endRun(const edm::Run&, const edm::EventSetup&) override;
62 
63 private:
66 
67  bool verbose_;
68 
69  // ----------member data ---------------------------
70 };
71 
73 
74 {
75  using namespace edm;
76  dbe_ = nullptr;
78  if (!dbe_) {
79  LogInfo("HLTMuonVal") << "Can't find DQMStore, no results will be saved" << endl;
80  }
81 
82  parameters_ = pset;
83  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
84 
85  if (verbose_)
86  LogInfo("HLTMuonVal") << ">>> Constructor (HLTOverallSummary) <<<" << endl;
87 }
88 
90 
91 //
92 // member functions
93 //
94 
95 // ------------ method called to for each event ------------
97  using namespace edm;
98 
99  if (verbose_)
100  LogInfo("HLTMuonVal") << ">>> Analyze (HLTOverallSummary) <<<" << std::endl;
101 }
102 
103 // ------------ method called just before starting a new run ------------
105  using namespace edm;
106  if (verbose_)
107  LogInfo("HLTMuonVal") << ">>> BeginRun (HLTOverallSummary) <<<" << std::endl;
108  if (verbose_)
109  LogInfo("HLTMuonVal") << ">>> " << run.id() << std::endl;
110 }
111 
112 // ------------ method called right after a run ends ------------
114  using namespace edm;
115  if (verbose_)
116  LogInfo("HLTMuonVal") << ">>> EndRun (HLTOverallSummary) <<<" << std::endl;
117 
118  if (!dbe_) {
119  LogInfo("HLTMuonVal") << "No dqmstore... skipping processing step" << endl;
120  return;
121  }
122 
123  std::vector<string> histoNameVector;
124 
125  //booking histograms according to naming conventions
126 
127  float defaultValueIfNotFound = 1.0;
128 
129  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContent");
130 
131  //============ Unpack information ==========
132 
133  MonitorElement* muonQualityBit = nullptr;
134  muonQualityBit = dbe_->get("HLT_Muon");
135 
136  if (!muonQualityBit) {
137  LogInfo("HLTMuonVal") << "Can't find muonQuality bit... making a bit, setting it to zero" << endl;
138 
139  muonQualityBit = dbe_->bookFloat("HLT_Muon");
140  muonQualityBit->Fill(defaultValueIfNotFound);
141  }
142 
143  MonitorElement* eleQualityBit = nullptr;
144  eleQualityBit = dbe_->get("HLT_Electron");
145 
146  if (!eleQualityBit) {
147  LogInfo("HLTMuonVal") << "Can't find eleQuality bit... making a bit, setting it to zero" << endl;
148 
149  eleQualityBit = dbe_->bookFloat("HLT_Electron");
150  eleQualityBit->Fill(defaultValueIfNotFound);
151  }
152 
153  MonitorElement* photonQualityBit = nullptr;
154  photonQualityBit = dbe_->get("HLT_Photon");
155 
156  if (!photonQualityBit) {
157  LogInfo("HLTMuonVal") << "Can't find photonQuality bit... making a bit, setting it to zero" << endl;
158 
159  photonQualityBit = dbe_->bookFloat("HLT_Photon");
160  photonQualityBit->Fill(defaultValueIfNotFound);
161  }
162 
163  //============ Book new storage locations =============
164 
165  dbe_->setCurrentFolder("HLT/EventInfo");
166  MonitorElement* hltQualityBit = dbe_->bookFloat("reportSummary");
167 
168  MonitorElement* hltQualitySummaryWord = dbe_->bookInt("HLT_SUMMARY_WORD");
169 
170  //for now these will hold values from eta/phi tests for spikes/holes
171  MonitorElement* reportSummaryMap =
172  dbe_->book2D("reportSummaryMap", "HLT: ReportSummaryMap", 3, -0.5, 2.5, 1, -0.5, 0.5);
173  MonitorElement* CertificationSummaryMap =
174  dbe_->book2D("certificationSummaryMap", "HLT: CertificationSummaryMap", 3, -0.5, 2.5, 1, -0.5, 0.5);
175 
176  TH2* reportSummaryMapTH2 = reportSummaryMap->getTH2F();
177 
178  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1, "Muon");
179  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2, "Electron");
180  reportSummaryMapTH2->GetXaxis()->SetBinLabel(3, "Photon");
181 
182  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1, "Quality");
183 
184  TH2* CertificationSummaryMapTH2 = CertificationSummaryMap->getTH2F();
185 
186  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(1, "Muon");
187  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(2, "Electron");
188  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(3, "Photon");
189  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(1, "Quality");
190 
191  //=================== Interpret bits and store result
192 
193  float photonValue = photonQualityBit->getFloatValue();
194 
195  float electronValue = eleQualityBit->getFloatValue();
196 
197  float muonValue = muonQualityBit->getFloatValue();
198 
199  float hltOverallValue = 1.0;
200 
201  if ((photonValue > 0.99) && (electronValue > 0.99) && (muonValue > 0.99)) {
202  hltOverallValue = 1.0;
203 
204  } else {
205  hltOverallValue = 0.0;
206  }
207 
208  hltQualityBit->Fill(hltOverallValue);
209 
210  unsigned int hltSummaryValue = 0x0; //
211 
212  unsigned int ELECTRON_MASK = 0x1;
213  unsigned int PHOTON_MASK = 0x2;
214  unsigned int MUON_MASK = 0x4;
215 
216  if (electronValue > 0.99)
217  hltSummaryValue = hltSummaryValue | ELECTRON_MASK;
218  if (photonValue > 0.99)
219  hltSummaryValue = hltSummaryValue | PHOTON_MASK;
220  if (muonValue > 0.99)
221  hltSummaryValue = hltSummaryValue | MUON_MASK;
222 
223  hltQualitySummaryWord->Fill(hltSummaryValue);
224 
225  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(1, 1), muonValue);
226  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(2, 1), electronValue);
227  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(3, 1), photonValue);
228 
229  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(1, 1), muonValue);
230  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(2, 1), electronValue);
231  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(3, 1), photonValue);
232 }
233 
const edm::EventSetup & c
RunID const & id() const
Definition: RunBase.h:39
void endRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &) override
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
void beginRun(const edm::Run &, const edm::EventSetup &) override
~HLTOverallSummary() override
Log< level::Info, false > LogInfo
dqm::legacy::DQMStore DQMStore
edm::ParameterSet parameters_
HLTOverallSummary(const edm::ParameterSet &pset)
dqm::legacy::MonitorElement MonitorElement
Definition: Run.h:45