GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitDataGraph.cxx
Go to the documentation of this file.
1 // $Id: TGo4FitDataGraph.cxx 992 2013-07-08 09:09:31Z 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 für 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 "Riostream.h"
17 #include "TGraph.h"
18 #include "TGraphErrors.h"
19 #include "TGraphAsymmErrors.h"
20 #include "TArrayD.h"
21 
23  TGo4FitData(),
24  fxGraph(this, TGraph::Class())
25 {
26 }
27 
28 TGo4FitDataGraph::TGo4FitDataGraph(const char* iName, TGraph *iGraph, Bool_t iGraphOwned, Bool_t AddAmpl) :
29  TGo4FitData(iName,"TGraph and derived classes", dtGraph, AddAmpl),
30  fxGraph("Graph","Data object of TGraph class",this, TGraph::Class(), kTRUE, iGraph, iGraphOwned)
31 {
32  SetExcludeLessThen(-1e50);
33 }
34 
36 }
37 
39 {
40  return new TGo4FitDataGraphIter(this);
41 }
42 
43 void TGo4FitDataGraph::SetGraph(TGraph *iGraph, Bool_t iGraphOwned)
44 {
46  fxGraph.SetObject(iGraph,iGraphOwned);
47 }
48 
49 void TGo4FitDataGraph::FillSlotList(TSeqCollection* list)
50 {
52  list->Add(&fxGraph);
53 }
54 
55 void TGo4FitDataGraph::Print(Option_t* option) const
56 {
57  TGo4FitData::Print(option);
58  std::cout << " ";
59  fxGraph.Print(option);
60 }
61 
62 // *********************************************************************************
63 
66  fxData(0),
67  fiNumPoints(0)
68 {
69 }
70 
73  fxData(Data),
74  fiNumPoints(0)
75 {
76 }
77 
79 {
80 }
81 
83 {
84  if ((fxData==0) || (fxData->GetGraph()==0)) return kFALSE;
85 
86  fiNumPoints = fxData->GetGraph()->GetN();
87 
88  return ReserveArrays(1, 1, kFALSE);
89 }
90 
92 {
93  if (fxData==0) return kFALSE;
94  TGraph* gr = fxData->GetGraph();
95  if (gr==0) return kFALSE;
96 
97  Double_t* xx = gr->GetX();
98  Double_t* yy = gr->GetY();
99  if ((xx==0) || (yy==0)) return kFALSE;
100 
101  Double_t xvalue = xx[fxIndexes[0]];
102  fdValue = yy[fxIndexes[0]];
103 
104  if (!GetDeviation()) {
105  Double_t zn = gr->GetErrorY(fxIndexes[0]);
106  if (zn>0) fdStandardDeviation = zn*zn;
107  else fdStandardDeviation = 1.;
108  }
109 
110  return ProduceScales(fxIndexes.GetArray(), &xvalue, 0);
111 }
112 
114 {
115  fxIndexes[0]+=1;
116  return (fxIndexes[0]<fiNumPoints);
117 }
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