Logo ROOT   6.08/07
Reference Guide
mathcoreStatFunc.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_math
3 /// \notebook
4 /// Example macro showing some major probability density functions in ROOT.
5 /// The macro shows four of them with
6 /// respect to their two variables. In order to run the macro type:
7 ///
8 /// ~~~{.cpp}
9 /// root [0] .x mathcoreStatFunc.C
10 /// ~~~
11 ///
12 /// \macro_image
13 /// \macro_code
14 ///
15 /// \author Andras Zsenei
16 
17 #include "TF2.h"
18 #include "TSystem.h"
19 #include "TCanvas.h"
20 
21 void mathcoreStatFunc() {
22  gSystem->Load("libMathCore");
23  TF2 *f1a = new TF2("f1a","ROOT::Math::cauchy_pdf(x, y)",0,10,0,10);
24  TF2 *f2a = new TF2("f2a","ROOT::Math::chisquared_pdf(x,y)",0,20, 0,20);
25  TF2 *f3a = new TF2("f3a","ROOT::Math::gaussian_pdf(x,y)",0,10,0,5);
26  TF2 *f4a = new TF2("f4a","ROOT::Math::tdistribution_pdf(x,y)",0,10,0,5);
27 
28  TCanvas *c1 = new TCanvas("c1","c1",800,650);
29 
30  c1->Divide(2,2);
31 
32  c1->cd(1); f1a->SetLineWidth(1);
33  f1a->Draw("surf1");
34  c1->cd(2); f2a->SetLineWidth(1);
35  f2a->Draw("surf1");
36  c1->cd(3); f3a->SetLineWidth(1);
37  f3a->Draw("surf1");
38  c1->cd(4); f4a->SetLineWidth(1);
39  f4a->Draw("surf1");
40 }
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF2.cxx:216
return c1
Definition: legend1.C:41
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:659
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1819
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
A 2-Dim function with parameters.
Definition: TF2.h:33
The Canvas class.
Definition: TCanvas.h:41
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Definition: TPad.cxx:1089