ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
ROOTR.C
Go to the documentation of this file.
1
//script to test Modules
2
#include<
TRInterface.h
>
3
4
Double_t myFunc(Double_t x)
5
{
6
return
cos(x);
7
}
8
9
void
ROOTR()
10
{
11
ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
12
r.SetVerbose(kFALSE);
13
r.LoadModule(
"Gpad"
);
14
r.LoadModule(
"Hist"
);
15
r.LoadModule(
"Rint"
);
16
17
r<<
"x<-seq(0,2*pi,by=.1)"
;
18
r<<
"c1<-new(TCanvas,'c1','dlnorm')"
;
19
r<<
"u <-new(TGraph,length(x),x,dlnorm(x))"
;
//TGraph(int,double*,double*)
20
r<<
"u$Draw()"
;
21
22
r<<
"c2<-new(TCanvas,'c2','DiLog from TMath')"
;
23
r<<
"o<- new(TF1,'dilog','TMath::DiLog(x)',0,2*pi)"
;
24
r<<
"o$Draw()"
;
25
//
26
r<<
"c3<-new(TCanvas,'c3','Custom')"
;
27
r<<
"i <- new(TF1,'f2','[0]*myFunc([1]*x)',0,2*pi)"
;
28
r<<
"i$SetRange(0,2*pi)"
;
29
r<<
"i$SetParameter(0,4)"
;
30
r<<
"i$SetParameter(1,pi/2)"
;
31
r<<
"print(i$Eval(0))"
;
32
r<<
"print(i$Eval(c(0,pi)))"
;
33
r<<
"i$Draw('')"
;
34
35
// r<<"gApp<-new(TRint,'ROOTR')";
36
// r<<"gApp$ProcessLine('cout<<\"Calling cout from TRint\"<<endl;')";
37
38
}
TRInterface.h
bindings
r
tests
ROOTR.C
Generated on Tue May 5 2020 14:02:18 for ROOT by
1.8.5