TTree's UserInfo and TTree Draw

Hello rooters,

In order to save some space in my rootfiles I’m investigating whether it’s possible to move a bunch of constant branches in my TTree to the UserInfo list. Those values change from tree to tree, but they are constant within one.

I created a TParameter called ‘dataset’, added to UserInfo, saved to TFile.
When opening the file, my integer is happily saved in the TTree’s UserInfo

Now, my problems start when I want to use this information in TTree::Draw

I managed to access the object:

[code]t.Scan(‘This.GetUserInfo().FindObject(“dataset”).GetName()’,’’,‘col=20’)


  • Row * This.GetUserInfo().F *

  •    0 *              dataset *
    

[/code]

I want to access the value inside my ‘dataset’ parameter, so I try to

[code]t.Scan(’((TParameter*)This.GetUserInfo().FindObject(“dataset”)).GetVal()’,’’,‘col=20’)

Error in TTreeFormula::DefinedVariable: Unknown method:GetUserInfo().FindObject(“dataset”)).GetVal() in TObject
Error in TTreeFormula::Compile: Bad numerical expression : “((TParameter*)This.GetUserInfo().FindObject(“dataset”)).GetVal()”


  • Row * ((TParameter*)T *

  •    0 *                      *
    

***********************************[/code]

which fails. TTreeFormula claims the object to be a TObject despite the cast.
The cast itself is somehow accepted

[code]t.Scan(’((TParameter*)This.GetUserInfo().FindObject(“dataset”)).GetName()’,’’,‘col=20’)


  • Row * ((TParameter*)T *

  •    0 *              dataset *
    

***********************************[/code]
it doesn’t complain. It just seem to ignore the cast and consider it still a TObject.
I’ve attached a small pyROOT script to reproduce the `problem’

Any idea if I’m doing anything wrong or wehtehr it’s just not supported.
If not, any suggestion how to avoid saving constant numbers in branches and still access them with Draw/Scan?

Thanks!!

-a
testparameter.py (930 Bytes)