]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTCTPData.h
Removed depricted histograms ... cleanup
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTCTPData.h
CommitLineData
1dbbd625 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"
89413559 21#include "AliHLTReadoutList.h"
22
1dbbd625 23
24/**
25 * @class AliHLTCTPData
26 * This is a container for the CTP trigger classes, the mapping to the bit
27 * field, and counters.
28 *
1462df14 29 * The class is initialized from CTP_TRIGGER_CLASSES part of the ECS parameters.
30 * and stores internally a list of trigger classes holding the information on bit
31 * position, class name and involved detectors. The general format og the parameter
32 * is as follows:
33 * <pre>
34 * [bit position]:[Trigger class identifier string]:[detector-id-nr]-[detector-id-nr]-...,[bit position]:.....
35 * </pre>
36 *
37 * The list of participating detectors is converted into an AliHLTReadoutList
38 * object named after the trigger class name, and can be used as mask for the
39 * readout list generated by a component.
40 *
1dbbd625 41 * The object is also stored as part of the HLTGlobalTriggerDecision
42 * @ingroup alihlt_trigger
43 */
44class AliHLTCTPData: public TNamed, public AliHLTLogging
45{
46 public:
47 /// default constructor
48 AliHLTCTPData();
49 /// standard constructor including initialization from CTP_TRIGGER_CLASS
50 AliHLTCTPData(const char* parameter);
59be6254 51 /// copy constructor
52 AliHLTCTPData(const AliHLTCTPData&);
53 ///assignment operator
54 AliHLTCTPData& operator=(const AliHLTCTPData&);
1dbbd625 55 /// destructor
56 virtual ~AliHLTCTPData();
57
59be6254 58 /// Add counters
59 AliHLTCTPData& operator += (const AliHLTCTPData&);
60 /// Add counters
61 AliHLTCTPData operator + (const AliHLTCTPData&) const;
62
63 /// Subtract counters
64 AliHLTCTPData& operator -= (const AliHLTCTPData&);
65 /// Subtract counters
66 AliHLTCTPData operator - (const AliHLTCTPData&) const;
67
1dbbd625 68 /**
69 * Init the class ids and mapping from the CTP_TRIGGER_CLASS parameter.
70 * The general format of the parameter is as follows:
71 */
72 int InitCTPTriggerClasses(const char* ctpString);
73
e5339167 74 /// etract the active trigger mask from the trigger data
75 static AliHLTUInt64_t ActiveTriggers(const AliHLTComponentTriggerData& trigData);
76
1dbbd625 77 /**
78 * Evaluate an expression of trigger class ids with respect to the trigger mask.
79 */
edd72347 80 bool EvaluateCTPTriggerClass(const char* expression, const AliHLTComponentTriggerData& trigData) const;
81
82 /**
83 * Evaluate an expression of trigger class ids with respect to the trigger mask.
84 */
85 bool EvaluateCTPTriggerClass(const char* expression, AliHLTUInt64_t triggerMask) const;
86
87 /**
88 * Evaluate an expression of trigger class ids with respect to the current trigger mask.
89 */
90 bool EvaluateCTPTriggerClass(const char* expression) const {
91 return EvaluateCTPTriggerClass(expression, fTriggers);
92 }
1dbbd625 93
94 /**
95 * Reset all counters
96 */
97 void ResetCounters();
98
99 /**
100 * Get index of a trigger class in the tigger pattern
101 */
102 int Index(const char* name) const;
103
ffda78e3 104 /**
105 * Check state of a trigger class.
106 * If the class name is not part of the current trigger setup (i.e. ECS parameter
107 * does not contain a trigger definition for this class name) the function
108 * returns -1
109 * @return -1 class name not initialized,
110 * 0 trigger not active
111 * 1 trigger active
112 */
113 int CheckTrigger(const char* name) const;
114
1dbbd625 115 /**
116 * Increment counter for CTP trigger classes
117 * @param classIds comma separated list of class ids
118 */
119 void Increment(const char* classIds);
120
121 /**
122 * Increment counter for CTP trigger classes
123 * @param triggerPattern corresponds to the 50bit trigger mask in the CDH
124 */
125 void Increment(AliHLTUInt64_t triggerPattern);
126
127 /**
128 * Increment counter for a CTP trigger class
129 * @param classIdx index of the class in the 50bit trigger mask
130 */
131 void Increment(int classIdx);
132
133 /**
134 * Increment counters according to the trigger data struct.
135 * First extract trigger pattern from the CDH and then
136 * increment from the trigger pattern.
137 */
138 int Increment(AliHLTComponentTriggerData& trigData);
139
1462df14 140 /**
141 * Return a readout list for the active trigger classes.
142 * The list is an 'OR' of the active trugger classes.
143 */
89413559 144 AliHLTReadoutList ReadoutList(const AliHLTComponentTriggerData& trigData) const;
1462df14 145
f11febe7 146 /**
147 * Return a readout list for the active trigger classes.
148 * The list is an 'OR' of the active trugger classes.
149 */
89413559 150 AliHLTReadoutList ReadoutList(AliHLTUInt64_t triggerMask) const;
f11febe7 151
152 /**
153 * Return a readout list for the active trigger classes.
154 * The list is an 'OR' of the active trugger classes.
155 */
89413559 156 AliHLTReadoutList ReadoutList() const {
f11febe7 157 return ReadoutList(fTriggers);
158 }
159
1dbbd625 160 /**
161 * Inherited from TObject, this prints the contents of the trigger decision.
162 */
163 virtual void Print(Option_t* option = "") const;
164
165 AliHLTUInt64_t Mask() const { return fMask; }
edd72347 166 AliHLTUInt64_t Triggers() const { return fTriggers; }
167 void SetTriggers(AliHLTUInt64_t triggers) { fTriggers=triggers; }
168 void SetTriggers(AliHLTComponentTriggerData trigData) {SetTriggers(ActiveTriggers(trigData));}
1dbbd625 169 const TArrayL64& Counters() const { return fCounters; }
170 AliHLTUInt64_t Counter(int index) const;
171 AliHLTUInt64_t Counter(const char* classId) const;
172 const char* Name(int index) const;
173
174 protected:
175 private:
59be6254 176 /**
177 * Add counters.
178 * Base methods for operators.
179 * @param src instance to add
180 * @param factor +1/-1 for addition/subtraction
181 * @skipped target to get the numner of not matching class names
182 */
183 int Add(const AliHLTCTPData& src, int factor, int &skipped);
1dbbd625 184
ffda78e3 185 /**
186 * Read the map of trigger class indexes
187 * The map is used in the generation of the TFormula from the trigger
188 * expression in order to handle similar class names correctly.
189 * For names like 'base', 'baseA', 'baseB' the class with the longer name
190 * has to be replaced first.
191 */
192 int ReadMap(vector<unsigned> &map) const;
193
194 int ReadMap() {return ReadMap(fMap);}
195
1dbbd625 196 AliHLTUInt64_t fMask; /// mask of initialized trigger classes
edd72347 197 AliHLTUInt64_t fTriggers; /// current trigger
1dbbd625 198 TClonesArray fClassIds; /// array of trigger class ids
199 TArrayL64 fCounters; /// trigger class counters
ffda78e3 200 vector<unsigned> fMap; //! index map for trigger expression evaluation
1dbbd625 201
ffda78e3 202 ClassDef(AliHLTCTPData, 2)
1dbbd625 203};
204
205#endif