Creating ROOT tree files

The creation of tree files is directly implemented in Go4. It is done using the class TXXXEvent. The trees are stored in the file tree.root

In the header file TXXXEvent.h one has to specify the structure how the date is saved.  In our case these are the two arrays f1 and f2.

In the file TXXXEvent.cxx one has to adapt the Clear method in the right way. Arrays are set to zero with the memset command.

In the file TXXXProc.cxx a new member of the class has to be created to us this arrays. Look into the code:

TXXXEvent *data = (TXXXEvent *) target;

Now, one can store the values inside the arrays in the following way:

data->f1[index] = value;

Remark:

One does not need to take arrays if one only has one, lets call it trigger event, per MBS event.
At the moment Go4 only writes one tree per MBS event.
In order to get all trigger events stored in the tree one has to create an array with the number of the trigger events per MBS event: array[bufferdepth]

This is done in the example. Uncomment the printf commands and one sees that there are 31 trigger events per MBS event and all of them are stored in the array.

The tree file can also be opened with the Go4 GUI or the ROOT TBrowser. In general a tree is drawn in Go4 when one double clicks on the array, choses an index of the array and clicks on the draw symbol. One can draw all events by removing the index.