ROOT
master
Reference Guide
Class.C
Go to the documentation of this file.
1
//script to test Modules
2
#include<
TRInterface.h
>
3
#include<
TMath.h
>
4
#include<
TF1.h
>
5
6
class
TRF1 {
7
private
:
8
TF1
*
f
;
9
public
:
10
TRF1(std::string
name
,std::string formula){
f
=
new
TF1
(
name
.c_str(),formula.c_str());}
11
double
Eval
(
double
x
) {
12
return
f
->Eval(
x
);
13
}
14
void
Draw
(){
15
f
->Draw();
16
}
17
};
18
19
20
ROOTR_MODULE
(rootr) {
21
ROOT::R::class_<TRF1>
(
"TRF1"
)
22
.constructor<std::string,std::string>()
23
.method(
"Eval"
, &
TRF1::Eval
)
24
.method(
"Draw"
, &
TRF1::Draw
)
25
;
26
}
27
28
29
void
Class
()
30
{
31
ROOT::R::TRInterface
&
r
=
ROOT::R::TRInterface::Instance
();
32
r
[
"rootr"
]<<
LOAD_ROOTR_MODULE
(rootr);
33
34
r
<<
"TRF1 <- rootr$TRF1"
;
35
r
<<
"u <- new(TRF1,'dilog','TMath::DiLog(x)')"
;
36
r
<<
"print(u$Eval( 0.0 ))"
;
37
r
<<
"u$Draw()"
;
38
}
f
#define f(i)
Definition:
RSha256.hxx:104
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
TRInterface.h
Draw
th1 Draw()
ROOT::R::class_
Definition:
RExports.h:144
LOAD_ROOTR_MODULE
#define LOAD_ROOTR_MODULE(NAME)
Definition:
RExports.h:177
TF1.h
name
char name[80]
Definition:
TGX11.cxx:110
ROOT::R::TRInterface::Instance
static TRInterface & Instance()
static method to get an TRInterface instance reference
Definition:
TRInterface.cxx:185
TF1
1-Dim function class
Definition:
TF1.h:213
Class
void Class()
Definition:
Class.C:29
RooFit::Eval
@ Eval
Definition:
RooGlobalFunc.h:68
TMath.h
ROOTR_MODULE
ROOTR_MODULE(rootr)
Definition:
Class.C:20
bindings
r
tests
Class.C
ROOT master - Reference Guide Generated on Sat Jan 16 2021 12:31:14 (GVA Time) using Doxygen 1.9.0