CMS 3D CMS Logo

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