Re: [ROOT] Retrieve the formula expression from a TFormula

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Thu Jun 12 2003 - 23:02:08 MEST


Suppose I do

TFormula* f1 = new TFormula("f1","x+y");
TFormula f2("f2","f1+2")               ;
delete f1;

f2.GetTitle() doesn't return "x+y+2". It returns "f1+2"

I want to get "x+y+2" even if f1 is deleted. Since the formula is
implicitly stored in f2 member variables (I'm able to Eval() even when f1
is deleted), I should be able to retrieve it

Thank you

Pierre-Luc Drouin


On Thu, 12 Jun 2003, Rene Brun wrote:

> Pierre-Luc,
> 
> same answer as before. A TF1 is a TFormula. If you have
>    TF1 f("f:,"sin(x)/x",0,10);
>    f.GetTitle() returns "sin(x)/x"
> 
> Rene Brun
> 
> On Thu, 12 Jun 
> 2003, Pierre-Luc Drouin wrote:
> 
> > Hi,
> > 
> > My question was not very clear... sorry
> > 
> > I've in a ROOT file a TF1 object that has been created using an user
> > defined TFormula. I mean that the formula of the TF1 object
> > (TNamed::fTitle) contains the TNamed::fName of an user define TFormula
> > object. This TF1 object has been compiled and has been written in a ROOT
> > file. Now I have to open the ROOT file, load the TF1 object and retrieve 
> > its
> > formula. The formula is stored in the TFormula object tables of the TF1
> > object and the TNamed::fTitle member variable contains the TFormula
> > object name (this TFormula object doesn't exist anymore because only the
> > TF1 object is contained in the ROOT file).
> > 
> > I want to get the mathematical expression of the function contained in the
> > TF1 object, expression that doesn't depend on a TFormula object name. It's
> > not a problem if this expression is different from the original expression
> > (when the TF1 object has been created the first time), I just want it to
> > be equivalent. I want to apply a scaling factor and some complexe cuts on
> > the TF1
> > object, so it's essential to retrieve the expression.
> > 
> > Thank you!
> > 
> > Pierre-Luc Drouin
> > 
> > On Thu, 12 Jun 2003, Rene Brun wrote:
> > 
> > > Hi Pierre-Luc,
> > > 
> > > TFormula is a TNamed. If you have TFormula* f, do
> > >   f->GetTitle();
> > > 
> > > Rene Brun
> > > 
> > > On Thu, 12 Jun 2003, 
> > > Pierre-Luc Drouin wrote:
> > > 
> > > > Hi,
> > > > 
> > > > How can I retrieve the formula string from a TFormula instance if
> > > > SetTitle() has been called to change the default title by something else?
> > > > 
> > > > Must ROOT users not call SetTitle() with a non mathematical string?
> > > > 
> > > > Is it possible to retrieve a formula string from TFormula object tables?
> > > > 
> > > > Thank you!
> > > > 
> > > > Pierre-Luc Drouin
> > > > 
> > > 
> > 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET