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
void SetReferenceFilename(const TString &filename)
Definition: HistoCompare.h:32
double result_
Definition: HistoCompare.h:53
TH1 * resHisto_
Definition: HistoCompare.h:56
bool do_nothing_
Definition: HistoCompare.h:54
TH1 * refHisto_
Definition: HistoCompare.h:57
double GetResult()
Definition: HistoCompare.h:48
void SetKGTest(bool test=true)
Definition: HistoCompare.h:46
TString refFilename_
Definition: HistoCompare.h:60
void SetChi2Test(bool test=true)
Definition: HistoCompare.h:44
bool setChi2Test_
Definition: HistoCompare.h:48
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
TFile * refFile_
Definition: HistoCompare.h:58
TH1 * Compare(TH1 *h, const TString &hname)
Definition: HistoCompare.cc:39