WTI/Experiment Electronics/Data Processing: Go4

Previous tutorial 6  |    Go4   Example 7   |  Next tutorial 8

Tutorial 7

What do we have now

We have an analysis reading data from MBS sources. It copies data into an output event which optionally can be written to a file. This file we can use as input instead of the MBS raw data. All that is steered by the setup macro.
In fact, we do two subsequent steps: filling the event and processing the event. Because we have only one processor TSimProc, we must implement the code for both there checking what kind of input we have.

A much cleaner implementation would be to separate the two steps and have two processors. Exactly that is provided by Go4 steps. Go4 steps are modular function units executed sequentially. Each step has an event source, an event processor, and an event store. The setup of the steps can be done in the GUI in the configuration window we already used (we had one step). The standard setup of steps is that each step uses the output of the previous one as input. Each step providing an output event can be enabled to store the output in a file. Then the execution of this step can be disabled and the following step using this output as input gets it from the file. The processor need not to know where the input event comes from. The file I/O is done by the framework (see lecture).

Using the Go4 steps

For that we first create a directory and change to it. We enable Go4 by
> . go4login
Now the variable GO4SYS should point to the top Go4 directory. Copy the tarball tut07.tar from Example above into your directory and unpack it to your new directory:
> tar xvf tut07.tar
> . ./rename.sh XXX St3
> make all
As before this should create a libGo4UserAnalysis.so library which is used by the standard Go4 analysis main program.
The most important components are:


We have three steps: Unpack, calibrate and physics. Each step has a processor (Make) producing an output event (Event) which is then used by the next step as input. The first step uses the MBS input provided by Go4 as in the previous example. The table below shows the setup as it is done in the setup file.


We moved the step creation from TSt3Analysis.cxx into setup.C.

Running the analysis from shell

The built-in random event generator is used as data source:
> go4analysis -events 100000
The output shows in detail what happens like in the previous examples. After having processed the 100000 events, the program terminates and has produced a root file which we now inspect using the Go4 browser.

Launch analysis by GUI

Now use the Analysis->Launch Analysis to open the window to launch the analysis. Check if the values in the window are correct, i.e. that the directory path is your current directory.
After pressing the Start button the analysis is launched and the configuration window comes up. Select as Event source MBS Random and give it a name. Then press Submit and close the window (can be opened any time by Analysis->Configuration). You will see now three tabs, one for each step. The source/store radio buttons refer to file IO: Enable source means get event from file, otherwise from previous step, Enable store means store events to file. The first step logically must have an enabled source. These three step control settings can be seen in the tab headers by x or o.

If you look into the folders you will see subfolders for the steps:

Manage step setups

Up to now we were using a setup macro to configure the steps. For a different configuration we had to edit this macro. When started from GUI, the configuration as set up in the macro appeared in the configuration window. We can store this configuration into a root file: Enter a file name in the Analysis Configuration File field and press the store button besides. Note that not the GUI, but the analysis stores the configuration! If we change the configuration in the window we first must submit it, and then store. Similarly we can restore a configuration and submit it to the analysis.
What we could not do, however, was to use such a stored configuration in batch (shell) mode. The calling sequence to load a configuration file is:
> go4analysis -name MyAnalysis -prefs Go4AnalysisPrefs.root -events 100000
where MyAnalysis is the name (default) as specified in the launch panel and Go4AnalysisPrefs.root the file name (default) specified in the configuration panel. When launched by GUI we have to use the restore button as described above. In both cases the configurations are made from the same files. The setup macro is only the default or starter setup, as long as we have no other.
Warning: The configuration Go4AnalysisPrefs.root is always loaded finally when the analysis is launched by GUI. It overrides all setting of the user. It could be a good strategy never to use this file!
Instead, I would propose to use the GUI and store different configurations in different files and load these in batch as well in interactive mode.
Especially with our final example (tutorials 9 and 10) the management of configurations requires some care.

An alternative would be to use only different macros (pass macro name to analysis program) which works also in GUI controlled mode.

Passing arguments to Analysis

There is a mechanism to pass optional arguments to TSt3Analysis.cxx.
> go4analysis -events 100000 -x abc
The arguments behind -x (separated by spaces) are passed to TSt3Analysis.cxx as string vector (alternatively the argument list can be specified in the analysis launch panel of the GUI, see
Tutorial 2). There they can be accessed like
if(argc > 1) cout << argv[1] << endl;
This mechanism could be used to specify from command line or launch panel an input file name and pass it as argument to setup.C where it can be used to compose all other file names. Then all files of a run can be identified by that name.
Example (setup.C):
void setup(char * name){
TString TSauto = Form("%s_AS.root", name);
TString TSlmd = Form("%s.lmd", name);
TString TStree = Form("%s_tree.root", name);
TString TSnode = Form("%s", name);

Next tutorial

WTI Experiment Electronic Data Processing Group
Hans Essel , GSI Helmholtzzentrum für Schwerionenforschung mbH, GSI
Total 25967, last 2022 Jul 06 19:00
Last update: 2009 Nov 25 19:13