26#include "TObjString.h"
60 if (IsAddStandardActions)
74 else if (iMemoryUsage > 100)
84 for (Int_t ndata = 0; ndata <
GetNumData(); ndata++)
87 for (Int_t nmodel = 0; nmodel <
GetNumModel(); nmodel++) {
106 return (n >= 0) && (n < GetNumData()) ? dynamic_cast<TGo4FitData *>(
fxDatas[n]) :
nullptr;
116 return !DataName ? nullptr :
dynamic_cast<TGo4FitData *
>(
fxDatas.FindObject(DataName));
130 if ((lrange < rrange) || (rrange != 0.))
147 if ((lrange < rrange) || (rrange != 0.))
164 for (Int_t n = 0; n < comp->
NumSlots(); n++) {
167 for (Int_t n2 = 0; n2 <
NumSlots(); n2++) {
202 return (n >= 0) && (n < GetNumModel()) ? dynamic_cast<TGo4FitModel *>(
fxModels[n]) :
nullptr;
236 Double_t lrange, Double_t rrange)
241 Bool_t flag = kFALSE;
243 Bool_t createmodel = kFALSE;
246 TString Prefix(NamePrefix);
250 Bool_t findsame = kFALSE;
252 for (Int_t Order = 0; Order <= MaxOrder; Order++) {
253 TString Name(Prefix);
257 if (findsame && !createmodel)
263 if ((lrange < rrange) || (rrange != 0.))
272 createmodel = kFALSE;
273 }
else if (createmodel)
286 Bool_t flag = kFALSE;
288 Bool_t createmodel = kFALSE;
291 Bool_t findsame = kFALSE;
293 for (Int_t n = 0; n < Coef.GetSize(); n++) {
294 TString Name(NamePrefix);
300 if (findsame && !createmodel)
314 createmodel = kFALSE;
315 }
else if (createmodel)
328 TArrayD Orders(NumAxis);
331 Bool_t flag = kFALSE;
333 Bool_t createmodel = kFALSE;
337 TString Prefix(NamePrefix);
341 Bool_t findsame = kFALSE;
344 TString Name(Prefix);
345 for (Int_t n = 0; n < NumAxis; n++) {
347 Name += Int_t(Orders[n]);
350 if (findsame && !createmodel)
362 if (Orders[nn] <= MaxOrder)
366 }
while (nn < NumAxis);
367 flag = (nn < NumAxis);
373 createmodel = kFALSE;
374 }
else if (createmodel)
383 Double_t iWidth, Double_t iAmpl, Int_t Axis)
401 newname = NewName ? NewName : mod->GetName();
435 if (
GetModel(n)->IsAssignTo(DataName))
502 Int_t dbuf = -1, mbuf = -1;
516 default: dbuf = -1; mbuf = -1;
534 std::cout <<
" User fit function not set. Switch to least squares " << std::endl;
552 switch (FitFunctionType) {
554 Double_t zn1 = (value - modelvalue);
560 Double_t zn2 = (value - modelvalue);
561 return zn2 * zn2 / standdev;
564 if (modelvalue <= 0.)
566 Double_t zn3 = (value - modelvalue);
567 return zn3 * zn3 / modelvalue;
570 Double_t zn4 = (value - modelvalue);
571 return zn4 * zn4 / ((value < 1.) ? 1. : value);
576 Double_t zn5 = (value + ((value < 1.) ? 0. : 1.) - modelvalue);
577 return zn5 * zn5 / (value + 1.);
580 if (modelvalue <= 0.)
582 return modelvalue - value * TMath::Log(modelvalue);
587 default:
return (value - modelvalue) * (value - modelvalue);
600 if (selectdata && (dat != selectdata))
610 for (Int_t nbin = 0; nbin < size; nbin++)
612 PointFitFunction(FitFunctionType, DataAmpl * values[nbin], res[nbin], DataAmpl * DataAmpl * devs[nbin]);
623 if (
GetModel(nm)->IsAssignTo(dat->GetName())) {
631 Double_t value = DataAmpl * iter->Value();
632 Double_t deviat = DataAmpl * DataAmpl * iter->StandardDeviation();
634 Double_t modelvalue = 0.;
635 for (Int_t nm = 0; nm <= Models.GetLast(); nm++) {
642 }
while (iter->Next());
644 for (Int_t nm = 0; nm <= Models.GetLast(); nm++)
654 if (FitFunctionType < 0)
709 for (Int_t nbin = 0; nbin < size; nbin++)
776 return !model ? nullptr : model->
GetModelBins(DataName);
782 if (Opt ==
"Ampls") {
785 }
else if (Opt ==
"Pars") {
788 }
else if (Opt ==
"Results") {
791 }
else if (Opt ==
"Lines") {
797 std::cout <<
"Fitiing function type: ";
799 case ff_chi_square: std::cout <<
"ff_chi_square" << std::endl;
break;
800 case ff_chi_Pearson: std::cout <<
"ff_chi_Pearson" << std::endl;
break;
801 case ff_chi_Neyman: std::cout <<
"ff_chi_Neyman" << std::endl;
break;
802 case ff_chi_gamma: std::cout <<
"ff_chi_gamma" << std::endl;
break;
803 case ff_ML_Poisson: std::cout <<
"ff_ML_Poisson" << std::endl;
break;
804 case ff_user: std::cout <<
"user defined" << std::endl;
break;
805 default: std::cout <<
"ff_least_squares" << std::endl;
807 std::cout << std::endl <<
" LIST OF DATA OBJECTS" << std::endl;
809 std::cout << std::endl <<
" LIST OF MODEL OBJECTS" << std::endl;
831 if (
GetModel(nm)->IsAssignTo(DataName))
834 TArrayD Ampls(Models.GetLast() + 1);
835 for (Int_t n = 0; n <= Models.GetLast(); n++) {
841 TArrayD bins(size), scales(size);
845 if (iter->Reset(UseRanges))
847 Double_t value = iter->Value();
848 for (Int_t n = 0; n <= Models.GetLast(); n++) {
852 value = TMath::Abs(value);
854 scales[ppnt] = iter->x();
856 }
while (iter->Next(UseRanges));
858 for (Int_t n = 0; n <= Models.GetLast(); n++) {
866 Double_t sum00 = 0., sum11 = 0., sum22 = 0.;
867 for (Int_t pnt = 0; pnt < size; pnt++)
868 if ((bins[pnt] > 0.) && ((niter == 0) || (TMath::Abs(scales[pnt] - first) < second * 2.))) {
870 sum11 += bins[pnt] * scales[pnt];
871 sum22 += bins[pnt] * scales[pnt] * scales[pnt];
875 Double_t mid = sum11 / sum00;
876 Double_t dev = TMath::Sqrt(sum22 / sum00 - mid * mid);
879 if ((dev / second > 0.8) && (dev / second < 1.2))
889 }
while (niter++ < 8);
901 if (ModelName && !model)
905 if (!iter || !iter->Reset(kTRUE))
908 double sum = 0., ampl = 1.;
916 double dx = onlycounts ? 1. : iter->xWidths();
918 sum += ampl * value * dx;
919 }
while (iter->Next(kTRUE));
947 Int_t groupindex = -1;
950 TString modelname(ModelName);
951 if (modelname ==
"Background")
953 else if (modelname.Index(
"Group", 0, TString::kExact) == 0) {
954 modelname.Remove(0, 5);
956 groupindex = strtol(modelname.Data(), &err, 10);
957 if (err && (*err != 0))
965 if ((groupindex < 0) || (model->
GetGroupIndex() == groupindex))
969 if (Models.GetLast() < 0)
974 if (!iter || !iter->Reset(kFALSE))
977 TH1 *histo =
nullptr;
979 TGraph *gr =
nullptr;
980 Bool_t UseRanges = kTRUE;
982 if (iter->HasIndexes() && (iter->IndexesSize() == iter->ScalesSize()) && iter->HasWidths()) {
983 histo = iter->CreateHistogram(ResName, kFALSE, !IsModel);
986 ndim = histo->GetDimension();
987 UseRanges = Models.GetLast() >= 0;
990 gr = iter->CreateGraph(ResName, kTRUE, !IsModel);
994 if ((histo || gr) && IsModel) {
995 TArrayD Ampls(Models.GetLast() + 1);
997 for (Int_t n = 0; n <= Models.GetLast(); n++) {
1003 if (iter->Reset(UseRanges))
1006 for (Int_t n = 0; n <= Models.GetLast(); n++) {
1012 case 1: histo->SetBinContent(iter->Indexes()[0] + 1, zn);
break;
1013 case 2: histo->SetBinContent(iter->Indexes()[0] + 1, iter->Indexes()[1] + 1, zn);
break;
1015 histo->SetBinContent(iter->Indexes()[0] + 1, iter->Indexes()[1] + 1, iter->Indexes()[2] + 1, zn);
1019 (gr->GetX())[iter->Point()] = iter->x();
1020 (gr->GetY())[iter->Point()] = zn;
1023 }
while (iter->Next(UseRanges));
1025 for (Int_t n = 0; n <= Models.GetLast(); n++) {
1032 for (Int_t n1 = 0; n1 < gr->GetN() - 1; n1++)
1033 for (Int_t n2 = n1 + 1; n2 < gr->GetN(); n2++)
1034 if ((gr->GetX())[n1] > (gr->GetX())[n2]) {
1035 Double_t xx = (gr->GetX())[n1];
1036 (gr->GetX())[n1] = (gr->GetX())[n2];
1037 (gr->GetX())[n2] = xx;
1038 Double_t yy = (gr->GetY())[n1];
1039 (gr->GetY())[n1] = (gr->GetY())[n2];
1040 (gr->GetY())[n2] = yy;
1043 TNamed *res =
nullptr;
1052 title.Form(
"Draw of model %s", ModelName);
1054 title.Form(
"Draw of full model of %s", DataName);
1056 title.Form(
"Draw of data %s", DataName);
1057 res->SetTitle(title.Data());
1078 TString opt(option);
1080 TCanvas *fCanvas =
nullptr;
1082 if ((opt.Length() > 0) && (opt[0] ==
'#')) {
1087 CanvasName =
"Canvas";
1089 }
while (gROOT->FindObject(CanvasName.Data()));
1090 fCanvas =
new TCanvas(CanvasName, TString(
"Draw of fitter ") + GetName() +
" " + opt, 3);
1094 Bool_t drawdata = kFALSE, drawcomp = kFALSE, drawmodel = kFALSE;
1096 TObjArray selectmodels;
1104 while (opt.Length() > 0) {
1105 Int_t len = opt.Index(
",", 0, TString::kExact);
1112 TString optpart(opt.Data(), len);
1113 while ((optpart.Length() > 0) && (optpart[0] ==
' '))
1114 optpart.Remove(0, 1);
1116 Bool_t find = kFALSE;
1119 if (optpart.Index(
GetDataName(n), 0, TString::kExact) == 0) {
1127 else if (optpart ==
"-")
1133 selectmodels.Add(
new TObjString(optpart));
1135 if (model && !selectdata)
1142 if (opt.Length() > 0)
1146 if (!selectdata && !drawdata)
1153 for (Int_t nn = 0; nn <
GetNumData(); nn++) {
1155 if (selectdata && (data != selectdata))
1159 TObject *obj =
CreateDrawObject(TString(data->GetName()) +
"_bins", data->GetName(), kFALSE);
1161 TAttLine *line =
dynamic_cast<TAttLine *
>(obj);
1163 line->SetLineColor(1);
1164 line->SetLineWidth(1);
1171 TObject *mobj =
CreateDrawObject(TString(data->GetName()) +
"_fullmodel", data->GetName(), kTRUE);
1173 TAttLine *line =
dynamic_cast<TAttLine *
>(mobj);
1175 line->SetLineColor(4);
1176 line->SetLineWidth(2);
1183 for (Int_t nmodel = 0; nmodel <
GetNumModel(); nmodel++) {
1188 TObject *cobj =
CreateDrawObject(TString(data->GetName()) +
"_" + model->GetName(), data->GetName(), kTRUE,
1191 TAttLine *line =
dynamic_cast<TAttLine *
>(cobj);
1193 line->SetLineColor(6);
1194 line->SetLineWidth(1);
1200 for (Int_t n = 0; n <= selectmodels.GetLast(); n++) {
1201 TString name = ((TObjString *)(selectmodels[n]))->String();
1203 TObject *cobj =
CreateDrawObject(TString(data->GetName()) +
"_" + name, data->GetName(), kTRUE, name.Data());
1205 TAttLine *line =
dynamic_cast<TAttLine *
>(cobj);
1207 line->SetLineColor(6);
1208 line->SetLineWidth(1);
1218 Bool_t allhisto = kTRUE;
1219 for (Int_t n = 0; n <=
fxDrawObjs->GetLast(); n++)
1220 if (!(
fxDrawObjs->At(n)->InheritsFrom(TH1::Class())))
1224 new THStack(TString(
"Stack") +
"_" +
fxDrawObjs->At(0)->GetName(),
fxDrawObjs->At(0)->GetName());
1225 for (Int_t n = 0; n <=
fxDrawObjs->GetLast(); n++)
1229 stack->Draw(
"nostack");
1231 for (Int_t n = 0; n <=
fxDrawObjs->GetLast(); n++)
1244 std::cout << std::endl <<
"*** LIST OF AMPLITUDES VALUE ***" << std::endl;
1255 std::cout << std::endl <<
" *** LIST OF LINES PARAMETERS ***" << std::endl;
1263 for (
int naxis = 0; naxis < 3; naxis++)
1268 std::cout << std::setw(10) <<
"Name" << std::setw(12) <<
"Ampl";
1269 for (Int_t naxis = 0; naxis <= MaxAxis; naxis++)
1270 std::cout << std::setw(11) <<
"Pos" << naxis << std::setw(11) <<
"Width" << naxis;
1271 std::cout << std::endl;
1277 std::cout << std::setw(10) << m->GetName() << std::setw(12) << m->
GetAmplValue();
1279 for (
int naxis = 0; naxis <= MaxAxis; naxis++) {
1280 Double_t pos, width;
1281 std::cout << std::setw(12);
1286 std::cout << std::setw(12);
1292 std::cout << std::endl;
1308 for (Int_t n = 0; n <=
fxDrawObjs->GetLast(); n++)
1320 name.Form(
"%s%d", Head, n++);
1321 }
while (isModel ?
FindModel(name.Data()) !=
nullptr :
FindData(name.Data()) !=
nullptr);
1325void TGo4Fitter::Streamer(TBuffer &b)
1327 if (b.IsReading()) {
1328 TGo4Fitter::Class()->ReadBuffer(b,
this);
1334 TGo4Fitter::Class()->WriteBuffer(b,
this);
void DoAction(TGo4FitterAbstract *Fitter) override
Perform amplitude estimations.
Basic abstract class, combining common properties of data and model.
TGo4FitParameter * GetAmplPar()
Return amplitude parameter object.
void SetRange(Int_t naxis, Double_t min, Double_t max)
Includes axis range in consideration.
Double_t GetAmplError()
Return error of amplitude parameter.
const char * GetAmplFullName()
Returns full name of amplitude parameter.
void CollectParsTo(TGo4FitParsList &list) override
Collect all parameters to provided parameters list object.
Double_t GetAmplValue()
Return value of amplitude parameter.
void SetAmplValue(Double_t iAmpl)
Set value of amplitude parameter.
Data object, which provides access to TGraph and TGraphErrors ROOT objects.
void SetGraph(TGraph *iGraph, Bool_t iGraphOwned=kFALSE)
Set TGraph object.
Data objects, which provides access to generic TH1 ROOT histogram.
void SetHistogram(TH1 *iHistogram, Bool_t iHistogramOwned=kFALSE)
Set histogram to object.
Int_t CountPoints(Bool_t UseRanges=kTRUE)
Counts total number of points in data object.
Basic abstract class for representing data, which should be fitted.
Double_t * GetBinsResult() const
Returns pointer on buffer with complete model of data bins.
Bool_t BuffersAllocated() const
Checks, if buffers allocated for data.
Int_t GetBinsSize() const
Return number of data bins in buffers.
Double_t * GetBinsDevs() const
Returns pointer on buffer with standard deviations for each data bins.
Double_t * GetBinsValues() const
Returns pointer on buffer with data bins values.
virtual void Finalize()
Removes all buffers, created in initialize() routine.
virtual Bool_t Initialize(Int_t UseBuffers=-1)
Initialize data object.
virtual std::unique_ptr< TGo4FitDataIter > MakeIter()
Creates iterator for data object.
Int_t DefineBinsSize()
Defines number of selected bins in data Creates iterator and sequentially checks all points.
One dimensional gaussian peak.
Model objects, which reproduce component of polynomial function.
Basic abstract class for representing model components of fitted data.
void ClearAssignments()
Remove all assignments.
Double_t * GetModelBins(const char *DataName) const
Get model bins for specified data (if exists)
Bool_t AddModelToDataResult(TGo4FitData *data)
Evaluate model values for all data point and add them to result buffer.
void ConnectToDataIfAssigned(TGo4FitData *data)
Check, if model assigned to such a data (via name) and store pointer on this data object.
Bool_t BuffersAllocated() const
Checks if model allocate buffers for calculations.
virtual void Finalize()
Deletes all buffers, created during initialization.
virtual Bool_t Initialize(Int_t UseBuffers=-1)
Initialize model object.
const char * AssignmentName(Int_t n)
Returns name of data, to which model object is assigned.
Int_t GetGroupIndex() const
Returns group index of model.
virtual Bool_t BeforeEval(Int_t ndim)
Prepares (if necessary) some intermediate variables to be able calculate values of model via EvalN() ...
virtual Bool_t GetWidth(Int_t naxis, Double_t &width)
Returns with of model component, if exists.
virtual Bool_t GetPosition(Int_t naxis, Double_t &pos)
Return position of model, if exists.
Bool_t IsAssignTo(const char *DataName) const
Checks, if model assigned to given data.
virtual Double_t EvaluateAtPoint(TGo4FitData *data, Int_t nbin, Bool_t UseRanges=kTRUE)
Evaluate model value for specified data point.
void ChangeDataNameInAssignments(const char *oldname, const char *newname)
Change name of data in assignments.
void RebuildShape(Bool_t ForceBuild=kFALSE)
Recalculates shape of object.
void SetGroupIndex(Int_t index=-1)
Set group index of model.
void AssignToData(const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Assign model to specified data object.
virtual void AfterEval()
Clear buffers, which were created by BeforeEval() method.
Double_t GetRatioValueFor(const char *DataName)
Returns ratio value for specified data object.
void ClearAssignmentTo(const char *DataName)
Remove assignment to given data (if exists).
Int_t NumAssigments() const
Returns number of assignment for this model.
void SetOwner(TNamed *iOwner)
Sets owner of object.
void SetParsValues(Double_t *pars)
Set value for all parameters from array.
void PrintPars() const
Print only value and error of all parameters in list.
Int_t NumFreePars()
Return number of free pars.
virtual void FillSlotList(TSeqCollection *lst)
Fill list of TGo4FitSlot objects to provided collection.
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
Clear object in specified slot.
void PrepareSlotsForWriting()
void CheckDuplicatesOnSlot()
Resolve situation, when same object assigned to several slots with ownership flag.
Int_t NumSlots()
Returns number of slots in list.
TGo4FitSlot * GetSlot(Int_t nslot)
Returns slots from list with specified index.
void SetUpdateSlotList()
Update internal list of slots (if exists).
Managing pointers on specific objects.
void ClearConnectionToSlot()
Clear connection to other slot.
TGo4FitSlot * GetConnectedSlot() const
Returns pointer to connected slot or 0, if not connected.
void SetParsListChange()
Should be used, when number of parameters are changed.
void Clear(Option_t *option="") override
Clear fitter.
void Print(Option_t *option="") const override
Print information about fitter to standard output.
void PrintResults() const
Print result values to standard output.
void AddAction(TGo4FitterAction *Action)
Add action to action list.
void AddSimpleMinuit()
Creates and add TGo4FitMinuit object to actions list.
TGo4FitterAbstract()
Default constructor.
void ExecuteDependencies(Double_t *pars)
Execute dependencies in currently associated configuration (if exist).
virtual void CollectAllPars()
Should collect parameters from all associated to fitter objects.
TObjArray fxModels
Container for model components.
void FinalizeFitterData() override
Finalize fitter data.
void MoveDrawObjectsToROOT()
TGo4FitDataHistogram * AddH1(const char *DataName, TH1 *histo, Bool_t Owned=kFALSE, Double_t lrange=0., Double_t rrange=0.)
Create TGo4FitDataHistogram object and adds its to fitter.
TGo4FitDataHistogram * SetH1(const char *DataName, TH1 *histo, Bool_t Owned=kFALSE)
Set histogram to existing TGo4FitDataHistogram object.
void PrintLines() const
Print amplitude, position and width for each model components.
Bool_t ModelBuffersAllocated(TGo4FitModel *model)
Bool_t DataBuffersAllocated(TGo4FitData *data)
Double_t CalculatesModelIntegral(const char *ModelName, Bool_t OnlyCounts=kFALSE)
Calculates integral of model (if ModelName is specified) if OnlyCounts specified, only sum of values ...
Int_t fiMemoryUsage
Defines use of memory during actions executions.
Int_t GetNumComp() const
Return total number of TGo4FitComponent (data and model) objects in fitter.
Double_t * GetDataBinsResult(TGo4FitData *data) const
TGo4FitModel * GetModel(Int_t n)
Return model component with given index.
Int_t NumModelsAssosiatedTo(const char *DataName)
Counts models associated with specific data.
void Print(Option_t *option="") const override
Print containment of fitter.
TGo4FitModel * RemoveModel(const char *ModelName, Bool_t IsDel=kFALSE)
Remove model component from fitter.
void DeleteModelsAssosiatedTo(const char *DataName)
Remove models associated with specific data.
const char * GetDataName(Int_t n)
Return name of data object with given index.
TGo4FitModelGauss1 * AddGauss1(const char *DataName, const char *ModelName, Double_t iPosition, Double_t iWidth, Double_t iAmpl=1., Int_t Axis=0)
Add 1-dim gaussian model to fitter.
TGo4FitData * AddData(TGo4FitData *d)
Add data object to fitter.
TGo4FitDataGraph * SetGraph(const char *DataName, TGraph *gr, Bool_t Owned=kFALSE)
Set graph to existing TGo4FitDataGraph object.
TGo4FitData * RemoveData(const char *DataName, Bool_t IsDel=kFALSE)
Remove data object from fitter.
Bool_t InitFitterData() override
Initialize fitter data.
void EstimateAmplitudes(Int_t NumIters=1)
Estimate amplitude of all model components.
void PrintAmpls() const
Print value of all amplitude parameters.
TUserFitFunction fxUserFitFunction
Pointer on user fit function.
Double_t * GetModelBinsValues(TGo4FitModel *model, const char *DataName) const
void AddAmplEstimation(Int_t NumIters=1)
Add amplitude estimation to actions list.
friend class TGo4FitAmplEstimation
Double_t CalculateFCN(Int_t FitFunctionType, TGo4FitData *selectdata=nullptr)
void SetMemoryUsage(Int_t iMemoryUsage)
Set value of memory usage.
void CheckSlotsBeforeDelete(TGo4FitComponent *comp)
Double_t PointFitFunction(Int_t FitFunctionType, Double_t value, Double_t modelvalue, Double_t standdev)
void DeleteAllData()
Delete all data objects from fitter.
void ClearModelAssignmentTo(const char *ModelName, const char *DataName=nullptr)
Remove assignment to given data (if exists).
Int_t GetNumModel() const
Return number of model component in fitter.
Int_t GetDataBinsSize(TGo4FitData *data) const
TGo4FitModel * FindModel(const char *ModelName)
Return model component with given name.
TGo4FitModel * CloneModel(const char *ModelName, const char *NewName=nullptr)
Clones specified model.
void ProvideLastDrawObjects(TObjArray &lst)
Copy pointer on drawn object after last command to specified TObjArray.
void RebuildAll(Bool_t ForceBuild=kFALSE)
Update all data objects and model components according to current parameters values.
void AddPolynomX(const char *DataName, const char *NamePrefix, Int_t MaxOrder=1, Int_t GroupIndex=0, Double_t lrange=0., Double_t rrange=0.)
Construct 1-dim polynom for specified data object for x scale.
TString FindNextName(const char *Head, Int_t start, Bool_t isModel=kTRUE)
void Draw(Option_t *option) override
Draw fitter on current canvas.
void AddStandardActions()
Add list of standard actions to fitter.
TGo4FitModel * AddModel(TGo4FitModel *m)
Add model component to fitter.
Int_t GetMemoryUsage() const
Return value of memory usage parameter.
TGo4FitData * GetData(Int_t n)
Return data object with given index.
TGo4FitData * FindData(const char *DataName)
Return data object with given name.
Double_t CalculateFitFunction(Double_t *pars=nullptr, Int_t FitFunctionType=-1, const char *DataName=nullptr)
Calculate value of fit function for given set of parameters and specified type of fit function (it ca...
Int_t GetNumData() const
Return number of data objects in fitter.
void Clear(Option_t *option="") override
Remove all data, all models and all actions.
Int_t fiFitFunctionType
Defines type of fitted function.
void AddPolynoms(const char *DataName, const char *NamePrefix, Int_t MaxOrder=1, Int_t NumAxis=1, Int_t GroupIndex=0)
Construct full polynom for specified data object.
TObjArray fxDatas
Container for data objects.
Int_t CalculateNDF(const char *DataName=nullptr)
Calculates number of degree of freedom (NDF).
Double_t DoCalculation() override
Calculates value of fit function according current values of parameters.
Bool_t CalculatesMomentums(const char *DataName, Bool_t UseRanges, Bool_t SubstractModels, Double_t &first, Double_t &second)
Calculates first and second momentum for specified data Usage of ranges and subtraction of model can ...
Double_t CalculatesIntegral(const char *DataName, const char *ModelName=nullptr, Bool_t OnlyCounts=kFALSE)
Calculates integral for data or model (if ModelName is specified) if OnlyCounts specified,...
Int_t DoNDFCalculation() override
Calculates number of dimensions of freedom; Should be implemented in inherited classes.
void CollectAllPars() override
Should collect parameters from all associated to fitter objects.
void AssignModelTo(const char *ModelName, const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Assign model to specified data object.
Double_t * GetDataBinsDevs(TGo4FitData *data) const
Double_t * GetDataBinsValues(TGo4FitData *data) const
void ChangeDataNameInAssignments(const char *oldname, const char *newname)
Change data name in model component assignments.
void SetFitFunctionType(Int_t iFitFunctionType)
Set fitted function type for minimization.
void FillSlotList(TSeqCollection *) override
Collect all TGo4FitSlot objects, situated in fitter, data and models to givven TObjArray.
TGo4FitDataGraph * AddGraph(const char *DataName, TGraph *gr, Bool_t Owned=kFALSE, Double_t lrange=0., Double_t rrange=0.)
Create TGo4FitDataGraph object and adds its to fitter.
Int_t GetFitFunctionType() const
Return type of fitted function.
virtual ~TGo4Fitter()
Destructor.
TObject * CreateDrawObject(const char *ObjName, const char *DataName, Bool_t IsModel=kFALSE, const char *ModelName=nullptr)
Create object (TH1 or TGraph), which can be drawn.
TGo4Fitter()
Default constructor.
void DeleteAllModels()
Delete all model objects from fitter.
TGo4FitComponent * GetComp(Int_t n)
Return TGo4FitComponent object with given index.