16 #include "Riostream.h"
20 #include "TObjArray.h"
33 fiDataType(0), fbUseBinScale(kFALSE), fiTakeSigmasFrom(1), fdSigmaValue(1.), fdExcludeLessThen(0.),
40 fbUseBinScale(kFALSE), fiTakeSigmasFrom(1), fdSigmaValue(1.), fdExcludeLessThen(0.),
57 if ( (nslots<0) || (nslots == oldnum) )
return kFALSE;
60 for(Int_t n=oldnum;n<nslots;n++) {
61 TString name(
"Trans");
63 fxAxisTrans.Add(
new TGo4FitSlot(name.Data(),
"Axis transformation",
this, TGo4FitAxisTrans::Class(), kFALSE));
66 for (Int_t n=oldnum;n>nslots;n--) {
117 if (iter==0)
return 0;
126 if (iter==0)
return kFALSE;
133 Bool_t use = ((UseBuffers<0) && GetUseBuffers()) || (UseBuffers>0);
155 if (iter->
Reset())
do {
173 }
while (iter->
Next());
218 if (iter==0)
return kFALSE;
221 min = iter->
Scales()[naxis]; max = min;
223 Double_t value = iter->
Scales()[naxis];
224 if (value<min) min = value;
else
225 if (value>max) max = value;
226 }
while (iter->
Next(kFALSE));
236 if (iter==0)
return 0;
246 if (iter==0)
return 0;
274 if (data==0)
return kFALSE;
276 if (iter==0)
return kFALSE;
288 if (ModelMask==0)
return;
296 ModelMask[nbin] = res ? 1 : 0;
301 if (iter->
Reset())
do {
303 ModelMask[nbin] = res ? 1 : 0;
305 }
while (iter->
Next());
319 std::cout <<
" Data type: ";
321 case 1: std::cout <<
"histogram" << std::endl;
break;
322 case 2: std::cout <<
"graph" << std::endl;
break;
323 default: std::cout <<
fiDataType << std::endl;
325 std::cout <<
" Use bin scale: " <<
fbUseBinScale << std::endl;
326 std::cout <<
" Take sigmas from: " ;
328 case 0: std::cout <<
"none" << std::endl;
break;
329 case 1: std::cout <<
"data" << std::endl;
break;
330 case 2: std::cout <<
"const value " <<
GetSigmaValue() << std::endl;
break;
333 std::cout <<
" Axis transformation data: " << std::endl;
337 void TGo4FitData::Streamer(TBuffer& b)
341 TGo4FitData::Class()->ReadBuffer(b,
this);
349 TGo4FitData::Class()->WriteBuffer(b,
this);
357 fxIndexes(), fxScales(), fxWidths(), fdValue(0.), fdStandardDeviation(1.), fiNumPoint(0), fbReachEnd(kTRUE) {
365 if (data==0)
return kFALSE;
371 else size = NumOwnAxis;
373 if (size<=0)
return kFALSE;
394 if (data==0)
return kFALSE;
397 if (index==0)
return kFALSE;
399 for(Int_t n=0;n<
fxScales.GetSize();n++)
403 for(Int_t n=0; n<
fxScales.GetSize();n++)
406 for(Int_t n=0; n<
fxWidths.GetSize();n++)
420 fxWidths[n] = TMath::Abs(arr2[n]-arr1[n]);
431 while (n<Index.GetSize()) {
433 if (Index[n]<Limits[n])
return kTRUE;
441 if (data==0)
return kFALSE;
445 }
else return kFALSE;
450 if (data==0)
return kFALSE;
463 if (!UseRanges) {
fbReachEnd = kFALSE;
return kTRUE; }
484 if (!UseRanges)
return kTRUE;
495 for(
int n=0;n<
fxWidths.GetSize();n++)
501 if (!
Reset(UseRanges))
return 0;
505 }
while (
Next(UseRanges)) ;
510 if (!
Reset(kFALSE))
return kFALSE;
516 }
while(
Next(kFALSE));
526 if (NumDim>3) NumDim=3;
531 case 1: histo =
new TH1D(HistoName,
"result", Limits[0]+1, dummy);
break;
532 case 2: histo =
new TH2D(HistoName,
"result", Limits[0]+1, dummy, Limits[1]+1, dummy);
break;
533 case 3: histo =
new TH3D(HistoName,
"result", Limits[0]+1, dummy, Limits[1]+1, dummy, Limits[2]+1, dummy);
break;
537 histo->SetDirectory(0);
540 for (Int_t n=0;n<NumDim;n++)
541 Axises[n] =
new Double_t[Limits[n]+2];
545 if (
Reset(UseRanges))
do {
548 case 1: histo->SetBinContent(
Indexes()[0]+1, ampl*
Value());
break;
552 for(Int_t n=0;n<NumDim;n++) {
557 }
while(
Next(UseRanges));
559 histo->GetXaxis()->Set(Limits[0]+1,Axises[0]);
560 if (NumDim>1) histo->GetYaxis()->Set(Limits[1]+1,Axises[1]);
561 if (NumDim>2) histo->GetZaxis()->Set(Limits[2]+1,Axises[2]);
563 for (Int_t n=0;n<NumDim;n++)
571 if ((NumPoints<=0) || (
ScalesSize()<1))
return 0;
573 TGraph* gr =
new TGraph(NumPoints);
574 gr->SetName(GraphName);
575 if (
Reset(UseRanges))
do {
576 (gr->GetX())[
Point()] =
x();
579 }
while(
Next(UseRanges));
585 if (!
Reset(kFALSE))
return 0;
Bool_t DefineScaleMinMax(Int_t naxis, Double_t &min, Double_t &max)
TH1 * CreateHistogram(const char *HistoName, Bool_t UseRanges=kFALSE, Bool_t SetBins=kFALSE)
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
Double_t fdStandardDeviation
virtual void Print(Option_t *option) const
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
virtual Bool_t IsAnyDataTransform()
Bool_t CheckRangeConditions(const Double_t *values, Int_t numaxis)
virtual void Print(Option_t *option) const
Bool_t SetNumberOfTransSlots(Int_t nslots)
const Int_t * GetFullIndex(Int_t nbin)
virtual TGo4FitDataIter * MakeIter()
TObject * CreateDrawObject(const char *ObjName)
void ReleaseAllPointers()
Bool_t DefineIndexesLimits(TArrayI &Limits)
Int_t GetSigmaSource() const
const Int_t GetDataType()
void TransformScales(Double_t *scales)
TGraph * CreateGraph(const char *GraphName, Bool_t UseRanges=kFALSE, Bool_t SetBins=kFALSE)
Bool_t NextIndex(TArrayI &Index, TArrayI &Limits)
Int_t GetNumberOfTransSlots()
TGo4FitSlot * GetAxisTransSlot(Int_t nslot)
virtual Bool_t Initialize(Int_t UseBuffers=-1)
Double_t GetSigmaValue() const
TGo4FitParameter * NewAmplitude(const char *Name=0, Double_t iValue=0., Bool_t IsFixed=kFALSE, Int_t AtIndx=0)
virtual Bool_t Reset(Bool_t UseRanges=kTRUE)
const Double_t * Widths() const
Bool_t IsCompatibleData(TGo4FitData *data)
virtual ~TGo4FitDataIter()
virtual Bool_t StartReset()=0
Bool_t BuffersAllocated() const
const Double_t * GetScaleValues(const Int_t nbin)
Int_t CountPoints(Bool_t UseRanges=kTRUE)
Int_t GetBinsSize() const
virtual Bool_t Next(Bool_t UseRanges=kTRUE)
virtual TGo4FitData * GetData() const =0
TObject * CreateDrawObject(const char *ObjName)
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
virtual void FillSlotList(TSeqCollection *lst)
virtual void FillSlotList(TSeqCollection *list)
TGo4FitAxisTrans * GetAxisTrans(Int_t nslot)
void SetAxisTrans(Int_t nslot, TGo4FitAxisTrans *Trans, Bool_t TransOwned=kFALSE)
Bool_t HasIndexes() const
void SetDefaults(TNamed *iOwner, TClass *iClass)
const Int_t * Indexes() const
const Double_t * Scales() const
void AddAxisTrans(TGo4FitAxisTrans *Trans, Bool_t TransOwned=kFALSE)
virtual Bool_t ShiftToNextPoint()=0
Int_t GetScalesSize() const
virtual void Transformation(Double_t *scales, Int_t naxis)=0
virtual Bool_t ReadCurrentPoint()=0
Double_t GetExcludeLessThen() const
TObject * GetObject() const
Int_t IndexesSize() const
Double_t StandardDeviation() const
Bool_t CheckPointForRange()
void ApplyRangesForModelMask(TGo4FitComponent *model, Char_t *ModelMask)
Int_t GetIndexesSize() const
const Double_t * GetWidthValues(const Int_t nbin)
void SetAxisTransNeeded(Int_t nslot, Bool_t iNeeded=kFALSE)