Graphic with error bar

Hello! I wanted to do a graph with error bars . But it is giving me a stupid error that a i cant find out what is .Furthmore I want to know how to create a fctree .
The code is here:

[code] #ifndef CINT

#include <stdlib.h>
#include <Riostream.h>
#include <time.h>
#include <TString.h>
#include <TROOT.h>
#include <TError.h>
#include <TRandom.h>
#include <TBenchmark.h>
#include <TSystem.h>
#include <TApplication.h>
#include <TDatime.h>
#include <TFile.h>
#include <TF1.h>
#include “TF2.h”
#include <TF3.h>
#include <TH2.h>
#include <TNtuple.h>
#include <TProfile.h>

#include <TStyle.h>
#include <TCanvas.h>
#include <TColor.h>
#include <TFrame.h>
#include <TPostScript.h>
#include <TPDF.h>
#include <TLine.h>
#include <TMarker.h>
#include <TPolyLine.h>
#include <TLatex.h>
#include <TEllipse.h>
#include <TCurlyArc.h>
#include <TArc.h>
#include <TPaveText.h>
#include <TPaveStats.h>
#include <TPaveLabel.h>
#include <TGaxis.h>
#include <TGraph.h>
#include <TGraphErrors.h>
#include <TGraphAsymmErrors.h>
#include <TGraphBentErrors.h>
#include <TMultiGraph.h>
#include <TGraph2D.h>
#include <TImage.h>
#include <TMath.h>
#include <TSystem.h>

void stressGraphics (Int_t verbose);
Int_t StatusPrint (TString &filename, Int_t id, const TString &title, Int_t res, Int_t ref, Int_t err);
Int_t AnalysePS (const TString &filename);
Int_t FileSize (char *filename);
TCanvas *StartTest (Int_t w, Int_t h);
void TestReport1 (TCanvas *C, const TString &title);
void TestReport2 ();
void DoCcode (TCanvas *C);

void graph ()
{
// Stat and fit parameters with errors.

TCanvas *C = StartTest(800,500);

C->Divide(3,2);
gStyle->SetOptFit(1111);  
gStyle->SetOptStat(111111); 

gStyle->SetStatW(0.43);
gStyle->SetStatH(0.35);

TH1 *hsf1 = new TH1F("hsf1","hsf1", 2,0.,1.);
TH1 *hsf2 = new TH1F("hsf2","hsf2", 2,0.,1.);
TH1 *hsf3 = new TH1F("hsf3","hsf3", 2,0.,1.);

TH1 *hsf4 = new TH1F(“hsf4”,“hsf4”, 2,0.,1.);
TH1 *hsf5 = new TH1F(“hsf5”,“hsf5”, 2,0.,1.);

C->cd(1);
hsf1->SetBinContent (1, 5.3E5); hsf1->SetBinError (1, 0.9);
hsf1->SetBinContent (2, 5.3E5); hsf1->SetBinError (2, 0.1);
hsf1->Fit("pol0","Q");

C->cd(2);
hsf2->SetBinContent (1, 5.0E15); hsf2->SetBinError (1, 4.9E15);
hsf2->SetBinContent (2, 5.0E15); hsf2->SetBinError (2, 4.9E11);
hsf2->Fit("pol0","Q");

C->cd(3);
hsf3->SetBinContent (1, 5.0E-15); hsf3->SetBinError (1, 4.9E-15);
hsf3->SetBinContent (2, 5.0E-15); hsf3->SetBinError (2, 4.9E-11);
hsf3->Fit("pol0","Q");

C->cd(4);
hsf4->SetBinContent (1, 5); hsf4->SetBinError (1, 3);
hsf4->SetBinContent (2, 5); hsf4->SetBinError (2, 1);
hsf4->Fit(“pol0”,“Q”);

C->cd(5);
hsf5->SetBinContent (1, 5.3); hsf5->SetBinError (1, 0.9);
hsf5->SetBinContent (2, 5.3); hsf5->SetBinError (2, 0.1);
hsf5->Fit("pol0","Q");

C->cd(6);
TPaveText *pt = new TPaveText(0.02,0.2,0.98,0.8,"brNDC");
pt->SetFillColor(18);
pt->SetTextAlign(12);
pt->AddText("This example test all the possible cases");
pt->AddText("handled by ThistPainter::GetBestFormat.");
pt->AddText("This method returns the best format to");
pt->AddText("paint the fit parameters errors.");
pt->Draw();

TestReport1(C, "Stat and fit parameters with errors");
DoCcode(C);
TestReport2();

}[/code]

I hope you can help me.
Rgds

[quote]But it is giving me a stupid error that a i cant find out what is .[/quote]What is the ‘error’ you are getting?

[quote]Furthmore I want to know how to create a fctree . [/quote]What is a ‘fctree’?

Philippe.

First thing the error is :
"function graph is not defined in a corrent scope"
Can be very simple to solve but i have done just a few things in root like histo and for that i am still a beginner . Then i want to learn more.
The second thing is that my question is how to create a tree . I got mistaken when i said fctree .
Rgds
Bruno Santos

Hi Bruno,

First, remove the first line of your macro:

or put a #endif somewhere below your #include list

Then, for the tree, take a look at the many examples in $ROOTSYS/tutorials/tree

Cheers, Bertrand.

Sorry to bother again but it appears another error that it was the following one:
"StartTest() declared but not defined"
I hope you can help me.
Rgds
Bruno Santos

Hi,

This message

Means that the method StartTest() is declared at the begining of your code, but never defined (implemented).
And this is not the only one, just take a look at your macro, these methods:

void stressGraphics (Int_t verbose); Int_t StatusPrint (TString &filename, Int_t id, const TString &title, Int_t res, Int_t ref, Int_t err); Int_t AnalysePS (const TString &filename); Int_t FileSize (char *filename); TCanvas *StartTest (Int_t w, Int_t h); void TestReport1 (TCanvas *C, const TString &title); void TestReport2 (); void DoCcode (TCanvas *C);
are also declared, but never implemented.
If you copied your code from somewhere else, you probably missed part of it, or these definitions (implementations) were maybe in another file…

Cheers, Bertrand.

I’ll try to rebuilt my code and when it’s finished I tell something if I can not do it.
Thanks for all the help .
Cheers,
Bruno Santos