#include <CompMethods.h>
Public Member Functions | |
void | fit (TH1F &) |
double | spread (TH1F &hist) |
double | spreadError (TH1F &hist) |
StabilizedGauss () | |
StabilizedGauss (const char *name) | |
StabilizedGauss (const char *, int, double, double) | |
double | value (TH1F &hist) |
double | valueError (TH1F &hist) |
~StabilizedGauss () | |
Private Member Functions | |
double | error (TH1F &hist, int target) |
double | value (TH1F &hist, int target) |
Private Attributes | |
TF1 * | func_ |
const char * | funcName_ |
int | funcType_ |
double | lowerBound_ |
double | mean_ |
double | sigma_ |
double | upperBound_ |
Definition at line 79 of file CompMethods.h.
StabilizedGauss::StabilizedGauss | ( | ) | [inline] |
StabilizedGauss::StabilizedGauss | ( | const char * | name | ) | [inline] |
StabilizedGauss::StabilizedGauss | ( | const char * | funcName, |
int | funcType, | ||
double | lowerBound, | ||
double | upperBound | ||
) |
Definition at line 23 of file CompMethods.cc.
References gather_cfg::cout, func_, funcName_, funcType_, Gauss(), lowerBound_, and upperBound_.
: funcType_ (funcType ), funcName_ (funcName ), lowerBound_(lowerBound), upperBound_(upperBound) { if(funcType_==0){ func_ = new TF1(funcName_, Gauss, lowerBound_, upperBound_, 3); func_->SetParNames( "Const", "Mean", "Sigma" ); } else{ std::cout << "Sorry: not yet implemented" << std::endl; } }
StabilizedGauss::~StabilizedGauss | ( | ) | [inline] |
double StabilizedGauss::error | ( | TH1F & | hist, |
int | target | ||
) | [inline, private] |
Definition at line 96 of file CompMethods.h.
References funcName_.
Referenced by spreadError(), and valueError().
void StabilizedGauss::fit | ( | TH1F & | hist | ) |
Definition at line 39 of file CompMethods.cc.
References gather_cfg::cout, func_, funcType_, lowerBound_, mean_, sigma_, and upperBound_.
Referenced by FitHist::fitAndDrawEps(), and FitHist::fitAndDrawPs().
{ //set start values for first iteration if(funcType_==0){ double maxValue=hist.GetBinCenter(hist.GetMaximumBin()); func_->SetParameter(1, maxValue); func_->SetParameter(2, hist.GetRMS()); } //set parameter limits if(funcType_==0){ func_->SetParLimits(1, lowerBound_, upperBound_); func_->SetParLimits(2, 0., 5.*hist.GetRMS()); } //do the fit mean_ = func_->GetParameter(1); sigma_= func_->GetParameter(2); hist.Fit( "func", "RE0", "", (mean_-2.*sigma_), (mean_+2.*sigma_) ); if(hist.GetFunction("func")){ //get mean and sigma //from first iteration mean_ = hist.GetFunction("func")->GetParameter(1); sigma_= hist.GetFunction("func")->GetParameter(2); //set start values for //second iteration func_->SetParameter(1, mean_ ); func_->SetParameter(2, sigma_); hist.Fit( func_, "MEL", "", (mean_-1.5*sigma_), (mean_+1.5*sigma_) ); } else{ std::cout << "sorry... no fit function found..." << std::endl; } }
double StabilizedGauss::spread | ( | TH1F & | hist | ) | [inline] |
Definition at line 90 of file CompMethods.h.
References value().
Referenced by FitHist::fillTargetHistogramBin().
double StabilizedGauss::spreadError | ( | TH1F & | hist | ) | [inline] |
Definition at line 91 of file CompMethods.h.
References error().
Referenced by FitHist::fillTargetHistogramBin().
double StabilizedGauss::value | ( | TH1F & | hist | ) | [inline] |
Definition at line 88 of file CompMethods.h.
References value().
Referenced by FitHist::fillTargetHistogramBin(), spread(), and value().
double StabilizedGauss::value | ( | TH1F & | hist, |
int | target | ||
) | [inline, private] |
double StabilizedGauss::valueError | ( | TH1F & | hist | ) | [inline] |
Definition at line 89 of file CompMethods.h.
References error().
Referenced by FitHist::fillTargetHistogramBin().
TF1* StabilizedGauss::func_ [private] |
Definition at line 100 of file CompMethods.h.
Referenced by fit(), StabilizedGauss(), and ~StabilizedGauss().
const char* StabilizedGauss::funcName_ [private] |
Definition at line 104 of file CompMethods.h.
Referenced by error(), StabilizedGauss(), and value().
int StabilizedGauss::funcType_ [private] |
Definition at line 103 of file CompMethods.h.
Referenced by fit(), and StabilizedGauss().
double StabilizedGauss::lowerBound_ [private] |
Definition at line 105 of file CompMethods.h.
Referenced by fit(), and StabilizedGauss().
double StabilizedGauss::mean_ [private] |
Definition at line 101 of file CompMethods.h.
Referenced by fit().
double StabilizedGauss::sigma_ [private] |
Definition at line 102 of file CompMethods.h.
Referenced by fit().
double StabilizedGauss::upperBound_ [private] |
Definition at line 106 of file CompMethods.h.
Referenced by fit(), and StabilizedGauss().