WTI/Experiment Electronics/Data Processing: Go4 |
Previous tutorial 2 | | Go4 | | Next tutorial 4 |
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.
TSimAnalysis.h TSimAnalysis.cxx setup.C TSimProc.h TSimProc.cxx TSimParam.h TSimParam.cxx
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.
fHis1->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.
if( fcHis1->Test( f1[0] ) ) fHis1g->Fill( f1[0] );