#include <Validation/RecoB/interface/HistoCompare.h>
Public Member Functions | |
TH1 * | Compare (TH1 *h, TString hname) |
double | GetResult () |
HistoCompare (TString refFilename) | |
HistoCompare () | |
_________________________________________________________________ class: HistoCompare.cc package: Validation/RecoB | |
void | SetChi2Test (bool test=true) |
void | SetKGTest (bool test=true) |
void | SetReferenceFilename (TString filename) |
~HistoCompare () | |
Private Attributes | |
bool | do_nothing_ |
TFile * | refFile_ |
TString | refFilename_ |
TH1 * | refHisto_ |
TH1 * | resHisto_ |
double | result_ |
bool | setChi2Test_ |
bool | setKGTest_ |
author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 25 of file HistoCompare.h.
HistoCompare::HistoCompare | ( | ) |
_________________________________________________________________ class: HistoCompare.cc package: Validation/RecoB
author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 17 of file HistoCompare.cc.
References do_nothing_, and result_.
00017 { 00018 result_ = 0; 00019 do_nothing_ = false; 00020 }
HistoCompare::HistoCompare | ( | TString | refFilename | ) |
Definition at line 22 of file HistoCompare.cc.
References GenMuonPlsPt100GeV_cfg::cout, do_nothing_, lat::endl(), refFile_, result_, and setChi2Test_.
00022 { 00023 00024 result_ = 0; 00025 do_nothing_ = false; 00026 // open reference file 00027 refFile_ = new TFile(refFilename); 00028 if (refFile_->IsZombie()) { 00029 std::cout << " Error openning file " << refFilename << std::endl; 00030 std::cout << " we will not compare histograms. " << std::endl; 00031 do_nothing_ = true; 00032 } else { 00033 std::cout << " open file " << refFilename << std::endl; 00034 } 00035 00036 setChi2Test_ = true; 00037 00038 }
HistoCompare::~HistoCompare | ( | ) |
TH1 * HistoCompare::Compare | ( | TH1 * | h, | |
TString | hname | |||
) |
Definition at line 44 of file HistoCompare.cc.
References do_nothing_, refFile_, refHisto_, resHisto_, result_, setChi2Test_, and setKGTest_.
Referenced by BTagValidator::endJob().
00044 { 00045 00046 if (do_nothing_) return 0; 00047 00048 //std::cout << "histo: " << h->GetName() << " entries: "<< h->GetEntries() << std::endl; 00049 //std::cout << "hname: " << hname << std::endl; 00050 00051 00052 //create a residual histogram 00053 //if (resHisto_) delete resHisto_; 00054 resHisto_ = (TH1*) h->Clone(TString(h->GetName())+"_residuals"); 00055 resHisto_->Reset(); 00056 00057 // clone input histogram 00058 TH1 *htemp = (TH1*) h->Clone(TString(h->GetName())); 00059 00060 refFile_->cd(); 00061 //std::cout << "get reference" << std::endl; 00062 refHisto_ = (TH1*) gDirectory->Get( hname ); 00063 //std::cout << "historef: " << refHisto_->GetName() << " entries: "<< refHisto_->GetEntries() << std::endl; 00064 //std::cout << "name: " << refHisto_->GetName() << std::endl; 00065 00066 00067 // normalize histograms 00068 htemp->Scale(1./htemp->Integral()); 00069 refHisto_->Scale(1./refHisto_->Integral()); 00070 00071 if (setChi2Test_) { 00072 result_ = refHisto_->Chi2Test(htemp,"UFOF"); 00073 } 00074 if (setKGTest_) { 00075 result_ = refHisto_->KolmogorovTest(htemp,"UO"); 00076 } 00077 00078 00079 resHisto_->Add( htemp, refHisto_, 1., -1.); 00080 00081 //std::cout << " residual done." << std::endl; 00082 00083 return resHisto_; 00084 00085 }
double HistoCompare::GetResult | ( | ) | [inline] |
Definition at line 47 of file HistoCompare.h.
References setChi2Test_, and parsecf::pyparsing::test().
00047 { 00048 setChi2Test_ = test; 00049 };
Definition at line 51 of file HistoCompare.h.
References setKGTest_, and parsecf::pyparsing::test().
00051 { 00052 setKGTest_ = test; 00053 };
void HistoCompare::SetReferenceFilename | ( | TString | filename | ) | [inline] |
Definition at line 35 of file HistoCompare.h.
References GenMuonPlsPt100GeV_cfg::cout, do_nothing_, lat::endl(), refFile_, and refFilename_.
Referenced by BTagValidator::endJob().
00035 { 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 };
bool HistoCompare::do_nothing_ [private] |
Definition at line 62 of file HistoCompare.h.
Referenced by Compare(), HistoCompare(), and SetReferenceFilename().
TFile* HistoCompare::refFile_ [private] |
Definition at line 66 of file HistoCompare.h.
Referenced by Compare(), HistoCompare(), and SetReferenceFilename().
TString HistoCompare::refFilename_ [private] |
TH1* HistoCompare::refHisto_ [private] |
TH1* HistoCompare::resHisto_ [private] |
double HistoCompare::result_ [private] |
bool HistoCompare::setChi2Test_ [private] |
Definition at line 55 of file HistoCompare.h.
Referenced by Compare(), HistoCompare(), and SetChi2Test().
bool HistoCompare::setKGTest_ [private] |