WTI/Experiment Electronics/Data Processing: Go4

Previous tutorial 3  |    Go4    TXXXEvent.h    TXXXEvent.cxx    |  Next tutorial 5

Tutorial 4

In tutorial 3 we copied raw data from the input event into local arrays f1 and f2 of TSimProc. Then we filled histograms from these arrays. We now want to separate these two steps in the way that we can output the arrays to a file and do the histogram filling using this file as input later.

1. Getting an output event class

To do that we need an output event object. Please, copy the two files above to your working directory. Again use the
>. ./rename.sh XXX Sim
sequence to customize the names. TSimEvent is now our output event class.

2. Register it for make

To be built, we must enter this class name in the file SimLinkDef.h (just uncomment the line).

3. Register it in the framework

Now we must tell the framework that we want to use this class as event output. This shall be done in Setup.C. We have to make the changes needed for scenario 2. Look at the line
fact->DefOutputEvent("Dummy","TGo4EventElement");
We defined the output event to be of class TGo4EventElement. This is a default class provided by Go4. Actually the function Fill in this class calls our BuildEvent function of TSimProc.cxx. Because we now want to use our class TSimEvent instead, we simply comment out the line with TGo4EventElement and uncomment the line with TSimEvent. To speficy the output file name and enable output the following lines at the end must be uncommented:
store = new TGo4FileStoreParameter(outfile);
step->SetEventStore(store);
step->SetStoreEnabled(kTRUE);

4. Declare data in the event class

The data members inside TSimEvent are declared in TSimEvent.h. It is recommended to clear these arrays before they are filled. This is done in TSimEvent.cxx in function Clear.

5. Fill the event in BuildEvent

Now we have the data, but they are not yet filled! This must be done in TSimProc.cxx. Here we have first to uncomment the include statement defining TSimEvent. In function BuildEvent we get a pointer to the output event as argument ( target), which is now a TSimEvent. We check if target->ClassName() is "TSimEvent". Just uncomment this block of lines. In this case we copy that pointer with a cast. Then we copy the local arrays we filled from the MBS event into the arrays of our event object:
TSimEvent * data = (TsimEvent *) target;
for(i = 0; i < 8; i++)
{
  data->f1[i]=f1[i];
  data->f2[i]=f2[i];
}
FillHistograms(data);
The histograms are now filled with the data of TSimEvent. For that we must uncomment the else block in FillHistograms. The return code of BuildEvent function indicates if this event shall be written to the output file (when writing is enabled).

6. Make

Now everything should be ready to make.

7. Now we are through

Now we run go4analysis like in tutorial 2:
> go4analysis -events 100000
> ....
> dir *.root
 result.root
 tree.root
tree.root contains our output events with the two arrays as ROOT tree. In the next tutorial we will learn how to process this file.

Next tutorial


WTI Experiment Electronic Data Processing Group
Hans Essel , GSI Helmholtzzentrum für Schwerionenforschung mbH, GSI
Total 29745, last 2024 Mar 29 06:50
Last update: 2009 Nov 24 14:52