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