]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTCTPData.h
correcting const'ness of methods
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTCTPData.h
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTCTPDATA_H
5 #define ALIHLTCTPDATA_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTCTPData.h
11     @author Matthias Richter
12     @date   2009-08-20
13     @brief  Container for CTP trigger classes and counters
14 */
15
16 #include "TNamed.h"
17 #include "TClonesArray.h"
18 #include "TArrayL64.h"
19 #include "AliHLTLogging.h"
20 #include "AliHLTDataTypes.h"
21
22 /**
23  * @class AliHLTCTPData
24  * This is a container for the CTP trigger classes, the mapping to the bit
25  * field, and counters.
26  *
27  * The class is initialized from CTP_TRIGGER_CLASSES part of the ECS parameters.
28  * and stores internally a list of trigger classes holding the information on bit
29  * position, class name and involved detectors. The general format og the parameter
30  * is as follows:
31  * <pre>
32  * [bit position]:[Trigger class identifier string]:[detector-id-nr]-[detector-id-nr]-...,[bit position]:.....
33  * </pre>
34  *
35  * The list of participating detectors is converted into an AliHLTReadoutList
36  * object named after the trigger class name, and can be used as mask for the
37  * readout list generated by a component.
38  *
39  * The object is also stored as part of the HLTGlobalTriggerDecision
40  * @ingroup alihlt_trigger
41  */
42 class AliHLTCTPData: public TNamed, public AliHLTLogging
43 {
44  public:
45   /// default constructor
46   AliHLTCTPData();
47   /// standard constructor including initialization from CTP_TRIGGER_CLASS
48   AliHLTCTPData(const char* parameter);
49   /// copy constructor
50   AliHLTCTPData(const AliHLTCTPData&);
51   ///assignment operator
52   AliHLTCTPData& operator=(const AliHLTCTPData&);
53   /// destructor
54   virtual ~AliHLTCTPData();
55
56   /// Add counters
57   AliHLTCTPData& operator += (const AliHLTCTPData&);
58   /// Add counters
59   AliHLTCTPData operator + (const AliHLTCTPData&) const;
60
61   /// Subtract counters
62   AliHLTCTPData& operator -= (const AliHLTCTPData&);
63   /// Subtract counters
64   AliHLTCTPData operator - (const AliHLTCTPData&) const;
65
66   /**
67    * Init the class ids and mapping from the CTP_TRIGGER_CLASS parameter.
68    * The general format of the parameter is as follows:
69    */
70   int InitCTPTriggerClasses(const char* ctpString);
71
72   /// etract the active trigger mask from the trigger data
73   static AliHLTUInt64_t ActiveTriggers(const AliHLTComponentTriggerData& trigData);
74
75   /**
76    * Evaluate an expression of trigger class ids with respect to the trigger mask.
77    */
78   bool EvaluateCTPTriggerClass(const char* expression, AliHLTComponentTriggerData& trigData) const;
79
80   /**
81    * Reset all counters
82    */
83   void ResetCounters();
84
85   /**
86    * Get index of a trigger class in the tigger pattern
87    */
88   int Index(const char* name) const;
89
90   /**
91    * Increment counter for CTP trigger classes
92    * @param classIds  comma separated list of class ids
93    */
94   void Increment(const char* classIds);
95
96   /**
97    * Increment counter for CTP trigger classes
98    * @param triggerPattern  corresponds to the 50bit trigger mask in the CDH
99    */
100   void Increment(AliHLTUInt64_t triggerPattern);
101
102   /**
103    * Increment counter for a CTP trigger class
104    * @param classIdx  index of the class in the 50bit trigger mask
105    */
106   void Increment(int classIdx);
107
108   /**
109    * Increment counters according to the trigger data struct.
110    * First extract trigger pattern from the CDH and then
111    * increment from the trigger pattern.
112    */
113   int Increment(AliHLTComponentTriggerData& trigData);
114
115   /**
116    * Return a readout list for the active trigger classes.
117    * The list is an 'OR' of the active trugger classes.
118    */
119   AliHLTEventDDL ReadoutList(const AliHLTComponentTriggerData& trigData) const;
120
121   /**
122    * Inherited from TObject, this prints the contents of the trigger decision.
123    */
124   virtual void Print(Option_t* option = "") const;
125
126   AliHLTUInt64_t   Mask() const { return fMask; }
127   const TArrayL64& Counters() const { return fCounters; }
128   AliHLTUInt64_t   Counter(int index) const;
129   AliHLTUInt64_t   Counter(const char* classId) const;
130   const char*      Name(int index) const;
131
132  protected:
133  private:
134   /**
135    * Add counters.
136    * Base methods for operators.
137    * @param src    instance to add
138    * @param factor +1/-1 for addition/subtraction
139    * @skipped      target to get the numner of not matching class names
140    */
141   int Add(const AliHLTCTPData& src, int factor, int &skipped);
142
143   AliHLTUInt64_t fMask;      /// mask of initialized trigger classes
144   TClonesArray   fClassIds;  /// array of trigger class ids
145   TArrayL64      fCounters;  /// trigger class counters
146
147   ClassDef(AliHLTCTPData, 0)
148 };
149
150 #endif