ROOT » HIST » HIST » TBackCompFitter

class TBackCompFitter: public TVirtualFitter


Backward compatible implementation of TVirtualFitter using the
class ROOT::Fit::Fitter. This class is created after fitting an
histogram (TH1), TGraph or TTree and provides in addition to the
methods of the TVirtualFitter hooks to access the fit result class
(ROOT::Fit::FitResult), the fit configuration
(ROOT::Fit::FitConfig) or the fit data (ROOT::Fit::FitData) using

 TBackCompFitter * fitter = (TBackCompFitter *) TVirtualFitter::GetFitter();
 ROOT::Fit::FitResult & result = fitter->GetFitResult();

Methods for getting the confidence level or contours are also
provided. Note that after a new calls to TH1::Fit (or similar) the
class will be deleted and all reference to the FitResult, FitConfig
or minimizer will be invalid. One could eventually copying  the
class before issuing a new fit to avoid deleting this information.

Function Members (Methods)

voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
virtual Double_tChisquare(Int_t npar, Double_t* params) const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
boolContour(unsigned int ipar, unsigned int jpar, TGraph* gr, double confLevel = 0.68300000000000005)
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual Int_tExecuteCommand(const char* command, Double_t* args, Int_t nargs)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
static TVirtualFitter*TVirtualFitter::Fitter(TObject* obj, Int_t maxpar = 25)
virtual voidFixParameter(Int_t ipar)
virtual voidGetConfidenceIntervals(TObject* obj, Double_t cl = 0.94999999999999996)
virtual voidGetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t* x, Double_t* ci, Double_t cl = 0.94999999999999996)
virtual Double_t*GetCovarianceMatrix() const
virtual Double_tGetCovarianceMatrixElement(Int_t i, Int_t j) const
static const char*TVirtualFitter::GetDefaultFitter()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
static Double_tTVirtualFitter::GetErrorDef()
virtual Int_tGetErrors(Int_t ipar, Double_t& eplus, Double_t& eminus, Double_t& eparab, Double_t& globcc) const
virtual TVirtualFitter::FCNFunc_tTVirtualFitter::GetFCN()
const ROOT::Fit::FitData&GetFitData() const
virtual Foption_tTVirtualFitter::GetFitOption() const
const ROOT::Fit::FitResult&GetFitResult() const
static TVirtualFitter*TVirtualFitter::GetFitter()
virtual const char*TObject::GetIconName() const
static Int_tTVirtualFitter::GetMaxIterations()
TMethodCall*TVirtualFitter::GetMethodCall() const
ROOT::Math::Minimizer*GetMinimizer() const
virtual const char*TNamed::GetName() const
virtual Int_tGetNumberFreeParameters() const
virtual Int_tGetNumberTotalParameters() const
virtual TObject*TVirtualFitter::GetObjectFit() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
ROOT::Math::IMultiGenFunction*GetObjFunction() const
virtual Option_t*TObject::GetOption() const
virtual Double_tGetParameter(Int_t ipar) const
virtual Int_tGetParameter(Int_t ipar, char* name, Double_t& value, Double_t& verr, Double_t& vlow, Double_t& vhigh) const
virtual Double_tGetParError(Int_t ipar) const
virtual const char*GetParName(Int_t ipar) const
static Double_tTVirtualFitter::GetPrecision()
virtual Int_tGetStats(Double_t& amin, Double_t& edm, Double_t& errdef, Int_t& nvpar, Int_t& nparx) const
virtual Double_tGetSumLog(Int_t i)
TFitResult*GetTFitResult() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual TObject*TVirtualFitter::GetUserFunc() const
virtual Int_tTVirtualFitter::GetXfirst() const
virtual Int_tTVirtualFitter::GetXlast() const
virtual Int_tTVirtualFitter::GetYfirst() const
virtual Int_tTVirtualFitter::GetYlast() const
virtual Int_tTVirtualFitter::GetZfirst() const
virtual Int_tTVirtualFitter::GetZlast() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFixed(Int_t ipar) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TBackCompFitter&operator=(const TBackCompFitter&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidPrintResults(Int_t level, Double_t amin) const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidReleaseParameter(Int_t ipar)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
boolScan(unsigned int ipar, TGraph* gr, double xmin = 0, double xmax = 0)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual Double_t*TVirtualFitter::SetCache(Int_t npoints, Int_t psize)
static voidTVirtualFitter::SetDefaultFitter(const char* name = "")
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTVirtualFitter::SetErrorDef(Double_t errdef = 1)
virtual voidSetFCN(void(*)(Int_t&,Double_t*,Double_t&,Double_t*,Int_t) fcn)
virtual voidSetFCN(void*)
virtual voidSetFitMethod(const char* name)
virtual voidTVirtualFitter::SetFitOption(Foption_t option)
static voidTVirtualFitter::SetFitter(TVirtualFitter* fitter, Int_t maxpar = 25)
static voidTVirtualFitter::SetMaxIterations(Int_t niter = 5000)
virtual voidSetMethodCall(TMethodCall* m)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
virtual voidTVirtualFitter::SetObjectFit(TObject* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetObjFunction(ROOT::Math::IMultiGenFunction* f)
virtual Int_tSetParameter(Int_t ipar, const char* parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
static voidTVirtualFitter::SetPrecision(Double_t prec = 9.9999999999999995E-7)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidTVirtualFitter::SetUserFunc(TObject* userfunc)
virtual voidTVirtualFitter::SetXfirst(Int_t first)
virtual voidTVirtualFitter::SetXlast(Int_t last)
virtual voidTVirtualFitter::SetYfirst(Int_t first)
virtual voidTVirtualFitter::SetYlast(Int_t last)
virtual voidTVirtualFitter::SetZfirst(Int_t first)
virtual voidTVirtualFitter::SetZlast(Int_t last)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TBackCompFitter(const TBackCompFitter&)
TBackCompFitter(const shared_ptr<ROOT::Fit::Fitter>& fitter, const shared_ptr<ROOT::Fit::FitData>& data)
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
boolValidParameterIndex(int ipar) const

Data Members

static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TBackCompFitter::(anonymous)kCanDeleteLast
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
Double_t*TVirtualFitter::fCache[fCacheSize] array of points data (fNpoints*fPointSize < fCacheSize words)
Int_tTVirtualFitter::fCacheSizeSize of the fCache array
TMethodCall*TVirtualFitter::fMethodCallPointer to MethodCall in case of interpreted function
TStringTNamed::fNameobject identifier
Int_tTVirtualFitter::fNpointsNumber of points to fit
TObject*TVirtualFitter::fObjectFitpointer to object being fitted
Foption_tTVirtualFitter::fOptionstruct with the fit options
Int_tTVirtualFitter::fPointSizeNumber of words per point in the cache
TStringTNamed::fTitleobject title
TObject*TVirtualFitter::fUserFuncpointer to user theoretical function (a TF1*)
Int_tTVirtualFitter::fXfirstfirst bin on X axis
Int_tTVirtualFitter::fXlastlast bin on X axis
Int_tTVirtualFitter::fYfirstfirst bin on Y axis
Int_tTVirtualFitter::fYlastlast bin on Y axis
Int_tTVirtualFitter::fZfirstfirst bin on Z axis
Int_tTVirtualFitter::fZlastlast bin on Z axis
static TStringTVirtualFitter::fgDefaultname of the default fitter ("Minuit","Fumili",etc)
static Double_tTVirtualFitter::fgErrorDefError definition (default=1)
static TVirtualFitter*TVirtualFitter::fgFitterCurrent fitter (default TFitter)
static Int_tTVirtualFitter::fgMaxiterMaximum number of iterations
static Int_tTVirtualFitter::fgMaxparMaximum number of fit parameters for current fitter
static Double_tTVirtualFitter::fgPrecisionmaximum precision
vector<double>fCovarcached covariance matrix (NxN)
shared_ptr<ROOT::Fit::FitData>fFitData! data of the fit
shared_ptr<ROOT::Fit::Fitter>fFitter! pointer to fitter object

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 Constructur needed by TVirtualFitter interface. Same behavior as default constructor.
 initialize setting name and the global pointer
TBackCompFitter(const shared_ptr<ROOT::Fit::Fitter>& fitter, const shared_ptr<ROOT::Fit::FitData>& data)
 constructor used after having fit using directly ROOT::Fit::Fitter
 will create a dummy fitter copying configuration and parameter settings
 destructor - delete the managed objects
Double_t Chisquare(Int_t npar, Double_t* params) const
 do chisquare calculations in case of likelihood fits
 do evaluation a the minimum only
void Clear(Option_t* option = "")
 clear resources for consecutive fits
Int_t ExecuteCommand(const char* command, Double_t* args, Int_t nargs)
 execute the command (Fortran Minuit compatible interface)
bool ValidParameterIndex(int ipar) const
 check if ipar is a valid parameter index
void FixParameter(Int_t ipar)
 fix the paramter
void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t* x, Double_t* ci, Double_t cl = 0.94999999999999996)
Computes point-by-point confidence intervals for the fitted function
n - number of points
ndim - dimensions of points
x - points, at which to compute the intervals, for ndim > 1
    should be in order: (x0,y0, x1, y1, ... xn, yn)
ci - computed intervals are returned in this array
cl - confidence level, default=0.95
NOTE, that the intervals are approximate for nonlinear(in parameters) models
void GetConfidenceIntervals(TObject* obj, Double_t cl = 0.94999999999999996)
Computes confidence intervals at level cl. Default is 0.95
The TObject parameter can be a TGraphErrors, a TGraph2DErrors or a TH1,2,3.
For Graphs, confidence intervals are computed for each point,
the value of the graph at that point is set to the function value at that
point, and the graph y-errors (or z-errors) are set to the value of
the confidence interval at that point.
For Histograms, confidence intervals are computed for each bin center
The bin content of this bin is then set to the function value at the bin
center, and the bin error is set to the confidence interval value.
NOTE: confidence intervals are approximate for nonlinear models!

Allowed combinations:
Fitted object               Passed object
TGraph                      TGraphErrors, TH1
TGraphErrors, AsymmErrors   TGraphErrors, TH1
TH1                         TGraphErrors, TH1
TGraph2D                    TGraph2DErrors, TH2
TGraph2DErrors              TGraph2DErrors, TH2
TH2                         TGraph2DErrors, TH2
TH3                         TH3
Double_t* GetCovarianceMatrix() const
 get the error matrix in a pointer to a NxN array.
 excluding the fixed parameters
Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
 get error matrix element (return all zero if matrix is not available)
Int_t GetErrors(Int_t ipar, Double_t& eplus, Double_t& eminus, Double_t& eparab, Double_t& globcc) const
 get fit errors
Int_t GetNumberTotalParameters() const
 number of total parameters
Int_t GetNumberFreeParameters() const
 number of variable parameters
Double_t GetParError(Int_t ipar) const
 parameter error
Double_t GetParameter(Int_t ipar) const
 parameter value
Int_t GetParameter(Int_t ipar, char* name, Double_t& value, Double_t& verr, Double_t& vlow, Double_t& vhigh) const
 get all parameter info (name, value, errors)
const char * GetParName(Int_t ipar) const
   return name of parameter ipar
Int_t GetStats(Double_t& amin, Double_t& edm, Double_t& errdef, Int_t& nvpar, Int_t& nparx) const
 get fit statistical information
Double_t GetSumLog(Int_t i)
   sum of log . Un-needed
Bool_t IsFixed(Int_t ipar) const
 query if parameter ipar is fixed
void PrintResults(Int_t level, Double_t amin) const
 print the fit result
 use PrintResults function in case of Minuit for old -style printing
void ReleaseParameter(Int_t ipar)
 release a fit parameter
void SetFitMethod(const char* name)
 set fit method (i.e. chi2 or likelihood)
 according to the method the appropriate FCN function will be created
Int_t SetParameter(Int_t ipar, const char* parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
 set (add) a new fit parameter passing initial value,  step size (verr) and parametr limits
 if vlow > vhigh the parameter is unbounded
 if the stepsize (verr) == 0 the parameter is treated as fixed
void ReCreateMinimizer()
 Recreate a minimizer instance using the function and data
 set objective function in minimizers function to re-create FCN from stored data object and fit options
void SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
 override setFCN to use the Adapter to Minuit2 FCN interface
To set the address of the minimization function*-
*-*          ===============================================
void SetFCN(void* )
To set the address of the minimization function*-
*-*          ===============================================
     this function is called by CINT instead of the function above
void SetObjFunction(ROOT::Math::IMultiGenFunction* f)
 set the objective function for fitting
 Needed if fitting directly using TBackCompFitter class
 The class clones a copy of the function and manages it
void DoSetDimension()
 Private method to set dimension in objective function
ROOT::Math::IMultiGenFunction * GetObjFunction() const
 return a pointer to the objective function (FCN)
 If fitting directly using TBackCompFitter the pointer is managed by the class,
 which has been set previously when calling SetObjFunction or SetFCN
 Otherwise if the class is used in the backward compatible mode (e.g. after having fitted a TH1)
 the return pointer will be valid after fitting and as long a new fit will not be done.
ROOT::Math::Minimizer * GetMinimizer() const
 return a pointer to the minimizer.
 the return pointer will be valid after fitting and as long a new fit will not be done.
 For keeping a minimizer pointer the method ReCreateMinimizer() could eventually be used
TFitResult * GetTFitResult() const
 return a new copy of the TFitResult object which needs to be deleted later by the user
bool Scan(unsigned int ipar, TGraph* gr, double xmin = 0, double xmax = 0)
     scan parameter ipar between value of xmin and xmax
     a graph must be given which will be on return filled with the scan resul
     If the graph size is zero, a default size n = 40 will be used
bool Contour(unsigned int ipar, unsigned int jpar, TGraph* gr, double confLevel = 0.68300000000000005)
  create a 2D contour around the minimum for the parameter ipar and jpar
 if a minimum does not exist or is invalid it will return false
 on exit a TGraph is filled with the contour points
 the number of contur points is determined by the size of the TGraph.
 if the size is zero a default number of points = 20 is used
 pass optionally the confidence level, default is 0.683
 it is assumed that ErrorDef() defines the right error definition
 (i.e 1 sigma error for one parameter). If not the confidence level are scaled to new level
void SetMethodCall(TMethodCall* m)
 for using interpreted function passed by the user
{ fMethodCall = m; }
ROOT::Fit::FitConfig & GetFitConfig()
!!!! new method (of this interface)
 get reference to Fit configuration (NOTE: it will be invalid when class is deleted)
{ return fFitter->Config(); }
const ROOT::Fit::FitResult & GetFitResult() const
 get reference to Fit Result object (NOTE: it will be invalid when class is deleted)
{ return fFitter->Result(); }
const ROOT::Fit::FitData & GetFitData() const
 get reference to Fit Data object (NOTE: it will be invalid when class is deleted)
{ return *fFitData; }