#include <HistoCompare.h>
Public Member Functions | |
TH1 * | Compare (TH1 *h, TString hname) |
double | GetResult () |
HistoCompare (TString refFilename) | |
HistoCompare () | |
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_ |
_________________________________________________________________ class: HistoCompare.h package: Validation/RecoB
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_.
{ result_ = 0; do_nothing_ = false; }
HistoCompare::HistoCompare | ( | TString | refFilename | ) |
Definition at line 22 of file HistoCompare.cc.
References gather_cfg::cout, do_nothing_, refFile_, result_, and setChi2Test_.
{ result_ = 0; do_nothing_ = false; // open reference file refFile_ = new TFile(refFilename); if (refFile_->IsZombie()) { std::cout << " Error openning file " << refFilename << std::endl; std::cout << " we will not compare histograms. " << std::endl; do_nothing_ = true; } else { std::cout << " open file " << refFilename << std::endl; } setChi2Test_ = true; }
HistoCompare::~HistoCompare | ( | ) |
Definition at line 40 of file HistoCompare.cc.
{ }
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().
{ if (do_nothing_) return 0; //std::cout << "histo: " << h->GetName() << " entries: "<< h->GetEntries() << std::endl; //std::cout << "hname: " << hname << std::endl; //create a residual histogram //if (resHisto_) delete resHisto_; resHisto_ = (TH1*) h->Clone(TString(h->GetName())+"_residuals"); resHisto_->Reset(); // clone input histogram TH1 *htemp = (TH1*) h->Clone(TString(h->GetName())); refFile_->cd(); //std::cout << "get reference" << std::endl; refHisto_ = (TH1*) gDirectory->Get( hname ); //std::cout << "historef: " << refHisto_->GetName() << " entries: "<< refHisto_->GetEntries() << std::endl; //std::cout << "name: " << refHisto_->GetName() << std::endl; // normalize histograms htemp->Scale(1./htemp->Integral()); refHisto_->Scale(1./refHisto_->Integral()); if (setChi2Test_) { result_ = refHisto_->Chi2Test(htemp,"UFOF"); } if (setKGTest_) { result_ = refHisto_->KolmogorovTest(htemp,"UO"); } resHisto_->Add( htemp, refHisto_, 1., -1.); //std::cout << " residual done." << std::endl; return resHisto_; }
double HistoCompare::GetResult | ( | ) | [inline] |
Definition at line 55 of file HistoCompare.h.
{ return result_; };
void HistoCompare::SetChi2Test | ( | bool | test = true | ) | [inline] |
Definition at line 47 of file HistoCompare.h.
References setChi2Test_, and run_regression::test.
{ setChi2Test_ = test; };
void HistoCompare::SetKGTest | ( | bool | test = true | ) | [inline] |
Definition at line 51 of file HistoCompare.h.
References setKGTest_, and run_regression::test.
{ setKGTest_ = test; };
void HistoCompare::SetReferenceFilename | ( | TString | filename | ) | [inline] |
Definition at line 35 of file HistoCompare.h.
References gather_cfg::cout, do_nothing_, lut2db_cfg::filename, refFile_, and refFilename_.
Referenced by BTagValidator::endJob().
{ refFilename_ = filename; //if (refFile_) delete refFile_; refFile_ = new TFile(refFilename_); if (refFile_->IsZombie()) { std::cout << " Error openning file " << refFilename_ << std::endl; std::cout << " we will not compare histograms. " << std::endl; do_nothing_ = true; } std::cout << " open file" << std::endl; };
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] |
Definition at line 68 of file HistoCompare.h.
Referenced by SetReferenceFilename().
TH1* HistoCompare::refHisto_ [private] |
Definition at line 65 of file HistoCompare.h.
Referenced by Compare().
TH1* HistoCompare::resHisto_ [private] |
Definition at line 64 of file HistoCompare.h.
Referenced by Compare().
double HistoCompare::result_ [private] |
Definition at line 61 of file HistoCompare.h.
Referenced by Compare(), and HistoCompare().
bool HistoCompare::setChi2Test_ [private] |
Definition at line 55 of file HistoCompare.h.
Referenced by Compare(), HistoCompare(), and SetChi2Test().
bool HistoCompare::setKGTest_ [private] |
Definition at line 60 of file HistoCompare.h.
Referenced by Compare(), and SetKGTest().