CMS 3D CMS Logo

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