Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DL3Trigger.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DL3Trigger.h
4 // Created: Wed Jul 31 14:34:24 EDT 2013
5 // Creator: davidl (on Darwin harriet.jlab.org 11.4.2 i386)
6 //
7 
8 #ifndef _DL3Trigger_
9 #define _DL3Trigger_
10 
11 #include <JANA/JObject.h>
12 #include <JANA/JFactory.h>
13 
14 class DL3Trigger:public jana::JObject{
15  public:
17 
18  /// The DL3Trigger object is used to tell the level-3 trigger process whether
19  /// or not to discard the event. The intent is for the algorithm to be contained
20  /// in the DL3Trigger_factory class which creates a single DL3Trigger object
21  /// for each event.
22  ///
23  /// The factory should set the 3 members of the DL3Trigger object based on its
24  /// results. The L3_decision value must be set to one of the values in the
25  /// L3_decision_t enum such as DL3Trigger::kDiscardEvent. An enum is used in
26  /// case additional states are needed later. The "status" member is a 64bit
27  /// word that will be written out with those events that are kept. The intent
28  /// is for this to hold a set of flags indicating the cause for the decision.
29  /// The meaning of the bits in therefore algorithm specific. Because of this,
30  /// a 3rd member "algorithm" is used to record which L3 algorithm (i.e. which
31  /// version) was used for this event. Recording this for each event is important
32  /// in case a set of filtered events from multiple runs are ever concatentated
33  /// into a single file.
34  ///
35  /// Different L3 algorithms can be developed, each in its own plugin. (The
36  /// DL3Trigger factory in the plugin takes precedence over one statically linked
37  /// into the executable.) To implement a L3 trigger algorithm, one should create
38  /// a plugin that contains a DL3Trigger factory object. You can do this using the
39  /// mkplugin_factory script that comes with JANA e.g.:
40  ///
41  /// mkfactory_plugin DL3Trigger
42  ///
43  /// This will create directory named "DL3Trigger" with skeleton files (including
44  /// a Makefile) that can be built into an appropriate plugin. Please note that
45  /// the generated code will need to be modified to use the existing DL3Trigger
46  /// class definitiong in DANA. Specifically:
47  ///
48  /// 1.) remove the skeleton DL3Trigger.h file
49  ///
50  /// 2.) Inside DL3Trigger_factory.h, replace
51  ///
52  /// #include "DL3Trigger.h"
53  ///
54  /// with
55  ///
56  /// #include <TRIGGER/DL3Trigger.h>
57  ///
58  /// The plugin name is taken as the name of the directory (in this case "DL3Trigger").
59  /// To change the name of the plugin, simply rename the DL3Trigger directory.
60  ///
61  /// Once the plugin is built use it with any DANA program in the standard way:
62  ///
63  /// e.g.
64  ///
65  /// hd_ana -PPLUGINS=DL3Trigger ....
66  ///
67 
72  };
73 
76 
77  L3_decision_t L3_decision; // keep event or not?
78  uint64_t status; // algorithm specific status bits
79  uint32_t algorithm; // unique identifier for this algorithm
80  double mva_response; // response of MVA algorithm
81 
82 
83  // This method is used primarily for pretty printing
84  // the second argument to AddString is printf style format
85  void toStrings(vector<pair<string,string> > &items)const{
86  AddString(items, "L3_decision", "%d", L3_decision);
87  AddString(items, "status", "0x%16x", status);
88  AddString(items, "algorithm", "0x%8x", algorithm);
89  }
90 
91 };
92 
93 #endif // _DL3Trigger_
94 
L3_decision_t
The DL3Trigger object is used to tell the level-3 trigger process whether or not to discard the event...
Definition: DL3Trigger.h:68
JOBJECT_PUBLIC(DL3Trigger)
void toStrings(vector< pair< string, string > > &items) const
Definition: DL3Trigger.h:85
uint64_t status
Definition: DL3Trigger.h:78
double mva_response
Definition: DL3Trigger.h:80
uint32_t algorithm
Definition: DL3Trigger.h:79
DL3Trigger(L3_decision_t L3_decision=kNO_DECISION, uint64_t status=0L, uint32_t algorithm=0)
Definition: DL3Trigger.h:74
L3_decision_t L3_decision
Definition: DL3Trigger.h:77