Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4FitExample/Example12.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 // Go4Fit Example N12
00017 
00018 
00019 #ifndef __CINT__
00020 
00021 #include "TGraph.h"
00022 #include "TApplication.h"
00023 
00024 #include "../Go4Fit/TGo4Fitter.h"
00025 #include "../Go4Fit/TGo4FitDataGraph.h"
00026 
00027 void Example12();
00028 
00029 int main(int argc, char **argv) {
00030 
00031    TApplication theApp("Application", 0, 0);
00032 
00033    Example12();
00034 
00035    theApp.Run();
00036 
00037    return 0;
00038 }
00039 
00040 #endif
00041 
00042 // routine to generate example graph function
00043 TGraph* MakeGraph() {
00044   TGraph* gr = new TGraph(40);
00045   for(Int_t i=0;i<40;i++) {
00046     Double_t x = (i+1.)/40.;
00047     Double_t y = 5 - 0.5*x + x*x;
00048     if ((x>0.3) && (x<0.7))
00049       y+= 10.*(1. - 25.*(x-.5)*(x-.5));
00050     gr->SetPoint(i, x, y);
00051   }
00052   return gr;
00053 
00054 }
00055 
00056 void Example12() {
00057 // create fitter, select fit function and add standard actions list
00058    TGo4Fitter fitter("Fitter", TGo4Fitter::ff_ML_Poisson, kTRUE);
00059 
00060 // add histogram to fitter, which should be fitted
00061    fitter.AddGraph("data1", MakeGraph(), kTRUE);
00062 
00063 // add polynom of 2 order for backgroud approx
00064    fitter.AddPolynomX("data1", "BackgrPol", 2);
00065 
00066 // add polynom of 2 order for backgroud approx
00067    fitter.AddPolynomX("data1", "LinePol", 2, 123, 0.3, 0.7);
00068 
00069 // perform all actions
00070    fitter.DoActions();
00071 
00072 // printing of fitter parameters
00073    fitter.Print("Pars");
00074 
00075 // Draw data ("-" means without full model), Background and line (has group 123)
00076    fitter.Draw("#data1-, Background, Group123");
00077 }
00078 
00079 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:57 2005 for Go4-v2.10-5 by doxygen1.2.15