]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTrigger.h
Adding the trigger menu for the HLT global trigger.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTrigger.h
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
17 class AliHLTTriggerDecision;
18 class AliHLTGlobalTriggerDecision;
19
20 /**
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.
26  */
27 class AliHLTGlobalTrigger
28 {
29  public:
30   
31   /**
32    * Default constructor.
33    */
34   AliHLTGlobalTrigger();
35   
36   /**
37    * Default destructor.
38    */
39   virtual ~AliHLTGlobalTrigger();
40   
41   /**
42    * Abstract method to indicate that a new event is being processed and the
43    * internal buffers should be cleared or reset.
44    */
45   virtual void NewEvent() = 0;
46   
47   /**
48    * Abstract method which should fill in the internal attributes from the given
49    * trigger decision.
50    * \param  decision  The trigger decision to fill from.
51    */
52   virtual void Add(const AliHLTTriggerDecision* decision) = 0;
53   
54   /**
55    * Abstract method which should fill in the internal attributes from the given
56    * object.
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.
60    */
61   virtual void Add(
62       const TObject* object,
63       const AliHLTComponentDataType& type,
64       AliHLTUInt32_t spec
65     ) = 0;
66   
67   /**
68    * Abstract method that calculates the trigger decision
69    * \returns The global HLT trigger decision result.
70    */
71   virtual AliHLTGlobalTriggerDecision* CalculateTriggerDecision() = 0;
72   
73   /**
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.
78    */
79   static AliHLTGlobalTrigger* CreateNew(const char* name) { return Factory::CreateNew(name); }
80   
81  protected:
82   
83   /**
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
88    * properly.
89    */
90   class Factory : public AliHLTLogging
91   {
92    public:
93     
94     /**
95      * Default constructor registers a class factory for the creation of new
96      * instances of classes deriving from AliHLTGlobalTrigger.
97      */
98     Factory();
99     
100     /**
101      * The default destructor deregisters the factory from the class factory list.
102      */
103     ~Factory();
104     
105     /**
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.
110      */
111     static AliHLTGlobalTrigger* CreateNew(const char* name);
112     
113     /**
114      * Returns the class name of the object returned by the New() method.
115      */
116     virtual const char* ClassName() const = 0;
117     
118     /**
119      * Creates and returns a new instance of a trigger class.
120      * The returned object should be deleted via the delete operator.
121      */
122     virtual AliHLTGlobalTrigger* New() const = 0;
123     
124    private:
125     
126     enum {kMaxFactories = 8}; /// The maximum number of factories that can be registered.
127     
128     static Factory* fFactory[kMaxFactories];
129   };
130   
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);
135   
136  private:
137   
138   TArrayL64 fCounters; //! Event trigger counters. One counter for each trigger class.
139   
140   ClassDef(AliHLTGlobalTrigger, 0) // Global HLT trigger base class which implements logic for a particular trigger menu.
141 };
142
143 #endif // ALIHLTGLOBALTRIGGER_H
144