Anonymous TFormula

Hi,

often I have situation that I need to create TFormula and read the properties of it, like number of parameters, but this is not yet time to name in. Name is created dynamically and later in the code.

But currently one has to name the TFormula object. Is there smart way to have unnamed formulas?

I see two ways:

  • put empty string "" as formula name; or
  • put random-generated string as a name, and later rename it.

but I am not sure whether the first solution will not break somewhere later if I have couple "" named formulas in the code.

I would suggest to try it.
I am not sure if have several TFormula with the same name is
a problem or not (again try), but in any case it should be easy to name
them differently with a “random-generated string” as you suggested.

Hi,

When you construct TFormula objects you can pass false the flag addToGlobalList in the Formula constructor, see ROOT: TFormula Class Reference.
In this case you can use just an empty string.

Lorenzo