StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gl3Algorithm.h
1 //:>------------------------------------------------------------------
2 //: FILE: gl3Algorithm.h
3 //: HISTORY:
4 //: 1feb2000 version 1.00
5 //: 31jul2000 add methods initRun, endRun, end
6 //:<------------------------------------------------------------------
7 //
8 // tom: This class implements the "housekeeping"-issues common to
9 // all Algorithms: counters, pre-/postscaling, parameter handling,
10 // generation of L3 summary data.
11 //
12 // Any implementation of an L3 algorithm must inherit from this class.
13 //
14 //------------------------------------------------------------------
15 
16 #ifndef GL3ALGORITHM
17 #define GL3ALGORITHM
18 
19 #include "Stl3Util/gl3/gl3Event.h"
20 #include "Stl3Util/gl3/gl3Histo.h"
21 
22 //#include "foreign/daqFormats.h"
23 #include "Stl3Util/foreign/L3/L3Algorithms.h"
24 
25 #include <stdio.h>
26 #include <math.h>
27 
28 
29 class gl3Algorithm {
30  public:
31 
32  gl3Algorithm();
33  virtual ~gl3Algorithm();
34 
35  virtual int init();
36  virtual int end();
37 
38  int process (gl3Event* event_in);
39  void incrementCounters();
40 
41  virtual int setParameters(int, int, int, int, int,
42  float, float, float, float, float);
43  void setScaling(int preScale, int postScale);
44 
45  void fillSummary(struct algorithm_data *dest);
46 
47  virtual const int getAlgorithmID() = 0;
48  virtual const char *getAlgorithmName() = 0;
49 
50  protected:
51  virtual int decide () = 0;
52  int priority; // 1 = soft trigger (EVB can drop the event to save bandwidth)
53  // 2 = hard trigger (EVB will write in any case)
54 
55 
56  // Pointer to L3_P containing the event data
57  gl3Event * event;
58 
59  // Parameters from run control
60  int GI1, GI2, GI3, GI4, GI5;
61  float GF1, GF2, GF3, GF4, GF5;
62 
63  // Algorithm summary data to be stored in algorithm_data
64  // Filled by decide()
65  float SummaryData[10];
66 
67 
68  public:
69  void showConfiguration();
70 
71 
72 
73  private:
74 
75  void resetCounters();
76 
77  typedef int counter_type;
78 
79  counter_type preScale_cnt;
80  counter_type call_cnt;
81  counter_type accept_cnt;
82  counter_type build_cnt;
83 
84  int preScale;
85  int postScale;
86 
87  char on, accept, build;
88 };
89 
90 gl3Algorithm *gl3InstantiateAlgorithm(int algID);
91 
92 
93 #endif