]>
Commit | Line | Data |
---|---|---|
26a4668d | 1 | #ifndef ALIHLTMUONUTILS_H |
2 | #define ALIHLTMUONUTILS_H | |
3 | /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
6253e09b | 8 | /// |
9 | /// @file AliHLTMUONUtils.h | |
10 | /// @author Artur Szostak <artursz@iafrica.com> | |
dba14d7d | 11 | /// @date 17 May 2007 |
6253e09b | 12 | /// @brief Class containing various dimuon HLT utility routines and macros. |
13 | /// | |
26a4668d | 14 | |
c8ec7c7e | 15 | #include "AliHLTMUONDataTypes.h" |
878cb83d | 16 | #include <ostream> |
c8ec7c7e | 17 | |
18 | // Forward declare structures. | |
19 | extern "C" { | |
90a74d7a | 20 | struct AliHLTMUONTriggerRecordStruct; |
c8ec7c7e | 21 | struct AliHLTMUONTriggerRecordsBlockStruct; |
dba14d7d | 22 | struct AliHLTMUONTrigRecInfoStruct; |
c8ec7c7e | 23 | struct AliHLTMUONTrigRecsDebugBlockStruct; |
24 | struct AliHLTMUONTriggerChannelsBlockStruct; | |
25 | struct AliHLTMUONRecHitsBlockStruct; | |
dba14d7d | 26 | struct AliHLTMUONClusterStruct; |
c8ec7c7e | 27 | struct AliHLTMUONClustersBlockStruct; |
dba14d7d | 28 | struct AliHLTMUONChannelStruct; |
c8ec7c7e | 29 | struct AliHLTMUONChannelsBlockStruct; |
90a74d7a | 30 | struct AliHLTMUONMansoTrackStruct; |
31 | struct AliHLTMUONMansoTracksBlockStruct; | |
dba14d7d | 32 | struct AliHLTMUONMansoCandidateStruct; |
90a74d7a | 33 | struct AliHLTMUONMansoCandidatesBlockStruct; |
34 | struct AliHLTMUONTrackDecisionStruct; | |
35 | struct AliHLTMUONSinglesDecisionBlockStruct; | |
36 | struct AliHLTMUONPairDecisionStruct; | |
37 | struct AliHLTMUONPairsDecisionBlockStruct; | |
c8ec7c7e | 38 | } // extern "C" |
26a4668d | 39 | |
40 | /** | |
41 | * AliHLTMUONUtils contains arbitrary utility methods to be used in various | |
42 | * parts of the dimuon HLT system. | |
43 | * These include methods to perform basic sanity checks on the integrity of | |
44 | * data blocks. | |
45 | */ | |
46 | class AliHLTMUONUtils | |
47 | { | |
48 | public: | |
b727f838 | 49 | /** |
50 | * This packs the given parameters into the bits of a word appropriate | |
51 | * for AliHLTMUONTriggerRecordStruct::fFlags. | |
52 | * @param sign The particle sign. | |
53 | * @param hitset Flags to indicate if the corresponding fHits[i] elements | |
54 | * was set/filled. | |
55 | * @return Returns the 32 bit packed word. | |
56 | */ | |
57 | static AliHLTUInt32_t PackTriggerRecordFlags( | |
e6357f88 | 58 | AliHLTMUONParticleSign sign, const bool hitset[4] |
b727f838 | 59 | ); |
60 | ||
61 | /** | |
62 | * This unpacks the AliHLTMUONTriggerRecordStruct::fFlags bits into | |
63 | * its component fields. | |
64 | * @param flags The flags from an AliHLTMUONTriggerRecordStruct structure. | |
65 | * @param sign Sets this to the particle sign. | |
66 | * @param hitset Sets the array elements to indicate if the corresponding | |
67 | * fHits[i] element was set/filled. | |
68 | */ | |
69 | static void UnpackTriggerRecordFlags( | |
70 | AliHLTUInt32_t flags, // [in] | |
71 | AliHLTMUONParticleSign& sign, // [out] | |
72 | bool hitset[4] // [out] | |
73 | ); | |
74 | ||
75 | /** | |
76 | * This packs the given parameters into the bits of a word appropriate | |
77 | * for AliHLTMUONMansoTrackStruct::fFlags. | |
78 | * @param sign The particle sign. | |
79 | * @param hitset Flags to indicate if the corresponding fHits[i] elements | |
80 | * was set/filled. | |
81 | * @return Returns the 32 bit packed word. | |
82 | */ | |
83 | static AliHLTUInt32_t PackMansoTrackFlags( | |
e6357f88 | 84 | AliHLTMUONParticleSign sign, const bool hitset[4] |
b727f838 | 85 | ) |
86 | { | |
87 | return PackTriggerRecordFlags(sign, hitset); | |
88 | } | |
89 | ||
90 | /** | |
91 | * This unpacks the AliHLTMUONMansoTrackStruct::fFlags bits into | |
92 | * its component fields. | |
93 | * @param flags The flags from an AliHLTMUONMansoTrackStruct structure. | |
94 | * @param sign Sets this to the particle sign. | |
95 | * @param hitset Sets the array elements to indicate if the corresponding | |
96 | * fHits[i] element was set/filled. | |
97 | */ | |
98 | static void UnpackMansoTrackFlags( | |
99 | AliHLTUInt32_t flags, // [in] | |
100 | AliHLTMUONParticleSign& sign, // [out] | |
101 | bool hitset[4] // [out] | |
102 | ) | |
103 | { | |
104 | UnpackTriggerRecordFlags(flags, sign, hitset); | |
105 | } | |
90a74d7a | 106 | |
107 | /** | |
108 | * This packs the given parameters into the bits of a word appropriate | |
109 | * for AliHLTMUONTrackDecisionStruct::fTriggerBits. | |
110 | * @param highPt Has the track passed the high pt cut. | |
111 | * @param lowPt Has the track passed the low pt cut. | |
112 | * @return Returns the 32 bit packed word. | |
113 | */ | |
114 | static AliHLTUInt32_t PackTrackDecisionBits(bool highPt, bool lowPt); | |
115 | ||
116 | /** | |
117 | * This unpacks the AliHLTMUONTrackDecisionStruct::fTriggerBits bits into | |
118 | * its component fields. | |
119 | * @param bits The trigger bits from an AliHLTMUONTrackDecisionStruct | |
120 | * structure. | |
121 | * @param highPt Sets this to the value of the high pt cut bit. | |
122 | * @param lowPt Sets this to the value of the low pt cut bit. | |
123 | */ | |
124 | static void UnpackTrackDecisionBits( | |
125 | AliHLTUInt32_t bits, // [in] | |
126 | bool& highPt, // [out] | |
127 | bool& lowPt // [out] | |
128 | ); | |
129 | ||
130 | /** | |
131 | * This packs the given parameters into the bits of a word appropriate | |
132 | * for AliHLTMUONPairDecisionStruct::fTriggerBits. | |
133 | * | |
134 | * @param highMass Has the track pair passed the high invariant mass cut. | |
135 | * @param lowMass Has the track pair passed the low invariant mass cut. | |
136 | * @param unlike Does the track pair have unlike signs. | |
137 | * @param highPtCount The number of tracks that passed the high pt cut | |
138 | * in the pair. | |
139 | * @param lowPtCount The number of tracks that passed the low pt cut | |
140 | * in the pair. | |
141 | * @return Returns the 32 bit packed word. | |
142 | * | |
143 | * Note: Must have highPtCount + lowPtCount <= 2 and unlike == true if | |
144 | * highMass or lowMass is true. | |
145 | */ | |
146 | static AliHLTUInt32_t PackPairDecisionBits( | |
147 | bool highMass, bool lowMass, bool unlike, | |
148 | AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount | |
149 | ); | |
150 | ||
151 | /** | |
152 | * This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into | |
153 | * its component fields. | |
154 | * @param bits The trigger bits from an AliHLTMUONPairDecisionStruct | |
155 | * structure. | |
156 | * @param highMass Sets this to the value of the high invariant mass cut bit. | |
157 | * @param lowMass Sets this to the value of the low invariant mass cut bit. | |
158 | * @param unlike Sets this if the pair is unlike sign. | |
159 | * @param highPtCount Sets this to the high pt count bits. | |
160 | * @param lowPtCount Sets this to the low pt count bits. | |
161 | */ | |
162 | static void UnpackPairDecisionBits( | |
163 | AliHLTUInt32_t bits, // [in] | |
164 | bool& highMass, // [out] | |
165 | bool& lowMass, // [out] | |
166 | bool& unlike, // [out] | |
167 | AliHLTUInt8_t& highPtCount, // [out] | |
168 | AliHLTUInt8_t& lowPtCount // [out] | |
169 | ); | |
e6357f88 | 170 | |
171 | /** | |
172 | * This packs the given parameters into the 32bit Pub/Sub specification | |
173 | * word in the data block descriptor. | |
174 | * | |
175 | * @param ddl The list of DDLs forming part of the readout. ddl[0] | |
176 | * indicates DDL number 2560, ddl[1] is for DDL 2561 and so | |
177 | * on up to ddl[19]. ddl[20] and ddl[21] will be for the | |
178 | * trigger DDLs 2816 and 2817 respectively. | |
179 | * @return Returns the 32 bit packed specification word. | |
180 | */ | |
181 | static AliHLTUInt32_t PackSpecBits( | |
182 | const bool ddl[22] | |
183 | ); | |
184 | ||
185 | /** | |
186 | * This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into | |
187 | * its component fields. | |
188 | * @param bits The Pub/Sub specification word from a data block descriptor. | |
189 | * @param ddl The output list of DDLs forming part of the readout. ddl[0] | |
190 | * indicates DDL number 2560, ddl[1] is for DDL 2561 and so | |
191 | * on up to ddl[19]. ddl[20] and ddl[21] will be for the | |
192 | * trigger DDLs 2816 and 2817 respectively. | |
193 | */ | |
194 | static void UnpackSpecBits( | |
195 | AliHLTUInt32_t bits, // [in] | |
196 | bool ddl[22] // [out] | |
197 | ); | |
26a4668d | 198 | |
86b774d9 | 199 | /** |
200 | * This method converts the DDL number for the muon spectrometer in the | |
201 | * range [0..21] to the equipment ID number. | |
202 | * @param ddlNo The DDL number in the range [0..21]. | |
203 | * @return Returns the equipment ID number or -1 if ddlNo was invalid. | |
204 | */ | |
205 | static AliHLTInt32_t DDLNumberToEquipId(AliHLTInt32_t ddlNo); | |
206 | ||
207 | /** | |
208 | * This method converts the equipment ID number for a muon spectrometer | |
209 | * DDL to the DDL number in the range [0..21]. | |
210 | * @param id The equipment ID of the DDL. | |
211 | * @return Returns the DDL number in the range [0..21] or -1 if the | |
212 | * equipment ID was invalid. | |
213 | */ | |
214 | static AliHLTInt32_t EquipIdToDDLNumber(AliHLTInt32_t id); | |
215 | ||
216 | /** | |
217 | * This method converts a 32 bit data block specification for a MUON-HLT | |
218 | * data block into its corresponding DDL equipment ID number. | |
219 | * It is assumed that the specification is for a data block comming from | |
220 | * a single DDL source. If more than one DDL contributed to the data block | |
221 | * then -1 is returned. | |
222 | * @param spec The 32 bit specification for a data block. | |
223 | * @return Returns the equipment ID corresponding to the specification | |
224 | * or -1 if the specification was invalid. | |
225 | */ | |
226 | static AliHLTInt32_t SpecToEquipId(AliHLTUInt32_t spec); | |
227 | ||
228 | /** | |
229 | * This method converts a equipment ID number for a DDL into its corresponding | |
230 | * 32 bit data block specification for the MUON-HLT. | |
231 | * @param id The equipment ID number of the DDL. | |
232 | * @return Returns the 32 bit data block specification or 0x0 if the | |
233 | * equipment ID was invalid. | |
234 | */ | |
235 | static AliHLTUInt32_t EquipIdToSpec(AliHLTInt32_t id); | |
236 | ||
237 | /** | |
238 | * This method converts a 32 bit data block specification for a MUON-HLT | |
239 | * data block into its corresponding DDL number in the range [0..21]. | |
240 | * It is assumed that the specification is for a data block comming from | |
241 | * a single DDL source. If more than one DDL contributed to the data block | |
242 | * then -1 is returned. | |
243 | * @param spec The 32 bit specification for a data block. | |
244 | * @return Returns the corresponding DDL number for the specification | |
245 | * or -1 if the specification was invalid. | |
246 | */ | |
247 | static AliHLTInt32_t SpecToDDLNumber(AliHLTUInt32_t spec); | |
248 | ||
249 | /** | |
250 | * This method converts a DDL number in the range [0..21] into its | |
251 | * corresponding 32 bit data block specification for the MUON-HLT. | |
252 | * @param ddlNo The equipment ID number of the DDL. | |
253 | * @return Returns the 32 bit data block specification or 0x0 if the | |
254 | * DDL number was invalid (out of range). | |
255 | */ | |
256 | static AliHLTUInt32_t DDLNumberToSpec(AliHLTInt32_t ddlNo); | |
257 | ||
668eee9f | 258 | /** |
259 | * Returns true if the given specification was for a single trigger DDL. | |
260 | */ | |
261 | static bool IsTriggerDDL(AliHLTUInt32_t spec) | |
262 | { | |
263 | AliHLTInt32_t ddl = SpecToDDLNumber(spec); | |
264 | return (20 <= ddl and ddl <= 21); | |
265 | } | |
266 | ||
267 | /** | |
268 | * Returns true if the given specification was for a single tracker DDL. | |
269 | */ | |
270 | static bool IsTrackerDDL(AliHLTUInt32_t spec) | |
271 | { | |
272 | AliHLTInt32_t ddl = SpecToDDLNumber(spec); | |
273 | return (0 <= ddl and ddl <= 19); | |
274 | } | |
dba14d7d | 275 | |
276 | /** | |
277 | * Returns true if the given specification is in principle valid. | |
278 | * It checks if the bits that should be zero are indeed zero. | |
279 | */ | |
280 | static bool IsSpecValid(AliHLTUInt32_t spec) | |
281 | { | |
282 | AliHLTUInt32_t mask = ~((1 << 22) - 1); // First 22 bits indicate DDL number. | |
283 | return (spec & mask) == 0x0; | |
284 | } | |
285 | ||
286 | /** | |
287 | * Returns true if the data specification indicates the data block contains | |
288 | * information generated from a trigger DDL or data fragments thereof. | |
289 | */ | |
290 | static bool ContainsDataFromTrigger(AliHLTUInt32_t spec) | |
291 | { | |
292 | AliHLTUInt32_t mask = ((1 << 22) - 1) & ~((1 << 20) - 1); | |
293 | return (spec & mask) != 0x0; | |
294 | } | |
295 | ||
296 | /** | |
297 | * Returns true if the data specification indicates the data block contains | |
298 | * information generated from a tracker DDL or data fragments thereof. | |
299 | */ | |
300 | static bool ContainsDataFromTracker(AliHLTUInt32_t spec) | |
301 | { | |
302 | AliHLTUInt32_t mask = ((1 << 20) - 1); | |
303 | return (spec & mask) != 0x0; | |
304 | } | |
f68b4e0e | 305 | |
306 | /** | |
307 | * Parses the string containing the type name of a dHLT data block and | |
308 | * returns the corresponding AliHLTMUONDataBlockType value. | |
309 | * \param type The string containing the type name. | |
310 | * \returns The data block type or kUnknownDataBlock if the type name | |
311 | * is invalid. | |
312 | */ | |
313 | static AliHLTMUONDataBlockType ParseCommandLineTypeString(const char* type); | |
dba14d7d | 314 | |
698c9498 | 315 | /** |
316 | * These codes indicate the reason why a data block failed its | |
317 | * validity check. | |
318 | */ | |
319 | enum WhyNotValid | |
320 | { | |
878cb83d | 321 | kNoReason, ///< There was no reason for failure. |
322 | kHeaderContainsWrongType, ///< The common header contains an incorrect type ID. | |
323 | kHeaderContainsWrongRecordWidth, ///< The common header contains an incorrect data record width. | |
dba14d7d | 324 | kInvalidIdValue, ///< The structure identifier does not have a valid value. |
325 | kInvalidTriggerIdValue, ///< The trigger structure identifier does not have a valid value. | |
326 | kInvalidTrackIdValue, ///< The track structure identifier does not have a valid value. | |
878cb83d | 327 | kReservedBitsNotZero, ///< Reserved bits have not been set to zero. |
328 | kParticleSignBitsNotValid, ///< The particle sign bits are not a valid value. | |
329 | kHitNotMarkedAsNil, ///< A hit was marked as not found, but the corresponding hit structure was not set to nil. | |
dba14d7d | 330 | kInvalidDetElementNumber, ///< An invalid detector element ID was found. |
331 | kHitIsNil, ///< The hit cannot be set to a nil value. | |
332 | kInvalidChannelCount, ///< The number of channels indicated is zero or outside the valid range. | |
333 | kInvalidBusPatchId, ///< The bus patch ID is outside the valid range. | |
334 | kInvalidManuId, ///< The MANU ID is outside the valid range. | |
335 | kInvalidChannelAddress, ///< The MANU channel address is outside the valid range. | |
336 | kInvalidSignal, ///< The ADC signal value is outside the valid range. | |
337 | kDataWordDifferent, ///< The raw data word is different from the unpacked values. | |
338 | kChiSquareInvalid, ///< The chi squared value must be a positive value or -1 indicating a fitting error. | |
339 | kMomentumVectorNotZero, ///< The chi sqaured value is set to -1, but momentum vector not zero. | |
340 | kRoiRadiusInvalid, ///< The region of interest radius is invalid. | |
341 | kHitNotWithinRoi, ///< A tracks hit is not within the corresponding region of interest. | |
878cb83d | 342 | kPtValueNotValid, ///< The pT value is not positive nor -1 indicating an invalid value. |
878cb83d | 343 | kPairTrackIdsAreIdentical, ///< The track IDs of the track pair are identical. |
344 | kMassValueNotValid, ///< The invariant mass value is not positive nor -1 indicating an invalid value. | |
345 | kLowPtCountInvalid, ///< The low pT trigger count is greater than 2, which is invalid. | |
dba14d7d | 346 | kHighPtCountInvalid, ///< The high pT trigger count is greater than 2, which is invalid. |
347 | kFoundDuplicateIDs, ///< Found duplicate identifiers, but they should all be unique. | |
348 | kFoundDuplicateHits, ///< Found duplicate hits. | |
349 | kFoundDuplicateTriggers ///< Found duplicate trigger decisions. | |
698c9498 | 350 | }; |
878cb83d | 351 | |
352 | /** | |
353 | * This method converts the WhyNotValid enumeration to a string representation. | |
354 | */ | |
355 | static const char* FailureReasonToString(WhyNotValid reason); | |
356 | ||
357 | /** | |
358 | * This method returns a string containing a user readable message explaining | |
359 | * the reason for failure described by the WhyNotValid enumeration. | |
360 | */ | |
361 | static const char* FailureReasonToMessage(WhyNotValid reason); | |
698c9498 | 362 | |
dba14d7d | 363 | /** |
364 | * Method used to check if the header information corresponds to the | |
365 | * supposed type of the trigger records data block. | |
366 | * This method will return either kHeaderContainsWrongType or | |
367 | * kHeaderContainsWrongRecordWidth as the reason code. | |
368 | * [in] \param block The data block to check. | |
369 | * [out] \param reason If this is not NULL, then the variable pointed to | |
370 | * by this pointer will be filled with the reason code describing why | |
371 | * the header is not valid, if and only if a problem is found with | |
372 | * the data. | |
373 | * \returns true if there is no problem with the header and false otherwise. | |
374 | */ | |
375 | static bool HeaderOk(const AliHLTMUONTriggerRecordsBlockStruct& block, WhyNotValid* reason = NULL) | |
376 | { | |
377 | AliHLTUInt32_t count = 1; | |
378 | return HeaderOk(block, reason, count); | |
379 | } | |
380 | ||
381 | /** | |
382 | * Method used to check if the header information corresponds to the | |
383 | * supposed type of the trigger debug information data block. | |
384 | * This method will return either kHeaderContainsWrongType or | |
385 | * kHeaderContainsWrongRecordWidth as the reason code. | |
386 | * [in] \param block The data block to check. | |
387 | * [out] \param reason If this is not NULL, then the variable pointed to | |
388 | * by this pointer will be filled with the reason code describing why | |
389 | * the header is not valid, if and only if a problem is found with | |
390 | * the data. | |
391 | * \returns true if there is no problem with the header and false otherwise. | |
392 | */ | |
393 | static bool HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block, WhyNotValid* reason = NULL) | |
394 | { | |
395 | AliHLTUInt32_t count = 1; | |
396 | return HeaderOk(block, reason, count); | |
397 | } | |
398 | ||
399 | // this method is deprecated. | |
400 | static bool HeaderOk(const AliHLTMUONTriggerChannelsBlockStruct& block, WhyNotValid* reason = NULL); | |
401 | ||
402 | /** | |
403 | * Method used to check if the header information corresponds to the | |
404 | * supposed type of the reconstructed hits data block. | |
405 | * This method will return either kHeaderContainsWrongType or | |
406 | * kHeaderContainsWrongRecordWidth as the reason code. | |
407 | * [in] \param block The data block to check. | |
408 | * [out] \param reason If this is not NULL, then the variable pointed to | |
409 | * by this pointer will be filled with the reason code describing why | |
410 | * the header is not valid, if and only if a problem is found with | |
411 | * the data. | |
412 | * \returns true if there is no problem with the header and false otherwise. | |
413 | */ | |
414 | static bool HeaderOk(const AliHLTMUONRecHitsBlockStruct& block, WhyNotValid* reason = NULL) | |
415 | { | |
416 | AliHLTUInt32_t count = 1; | |
417 | return HeaderOk(block, reason, count); | |
418 | } | |
419 | ||
420 | /** | |
421 | * Method used to check if the header information corresponds to the | |
422 | * supposed type of the clusters data block. | |
423 | * This method will return either kHeaderContainsWrongType or | |
424 | * kHeaderContainsWrongRecordWidth as the reason code. | |
425 | * [in] \param block The data block to check. | |
426 | * [out] \param reason If this is not NULL, then the variable pointed to | |
427 | * by this pointer will be filled with the reason code describing why | |
428 | * the header is not valid, if and only if a problem is found with | |
429 | * the data. | |
430 | * \returns true if there is no problem with the header and false otherwise. | |
431 | */ | |
432 | static bool HeaderOk(const AliHLTMUONClustersBlockStruct& block, WhyNotValid* reason = NULL) | |
433 | { | |
434 | AliHLTUInt32_t count = 1; | |
435 | return HeaderOk(block, reason, count); | |
436 | } | |
437 | ||
438 | /** | |
439 | * Method used to check if the header information corresponds to the | |
440 | * supposed type of the channels data block. | |
441 | * This method will return either kHeaderContainsWrongType or | |
442 | * kHeaderContainsWrongRecordWidth as the reason code. | |
443 | * [in] \param block The data block to check. | |
444 | * [out] \param reason If this is not NULL, then the variable pointed to | |
445 | * by this pointer will be filled with the reason code describing why | |
446 | * the header is not valid, if and only if a problem is found with | |
447 | * the data. | |
448 | * \returns true if there is no problem with the header and false otherwise. | |
449 | */ | |
450 | static bool HeaderOk(const AliHLTMUONChannelsBlockStruct& block, WhyNotValid* reason = NULL) | |
451 | { | |
452 | AliHLTUInt32_t count = 1; | |
453 | return HeaderOk(block, reason, count); | |
454 | } | |
455 | ||
456 | /** | |
457 | * Method used to check if the header information corresponds to the | |
458 | * supposed type of the Manso tracks data block. | |
459 | * This method will return either kHeaderContainsWrongType or | |
460 | * kHeaderContainsWrongRecordWidth as the reason code. | |
461 | * [in] \param block The data block to check. | |
462 | * [out] \param reason If this is not NULL, then the variable pointed to | |
463 | * by this pointer will be filled with the reason code describing why | |
464 | * the header is not valid, if and only if a problem is found with | |
465 | * the data. | |
466 | * \returns true if there is no problem with the header and false otherwise. | |
467 | */ | |
468 | static bool HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block, WhyNotValid* reason = NULL) | |
469 | { | |
470 | AliHLTUInt32_t count = 1; | |
471 | return HeaderOk(block, reason, count); | |
472 | } | |
473 | ||
474 | /** | |
475 | * Method used to check if the header information corresponds to the | |
476 | * supposed type of the Manso candidates data block. | |
477 | * This method will return either kHeaderContainsWrongType or | |
478 | * kHeaderContainsWrongRecordWidth as the reason code. | |
479 | * [in] \param block The data block to check. | |
480 | * [out] \param reason If this is not NULL, then the variable pointed to | |
481 | * by this pointer will be filled with the reason code describing why | |
482 | * the header is not valid, if and only if a problem is found with | |
483 | * the data. | |
484 | * \returns true if there is no problem with the header and false otherwise. | |
485 | */ | |
486 | static bool HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block, WhyNotValid* reason = NULL) | |
487 | { | |
488 | AliHLTUInt32_t count = 1; | |
489 | return HeaderOk(block, reason, count); | |
490 | } | |
491 | ||
492 | /** | |
493 | * Method used to check if the header information corresponds to the | |
494 | * supposed type of the single tracks dHLT trigger decision data block. | |
495 | * This method will return either kHeaderContainsWrongType or | |
496 | * kHeaderContainsWrongRecordWidth as the reason code. | |
497 | * [in] \param block The data block to check. | |
498 | * [out] \param reason If this is not NULL, then the variable pointed to | |
499 | * by this pointer will be filled with the reason code describing why | |
500 | * the header is not valid, if and only if a problem is found with | |
501 | * the data. | |
502 | * \returns true if there is no problem with the header and false otherwise. | |
503 | */ | |
504 | static bool HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block, WhyNotValid* reason = NULL) | |
505 | { | |
506 | AliHLTUInt32_t count = 1; | |
507 | return HeaderOk(block, reason, count); | |
508 | } | |
509 | ||
510 | /** | |
511 | * Method used to check if the header information corresponds to the | |
512 | * supposed type of the track pairs dHLT trigger decision data block. | |
513 | * This method will return either kHeaderContainsWrongType or | |
514 | * kHeaderContainsWrongRecordWidth as the reason code. | |
515 | * [in] \param block The data block to check. | |
516 | * [out] \param reason If this is not NULL, then the variable pointed to | |
517 | * by this pointer will be filled with the reason code describing why | |
518 | * the header is not valid, if and only if a problem is found with | |
519 | * the data. | |
520 | * \returns true if there is no problem with the header and false otherwise. | |
521 | */ | |
522 | static bool HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block, WhyNotValid* reason = NULL) | |
523 | { | |
524 | AliHLTUInt32_t count = 1; | |
525 | return HeaderOk(block, reason, count); | |
526 | } | |
527 | ||
26a4668d | 528 | /** |
b727f838 | 529 | * Methods used to check if the header information corresponds to the |
530 | * supposed type of the data block. | |
dba14d7d | 531 | * If the 'reason' parameter should point to an array which will store |
532 | * the reason codes indicating the problems with the data block. | |
533 | * The 'reasonCount' parameter should initialy contain the number of | |
534 | * elements that can be stored in reason. When the method exits it will | |
535 | * store the number of elements in the 'reason' array actually filled. | |
536 | */ | |
537 | static bool HeaderOk( | |
538 | const AliHLTMUONTriggerRecordsBlockStruct& block, | |
539 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
540 | ); | |
541 | ||
542 | static bool HeaderOk( | |
543 | const AliHLTMUONTrigRecsDebugBlockStruct& block, | |
544 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
545 | ); | |
546 | ||
547 | static bool HeaderOk( | |
548 | const AliHLTMUONRecHitsBlockStruct& block, | |
549 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
550 | ); | |
551 | ||
552 | static bool HeaderOk( | |
553 | const AliHLTMUONClustersBlockStruct& block, | |
554 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
555 | ); | |
556 | ||
557 | static bool HeaderOk( | |
558 | const AliHLTMUONChannelsBlockStruct& block, | |
559 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
560 | ); | |
561 | ||
562 | static bool HeaderOk( | |
563 | const AliHLTMUONMansoTracksBlockStruct& block, | |
564 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
565 | ); | |
566 | ||
567 | static bool HeaderOk( | |
568 | const AliHLTMUONMansoCandidatesBlockStruct& block, | |
569 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
570 | ); | |
571 | ||
572 | static bool HeaderOk( | |
573 | const AliHLTMUONSinglesDecisionBlockStruct& block, | |
574 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
575 | ); | |
576 | ||
577 | static bool HeaderOk( | |
578 | const AliHLTMUONPairsDecisionBlockStruct& block, | |
579 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
580 | ); | |
581 | ||
582 | /** | |
583 | * This method is used to check more extensively if the integrity of the | |
584 | * trigger record structure is OK and returns true in that case. | |
585 | * [in] \param tr The trigger record structure to check. | |
586 | * [out] \param reason If this is not NULL, then it will be filled with | |
587 | * the reason code describing why the structure is not valid, if and | |
588 | * only if a problem is found with the data. | |
589 | * \returns true if there is no problem with the structure and false otherwise. | |
590 | */ | |
591 | static bool IntegrityOk( | |
592 | const AliHLTMUONTriggerRecordStruct& tr, | |
593 | WhyNotValid* reason = NULL | |
594 | ) | |
595 | { | |
596 | AliHLTUInt32_t count = 1; | |
597 | return IntegrityOk(tr, reason, count); | |
598 | } | |
599 | ||
600 | /** | |
601 | * This method is used to check more extensively if the integrity of the | |
602 | * dHLT raw internal data block is OK and returns true in that case. | |
603 | * [in] \param block The trigger record data block to check. | |
604 | * [out] \param reason If this is not NULL, then it will be filled with | |
605 | * the reason code describing why the data block is not valid, if and | |
606 | * only if a problem is found with the data. | |
607 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
608 | * the number of the trigger record that had a problem. This value will | |
609 | * only contain a valid value if the method RecordNumberWasSet(*reason) | |
610 | * returns true. Thus, 'reason' must be set. | |
611 | * \returns true if there is no problem with the data and false otherwise. | |
612 | */ | |
613 | static bool IntegrityOk( | |
614 | const AliHLTMUONTriggerRecordsBlockStruct& block, | |
615 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
616 | ) | |
617 | { | |
618 | AliHLTUInt32_t count = 1; | |
619 | return IntegrityOk(block, reason, recordNum, count); | |
620 | } | |
621 | ||
622 | /** | |
623 | * This method is used to check more extensively if the integrity of the | |
624 | * trigger record debug information structure is OK and returns true in that case. | |
625 | * [in] \param trigInfo The trigger record debug information structure to check. | |
626 | * [out] \param reason If this is not NULL, then it will be filled with | |
627 | * the reason code describing why the structure is not valid, if and | |
628 | * only if a problem is found with the data. | |
629 | * \returns true if there is no problem with the structure and false otherwise. | |
630 | */ | |
631 | static bool IntegrityOk( | |
632 | const AliHLTMUONTrigRecInfoStruct& trigInfo, | |
633 | WhyNotValid* reason = NULL | |
634 | ) | |
635 | { | |
636 | AliHLTUInt32_t count = 1; | |
637 | return IntegrityOk(trigInfo, reason, count); | |
638 | } | |
639 | ||
640 | /** | |
641 | * This method is used to check more extensively if the integrity of the | |
642 | * dHLT raw internal data block is OK and returns true in that case. | |
643 | * [in] \param block The trigger record debugging information data block to check. | |
644 | * [out] \param reason If this is not NULL, then it will be filled with | |
645 | * the reason code describing why the data block is not valid, if and | |
646 | * only if a problem is found with the data. | |
647 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
648 | * the number of the trigger record debug information structure that had | |
649 | * a problem. This value will only contain a valid value if the method | |
650 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
651 | * \returns true if there is no problem with the data and false otherwise. | |
652 | */ | |
653 | static bool IntegrityOk( | |
654 | const AliHLTMUONTrigRecsDebugBlockStruct& block, | |
655 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
656 | ) | |
657 | { | |
658 | AliHLTUInt32_t count = 1; | |
659 | return IntegrityOk(block, reason, recordNum, count); | |
660 | } | |
661 | ||
662 | // this method is deprecated. | |
663 | static bool IntegrityOk(const AliHLTMUONTriggerChannelsBlockStruct& block, WhyNotValid* reason = NULL); | |
664 | ||
665 | /** | |
666 | * This method is used to check more extensively if the integrity of the | |
667 | * dHLT raw internal data block is OK and returns true in that case. | |
668 | * [in] \param block The reconstructed hits data block to check. | |
669 | * [out] \param reason If this is not NULL, then it will be filled with | |
670 | * the reason code describing why the data block is not valid, if and | |
671 | * only if a problem is found with the data. | |
672 | * \returns true if there is no problem with the data and false otherwise. | |
673 | */ | |
674 | static bool IntegrityOk( | |
675 | const AliHLTMUONRecHitsBlockStruct& block, | |
676 | WhyNotValid* reason = NULL | |
677 | ) | |
678 | { | |
679 | AliHLTUInt32_t count = 1; | |
680 | return IntegrityOk(block, reason, count); | |
681 | } | |
682 | ||
683 | /** | |
684 | * This method is used to check more extensively if the integrity of the | |
685 | * cluster data structure is OK and returns true in that case. | |
686 | * [in] \param cluster The cluster structure to check. | |
687 | * [out] \param reason If this is not NULL, then it will be filled with | |
688 | * the reason code describing why the structure is not valid, if and | |
689 | * only if a problem is found with the data. | |
690 | * \returns true if there is no problem with the data and false otherwise. | |
691 | */ | |
692 | static bool IntegrityOk( | |
693 | const AliHLTMUONClusterStruct& cluster, | |
694 | WhyNotValid* reason = NULL | |
695 | ) | |
696 | { | |
697 | AliHLTUInt32_t count = 1; | |
698 | return IntegrityOk(cluster, reason, count); | |
699 | } | |
700 | ||
701 | /** | |
702 | * This method is used to check more extensively if the integrity of the | |
703 | * dHLT raw internal data block is OK and returns true in that case. | |
704 | * [in] \param block The clusters data block to check. | |
705 | * [out] \param reason If this is not NULL, then it will be filled with | |
706 | * the reason code describing why the data block is not valid, if and | |
707 | * only if a problem is found with the data. | |
708 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
709 | * the number of the cluster structure that had a problem. This value | |
710 | * will only contain a valid value if the method | |
711 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
712 | * \returns true if there is no problem with the data and false otherwise. | |
713 | */ | |
714 | static bool IntegrityOk( | |
715 | const AliHLTMUONClustersBlockStruct& block, | |
716 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
717 | ) | |
718 | { | |
719 | AliHLTUInt32_t count = 1; | |
720 | return IntegrityOk(block, reason, recordNum, count); | |
721 | } | |
722 | ||
723 | /** | |
724 | * This method is used to check more extensively if the integrity of the | |
725 | * channel data structure is OK and returns true in that case. | |
726 | * [in] \param cluster The channel structure to check. | |
727 | * [out] \param reason If this is not NULL, then it will be filled with | |
728 | * the reason code describing why the structure is not valid, if and | |
729 | * only if a problem is found with the data. | |
730 | * \returns true if there is no problem with the data and false otherwise. | |
731 | */ | |
732 | static bool IntegrityOk( | |
733 | const AliHLTMUONChannelStruct& channel, | |
734 | WhyNotValid* reason = NULL | |
735 | ) | |
736 | { | |
737 | AliHLTUInt32_t count = 1; | |
738 | return IntegrityOk(channel, reason, count); | |
739 | } | |
740 | ||
741 | /** | |
742 | * This method is used to check more extensively if the integrity of the | |
743 | * dHLT raw internal data block is OK and returns true in that case. | |
744 | * [in] \param block The ADC channels data block to check. | |
745 | * [out] \param reason If this is not NULL, then it will be filled with | |
746 | * the reason code describing why the data block is not valid, if and | |
747 | * only if a problem is found with the data. | |
748 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
749 | * the number of the channel structure that had a problem. This value | |
750 | * will only contain a valid value if the method | |
751 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
752 | * \returns true if there is no problem with the data and false otherwise. | |
753 | */ | |
754 | static bool IntegrityOk( | |
755 | const AliHLTMUONChannelsBlockStruct& block, | |
756 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
757 | ) | |
758 | { | |
759 | AliHLTUInt32_t count = 1; | |
760 | return IntegrityOk(block, reason, recordNum, count); | |
761 | } | |
762 | ||
763 | /** | |
764 | * This method is used to check more extensively if the integrity of the | |
765 | * Manso track structure is OK and returns true in that case. | |
766 | * [in] \param track The Manso track structure to check. | |
767 | * [out] \param reason If this is not NULL, then it will be filled with | |
768 | * the reason code describing why the structure is not valid, if and | |
769 | * only if a problem is found with the data. | |
770 | * \returns true if there is no problem with the structure and false otherwise. | |
771 | */ | |
772 | static bool IntegrityOk( | |
773 | const AliHLTMUONMansoTrackStruct& track, | |
774 | WhyNotValid* reason = NULL | |
775 | ) | |
776 | { | |
777 | AliHLTUInt32_t count = 1; | |
778 | return IntegrityOk(track, reason, count); | |
779 | } | |
780 | ||
781 | /** | |
782 | * This method is used to check more extensively if the integrity of the | |
783 | * dHLT raw internal data block is OK and returns true in that case. | |
784 | * [in] \param block The Manso track data block to check. | |
785 | * [out] \param reason If this is not NULL, then it will be filled with | |
786 | * the reason code describing why the data block is not valid, if and | |
787 | * only if a problem is found with the data. | |
788 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
789 | * the number of the Manso track structure that had a problem. | |
790 | * This value will only contain a valid value if the method | |
791 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
792 | * \returns true if there is no problem with the data and false otherwise. | |
793 | */ | |
794 | static bool IntegrityOk( | |
795 | const AliHLTMUONMansoTracksBlockStruct& block, | |
796 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
797 | ) | |
798 | { | |
799 | AliHLTUInt32_t count = 1; | |
800 | return IntegrityOk(block, reason, recordNum, count); | |
801 | } | |
802 | ||
803 | /** | |
804 | * This method is used to check more extensively if the integrity of the | |
805 | * Manso track candidate structure is OK and returns true in that case. | |
806 | * [in] \param candidate The Manso track candidate structure to check. | |
807 | * [out] \param reason If this is not NULL, then it will be filled with | |
808 | * the reason code describing why the structure is not valid, if and | |
809 | * only if a problem is found with the data. | |
810 | * \returns true if there is no problem with the structure and false otherwise. | |
811 | */ | |
812 | static bool IntegrityOk( | |
813 | const AliHLTMUONMansoCandidateStruct& candidate, | |
814 | WhyNotValid* reason = NULL | |
815 | ) | |
816 | { | |
817 | AliHLTUInt32_t count = 1; | |
818 | return IntegrityOk(candidate, reason, count); | |
819 | } | |
820 | ||
821 | /** | |
822 | * This method is used to check more extensively if the integrity of the | |
823 | * dHLT raw internal data block is OK and returns true in that case. | |
824 | * [in] \param block The Manso track candidate data block to check. | |
825 | * [out] \param reason If this is not NULL, then it will be filled with | |
826 | * the reason code describing why the data block is not valid, if and | |
827 | * only if a problem is found with the data. | |
828 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
829 | * the number of the Manso track candidate structure that had a problem. | |
830 | * This value will only contain a valid value if the method | |
831 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
832 | * \returns true if there is no problem with the data and false otherwise. | |
833 | */ | |
834 | static bool IntegrityOk( | |
835 | const AliHLTMUONMansoCandidatesBlockStruct& block, | |
836 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
837 | ) | |
838 | { | |
839 | AliHLTUInt32_t count = 1; | |
840 | return IntegrityOk(block, reason, recordNum, count); | |
841 | } | |
842 | ||
843 | /** | |
844 | * This method is used to check more extensively if the integrity of the | |
845 | * single track trigger decision structure is OK and returns true in that case. | |
846 | * [in] \param decision The trigger decision structure to check. | |
847 | * [out] \param reason If this is not NULL, then it will be filled with | |
848 | * the reason code describing why the structure is not valid, if and | |
849 | * only if a problem is found with the data. | |
850 | * \returns true if there is no problem with the structure and false otherwise. | |
851 | */ | |
852 | static bool IntegrityOk( | |
853 | const AliHLTMUONTrackDecisionStruct& decision, | |
854 | WhyNotValid* reason = NULL | |
855 | ) | |
856 | { | |
857 | AliHLTUInt32_t count = 1; | |
858 | return IntegrityOk(decision, reason, count); | |
859 | } | |
860 | ||
861 | /** | |
862 | * This method is used to check more extensively if the integrity of the | |
863 | * dHLT raw internal data block is OK and returns true in that case. | |
864 | * [in] \param block The single track trigger decision data block to check. | |
865 | * [out] \param reason If this is not NULL, then it will be filled with | |
866 | * the reason code describing why the data block is not valid, if and | |
867 | * only if a problem is found with the data. | |
868 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
869 | * the number of the single track trigger decision structure that had | |
870 | * a problem. This value will only contain a valid value if the method | |
871 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
872 | * \returns true if there is no problem with the data and false otherwise. | |
873 | */ | |
874 | static bool IntegrityOk( | |
875 | const AliHLTMUONSinglesDecisionBlockStruct& block, | |
876 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
877 | ) | |
878 | { | |
879 | AliHLTUInt32_t count = 1; | |
880 | return IntegrityOk(block, reason, recordNum, count); | |
881 | } | |
882 | ||
883 | /** | |
884 | * This method is used to check more extensively if the integrity of the | |
885 | * track pair trigger decision structure is OK and returns true in that case. | |
886 | * [in] \param decision The trigger decision structure to check. | |
887 | * [out] \param reason If this is not NULL, then it will be filled with | |
888 | * the reason code describing why the structure is not valid, if and | |
889 | * only if a problem is found with the data. | |
890 | * \returns true if there is no problem with the structure and false otherwise. | |
891 | */ | |
892 | static bool IntegrityOk( | |
893 | const AliHLTMUONPairDecisionStruct& decision, | |
894 | WhyNotValid* reason = NULL | |
895 | ) | |
896 | { | |
897 | AliHLTUInt32_t count = 1; | |
898 | return IntegrityOk(decision, reason, count); | |
899 | } | |
900 | ||
901 | /** | |
902 | * This method is used to check more extensively if the integrity of the | |
903 | * dHLT raw internal data block is OK and returns true in that case. | |
904 | * [in] \param block The track pair trigger decision data block to check. | |
905 | * [out] \param reason If this is not NULL, then it will be filled with | |
906 | * the reason code describing why the data block is not valid, if and | |
907 | * only if a problem is found with the data. | |
908 | * [out] \param recordNum If this is not NULL, then it will be filled with | |
909 | * the number of the track pairs trigger decision structure that had | |
910 | * a problem. This value will only contain a valid value if the method | |
911 | * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set. | |
912 | * \returns true if there is no problem with the data and false otherwise. | |
913 | */ | |
914 | static bool IntegrityOk( | |
915 | const AliHLTMUONPairsDecisionBlockStruct& block, | |
916 | WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL | |
917 | ) | |
918 | { | |
919 | AliHLTUInt32_t count = 1; | |
920 | return IntegrityOk(block, reason, recordNum, count); | |
921 | } | |
b727f838 | 922 | |
923 | /** | |
90a74d7a | 924 | * Methods used to check more extensively if the integrity of various |
925 | * types of data blocks are Ok and returns true in that case. | |
b727f838 | 926 | * These can be slow and should generally only be used for debugging. |
dba14d7d | 927 | * The methods are able to return multiple reasons for the problems related |
928 | * to the data block under test. | |
b727f838 | 929 | */ |
dba14d7d | 930 | static bool IntegrityOk( |
931 | const AliHLTMUONTriggerRecordStruct& tr, | |
932 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
933 | ); | |
878cb83d | 934 | |
935 | static bool IntegrityOk( | |
936 | const AliHLTMUONTriggerRecordsBlockStruct& block, | |
dba14d7d | 937 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, |
938 | AliHLTUInt32_t& reasonCount | |
939 | ); | |
940 | ||
941 | static bool IntegrityOk( | |
942 | const AliHLTMUONTrigRecInfoStruct& trigInfo, | |
943 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
944 | ); | |
945 | ||
946 | static bool IntegrityOk( | |
947 | const AliHLTMUONTrigRecsDebugBlockStruct& block, | |
948 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, | |
949 | AliHLTUInt32_t& reasonCount | |
950 | ); | |
951 | ||
952 | static bool IntegrityOk( | |
953 | const AliHLTMUONRecHitsBlockStruct& block, | |
954 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
955 | ); | |
956 | ||
957 | static bool IntegrityOk( | |
958 | const AliHLTMUONClusterStruct& cluster, | |
959 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
960 | ); | |
961 | ||
962 | static bool IntegrityOk( | |
963 | const AliHLTMUONClustersBlockStruct& block, | |
964 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, | |
965 | AliHLTUInt32_t& reasonCount | |
966 | ); | |
967 | ||
968 | static bool IntegrityOk( | |
969 | const AliHLTMUONChannelStruct& channel, | |
970 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
971 | ); | |
972 | ||
973 | static bool IntegrityOk( | |
974 | const AliHLTMUONChannelsBlockStruct& block, | |
975 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, | |
976 | AliHLTUInt32_t& reasonCount | |
977 | ); | |
978 | ||
979 | static bool IntegrityOk( | |
980 | const AliHLTMUONMansoTrackStruct& track, | |
981 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
878cb83d | 982 | ); |
878cb83d | 983 | |
984 | static bool IntegrityOk( | |
985 | const AliHLTMUONMansoTracksBlockStruct& block, | |
dba14d7d | 986 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, |
987 | AliHLTUInt32_t& reasonCount | |
988 | ); | |
989 | ||
990 | static bool IntegrityOk( | |
991 | const AliHLTMUONMansoCandidateStruct& candidate, | |
992 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
878cb83d | 993 | ); |
994 | ||
995 | static bool IntegrityOk( | |
996 | const AliHLTMUONMansoCandidatesBlockStruct& block, | |
dba14d7d | 997 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, |
998 | AliHLTUInt32_t& reasonCount | |
878cb83d | 999 | ); |
1000 | ||
dba14d7d | 1001 | static bool IntegrityOk( |
1002 | const AliHLTMUONTrackDecisionStruct& decision, | |
1003 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
1004 | ); | |
878cb83d | 1005 | |
1006 | static bool IntegrityOk( | |
1007 | const AliHLTMUONSinglesDecisionBlockStruct& block, | |
dba14d7d | 1008 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, |
1009 | AliHLTUInt32_t& reasonCount | |
878cb83d | 1010 | ); |
1011 | ||
dba14d7d | 1012 | static bool IntegrityOk( |
1013 | const AliHLTMUONPairDecisionStruct& decision, | |
1014 | WhyNotValid* reason, AliHLTUInt32_t& reasonCount | |
1015 | ); | |
878cb83d | 1016 | |
1017 | static bool IntegrityOk( | |
1018 | const AliHLTMUONPairsDecisionBlockStruct& block, | |
dba14d7d | 1019 | WhyNotValid* reason, AliHLTUInt32_t* recordNum, |
1020 | AliHLTUInt32_t& reasonCount | |
878cb83d | 1021 | ); |
dba14d7d | 1022 | |
1023 | /** | |
1024 | * Returns true if the \em recordNum in the corresponding IntegrityOk method | |
1025 | * would have been set, if it returned false and a reason was set. | |
1026 | * This helper method makes it easy to test if the \em recordNum parameter | |
1027 | * is filled with a valid value or not. | |
1028 | */ | |
1029 | static bool RecordNumberWasSet(WhyNotValid reason); | |
26a4668d | 1030 | |
1031 | private: | |
1032 | // Should never have to create or destroy this object. | |
1033 | AliHLTMUONUtils(); | |
1034 | ~AliHLTMUONUtils(); | |
1035 | }; | |
1036 | ||
b727f838 | 1037 | //_____________________________________________________________________________ |
1038 | ||
878cb83d | 1039 | inline std::ostream& operator << (std::ostream& stream, AliHLTMUONUtils::WhyNotValid reason) |
1040 | { | |
1041 | /// Stream operator for the WhyNotValid enumeration for usage with | |
1042 | /// std::ostream classes. Allows usages such as: | |
1043 | /// AliHLTMUONUtils::WhyNotValid r; std::cout << r; | |
1044 | ||
1045 | stream << AliHLTMUONUtils::FailureReasonToString(reason); | |
1046 | return stream; | |
1047 | } | |
1048 | ||
1049 | //_____________________________________________________________________________ | |
1050 | ||
b727f838 | 1051 | // Since c++ is missing a finally "keyword" we define one. Its usage is identical |
1052 | // to a try..finally statement in Java etc.. however, since it is officialy a macro | |
1053 | // one must use the ( ) brackets instead of { } | |
1054 | // If the compiler supports __finally use it otherwise make our own. | |
1055 | #if defined(__BORLANDC__) | |
1056 | # define finally(str) __finally{str} | |
1057 | #else | |
1058 | # define finally(code) \ | |
1059 | catch(...) \ | |
1060 | { \ | |
1061 | code \ | |
1062 | throw; \ | |
1063 | }; \ | |
1064 | code | |
1065 | #endif // __BORLANDC__ | |
1066 | ||
b727f838 | 1067 | // Here we define the DebugTrace(message) macro for easy embedding of debug |
1068 | // information into the dimuon HLT code. Its usage is meant to be for generating | |
1069 | // traces of the program which are only useful during full scale debugging. | |
1070 | // Log messages should use the standard HLT logging mechanisms. | |
1071 | // The output is only generated in programs compiled with the DEBUG directive | |
1072 | // defined. Here is a usage example: | |
1073 | // | |
1074 | // // statements... | |
1075 | // DebugTrace("some debug information."); | |
1076 | // // statements... | |
1077 | // | |
1078 | // One can also use C++ ostream operators and manipulators like so: | |
1079 | // | |
1080 | // // statements... | |
1081 | // int x, y; | |
b12fe461 | 1082 | // DebugTrace("x = " << x << " and y = 0x" << std::hex << y ); |
b727f838 | 1083 | // // statements... |
1084 | // | |
1085 | #ifdef DEBUG | |
b4dfa1c8 | 1086 | # include <iostream> |
b727f838 | 1087 | # define DebugTrace(message) {std::cout << message << std::endl;} |
1088 | #else // DEBUG | |
1089 | # define DebugTrace(message) | |
1090 | #endif // DEBUG | |
1091 | ||
1092 | ||
26a4668d | 1093 | #endif // ALIHLTMUONUTILS_H |