GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitDataGraph.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitDataGraph.cxx 3490 2022-01-21 14:19:46Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4FitDataGraph.h"
15 
16 #include <iostream>
17 #include "TGraph.h"
18 
20  TGo4FitData(),
21  fxGraph(this, TGraph::Class())
22 {
23 }
24 
25 TGo4FitDataGraph::TGo4FitDataGraph(const char* iName, TGraph *iGraph, Bool_t iGraphOwned, Bool_t AddAmpl) :
26  TGo4FitData(iName,"TGraph and derived classes", dtGraph, AddAmpl),
27  fxGraph("Graph","Data object of TGraph class", this, TGraph::Class(), kTRUE, iGraph, iGraphOwned)
28 {
29  SetExcludeLessThen(-1e50);
30 }
31 
33 }
34 
36 {
37  return new TGo4FitDataGraphIter(this);
38 }
39 
40 void TGo4FitDataGraph::SetGraph(TGraph *iGraph, Bool_t iGraphOwned)
41 {
43  fxGraph.SetObject(iGraph,iGraphOwned);
44 }
45 
46 void TGo4FitDataGraph::FillSlotList(TSeqCollection* list)
47 {
49  list->Add(&fxGraph);
50 }
51 
52 void TGo4FitDataGraph::Print(Option_t* option) const
53 {
54  TGo4FitData::Print(option);
55  std::cout << " ";
56  fxGraph.Print(option);
57 }
58 
59 // *********************************************************************************
60 
63  fxData(0),
64  fiNumPoints(0)
65 {
66 }
67 
70  fxData(Data),
71  fiNumPoints(0)
72 {
73 }
74 
76 {
77 }
78 
80 {
81  if ((fxData==0) || (fxData->GetGraph()==0)) return kFALSE;
82 
83  fiNumPoints = fxData->GetGraph()->GetN();
84 
85  return ReserveArrays(1, 1, kFALSE);
86 }
87 
89 {
90  if (fxData==0) return kFALSE;
91  TGraph* gr = fxData->GetGraph();
92  if (gr==0) return kFALSE;
93 
94  Double_t* xx = gr->GetX();
95  Double_t* yy = gr->GetY();
96  if ((xx==0) || (yy==0)) return kFALSE;
97 
98  Double_t xvalue = xx[fxIndexes[0]];
99  fdValue = yy[fxIndexes[0]];
100 
101  if (!GetDeviation()) {
102  Double_t zn = gr->GetErrorY(fxIndexes[0]);
103  if (zn>0) fdStandardDeviation = zn*zn;
104  else fdStandardDeviation = 1.;
105  }
106 
107  return ProduceScales(fxIndexes.GetArray(), &xvalue, 0);
108 }
109 
111 {
112  fxIndexes[0]+=1;
113  return (fxIndexes[0]<fiNumPoints);
114 }
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
TArrayI fxIndexes
Definition: TGo4FitData.h:617
Double_t fdStandardDeviation
Definition: TGo4FitData.h:622
TGo4FitSlot fxGraph
virtual void Print(Option_t *option) const
virtual ~TGo4FitDataGraph()
Double_t fdValue
Definition: TGo4FitData.h:621
void SetExcludeLessThen(Double_t limit=0.)
Definition: TGo4FitData.h:107
virtual Bool_t StartReset()
virtual Bool_t ReadCurrentPoint()
void SetGraph(TGraph *iGraph, Bool_t iGraphOwned=kFALSE)
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
TGo4FitDataIter * MakeIter()
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
virtual void FillSlotList(TSeqCollection *list)
TGo4FitDataGraph * fxData
Bool_t GetDeviation()
virtual void FillSlotList(TSeqCollection *list)
void ClearObject()
virtual void Print(Option_t *option) const
virtual Bool_t ShiftToNextPoint()
virtual void Print(Option_t *option) const