Often users, when opening a TTree, can struggle understanding its content. Would it be meaningful/interesting/doable to add an optional text description to a TBranch?
I know that probably this is not really a ROOT’s duty (it should be on the user data documentation eventually) but maybe it could be useful in some cases, to share with people a self-explanatory file.
(Sorry if it’s a feature that already exist and I didn’t know about. Maybe the object title can serve this purpose but it does not sounds clean somehow.)
Hello,
I think it’s a good idea to document the purpose of branches, and it looks like the title is exactly what you should use for it. See this example:
root.exe tutorials/hsimple.root
root [2] ntuple->Print()
******************************************************************************
*Tree :ntuple : Demo ntuple *
*Entries : 25000 : Total = 504176 bytes File Size = 400827 *
* : : Tree compression factor = 1.25 *
******************************************************************************
*Br 0 :px : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 93173 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.08 *
*............................................................................*
*Br 1 :py : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 93195 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.08 *
*............................................................................*
*Br 2 :pz : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 91547 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.10 *
*............................................................................*
*Br 3 :random : Float_t *
*Entries : 25000 : Total Size= 100787 bytes File Size = 90472 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.11 *
*............................................................................*
*Br 4 :i : Float_t *
*Entries : 25000 : Total Size= 100747 bytes File Size = 31643 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 3.17 *
*............................................................................*
No usable description yet, since name and title of the branch are identical.
But see this:
root [11] ntuple->GetBranch("i")->SetTitle("This is a description")
root [12] ntuple->Print()
******************************************************************************
*Tree :ntuple : Demo ntuple *
*Entries : 25000 : Total = 504196 bytes File Size = 400827 *
* : : Tree compression factor = 1.25 *
******************************************************************************
*Br 0 :px : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 93173 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.08 *
*............................................................................*
*Br 1 :py : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 93195 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.08 *
*............................................................................*
*Br 2 :pz : Float_t *
*Entries : 25000 : Total Size= 100755 bytes File Size = 91547 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.10 *
*............................................................................*
*Br 3 :random : Float_t *
*Entries : 25000 : Total Size= 100787 bytes File Size = 90472 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.11 *
*............................................................................*
*Br 4 :i : Float_t This is a description *
*Entries : 25000 : Total Size= 100767 bytes File Size = 31643 *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 3.17 *
*............................................................................*
You see, once I set a title that’s different from the branch name, it shows up as a description.
Indeed the title can work probably in most cases.
system
Closed
May 18, 2025, 11:14pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.