CMS 3D CMS Logo

HLTMuonCertSummary.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:
53  explicit HLTMuonCertSummary(const edm::ParameterSet& pset);
54  ~HLTMuonCertSummary() override;
55 
56  void beginJob() override;
57  void beginRun(const edm::Run&, const edm::EventSetup&) override;
58  void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;
59 
60 private:
62 
63  bool verbose_;
64 
65  // ----------member data ---------------------------
66 };
67 
69 
70 {
71  using namespace edm;
72 
73  parameters_ = pset;
74  verbose_ = parameters_.getUntrackedParameter<bool>("verbose", false);
75 
76  if (verbose_)
77  LogInfo("HLTMuonVal") << ">>> Constructor (HLTMuonCertSummary) <<<" << endl;
78 }
79 
81 
82 //
83 // member functions
84 //
85 
86 // ------------ method called once each job just before starting event loop ------------
88 
89 // ------------ method called just before starting a new run ------------
91  using namespace edm;
92  if (verbose_)
93  LogInfo("HLTMuonVal") << ">>> BeginRun (HLTMuonCertSummary) <<<" << std::endl;
94  if (verbose_)
95  LogInfo("HLTMuonVal") << ">>> " << run.id() << std::endl;
96 }
97 
98 // ------------ method called right after a run ends ------------
99 void HLTMuonCertSummary::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) {
100  using namespace edm;
101  if (verbose_)
102  LogInfo("HLTMuonVal") << ">>> EndRun (HLTMuonCertSummary) <<<" << std::endl;
103 
104  std::vector<string> histoNameVector;
105 
106  //booking histograms according to naming conventions
107 
108  iBooker.setCurrentFolder("HLT/EventInfo/muonQuality");
109 
110  MonitorElement* reportSummary = iBooker.bookFloat("HLT_MUON_REPORT_SUMMARY");
111 
112  int SummaryBitResult = 100;
113 
114  MonitorElement* CertificationSummary = iBooker.bookFloat("HLT_MUON_CERTIFICATION_SUMMARY");
115 
116  //for now these will hold values from eta/phi tests for spikes/holes
117  MonitorElement* reportSummaryMap =
118  iBooker.book2D("HLT_MUON_ReportSummaryMap", "HLT_MUON: ReportSummaryMap", 6, -0.5, 5.5, 1, -0.5, 0.5);
119  MonitorElement* CertificationSummaryMap = iBooker.book2D(
120  "HLT_MUON_CertificationSummaryMap", "HLT_MUON: CertificationSummaryMap", 6, -0.5, 5.5, 1, -0.5, 0.5);
121 
122  TH2* reportSummaryMapTH2 = reportSummaryMap->getTH2F();
123 
124  reportSummaryMapTH2->GetXaxis()->SetBinLabel(1, "PhiEtaOccAll");
125  reportSummaryMapTH2->GetXaxis()->SetBinLabel(2, "PhiEtaOccMatch");
126  reportSummaryMapTH2->GetXaxis()->SetBinLabel(3, "PhiEtaEff");
127  reportSummaryMapTH2->GetXaxis()->SetBinLabel(4, "PhiEff");
128  reportSummaryMapTH2->GetXaxis()->SetBinLabel(5, "EtaEff");
129  reportSummaryMapTH2->GetXaxis()->SetBinLabel(6, "PtEff");
130 
131  reportSummaryMapTH2->GetYaxis()->SetBinLabel(1, "HLT_Mu5_allMuons");
132 
133  TH2* CertificationSummaryMapTH2 = CertificationSummaryMap->getTH2F();
134 
135  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(1, "PhiEtaOccAll");
136  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(2, "PhiEtaOccMatch");
137  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(3, "PhiEtaEff");
138  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(4, "PhiEff");
139  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(5, "EtaEff");
140  CertificationSummaryMapTH2->GetXaxis()->SetBinLabel(6, "PtEff");
141 
142  CertificationSummaryMapTH2->GetYaxis()->SetBinLabel(1, "HLT_Mu5_allMuons");
143 
144  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recPhiVsRecEta_All");
145  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recPhiVsRecEta_L3Filtered");
146  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffPhiVsEta_L3Filtered");
147  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffPt_L3Filtered");
148  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffPhi_L3Filtered");
149  histoNameVector.emplace_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffEta_L3Filtered");
150 
151  // to do: what do we want in certification contents?
152  // iBooker.setCurrentFolder("Egamma/EventInfo/CertificationContents/");
153 
154  // //looping over histograms to be tested
155  if (verbose_)
156  LogInfo("HLTMuonVal") << "\n>>> looping over histograms to be tested <<<\n\n";
157 
158  for (auto& it : histoNameVector) {
159  const string& HistoName = it;
160  if (verbose_)
161  LogInfo("HLTMuonVal") << ">>> " << HistoName;
162 
163  MonitorElement* TestHist = nullptr;
164 
165  TestHist = iGetter.get(HistoName);
166 
167  bool validMe = TestHist != nullptr;
168  if (verbose_)
169  LogInfo("HLTMuonVal") << " is valid? " << validMe << "\n";
170  if (!validMe)
171  continue;
172 
173  string histNameNoPath = TestHist->getName();
174 
175  if (verbose_)
176  LogInfo("HLTMuonVal") << ">>> TestHist Name: " << histNameNoPath << "\n\n";
177 
178  //get QReports associated to each ME
179  std::vector<QReport*> myQReports = TestHist->getQReports();
180  if (verbose_)
181  LogInfo("HLTMuonVal") << TestHist->getName() << ": myQReports.size() = " << myQReports.size() << "\n\n";
182  for (uint i = 0; i != myQReports.size(); ++i) {
183  std::string qtname = myQReports[i]->getQRName(); // get QT name
184  float qtresult = myQReports[i]->getQTresult(); // get QT result value
185  int qtstatus = myQReports[i]->getStatus(); // get QT status value
186 
187  if (verbose_)
188  LogInfo("HLTMuonVal") << "\tTest " << i << ": qtname: " << qtname << "\n";
189  if (verbose_)
190  LogInfo("HLTMuonVal") << "\tTest " << i << ": qtresult: " << qtresult << std::endl;
191  if (verbose_)
192  LogInfo("HLTMuonVal") << "\tTest " << i << ": qtstatus: " << qtstatus << "\n\n";
193 
194  //book and fill float for each test done
195  iBooker.setCurrentFolder("HLT/EventInfo/muonQuality/");
196  MonitorElement* qValueInt = iBooker.bookFloat(histNameNoPath + "_HLT_Mu5_" + qtname);
197  qValueInt->Fill(qtstatus);
198 
199  // We're assuming that you want all of the bits to go into the decision
200 
201  if (HistoName.find("recPhiVsRecEta_All") != std::string::npos) {
202  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(1, 1), qtstatus);
203  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(1, 1), qtstatus);
204  if ((qtstatus == 200) && (SummaryBitResult < 300))
205  SummaryBitResult = 200;
206  if (qtstatus == 300)
207  SummaryBitResult = 300;
208  }
209 
210  if (HistoName.find("recPhiVsRecEta_L3Filtered") != std::string::npos) {
211  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(2, 1), qtstatus);
212  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(2, 1), qtstatus);
213  if ((qtstatus == 200) && (SummaryBitResult < 300))
214  SummaryBitResult = 200;
215  if (qtstatus == 300)
216  SummaryBitResult = 300;
217  }
218 
219  if (HistoName.find("recEffPhiVsEta_L3Filtered") != std::string::npos) {
220  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(3, 1), qtstatus);
221  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(3, 1), qtstatus);
222  if ((qtstatus == 200) && (SummaryBitResult < 300))
223  SummaryBitResult = 200;
224  if (qtstatus == 300)
225  SummaryBitResult = 300;
226  }
227 
228  if (HistoName.find("recEffPhi_L3Filtered") != std::string::npos) {
229  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(4, 1), qtstatus);
230  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(4, 1), qtstatus);
231  }
232 
233  if (HistoName.find("recEffEta_L3Filtered") != std::string::npos) {
234  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(5, 1), qtstatus);
235  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(5, 1), qtstatus);
236  }
237 
238  if (HistoName.find("recEffPt_L3Filtered") != std::string::npos) {
239  reportSummaryMapTH2->SetBinContent(reportSummaryMapTH2->GetBin(6, 1), qtstatus);
240  CertificationSummaryMapTH2->SetBinContent(CertificationSummaryMapTH2->GetBin(6, 1), qtstatus);
241  }
242  }
243  }
244 
245  reportSummary->Fill(SummaryBitResult);
246  CertificationSummary->Fill(SummaryBitResult);
247 
248  // Set the final bits
249 
250  iBooker.setCurrentFolder("HLT/EventInfo/reportSummaryContents");
251  MonitorElement* muonHLTQualityBinaryBit = iBooker.bookFloat("HLT_Muon");
252 
253  if (SummaryBitResult == 100) {
254  muonHLTQualityBinaryBit->Fill(1);
255  } else {
256  muonHLTQualityBinaryBit->Fill(0);
257  }
258 }
259 
DQMEDHarvester.h
HLTMuonCertSummary::beginJob
void beginJob() override
Definition: HLTMuonCertSummary.cc:87
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
HLTMuonCertSummary
Definition: HLTMuonCertSummary.cc:51
mps_fire.i
i
Definition: mps_fire.py:355
HLTMuonCertSummary::HLTMuonCertSummary
HLTMuonCertSummary(const edm::ParameterSet &pset)
Definition: HLTMuonCertSummary.cc:68
MessageLogger.h
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTMuonCertSummary::~HLTMuonCertSummary
~HLTMuonCertSummary() override
edm::LogInfo
Definition: MessageLogger.h:254
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
dqm::impl::MonitorElement::getQReports
std::vector< MonitorElementData::QReport * > getQReports() const
get map of QReports
Definition: MonitorElement.cc:502
parallelization.uint
uint
Definition: parallelization.py:124
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
Run.h
HLTMuonCertSummary::parameters_
edm::ParameterSet parameters_
Definition: HLTMuonCertSummary.cc:61
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
cscdqm::HistoName
std::string HistoName
Definition: CSCDQM_HistoDef.h:32
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
DQMEDHarvester
Definition: DQMEDHarvester.py:1
HLTMuonCertSummary::verbose_
bool verbose_
Definition: HLTMuonCertSummary.cc:63
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Frameworkfwd.h
dqm::impl::MonitorElement::getName
const std::string & getName() const
get name of ME
Definition: MonitorElement.h:250
HLTMuonCertSummary::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: HLTMuonCertSummary.cc:90
Exception.h
ParameterSet.h
HLTMuonCertSummary::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: HLTMuonCertSummary.cc:99
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490