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

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 12 2003 - 22:51:26 MEST


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