Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4FitDataGraph.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4FitDataGraph.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TGraph.h"
00021 #include "TGraphErrors.h"
00022 #include "TGraphAsymmErrors.h"
00023 #include "TArrayD.h"
00024 
00025 TGo4FitDataGraph::TGo4FitDataGraph() :
00026    TGo4FitData(),
00027    fxGraph(this, TGraph::Class())
00028 {
00029 }
00030 
00031 TGo4FitDataGraph::TGo4FitDataGraph(const char* iName, TGraph *iGraph, Bool_t iGraphOwned, Bool_t AddAmpl) :
00032    TGo4FitData(iName,"TGraph and derived classes", dtGraph, AddAmpl),
00033    fxGraph("Graph","Data object of TGraph class",this, TGraph::Class(), kTRUE, iGraph, iGraphOwned)
00034 {
00035    SetExcludeLessThen(-1e50);
00036 }
00037 
00038 TGo4FitDataGraph::~TGo4FitDataGraph() {
00039 }
00040 
00041 TGo4FitDataIter* TGo4FitDataGraph::MakeIter()
00042 {
00043    return new TGo4FitDataGraphIter(this);
00044 }
00045 
00046 void TGo4FitDataGraph::SetGraph(TGraph *iGraph, Bool_t iGraphOwned)
00047 {
00048    fxGraph.SetObject(iGraph,iGraphOwned);
00049 }
00050 
00051 void TGo4FitDataGraph::FillSlotList(TSeqCollection* list)
00052 {
00053    TGo4FitData::FillSlotList(list);
00054    list->Add(&fxGraph);
00055 }
00056 
00057 void TGo4FitDataGraph::Print(Option_t* option) const
00058 {
00059    TGo4FitData::Print(option);
00060    cout << "   ";
00061    fxGraph.Print(option);
00062 }
00063 
00064 // *********************************************************************************
00065 
00066 TGo4FitDataGraphIter::TGo4FitDataGraphIter() :
00067    TGo4FitDataIter(),
00068    fxData(0),
00069    fiNumPoints(0)
00070 {
00071 }
00072 
00073 TGo4FitDataGraphIter::TGo4FitDataGraphIter(TGo4FitDataGraph* Data) :
00074    TGo4FitDataIter(),
00075    fxData(Data),
00076    fiNumPoints(0)
00077 {
00078 }
00079 
00080 TGo4FitDataGraphIter::~TGo4FitDataGraphIter()
00081 {
00082 }
00083 
00084 Bool_t TGo4FitDataGraphIter::StartReset()
00085 {
00086   if ((fxData==0) || (fxData->GetGraph()==0)) return kFALSE;
00087 
00088   fiNumPoints = fxData->GetGraph()->GetN();
00089 
00090   return ReserveArrays(1, 1, kFALSE);
00091 }
00092 
00093 Bool_t TGo4FitDataGraphIter::ReadCurrentPoint()
00094 {
00095    if (fxData==0) return kFALSE;
00096    TGraph* gr = fxData->GetGraph();
00097    if (gr==0) return kFALSE;
00098 
00099    Double_t* xx = gr->GetX();
00100    Double_t* yy = gr->GetY();
00101    if ((xx==0) || (yy==0)) return kFALSE;
00102 
00103    Double_t xvalue = xx[fxIndexes[0]];
00104    fdValue = yy[fxIndexes[0]];
00105 
00106    if (!GetDeviation()) {
00107       Double_t zn = gr->GetErrorY(fxIndexes[0]);
00108       if (zn>0) fdStandardDeviation = zn*zn;
00109            else fdStandardDeviation = 1.;
00110    }
00111 
00112    return ProduceScales(fxIndexes.GetArray(), &xvalue, 0);
00113 }
00114 
00115 Bool_t TGo4FitDataGraphIter::ShiftToNextPoint()
00116 {
00117    fxIndexes[0]+=1;
00118    return (fxIndexes[0]<fiNumPoints);
00119 }
00120 
00121 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:12 2008 for Go4-v3.04-1 by  doxygen 1.4.2