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 */
7 /// @file AliHLTGlobalTrigger.h
8 /// @author Artur Szostak <artursz@iafrica.com>
10 /// @brief Declaration of the AliHLTGlobalTrigger base class.
13 #include "TArrayL64.h"
14 #include "AliHLTDataTypes.h"
15 #include "AliHLTLogging.h"
17 class AliHLTTriggerDecision;
18 class AliHLTGlobalTriggerDecision;
21 * \class AliHLTGlobalTrigger
22 * This class is an abstract class. Classes which derive from this class should
23 * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class
24 * creates a class deriving from AliHLTGlobalTrigger on the fly to implement the
25 * trigger logic for that particular trigger menu.
27 class AliHLTGlobalTrigger
32 * Default constructor.
34 AliHLTGlobalTrigger();
39 virtual ~AliHLTGlobalTrigger();
42 * Abstract method to indicate that a new event is being processed and the
43 * internal buffers should be cleared or reset.
45 virtual void NewEvent() = 0;
48 * Abstract method which should fill in the internal attributes from the given
50 * \param decision The trigger decision to fill from.
52 virtual void Add(const AliHLTTriggerDecision* decision) = 0;
55 * Abstract method which should fill in the internal attributes from the given
57 * \param object The object to fill from.
58 * \param type The data block type the object was found in.
59 * \param spec The data block specification the object was found in.
62 const TObject* object,
63 const AliHLTComponentDataType& type,
68 * Abstract method that calculates the trigger decision
69 * \returns The global HLT trigger decision result.
71 virtual AliHLTGlobalTriggerDecision* CalculateTriggerDecision() = 0;
74 * Creates a new instance of a particular trigger class.
75 * \param name The name of the class to create.
76 * \returns the new trigger class instance which needs to be deleted by the
77 * caller with the delete operator.
79 static AliHLTGlobalTrigger* CreateNew(const char* name) { return Factory::CreateNew(name); }
84 * The factory object is used to create new instances of classes via the
85 * AliHLTGlobalTrigger::CreateNew method.
86 * A single static instance of a factory must be created by classes deriving
87 * from AliHLTGlobalTrigger so that AliHLTGlobalTrigger::CreateNew will work
90 class Factory : public AliHLTLogging
95 * Default constructor registers a class factory for the creation of new
96 * instances of classes deriving from AliHLTGlobalTrigger.
101 * The default destructor deregisters the factory from the class factory list.
106 * Creates a new instance of a particular trigger class.
107 * \param name The name of the class to create.
108 * \returns the new trigger class instance which needs to be deleted by the
109 * caller with the delete operator.
111 static AliHLTGlobalTrigger* CreateNew(const char* name);
114 * Returns the class name of the object returned by the New() method.
116 virtual const char* ClassName() const = 0;
119 * Creates and returns a new instance of a trigger class.
120 * The returned object should be deleted via the delete operator.
122 virtual AliHLTGlobalTrigger* New() const = 0;
126 enum {kMaxFactories = 8}; /// The maximum number of factories that can be registered.
128 static Factory* fFactory[kMaxFactories];
131 /// Not implemented. Do not allow copying of this object.
132 AliHLTGlobalTrigger(const AliHLTGlobalTrigger& obj);
133 /// Not implemented. Do not allow copying of this object.
134 AliHLTGlobalTrigger& operator = (const AliHLTGlobalTrigger& obj);
138 TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
140 ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
143 #endif // ALIHLTGLOBALTRIGGER_H