CMS 3D CMS Logo

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