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