graphApply.C

Go to the documentation of this file.
00001 {
00002 //A macro to demonstrate the functionality of TGraphX::Apply() method
00003 //Author: Miro Helbich oct.2001
00004 
00005 
00006 Int_t npoints=3;
00007 Double_t xaxis[npoints] = {1.,2.,3.};
00008 Double_t yaxis[npoints] = {10.,20.,30.};
00009 Double_t errorx[npoints] = {0.5,0.5,0.5};
00010 Double_t errory[npoints] = {5.,5.,5.};
00011 
00012 Double_t exl[npoints] = {0.5,0.5,0.5};
00013 Double_t exh[npoints] = {0.5,0.5,0.5};
00014 Double_t eyl[npoints] = {5.,5.,5.};
00015 Double_t eyh[npoints] = {5.,5.,5.};
00016 
00017 TGraph *gr1 = new TGraph(npoints,xaxis,yaxis);
00018 TGraphErrors *gr2 = new TGraphErrors(npoints,xaxis,yaxis,errorx,errory);
00019 TGraphAsymmErrors *gr3 = new TGraphAsymmErrors(npoints,xaxis,yaxis,exl,exh,eyl,eyh);
00020 TF2 *ff = new TF2("ff","-1./y");
00021 
00022 TCanvas *c1 = new TCanvas("c1","c1");
00023 c1->Divide(2,3);
00024 // TGraph
00025 c1->cd(1);
00026 gr1->DrawClone("A*");
00027 c1->cd(2);
00028 gr1->Apply(ff);
00029 gr1->Draw("A*");
00030 
00031 // TGraphErrors
00032 c1->cd(3);
00033 gr2->DrawClone("A*");
00034 c1->cd(4);
00035 gr2->Apply(ff);
00036 gr2->Draw("A*");
00037 
00038 // TGraphAsymmErrors
00039 c1->cd(5);
00040 gr3->DrawClone("A*");
00041 c1->cd(6);
00042 gr3->Apply(ff);
00043 gr3->Draw("A*");
00044 
00045 }

Generated on Tue Jul 5 15:44:22 2011 for ROOT_528-00b_version by  doxygen 1.5.1