TGo4FitDataGraph.cxx

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

Generated on Thu Oct 28 15:54:12 2010 for Go4-Fitpackagev4.04-2 by  doxygen 1.5.1