49 std::cout <<
" " << GetName();
112 ass->SetName(newname);
155 return ass ? ass->
fxData :
nullptr;
195 Bool_t iAbsoluteEps, Bool_t iIntegrScaling)
220 Bool_t use = ((UseBuffers < 0) &&
GetUseBuffers()) || (UseBuffers > 0);
224 std::cout <<
"Data " << ass->GetName() <<
" not assigned to model " << GetName() << std::endl;
286 if ((NumScales < 1) || !Scales)
290 TArrayI IntegrIndexes(NumScales);
291 TArrayD ScaleValues(NumScales, Scales);
292 TArrayD WidthValues(NumScales, Widths);
293 TArrayD dScaleValues(NumScales);
295 Int_t *dindx = IntegrIndexes.GetArray();
296 Double_t *vector = ScaleValues.GetArray();
297 Double_t *width = WidthValues.GetArray();
298 Double_t *dvector = dScaleValues.GetArray();
303 for (n = 0; n < NumScales; n++)
304 vector[n] -= 0.5 * width[n];
307 Double_t TotalSum =
EvalN(vector);
308 Int_t TotalNumPnt = 1;
310 Int_t IntegrDepth = 0;
313 Bool_t stopcondition = kFALSE;
318 IntegrIndexes.Reset(0);
324 for (n = 0; n < NumScales; n++)
325 dvector[n] = vector[n] + Step * width[n] * (dindx[n] + 0.5);
327 Sum +=
EvalN(dvector);
333 if (dindx[n] < NumStep)
337 }
while (n < NumScales);
338 }
while (n < NumScales);
341 stopcondition = kFALSE;
344 stopcondition = kTRUE;
346 Double_t v1 = TotalSum / TotalNumPnt;
347 Double_t v2 = Sum / NumPnt;
348 Double_t v = TMath::Abs(v1 - v2);
350 if ((v1 != 0.) || (v2 != 0.))
351 v = v / (TMath::Abs(v1) + TMath::Abs(v2));
356 stopcondition = kTRUE;
360 TotalNumPnt += NumPnt;
364 }
while (!stopcondition);
368 value = TotalSum / TotalNumPnt;
370 for (n = 0; n < NumScales; n++)
374 return EvalN(Scales);
392 const Double_t *scales = iter->Scales();
393 Int_t scalessize = iter->ScalesSize();
406 for (Int_t n = 0; n <
fxAllPars->NumPars(); n++) {
432 for (Int_t nbin = 0; nbin < size; nbin++) {
433 if (mask && (mask[nbin] == 0))
441 for (Int_t n = 0; n <
fxAllPars->NumPars(); n++)
460 for (Int_t nbin = 0; nbin < size; nbin++)
461 result[nbin] += ampl * modelbins[nbin];
470 for (Int_t nbin = 0; nbin < size; nbin++)
507 Double_t vector[2] = {x, y};
518 Double_t vector[3] = {x, y, z};
561 res.Form(
"Ratio%d", n);
574 std::cout <<
" Assigned to: ";
576 std::cout << std::endl;
580 std::cout <<
" absolute";
582 std::cout <<
" relative";
583 std::cout <<
" error " <<
fdIntegrEps << std::endl;
587void TGo4FitModel::Streamer(TBuffer &b)
590 TGo4FitModel::Class()->ReadBuffer(b,
this);
595 TGo4FitModel::Class()->WriteBuffer(b,
this);
Internal class, used for assignment of model component to data.
virtual ~TGo4FitAssignment()
Destroys TGo4FitAssignment object.
TGo4FitData * fxData
Pointer on assigned data.
TGo4FitAssignment()
Default constructor.
TGo4FitParameter * fxRatio
Parameter for ratio value.
Char_t * fxModelMask
Array of boolean values, selected model bins.
Double_t * fxModelBins
Array of model bins for assigned data.
void Print(Option_t *option="") const override
Print information about object on standard output.
TGo4FitParameter * GetAmplPar()
Return amplitude parameter object.
Bool_t CheckRangeConditions(const Double_t *values, Int_t numaxis)
Check all range conditions for specified point.
Bool_t GetUseBuffers() const
Returns flag of usage of additional buffers.
void CollectParsTo(TGo4FitParsList &list) override
Collect all parameters to provided parameters list object.
Int_t GetAmplIndex() const
Returns index of amplitude parameter.
TGo4FitParameter * NewAmplitude(const char *Name=nullptr, Double_t iValue=0., Bool_t IsFixed=kFALSE, Int_t AtIndx=0)
Create amplitude parameter with specified properties.
TGo4FitComponent()
Default constructor.
Bool_t IsAnyRangeLimits() const
Return kTRUE, if any range conditions were introduced.
Double_t GetAmplValue()
Return value of amplitude parameter.
void Print(Option_t *option="") const override
Print info about object on standard output.
Basic abstract class for representing data, which should be fitted.
const Double_t * GetWidthValues(Int_t nbin) const
Return scales width values for specified index from buffer.
const Double_t * GetScaleValues(Int_t nbin) const
Return scale values for specified index from buffer.
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.
Int_t GetIndexesSize() const
Returns dimension of indexes arrays.
const Int_t * GetFullIndex(Int_t nbin) const
Return indexes values for specified data bin from buffer.
Int_t GetScalesSize() const
Returns number of axis values for each point.
void ApplyRangesForModelMask(TGo4FitComponent *model, Char_t *ModelMask)
Exclude points from model according model range conditions.
void ClearAssignments()
Remove all assignments.
Bool_t fbAbsoluteEps
States, if integration precision absolute or relative.
TArrayD fxCurrentPars
Array of values of parameters.
Double_t * GetModelBins(const char *DataName) const
Get model bins for specified data (if exists)
void SetNeedToRebuild()
Sets flag, that shape bins should be refilled next time, when RebuildShape() routine will be called.
Double_t * fxCurrentParsArray
Pointer on array of parameters values.
virtual Double_t EvalN(const Double_t *v)
Calculates value of model according current parameters values and provided axes values.
Bool_t AddModelToDataResult(TGo4FitData *data)
Evaluate model values for all data point and add them to result buffer.
Double_t fdIntegrEps
Integration precision.
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 SetPosition(Int_t naxis, Double_t pos)
Sets position of model component, if possible.
virtual Bool_t Initialize(Int_t UseBuffers=-1)
Initialize model object.
void Print(Option_t *option="") const override
Print information about model object on standard output.
virtual Double_t UserFunction(Double_t *, Double_t *)
Another place, where user specific code can be placed for model values calculation.
TGo4FitAssignment * FindAssigment(const char *DataName) const
Find assignment to given data.
TString GetRatioName(Int_t n)
Set name of ratio parameter.
virtual TGo4FitParameter * GetWidthPar(Int_t naxis=0)
Return parameter (if exist), which represent width of model component for given axis.
void RemoveAllPars()
Clear all buffers, allocated during initialization.
virtual Bool_t BeforeEval(Int_t ndim)
Prepares (if necessary) some intermediate variables to be able calculate values of model via EvalN() ...
virtual ~TGo4FitModel()
Delete TGo4FitModel object.
Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t *Scales, const Double_t *Widths)
Make integration of model inside given point, if integration specified.
Int_t fiGroupIndex
Store group index of specified model.
Int_t NumPars() override
Return number of parameters in list.
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.
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.
Bool_t fbNeedToRebuild
Internal flag.
TGo4FitParsList * fxAllPars
List of all parameters, associated not only with component directly but also with encapsulated object...
Int_t fiMaxIntegrDepth
Maximum integration depth.
Bool_t fbIntegrScaling
Scale integral to integration volume.
Int_t GetDataIndexesSize(TGo4FitData *data)
void RebuildShape(Bool_t ForceBuild=kFALSE)
Recalculates shape of object.
virtual Double_t Integral()
Calculates integral of model component.
virtual Double_t Evaluate(Double_t x)
Calculates value of model for given x value.
TGo4FitParameter * Get(Int_t n) override
void AssignToData(const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Assign model to specified data object.
const Int_t * GetDataFullIndex(TGo4FitData *data, Int_t nbin)
TGo4FitModel()
Default constructor.
virtual void AfterEval()
Clear buffers, which were created by BeforeEval() method.
TGo4FitAssignment * GetAssigment(Int_t n)
Return TGo4FitAssignment object with given index.
virtual TGo4FitParameter * GetPosPar(Int_t naxis=0)
Return parameter (if exist), which represent position of model for given axis.
void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth=0, Double_t iIntegrEps=0., Bool_t iAbsoluteEps=kFALSE, Bool_t iIntegrScaling=kFALSE)
Set integration properties.
TObjArray fxAssigments
List of TGo4FitAssignment objects.
TGo4FitData * GetAssignedConnection(Int_t n)
Return pointer on assigned data.
Int_t fiMinIntegrDepth
Minimum depth of integration.
TArrayD * fxAllParsValues
Double_t GetRatioValueFor(const char *DataName)
Returns ratio value for specified data object.
virtual Bool_t SetWidth(Int_t naxis, Double_t width)
Sets width of model component, if possible.
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.
Model and data objects parameter.
Double_t GetValue() const
Return parameter value.
void SetValue(Double_t iValue)
Set parameter value.
void SetFixed(Bool_t iFixed)
Set status of parameter fixed or not.
void GetParsValues(Double_t *pars)
Copy values of all parameters in list to provided array.
virtual TGo4FitParameter * Get(Int_t n)
TGo4FitParsList()
Default constructor.
virtual Int_t NumPars()
Return number of parameters in list.