3 #ifndef ALIHLTREADOUTLIST_H
4 #define ALIHLTREADOUTLIST_H
5 /* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
9 /// @file AliHLTReadoutList.h
10 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @brief Declaration of the AliHLTReadoutList class used to handle AliHLTEventDDL structures.
15 #include "AliHLTDataTypes.h"
18 * \class AliHLTReadoutList
19 * This class is used as an interface or wrapper to the AliHLTEventDDL structure.
20 * It makes it easy to manipulate the bits in this structure, which define what DDLs
21 * should be readout by DAQ.
22 * Several operators are also overloaded which are meant to be used in the trigger
23 * menu specification for the AliHLTGlobalTrigger. It allows one to construct
24 * expressions for the readout lists, which is necessary to be able to evaluate
25 * or compose the final readout list, given multiple input readout lists received
26 * from individual components that derive from AliHLTTrigger.
27 * The operators implemented are:
28 * | applies a bitwise or on the DDL bits.
29 * & applies a bitwise and on the DDL bits.
30 * ^ applies a bitwise xor on the DDL bits.
31 * ~ applies a bitwise not on the DDL bits.
32 * - unsets the bits in readout list A that are set in readout list B.
33 * This effectively applies A & (A ^ B).
35 class AliHLTReadoutList : public TObject
40 * Identifiers for different detectors used by methods in AliHLTReadoutList.
44 kITSSPD = 0x1 << 0, /// ID for SPD detector
45 kITSSDD = 0x1 << 1, /// ID for SDD detector
46 kITSSSD = 0x1 << 2, /// ID for SSD detector
47 kTPC = 0x1 << 3, /// ID for TPC detector
48 kTRD = 0x1 << 4, /// ID for TRD detector
49 kTOF = 0x1 << 5, /// ID for TOF detector
50 kHMPID = 0x1 << 6, /// ID for HMPID detector
51 kPHOS = 0x1 << 7, /// ID for PHOS detector
52 kCPV = 0x1 << 8, /// ID for CPV detector
53 kPMD = 0x1 << 9, /// ID for PMD detector
54 kMUONTRK = 0x1 << 10, /// ID for MUON tracking chambers
55 kMUONTRG = 0x1 << 11, /// ID for MUON trigger detector
56 kFMD = 0x1 << 12, /// ID for FMD detector
57 kT0 = 0x1 << 13, /// ID for T0 detector
58 kV0 = 0x1 << 14, /// ID for V0 detector
59 kZDC = 0x1 << 15, /// ID for ZDC detector
60 kACORDE = 0x1 << 16, /// ID for ACORDE detector
61 kTRG = 0x1 << 17, /// ID for TRG detector
62 kEMCAL = 0x1 << 18, /// ID for EMCAL detector
63 kDAQTEST = 0x1 << 19, /// ID for DAQ_TEST detector
64 kHLT = 0x1 << 30, /// ID for HLT detector
65 // kALLDET sets readout for all detectors except DAQ_TEST
66 kALLDET = (kITSSPD | kITSSDD | kITSSSD | kTPC | kTRD | kTOF | kHMPID | kPHOS
67 | kCPV | kPMD | kMUONTRK | kMUONTRG | kFMD | kT0 | kV0 | kZDC
68 | kACORDE | kTRG | kEMCAL | kHLT)
72 * Default constructor.
77 * Constructor to select which detectors to enable for readout.
78 * \param enabledDetectors Detector bit field. Can be any values for
79 * EDetectorId or'ed together.
81 AliHLTReadoutList(Int_t enabledDetectors);
84 * Constructor to select which detectors and DDLs to enable for readout.
85 * \param enabledList The string format is a space separated list where
86 * each item is either a detector acronym name or DDL number.
87 * Invalid sub-strings are simply ignored. The special ALL string is
88 * equivalent to kALLDET for AliHLTReadoutList(Int_t enabledDetectors).
90 AliHLTReadoutList(const char* enabledList);
93 * Constructor to create readout list from AliHLTEventDDL structure.
94 * \param list The AliHLTEventDDL structure from which to create this object.
96 AliHLTReadoutList(const AliHLTEventDDL& list);
99 * The copy constructor performs a deep copy.
100 * \param list The readout list to copy from.
102 AliHLTReadoutList(const AliHLTReadoutList& list);
105 * Default destructor.
107 virtual ~AliHLTReadoutList();
110 * Checks if the readout list is empty, i.e. all DDLs are disabled.
111 * \returns true if the readout list is empty and false otherwise.
116 * Disables all bits in the readout list.
117 * \param option This parameter is ignored.
118 * The method is inherited from TObject.
120 virtual void Clear(Option_t* option = "");
123 * Enables a specific DDL bit in the readout list.
124 * \param ddlId The ID number of the DDL to enable.
126 void EnableDDLBit(Int_t ddlId)
128 SetDDLBit(ddlId, kTRUE);
132 * Disables a specific DDL bit in the readout list.
133 * \param ddlId The ID number of the DDL to disable.
135 void DisableDDLBit(Int_t ddlId)
137 SetDDLBit(ddlId, kFALSE);
141 * Fetches the bit value for a particular DDL in the readout list.
142 * \param ddlId The ID number of the DDL to fetch.
143 * \return the bit value for the specified DDL.
145 Bool_t GetDDLBit(Int_t ddlId) const;
148 * Sets the bit value for a particular DDL in the readout list.
149 * \param ddlId The ID number of the DDL to set.
150 * \param state The value to set the bit to.
152 void SetDDLBit(Int_t ddlId, Bool_t state);
155 * Checks if a particular DDL is enabled for readout.
156 * \param ddlId The ID number of the DDL to check.
157 * \return the if the DDL is enabled for readout.
159 bool IsDDLEnabled(Int_t ddlId) const
161 return GetDDLBit(ddlId) == kTRUE;
165 * Checks if a particular DDL is disabled for readout.
166 * \param ddlId The ID number of the DDL to check.
167 * \return the if the DDL is disabled for readout.
169 bool IsDDLDisabled(Int_t ddlId) const
171 return GetDDLBit(ddlId) == kFALSE;
175 * Enables all DDLs for a particular detector or detectors.
176 * \param detector A bitmap of detectors to enable. Should be any values from
177 * EDetectorId that can be or'ed together for multiple detector selection.
179 void Enable(Int_t detector);
182 * Disables all DDLs for a particular detector or detectors.
183 * \param detector A bitmap of detectors to disable. Should be any values from
184 * EDetectorId that can be or'ed together for multiple detector selection.
186 void Disable(Int_t detector);
189 * Checks if a particular detector's DDLs are enabled for readout.
190 * \param detector A bitmap of detectors to check. Should be any values from
191 * EDetectorId that can be or'ed together for multiple detector selection.
192 * \return true if all DDLs for the specified detectors are enabled for readout.
194 bool DetectorEnabled(Int_t ddlId) const;
197 * Inherited from TObject. Prints the DDLs that will be readout according to
199 * \param option This is not used by this method.
201 virtual void Print(Option_t* option = "") const;
204 * This typecast operator converts the readout list to the AliHLTEventDDL
206 * \return Copy of the AliHLTEventDDL raw structure.
208 operator AliHLTEventDDL () const { return fReadoutList; }
211 * This typecast operator converts the readout list to the AliHLTEventDDL
213 * \return Reference to the AliHLTEventDDL raw structure.
215 operator AliHLTEventDDL& () { return fReadoutList; }
218 * Assignment operator performs a deep copy.
219 * \param list The readout list to copy from.
220 * \return A reference to this object.
222 AliHLTReadoutList& operator = (const AliHLTReadoutList& list);
225 * This operator performs a bitwise inclusive or operation on all DDL bits
226 * between this readout and <i>list</i>.
227 * \param list The right hand side readout list to operate on.
228 * \return A reference to this object.
230 AliHLTReadoutList& operator |= (const AliHLTReadoutList& list);
233 * This operator performs a bitwise exclusive or (xor) operation on all DDL
234 * bits between this readout and <i>list</i>.
235 * \param list The right hand side readout list to operate on.
236 * \return A reference to this object.
238 AliHLTReadoutList& operator ^= (const AliHLTReadoutList& list);
241 * This operator performs a bitwise and operation on all DDL bits between
242 * this readout and <i>list</i>.
243 * \param list The right hand side readout list to operate on.
244 * \return A reference to this object.
246 AliHLTReadoutList& operator &= (const AliHLTReadoutList& list);
249 * This operator performs the effective operation of "this and (this xor list)".
250 * It removes all the DDLs specified in list from this readout list.
251 * \param list The right hand side readout list to operate on.
252 * \return A reference to this object.
254 AliHLTReadoutList& operator -= (const AliHLTReadoutList& list);
257 * This operator performs a bitwise ones compliment on all DDL bits of this
259 * \return The result of the unary operator.
261 AliHLTReadoutList operator ~ () const;
264 * This operator performs a bitwise inclusive or operation on all DDL bits
265 * 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 exclusive or (xor) operation on all DDL
277 * bits between 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 a bitwise and operation on all DDL bits between
289 * this readout and <i>list</i>.
290 * \param list The right hand side readout list to operate on.
291 * \return The result of the binary operator.
293 AliHLTReadoutList operator & (const AliHLTReadoutList& list) const
295 AliHLTReadoutList result = *this;
296 return result.operator &= (list);
300 * This operator performs the effective operation of "this and (this xor list)".
301 * i.e. the set difference.
302 * It removes all the DDLs specified in list from this readout list.
303 * \param list The right hand side readout list to operate on.
304 * \return The result of the binary operator.
306 AliHLTReadoutList operator - (const AliHLTReadoutList& list) const
308 AliHLTReadoutList result = *this;
309 return result.operator -= (list);
315 * Decodes the word index and bit index within that word for the readout list structure.
316 * \param ddlId <i>[in]</i> The ID number of the DDL to decode.
317 * \param wordIndex <i>[out]</i> the word index of the word to modify or check
318 * within fReadoutList.fList
319 * \param bitIndex <i>[out]</i> the bit index of the bit to modify or check
320 * within the word pointed to by <i>wordIndex</i>.
321 * \return true if the ddlId was decoded and false if it was invalid.
322 * \note We do not check extensively if the ddlId is invalid. Just simple checks
323 * are performed to see that we do not overflow the buffer fReadoutList.fList.
325 static bool DecodeDDLID(Int_t ddlId, Int_t& wordIndex, Int_t& bitIndex);
327 AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
329 ClassDef(AliHLTReadoutList, 1) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
333 #endif // ALIHLTREADOUTLIST_H