]>
Commit | Line | Data |
---|---|---|
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" | |
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 | * | |
1462df14 | 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 | * | |
1dbbd625 | 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); | |
59be6254 | 49 | /// copy constructor |
50 | AliHLTCTPData(const AliHLTCTPData&); | |
51 | ///assignment operator | |
52 | AliHLTCTPData& operator=(const AliHLTCTPData&); | |
1dbbd625 | 53 | /// destructor |
54 | virtual ~AliHLTCTPData(); | |
55 | ||
59be6254 | 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 | ||
1dbbd625 | 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 | /** | |
73 | * Evaluate an expression of trigger class ids with respect to the trigger mask. | |
74 | */ | |
75 | bool EvaluateCTPTriggerClass(const char* expression, AliHLTComponentTriggerData& trigData) const; | |
76 | ||
77 | /** | |
78 | * Reset all counters | |
79 | */ | |
80 | void ResetCounters(); | |
81 | ||
82 | /** | |
83 | * Get index of a trigger class in the tigger pattern | |
84 | */ | |
85 | int Index(const char* name) const; | |
86 | ||
87 | /** | |
88 | * Increment counter for CTP trigger classes | |
89 | * @param classIds comma separated list of class ids | |
90 | */ | |
91 | void Increment(const char* classIds); | |
92 | ||
93 | /** | |
94 | * Increment counter for CTP trigger classes | |
95 | * @param triggerPattern corresponds to the 50bit trigger mask in the CDH | |
96 | */ | |
97 | void Increment(AliHLTUInt64_t triggerPattern); | |
98 | ||
99 | /** | |
100 | * Increment counter for a CTP trigger class | |
101 | * @param classIdx index of the class in the 50bit trigger mask | |
102 | */ | |
103 | void Increment(int classIdx); | |
104 | ||
105 | /** | |
106 | * Increment counters according to the trigger data struct. | |
107 | * First extract trigger pattern from the CDH and then | |
108 | * increment from the trigger pattern. | |
109 | */ | |
110 | int Increment(AliHLTComponentTriggerData& trigData); | |
111 | ||
1462df14 | 112 | /** |
113 | * Return a readout list for the active trigger classes. | |
114 | * The list is an 'OR' of the active trugger classes. | |
115 | */ | |
116 | AliHLTEventDDL ReadoutList(const AliHLTComponentTriggerData& trigData) const; | |
117 | ||
1dbbd625 | 118 | /** |
119 | * Inherited from TObject, this prints the contents of the trigger decision. | |
120 | */ | |
121 | virtual void Print(Option_t* option = "") const; | |
122 | ||
123 | AliHLTUInt64_t Mask() const { return fMask; } | |
124 | const TArrayL64& Counters() const { return fCounters; } | |
125 | AliHLTUInt64_t Counter(int index) const; | |
126 | AliHLTUInt64_t Counter(const char* classId) const; | |
127 | const char* Name(int index) const; | |
128 | ||
129 | protected: | |
130 | private: | |
59be6254 | 131 | /** |
132 | * Add counters. | |
133 | * Base methods for operators. | |
134 | * @param src instance to add | |
135 | * @param factor +1/-1 for addition/subtraction | |
136 | * @skipped target to get the numner of not matching class names | |
137 | */ | |
138 | int Add(const AliHLTCTPData& src, int factor, int &skipped); | |
1dbbd625 | 139 | |
140 | AliHLTUInt64_t fMask; /// mask of initialized trigger classes | |
141 | TClonesArray fClassIds; /// array of trigger class ids | |
142 | TArrayL64 fCounters; /// trigger class counters | |
143 | ||
144 | ClassDef(AliHLTCTPData, 0) | |
145 | }; | |
146 | ||
147 | #endif |