Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
6class TRF1 {
7private:
8 TF1 *f;
9public:
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
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
29void Class()
30{
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}
void Class()
Definition Class.C:29
ROOT::R::TRInterface & r
Definition Object.C:4
#define ROOTR_MODULE
Definition RExports.h:162
#define LOAD_ROOTR_MODULE(NAME)
Definition RExports.h:176
char name[80]
Definition TGX11.cxx:110
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
static TRInterface & Instance()
static method to get an TRInterface instance reference
1-Dim function class
Definition TF1.h:213
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition TF1.cxx:1328
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Definition TF1.cxx:1440
Definition Class.C:6
void Draw()
Definition Class.C:14
TF1 * f
Definition Class.C:8
TRF1(std::string name, std::string formula)
Definition Class.C:10
double Eval(double x)
Definition Class.C:11
Double_t x[n]
Definition legend1.C:17