VI Analysis
of data coming from a frame channel: the selector
It is possible to analyze data coming from a
frame channel by retrieving it sequentially or randomly. In this case, it is the
user's responsibility to do the analysis loop. It may be interesting to automate
the loop in order to let the user focus on the physics analysis, and in order to
prepare for parallel processing.
This is done by using the frame channel
VFrameChannel::Process()
method which sends a restricted set of data from a frame channel to a processing
script or class written by the user, called a "selector". Before we can process
data, we need to make this selector.
Generation of a standard source skeleton, if
"fc" is a valid frame channel, is made with the
VFrameChannel::MakeSelector
method :
vega[]
fc->MakeSelector("selectorname");
This creates skeleton source code of a class
named "selectorname" in two files
selectorname.h
and
selectorname.C.
The file
selectorname.C
is the only relevant for the user.
The generated class has a few initially
empty methods that the user should fill :
void Begin(VFrameChannel
*fc) is called at the start of the
processing. This is a good place to prepare the processing, such as booking the
histograms.
Bool_t ProcessCut(FrameH*
frame) is called for each frame. If
the result returned is "FALSE", the next steps of processing are ignored for
this frame.
Bool_t ProcessFrame(FrameH*
frame) is called for each frame and
does the real processing.
void Terminate()
is called at end of processing. One
can display histograms here for
example.
Once the file
selectorname.C is customized, it becomes the argument of VFrameChannel::Process
:
this will interpret the file selectorname.C
and send it frames starting at GPS time 712345678.65, for a duration of 1300 s.
The last argument is an optional condition on the data. One can also compile the
script before processing :
vega[]
fc->Process("selectorname.C++");
will compile the file selectorname.C, load
it and process all the data available to the frame channel through
it.
When appending a single "+", the file will
be compiled and loaded, but subsequent compilations will only be done if the
file has changed since the last compilation.