Logo ROOT  
Reference Guide
ROOTR.C
Go to the documentation of this file.
1 //script to test Modules
2 #include<TRInterface.h>
3 
5 {
6  return cos(x);
7 }
8 
9 void ROOTR()
10 {
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 }
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::R::TRInterface
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
Definition: TRInterface.h:137
x
Double_t x[n]
Definition: legend1.C:17
cos
double cos(double)
TRInterface.h
ROOT::R::TRInterface::SetVerbose
void SetVerbose(Bool_t status)
Method to set verbose mode, that produce extra output.
Definition: TRInterface.cxx:132
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
Double_t
double Double_t
Definition: RtypesCore.h:59
ROOT::R::TRInterface::Instance
static TRInterface & Instance()
static method to get an TRInterface instance reference
Definition: TRInterface.cxx:185
myFunc
Double_t myFunc(Double_t x)
Definition: ROOTR.C:4
ROOTR
void ROOTR()
Definition: ROOTR.C:9