CMS 3D CMS Logo

HistoCompare.h
Go to the documentation of this file.
1 #ifndef RecoB_HistoCompare_h
2 #define RecoB_HistoCompare_h
3 
16 #include "TFile.h"
17 #include "TH1.h"
18 #include "TString.h"
19 
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 
24 class HistoCompare {
25 
26  public:
27  HistoCompare();
28  HistoCompare(const TString& refFilename);
29 
30  ~HistoCompare();
31 
32  TH1* Compare(TH1* h, const TString& hname);
33 
34  void SetReferenceFilename(const TString& filename) {
36  //if (refFile_) delete refFile_;
37  refFile_ = new TFile(refFilename_);
38  if (refFile_->IsZombie()) {
39  std::cout << " Error openning file " << refFilename_ << std::endl;
40  std::cout << " we will not compare histograms. " << std::endl;
41  do_nothing_ = true;
42  }
43  std::cout << " open file" << std::endl;
44  };
45 
46  void SetChi2Test(bool test=true) {
48  };
49 
50  void SetKGTest(bool test=true) {
51  setKGTest_ = test;
52  };
53 
54  double GetResult() { return result_; };
55 
56  private:
57 
58  bool setChi2Test_;
59  bool setKGTest_;
60  double result_;
62 
63  TH1 *resHisto_;
64  TH1 *refHisto_;
65  TFile *refFile_;
66 
67  TString refFilename_;
68 
69  //std::map<std::string, TH1*> histomap_;
70 
71 };
72 
73 #endif
void SetReferenceFilename(const TString &filename)
Definition: HistoCompare.h:34
double result_
Definition: HistoCompare.h:60
TH1 * resHisto_
Definition: HistoCompare.h:63
bool do_nothing_
Definition: HistoCompare.h:61
TH1 * refHisto_
Definition: HistoCompare.h:64
double GetResult()
Definition: HistoCompare.h:54
void SetKGTest(bool test=true)
Definition: HistoCompare.h:50
TString refFilename_
Definition: HistoCompare.h:67
void SetChi2Test(bool test=true)
Definition: HistoCompare.h:46
bool setChi2Test_
Definition: HistoCompare.h:54
TFile * refFile_
Definition: HistoCompare.h:65
TH1 * Compare(TH1 *h, const TString &hname)
Definition: HistoCompare.cc:43