16 #include "Riostream.h"
24 #include "TObjString.h"
25 #include "TVirtualPad.h"
37 fxActions(), fxResults(),
38 fxCurrentConfig(0), fbParsChange(kTRUE),
39 fbInitializationDone(kFALSE), fbNeedToFinalize(kFALSE), fbParsAsResults(kFALSE)
45 fxActions(), fxResults(),
46 fxCurrentConfig(0), fbParsChange(kTRUE),
47 fbInitializationDone(kFALSE), fbNeedToFinalize(kFALSE), fbParsAsResults(kFALSE)
59 TGo4FitParsList::Clear(option);
73 if (fitter==0)
return;
77 for(Int_t n=0;n<
NumPars();n++) {
113 for(Int_t i=0;i<=Dependencies.GetLast();i++) {
120 if (deppar==0) { std::cout <<
"Error dependence parameter: " << dep->
GetParameter().Data() << std::endl;
return kFALSE; }
126 for(Int_t n=0;n<
NumPars();n++) {
127 if (n == parindx)
continue;
133 TFormula* fx =
new TFormula(
"test",formula.Data());
134 Int_t err = fx->Compile(formula.Data());
137 std::cout <<
"Error in dependence: " << formula.Data() <<
" code " << err << std::endl;
140 if (DoInit) dep->
Initialize(parindx, formula.Data());
142 }
else if (DoInit) dep->
Initialize(parindx,0);
151 for(Int_t i=0;i<=Dependencies.GetLast();i++)
157 for(Int_t i=0;i<=Dependencies.GetLast();i++) {
171 if (Config==0)
return kFALSE;
301 if ((num<0) || (num>
fxActions.GetLast()))
return 0;
307 if (action==0)
return;
318 if ((action==0) || (indx<0))
return;
319 Int_t newindx = indx+dir;
320 if ((newindx>=0) && (newindx<=
fxActions.GetLast()) && (newindx!=indx)) {
330 Bool_t need = kFALSE;
331 for(Int_t n=0;n<=Actions->GetLast();n++) {
340 for(Int_t n=0;n<=Actions->GetLast();n++) {
342 if (action==0)
continue;
354 if (Action==0)
return;
373 if ((objs==0) || (objs->GetLast()<0))
return 0;
377 TArrayI use(
NumSlots()); use.Reset(-1);
382 if (slot==0)
return 0;
384 if (slot->
IsRequired() || !OnlyRequired) use[numuse++] = n;
387 if ((numuse==0) || ((objs->GetLast()+1) % numuse != 0))
return 0;
390 for (Int_t nobj=0;nobj<=objs->GetLast();nobj++) {
391 TObject* obj = objs->At(nobj);
393 std::cout <<
"Empty object in list" << std::endl;
397 if (nuse==numuse) nuse=0;
399 std::cout <<
"Object " << obj->GetName() <<
" of class " << obj->ClassName() <<
400 " noncompatible with " << slot->
GetClass()->GetName() << std::endl;
405 TObjArray* res =
new TObjArray((objs->GetLast()+1) / numuse);
406 res->SetOwner(kTRUE);
409 if (rownames!=0) { rownames->
Clear(); rownames->SetOwner(kTRUE); }
410 if (colnames!=0) { colnames->Clear(); colnames->SetOwner(kTRUE); }
418 if (newfitter==0)
break;
427 if (nuse==1) newfitter->SetName(objs->At(nobj)->GetName());
428 if ((nuse==1) && (colnames!=0)) colnames->Add(
new TObjString(objs->At(nobj)->GetName()));
436 }
while (nobj<=objs->GetLast());
451 if ((nuse==1) && (colnames!=0)) colnames->Add(
new TObjString(objs->At(nobj)->GetName()));
461 }
while (nobj<=objs->GetLast());
468 if ((rownames!=0) && (resf!=0)){
473 TString rname(
"Result");
475 rownames->Add(
new TObjString(rname));
503 for(Int_t n=0;n<=
fxActions.GetLast();n++) {
505 if (action) {
fxActions.Remove(action);
delete action; }
515 if (act && act->
NeedPad()) res++;
526 if (i==indx) { act->
SetPad(pad);
return; }
552 std::cout << std::endl <<
"*** LIST OF RESULT VALUE ***" << std::endl;
553 std::cout <<
" Fit function = " <<
GetResultFF() << std::endl;
556 std::cout <<
" Res " << n <<
" = " <<
GetResultValue(n) << std::endl;
561 std::cout << std::endl <<
"********** THIS IS PRINTOUT OF FITTER OBJECT **********" << std::endl;
565 std::cout <<
"Actions list: " << std::endl;
570 void TGo4FitterAbstract::Streamer(TBuffer& b)
573 TGo4FitterAbstract::Class()->ReadBuffer(b,
this);
576 TGo4FitterAbstract::Class()->WriteBuffer(b,
this);
const TString & GetParameter()
virtual Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon)
virtual void FinalizeFitterData()
virtual void Clear(Option_t *option="")
void DoAction(TGo4FitterAction *Action)
TGo4FitSlot * GetSlot(Int_t nslot)
Int_t GetResultNDF() const
void DeleteAction(TGo4FitterAction *action)
virtual Double_t DoCalculation()
virtual ~TGo4FitterAbstract()
virtual Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon)
void AddCommand(const char *iCommand)
virtual void MemorizePars()
void AddAction(TGo4FitterAction *Action)
virtual Bool_t GetParEpsilon(const char *ParName, Double_t &Epsilon)
virtual void Print(Option_t *option) const
virtual Bool_t CanChangeFitter() const
const TArrayD * GetResults()
virtual Bool_t InitFitterData()
const char * GetFullName()
void Initialize(Int_t iNumPar, const char *iFormula)
virtual void DoAction(TGo4FitterAbstract *Fitter)=0
void ReplaceAction(TGo4FitterAction *action, Int_t dir)
void CopyParsValuesFrom(TGo4FitterAbstract *fitter)
virtual Bool_t GetParFixed(const char *ParName)
Int_t GetNumResults() const
void RunDependenciesList(TObjArray &Dependencies, Double_t *pars)
void FinalizeDependencies(TObjArray &Dependencies)
void PrepareSlotsForWriting()
TGo4FitterOutput * AddOutputAction(const char *Action, const char *Option=0)
virtual void Print(Option_t *option) const
Bool_t IsRequired() const
TObjArray & GetParsDepend()
virtual void CollectAllPars()
virtual Bool_t GetParFixed(const char *ParName)
void DoActions(Bool_t AllowFitterChange=kFALSE, TObjArray *Actions=0)
void SetPad(TVirtualPad *iPad)
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
void Print(Option_t *option) const
const char * GetParFullName(Int_t n)
TObjArray * ProcessObjects(TObjArray *objs, Bool_t CloneFitter=kTRUE, Bool_t OnlyRequired=kTRUE, TObjArray *rownames=0, TObjArray *colnames=0)
TGo4FitterConfig * fxCurrentConfig
void PrintResults() const
TGo4FitParameter * FindPar(const char *ParName)
virtual Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax)
virtual TGo4FitParameter * Get(Int_t n)
TGo4FitParameter * Find(const char *ParName)
Bool_t InitializeDependencies(TObjArray &Dependencies, Bool_t BlockPars, Bool_t DoInit)
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Double_t GetResultFF() const
Int_t GetParIndex(const TGo4FitParameter *par)
Double_t CalculateFitFunction(Double_t *pars=0)
virtual Bool_t GetParFixed(const char *ParName)
void SetValue(Double_t iValue)
Double_t GetResultValue(Int_t n) const
Double_t GetValue() const
virtual void RememberPars()
virtual Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax)
void CheckParsListChanging()
TGo4FitterAction * GetAction(Int_t num)
Bool_t fbInitializationDone
void DeleteOutputActions()
virtual Bool_t Initialize()
Bool_t IsSuitable(TObject *obj)
TGo4FitParsList & GetParsNew()
void SetPad(Int_t indx, TVirtualPad *pad)
const TString & GetExpression()
TObject * GetObject() const
void AddActionAt(TGo4FitterAction *Action, Int_t indx)
Double_t ExecuteDependency(Double_t *Params)
Bool_t IsSuitableConfig(TGo4FitterConfig *Config)
void GetParsValues(Double_t *pars)
Bool_t ApplyConfig(TGo4FitterConfig *Config)
virtual Int_t DoNDFCalculation()
virtual void CollectParsTo(TGo4FitParsList &list)
virtual Bool_t NeedBuffers() const
virtual Bool_t GetParRange(const char *ParName, Double_t &RangeMin, Double_t &RangeMax)
TObjArray & GetParsInit()
void ExecuteDependencies(Double_t *pars)
void SetParsValues(Double_t *pars)