Generating Trees and structures on-the-fly

In the domain I’m working, I’ve got in contact with structures (branches) of variables (leafs) which are posted into a server for this kind of information, I have read access. The values of the variables in this server are updated every N seconds.

The structures themselves have a dynamic nature and can be composed of both basic types and other structures. The server allows me to inspect the schema of these structures on-the-fly. The schema can change on every session, but once defined, it remains valid for the whole of the session.

I would like to sample the server once and get hold of the schema in the begin of a sampling session. And then, every N seconds, to acquire the values of every variable. In the end, I would like to stuff all this information into a ROOT tree in which the leafs represent the variables I read from that server.

After writing the ROOT file, I would like to post it somewhere other users can look at with a plain ROOT CINT prompt.

What would be the best way to do this? Also taking into consideration that the user reading the created files later on, would have only the ROOT file on its hands.

Using trees? Define and “Event” class (like in the manual)? How, taking into consideration the dynamics of the problem? If so, how to make this information usable to the final user?

Many thanks for any tips,

Andre Anjos


Yes you should use a TTree.

What you can do is to write/generate at each session an appropriate Event.h and to compile it using ACLiC.