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