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