16 #include "Riostream.h"
27 TNamed(), fxRatio(0), fxData(0), fxModelMask(0), fxModelBins(0) {
32 fxRatio(0), fxData(0), fxModelMask(0), fxModelBins(0) {
47 std::cout <<
" " << GetName();
53 fiMinIntegrDepth(0), fiMaxIntegrDepth(0), fdIntegrEps(0.), fbAbsoluteEps(kFALSE), fbIntegrScaling(kFALSE),
54 fxAssigments(), fiGroupIndex(-1),
55 fxCurrentPars(), fxCurrentParsArray(0),
56 fbNeedToRebuild(kFALSE), fxAllPars(0), fxAllParsValues(0) {
61 fiMinIntegrDepth(0), fiMaxIntegrDepth(0), fdIntegrEps(0.), fbAbsoluteEps(kFALSE), fbIntegrScaling(kFALSE),
62 fxAssigments(), fiGroupIndex(-1),
63 fxCurrentPars(), fxCurrentParsArray(0),
64 fbNeedToRebuild(kFALSE), fxAllPars(0), fxAllParsValues(0) {
91 "Amplitude ratio to first data",
102 if (ass) ass->SetName(newname);
132 if ( ass != 0 ) ass->
fxData = data;
137 if(ass)
return ass->
fxData;
145 }
else return kFALSE;
152 }
else return kFALSE;
159 }
else return kFALSE;
166 }
else return kFALSE;
185 Bool_t use = ((UseBuffers<0) && GetUseBuffers()) || (UseBuffers>0);
189 std::cout <<
"Data " << ass->GetName() <<
" not assigned to model " << GetName() << std::endl;
241 if ((NumScales<1) || (Scales==0))
return 0.;
244 TArrayI IntegrIndexes(NumScales);
245 TArrayD ScaleValues(NumScales, Scales);
246 TArrayD WidthValues(NumScales, Widths);
247 TArrayD dScaleValues(NumScales);
249 Int_t* dindx = IntegrIndexes.GetArray();
250 Double_t* vector = ScaleValues.GetArray();
251 Double_t* width = WidthValues.GetArray();
252 Double_t* dvector = dScaleValues.GetArray();
257 for(n=0;n<NumScales;n++)
258 vector[n] -= 0.5*width[n];
261 Double_t TotalSum =
EvalN(vector);
262 Int_t TotalNumPnt = 1;
264 Int_t IntegrDepth = 0;
267 Bool_t stopcondition = kFALSE;
272 IntegrIndexes.Reset(0);
278 for(n=0;n<NumScales;n++)
279 dvector[n] = vector[n]+Step*width[n]*(dindx[n]+0.5);
287 if (dindx[n]<NumStep)
break;
289 }
while (n<NumScales);
290 }
while (n<NumScales);
293 stopcondition = kFALSE;
296 Double_t v1 = TotalSum/TotalNumPnt;
297 Double_t v2 = Sum/NumPnt;
298 Double_t v = TMath::Abs(v1-v2);
300 if ((v1!=0) || (v2!=0)) v=v/(TMath::Abs(v1)+TMath::Abs(v2));
311 }
while (!stopcondition);
314 if (TotalNumPnt>0) value = TotalSum / TotalNumPnt;
316 for(n=0;n<NumScales;n++) value*=width[n];
318 }
else return EvalN(Scales);
322 if (data==0)
return 0.;
330 if (iter==0)
return 0;
331 const Double_t* scales = iter->
Scales();
365 for(Int_t nbin=0;nbin<size;nbin++) {
366 if ((mask!=0) && (mask[nbin]==0))
continue;
384 if (result==0)
return kFALSE;
390 for (Int_t nbin=0;nbin<size;nbin++)
391 result[nbin] += ampl * modelbins[nbin];
399 for(Int_t nbin=0;nbin<size;nbin++)
431 Double_t vector[2] = {x,y};
441 Double_t vector[3] = {x,y,z};
479 res.Form(
"Ratio%d",n);
490 std::cout <<
" Assigned to: ";
492 std::cout << std::endl;
495 if (
fbAbsoluteEps) std::cout <<
" absolute";
else std::cout <<
" relative";
496 std::cout <<
" error " <<
fdIntegrEps << std::endl;
500 void TGo4FitModel::Streamer(TBuffer& b) {
503 TGo4FitModel::Class()->ReadBuffer(b,
this);
510 TGo4FitModel::Class()->WriteBuffer(b,
this);
TString GetRatioName(Int_t n)
Bool_t IsAnyRangeLimits()
Int_t GetDataIndexesSize(TGo4FitData *data)
virtual Double_t Evaluate(Double_t x)
virtual void Print(Option_t *option) const
Double_t * fxCurrentParsArray
Bool_t CheckRangeConditions(const Double_t *values, Int_t numaxis)
const Int_t * GetFullIndex(Int_t nbin)
virtual ~TGo4FitAssignment()
TGo4FitAssignment * FindAssigment(const char *DataName) const
TGo4FitParameter * GetPar(Int_t n)
virtual TGo4FitParameter * GetWidthPar(Int_t naxis=0)
void AssignToData(const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Double_t * GetModelBins(const char *DataName) const
virtual Bool_t SetPosition(Int_t naxis, Double_t pos)
virtual Double_t Integral()
void ClearAssignmentTo(const char *DataName)
TGo4FitParameter * NewAmplitude(const char *Name=0, Double_t iValue=0., Bool_t IsFixed=kFALSE, Int_t AtIndx=0)
void SetOwner(TNamed *iOwner)
virtual Double_t EvaluateAtPoint(TGo4FitData *data, Int_t nbin, Bool_t UseRanges=kTRUE)
const Double_t * Widths() const
virtual Bool_t GetPosition(Int_t naxis, Double_t &pos)
Double_t * GetBinsResult()
virtual TGo4FitParameter * Get(Int_t n)
void ChangeDataNameInAssignments(const char *oldname, const char *newname)
Bool_t BuffersAllocated() const
TGo4FitData * GetAssignedConnection(Int_t n)
virtual Double_t UserFunction(Double_t *, Double_t *)
const Double_t * GetScaleValues(const Int_t nbin)
virtual void Print(Option_t *option) const
virtual Bool_t Initialize(Int_t UseBuffers=-1)
TGo4FitAssignment * GetAssigment(Int_t n)
Int_t GetBinsSize() const
virtual Bool_t BeforeEval(Int_t ndim)
TGo4FitParameter * fxRatio
void ConnectToDataIfAssigned(TGo4FitData *data)
virtual Bool_t SetWidth(Int_t naxis, Double_t width)
void SetIntegrationsProperty(Int_t iMinIntegrDepth, Int_t iMaxIntegrDepth=0, Double_t iIntegrEps=0., Bool_t iAbsoluteEps=kFALSE, Bool_t iIntegrScaling=kFALSE)
virtual Bool_t GetWidth(Int_t naxis, Double_t &width)
TGo4FitParsList * fxAllPars
Int_t NumAssigments() const
virtual void Print(Option_t *option) const
Double_t EvaluateAndIntegrate(Int_t NumScales, const Double_t *Scales, const Double_t *Widths)
virtual void CollectParsTo(TGo4FitParsList &list)
void SetValue(Double_t iValue)
virtual TGo4FitParameter * GetPosPar(Int_t naxis=0)
Double_t GetValue() const
Bool_t BuffersAllocated() const
const Double_t * Scales() const
Int_t GetScalesSize() const
void RebuildShape(Bool_t ForceBuild=kFALSE)
virtual TGo4FitParameter * Get(Int_t n)
void SetFixed(Bool_t iFixed)
Bool_t AddModelToDataResult(TGo4FitData *data)
void GetParsValues(Double_t *pars)
TArrayD * fxAllParsValues
Double_t GetRatioValueFor(const char *DataName)
void ApplyRangesForModelMask(TGo4FitComponent *model, Char_t *ModelMask)
Int_t GetIndexesSize() const
const Int_t * GetDataFullIndex(TGo4FitData *data, Int_t nbin)
virtual Double_t EvalN(const Double_t *v)
const Double_t * GetWidthValues(const Int_t nbin)
TGo4FitParameter * GetAmplPar()