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 */
9 /// @file AliHLTGlobalTrigger.h
10 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @brief Declaration of the AliHLTGlobalTrigger base class.
15 #include "TArrayL64.h"
16 #include "AliHLTDataTypes.h"
17 #include "AliHLTLogging.h"
19 class AliHLTTriggerDomain;
20 class AliHLTTriggerDecision;
21 class AliHLTGlobalTriggerDecision;
22 class AliHLTTriggerMenu;
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.
32 class AliHLTGlobalTrigger : public AliHLTLogging
37 * Default constructor.
39 AliHLTGlobalTrigger();
44 virtual ~AliHLTGlobalTrigger();
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.
51 virtual void FillFromMenu(const AliHLTTriggerMenu& menu) = 0;
54 * Abstract method to indicate that a new event is being processed and the
55 * internal buffers should be cleared or reset.
57 virtual void NewEvent() = 0;
60 * Abstract method which should fill in the internal attributes from the given
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.
67 const TObject* object,
68 const AliHLTComponentDataType& type,
73 * Abstract method that calculates the trigger decision
74 * \param domain The resultant trigger domain for the global HLT result.
75 * \param description The resultant description for the global HLT result.
76 * \returns The global HLT trigger decision result.
78 virtual bool CalculateTriggerDecision(AliHLTTriggerDomain& domain, TString& description) = 0;
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.
86 static AliHLTGlobalTrigger* CreateNew(const char* name) { return Factory::CreateNew(name); }
89 * Sets the number of trigger counters and resets them all to zero.
90 * \param number The number of counters to use.
92 void ResetCounters(UInt_t number = 0);
95 * Returns the array of trigger counters.
97 const TArrayL64& Counters() const { return fCounters; }
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
108 class Factory : public AliHLTLogging
113 * Default constructor registers a class factory for the creation of new
114 * instances of classes deriving from AliHLTGlobalTrigger.
119 * The default destructor deregisters the factory from the class factory list.
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.
129 static AliHLTGlobalTrigger* CreateNew(const char* name);
132 * Returns the class name of the object returned by the New() method.
134 virtual const char* ClassName() const = 0;
137 * Creates and returns a new instance of a trigger class.
138 * The returned object should be deleted via the delete operator.
140 virtual AliHLTGlobalTrigger* New() const = 0;
144 enum {kMaxFactories = 8}; /// The maximum number of factories that can be registered.
146 static Factory* fFactory[kMaxFactories];
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);
155 * Increments a trigger counter by one.
156 * \param i The counter to increment.
158 void IncrementCounter(UInt_t i) { ++fCounters[i]; };
161 * Returns a trigger counter's value.
162 * \param i The counter number to return.
164 Long64_t GetCounter(UInt_t i) const { return fCounters[i]; };
168 TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
170 ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
173 #endif // ALIHLTGLOBALTRIGGER_H