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 * - unsets the bits in readout list A that are set in readout list B.
31 * This effectively applies A & (A ^ B).
33 class AliHLTReadoutList : public TObject
38 * Identifiers for different detectors used by methods in AliHLTReadoutList.
42 kITSSPD = 0x1 << 0, /// ID for SPD detector
43 kITSSDD = 0x1 << 1, /// ID for SDD detector
44 kITSSSD = 0x1 << 2, /// ID for SSD detector
45 kTPC = 0x1 << 3, /// ID for TPC detector
46 kTRD = 0x1 << 4, /// ID for TRD detector
47 kTOF = 0x1 << 5, /// ID for TOF detector
48 kHMPID = 0x1 << 6, /// ID for HMPID detector
49 kPHOS = 0x1 << 7, /// ID for PHOS detector
50 kCPV = 0x1 << 8, /// ID for CPV detector
51 kPMD = 0x1 << 9, /// ID for PMD detector
52 kMUONTRK = 0x1 << 10, /// ID for MUON tracking chambers
53 kMUONTRG = 0x1 << 11, /// ID for MUON trigger detector
54 kFMD = 0x1 << 12, /// ID for FMD detector
55 kT0 = 0x1 << 13, /// ID for T0 detector
56 kV0 = 0x1 << 14, /// ID for V0 detector
57 kZDC = 0x1 << 15, /// ID for ZDC detector
58 kACORDE = 0x1 << 16, /// ID for ACORDE detector
59 kTRG = 0x1 << 17, /// ID for TRG detector
60 kEMCAL = 0x1 << 18, /// ID for EMCAL detector
61 kDAQTEST = 0x1 << 19, /// ID for DAQ_TEST detector
62 kHLT = 0x1 << 30, /// ID for HLT detector
63 // kALLDET sets readout for all detectors except DAQ_TEST
64 kALLDET = (kITSSPD | kITSSDD | kITSSSD | kTPC | kTRD | kTOF | kHMPID | kPHOS
65 | kCPV | kPMD | kMUONTRK | kMUONTRG | kFMD | kT0 | kV0 | kZDC
66 | kACORDE | kTRG | kEMCAL | kHLT)
70 * Default constructor.
75 * Constructor to select which detectors to enable for readout.
76 * \param enabledDetectors Detector bit field. Can be any values for
77 * EDetectorId or'ed together.
79 AliHLTReadoutList(Int_t enabledDetectors);
82 * Constructor to select which detectors and DDLs to enable for readout.
83 * \param enabledList The string format is a space separated list where
84 * each item is either a detector acronym name or DDL number.
85 * Invalid sub-strings are simply ignored. The special ALL string is
86 * equivalent to kALLDET for AliHLTReadoutList(Int_t enabledDetectors).
88 AliHLTReadoutList(const char* enabledList);
91 * Constructor to create readout list from AliHLTEventDDL structure.
92 * \param list The AliHLTEventDDL structure from which to create this object.
94 AliHLTReadoutList(const AliHLTEventDDL& list);
97 * The copy constructor performs a deep copy.
98 * \param list The readout list to copy from.
100 AliHLTReadoutList(const AliHLTReadoutList& list);
103 * Default destructor.
105 virtual ~AliHLTReadoutList();
108 * Checks if the readout list is empty, i.e. all DDLs are disabled.
109 * \returns true if the readout list is empty and false otherwise.
114 * Enables a specific DDL bit in the readout list.
115 * \param ddlId The ID number of the DDL to enable.
117 void EnableDDLBit(Int_t ddlId)
119 SetDDLBit(ddlId, kTRUE);
123 * Disables a specific DDL bit in the readout list.
124 * \param ddlId The ID number of the DDL to disable.
126 void DisableDDLBit(Int_t ddlId)
128 SetDDLBit(ddlId, kFALSE);
132 * Fetches the bit value for a particular DDL in the readout list.
133 * \param ddlId The ID number of the DDL to fetch.
134 * \return the bit value for the specified DDL.
136 Bool_t GetDDLBit(Int_t ddlId) const;
139 * Sets the bit value for a particular DDL in the readout list.
140 * \param ddlId The ID number of the DDL to set.
141 * \param state The value to set the bit to.
143 void SetDDLBit(Int_t ddlId, Bool_t state);
146 * Checks if a particular DDL is enabled for readout.
147 * \param ddlId The ID number of the DDL to check.
148 * \return the if the DDL is enabled for readout.
150 bool IsDDLEnabled(Int_t ddlId) const
152 return GetDDLBit(ddlId) == kTRUE;
156 * Checks if a particular DDL is disabled for readout.
157 * \param ddlId The ID number of the DDL to check.
158 * \return the if the DDL is disabled for readout.
160 bool IsDDLDisabled(Int_t ddlId) const
162 return GetDDLBit(ddlId) == kFALSE;
166 * Enables all DDLs for a particular detector or detectors.
167 * \param detector A bitmap of detectors to enable. Should be any values from
168 * EDetectorId that can be or'ed together for multiple detector selection.
170 void Enable(Int_t detector);
173 * Disables all DDLs for a particular detector or detectors.
174 * \param detector A bitmap of detectors to disable. Should be any values from
175 * EDetectorId that can be or'ed together for multiple detector selection.
177 void Disable(Int_t detector);
180 * Checks if a particular detector's DDLs are enabled for readout.
181 * \param detector A bitmap of detectors to check. Should be any values from
182 * EDetectorId that can be or'ed together for multiple detector selection.
183 * \return true if all DDLs for the specified detectors are enabled for readout.
185 bool DetectorEnabled(Int_t ddlId) const;
188 * Inherited from TObject. Prints the DDLs that will be readout according to
190 * \param option This is not used by this method.
192 virtual void Print(Option_t* option = "") const;
195 * This typecast operator converts the readout list to the AliHLTEventDDL
197 * \return Copy of the AliHLTEventDDL raw structure.
199 operator AliHLTEventDDL () const { return fReadoutList; }
202 * This typecast operator converts the readout list to the AliHLTEventDDL
204 * \return Reference to the AliHLTEventDDL raw structure.
206 operator AliHLTEventDDL& () { return fReadoutList; }
209 * Assignment operator performs a deep copy.
210 * \param list The readout list to copy from.
211 * \return A reference to this object.
213 AliHLTReadoutList& operator = (const AliHLTReadoutList& list);
216 * This operator performs a bitwise inclusive or operation on all DDL bits
217 * between this readout and <i>list</i>.
218 * \param list The right hand side readout list to operate on.
219 * \return A reference to this object.
221 AliHLTReadoutList& operator |= (const AliHLTReadoutList& list);
224 * This operator performs a bitwise exclusive or (xor) operation on all DDL
225 * bits between this readout and <i>list</i>.
226 * \param list The right hand side readout list to operate on.
227 * \return A reference to this object.
229 AliHLTReadoutList& operator ^= (const AliHLTReadoutList& list);
232 * This operator performs a bitwise and operation on all DDL bits between
233 * this readout and <i>list</i>.
234 * \param list The right hand side readout list to operate on.
235 * \return A reference to this object.
237 AliHLTReadoutList& operator &= (const AliHLTReadoutList& list);
240 * This operator performs the effective operation of "this and (this xor list)".
241 * It removes all the DDLs specified in list from this readout list.
242 * \param list The right hand side readout list to operate on.
243 * \return A reference to this object.
245 AliHLTReadoutList& operator -= (const AliHLTReadoutList& list);
248 * This operator performs a bitwise ones compliment on all DDL bits of this
250 * \return The result of the unary operator.
252 AliHLTReadoutList operator ~ () const;
255 * This operator performs a bitwise inclusive or operation on all DDL bits
256 * between this readout and <i>list</i>.
257 * \param list The right hand side readout list to operate on.
258 * \return The result of the binary operator.
260 AliHLTReadoutList operator | (const AliHLTReadoutList& list) const
262 AliHLTReadoutList result = *this;
263 return result.operator |= (list);
267 * This operator performs a bitwise exclusive or (xor) operation on all DDL
268 * bits between this readout and <i>list</i>.
269 * \param list The right hand side readout list to operate on.
270 * \return The result of the binary operator.
272 AliHLTReadoutList operator ^ (const AliHLTReadoutList& list) const
274 AliHLTReadoutList result = *this;
275 return result.operator ^= (list);
279 * This operator performs a bitwise and operation on all DDL bits between
280 * this readout and <i>list</i>.
281 * \param list The right hand side readout list to operate on.
282 * \return The result of the binary operator.
284 AliHLTReadoutList operator & (const AliHLTReadoutList& list) const
286 AliHLTReadoutList result = *this;
287 return result.operator &= (list);
291 * This operator performs the effective operation of "this and (this xor list)".
292 * i.e. the set difference.
293 * It removes all the DDLs specified in list from this readout list.
294 * \param list The right hand side readout list to operate on.
295 * \return The result of the binary operator.
297 AliHLTReadoutList operator - (const AliHLTReadoutList& list) const
299 AliHLTReadoutList result = *this;
300 return result.operator -= (list);
306 * Decodes the word index and bit index within that word for the readout list structure.
307 * \param ddlId <i>[in]</i> The ID number of the DDL to decode.
308 * \param wordIndex <i>[out]</i> the word index of the word to modify or check
309 * within fReadoutList.fList
310 * \param bitIndex <i>[out]</i> the bit index of the bit to modify or check
311 * within the word pointed to by <i>wordIndex</i>.
312 * \return true if the ddlId was decoded and false if it was invalid.
313 * \note We do not check extensively if the ddlId is invalid. Just simple checks
314 * are performed to see that we do not overflow the buffer fReadoutList.fList.
316 static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
318 AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
320 ClassDef(AliHLTReadoutList, 1) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
324 #endif // ALIHLTREADOUTLIST_H