1 #ifndef ALIHLTREADOUTLIST_H
2 #define ALIHLTREADOUTLIST_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 AliHLTReadoutList.h
8 /// @author Artur Szostak <artursz@iafrica.com>
10 /// @brief Declaration of the AliHLTReadoutList class used to handle AliHLTEventDDL structures.
13 #include "AliHLTDataTypes.h"
16 * \class AliHLTReadoutList
17 * This class is used as an interface or wrapper to the AliHLTEventDDL structure.
18 * It makes it easy to manipulate the bits in this structure, which define what DDLs
19 * should be readout by DAQ.
20 * Several operators are also overloaded which are meant to be used in the trigger
21 * menu specification for the AliHLTGlobalTrigger. It allows one to construct
22 * expressions for the readout lists, which is necessary to be able to evaluate
23 * or compose the final readout list, given multiple input readout lists received
24 * from individual components that derive from AliHLTTrigger.
25 * The operators implemented are:
26 * | applies a bitwise or on the DDL bits.
27 * & applies a bitwise and on the DDL bits.
28 * ^ applies a bitwise xor on the DDL bits.
29 * ~ applies a bitwise not on the DDL bits.
30 * + synonym for the '|' operator.
31 * - unsets the bits in readout list A that are set in readout list B.
32 * This effectively applies A & (A ^ B).
34 class AliHLTReadoutList : public TObject
39 * Identifiers for different detectors used by methods in AliHLTReadoutList.
43 kITSSPD = 0x1 << 0, /// ID for SPD detector
44 kITSSDD = 0x1 << 1, /// ID for SDD detector
45 kITSSSD = 0x1 << 2, /// ID for SSD detector
46 kTPC = 0x1 << 3, /// ID for TPC detector
47 kTRD = 0x1 << 4, /// ID for TRD detector
48 kTOF = 0x1 << 5, /// ID for TOF detector
49 kHMPID = 0x1 << 6, /// ID for HMPID detector
50 kPHOS = 0x1 << 7, /// ID for PHOS detector
51 kCPV = 0x1 << 8, /// ID for CPV detector
52 kPMD = 0x1 << 9, /// ID for PMD detector
53 kMUONTRK = 0x1 << 10, /// ID for MUON tracking chambers
54 kMUONTRG = 0x1 << 11, /// ID for MUON trigger detector
55 kFMD = 0x1 << 12, /// ID for FMD detector
56 kT0 = 0x1 << 13, /// ID for T0 detector
57 kV0 = 0x1 << 14, /// ID for V0 detector
58 kZDC = 0x1 << 15, /// ID for ZDC detector
59 kACORDE = 0x1 << 16, /// ID for ACORDE detector
60 kTRG = 0x1 << 17, /// ID for TRG detector
61 kEMCAL = 0x1 << 18, /// ID for EMCAL detector
62 kDAQTEST = 0x1 << 19, /// ID for DAQ_TEST detector
63 kHLT = 0x1 << 30, /// ID for HLT detector
64 // kALLDET sets readout for all detectors except DAQ_TEST
65 kALLDET = (kITSSPD | kITSSDD | kITSSSD | kTPC | kTRD | kTOF | kHMPID | kPHOS
66 | kCPV | kPMD | kMUONTRK | kMUONTRG | kFMD | kT0 | kV0 | kZDC
67 | kACORDE | kTRG | kEMCAL | kHLT)
71 * Default constructor.
76 * Constructor to select which detectors to enable for readout.
77 * \param enabledDetectors Detector bit field. Can be any values for
78 * EDetectorId or'ed together.
80 AliHLTReadoutList(Int_t enabledDetectors);
83 * Constructor to select which detectors and DDLs to enable for readout.
84 * \param enabledList The string format is a space separated list where
85 * each item is either a detector acronym name or DDL number.
86 * Invalid sub-strings are simply ignored. The special ALL string is
87 * equivalent to kALLDET for AliHLTReadoutList(Int_t enabledDetectors).
89 AliHLTReadoutList(const char* enabledList);
92 * Constructor to create readout list from AliHLTEventDDL structure.
93 * \param list The AliHLTEventDDL structure from which to create this object.
95 AliHLTReadoutList(const AliHLTEventDDL& list);
98 * The copy constructor performs a deep copy.
99 * \param list The readout list to copy from.
101 AliHLTReadoutList(const AliHLTReadoutList& list);
104 * Default destructor.
106 virtual ~AliHLTReadoutList();
109 * Enables a specific DDL bit in the readout list.
110 * \param ddlId The ID number of the DDL to enable.
112 void EnableDDLBit(Int_t ddlId)
114 SetDDLBit(ddlId, kTRUE);
118 * Disables a specific DDL bit in the readout list.
119 * \param ddlId The ID number of the DDL to disable.
121 void DisableDDLBit(Int_t ddlId)
123 SetDDLBit(ddlId, kFALSE);
127 * Fetches the bit value for a particular DDL in the readout list.
128 * \param ddlId The ID number of the DDL to fetch.
129 * \return the bit value for the specified DDL.
131 Bool_t GetDDLBit(Int_t ddlId) const;
134 * Sets the bit value for a particular DDL in the readout list.
135 * \param ddlId The ID number of the DDL to set.
136 * \param state The value to set the bit to.
138 void SetDDLBit(Int_t ddlId, Bool_t state);
141 * Checks if a particular DDL is enabled for readout.
142 * \param ddlId The ID number of the DDL to check.
143 * \return the if the DDL is enabled for readout.
145 bool IsDDLEnabled(Int_t ddlId) const
147 return GetDDLBit(ddlId) == kTRUE;
151 * Checks if a particular DDL is disabled for readout.
152 * \param ddlId The ID number of the DDL to check.
153 * \return the if the DDL is disabled for readout.
155 bool IsDDLDisabled(Int_t ddlId) const
157 return GetDDLBit(ddlId) == kFALSE;
161 * Enables all DDLs for a particular detector or detectors.
162 * \param detector A bitmap of detectors to enable. Should be any values from
163 * EDetectorId that can be or'ed together for multiple detector selection.
165 void Enable(Int_t detector);
168 * Disables all DDLs for a particular detector or detectors.
169 * \param detector A bitmap of detectors to disable. Should be any values from
170 * EDetectorId that can be or'ed together for multiple detector selection.
172 void Disable(Int_t detector);
175 * Inherited from TObject. Prints the DDLs that will be readout according to
177 * \param option This is not used by this method.
179 virtual void Print(Option_t* option = "") const;
182 * This typecast operator converts the readout list to the AliHLTEventDDL
184 * \return Copy of the AliHLTEventDDL raw structure.
186 operator AliHLTEventDDL () const { return fReadoutList; }
189 * This typecast operator converts the readout list to the AliHLTEventDDL
191 * \return Reference to the AliHLTEventDDL raw structure.
193 operator AliHLTEventDDL& () { return fReadoutList; }
196 * Assignment operator performs a deep copy.
197 * \param list The readout list to copy from.
198 * \return A reference to this object.
200 AliHLTReadoutList& operator = (const AliHLTReadoutList& list);
203 * This operator performs a bitwise inclusive or operation on all DDL bits
204 * between this readout and <i>list</i>.
205 * \param list The right hand side readout list to operate on.
206 * \return A reference to this object.
208 AliHLTReadoutList& operator |= (const AliHLTReadoutList& list);
211 * This operator performs a bitwise exclusive or (xor) operation on all DDL
212 * bits between this readout and <i>list</i>.
213 * \param list The right hand side readout list to operate on.
214 * \return A reference to this object.
216 AliHLTReadoutList& operator ^= (const AliHLTReadoutList& list);
219 * This operator performs a bitwise and operation on all DDL bits between
220 * this readout and <i>list</i>.
221 * \param list The right hand side readout list to operate on.
222 * \return A reference to this object.
224 AliHLTReadoutList& operator &= (const AliHLTReadoutList& list);
227 * This operator performs the same operation as '|='.
228 * \param list The right hand side readout list to operate on.
229 * \return A reference to this object.
231 AliHLTReadoutList& operator += (const AliHLTReadoutList& list)
233 return operator |= (list);
237 * This operator performs the effective operation of "this and (this xor list)".
238 * It removes all the DDLs specified in list from this readout list.
239 * \param list The right hand side readout list to operate on.
240 * \return A reference to this object.
242 AliHLTReadoutList& operator -= (const AliHLTReadoutList& list);
245 * This operator performs a bitwise ones compliment on all DDL bits of this
247 * \return The result of the unary operator.
249 AliHLTReadoutList operator ~ () const;
252 * This operator performs a bitwise inclusive or operation on all DDL bits
253 * between this readout and <i>list</i>.
254 * \param list The right hand side readout list to operate on.
255 * \return The result of the binary operator.
257 AliHLTReadoutList operator | (const AliHLTReadoutList& list) const
259 AliHLTReadoutList result = *this;
260 return result.operator |= (list);
264 * This operator performs a bitwise exclusive or (xor) operation on all DDL
265 * bits between this readout and <i>list</i>.
266 * \param list The right hand side readout list to operate on.
267 * \return The result of the binary operator.
269 AliHLTReadoutList operator ^ (const AliHLTReadoutList& list) const
271 AliHLTReadoutList result = *this;
272 return result.operator ^= (list);
276 * This operator performs a bitwise and operation on all DDL bits between
277 * this readout and <i>list</i>.
278 * \param list The right hand side readout list to operate on.
279 * \return The result of the binary operator.
281 AliHLTReadoutList operator & (const AliHLTReadoutList& list) const
283 AliHLTReadoutList result = *this;
284 return result.operator &= (list);
288 * This operator performs the same operation as '|'.
289 * \param list The right hand side readout list to operate on.
290 * \return The result of the binary operator.
292 AliHLTReadoutList operator + (const AliHLTReadoutList& list) const
294 AliHLTReadoutList result = *this;
295 return result.operator += (list);
299 * This operator performs the effective operation of "this and (this xor list)".
300 * It removes all the DDLs specified in list from this readout list.
301 * \param list The right hand side readout list to operate on.
302 * \return The result of the binary operator.
304 AliHLTReadoutList operator - (const AliHLTReadoutList& list) const
306 AliHLTReadoutList result = *this;
307 return result.operator -= (list);
313 * Decodes the word index and bit index within that word for the readout list structure.
314 * \param ddlId <i>[in]</i> The ID number of the DDL to decode.
315 * \param wordIndex <i>[out]</i> the word index of the word to modify or check
316 * within fReadoutList.fList
317 * \param bitIndex <i>[out]</i> the bit index of the bit to modify or check
318 * within the word pointed to by <i>wordIndex</i>.
319 * \return true if the ddlId was decoded and false if it was invalid.
320 * \note We do not check extensively if the ddlId is invalid. Just simple checks
321 * are performed to see that we do not overflow the buffer fReadoutList.fList.
323 static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
325 AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
327 ClassDef(AliHLTReadoutList, 1) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
331 #endif // ALIHLTREADOUTLIST_H