CMS 3D CMS Logo

HistoCompare.h

Go to the documentation of this file.
00001 #ifndef RecoB_HistoCompare_h
00002 #define RecoB_HistoCompare_h
00003 
00017 #include "TFile.h"
00018 #include "TH1.h"
00019 #include "TString.h"
00020 
00021 #include <iostream>
00022 #include <string>
00023 #include <vector>
00024 
00025 class HistoCompare {
00026 
00027   public:
00028         HistoCompare();
00029         HistoCompare(TString refFilename);
00030 
00031         ~HistoCompare();
00032 
00033         TH1* Compare(TH1* h, TString hname);
00034 
00035         void SetReferenceFilename(TString filename) {
00036           refFilename_ = filename;
00037           //if (refFile_) delete refFile_;
00038           refFile_ = new TFile(refFilename_);
00039           if (refFile_->IsZombie()) {
00040                   std::cout << " Error openning file " << refFilename_ << std::endl;
00041                   std::cout << " we will not compare histograms. " << std::endl;
00042                   do_nothing_ = true;
00043           }
00044           std::cout << " open file" << std::endl;
00045         };
00046 
00047         void SetChi2Test(bool test=true) {
00048                 setChi2Test_ = test;
00049         };
00050         
00051         void SetKGTest(bool test=true) {
00052                 setKGTest_ = test;
00053         };
00054         
00055         double GetResult() { return result_; };
00056 
00057   private:
00058 
00059         bool setChi2Test_;
00060         bool setKGTest_;
00061         double result_;
00062         bool do_nothing_;
00063         
00064         TH1 *resHisto_;
00065         TH1 *refHisto_;
00066         TFile *refFile_;
00067         
00068         TString refFilename_;
00069 
00070         //std::map<std::string, TH1*> histomap_;
00071         
00072 };
00073 
00074 #endif

Generated on Tue Jun 9 17:49:26 2009 for CMSSW by  doxygen 1.5.4