25#include "TObjString.h"
54 TGo4FitParsList::Clear(option);
73 for (Int_t n = 0; n <
NumPars(); n++) {
111 for (Int_t i = 0; i <= Dependencies.GetLast(); i++) {
121 std::cout <<
"Error dependence parameter: " << dep->
GetParameter().Data() << std::endl;
129 for (Int_t n = 0; n <
NumPars(); n++) {
137 TFormula *fx =
new TFormula(
"test", formula.Data());
138 Int_t err = fx->Compile(formula.Data());
141 std::cout <<
"Error in dependence: " << formula.Data() <<
" code " << err << std::endl;
158 for (Int_t i = 0; i <= Dependencies.GetLast(); i++)
164 for (Int_t i = 0; i <= Dependencies.GetLast(); i++) {
312 if ((num < 0) || (num >
fxActions.GetLast()))
331 if (!action || (indx < 0))
333 Int_t newindx = indx + dir;
334 if ((newindx >= 0) && (newindx <=
fxActions.GetLast()) && (newindx != indx)) {
345 Bool_t need = kFALSE;
346 for (Int_t n = 0; n <= Actions->GetLast(); n++) {
356 for (Int_t n = 0; n <= Actions->GetLast(); n++) {
394 TObjArray *rownames, TObjArray *colnames)
396 if (!objs || (objs->GetLast() < 0))
406 for (Int_t n = 0; n <
NumSlots(); n++) {
415 if ((numuse == 0) || ((objs->GetLast() + 1) % numuse != 0))
419 for (Int_t nobj = 0; nobj <= objs->GetLast(); nobj++) {
420 TObject *obj = objs->At(nobj);
422 std::cout <<
"Empty object in list" << std::endl;
429 std::cout <<
"Object " << obj->GetName() <<
" of class " << obj->ClassName() <<
" noncompatible with "
430 << slot->
GetClass()->GetName() << std::endl;
435 TObjArray *res =
new TObjArray((objs->GetLast() + 1) / numuse);
436 res->SetOwner(kTRUE);
441 rownames->SetOwner(kTRUE);
445 colnames->SetOwner(kTRUE);
462 while (nuse < numuse) {
466 newfitter->SetName(objs->At(nobj)->GetName());
467 if ((nuse == 1) && colnames)
468 colnames->Add(
new TObjString(objs->At(nobj)->GetName()));
476 }
while (nobj <= objs->GetLast());
487 while (nuse < numuse) {
490 if ((nuse == 1) && colnames)
491 colnames->Add(
new TObjString(objs->At(nobj)->GetName()));
501 }
while (nobj <= objs->GetLast());
508 if (rownames && resf) {
510 for (Int_t n = 0; n < resf->
NumPars(); n++)
514 TString rname(
"Result");
516 rownames->Add(
new TObjString(rname));
520 while (nuse < numuse) {
544 for (Int_t n = 0; n <=
fxActions.GetLast(); n++) {
603 std::cout << std::endl <<
"*** LIST OF RESULT VALUE ***" << std::endl;
604 std::cout <<
" Fit function = " <<
GetResultFF() << std::endl;
607 std::cout <<
" Res " << n <<
" = " <<
GetResultValue(n) << std::endl;
612 std::cout << std::endl <<
"********** THIS IS PRINTOUT OF FITTER OBJECT **********" << std::endl;
616 std::cout <<
"Actions list: " << std::endl;
621void TGo4FitterAbstract::Streamer(TBuffer &b)
624 TGo4FitterAbstract::Class()->ReadBuffer(b,
this);
627 TGo4FitterAbstract::Class()->WriteBuffer(b,
this);
Object, used to store dependency of one parameter from other, calculated via expression.
const TString & GetExpression() const
void Initialize(Int_t iNumPar, const char *iFormula)
Double_t ExecuteDependency(Double_t *Params)
const TString & GetParameter() const
Minuit minimization action.
void AddCommand(const char *iCommand)
Add Minuit command to command list.
void Print(Option_t *option="") const override
const char * GetFullName()
Returns full name of object.
Model and data objects parameter.
Double_t GetValue() const
Return parameter value.
void SetBlocked()
Blocks parameter value.
void SetValue(Double_t iValue)
Set parameter value.
TGo4FitParameter * FindPar(const char *ParName)
Find parameter object with given name.
virtual Bool_t GetParFixed(const char *ParName)
Return status for parameter with given name, is it fixed or not.
Int_t GetParIndex(const TGo4FitParameter *par)
Return index of given parameter in list.
virtual Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax)
Get range limits for parameter with given name.
TGo4FitParameter * Find(const char *ParName)
void SetParsValues(Double_t *pars)
Set value for all parameters from array.
void GetParsValues(Double_t *pars)
Copy values of all parameters in list to provided array.
virtual Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon)
Get epsilon value for parameter with given name.
const char * GetParFullName(Int_t n)
Return full name of parameter with given index.
virtual void MemorizePars()
Memorize values of all parameters.
void Print(Option_t *option="") const override
Default print method.
TGo4FitParsList()
Default constructor.
void ClearPars()
Remove all parameters from list.
virtual void RememberPars()
Restore parameters values, which were stored by MemorizePars() routine;.
void PrepareSlotsForWriting()
Int_t NumSlots()
Returns number of slots in list.
TGo4FitSlot * GetSlot(Int_t nslot)
Returns slots from list with specified index.
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Check, if all necessary objects are provided.
Managing pointers on specific objects.
TClass * GetClass() const
Return pointer on class for desired object.
Bool_t IsRequired() const
Returns kTRUE, if object required, but not yet set.
Bool_t IsSuitable(TObject *obj) const
Checks, if object class corresponds to class, specified for slot.
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
Sets object to slot.
TObject * GetObject() const
Return pointer on assigned object.
virtual Int_t DoNDFCalculation()
Calculates number of dimensions of freedom; Should be implemented in inherited classes.
void DoActions(Bool_t AllowFitterChange=kFALSE, TObjArray *Actions=nullptr)
Executes actions list.
Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax) override
Return kTRUE, if range condition specified for parameter and range boundaries.
virtual void FinalizeFitterData()
Finalize fitter data.
TObjArray * ProcessObjects(TObjArray *objs, Bool_t CloneFitter=kTRUE, Bool_t OnlyRequired=kTRUE, TObjArray *rownames=nullptr, TObjArray *colnames=nullptr)
void Clear(Option_t *option="") override
Clear fitter.
void DeleteOutputActions()
Remove and delete all output actions from actions list.
Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon) override
Return kTRUE, if epsilon value specified for parameter.
TObjArray fxActions
Array of actions objects (inherited from TGo4FitterAction).
void Print(Option_t *option="") const override
Print information about fitter to standard output.
void DeleteActions()
Remove and delete all actions from actions list.
Bool_t fbParsChange
Boolean variable, showing that number of parameters is changed.
const TArrayD * GetResults()
Returns pointer on array of result values.
void CheckParsListChanging()
If appropriate flag sets (via SetParsListChange() method), function recollect all parameters from all...
Bool_t GetParFixed(const char *ParName) override
Return kTRUE, if parameter should be fixed.
Bool_t InitializeDependencies(TObjArray &Dependencies, Bool_t BlockPars, Bool_t DoInit)
Initialize a list of dependencies (TGo4FitDependecy object), which used in configuration.
Double_t CalculateFitFunction(Double_t *pars=nullptr)
Calculates value of fit function.
TGo4FitterOutput * AddOutputAction(const char *Action, const char *Option=nullptr)
Creates and add TGo4FitterOutput action with given parameters to actions list.
Bool_t IsSuitableConfig(TGo4FitterConfig *Config)
Checks, if config object corresponds to fitter parameters.
virtual Bool_t Initialize()
Initialize fitter.
Int_t NeedPadsNumber()
Returns required number of TPad for actions output.
void PrintResults() const
Print result values to standard output.
virtual ~TGo4FitterAbstract()
Destroy TGo4FitterAbstract object.
Bool_t ApplyConfig(TGo4FitterConfig *Config)
Set active configuration object.
Int_t GetResultNDF() const
Return result value of number of degree of freedom.
Bool_t fbInitializationDone
Flag showing, that initialization was complete.
Double_t GetResultFF() const
Return result value of fit function.
void SetPad(Int_t indx, TVirtualPad *pad)
Set pad, which will be used for output of TGo4FitterOutput object.
void DeleteAction(TGo4FitterAction *action)
Remove action from actions list and destroy it.
TGo4FitterAction * GetAction(Int_t num)
Returns pointer on action with given index.
void AddAction(TGo4FitterAction *Action)
Add action to action list.
TGo4FitParameter * Get(Int_t n) override
Return pointer on parameter of given index.
Double_t GetResultValue(Int_t n) const
Return value of result with given index.
void CopyParsValuesFrom(TGo4FitterAbstract *fitter)
If provided fitter has a same list of parameters, their values will be copied to fitter.
void AddSimpleMinuit()
Creates and add TGo4FitMinuit object to actions list.
TGo4FitterAbstract()
Default constructor.
virtual void Finalize()
Remove all buffer, created in Initialize() routine.
void FinalizeDependencies(TObjArray &Dependencies)
Relese memory, allocated for dependency executions.
void RunDependenciesList(TObjArray &Dependencies, Double_t *pars)
Execute dependency equations.
Bool_t fbNeedToFinalize
Flag, showing, that finalize method should be called before fitter will be destroyed.
virtual Double_t DoCalculation()
Calculates value of fit function according current values of parameters.
void ExecuteDependencies(Double_t *pars)
Execute dependencies in currently associated configuration (if exist).
void DoAction(TGo4FitterAction *Action)
Executes specified action.
Int_t NumPars() override
Return total number of parameters, which should be fitted.
TArrayD fxResults
Array of result values.
void ReplaceAction(TGo4FitterAction *action, Int_t dir)
Shift action in action list upward (dir=-1) or downward (dir=+1).
Int_t GetNumResults() const
Return number of result values.
Bool_t IsParsAsResults() const
Return kTRUE, if parameters were taken as result values.
virtual void CollectAllPars()
Should collect parameters from all associated to fitter objects.
Int_t GetNumActions() const
Returns number of action in actions list.
virtual Bool_t InitFitterData()
Initialize fitter data.
TGo4FitterConfig * fxCurrentConfig
Pointer on currently activated config object.
void AddActionAt(TGo4FitterAction *Action, Int_t indx)
Add action to action list at specified index.
Basic class for objects, which performs actions on fitter.
virtual Bool_t CanChangeFitter() const
virtual Bool_t NeedBuffers() const
virtual void DoAction(TGo4FitterAbstract *)=0
Fitter configuration action.
TObjArray & GetParsDepend()
Returns list of TGo4FitDependency objects, used for dependencies calculations.
TObjArray & GetParsInit()
Returns list of TGo4FitDependency objects, used for parameters initialization.
TObjArray & GetResults()
Returns list of TGo4FitDependency objects, used for calculating result values for fitter.
Bool_t NeedPad() const
Return kTRUE, if pad required for output.
void SetPad(TVirtualPad *iPad)
Sets pad, which can be used for command output.