File indexing completed on 2024-04-06 12:32:56
0001 #ifndef RecoB_HistoCompare_h
0002 #define RecoB_HistoCompare_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "TFile.h"
0016 #include "TH1.h"
0017 #include "TString.h"
0018
0019 #include <iostream>
0020 #include <string>
0021 #include <vector>
0022
0023 class HistoCompare {
0024 public:
0025 HistoCompare();
0026 HistoCompare(const TString &refFilename);
0027
0028 ~HistoCompare();
0029
0030 TH1 *Compare(TH1 *h, const TString &hname);
0031
0032 void SetReferenceFilename(const TString &filename) {
0033 refFilename_ = filename;
0034
0035 refFile_ = new TFile(refFilename_);
0036 if (refFile_->IsZombie()) {
0037 std::cout << " Error openning file " << refFilename_ << std::endl;
0038 std::cout << " we will not compare histograms. " << std::endl;
0039 do_nothing_ = true;
0040 }
0041 std::cout << " open file" << std::endl;
0042 };
0043
0044 void SetChi2Test(bool test = true) { setChi2Test_ = test; };
0045
0046 void SetKGTest(bool test = true) { setKGTest_ = test; };
0047
0048 double GetResult() { return result_; };
0049
0050 private:
0051 bool setChi2Test_;
0052 bool setKGTest_;
0053 double result_;
0054 bool do_nothing_;
0055
0056 TH1 *resHisto_;
0057 TH1 *refHisto_;
0058 TFile *refFile_;
0059
0060 TString refFilename_;
0061
0062
0063 };
0064
0065 #endif