WTI/Experiment Electronics/Data Processing: Go4

Previous tutorial 2  |    Go4    |  Next tutorial 4

Tutorial 3

The analysis code

Using the simple example from tutorial 2 we may have a look into the analysis code. The relevant files are
 TSimAnalysis.hTSimAnalysis.cxx
 setup.C
 TSimProc.hTSimProc.cxx
 TSimParam.hTSimParam.cxx
The TSimAnalysis needs almost no changes for now. Most configurations are done in macro setup.C which is executed in TSimAnalysis constructor which is called by the Go4 analysis framework. If we run go4analysis from shell (called batch mode) this setup is taken. If we run it from the GUI, they are overwritten by a previously written preferences file, and then the analysis configuration window.
The macro is already prepared for the following tutorials. Currently we use scenario 1 (see comments in macro code). Later we will switch to the other scenarios by simply comment/uncomment the lines needed. No compilation is needed.

The user code is in class TSimProc. In the header file we have the declarations. In TSimProc.cxx we have the constructor and the event processing function BuildEvent(). The TSimProc object is (deleted and) created when we submit a configuration (see tutorial 2). In the constructor all histogram, condition, parameter objects are created and registered to the framework. They are not deleted with the object, but can be retrieved when registered!

Function BuildEvent is called event by event. Note that we have in this example no real event for output but only a dataless dummy! We will later see how to use an output event (target). First the event input source is determined

raw = (TGo4MbsEvent* ) GetInputEvent();
We check if raw->ClassName() is "TGo4MbsEvent" (provided by Go4). In this case we have events formatted like the MBS data. The random generator creates events with one or two sub-events, each with up to eight longword data. Later on we will process also events from a different source type. We step through the sub-events and their data fields and fill these into arrays declared in TSimProc.h (f1 and f2, respectively). Note that we use kind of calibration with parameters fPar1->fOffset and fPar1->fFactor.
The filling of histograms is done in a separate function FillHistograms(0). The argument signals the function to use the local arrays for histogramming. The histograms are filled when parameter fPar1->fFill is true.
fHis1->Fill( f1[0] );
if( fcHis1->Test( f1[0] ) ) fHis1g->Fill( f1[0] );
In the second line condition cHis1 is checked (f1[0] inside limits returns TRUE) and histogram His1g is filled only when the condition is TRUE.

Next tutorial


WTI Experiment Electronic Data Processing Group
Hans Essel , GSI Helmholtzzentrum für Schwerionenforschung mbH, GSI
Total 25966, last 2022 Jul 06 18:35
Last update: 2009 Nov 24 14:46