]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTGlobalTrigger.h
Finished code for global HLT trigger and the trigger menu implementation.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTrigger.h
CommitLineData
e2bb8ddd 1#ifndef ALIHLTGLOBALTRIGGER_H
2#define ALIHLTGLOBALTRIGGER_H
3/* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/// @file AliHLTGlobalTrigger.h
8/// @author Artur Szostak <artursz@iafrica.com>
9/// @date 19 Dec 2008
10/// @brief Declaration of the AliHLTGlobalTrigger base class.
11
12#include "TObject.h"
13#include "TArrayL64.h"
14#include "AliHLTDataTypes.h"
15#include "AliHLTLogging.h"
16
52f67e50 17class AliHLTTriggerDomain;
e2bb8ddd 18class AliHLTTriggerDecision;
19class AliHLTGlobalTriggerDecision;
52f67e50 20class AliHLTTriggerMenu;
21class TClonesArray;
e2bb8ddd 22
23/**
24 * \class AliHLTGlobalTrigger
25 * This class is an abstract class. Classes which derive from this class should
26 * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class
27 * creates a class deriving from AliHLTGlobalTrigger on the fly to implement the
28 * trigger logic for that particular trigger menu.
29 */
52f67e50 30class AliHLTGlobalTrigger : public AliHLTLogging
e2bb8ddd 31{
32 public:
33
34 /**
35 * Default constructor.
36 */
37 AliHLTGlobalTrigger();
38
39 /**
40 * Default destructor.
41 */
42 virtual ~AliHLTGlobalTrigger();
43
44 /**
52f67e50 45 * Abstract method to fill values from a trigger menu. Specifically, the description
46 * strings and domain entry values will be copied over.
47 * \param menu The trigger menu to fill from.
e2bb8ddd 48 */
52f67e50 49 virtual void FillFromMenu(const AliHLTTriggerMenu& menu) = 0;
e2bb8ddd 50
51 /**
52f67e50 52 * Abstract method to indicate that a new event is being processed and the
53 * internal buffers should be cleared or reset.
e2bb8ddd 54 */
52f67e50 55 virtual void NewEvent() = 0;
e2bb8ddd 56
57 /**
58 * Abstract method which should fill in the internal attributes from the given
59 * object.
60 * \param object The object to fill from.
61 * \param type The data block type the object was found in.
62 * \param spec The data block specification the object was found in.
63 */
64 virtual void Add(
65 const TObject* object,
66 const AliHLTComponentDataType& type,
67 AliHLTUInt32_t spec
68 ) = 0;
69
70 /**
71 * Abstract method that calculates the trigger decision
52f67e50 72 * \param domain The resultant trigger domain for the global HLT result.
73 * \param description The resultant description for the global HLT result.
e2bb8ddd 74 * \returns The global HLT trigger decision result.
75 */
52f67e50 76 virtual bool CalculateTriggerDecision(AliHLTTriggerDomain& domain, TString& description) = 0;
e2bb8ddd 77
78 /**
79 * Creates a new instance of a particular trigger class.
80 * \param name The name of the class to create.
81 * \returns the new trigger class instance which needs to be deleted by the
82 * caller with the delete operator.
83 */
84 static AliHLTGlobalTrigger* CreateNew(const char* name) { return Factory::CreateNew(name); }
85
52f67e50 86 /**
87 * Sets the number of trigger counters and resets them all to zero.
88 * \param number The number of counters to use.
89 */
90 void ResetCounters(UInt_t number = 0);
91
92 /**
93 * Returns the array of trigger counters.
94 */
95 const TArrayL64& Counters() const { return fCounters; }
96
e2bb8ddd 97 protected:
98
99 /**
100 * The factory object is used to create new instances of classes via the
101 * AliHLTGlobalTrigger::CreateNew method.
102 * A single static instance of a factory must be created by classes deriving
103 * from AliHLTGlobalTrigger so that AliHLTGlobalTrigger::CreateNew will work
104 * properly.
105 */
106 class Factory : public AliHLTLogging
107 {
108 public:
109
110 /**
111 * Default constructor registers a class factory for the creation of new
112 * instances of classes deriving from AliHLTGlobalTrigger.
113 */
114 Factory();
115
116 /**
117 * The default destructor deregisters the factory from the class factory list.
118 */
119 ~Factory();
120
121 /**
122 * Creates a new instance of a particular trigger class.
123 * \param name The name of the class to create.
124 * \returns the new trigger class instance which needs to be deleted by the
125 * caller with the delete operator.
126 */
127 static AliHLTGlobalTrigger* CreateNew(const char* name);
128
129 /**
130 * Returns the class name of the object returned by the New() method.
131 */
132 virtual const char* ClassName() const = 0;
133
134 /**
135 * Creates and returns a new instance of a trigger class.
136 * The returned object should be deleted via the delete operator.
137 */
138 virtual AliHLTGlobalTrigger* New() const = 0;
139
140 private:
141
142 enum {kMaxFactories = 8}; /// The maximum number of factories that can be registered.
143
144 static Factory* fFactory[kMaxFactories];
145 };
146
147 /// Not implemented. Do not allow copying of this object.
148 AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
149 /// Not implemented. Do not allow copying of this object.
150 AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
151
52f67e50 152 /**
153 * Increments a trigger counter by one.
154 * \param i The counter to increment.
155 */
156 void IncrementCounter(UInt_t i) { ++fCounters[i]; };
157
158 /**
159 * Returns a trigger counter's value.
160 * \param i The counter number to return.
161 */
162 Long64_t GetCounter(UInt_t i) const { return fCounters[i]; };
163
e2bb8ddd 164 private:
165
166 TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
167
168 ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
169};
170
171#endif // ALIHLTGLOBALTRIGGER_H
172