test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataCertificationJetMET.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMOffline/JetMET
4 // Class: DataCertificationJetMET
5 //
6 // Original Author: "Frank Chlebana"
7 // Created: Sun Oct 5 13:57:25 CDT 2008
8 //
9 
13 
14 // Some switches
15 //
16 // constructors and destructor
17 //
19 {
20  // now do what ever initialization is needed
21 
22  // -----------------------------------------
23  // verbose_ 0: suppress printouts
24  // 1: show printouts
25  verbose_ = conf_.getUntrackedParameter<int>("Verbose",0);
29 
30  jetTests[0][0] = conf_.getUntrackedParameter<bool>("pfBarrelJetMeanTest",true);
31  jetTests[0][1] = conf_.getUntrackedParameter<bool>("pfBarrelJetKSTest",false);
32  jetTests[1][0] = conf_.getUntrackedParameter<bool>("pfEndcapJetMeanTest",true);
33  jetTests[1][1] = conf_.getUntrackedParameter<bool>("pfEndcapJetKSTest",false);
34  jetTests[2][0] = conf_.getUntrackedParameter<bool>("pfForwardJetMeanTest",true);
35  jetTests[2][1] = conf_.getUntrackedParameter<bool>("pfForwardJetKSTest",false);
36  jetTests[3][0] = conf_.getUntrackedParameter<bool>("caloJetMeanTest",true);
37  jetTests[3][1] = conf_.getUntrackedParameter<bool>("caloJetKSTest",false);
38  jetTests[4][0] = conf_.getUntrackedParameter<bool>("jptJetMeanTest",true);
39  jetTests[4][1] = conf_.getUntrackedParameter<bool>("jptJetKSTest",false);
40 
41  metTests[0][0] = conf_.getUntrackedParameter<bool>("caloMETMeanTest",true);
42  metTests[0][1] = conf_.getUntrackedParameter<bool>("caloMETKSTest",false);
43  metTests[1][0] = conf_.getUntrackedParameter<bool>("pfMETMeanTest",true);
44  metTests[1][1] = conf_.getUntrackedParameter<bool>("pfMETKSTest",false);
45  metTests[2][0] = conf_.getUntrackedParameter<bool>("tcMETMeanTest",true);
46  metTests[2][1] = conf_.getUntrackedParameter<bool>("tcMETKSTest",false);
47 
48  if (verbose_) std::cout << ">>> Constructor (DataCertificationJetMET) <<<" << std::endl;
49 
50  // -----------------------------------------
51  //
52 }
53 
54 
56 {
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59  if (verbose_) std::cout << ">>> Deconstructor (DataCertificationJetMET) <<<" << std::endl;
60 }
61 
62 
63 // ------------ method called right after a run ends ------------
64 void
66 {
67  if (verbose_) std::cout << ">>> EndRun (DataCertificationJetMET) <<<" << std::endl;
68 
69  std::vector<std::string> subDirVec;
70  std::string RunDir;
71  std::string RunNum;
72 
73  std::string RefRunDir;
74 
75  if (verbose_) std::cout << "InMemory_ = " << InMemory_ << std::endl;
76 
78  reportSummary = ibook_.bookFloat("reportSummary");
79  CertificationSummary = ibook_.bookFloat("CertificationSummary");
80 
81  reportSummaryMap = ibook_.book2D("reportSummaryMap","reportSummaryMap",3,0,3,5,0,5);
82  CertificationSummaryMap = ibook_.book2D("CertificationSummaryMap","CertificationSummaryMap",3,0,3,5,0,5);
83 
84 
85  reportSummary = iget_.get(folderName+"/"+"reportSummary");
86  CertificationSummary = iget_.get(folderName+"/"+"CertificationSummary");
87  reportSummaryMap = iget_.get(folderName+"/"+"reportSummaryMap");
88  CertificationSummaryMap = iget_.get(folderName+"/"+"CertificationSummaryMap");
89 
90 
91 
93  reportSummaryMap->getTH2F()->SetStats(kFALSE);
94  reportSummaryMap->getTH2F()->SetOption("colz");
95  reportSummaryMap->setBinLabel(1,"CaloTower");
96  reportSummaryMap->setBinLabel(2,"MET");
97  reportSummaryMap->setBinLabel(3,"Jet");
98  }
100  CertificationSummaryMap->getTH2F()->SetStats(kFALSE);
101  CertificationSummaryMap->getTH2F()->SetOption("colz");
102  CertificationSummaryMap->setBinLabel(1,"CaloTower");
105  }
106 
107  reportSummary->Fill(1.);
109 
110  if (RunDir=="Reference") RunDir="";
111  if (verbose_) std::cout << RunDir << std::endl;
112  ibook_.setCurrentFolder("JetMET/EventInfo/CertificationSummaryContents/");
113 
114 
115  std::string refHistoName;
116  std::string newHistoName;
117 
118  //-----------------------------
119  // Jet DQM Data Certification
120  //-----------------------------
121  //we have 4 types anymore: PF (barrel,endcap,forward) and calojets
122  MonitorElement *meJetPt[4];
123  MonitorElement *meJetEta[4];
124  MonitorElement *meJetPhi[4];
125  MonitorElement *meJetEMFrac[4];
126  MonitorElement *meJetConstituents[4];
127  RunDir = "";
128  if (RunDir == "") newHistoName = "JetMET/Jet/";
129  else newHistoName = RunDir+"/JetMET/Runsummary/Jet/";
130  std::string cleaningdir = "";
131  if (isData){ //directory should be present in MC as well -> take out a later stage maybe
132  cleaningdir = "Cleaned";
133  }else{
134  cleaningdir = "Uncleaned";
135  }
136  //Jet Phi histos
137  meJetPhi[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_Barrel");
138  meJetPhi[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_EndCap");
139  meJetPhi[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_Forward");
140  meJetPhi[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Phi");
141  //meJetPhi[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Phi");
142 
143  //Jet Eta histos
144  meJetEta[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
145  meJetEta[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
146  meJetEta[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EtaFirst");
147  meJetEta[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Eta");
148  //meJetEta[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Eta");
149 
150  //Jet Pt histos
151  meJetPt[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Barrel");
152  meJetPt[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_EndCap");
153  meJetPt[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Forward");
154  meJetPt[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Pt_2");
155 
157  meJetConstituents[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Barrel");
158  meJetConstituents[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_EndCap");
159  meJetConstituents[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Forward");
160  meJetConstituents[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Constituents");
161  //
163  meJetEMFrac[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Barrel");
164  meJetEMFrac[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_EndCap");
165  meJetEMFrac[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Forward");
166  meJetEMFrac[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/EFrac");
167 
168 
169  //------------------------------------------------------------------------------
170  //--- Extract quality test results and fill data certification results for Jets
171  //--- Tests for Calo Barrel, EndCap and Forward, as well as PF and JPT jets
172  //--- For Calo and PF jets:
173  //--- Look at mean of Constituents, EM Frac and Pt
174  //--- Look at Kolmogorov result for Eta, Phi, and Pt
175  //--- For JPT jets:
176  //--- Look at mean of Pt, AllPionsTrackNHits?, nTracks,
177  //--- Look at Kolmogorov result for Eta, Phi, and Pt
178  //------------------------------------------------------------------------------
179 
180 
181  // Four types of jets {AK5 Barrel, AK5 EndCap, AK5 Forward, PF}, removed JPT which is 5th type of jets
182  //----------------------------------------------------------------------------
183  // Kolmogorov (KS) tests
184  const QReport* QReport_JetEta[4] = {0};
185  const QReport* QReport_JetPhi[4] = {0};
186  // Mean and KS tests for Calo and PF jets
187  const QReport* QReport_JetConstituents[4][2] = {{0}};
188  const QReport* QReport_JetEFrac[4][2] = {{0}};
189  const QReport* QReport_JetPt[4][2] = {{0}};
190 
191  // Mean and KS tests for JPT jets
192  //const QReport* QReport_JetNTracks[2] = {0, 0};
193  float qr_Jet_Eta[4] = {-1};
194  float qr_Jet_Phi[4] = {-1};
195  float dc_Jet[4] = {-1};
196 
197  float qr_Jet_Constituents[4][2] = {{-1}};
198  float qr_Jet_EFrac[4][2] = {{-1}};
199  float qr_Jet_Pt[4][2] = {{-1}};
200 
201 
202  // Loop
203  //----------------------------------------------------------------------------
204  for (int jtyp=0; jtyp<4; ++jtyp) {
205  // Mean test results
206 
207  if (meJetConstituents[jtyp] && meJetConstituents[jtyp]->getRootObject() ) {
208  QReport_JetConstituents[jtyp][0] = meJetConstituents[jtyp]->getQReport("meanJetConstituentsTest");
209  QReport_JetConstituents[jtyp][1] = meJetConstituents[jtyp]->getQReport("KolmogorovTest");
210  }
211  if (meJetEMFrac[jtyp]&& meJetEMFrac[jtyp]->getRootObject() ) {
212  QReport_JetEFrac[jtyp][0] = meJetEMFrac[jtyp]->getQReport("meanEMFractionTest");
213  QReport_JetEFrac[jtyp][1] = meJetEMFrac[jtyp]->getQReport("KolmogorovTest");
214  }
215  if (meJetPt[jtyp] && meJetPt[jtyp]->getRootObject() ) {
216  QReport_JetPt[jtyp][0] = meJetPt[jtyp]->getQReport("meanJetPtTest");
217  QReport_JetPt[jtyp][1] = meJetPt[jtyp]->getQReport("KolmogorovTest");
218  }
219  if (meJetPhi[jtyp] && meJetPhi[jtyp]->getRootObject()){
220  QReport_JetPhi[jtyp] = meJetPhi[jtyp]->getQReport("KolmogorovTest");
221  }
222  if (meJetEta[jtyp] && meJetEta[jtyp]->getRootObject()){
223  QReport_JetEta[jtyp] = meJetEta[jtyp]->getQReport("KolmogorovTest");
224  }
225 
226  //Jet Pt test
227  if (QReport_JetPt[jtyp][0]){
228  //std::cout<<"jet type test pt "<<jtyp<<"/"<<QReport_JetPt[jtyp][0]->getStatus()<<std::endl;
229  if (QReport_JetPt[jtyp][0]->getStatus()==100 ||
230  QReport_JetPt[jtyp][0]->getStatus()==200)
231  qr_Jet_Pt[jtyp][0] = 1;
232  else if (QReport_JetPt[jtyp][0]->getStatus()==300)
233  qr_Jet_Pt[jtyp][0] = 0;
234  else
235  qr_Jet_Pt[jtyp][0] = -1;
236  }
237  else{ qr_Jet_Pt[jtyp][0] = -2;
238  //std::cout<<"qreport is REALLY NULL type test pt "<<jtyp<<" 0 "<<std::endl;
239  }
240  if (QReport_JetPt[jtyp][1]){
241  if (QReport_JetPt[jtyp][1]->getStatus()==100 ||
242  QReport_JetPt[jtyp][1]->getStatus()==200)
243  qr_Jet_Pt[jtyp][1] = 1;
244  else if (QReport_JetPt[jtyp][1]->getStatus()==300)
245  qr_Jet_Pt[jtyp][1] = 0;
246  else
247  qr_Jet_Pt[jtyp][1] = -1;
248  }
249  else{ qr_Jet_Pt[jtyp][1] = -2;
250  }
251 
252  //Jet Phi test
253  if (QReport_JetPhi[jtyp]){
254  if (QReport_JetPhi[jtyp]->getStatus()==100 ||
255  QReport_JetPhi[jtyp]->getStatus()==200)
256  qr_Jet_Phi[jtyp] = 1;
257  else if (QReport_JetPhi[jtyp]->getStatus()==300)
258  qr_Jet_Phi[jtyp] = 0;
259  else
260  qr_Jet_Phi[jtyp] = -1;
261  }
262  else{ qr_Jet_Phi[jtyp] = -2;
263  }
264  //Jet Eta test
265  if (QReport_JetEta[jtyp]){
266  if (QReport_JetEta[jtyp]->getStatus()==100 ||
267  QReport_JetEta[jtyp]->getStatus()==200)
268  qr_Jet_Eta[jtyp] = 1;
269  else if (QReport_JetEta[jtyp]->getStatus()==300)
270  qr_Jet_Eta[jtyp] = 0;
271  else
272  qr_Jet_Eta[jtyp] = -1;
273  }
274  else{
275  qr_Jet_Eta[jtyp] = -2;
276  }
277  //Jet Constituents test
278  if (QReport_JetConstituents[jtyp][0]){
279  if (QReport_JetConstituents[jtyp][0]->getStatus()==100 ||
280  QReport_JetConstituents[jtyp][0]->getStatus()==200)
281  qr_Jet_Constituents[jtyp][0] = 1;
282  else if (QReport_JetConstituents[jtyp][0]->getStatus()==300)
283  qr_Jet_Constituents[jtyp][0] = 0;
284  else
285  qr_Jet_Constituents[jtyp][0] = -1;
286  }
287  else{ qr_Jet_Constituents[jtyp][0] = -2;
288  }
289 
290  if (QReport_JetConstituents[jtyp][1]){
291  if (QReport_JetConstituents[jtyp][1]->getStatus()==100 ||
292  QReport_JetConstituents[jtyp][1]->getStatus()==200)
293  qr_Jet_Constituents[jtyp][1] = 1;
294  else if (QReport_JetConstituents[jtyp][1]->getStatus()==300)
295  qr_Jet_Constituents[jtyp][1] = 0;
296  else
297  qr_Jet_Constituents[jtyp][1] = -1;
298  }
299  else{ qr_Jet_Constituents[jtyp][1] = -2;
300  }
301  //Jet EMFrac test
302  if (QReport_JetEFrac[jtyp][0]){
303  if (QReport_JetEFrac[jtyp][0]->getStatus()==100 ||
304  QReport_JetEFrac[jtyp][0]->getStatus()==200)
305  qr_Jet_EFrac[jtyp][0] = 1;
306  else if (QReport_JetEFrac[jtyp][0]->getStatus()==300)
307  qr_Jet_EFrac[jtyp][0] = 0;
308  else
309  qr_Jet_EFrac[jtyp][0] = -1;
310  }
311  else{ qr_Jet_EFrac[jtyp][0] = -2;
312  }
313 
314  if (QReport_JetEFrac[jtyp][1]){
315  if (QReport_JetEFrac[jtyp][1]->getStatus()==100 ||
316  QReport_JetEFrac[jtyp][1]->getStatus()==200)
317  qr_Jet_EFrac[jtyp][1] = 1;
318  else if (QReport_JetEFrac[jtyp][1]->getStatus()==300)
319  qr_Jet_EFrac[jtyp][1] = 0;
320  else
321  qr_Jet_EFrac[jtyp][1] = -1;
322  }
323  else{ qr_Jet_EFrac[jtyp][1] = -2;
324  }
325 
326  if (verbose_) {
327  printf("====================Jet Type %d QTest Report Summary========================\n",jtyp);
328  printf("Eta: Phi: Pt 1: 2: Const/Ntracks 1: 2: EFrac/tracknhits 1: 2:\n");
329 
330  printf("%2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f\n", \
331  qr_Jet_Eta[jtyp], \
332  qr_Jet_Phi[jtyp], \
333  qr_Jet_Pt[jtyp][0], \
334  qr_Jet_Pt[jtyp][1], \
335  qr_Jet_Constituents[jtyp][0], \
336  qr_Jet_Constituents[jtyp][1], \
337  qr_Jet_EFrac[jtyp][0], \
338  qr_Jet_EFrac[jtyp][1]);
339 
340  }
341  //certification result for Jet
342 
343  //Only apply certain tests, as defined in the config
344  for (int ttyp = 0; ttyp < 2; ++ttyp) {
345  if (!jetTests[jtyp][ttyp]) {
346  qr_Jet_Pt[jtyp][ttyp] = 1;
347  if (ttyp ==1) {
348  qr_Jet_Eta[jtyp] = 1;
349  qr_Jet_Phi[jtyp] = 1;
350  }
351  qr_Jet_EFrac[jtyp][ttyp] = 1;
352  qr_Jet_Constituents[jtyp][ttyp] = 1;
353  }
354  }
355 
356 
357 
358  if ( (qr_Jet_EFrac[jtyp][0] == 0) ||
359  (qr_Jet_EFrac[jtyp][1] == 0) ||
360  (qr_Jet_Constituents[jtyp][1] == 0) ||
361  (qr_Jet_Constituents[jtyp][0] == 0) ||
362  (qr_Jet_Eta[jtyp] == 0) ||
363  (qr_Jet_Phi[jtyp] == 0) ||
364  (qr_Jet_Pt[jtyp][0] == 0) ||
365  (qr_Jet_Pt[jtyp][1] == 0)
366  )
367  dc_Jet[jtyp] = 0;
368  else if ( (qr_Jet_EFrac[jtyp][0] == -1) &&
369  (qr_Jet_EFrac[jtyp][1] == -1) &&
370  (qr_Jet_Constituents[jtyp][1] == -1) &&
371  (qr_Jet_Constituents[jtyp][0] == -1) &&
372  (qr_Jet_Eta[jtyp] == -1) &&
373  (qr_Jet_Phi[jtyp] == -1) &&
374  (qr_Jet_Pt[jtyp][0] == -1) &&
375  (qr_Jet_Pt[jtyp][1] == -1 )
376  )
377  dc_Jet[jtyp] = -1;
378  else if ( (qr_Jet_EFrac[jtyp][0] == -2) &&
379  (qr_Jet_EFrac[jtyp][1] == -2) &&
380  (qr_Jet_Constituents[jtyp][1] == -2) &&
381  (qr_Jet_Constituents[jtyp][0] == -2) &&
382  (qr_Jet_Eta[jtyp] == -2) &&
383  (qr_Jet_Phi[jtyp] == -2) &&
384  (qr_Jet_Pt[jtyp][0] == -2) &&
385  (qr_Jet_Pt[jtyp][1] == -2)
386  )
387  dc_Jet[jtyp] = -2;
388  else
389  dc_Jet[jtyp] = 1;
390 
391  if (verbose_) std::cout<<"Certifying Jet algo: "<<jtyp<<" with value: "<<dc_Jet[jtyp]<<std::endl;
392 
393 
394  CertificationSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
395  reportSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
396  }
397 
398  //-----------------------------
399  // MET DQM Data Certification
400  //-----------------------------
401  //
402  // Prepare test histograms
403  //
404  MonitorElement *meMExy[2][2];
405  MonitorElement *meMEt[2];
406  MonitorElement *meSumEt[2];
407  MonitorElement *meMETPhi[2];
408 
409  RunDir = "";
410  if (RunDir == "") newHistoName = "JetMET/MET/";
411  else newHistoName = RunDir+"/JetMET/Runsummary/MET/";
412 
413  if (isData){ //directory should be present in MC as well
414  metFolder = "Cleaned";
415  }else{
416  metFolder = "Uncleaned";
417  }
418  //MEx/MEy monitor elements
419  meMExy[0][0] = iget_.get(newHistoName+"met/"+metFolder+"/MEx");
420  meMExy[0][1] = iget_.get(newHistoName+"met/"+metFolder+"/MEy");
421  meMExy[1][0] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEx");
422  meMExy[1][1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEy");
423 
424  //MET Phi monitor elements
425  meMETPhi[0] = iget_.get(newHistoName+"met/"+metFolder+"/METPhi");
426  meMETPhi[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/METPhi");
427  //MET monitor elements
428  meMEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/MET");
429  meMEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MET");
430  //SumET monitor elements
431  meSumEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/SumET");
432  meSumEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/SumET");
433 
434  //----------------------------------------------------------------------------
435  //--- Extract quality test results and fill data certification results for MET
436  //----------------------------------------------------------------------------
437 
438  // 2 types of MET {CaloMET, PfMET} // It is 5 if CaloMETNoHF is included, 4 for MuonCorMET
439  // removed 3rd type of TcMET
440  // 2 types of tests Mean test/Kolmogorov test
441  const QReport * QReport_MExy[2][2][2]={{{0}}};
442  const QReport * QReport_MEt[2][2]={{0}};
443  const QReport * QReport_SumEt[2][2]={{0}};
444  //2 types of tests phiQTest and Kolmogorov test
445  const QReport * QReport_METPhi[2][2]={{0}};
446 
447 
448  float qr_MET_MExy[2][2][2] = {{{-999.}}};
449  float qr_MET_MEt[2][2] = {{-999.}};
450  float qr_MET_SumEt[2][2] = {{-999.}};
451  float qr_MET_METPhi[2][2] = {{-999.}};
452  float dc_MET[2] = {-999.};
453 
454 
455  // J.Piedra, 27/02/212
456  // removed MuCorrMET & TcMET --> loop up to 2 instead of 4, remove already from definition
457  for (int mtyp = 0; mtyp < 2; ++mtyp){
458  //Mean test results
459  if (meMExy[mtyp][0] && meMExy[mtyp][0]->getRootObject()) {
460  QReport_MExy[mtyp][0][0] = meMExy[mtyp][0]->getQReport("meanMExyTest");
461  QReport_MExy[mtyp][1][0] = meMExy[mtyp][0]->getQReport("KolmogorovTest");
462  }
463  if (meMExy[mtyp][1]&& meMExy[mtyp][1]->getRootObject()) {
464  QReport_MExy[mtyp][0][1] = meMExy[mtyp][1]->getQReport("meanMExyTest");
465  QReport_MExy[mtyp][1][1] = meMExy[mtyp][1]->getQReport("KolmogorovTest");
466  }
467  if (meMEt[mtyp] && meMEt[mtyp]->getRootObject()) {
468  QReport_MEt[mtyp][0] = meMEt[mtyp]->getQReport("meanMETTest");
469  QReport_MEt[mtyp][1] = meMEt[mtyp]->getQReport("KolmogorovTest");
470  }
471 
472  if (meSumEt[mtyp] && meSumEt[mtyp]->getRootObject()) {
473  QReport_SumEt[mtyp][0] = meSumEt[mtyp]->getQReport("meanSumETTest");
474  QReport_SumEt[mtyp][1] = meSumEt[mtyp]->getQReport("KolmogorovTest");
475  }
476 
477  if (meMETPhi[mtyp] && meMETPhi[mtyp]->getRootObject()) {
478  QReport_METPhi[mtyp][0] = meMETPhi[mtyp]->getQReport("phiQTest");
479  QReport_METPhi[mtyp][1] = meMETPhi[mtyp]->getQReport("KolmogorovTest");
480  }
481  for (int testtyp = 0; testtyp < 2; ++testtyp) {
482  //MEx test
483  if (QReport_MExy[mtyp][testtyp][0]){
484  if (QReport_MExy[mtyp][testtyp][0]->getStatus()==100 ||
485  QReport_MExy[mtyp][testtyp][0]->getStatus()==200)
486  qr_MET_MExy[mtyp][testtyp][0] = 1;
487  else if (QReport_MExy[mtyp][testtyp][0]->getStatus()==300)
488  qr_MET_MExy[mtyp][testtyp][0] = 0;
489  else
490  qr_MET_MExy[mtyp][testtyp][0] = -1;
491  }
492  else qr_MET_MExy[mtyp][testtyp][0] = -2;
493  //MEy test
494  if (QReport_MExy[mtyp][testtyp][1]){
495  if (QReport_MExy[mtyp][testtyp][1]->getStatus()==100 ||
496  QReport_MExy[mtyp][testtyp][1]->getStatus()==200)
497  qr_MET_MExy[mtyp][testtyp][1] = 1;
498  else if (QReport_MExy[mtyp][testtyp][1]->getStatus()==300)
499  qr_MET_MExy[mtyp][testtyp][1] = 0;
500  else
501  qr_MET_MExy[mtyp][testtyp][1] = -1;
502  }
503  else qr_MET_MExy[mtyp][testtyp][1] = -2;
504 
505  //MEt test
506  if (QReport_MEt[mtyp][testtyp]){
507  if (QReport_MEt[mtyp][testtyp]->getStatus()==100 ||
508  QReport_MEt[mtyp][testtyp]->getStatus()==200)
509  qr_MET_MEt[mtyp][testtyp] = 1;
510  else if (QReport_MEt[mtyp][testtyp]->getStatus()==300)
511  qr_MET_MEt[mtyp][testtyp] = 0;
512  else
513  qr_MET_MEt[mtyp][testtyp] = -1;
514  }
515  else{
516  qr_MET_MEt[mtyp][testtyp] = -2;
517  }
518  //SumEt test
519  if (QReport_SumEt[mtyp][testtyp]){
520  if (QReport_SumEt[mtyp][testtyp]->getStatus()==100 ||
521  QReport_SumEt[mtyp][testtyp]->getStatus()==200)
522  qr_MET_SumEt[mtyp][testtyp] = 1;
523  else if (QReport_SumEt[mtyp][testtyp]->getStatus()==300)
524  qr_MET_SumEt[mtyp][testtyp] = 0;
525  else
526  qr_MET_SumEt[mtyp][testtyp] = -1;
527  }
528  else{
529  qr_MET_SumEt[mtyp][testtyp] = -2;
530  }
531  //METPhi test
532  if (QReport_METPhi[mtyp][testtyp]){
533  if (QReport_METPhi[mtyp][testtyp]->getStatus()==100 ||
534  QReport_METPhi[mtyp][testtyp]->getStatus()==200)
535  qr_MET_METPhi[mtyp][testtyp] = 1;
536  else if (QReport_METPhi[mtyp][testtyp]->getStatus()==300)
537  qr_MET_METPhi[mtyp][testtyp] = 0;
538  else
539  qr_MET_METPhi[mtyp][testtyp] = -1;
540  }
541  else{
542  qr_MET_METPhi[mtyp][testtyp] = -2;
543  }
544  }
545 
546 
547  if (verbose_) {
548  //certification result for MET
549  printf("====================MET Type %d QTest Report Summary========================\n",mtyp);
550  printf("MEx test MEy test MEt test: SumEt test: METPhi test:\n");
551  for (int tt = 0; tt < 2; ++tt) {
552  printf("%2.2f %2.2f %2.2f %2.2f %2.2f\n",qr_MET_MExy[mtyp][tt][0], \
553  qr_MET_MExy[mtyp][tt][1], \
554  qr_MET_MEt[mtyp][tt], \
555  qr_MET_SumEt[mtyp][tt], \
556  qr_MET_METPhi[mtyp][tt]);
557  }
558  printf("===========================================================================\n");
559  }
560 
561 
562  //Only apply certain tests, as defined in the config
563  for (int ttyp = 0; ttyp < 2; ++ttyp) {
564  if (!metTests[mtyp][ttyp]) {
565  qr_MET_MExy[mtyp][ttyp][0] = 1;
566  qr_MET_MExy[mtyp][ttyp][1] = 1;
567  qr_MET_MEt[mtyp][ttyp] = 1;
568  qr_MET_SumEt[mtyp][ttyp] = 1;
569  qr_MET_METPhi[mtyp][ttyp] = 1;
570  }
571  }
572 
573 
574  if (
575  (qr_MET_MExy[mtyp][0][0] == 0) ||
576  (qr_MET_MExy[mtyp][0][1] == 0) ||
577  (qr_MET_MEt[mtyp][0] == 0) ||
578  (qr_MET_SumEt[mtyp][0] == 0) ||
579  (qr_MET_METPhi[mtyp][0] == 0) ||
580  (qr_MET_MExy[mtyp][1][0] == 0) ||
581  (qr_MET_MExy[mtyp][1][1] == 0) ||
582  (qr_MET_MEt[mtyp][1] == 0) ||
583  (qr_MET_SumEt[mtyp][1] == 0) ||
584  (qr_MET_METPhi[mtyp][1] == 0)
585  )
586  dc_MET[mtyp] = 0;
587  else if (
588  (qr_MET_MExy[mtyp][0][0] == -1) &&
589  (qr_MET_MExy[mtyp][0][1] == -1) &&
590  (qr_MET_MEt[mtyp][0] == -1) &&
591  (qr_MET_SumEt[mtyp][0] == -1) &&
592  (qr_MET_METPhi[mtyp][0] == -1) &&
593  (qr_MET_MExy[mtyp][1][0] == -1) &&
594  (qr_MET_MExy[mtyp][1][1] == -1) &&
595  (qr_MET_MEt[mtyp][1] == -1) &&
596  (qr_MET_SumEt[mtyp][1] == -1) &&
597  (qr_MET_METPhi[mtyp][1] == -1)
598  )
599  dc_MET[mtyp] = -1;
600  else if (
601  (qr_MET_MExy[mtyp][0][0] == -2) &&
602  (qr_MET_MExy[mtyp][0][1] == -2) &&
603  (qr_MET_MEt[mtyp][0] == -2) &&
604  (qr_MET_SumEt[mtyp][0] == -2) &&
605  (qr_MET_METPhi[mtyp][0] == -2) &&
606  (qr_MET_MExy[mtyp][1][0] == -2) &&
607  (qr_MET_MExy[mtyp][1][1] == -2) &&
608  (qr_MET_MEt[mtyp][1] == -2) &&
609  (qr_MET_SumEt[mtyp][1] == -2) &&
610  (qr_MET_METPhi[mtyp][1] == -2)
611  )
612  dc_MET[mtyp] = -2;
613  else
614  dc_MET[mtyp] = 1;
615 
616  if (verbose_) std::cout<<"Certifying MET algo: "<<mtyp<<" with value: "<<dc_MET[mtyp]<<std::endl;
617  CertificationSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
618  reportSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
619  }
620 
621 
622  //----------------------------------------------------------------------------
623  //--- Extract quality test results and fill data certification results for MET
624  //----------------------------------------------------------------------------
625  // Commenting out unused but initialized variables. [Suchandra Dutta]
626  float dc_CT[3] = {-2.};
627  dc_CT[0] = -2.;
628  dc_CT[1] = -2.;
629  dc_CT[2] = -2.;
630 
631  for (int cttyp = 0; cttyp < 3; ++cttyp) {
632 
633  if (verbose_) std::cout<<"Certifying CaloTowers with value: "<<dc_CT[cttyp]<<std::endl;
634  CertificationSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
635  reportSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
636  }
637  ibook_.setCurrentFolder("");
638 }
639 
640 //define this as a plug-in
641 //DEFINE_FWK_MODULE(DataCertificationJetMET);
T getUntrackedParameter(std::string const &, T const &) const
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
MonitorElement * CertificationSummaryMap
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:291
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void Fill(long long x)
MonitorElement * CertificationSummary
TObject * getRootObject(void) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:131
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:107
TH2F * getTH2F(void) const
DataCertificationJetMET(const edm::ParameterSet &)