GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4FitDataGraph.cxx
Go to the documentation of this file.
1 // $Id$
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 }
35 
36 std::unique_ptr<TGo4FitDataIter> TGo4FitDataGraph::MakeIter()
37 {
38  return std::make_unique<TGo4FitDataGraphIter>(this);
39 }
40 
41 void TGo4FitDataGraph::SetGraph(TGraph *iGraph, Bool_t iGraphOwned)
42 {
44  fxGraph.SetObject(iGraph,iGraphOwned);
45 }
46 
47 void TGo4FitDataGraph::FillSlotList(TSeqCollection *list)
48 {
50  list->Add(&fxGraph);
51 }
52 
53 void TGo4FitDataGraph::Print(Option_t *option) const
54 {
55  TGo4FitData::Print(option);
56  std::cout << " ";
57  fxGraph.Print(option);
58 }
59 
60 // *********************************************************************************
61 
64  fxData(nullptr),
65  fiNumPoints(0)
66 {
67 }
68 
71  fxData(Data),
72  fiNumPoints(0)
73 {
74 }
75 
77 {
78 }
79 
81 {
82  if (!fxData || !fxData->GetGraph()) return kFALSE;
83 
84  fiNumPoints = fxData->GetGraph()->GetN();
85 
86  return ReserveArrays(1, 1, kFALSE);
87 }
88 
90 {
91  if (!fxData) return kFALSE;
92  TGraph *gr = fxData->GetGraph();
93  if (!gr) return kFALSE;
94 
95  auto xx = gr->GetX();
96  auto yy = gr->GetY();
97  if (!xx || !yy) return kFALSE;
98 
99  Double_t xvalue = xx[fxIndexes[0]];
100  fdValue = yy[fxIndexes[0]];
101 
102  if (!GetDeviation()) {
103  Double_t zn = gr->GetErrorY(fxIndexes[0]);
104  if (zn > 0.) fdStandardDeviation = zn*zn;
105  else fdStandardDeviation = 1.;
106  }
107 
108  return ProduceScales(fxIndexes.GetArray(), &xvalue, nullptr);
109 }
110 
112 {
113  fxIndexes[0] += 1;
114  return fxIndexes[0] < fiNumPoints;
115 }
Bool_t ProduceScales(const Int_t *index, const Double_t *ownscales, const Double_t *ownwidths)
void Print(Option_t *option="") const override
TArrayI fxIndexes
Definition: TGo4FitData.h:612
Double_t fdStandardDeviation
Definition: TGo4FitData.h:617
TGo4FitSlot fxGraph
void Print(Option_t *option="") const override
void Print(Option_t *option="") const override
virtual ~TGo4FitDataGraph()
Double_t fdValue
Definition: TGo4FitData.h:616
void SetExcludeLessThen(Double_t limit=0.)
Definition: TGo4FitData.h:117
Bool_t ReadCurrentPoint() override
Bool_t ShiftToNextPoint() override
void FillSlotList(TSeqCollection *list) override
void SetGraph(TGraph *iGraph, Bool_t iGraphOwned=kFALSE)
std::unique_ptr< TGo4FitDataIter > MakeIter() override
Bool_t StartReset() override
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
Bool_t ReserveArrays(Int_t NumDimen, Int_t NumOwnAxis, Bool_t HasWidth)
void FillSlotList(TSeqCollection *list) override
TGo4FitDataGraph * fxData
Bool_t GetDeviation()
void ClearObject()
TGraph * GetGraph() const