Project

General

Profile

Event Type Handlers » History » Version 1

Ole Hansen, 04/05/2018 09:47 AM

1 1 Ole Hansen
h1. Event Type Handlers
2
3
Bob Michaels,     updated March 30, 2016
4
5
An Event Type Handler is an Analysis Object which can handle, i.e. process, the data from a set of event types. During the course of an analysis session, each event type handler has its "Init" method called at the start, an "End" method called at the end, and an "Analyze" method called for each event. The Analyze method is given the @THaEvData@ event data.
6
7
The base class is @THaEvtTypeHandler@. At the moment, I've written two classes which inherit from this, namely @THaScalerEvtHandler@ and @THaEpicsEvtHandler@, which may be used as examples to write your own. Note that @THaEvtTypeHandler@ inherits from @THaAnalysisObject@, which means it can use the @THaAnalysisObject@ methods such as reading from a database. A database is used by the @THaScalerEvtHandler@, for example.
8
9
An event type handler can be added to the analysis by invoking lines like this in your analysis script:
10
11
<pre><code class="cpp">
12
THaScalerEvtHandler *lscaler = new THaScalerEvtHandler("Left","HA scaler event type 140");
13
gHaEvtHandlers->Add (lscaler);
14
</code></pre>
15
16
In the Init method, your event type handler should create the list of event types to analyze, e.g.
17
18
<pre><code class="cpp">
19
eventtypes.push_back(140);  // what event(s) to look for
20
</code></pre>
21
22
Here are some notes about the usage of the @THaScalerEvtHandler@.
23
24
If you are familiar with putting event type 140 scaler data into output trees that has not changed much except that the scaler event handler uses a database file, sometimes referred to as the scaler map file, e.g. ``db_LeftScalevt.dat''. This database defines two things: (1) the map of where the scalers are in VME, and (2) the variables and how they correspond to the slots and channels. The variable names defined in this map file are automatically added to a ROOT tree for just the data from this class. In addition, those variables become global variables in Podd and therefore can be added to the standard ``T'' Tree using the "variable" line in the output definition file (see [[Output]]).
25
26
<pre>
27
# Example of db_LeftScalevt.dat database file
28
# map line starts with "map".  Then model#, crate, slot, header, mask, norm slot
29
# If >7 fields it's a norm slot and last 2 are clock chan#, clock frequency
30
map 1151 1 0 abc00000 ffff0000 1
31
map 3800 1 2 abc10000 ffff0000 1 7 1024
32
# variables become global variables and appear in an output tree
33
# "variable" slot, chan, (1=cnt, 2=rate), variable name, description
34
variable 2 4 1  TSbcmu1  BCM x1 counts
35
variable 2 4 2  TSbcmu1r  BCM x1 rate
36
</pre>
37
38
Finally, to do something with scalers that appear with events of type 1 to 14, i.e. triggered by the trigger supervisor, somebody should write a new event type handler. I think that Hall C is doing that.
39
40
A note about EPICS data.
41
42
The interface to users has not changed, in terms of how to define the EPICS variables and put them into the Podd output. @THaEpicsEvtHandler@ is a permanent member of @THaAnalyzer@ and provides the ROOT output. Even though the mechanism ``under the hood'' is quite different now, the interface and the results are the same.