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  cleaningdir = "Cleaned";
132 
133  //Jet Phi histos
134  meJetPhi[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_Barrel");
135  meJetPhi[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_EndCap");
136  meJetPhi[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Phi_Forward");
137  meJetPhi[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Phi");
138  //meJetPhi[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Phi");
139 
140  //Jet Eta histos
141  meJetEta[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
142  meJetEta[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Eta");
143  meJetEta[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EtaFirst");
144  meJetEta[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Eta");
145  //meJetEta[4] = iget_.get(newHistoName+cleaningdir+"JetPlusTrackZSPCorJetAntiKt5/Eta");
146 
147  //Jet Pt histos
148  meJetPt[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Barrel");
149  meJetPt[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_EndCap");
150  meJetPt[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Pt_Forward");
151  meJetPt[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Pt_2");
152 
154  meJetConstituents[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Barrel");
155  meJetConstituents[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_EndCap");
156  meJetConstituents[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/Constituents_Forward");
157  meJetConstituents[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/Constituents");
158  //
160  meJetEMFrac[0] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Barrel");
161  meJetEMFrac[1] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_EndCap");
162  meJetEMFrac[2] = iget_.get(newHistoName+cleaningdir+jetAlgo+"PFJets/EFrac_Forward");
163  meJetEMFrac[3] = iget_.get(newHistoName+cleaningdir+jetAlgo+"CaloJets/EFrac");
164 
165 
166  //------------------------------------------------------------------------------
167  //--- Extract quality test results and fill data certification results for Jets
168  //--- Tests for Calo Barrel, EndCap and Forward, as well as PF and JPT jets
169  //--- For Calo and PF jets:
170  //--- Look at mean of Constituents, EM Frac and Pt
171  //--- Look at Kolmogorov result for Eta, Phi, and Pt
172  //--- For JPT jets:
173  //--- Look at mean of Pt, AllPionsTrackNHits?, nTracks,
174  //--- Look at Kolmogorov result for Eta, Phi, and Pt
175  //------------------------------------------------------------------------------
176 
177 
178  // Four types of jets {AK5 Barrel, AK5 EndCap, AK5 Forward, PF}, removed JPT which is 5th type of jets
179  //----------------------------------------------------------------------------
180  // Kolmogorov (KS) tests
181  const QReport* QReport_JetEta[4] = {0};
182  const QReport* QReport_JetPhi[4] = {0};
183  // Mean and KS tests for Calo and PF jets
184  const QReport* QReport_JetConstituents[4][2] = {{0}};
185  const QReport* QReport_JetEFrac[4][2] = {{0}};
186  const QReport* QReport_JetPt[4][2] = {{0}};
187 
188  // Mean and KS tests for JPT jets
189  //const QReport* QReport_JetNTracks[2] = {0, 0};
190  float qr_Jet_Eta[4] = {-1};
191  float qr_Jet_Phi[4] = {-1};
192  float dc_Jet[4] = {-1};
193 
194  float qr_Jet_Constituents[4][2] = {{-1}};
195  float qr_Jet_EFrac[4][2] = {{-1}};
196  float qr_Jet_Pt[4][2] = {{-1}};
197 
198 
199  // Loop
200  //----------------------------------------------------------------------------
201  for (int jtyp=0; jtyp<4; ++jtyp) {
202  // Mean test results
203 
204  if (meJetConstituents[jtyp] && meJetConstituents[jtyp]->getRootObject() ) {
205  QReport_JetConstituents[jtyp][0] = meJetConstituents[jtyp]->getQReport("meanJetConstituentsTest");
206  QReport_JetConstituents[jtyp][1] = meJetConstituents[jtyp]->getQReport("KolmogorovTest");
207  }
208  if (meJetEMFrac[jtyp]&& meJetEMFrac[jtyp]->getRootObject() ) {
209  QReport_JetEFrac[jtyp][0] = meJetEMFrac[jtyp]->getQReport("meanEMFractionTest");
210  QReport_JetEFrac[jtyp][1] = meJetEMFrac[jtyp]->getQReport("KolmogorovTest");
211  }
212  if (meJetPt[jtyp] && meJetPt[jtyp]->getRootObject() ) {
213  QReport_JetPt[jtyp][0] = meJetPt[jtyp]->getQReport("meanJetPtTest");
214  QReport_JetPt[jtyp][1] = meJetPt[jtyp]->getQReport("KolmogorovTest");
215  }
216  if (meJetPhi[jtyp] && meJetPhi[jtyp]->getRootObject()){
217  QReport_JetPhi[jtyp] = meJetPhi[jtyp]->getQReport("KolmogorovTest");
218  }
219  if (meJetEta[jtyp] && meJetEta[jtyp]->getRootObject()){
220  QReport_JetEta[jtyp] = meJetEta[jtyp]->getQReport("KolmogorovTest");
221  }
222 
223  //Jet Pt test
224  if (QReport_JetPt[jtyp][0]){
225  //std::cout<<"jet type test pt "<<jtyp<<"/"<<QReport_JetPt[jtyp][0]->getStatus()<<std::endl;
226  if (QReport_JetPt[jtyp][0]->getStatus()==100 ||
227  QReport_JetPt[jtyp][0]->getStatus()==200)
228  qr_Jet_Pt[jtyp][0] = 1;
229  else if (QReport_JetPt[jtyp][0]->getStatus()==300)
230  qr_Jet_Pt[jtyp][0] = 0;
231  else
232  qr_Jet_Pt[jtyp][0] = -1;
233  }
234  else{ qr_Jet_Pt[jtyp][0] = -2;
235  //std::cout<<"qreport is REALLY NULL type test pt "<<jtyp<<" 0 "<<std::endl;
236  }
237  if (QReport_JetPt[jtyp][1]){
238  if (QReport_JetPt[jtyp][1]->getStatus()==100 ||
239  QReport_JetPt[jtyp][1]->getStatus()==200)
240  qr_Jet_Pt[jtyp][1] = 1;
241  else if (QReport_JetPt[jtyp][1]->getStatus()==300)
242  qr_Jet_Pt[jtyp][1] = 0;
243  else
244  qr_Jet_Pt[jtyp][1] = -1;
245  }
246  else{ qr_Jet_Pt[jtyp][1] = -2;
247  }
248 
249  //Jet Phi test
250  if (QReport_JetPhi[jtyp]){
251  if (QReport_JetPhi[jtyp]->getStatus()==100 ||
252  QReport_JetPhi[jtyp]->getStatus()==200)
253  qr_Jet_Phi[jtyp] = 1;
254  else if (QReport_JetPhi[jtyp]->getStatus()==300)
255  qr_Jet_Phi[jtyp] = 0;
256  else
257  qr_Jet_Phi[jtyp] = -1;
258  }
259  else{ qr_Jet_Phi[jtyp] = -2;
260  }
261  //Jet Eta test
262  if (QReport_JetEta[jtyp]){
263  if (QReport_JetEta[jtyp]->getStatus()==100 ||
264  QReport_JetEta[jtyp]->getStatus()==200)
265  qr_Jet_Eta[jtyp] = 1;
266  else if (QReport_JetEta[jtyp]->getStatus()==300)
267  qr_Jet_Eta[jtyp] = 0;
268  else
269  qr_Jet_Eta[jtyp] = -1;
270  }
271  else{
272  qr_Jet_Eta[jtyp] = -2;
273  }
274  //Jet Constituents test
275  if (QReport_JetConstituents[jtyp][0]){
276  if (QReport_JetConstituents[jtyp][0]->getStatus()==100 ||
277  QReport_JetConstituents[jtyp][0]->getStatus()==200)
278  qr_Jet_Constituents[jtyp][0] = 1;
279  else if (QReport_JetConstituents[jtyp][0]->getStatus()==300)
280  qr_Jet_Constituents[jtyp][0] = 0;
281  else
282  qr_Jet_Constituents[jtyp][0] = -1;
283  }
284  else{ qr_Jet_Constituents[jtyp][0] = -2;
285  }
286 
287  if (QReport_JetConstituents[jtyp][1]){
288  if (QReport_JetConstituents[jtyp][1]->getStatus()==100 ||
289  QReport_JetConstituents[jtyp][1]->getStatus()==200)
290  qr_Jet_Constituents[jtyp][1] = 1;
291  else if (QReport_JetConstituents[jtyp][1]->getStatus()==300)
292  qr_Jet_Constituents[jtyp][1] = 0;
293  else
294  qr_Jet_Constituents[jtyp][1] = -1;
295  }
296  else{ qr_Jet_Constituents[jtyp][1] = -2;
297  }
298  //Jet EMFrac test
299  if (QReport_JetEFrac[jtyp][0]){
300  if (QReport_JetEFrac[jtyp][0]->getStatus()==100 ||
301  QReport_JetEFrac[jtyp][0]->getStatus()==200)
302  qr_Jet_EFrac[jtyp][0] = 1;
303  else if (QReport_JetEFrac[jtyp][0]->getStatus()==300)
304  qr_Jet_EFrac[jtyp][0] = 0;
305  else
306  qr_Jet_EFrac[jtyp][0] = -1;
307  }
308  else{ qr_Jet_EFrac[jtyp][0] = -2;
309  }
310 
311  if (QReport_JetEFrac[jtyp][1]){
312  if (QReport_JetEFrac[jtyp][1]->getStatus()==100 ||
313  QReport_JetEFrac[jtyp][1]->getStatus()==200)
314  qr_Jet_EFrac[jtyp][1] = 1;
315  else if (QReport_JetEFrac[jtyp][1]->getStatus()==300)
316  qr_Jet_EFrac[jtyp][1] = 0;
317  else
318  qr_Jet_EFrac[jtyp][1] = -1;
319  }
320  else{ qr_Jet_EFrac[jtyp][1] = -2;
321  }
322 
323  if (verbose_) {
324  printf("====================Jet Type %d QTest Report Summary========================\n",jtyp);
325  printf("Eta: Phi: Pt 1: 2: Const/Ntracks 1: 2: EFrac/tracknhits 1: 2:\n");
326 
327  printf("%2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f %2.2f\n", \
328  qr_Jet_Eta[jtyp], \
329  qr_Jet_Phi[jtyp], \
330  qr_Jet_Pt[jtyp][0], \
331  qr_Jet_Pt[jtyp][1], \
332  qr_Jet_Constituents[jtyp][0], \
333  qr_Jet_Constituents[jtyp][1], \
334  qr_Jet_EFrac[jtyp][0], \
335  qr_Jet_EFrac[jtyp][1]);
336 
337  }
338  //certification result for Jet
339 
340  //Only apply certain tests, as defined in the config
341  for (int ttyp = 0; ttyp < 2; ++ttyp) {
342  if (!jetTests[jtyp][ttyp]) {
343  qr_Jet_Pt[jtyp][ttyp] = 1;
344  if (ttyp ==1) {
345  qr_Jet_Eta[jtyp] = 1;
346  qr_Jet_Phi[jtyp] = 1;
347  }
348  qr_Jet_EFrac[jtyp][ttyp] = 1;
349  qr_Jet_Constituents[jtyp][ttyp] = 1;
350  }
351  }
352 
353 
354 
355  if ( (qr_Jet_EFrac[jtyp][0] == 0) ||
356  (qr_Jet_EFrac[jtyp][1] == 0) ||
357  (qr_Jet_Constituents[jtyp][1] == 0) ||
358  (qr_Jet_Constituents[jtyp][0] == 0) ||
359  (qr_Jet_Eta[jtyp] == 0) ||
360  (qr_Jet_Phi[jtyp] == 0) ||
361  (qr_Jet_Pt[jtyp][0] == 0) ||
362  (qr_Jet_Pt[jtyp][1] == 0)
363  )
364  dc_Jet[jtyp] = 0;
365  else if ( (qr_Jet_EFrac[jtyp][0] == -1) &&
366  (qr_Jet_EFrac[jtyp][1] == -1) &&
367  (qr_Jet_Constituents[jtyp][1] == -1) &&
368  (qr_Jet_Constituents[jtyp][0] == -1) &&
369  (qr_Jet_Eta[jtyp] == -1) &&
370  (qr_Jet_Phi[jtyp] == -1) &&
371  (qr_Jet_Pt[jtyp][0] == -1) &&
372  (qr_Jet_Pt[jtyp][1] == -1 )
373  )
374  dc_Jet[jtyp] = -1;
375  else if ( (qr_Jet_EFrac[jtyp][0] == -2) &&
376  (qr_Jet_EFrac[jtyp][1] == -2) &&
377  (qr_Jet_Constituents[jtyp][1] == -2) &&
378  (qr_Jet_Constituents[jtyp][0] == -2) &&
379  (qr_Jet_Eta[jtyp] == -2) &&
380  (qr_Jet_Phi[jtyp] == -2) &&
381  (qr_Jet_Pt[jtyp][0] == -2) &&
382  (qr_Jet_Pt[jtyp][1] == -2)
383  )
384  dc_Jet[jtyp] = -2;
385  else
386  dc_Jet[jtyp] = 1;
387 
388  if (verbose_) std::cout<<"Certifying Jet algo: "<<jtyp<<" with value: "<<dc_Jet[jtyp]<<std::endl;
389 
390 
391  CertificationSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
392  reportSummaryMap->Fill(2, 4-jtyp, dc_Jet[jtyp]);
393  }
394 
395  //-----------------------------
396  // MET DQM Data Certification
397  //-----------------------------
398  //
399  // Prepare test histograms
400  //
401  MonitorElement *meMExy[2][2];
402  MonitorElement *meMEt[2];
403  MonitorElement *meSumEt[2];
404  MonitorElement *meMETPhi[2];
405 
406  RunDir = "";
407  if (RunDir == "") newHistoName = "JetMET/MET/";
408  else newHistoName = RunDir+"/JetMET/Runsummary/MET/";
409 
410  metFolder = "Cleaned";
411 
412  //MEx/MEy monitor elements
413  meMExy[0][0] = iget_.get(newHistoName+"met/"+metFolder+"/MEx");
414  meMExy[0][1] = iget_.get(newHistoName+"met/"+metFolder+"/MEy");
415  meMExy[1][0] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEx");
416  meMExy[1][1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MEy");
417 
418  //MET Phi monitor elements
419  meMETPhi[0] = iget_.get(newHistoName+"met/"+metFolder+"/METPhi");
420  meMETPhi[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/METPhi");
421  //MET monitor elements
422  meMEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/MET");
423  meMEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/MET");
424  //SumET monitor elements
425  meSumEt[0] = iget_.get(newHistoName+"met/"+metFolder+"/SumET");
426  meSumEt[1] = iget_.get(newHistoName+"pfMet/"+metFolder+"/SumET");
427 
428  //----------------------------------------------------------------------------
429  //--- Extract quality test results and fill data certification results for MET
430  //----------------------------------------------------------------------------
431 
432  // 2 types of MET {CaloMET, PfMET} // It is 5 if CaloMETNoHF is included, 4 for MuonCorMET
433  // removed 3rd type of TcMET
434  // 2 types of tests Mean test/Kolmogorov test
435  const QReport * QReport_MExy[2][2][2]={{{0}}};
436  const QReport * QReport_MEt[2][2]={{0}};
437  const QReport * QReport_SumEt[2][2]={{0}};
438  //2 types of tests phiQTest and Kolmogorov test
439  const QReport * QReport_METPhi[2][2]={{0}};
440 
441 
442  float qr_MET_MExy[2][2][2] = {{{-999.}}};
443  float qr_MET_MEt[2][2] = {{-999.}};
444  float qr_MET_SumEt[2][2] = {{-999.}};
445  float qr_MET_METPhi[2][2] = {{-999.}};
446  float dc_MET[2] = {-999.};
447 
448 
449  // J.Piedra, 27/02/212
450  // removed MuCorrMET & TcMET --> loop up to 2 instead of 4, remove already from definition
451  for (int mtyp = 0; mtyp < 2; ++mtyp){
452  //Mean test results
453  if (meMExy[mtyp][0] && meMExy[mtyp][0]->getRootObject()) {
454  QReport_MExy[mtyp][0][0] = meMExy[mtyp][0]->getQReport("meanMExyTest");
455  QReport_MExy[mtyp][1][0] = meMExy[mtyp][0]->getQReport("KolmogorovTest");
456  }
457  if (meMExy[mtyp][1]&& meMExy[mtyp][1]->getRootObject()) {
458  QReport_MExy[mtyp][0][1] = meMExy[mtyp][1]->getQReport("meanMExyTest");
459  QReport_MExy[mtyp][1][1] = meMExy[mtyp][1]->getQReport("KolmogorovTest");
460  }
461  if (meMEt[mtyp] && meMEt[mtyp]->getRootObject()) {
462  QReport_MEt[mtyp][0] = meMEt[mtyp]->getQReport("meanMETTest");
463  QReport_MEt[mtyp][1] = meMEt[mtyp]->getQReport("KolmogorovTest");
464  }
465 
466  if (meSumEt[mtyp] && meSumEt[mtyp]->getRootObject()) {
467  QReport_SumEt[mtyp][0] = meSumEt[mtyp]->getQReport("meanSumETTest");
468  QReport_SumEt[mtyp][1] = meSumEt[mtyp]->getQReport("KolmogorovTest");
469  }
470 
471  if (meMETPhi[mtyp] && meMETPhi[mtyp]->getRootObject()) {
472  QReport_METPhi[mtyp][0] = meMETPhi[mtyp]->getQReport("phiQTest");
473  QReport_METPhi[mtyp][1] = meMETPhi[mtyp]->getQReport("KolmogorovTest");
474  }
475  for (int testtyp = 0; testtyp < 2; ++testtyp) {
476  //MEx test
477  if (QReport_MExy[mtyp][testtyp][0]){
478  if (QReport_MExy[mtyp][testtyp][0]->getStatus()==100 ||
479  QReport_MExy[mtyp][testtyp][0]->getStatus()==200)
480  qr_MET_MExy[mtyp][testtyp][0] = 1;
481  else if (QReport_MExy[mtyp][testtyp][0]->getStatus()==300)
482  qr_MET_MExy[mtyp][testtyp][0] = 0;
483  else
484  qr_MET_MExy[mtyp][testtyp][0] = -1;
485  }
486  else qr_MET_MExy[mtyp][testtyp][0] = -2;
487  //MEy test
488  if (QReport_MExy[mtyp][testtyp][1]){
489  if (QReport_MExy[mtyp][testtyp][1]->getStatus()==100 ||
490  QReport_MExy[mtyp][testtyp][1]->getStatus()==200)
491  qr_MET_MExy[mtyp][testtyp][1] = 1;
492  else if (QReport_MExy[mtyp][testtyp][1]->getStatus()==300)
493  qr_MET_MExy[mtyp][testtyp][1] = 0;
494  else
495  qr_MET_MExy[mtyp][testtyp][1] = -1;
496  }
497  else qr_MET_MExy[mtyp][testtyp][1] = -2;
498 
499  //MEt test
500  if (QReport_MEt[mtyp][testtyp]){
501  if (QReport_MEt[mtyp][testtyp]->getStatus()==100 ||
502  QReport_MEt[mtyp][testtyp]->getStatus()==200)
503  qr_MET_MEt[mtyp][testtyp] = 1;
504  else if (QReport_MEt[mtyp][testtyp]->getStatus()==300)
505  qr_MET_MEt[mtyp][testtyp] = 0;
506  else
507  qr_MET_MEt[mtyp][testtyp] = -1;
508  }
509  else{
510  qr_MET_MEt[mtyp][testtyp] = -2;
511  }
512  //SumEt test
513  if (QReport_SumEt[mtyp][testtyp]){
514  if (QReport_SumEt[mtyp][testtyp]->getStatus()==100 ||
515  QReport_SumEt[mtyp][testtyp]->getStatus()==200)
516  qr_MET_SumEt[mtyp][testtyp] = 1;
517  else if (QReport_SumEt[mtyp][testtyp]->getStatus()==300)
518  qr_MET_SumEt[mtyp][testtyp] = 0;
519  else
520  qr_MET_SumEt[mtyp][testtyp] = -1;
521  }
522  else{
523  qr_MET_SumEt[mtyp][testtyp] = -2;
524  }
525  //METPhi test
526  if (QReport_METPhi[mtyp][testtyp]){
527  if (QReport_METPhi[mtyp][testtyp]->getStatus()==100 ||
528  QReport_METPhi[mtyp][testtyp]->getStatus()==200)
529  qr_MET_METPhi[mtyp][testtyp] = 1;
530  else if (QReport_METPhi[mtyp][testtyp]->getStatus()==300)
531  qr_MET_METPhi[mtyp][testtyp] = 0;
532  else
533  qr_MET_METPhi[mtyp][testtyp] = -1;
534  }
535  else{
536  qr_MET_METPhi[mtyp][testtyp] = -2;
537  }
538  }
539 
540 
541  if (verbose_) {
542  //certification result for MET
543  printf("====================MET Type %d QTest Report Summary========================\n",mtyp);
544  printf("MEx test MEy test MEt test: SumEt test: METPhi test:\n");
545  for (int tt = 0; tt < 2; ++tt) {
546  printf("%2.2f %2.2f %2.2f %2.2f %2.2f\n",qr_MET_MExy[mtyp][tt][0], \
547  qr_MET_MExy[mtyp][tt][1], \
548  qr_MET_MEt[mtyp][tt], \
549  qr_MET_SumEt[mtyp][tt], \
550  qr_MET_METPhi[mtyp][tt]);
551  }
552  printf("===========================================================================\n");
553  }
554 
555 
556  //Only apply certain tests, as defined in the config
557  for (int ttyp = 0; ttyp < 2; ++ttyp) {
558  if (!metTests[mtyp][ttyp]) {
559  qr_MET_MExy[mtyp][ttyp][0] = 1;
560  qr_MET_MExy[mtyp][ttyp][1] = 1;
561  qr_MET_MEt[mtyp][ttyp] = 1;
562  qr_MET_SumEt[mtyp][ttyp] = 1;
563  qr_MET_METPhi[mtyp][ttyp] = 1;
564  }
565  }
566 
567 
568  if (
569  (qr_MET_MExy[mtyp][0][0] == 0) ||
570  (qr_MET_MExy[mtyp][0][1] == 0) ||
571  (qr_MET_MEt[mtyp][0] == 0) ||
572  (qr_MET_SumEt[mtyp][0] == 0) ||
573  (qr_MET_METPhi[mtyp][0] == 0) ||
574  (qr_MET_MExy[mtyp][1][0] == 0) ||
575  (qr_MET_MExy[mtyp][1][1] == 0) ||
576  (qr_MET_MEt[mtyp][1] == 0) ||
577  (qr_MET_SumEt[mtyp][1] == 0) ||
578  (qr_MET_METPhi[mtyp][1] == 0)
579  )
580  dc_MET[mtyp] = 0;
581  else if (
582  (qr_MET_MExy[mtyp][0][0] == -1) &&
583  (qr_MET_MExy[mtyp][0][1] == -1) &&
584  (qr_MET_MEt[mtyp][0] == -1) &&
585  (qr_MET_SumEt[mtyp][0] == -1) &&
586  (qr_MET_METPhi[mtyp][0] == -1) &&
587  (qr_MET_MExy[mtyp][1][0] == -1) &&
588  (qr_MET_MExy[mtyp][1][1] == -1) &&
589  (qr_MET_MEt[mtyp][1] == -1) &&
590  (qr_MET_SumEt[mtyp][1] == -1) &&
591  (qr_MET_METPhi[mtyp][1] == -1)
592  )
593  dc_MET[mtyp] = -1;
594  else if (
595  (qr_MET_MExy[mtyp][0][0] == -2) &&
596  (qr_MET_MExy[mtyp][0][1] == -2) &&
597  (qr_MET_MEt[mtyp][0] == -2) &&
598  (qr_MET_SumEt[mtyp][0] == -2) &&
599  (qr_MET_METPhi[mtyp][0] == -2) &&
600  (qr_MET_MExy[mtyp][1][0] == -2) &&
601  (qr_MET_MExy[mtyp][1][1] == -2) &&
602  (qr_MET_MEt[mtyp][1] == -2) &&
603  (qr_MET_SumEt[mtyp][1] == -2) &&
604  (qr_MET_METPhi[mtyp][1] == -2)
605  )
606  dc_MET[mtyp] = -2;
607  else
608  dc_MET[mtyp] = 1;
609 
610  if (verbose_) std::cout<<"Certifying MET algo: "<<mtyp<<" with value: "<<dc_MET[mtyp]<<std::endl;
611  CertificationSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
612  reportSummaryMap->Fill(1, 4-mtyp, dc_MET[mtyp]);
613  }
614 
615 
616  //----------------------------------------------------------------------------
617  //--- Extract quality test results and fill data certification results for MET
618  //----------------------------------------------------------------------------
619  // Commenting out unused but initialized variables. [Suchandra Dutta]
620  float dc_CT[3] = {-2.};
621  dc_CT[0] = -2.;
622  dc_CT[1] = -2.;
623  dc_CT[2] = -2.;
624 
625  for (int cttyp = 0; cttyp < 3; ++cttyp) {
626 
627  if (verbose_) std::cout<<"Certifying CaloTowers with value: "<<dc_CT[cttyp]<<std::endl;
628  CertificationSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
629  reportSummaryMap->Fill(0, 4-cttyp, dc_CT[cttyp]);
630  }
631  ibook_.setCurrentFolder("");
632 }
633 
634 //define this as a plug-in
635 //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:298
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:133
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
TH2F * getTH2F(void) const
DataCertificationJetMET(const edm::ParameterSet &)