Error: String literal syntax error

Hi,
Can anyone tell me what is the syntax error in the string literal in question?
This is what I am trying to do:
gROOT->ProcessLine("((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x))")
and I get:
Error: String literal syntax error (tmpfile):1:
Error: String literal syntax error (tmpfile):1:
*** Interpreter error recovered ***

What i am actually trying to do is to create a new TF1 based on an existing TF1 but evaluating it on a function of the argument like this:
root [11] TF1* current_ele_fun_Sqrt=new TF1(“current_ele_fun_Sqrt”,"((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x))",0,4)
Error: String literal syntax error (tmpfile):1:
Error: String literal syntax error (tmpfile):1:
*** Interpreter error recovered ***

I don’t see a problem with the string literal and it evaluates fine when i evaluate it on the CINT line.
(provided I declare x)

Is there a simpler way to do this? If not what am I doing wong here?

Thanks.
w

Try this:
gROOT->ProcessLine("((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x))")
and/or this:
TF1* current_ele_fun_Sqrt = new TF1(“current_ele_fun_Sqrt”, “((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x))”, 0, 4)

Ah yes - escapes…

This worked - but when I’m trying to use this for the intended purpose I get a different error as below:

root [2] TF1* current_ele_fun_Sqrt=new TF1(“current_ele_fun_Sqrt”,"((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x))",0,4)
Error in TFormula::Compile: Bad numerical expression : "((TF1*)gDirectory.Get(“func_polemassbin0_recomassbin10”)).Eval(TMath::Sqrt(x))"
Error in TF1::TF1: function: current_ele_fun_Sqrt/((TF1*)gDirectory->Get(“func_polemassbin0_recomassbin10”))->Eval(TMath::Sqrt(x)) has 0 parameters instead of 1

any ideas?
Thanks,
w

Hi,

The string based interface of TF1/TFormula does not support access global variable or non-static member functions.

Cheers,
Philippe.