CMS 3D CMS Logo

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 beginJob() override;
60  void analyze(const edm::Event&, const edm::EventSetup&) override;
61  void endJob() override;
62  void beginRun(const edm::Run&, const edm::EventSetup&) override;
63  void endRun(const edm::Run&, const edm::EventSetup&) override;
64 
65 private:
68 
69  bool verbose_;
70 
71  // ----------member data ---------------------------
72 };
73 
75 
76 {
77  using namespace edm;
78  dbe_ = nullptr;
79  dbe_ = edm::Service<DQMStore>().operator->();
80  if (!dbe_) {
81  LogInfo("HLTMuonVal") << "Can't find DQMStore, no results will be saved" << endl;
82  }
83 
84  parameters_ = pset;
85  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
86 
87  if (verbose_)
88  LogInfo("HLTMuonVal") << ">>> Constructor (HLTOverallSummary) <<<" << endl;
89 }
90 
92 
93 //
94 // member functions
95 //
96 
97 // ------------ method called to for each event ------------
99  using namespace edm;
100 
101  if (verbose_)
102  LogInfo("HLTMuonVal") << ">>> Analyze (HLTOverallSummary) <<<" << std::endl;
103 }
104 
105 // ------------ method called once each job just before starting event loop ------------
107 
108 // ------------ method called once each job just after ending the event loop ------------
110 
111 // ------------ method called just before starting a new run ------------
113  using namespace edm;
114  if (verbose_)
115  LogInfo("HLTMuonVal") << ">>> BeginRun (HLTOverallSummary) <<<" << std::endl;
116  if (verbose_)
117  LogInfo("HLTMuonVal") << ">>> " << run.id() << std::endl;
118 }
119 
120 // ------------ method called right after a run ends ------------
122  using namespace edm;
123  if (verbose_)
124  LogInfo("HLTMuonVal") << ">>> EndRun (HLTOverallSummary) <<<" << std::endl;
125 
126  if (!dbe_) {
127  LogInfo("HLTMuonVal") << "No dqmstore... skipping processing step" << endl;
128  return;
129  }
130 
131  std::vector<string> histoNameVector;
132 
133  //booking histograms according to naming conventions
134 
135  float defaultValueIfNotFound = 1.0;
136 
137  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContent");
138 
139  //============ Unpack information ==========
140 
141  MonitorElement* muonQualityBit = nullptr;
142  muonQualityBit = dbe_->get("HLT_Muon");
143 
144  if (!muonQualityBit) {
145  LogInfo("HLTMuonVal") << "Can't find muonQuality bit... making a bit, setting it to zero" << endl;
146 
147  muonQualityBit = dbe_->bookFloat("HLT_Muon");
148  muonQualityBit->Fill(defaultValueIfNotFound);
149  }
150 
151  MonitorElement* eleQualityBit = nullptr;
152  eleQualityBit = dbe_->get("HLT_Electron");
153 
154  if (!eleQualityBit) {
155  LogInfo("HLTMuonVal") << "Can't find eleQuality bit... making a bit, setting it to zero" << endl;
156 
157  eleQualityBit = dbe_->bookFloat("HLT_Electron");
158  eleQualityBit->Fill(defaultValueIfNotFound);
159  }
160 
161  MonitorElement* photonQualityBit = nullptr;
162  photonQualityBit = dbe_->get("HLT_Photon");
163 
164  if (!photonQualityBit) {
165  LogInfo("HLTMuonVal") << "Can't find photonQuality bit... making a bit, setting it to zero" << endl;
166 
167  photonQualityBit = dbe_->bookFloat("HLT_Photon");
168  photonQualityBit->Fill(defaultValueIfNotFound);
169  }
170 
171  //============ Book new storage locations =============
172 
173  dbe_->setCurrentFolder("HLT/EventInfo");
174  MonitorElement* hltQualityBit = dbe_->bookFloat("reportSummary");
175 
176  MonitorElement* hltQualitySummaryWord = dbe_->bookInt("HLT_SUMMARY_WORD");
177 
178  //for now these will hold values from eta/phi tests for spikes/holes
179  MonitorElement* reportSummaryMap =
180  dbe_->book2D("reportSummaryMap", "HLT: ReportSummaryMap", 3, -0.5, 2.5, 1, -0.5, 0.5);
181  MonitorElement* CertificationSummaryMap =
182  dbe_->book2D("certificationSummaryMap", "HLT: CertificationSummaryMap", 3, -0.5, 2.5, 1, -0.5, 0.5);
183 
184  TH2* reportSummaryMapTH2 = reportSummaryMap->getTH2F();
185 
186  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1, "Muon");
187  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2, "Electron");
188  reportSummaryMapTH2->GetXaxis()->SetBinLabel(3, "Photon");
189 
190  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1, "Quality");
191 
192  TH2* CertificationSummaryMapTH2 = CertificationSummaryMap->getTH2F();
193 
194  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(1, "Muon");
195  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(2, "Electron");
196  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(3, "Photon");
197  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(1, "Quality");
198 
199  //=================== Interpret bits and store result
200 
201  float photonValue = photonQualityBit->getFloatValue();
202 
203  float electronValue = eleQualityBit->getFloatValue();
204 
205  float muonValue = muonQualityBit->getFloatValue();
206 
207  float hltOverallValue = 1.0;
208 
209  if ((photonValue > 0.99) && (electronValue > 0.99) && (muonValue > 0.99)) {
210  hltOverallValue = 1.0;
211 
212  } else {
213  hltOverallValue = 0.0;
214  }
215 
216  hltQualityBit->Fill(hltOverallValue);
217 
218  unsigned int hltSummaryValue = 0x0; //
219 
220  unsigned int ELECTRON_MASK = 0x1;
221  unsigned int PHOTON_MASK = 0x2;
222  unsigned int MUON_MASK = 0x4;
223 
224  if (electronValue > 0.99)
225  hltSummaryValue = hltSummaryValue | ELECTRON_MASK;
226  if (photonValue > 0.99)
227  hltSummaryValue = hltSummaryValue | PHOTON_MASK;
228  if (muonValue > 0.99)
229  hltSummaryValue = hltSummaryValue | MUON_MASK;
230 
231  hltQualitySummaryWord->Fill(hltSummaryValue);
232 
233  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(1, 1), muonValue);
234  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(2, 1), electronValue);
235  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(3, 1), photonValue);
236 
237  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(1, 1), muonValue);
238  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(2, 1), electronValue);
239  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(3, 1), photonValue);
240 }
241 
Ecal2004TBTDCRanges_v1_cff.endRun
endRun
Definition: Ecal2004TBTDCRanges_v1_cff.py:4
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
MessageLogger.h
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
HLTOverallSummary::beginJob
void beginJob() override
Definition: HLTOverallSummary.cc:106
edm::Run
Definition: Run.h:45
DQMOffline_HLT_SummaryCert_cfi.HLTOverallSummary
HLTOverallSummary
Definition: DQMOffline_HLT_SummaryCert_cfi.py:5
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTOverallSummary::endRun
void endRun(const edm::Run &, const edm::EventSetup &) override
Definition: HLTOverallSummary.cc:121
edm::LogInfo
Definition: MessageLogger.h:254
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
EDAnalyzer.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
MakerMacros.h
HLTOverallSummary::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: HLTOverallSummary.cc:112
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
Run.h
HLTOverallSummary::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: HLTOverallSummary.cc:98
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
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
dqm::implementation::IBooker::bookInt
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HLTOverallSummary::HLTOverallSummary
HLTOverallSummary(const edm::ParameterSet &pset)
Definition: HLTOverallSummary.cc:74
HLTOverallSummary::parameters_
edm::ParameterSet parameters_
Definition: HLTOverallSummary.cc:67
HLTOverallSummary::~HLTOverallSummary
~HLTOverallSummary() override
HLTOverallSummary
Definition: HLTOverallSummary.cc:51
HLTOverallSummary::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: HLTOverallSummary.cc:54
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Frameworkfwd.h
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
HLTOverallSummary::dbe_
DQMStore * dbe_
Definition: HLTOverallSummary.cc:66
Exception.h
HLTOverallSummary::verbose_
bool verbose_
Definition: HLTOverallSummary.cc:69
ParameterSet.h
HLTOverallSummary::endJob
void endJob() override
Definition: HLTOverallSummary.cc:109
edm::Event
Definition: Event.h:73
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
HLTOverallSummary::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: HLTOverallSummary.cc:53
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490