]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONUtils.h
minor coverity defect: correcting return type of assignment operator and adding self...
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONUtils.h
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
8 ///
9 /// @file   AliHLTMUONUtils.h
10 /// @author Artur Szostak <artursz@iafrica.com>
11 /// @date   17 May 2007
12 /// @brief  Class containing various dimuon HLT utility routines and macros.
13 ///
14
15 #include "TObject.h"
16 #include "AliHLTMUONDataTypes.h"
17 #include <ostream>
18
19 // Forward declare structures.
20 extern "C" {
21 struct AliHLTMUONTriggerRecordStruct;
22 struct AliHLTMUONTriggerRecordsBlockStruct;
23 struct AliHLTMUONTrigRecInfoStruct;
24 struct AliHLTMUONTrigRecsDebugBlockStruct;
25 struct AliHLTMUONRecHitStruct;
26 struct AliHLTMUONRecHitsBlockStruct;
27 struct AliHLTMUONClusterStruct;
28 struct AliHLTMUONClustersBlockStruct;
29 struct AliHLTMUONChannelStruct;
30 struct AliHLTMUONChannelsBlockStruct;
31 struct AliHLTMUONMansoTrackStruct;
32 struct AliHLTMUONMansoTracksBlockStruct;
33 struct AliHLTMUONMansoCandidateStruct;
34 struct AliHLTMUONMansoCandidatesBlockStruct;
35 struct AliHLTMUONTrackStruct;
36 struct AliHLTMUONTracksBlockStruct;
37 struct AliHLTMUONTrackDecisionStruct;
38 struct AliHLTMUONSinglesDecisionBlockStruct;
39 struct AliHLTMUONPairDecisionStruct;
40 struct AliHLTMUONPairsDecisionBlockStruct;
41 } // extern "C"
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  */
49 class AliHLTMUONUtils
50 {
51 public:
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(
61                         AliHLTMUONParticleSign sign, const bool hitset[4]
62                 );
63
64         /**
65          * This unpacks the AliHLTMUONTriggerRecordStruct::fFlags bits into
66          * its component fields.
67          * @param [in]  flags  The flags from an AliHLTMUONTriggerRecordStruct structure.
68          * @param [out] sign    Sets this to the particle sign.
69          * @param [out] 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                 );
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          * @param [in]  flags  The flags from an AliHLTMUONRecHitStruct structure.
93          * @param [out] chamber    Sets the chamber number in the range [0..13].
94          * @param [out] 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                 );
101
102         /**
103          * Returns the detector element ID from the flags bits.
104          * @param [in]  flags  The flags from an AliHLTMUONRecHitStruct structure.
105          */
106         static AliHLTUInt16_t GetDetElemIdFromFlags(AliHLTUInt32_t flags)
107         {
108                 return flags & 0xFFF;
109         }
110
111         /**
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(
120                         AliHLTMUONParticleSign sign, const bool hitset[4]
121                 )
122         {
123                 return PackTriggerRecordFlags(sign, hitset);
124         }
125
126         /**
127          * This unpacks the AliHLTMUONMansoTrackStruct::fFlags bits into
128          * its component fields.
129          * @param [in]  flags  The flags from an AliHLTMUONMansoTrackStruct structure.
130          * @param [out] sign    Sets this to the particle sign.
131          * @param [out] 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         }
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 [in]  flags  The flags from an AliHLTMUONTrackStruct structure.
159          * @param [out] sign    Sets this to the particle sign.
160          * @param [out] 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                 );
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 [in] bits  The trigger bits from an AliHLTMUONTrackDecisionStruct
182          *              structure.
183          * @param [out] highPt Sets this to the value of the high pt cut bit.
184          * @param [out] 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 [in]  bits  The trigger bits from an AliHLTMUONPairDecisionStruct
217          *              structure.
218          * @param [out] highMass Sets this to the value of the high invariant mass cut bit.
219          * @param [out] lowMass  Sets this to the value of the low invariant mass cut bit.
220          * @param [out] unlike   Sets this if the pair is unlike sign.
221          * @param [out] highPtCount Sets this to the high pt count bits.
222          * @param [out] 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                 );
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 [in]  bits  The Pub/Sub specification word from a data block descriptor.
251          * @param [out] 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                 );
260
261         /**
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         /**
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         }
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         {
344                 AliHLTUInt32_t mask = ~AliHLTUInt32_t((1 << 22) - 1);  // First 22 bits indicate DDL number.
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         {
354                 AliHLTUInt32_t mask = AliHLTUInt32_t((1 << 22) - 1) & ~AliHLTUInt32_t((1 << 20) - 1);
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         {
364                 AliHLTUInt32_t mask = AliHLTUInt32_t((1 << 20) - 1);
365                 return (spec & mask) != 0x0;
366         }
367         
368         /**
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          */
375         static AliHLTMUONDataBlockType ParseCommandLineTypeString(const char* type);
376         
377         /**
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         /**
384          * These codes indicate the reason why a data block failed its
385          * validity check.
386          */
387         enum WhyNotValid
388         {
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.
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.
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.
398                 kInvalidDetElementNumber,  ///< An invalid detector element ID was found.
399                 kInvalidChamberNumber,  ///< An invalid chamber number was found.
400                 kHitIsNil,  ///< The hit cannot be set to a nil value.
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.
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.
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.
414                 kRoiRadiusInvalid, ///< The region of interest radius is invalid.
415                 kHitNotWithinRoi, ///< A tracks hit is not within the corresponding region of interest.
416                 kPtValueNotValid,  ///< The pT value is not positive nor -1 indicating an invalid value.
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.
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.
424         };
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);
436
437         /**
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          * \param [in]  block  The data block to check.
443          * \param [out] 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          * \param [in]  block  The data block to check.
461          * \param [out] 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         
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          * \param [in]  block  The data block to check.
479          * \param [out] 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          * \param [in]  block  The data block to check.
497          * \param [out] 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          * \param [in]  block  The data block to check.
515          * \param [out] 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          * \param [in]  block  The data block to check.
533          * \param [out] 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          * \param [in]  block  The data block to check.
551          * \param [out] 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
565          * supposed type of the tracks data block given.
566          * This method will return either kHeaderContainsWrongType or
567          * kHeaderContainsWrongRecordWidth as the reason code.
568          * \param [in]  block  The data block to check.
569          * \param [out] 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
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          * \param [in]  block  The data block to check.
587          * \param [out] 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          * \param [in]  block  The data block to check.
605          * \param [out] 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         /**
618          * Methods used to check if the header information corresponds to the
619          * supposed type of the data block.
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(
662                         const AliHLTMUONTracksBlockStruct& block,
663                         WhyNotValid* reason, AliHLTUInt32_t& reasonCount
664                 );
665         
666         static bool HeaderOk(
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          * \param [in]  tr  The trigger record structure to check.
680          * \param [out] 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          * \param [in]  block  The trigger record data block to check.
698          * \param [out] 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          * \param [out] 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          * \param [in]  trigInfo  The trigger record debug information structure to check.
720          * \param [out] 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          * \param [in]  block  The trigger record debugging information data block to check.
738          * \param [out] 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          * \param [out] 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         
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          * \param [in]  hit  The reconstructed hit structure to check.
760          * \param [out] 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         }
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          * \param [in]  block  The reconstructed hits data block to check.
778          * \param [out] 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.
781          * \param [out] 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.
785          * \returns  true if there is no problem with the data and false otherwise.
786          */
787         static bool IntegrityOk(
788                         const AliHLTMUONRecHitsBlockStruct& block,
789                         WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
790                 )
791         {
792                 AliHLTUInt32_t count = 1;
793                 return IntegrityOk(block, reason, recordNum, count);
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          * \param [in]  cluster  The cluster structure to check.
800          * \param [out] 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          * \param [in]  block  The clusters data block to check.
818          * \param [out] 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          * \param [out] 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          * \param [in]  cluster  The channel structure to check.
840          * \param [out] 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          * \param [in]  block  The ADC channels data block to check.
858          * \param [out] 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          * \param [out] 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          * \param [in]  track  The Manso track structure to check.
880          * \param [out] 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          * \param [in]  block  The Manso track data block to check.
898          * \param [out] 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          * \param [out] 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          * \param [in]  candidate  The Manso track candidate structure to check.
920          * \param [out] 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          * \param [in]  block  The Manso track candidate data block to check.
938          * \param [out] 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          * \param [out] 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
958          * full track structure is OK and returns true in that case.
959          * \param [in]  track  The track structure to check.
960          * \param [out] 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          * \param [in]  block  The track data block to check.
978          * \param [out] 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          * \param [out] 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
998          * single track trigger decision structure is OK and returns true in that case.
999          * \param [in]  decision  The trigger decision structure to check.
1000          * \param [out] 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          * \param [in]  block  The single track trigger decision data block to check.
1018          * \param [out] 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          * \param [out] 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          * \param [in]  decision  The trigger decision structure to check.
1040          * \param [out] 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          * \param [in]  block  The track pair trigger decision data block to check.
1058          * \param [out] 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          * \param [out] 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         }
1075
1076         /**
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.
1079          * These can be slow and should generally only be used for debugging.
1080          * The methods are able to return multiple reasons for the problems related
1081          * to the data block under test.
1082          */
1083         static bool IntegrityOk(
1084                         const AliHLTMUONTriggerRecordStruct& tr,
1085                         WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1086                 );
1087         
1088         static bool IntegrityOk(
1089                         const AliHLTMUONTriggerRecordsBlockStruct& block,
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(
1106                         const AliHLTMUONRecHitStruct& hit,
1107                         WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1108                 );
1109         
1110         static bool IntegrityOk(
1111                         const AliHLTMUONRecHitsBlockStruct& block,
1112                         WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1113                         AliHLTUInt32_t& reasonCount
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
1141                 );
1142         
1143         static bool IntegrityOk(
1144                         const AliHLTMUONMansoTracksBlockStruct& block,
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
1152                 );
1153         
1154         static bool IntegrityOk(
1155                         const AliHLTMUONMansoCandidatesBlockStruct& block,
1156                         WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1157                         AliHLTUInt32_t& reasonCount
1158                 );
1159         
1160         static bool IntegrityOk(
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(
1172                         const AliHLTMUONTrackDecisionStruct& decision,
1173                         WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1174                 );
1175         
1176         static bool IntegrityOk(
1177                         const AliHLTMUONSinglesDecisionBlockStruct& block,
1178                         WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1179                         AliHLTUInt32_t& reasonCount
1180                 );
1181         
1182         static bool IntegrityOk(
1183                         const AliHLTMUONPairDecisionStruct& decision,
1184                         WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1185                 );
1186         
1187         static bool IntegrityOk(
1188                         const AliHLTMUONPairsDecisionBlockStruct& block,
1189                         WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1190                         AliHLTUInt32_t& reasonCount
1191                 );
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);
1200
1201 private:
1202
1203         // Should never have to create, copy or destroy this object.
1204         AliHLTMUONUtils() {}
1205         AliHLTMUONUtils(const AliHLTMUONUtils& obj);
1206         virtual ~AliHLTMUONUtils() {}
1207         AliHLTMUONUtils& operator = (const AliHLTMUONUtils& obj);
1208         
1209         ClassDef(AliHLTMUONUtils, 0);  // Interface for helpful dHLT utility methods.
1210 };
1211
1212 //_____________________________________________________________________________
1213
1214 inline 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
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
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.
1246 // The output is only generated in programs compiled with the DEBUGTRACE directive
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;
1257 //  DebugTrace("x = " << x << " and y = 0x" << std::hex << y );
1258 //  // statements...
1259 //
1260 #ifdef DEBUGTRACE
1261 #       include <iostream>
1262 #       define DebugTrace(message) {std::cout << message << std::endl;}
1263 #else // DEBUG
1264 #       define DebugTrace(message)
1265 #endif // DEBUG
1266
1267
1268 #endif // ALIHLTMUONUTILS_H