WTI/Experiment Electronics/Data Processing: Go4

Previous tutorial 4  |    Go4    tree.C    make.C    |  Next tutorial 6

Tutorial 5

In this tutorial we inspect the ROOT file we created in tutorial 4. This can be done in several ways:

Go4 GUI

We start the GUI as before and open the files tree.root and as comparison result.root as in tutorial 2. Now we can break up the structure of tree.root in the browser until we see our f1 and f2 arrays. We need the tree viewer to inspect the data. Use Settings->Show/hide in the menu and enable it. It will appear in a one line window. Drag f1 into the first field (X) and insert index 0. Then press RET or the button on the left side: a histogram filled with f1[0] will show up.
In the field with the scissor one can enter an expression as valid for the ROOT TreeDraw.
One could also create a histogram using the rightmost button and use that for the tree draw. The histograms will show up in the workspace folder and can be saved to a ROOT file. The histogram created automatically has only 100 channels. Therefore it looks different from His1 in result.root.
The GUI could look like

Go4 analysis

One comment in advance: in a real analysis the output of a step would not be used as input of the same step but of the following step. Up to now we have only one step, and this is rather a demonstration that it is possible to handle two different inputs ( TGo4MbsEvent or TSimEvent ) in the same step.
If we want to read the tree file in our analysis, we only have to adust the setup file. Everything else is already done! In setup.C we choose scenario 3 (comment out scenario 2, do not forget comment out scenario 1 and 2). That means, again use the default output event class, comment out the output specifications at the end, and use our TSimEvent now as input event.
Without make we can run our main program (delete result.root before), and should see the same result as before.
Note that all the previous steps can now be repeated without remake, just by editing the setup file.

Processing the tree file with CINT

Please, copy tree.C above to your working directory. Again use the
> . ./rename.sh XXX Sim
sequence to customize the names. Execute the macro in ROOT CINT
> root
> root [0] .x tree.C("tree")
  **** TSimEvent: Create instance
  **** TSimEvent: Create instance
  **** TSimEvent: Delete instance
  Starting tree read for 100000 events...
  Printout last event:
  ======> EVENT:99999
  Event. = NULL
  Event.TGo4EventElement.fUniqueID = 0
  Event.TGo4EventElement.fBits = 50331656
  Event.TGo4EventElement.fName = Event
  Event.TGo4EventElement.fTitle = This is a Go4 EventElement
  Event.TGo4EventElement.fbIsValid = 1
  Event.TGo4EventElement.fIdentifier = -1
  Event.f1[8] = 195.0 , 613.0 , 1014.0 , 595.0 , 0.0 , 0.0 , 0.0 , 0.0
  Event.f2[8] = 201.0 , 299.0 , 94.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0

 TCanvas::MakeDefCanvas: created default TCanvas with name c1
The canvas with the histogram is shown:

Create Go4 independent analysis of tree file

ROOT provides a very powerful mechanism to analyse ROOT trees even if the class libraries producing the trees are not available. In our case the tree is built from our event object of class TSimEvent. If someone would like to analyse the file without having Go4 nor this class one can use this mechanism to create a Go4 independent analysis macro. Please, copy make.C above to your working directory (this one contains no XXX!).
> root
root [0] .x make.C("tree","Anatree")
 Info in TTreePlayer::MakeClass:
 Files: Anatree.h and Anatree.C
 generated from TTree: UnpackxTree
You can see that the two files created are plain ROOT! The definition file contains a class containing the data of our TSimEvent. The members names are prefixed by the name of the object ( Event in our case).

Next tutorial


WTI Experiment Electronic Data Processing Group
Hans Essel , GSI Helmholtzzentrum für Schwerionenforschung mbH, GSI
Total 25961, last 2022 Jul 06 17:57
Last update: 2010 Apr 07 14:07