157#include "RConfigure.h"
189 if ( strcmp(
f->GetName(),
name ) == 0 )
197 for (
fPrevFitIter it = look.first; it != look.second; ++it ) {
199 if ( strcmp(
f->GetName(),
name ) == 0 )
221 if (
dynamic_cast<TF3 *
>(
f) != 0 ) {
222 TF3* fnew = (
TF3 *)
f->IsA()->New();
229 }
else if (
dynamic_cast<TF2 *
>(
f) != 0 ) {
230 TF2* fnew = (
TF2 *)
f->IsA()->New();
239 TF1* fnew = (
TF1 *)
f->IsA()->New();
259 if (npar != (
int) pars.size() ) pars.resize(npar);
260 for (
Int_t i = 0; i < npar; ++i )
276 if (npar > (
int) pars.size() ) pars.resize(npar);
277 for (
Int_t i = 0; i < npar; ++i )
287template<
class FitObject>
291 if (100 == special || 400 == special) {
296 }
else if ( 110 == special || 410 == special ) {
312 if (!textEntry)
return;
316 variablesStr = nameStr(nameStr.
First(
'(') + 2, nameStr.
First(
',') - nameStr.
First(
'(') - 3);
318 cutsStr = nameStr( nameStr.
First(
',') + 3, nameStr.
First(
')') - nameStr.
First(
',') - 4 );
334 gROOT->MakeDefCanvas();
385 fTab->Associate(
this);
413 int parts[] = { 20, 20, 20, 20, 20 };
423 gROOT->GetListOfCleanups()->Add(
this);
447 std::vector<TObject*>
v;
482 if (cw +
size.fWidth < dw) {
483 Int_t gedx = 0, gedy = 0;
485 gedy = (cy > 20) ? cy-20 : 0;
506 fDataSet ->Disconnect(
"Selected(Int_t)");
509 this,
"SetFitObject(TVirtualPad *, TObject *, Int_t)");
510 gROOT->GetListOfCleanups()->Remove(
this);
572 bgr -> SetRadioButtonExclusive();
578 fNone -> SetToolTipText(
"No operation defined");
580 fAdd -> SetToolTipText(
"Addition");
582 fNormAdd -> SetToolTipText(
"NormAddition");
584 fConv -> SetToolTipText(
"Convolution");
610 fEnteredFunc->SetToolTipText(
"Enter file_name/function_name or a function expression");
634 gClient->GetColorByName(
"#336666", color);
642 fSetParam->SetToolTipText(
"Open a dialog for parameter(s) settings");
687 fLinearFit->SetToolTipText(
"Perform Linear fitter if selected");
700 fUserButton->SetToolTipText(
"Open a dialog for entering a user-defined method");
707 fEnableRobust->SetToolTipText(
"Perform Linear Robust fitter if selected");
716 fRobustValue->GetNumberEntry()->SetToolTipText(
"Available only for graphs");
740 fIntegral->SetToolTipText(
"'I'- use integral of function instead of value in bin center");
745 fBestErrors->SetToolTipText(
"'E'- better errors estimation using Minos technique");
750 fAllWeights1->SetToolTipText(
"'W'- all weights=1 for non empty bins; error bars ignored");
755 fEmptyBinsWghts1->SetToolTipText(
"'WW'- all weights=1 including empty bins; error bars ignored");
763 fUseRange->SetToolTipText(
"'R'- fit only data within the specified function range");
768 fImproveResults->SetToolTipText(
"'M'- after minimum is found, search for a new one");
773 fAdd2FuncList->SetToolTipText(
"'+'- add function to the list without deleting the previous");
778 fUseGradient->SetToolTipText(
"'G'- Use the gradient as an aid for the fitting");
798 fDrawSame->SetToolTipText(
"Superimpose on previous picture in the same pad");
803 fNoDrawing->SetToolTipText(
"'0'- do not draw function graphics");
808 fNoStoreDrawing->SetToolTipText(
"'N'- do not store the function, do not draw it");
820 fDrawAdvanced->SetToolTipText(
"Open a dialog for advanced draw options");
906 fLibMinuit->SetToolTipText(
"Use minimization from libMinuit (default)");
912 fLibMinuit2->SetToolTipText(
"New C++ version of Minuit");
917 fLibFumili->SetToolTipText(
"Use minimization from libFumili");
924 #ifdef R__HAS_MATHMORE
926 fLibGSL->SetToolTipText(
"Use minimization from libGSL");
929 fLibGSL->SetToolTipText(
"Needs GSL to be compiled");
934 if (
gPluginMgr->FindHandler(
"ROOT::Math::Minimizer",
"Genetic") ||
935 gPluginMgr->FindHandler(
"ROOT::Math::Minimizer",
"GAlibMin") )
938 fLibGenetics->SetToolTipText(
"Different GAs implementations");
942 "minimizers to be compiled");
981 TGLabel *errlabel =
new TGLabel(hsv1,
"Error definition (default = 1): ");
984 TGLabel *tollabel =
new TGLabel(hsv1,
"Max tolerance (precision): ");
987 TGLabel *itrlabel =
new TGLabel(hsv1,
"Max number of iterations: ");
1022 fOptDefault->SetToolTipText(
"Default is between Verbose and Quiet");
1029 fOptVerbose->SetToolTipText(
"'V'- print results after each iteration");
1034 fOptQuiet->SetToolTipText(
"'Q'- no print");
1047 fDataSet ->
Connect(
"Selected(Int_t)",
"TFitEditor",
this,
"DoDataSet(Int_t)");
1049 fTypeFit ->
Connect(
"Selected(Int_t)",
"TFitEditor",
this,
"FillFunctionList(Int_t)");
1051 fFuncList ->
Connect(
"Selected(Int_t)",
"TFitEditor",
this,
"DoFunction(Int_t)");
1055 fSetParam ->
Connect(
"Clicked()",
"TFitEditor",
this,
"DoSetParameters()");
1057 fAdd ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoAddition(Bool_t)");
1062 fUseRange ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoUseFuncRange()");
1082 fSliderX ->
Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderXMoved()");
1083 fSliderXMax ->
Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderXChanged()");
1084 fSliderXMin ->
Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderXChanged()");
1088 fSliderY ->
Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderYMoved()");
1089 fSliderYMax ->
Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderYChanged()");
1090 fSliderYMin ->
Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderYChanged()");
1093 fSliderZ ->
Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderZMoved()");
1099 fLibMinuit ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoLibrary(Bool_t)");
1101 fLibFumili ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoLibrary(Bool_t)");
1102 fLibGSL ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoLibrary(Bool_t)");
1112 fOptQuiet ->
Connect(
"Toggled(Bool_t)",
"TFitEditor",
this,
"DoPrintOpt(Bool_t)");
1199 "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1200 TQObject::Connect(
"TCanvas",
"Closed()",
"TFitEditor",
this,
"DoNoSelection()");
1212 fParentPad->Disconnect(
"RangeAxisChanged()");
1215 this,
"SetFitObject(TVirtualPad *, TObject *, Int_t)");
1219 gROOT->GetListOfCleanups()->Remove(
this);
1227 if (!
gROOT->GetListOfCleanups()->FindObject(
this))
1228 gROOT->GetListOfCleanups()->Add(
this);
1309 Error(
"UpdateGUI",
"No hist is present - this should not happen, please report."
1310 "The FitPanel might be in an inconsistent state");
1315 fSliderX->Disconnect(
"PositionChanged()");
1329 if (ixmin > 1 || ixmax < ixrange) {
1331 fSliderX->SetPosition(ixmin, ixmax);
1334 fSliderX->SetPosition(ixmin,ixmax);
1348 fSliderX->Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderXMoved()");
1349 fSliderXMax->Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderXChanged()");
1350 fSliderXMin->Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderXChanged()");
1354 fSliderY->Disconnect(
"PositionChanged()");
1363 Int_t iymin = 0, iymax = 0, iyrange = 0;
1368 iyrange =
fYaxis->GetNbins();
1369 iymin =
fYaxis->GetFirst();
1370 iymax =
fYaxis->GetLast();
1381 if (iymin > 1 || iymax < iyrange) {
1383 fSliderY->SetPosition(iymin, iymax);
1386 fSliderY->SetPosition(iymin,iymax);
1400 fSliderY->Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderYMoved()");
1401 fSliderYMax->Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderYChanged()");
1402 fSliderYMin->Connect(
"ValueSet(Long_t)",
"TFitEditor",
this,
"DoNumericSliderYChanged()");
1407 fSliderZ->Disconnect(
"PositionChanged()");
1412 Int_t izmin = 0, izmax = 0, izrange = 0;
1416 izrange =
fZaxis->GetNbins();
1417 izmin =
fZaxis->GetFirst();
1418 izmax =
fZaxis->GetLast();
1430 if (izmin > 1 || izmax < izrange) {
1432 fSliderZ->SetPosition(izmin, izmax);
1435 fSliderZ->SetPosition(izmin,izmax);
1439 fSliderZ->Connect(
"PositionChanged()",
"TFitEditor",
this,
"DoSliderZMoved()");
1477 if ( tmpStr.
Length() == 0 )
1549 if (
gROOT->GetListOfCanvases()->IsEmpty()) {
1586 "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1690 if ( strncmp(
f->GetName(),
"PrevFit", 7) != 0 ) {
1697 if (
f->GetNdim() ==
fDim ||
fDim == 0) {
1706 else if(
fDim == 1 ) {
1709 }
else if(
fDim == 2 ) {
1721 for (
fPrevFitIter it = look.first; it != look.second; ++it ) {
1722 fFuncList->AddEntry(it->second->GetName(), newid++);
1732 else if (
fDim == 2 )
1779 if (
gPluginMgr->FindHandler(
"ROOT::Math::Minimizer",
"GAlibMin") ) {
1782 }
else if (
gPluginMgr->FindHandler(
"ROOT::Math::Minimizer",
"Genetic")) {
1803 TIter canvasIter(canvases);
1808 if (
TPad* can =
dynamic_cast<TPad*
>(obj))
1811 else if (
dynamic_cast<TH1*
>(obj)
1812 ||
dynamic_cast<TGraph*
>(obj)
1815 ||
dynamic_cast<THStack*
>(obj)
1816 ||
dynamic_cast<TTree*
>(obj) ) {
1817 bool insertNew =
true;
1819 for ( std::vector<TObject*>::iterator i = objects.begin(); i != objects.end(); ++i )
1820 if ( (*i) == obj ) {
1826 if ( insertNew ) objects.push_back(obj);
1846 std::vector<TObject*> objects;
1854 while ( (obj = (
TObject*) next()) ) {
1856 if (
dynamic_cast<TH1*
>(obj) ||
1858 dynamic_cast<TTree*
>(obj) ) {
1859 objects.push_back(obj);
1873 fDataSet->AddEntry(
"No Selection", newid++);
1874 for ( std::vector<TObject*>::iterator i = objects.begin(); i != objects.end(); ++i ) {
1879 if ( selEntryStr &&
name == selEntryStr )
1900 c->AddEntry(
"Unbinned Likelihood",
kFP_MUBIN);
2003 "Error...",
"2) Verify the entered function string!",
2016 fParentPad->Disconnect(
"RangeAxisChanged()");
2035 static TF1 *fitFunc =
nullptr;
2042 std::cout <<
"TFitEditor::DoFit - using function " << fitFunc->
GetName() <<
" " << fitFunc << std::endl;
2045 Error(
"DoFit",
"This should have never happend, the fitfunc pointer is NULL! - Please Report" );
2071 FitObject(
gr, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2078 FitObject(mg, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2086 FitObject(g2d, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2109 if ( !tree )
return;
2114 tree->
Draw(variables,cuts,
"goff");
2118 Error(
"DoFit",
"Player reference is NULL");
2122 auto selector =
dynamic_cast<TSelectorDraw *
>(player->GetSelector());
2124 Error(
"DoFit",
"Selector reference is NULL");
2131 Error(
"DoFit",
"NDIM == 0");
2135 std::vector<double *> vlist;
2136 for (
unsigned int i = 0; i < ndim; ++i) {
2137 double *
v = selector->GetVal(i);
2138 if (
v != 0) vlist.push_back(
v);
2140 std::cerr <<
"pointer for variable " << i <<
" is zero" << std::endl;
2142 if (vlist.size() != ndim) {
2143 Error(
"DoFit",
"Vector is not complete");
2148 Long64_t nrows = player->GetSelectedRows();
2150 Error(
"DoFit",
"NROWS == 0");
2156 for (
int i = 0; i < std::min(
int(fitdata->
Size()),10); ++i) {
2158 for (
unsigned int j = 0; j < ndim; ++j) {
2159 printf(
" x_%d [%d] = %f \n", j, i,*(fitdata->
Coords(i)+j) );
2181 fitFunc->
Draw(
"same");
2191 if (!strstr(fitFunc->
GetName(),
"PrevFit"))
2197 float xmin = 0.f,
xmax = 0.f,
ymin = 0.f,
ymax = 0.f, zmin = 0.f, zmax = 0.f;
2221 fParentPad->Connect(
"RangeAxisChanged()",
"TFitEditor",
this,
"UpdateGUI()");
2223 if (save)
gPad = save;
2234 if ( !
fTypeFit->FindEntry(
"Prev. Fit") )
2247 TF1 form(
"tmpCheck", fname);
2249 rvalue = form.
IsValid() ? 0 : -1;
2250 }
else if (
fDim == 2 ) {
2251 TF2 form(
"tmpCheck", fname);
2253 rvalue = form.
IsValid() ? 0 : -1;
2254 }
else if (
fDim == 3 ) {
2255 TF3 form(
"tmpCheck", fname);
2257 rvalue = form.
IsValid() ? 0 : -1;
2305 if (on)
Info(
"DoNormAddition",
"Normalized addition is selected");
2329 if (on)
Info(
"DoConvolution",
"Convolution is selected");
2344 if (!textEntry)
return;
2351 if ( className ==
"TTree" ) {
2357 lookStr =
name(0,
name.First(
' '));
2359 objSelected =
gROOT->FindObject(lookStr);
2374 char variables[256] = {0};
char cuts[256] = {0};
2375 strlcpy(variables,
"Sin input!", 256);
2377 if ( strcmp ( variables,
"" ) == 0 ) {
2385 TPad* currentPad = NULL;
2387 std::queue<TPad*> stPad;
2390 if (
dynamic_cast<TPad*
>(canvas) )
2391 stPad.push(
dynamic_cast<TPad*
>(canvas));
2394 while ( !stPad.empty() && !found ) {
2395 currentPad = stPad.front();
2399 if ( elem == objSelected ) {
2402 }
else if (
dynamic_cast<TPad*
>(elem) )
2403 stPad.push(
dynamic_cast<TPad*
>(elem) );
2418 fDataSet->InsertEntry(entryName, newid, selected );
2434 bool editable =
false;
2573 "Error...",
"3) Verify the entered function string!",
2744 if (!fitFunc) {
Error(
"DoSetParameters",
"NUll function");
return; }
2791 if (
fParentPad )
fParentPad->Connect(
"RangeAxisChanged()",
"TFitEditor",
this,
"UpdateGUI()");
2821 static Int_t px1old, py1old, px2old, py2old;
2836 Int_t px1,py1,px2,py2;
2860 px1 =
gPad->XtoAbsPixel(xleft);
2862 px2 =
gPad->XtoAbsPixel(xright);
2865 if (
gPad->GetCanvas())
gPad->GetCanvas()->FeedbackMode(
kTRUE);
2866 gPad->SetLineWidth(1);
2867 gPad->SetLineColor(2);
2881 if(save)
gPad = save;
2954 "Info",
"Dialog of user method is not implemented yet",
2984 fRobustValue->GetNumberEntry()->SetToolTipText(
"Set robust value");
3006 for (
int i = 0; i < variables.Length() &&
fDim <= 2; ++i )
3007 if (
':' == variables[i] )
fDim += 1;
3018 fDim = ((
TH1*)obj)->GetDimension();
3031 fRobustValue->GetNumberEntry()->SetToolTipText(
"Set robust value");
3048 if ( !
fTypeFit->FindEntry(
"Predef-1D") )
3051 if (
fTypeFit->FindEntry(
"Predef-1D") )
3056 if ( !
fTypeFit->FindEntry(
"Predef-2D") )
3059 if (
fTypeFit->FindEntry(
"Predef-2D") )
3072 bool isTree =
false;
3079 isTree = strcmp(obj->
ClassName(),
"TTree") == 0;
3081 name =
"No object selected";
3088 if ( selectedEntry ) {
3091 selectedName = selectedName(0, selectedName.
First(
' '));
3092 if (
name.CompareTo(selectedName) == 0 ) {
3102 (
fDataSet->GetListBox()->GetEntry(entryId)) ) {
3103 TString compareName = entry->GetText()->GetString();
3105 compareName = compareName(0, compareName.
First(
' '));
3106 if (
name.CompareTo(compareName) == 0 ) {
3133 while ((obj = next())) {
3300 if ( !
fTypeFit->FindEntry(
"Prev. Fit") )
3307 while ((obj2 = next())) {
3316 if ( strcmp( func->
GetName(), it->second->GetName() ) == 0 )
3318 if ( strcmp( func->
GetName(),
"PrevFitTMP" ) == 0 )
3514 TList *listOfFunctions = 0;
3519 listOfFunctions = ((
TH1 *)
fFitObject)->GetListOfFunctions();
3540 return listOfFunctions;
3556 const unsigned int nfuncs = 16;
3557 const char* fnames[nfuncs] = {
"gaus" ,
"gausn",
"expo",
"landau",
3558 "landaun",
"pol0",
"pol1",
"pol2",
3559 "pol3",
"pol4",
"pol5",
"pol6",
3560 "pol7",
"pol8",
"pol9",
"user"
3564 TIter functionsIter(
gROOT->GetListOfFunctions());
3566 while( ( obj = (
TObject*) functionsIter() ) ) {
3568 if (
TF1* func =
dynamic_cast<TF1*
>(obj) ) {
3569 bool addFunction =
true;
3571 for (
unsigned int i = 0; i < nfuncs; ++i ) {
3572 if ( strcmp( func->GetName(), fnames[i] ) == 0 ) {
3573 addFunction =
false;
3598 std::pair<fPrevFitIter, fPrevFitIter> look =
fPrevFit.equal_range(obj);
3599 for (
fPrevFitIter it = look.first; it != look.second; ++it ) {
3600 retList->
Add(it->second);
3621 "Error...",
"1) Verify the entered function string!",
3629 tmpF1->
Copy(*fitFunc);
3671 if (
fConv -> IsOn())
3680 else if (
fDim == 2 ) {
3683 else if (
fDim == 3 ) {
3696 if ( tmpF1 != 0 && fitFunc != 0 &&
3701 tmpF1->
Copy(*fitFunc);
ULong_t Pixel_t
Pixel value.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
const Bool_t kIterForward
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
TF1 * copyTF1(TF1 *f)
Copies f into a new TF1 to be stored in the fitpanel with it's own ownership.
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
void InitParameters(TF1 *func, FitObject *fitobj)
Parameter initialization for the function.
void GetTreeVarsAndCuts(TGComboBox *dataSet, TString &variablesStr, TString &cutsStr)
Splits the entry in fDataSet to get the selected variables and cuts from the text.
void SetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Restore the parameters from pars into the function.
void SearchCanvases(TSeqCollection *canvases, std::vector< TObject * > &objects)
std::multimap< TObject *, TF1 * > FitFuncMap_t
externTPluginManager * gPluginMgr
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
class describing the range in the coordinates it supports multiple range in a coordinate.
void AddRange(unsigned int icoord, double xmin, double xmax)
add a range [xmin,xmax] for the new coordinate icoord Adding a range does not delete existing one,...
void GetRange(unsigned int irange, unsigned int icoord, double &xmin, double &xmax) const
get the i-th range for given coordinate.
unsigned int Size() const
return number of fit points
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
Class describing the un-binned data sets (just x coordinates values) of any dimensions.
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
void SetMinimizerType(const char *type)
set minimizer type
static double DefaultTolerance()
static const std::string & DefaultMinimizerType()
void SetErrorDef(double err)
set error def
static int DefaultMaxIterations()
static double DefaultErrorDef()
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm
void SetTolerance(double tol)
set the tolerance
Allows to create advanced graphics from the last fit made in the fitpanel.
Int_t GetWindowTopX()
Returns current top x position of window on screen.
Int_t GetWindowTopY()
Returns current top y position of window on screen.
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
UInt_t GetWindowWidth() const
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Class wrapping convolution of two functions.
Class adding two functions: c1*f1+c2*f2.
virtual Int_t GetNumber() const
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
virtual Int_t GetNpar() const
virtual TString GetExpFormula(Option_t *option="") const
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
virtual void SetParent(TObject *p=nullptr)
virtual Double_t * GetParameters() const
void Copy(TObject &f1) const override
Copy this to obj.
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
virtual void SetRange(Double_t xmin, Double_t xmax)
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual Bool_t IsValid() const
virtual void SetParameters(const Double_t *params)
virtual void SetParameter(Int_t param, Double_t value)
virtual void SetParName(Int_t ipar, const char *name)
TClass * IsA() const override
virtual Double_t GetParameter(Int_t ipar) const
virtual Bool_t AddToGlobalList(Bool_t on=kTRUE)
void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax) override
void SetRange(Double_t xmin, Double_t xmax) override
void SetRange(Double_t xmin, Double_t xmax) override
Allows to perform, explore and compare various fits.
TList * GetListOfFittingFunctions(TObject *obj=nullptr)
TGCheckButton * fBestErrors
switch on/off option 'improve errors'
TF1 * FindFunction()
This method looks among the functions stored by the fitpanel, the one that is currently selected in t...
TGDoubleHSlider * fSliderX
slider to set fit range along x-axis
static TFitEditor * GetInstance(TVirtualPad *pad=nullptr, TObject *obj=nullptr)
Static method - opens the fit panel.
TFitEditor(const TFitEditor &)
TGComboBox * fMinMethodList
void CloseWindow() override
Close fit panel window.
TGTextButton * fSetParam
open set parameters dialog
void CreateGeneralTab()
Create 'General' tab.
virtual void DoUpdate()
Easy here!
TGLayoutHints * fLayoutNormAdd
layout hints of fNOrmAdd radio button
TGNumberEntry * fSliderXMax
entry to set the maximum in the range
virtual void DoConvolution(Bool_t on)
Slot connected to addition of predefined functions.
TGNumberEntry * fSliderXMin
entry to set the minumum in the range
virtual void SetFitObject(TVirtualPad *pad, TObject *obj, Int_t event)
Slot called when the user clicks on an object inside a canvas.
virtual void DoEnteredFunction()
Slot connected to entered function in text entry.
virtual void DoNormAddition(Bool_t on)
Slot connected to addition of predefined functions.
virtual void DoPrintOpt(Bool_t on)
Slot connected to print option settings.
std::vector< TF1 * > fSystemFuncs
TGCheckButton * fDrawSame
switch on/off fit function drawing
TGRadioButton * fLibMinuit
TGRadioButton * fConv
set convolution mode
TVirtualPad * fParentPad
pad containing the object
TGRadioButton * fOptDefault
set default printing mode
TGCheckButton * fLinearFit
switch on/off linear fit option
TGRadioButton * fLibMinuit2
virtual void DoMinMethod(Int_t)
Set selected minimization method in use.
TF1 * HasFitFunction()
Look in the list of function for TF1.
void UpdateGUI()
Set the fit panel GUI according to the selected object.
TGCheckButton * fUseRange
switch on/off option 'use function range'
virtual void DoSliderXMoved()
Slot connected to range settings on x-axis.
TGTextButton * fDrawAdvanced
opens a dialog for advanced draw options
TGComboBox * fTypeFit
contains the types of functions to be selected
virtual void DoReset()
Reset all fit parameters.
TGNumberEntryField * fTolerance
TGCheckButton * fNoDrawing
switch on/off 'no drawing' option
TGHorizontalFrame * fSliderZParent
parent of fSliderZ
virtual void DoSetParameters()
Open set parameters dialog.
TGCompositeFrame * fMinimization
minimization tab
TGTab * fTab
tab widget holding the editor
virtual void DoLinearFit()
Slot connected to linear fit settings.
void FillFunctionList(Int_t selected=-1)
Fills the list of functions depending on the type of fit selected.
virtual void Show(TVirtualPad *pad, TObject *obj)
Show the fit panel (possible only via context menu).
virtual void DoNumericSliderYChanged()
syncronize the numeric slider with the graphical one.
virtual void DoClose()
Close the fit panel.
TF1NormSum * fSumFunc
! TF1NormSum object
TGComboBox * fMethodList
contains method list
TGDoubleHSlider * fSliderY
slider to set fit range along y-axis
void ShowObjectName(TObject *obj)
Show object name on the top.
static TFitEditor * fgFitDialog
TList * GetFitObjectListOfFunctions()
virtual void DoAdvancedOptions()
Slot connected to advanced option button (opens a dialog).
TGRadioButton * fLibFumili
virtual void DoDataSet(Int_t sel)
Selects the data set to be fitted.
TGRadioButton * fAdd
set addition mode
TGComboBox * BuildMethodList(TGFrame *parent, Int_t id)
Create method list in a combo box.
void CreateMinimizationTab()
Create 'Minimization' tab.
TGRadioButton * fLibGenetics
TGCheckButton * fImproveResults
switch on/off option 'improve fit results'
TGComboBox * fFuncList
contains function list
TF1Convolution * fConvFunc
! TF1Convolution object
TGCheckButton * fUseGradient
switch on/off option 'use gradient'
TGRadioButton * fNormAdd
set normalized addition mode
virtual void SetCanvas(TCanvas *c)
Connect to another canvas.
EObjectType fType
object type info
TGNumberEntryField * fIterations
TGCompositeFrame * fTabContainer
main tab container
virtual void DoFunction(Int_t sel)
Slot connected to predefined fit function settings.
virtual void DoUseFuncRange()
TGComboBox * fDataSet
contains list of data set to be fitted
virtual void ConnectSlots()
Connect GUI signals to fit panel slots.
virtual void DoFit()
Perform a fit with current parameters' settings.
TGRadioButton * fOptVerbose
set printing mode to 'Verbose'
virtual void SetFunction(const char *function)
Set the function to be used in performed fit.
virtual void Terminate()
Called to delete the fit panel.
TGTextButton * fUserButton
opens a dialog for user-defined fit method
~TFitEditor() override
Fit editor destructor.
TGDoubleHSlider * fSliderZ
slider to set fit range along z-axis
TGTextButton * fFitButton
performs fitting
virtual void DoMaxIterations()
Set the maximum number of iterations.
virtual void DoLibrary(Bool_t on)
Set selected minimization library in use.
void FillDataSetList()
Create a combo box with all the possible objects to be fitted.
virtual void DoEmptyBinsAllWeights1()
Slot connected to 'include emtry bins and forse all weights to 1' setting.
virtual void DoSliderYMoved()
Slot connected to range settings on y-axis.
void RetrieveOptions(Foption_t &, TString &, ROOT::Math::MinimizerOptions &, Int_t)
Retrieve the fitting options from all the widgets.
std::vector< FuncParamData_t > fFuncPars
TGHorizontalFrame * fSliderYParent
parent of fSliderY
TGCheckButton * fNoChi2
switch on/off option 'No Chi-square'
virtual void DoNoStoreDrawing()
Slot connected to 'no storing, no drawing' settings.
void MakeTitle(TGCompositeFrame *parent, const char *title)
Create section title in the GUI.
virtual void DoNoSelection()
Slot called when users close a TCanvas or when the user select no object.
TGTextButton * fUpdateButton
updates data from gROOT and gDirectory
TGTextEntry * fEnteredFunc
contains user function file name
TGCheckButton * fIntegral
switch on/off option 'integral'
virtual void DoAllWeights1()
Slot connected to 'set all weights to 1' setting.
Bool_t SetObjectType(TObject *obj)
Check whether the object suitable for fitting and set its type, dimension and method combo box accord...
virtual void Hide()
Hide the fit panel and set it to non-active state.
TGNumberEntryField * fErrorScale
void SetEditable(Bool_t) override
Option_t * GetDrawOption() const override
Get draw options of the selected object.
std::vector< FuncParamData_t > FuncParams_t
TGLayoutHints * fLayoutAdd
layout hints of fAdd radio button
TGHorizontalFrame * fSliderXParent
parent of fSliderX
void ProcessTreeInput(TObject *objSelected, Int_t selected, TString variables, TString cuts)
TGCheckButton * fEnableRobust
switch on/off robust option
void DrawSelection(bool restore=false)
Draws the square around the object showing where the limits for fitting are.
TGCheckButton * fEmptyBinsWghts1
switch on/off option 'include empry bins'
virtual void DoSliderZMoved()
Slot connected to range settings on z-axis.
Int_t fDim
object dimension
TGNumberEntry * fSliderYMin
entry to set the minumum in the range
void GetRanges(ROOT::Fit::DataRange &)
std::multimap< TObject *, TF1 * > fPrevFit
TGNumberEntry * fRobustValue
contains robust value for linear fit
TGNumberEntry * fSliderYMax
entry to set the maximum in the range
virtual void DoNoChi2()
Slot connected to 'no chi2' option settings.
TGCheckButton * fAdd2FuncList
switch on/off option 'add to list'
TGCompositeFrame * fGeneral
general tab
virtual void DisconnectSlots()
Disconnect GUI signals from fit panel slots.
void GetFunctionsFromSystem()
TGRadioButton * fOptQuiet
set printing mode to 'Quiet'
void FillMinMethodList(Int_t selected=-1)
Fills the list of methods depending on the minimization library selected.
TGCheckButton * fNoStoreDrawing
switch on/off 'no store/drwing' option
TGCheckButton * fAllWeights1
switch on/off option 'all weights=1'
TGRadioButton * fNone
set no operation mode
TGLayoutHints * fLayoutConv
layout hints of fConv radio button
TGTextButton * fResetButton
resets fit parameters
void CreateFunctionGroup()
Creates the Frame that contains oll the information about the function.
TGLayoutHints * fLayoutNone
layout hints of fNone radio button
TGLabel * fSelLabel
contains selected fit function
Int_t CheckFunctionString(const char *str)
Check entered function string.
void RecursiveRemove(TObject *obj) override
When obj is deleted, clear fFitObject if fFitObject = obj.
TObject * fFitObject
selected object to fit
virtual void DoRobustFit()
Slot connected to 'robust fitting' option settings.
TGTextButton * fCloseButton
close the fit panel
virtual void DoAddition(Bool_t on)
Slot connected to addition of predefined functions.
virtual void DoUserDialog()
Open a dialog for getting a user defined method.
virtual void DoNumericSliderXChanged()
Sincronize the numeric sliders with the graphical one.
Create a dialog for fit function parameter settings.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
virtual Int_t GetSelected() const
virtual TGListBox * GetListBox() const
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Int_t GetState(TGFrame *f) const
Get state of sub frame.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Dragging the slider will generate the event:
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
TGFrame(const TGFrame &)=delete
void MapWindow() override
map window
virtual UInt_t GetOptions() const
A composite frame with a border and a title.
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
A listbox is a box, possibly with scrollbar, containing entries.
virtual Int_t GetNumberOfEntries() const
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
TGMainFrame(const TGMainFrame &)=delete
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
TGNumberEntry is a number entry input widget with up/down buttons.
TGClient * fClient
Connection to display server.
Provides a StatusBar widget.
const char * GetString() const
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
Text string listbox entries.
const TGString * GetText() const
const char * GetTitle() const override
Returns title of object.
A composite frame that layout their children in vertical way.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetDimension() const
Option_t * GetOption() const override
Returns the object option stored in the list.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
The most important graphics class in the ROOT system.
TList * GetListOfPrimitives() const override
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
virtual Bool_t HasConnection(const char *signal_name) const
Return true if there is any object connected to this signal.
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
A specialized TSelector for TTree::Draw.
virtual Int_t GetDimension() const
Sequenceable collection abstract base class.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
void Draw(Option_t *opt) override
Default Draw method for all objects.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TCanvas * GetCanvas() const =0
std::multimap< TObject *, TF1 * >::iterator fPrevFitIter
leg AddEntry(h1,"Histogram filled with random numbers","f")
TFitResultPtr FitObject(TH1 *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
fitting function for a TH1 (called from TH1::Fit)
void Init2DGaus(const ROOT::Fit::BinData &data, TF1 *f1)
compute initial parameter for 2D gaussian function given the fit data Set the sigma limits for zero t...
TFitResultPtr UnBinFit(ROOT::Fit::UnBinData *data, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption)
fit an unbin data set (from tree or from histogram buffer) using a TF1 pointer and fit options.
void FillData(BinData &dv, const TH1 *hist, TF1 *func=nullptr)
fill the data vector from a TH1.
void InitGaus(const ROOT::Fit::BinData &data, TF1 *f1)
compute initial parameter for gaussian function given the fit data Set the sigma limits for zero top ...