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 */
9 /// @file AliHLTMUONUtils.h
10 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @brief Class containing various dimuon HLT utility routines and macros.
16 #include "AliHLTMUONDataTypes.h"
19 // Forward declare structures.
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;
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
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
56 * @return Returns the 32 bit packed word.
58 static AliHLTUInt32_t PackTriggerRecordFlags(
59 AliHLTMUONParticleSign sign, const bool hitset[4]
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.
70 static void UnpackTriggerRecordFlags(
71 AliHLTUInt32_t flags, // [in]
72 AliHLTMUONParticleSign& sign, // [out]
73 bool hitset[4] // [out]
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.
83 static AliHLTUInt32_t PackRecHitFlags(
84 AliHLTUInt8_t chamber, AliHLTUInt16_t detElemId
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.
94 static void UnpackRecHitFlags(
95 AliHLTUInt32_t flags, // [in]
96 AliHLTUInt8_t& chamber, // [out]
97 AliHLTUInt16_t& detElemId // [out]
101 * This packs the given parameters into the bits of a word appropriate
102 * for AliHLTMUONMansoTrackStruct::fFlags.
103 * @param sign The particle sign.
104 * @param hitset Flags to indicate if the corresponding fHits[i] elements
106 * @return Returns the 32 bit packed word.
108 static AliHLTUInt32_t PackMansoTrackFlags(
109 AliHLTMUONParticleSign sign, const bool hitset[4]
112 return PackTriggerRecordFlags(sign, hitset);
116 * This unpacks the AliHLTMUONMansoTrackStruct::fFlags bits into
117 * its component fields.
118 * @param flags The flags from an AliHLTMUONMansoTrackStruct structure.
119 * @param sign Sets this to the particle sign.
120 * @param hitset Sets the array elements to indicate if the corresponding
121 * fHits[i] element was set/filled.
123 static void UnpackMansoTrackFlags(
124 AliHLTUInt32_t flags, // [in]
125 AliHLTMUONParticleSign& sign, // [out]
126 bool hitset[4] // [out]
129 UnpackTriggerRecordFlags(flags, sign, hitset);
133 * This packs the given parameters into the bits of a word appropriate
134 * for AliHLTMUONTrackDecisionStruct::fTriggerBits.
135 * @param highPt Has the track passed the high pt cut.
136 * @param lowPt Has the track passed the low pt cut.
137 * @return Returns the 32 bit packed word.
139 static AliHLTUInt32_t PackTrackDecisionBits(bool highPt, bool lowPt);
142 * This unpacks the AliHLTMUONTrackDecisionStruct::fTriggerBits bits into
143 * its component fields.
144 * @param bits The trigger bits from an AliHLTMUONTrackDecisionStruct
146 * @param highPt Sets this to the value of the high pt cut bit.
147 * @param lowPt Sets this to the value of the low pt cut bit.
149 static void UnpackTrackDecisionBits(
150 AliHLTUInt32_t bits, // [in]
151 bool& highPt, // [out]
156 * This packs the given parameters into the bits of a word appropriate
157 * for AliHLTMUONPairDecisionStruct::fTriggerBits.
159 * @param highMass Has the track pair passed the high invariant mass cut.
160 * @param lowMass Has the track pair passed the low invariant mass cut.
161 * @param unlike Does the track pair have unlike signs.
162 * @param highPtCount The number of tracks that passed the high pt cut
164 * @param lowPtCount The number of tracks that passed the low pt cut
166 * @return Returns the 32 bit packed word.
168 * Note: Must have highPtCount + lowPtCount <= 2 and unlike == true if
169 * highMass or lowMass is true.
171 static AliHLTUInt32_t PackPairDecisionBits(
172 bool highMass, bool lowMass, bool unlike,
173 AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount
177 * This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
178 * its component fields.
179 * @param bits The trigger bits from an AliHLTMUONPairDecisionStruct
181 * @param highMass Sets this to the value of the high invariant mass cut bit.
182 * @param lowMass Sets this to the value of the low invariant mass cut bit.
183 * @param unlike Sets this if the pair is unlike sign.
184 * @param highPtCount Sets this to the high pt count bits.
185 * @param lowPtCount Sets this to the low pt count bits.
187 static void UnpackPairDecisionBits(
188 AliHLTUInt32_t bits, // [in]
189 bool& highMass, // [out]
190 bool& lowMass, // [out]
191 bool& unlike, // [out]
192 AliHLTUInt8_t& highPtCount, // [out]
193 AliHLTUInt8_t& lowPtCount // [out]
197 * This packs the given parameters into the 32bit Pub/Sub specification
198 * word in the data block descriptor.
200 * @param ddl The list of DDLs forming part of the readout. ddl[0]
201 * indicates DDL number 2560, ddl[1] is for DDL 2561 and so
202 * on up to ddl[19]. ddl[20] and ddl[21] will be for the
203 * trigger DDLs 2816 and 2817 respectively.
204 * @return Returns the 32 bit packed specification word.
206 static AliHLTUInt32_t PackSpecBits(
211 * This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
212 * its component fields.
213 * @param bits The Pub/Sub specification word from a data block descriptor.
214 * @param ddl The output list of DDLs forming part of the readout. ddl[0]
215 * indicates DDL number 2560, ddl[1] is for DDL 2561 and so
216 * on up to ddl[19]. ddl[20] and ddl[21] will be for the
217 * trigger DDLs 2816 and 2817 respectively.
219 static void UnpackSpecBits(
220 AliHLTUInt32_t bits, // [in]
221 bool ddl[22] // [out]
225 * This method converts the DDL number for the muon spectrometer in the
226 * range [0..21] to the equipment ID number.
227 * @param ddlNo The DDL number in the range [0..21].
228 * @return Returns the equipment ID number or -1 if ddlNo was invalid.
230 static AliHLTInt32_t DDLNumberToEquipId(AliHLTInt32_t ddlNo);
233 * This method converts the equipment ID number for a muon spectrometer
234 * DDL to the DDL number in the range [0..21].
235 * @param id The equipment ID of the DDL.
236 * @return Returns the DDL number in the range [0..21] or -1 if the
237 * equipment ID was invalid.
239 static AliHLTInt32_t EquipIdToDDLNumber(AliHLTInt32_t id);
242 * This method converts a 32 bit data block specification for a MUON-HLT
243 * data block into its corresponding DDL equipment ID number.
244 * It is assumed that the specification is for a data block comming from
245 * a single DDL source. If more than one DDL contributed to the data block
246 * then -1 is returned.
247 * @param spec The 32 bit specification for a data block.
248 * @return Returns the equipment ID corresponding to the specification
249 * or -1 if the specification was invalid.
251 static AliHLTInt32_t SpecToEquipId(AliHLTUInt32_t spec);
254 * This method converts a equipment ID number for a DDL into its corresponding
255 * 32 bit data block specification for the MUON-HLT.
256 * @param id The equipment ID number of the DDL.
257 * @return Returns the 32 bit data block specification or 0x0 if the
258 * equipment ID was invalid.
260 static AliHLTUInt32_t EquipIdToSpec(AliHLTInt32_t id);
263 * This method converts a 32 bit data block specification for a MUON-HLT
264 * data block into its corresponding DDL number in the range [0..21].
265 * It is assumed that the specification is for a data block comming from
266 * a single DDL source. If more than one DDL contributed to the data block
267 * then -1 is returned.
268 * @param spec The 32 bit specification for a data block.
269 * @return Returns the corresponding DDL number for the specification
270 * or -1 if the specification was invalid.
272 static AliHLTInt32_t SpecToDDLNumber(AliHLTUInt32_t spec);
275 * This method converts a DDL number in the range [0..21] into its
276 * corresponding 32 bit data block specification for the MUON-HLT.
277 * @param ddlNo The equipment ID number of the DDL.
278 * @return Returns the 32 bit data block specification or 0x0 if the
279 * DDL number was invalid (out of range).
281 static AliHLTUInt32_t DDLNumberToSpec(AliHLTInt32_t ddlNo);
284 * Returns true if the given specification was for a single trigger DDL.
286 static bool IsTriggerDDL(AliHLTUInt32_t spec)
288 AliHLTInt32_t ddl = SpecToDDLNumber(spec);
289 return (20 <= ddl and ddl <= 21);
293 * Returns true if the given specification was for a single tracker DDL.
295 static bool IsTrackerDDL(AliHLTUInt32_t spec)
297 AliHLTInt32_t ddl = SpecToDDLNumber(spec);
298 return (0 <= ddl and ddl <= 19);
302 * Returns true if the given specification is in principle valid.
303 * It checks if the bits that should be zero are indeed zero.
305 static bool IsSpecValid(AliHLTUInt32_t spec)
307 AliHLTUInt32_t mask = ~((1 << 22) - 1); // First 22 bits indicate DDL number.
308 return (spec & mask) == 0x0;
312 * Returns true if the data specification indicates the data block contains
313 * information generated from a trigger DDL or data fragments thereof.
315 static bool ContainsDataFromTrigger(AliHLTUInt32_t spec)
317 AliHLTUInt32_t mask = ((1 << 22) - 1) & ~((1 << 20) - 1);
318 return (spec & mask) != 0x0;
322 * Returns true if the data specification indicates the data block contains
323 * information generated from a tracker DDL or data fragments thereof.
325 static bool ContainsDataFromTracker(AliHLTUInt32_t spec)
327 AliHLTUInt32_t mask = ((1 << 20) - 1);
328 return (spec & mask) != 0x0;
332 * Parses the string containing the type name of a dHLT data block and
333 * returns the corresponding AliHLTMUONDataBlockType value.
334 * \param type The string containing the type name.
335 * \returns The data block type or kUnknownDataBlock if the type name
338 static AliHLTMUONDataBlockType ParseCommandLineTypeString(const char* type);
341 * Converts a type ID to a type string to be used for the dHLT FilePublisher
342 * component configuration parameters for example.
344 static const char* DataBlockTypeToString(AliHLTMUONDataBlockType type);
347 * These codes indicate the reason why a data block failed its
352 kNoReason, ///< There was no reason for failure.
353 kHeaderContainsWrongType, ///< The common header contains an incorrect type ID.
354 kHeaderContainsWrongRecordWidth, ///< The common header contains an incorrect data record width.
355 kInvalidIdValue, ///< The structure identifier does not have a valid value.
356 kInvalidTriggerIdValue, ///< The trigger structure identifier does not have a valid value.
357 kInvalidTrackIdValue, ///< The track structure identifier does not have a valid value.
358 kReservedBitsNotZero, ///< Reserved bits have not been set to zero.
359 kParticleSignBitsNotValid, ///< The particle sign bits are not a valid value.
360 kHitNotMarkedAsNil, ///< A hit was marked as not found, but the corresponding hit structure was not set to nil.
361 kInvalidDetElementNumber, ///< An invalid detector element ID was found.
362 kInvalidChamberNumber, ///< An invalid chamber number was found.
363 kHitIsNil, ///< The hit cannot be set to a nil value.
364 kInvalidChannelCount, ///< The number of channels indicated is zero or outside the valid range.
365 kInvalidBusPatchId, ///< The bus patch ID is outside the valid range.
366 kInvalidManuId, ///< The MANU ID is outside the valid range.
367 kInvalidChannelAddress, ///< The MANU channel address is outside the valid range.
368 kInvalidSignal, ///< The ADC signal value is outside the valid range.
369 kDataWordDifferent, ///< The raw data word is different from the unpacked values.
370 kChiSquareInvalid, ///< The chi squared value must be a positive value or -1 indicating a fitting error.
371 kMomentumVectorNotZero, ///< The chi sqaured value is set to -1, but momentum vector not zero.
372 kRoiRadiusInvalid, ///< The region of interest radius is invalid.
373 kHitNotWithinRoi, ///< A tracks hit is not within the corresponding region of interest.
374 kPtValueNotValid, ///< The pT value is not positive nor -1 indicating an invalid value.
375 kPairTrackIdsAreIdentical, ///< The track IDs of the track pair are identical.
376 kMassValueNotValid, ///< The invariant mass value is not positive nor -1 indicating an invalid value.
377 kLowPtCountInvalid, ///< The low pT trigger count is greater than 2, which is invalid.
378 kHighPtCountInvalid, ///< The high pT trigger count is greater than 2, which is invalid.
379 kFoundDuplicateIDs, ///< Found duplicate identifiers, but they should all be unique.
380 kFoundDuplicateHits, ///< Found duplicate hits.
381 kFoundDuplicateTriggers ///< Found duplicate trigger decisions.
385 * This method converts the WhyNotValid enumeration to a string representation.
387 static const char* FailureReasonToString(WhyNotValid reason);
390 * This method returns a string containing a user readable message explaining
391 * the reason for failure described by the WhyNotValid enumeration.
393 static const char* FailureReasonToMessage(WhyNotValid reason);
396 * Method used to check if the header information corresponds to the
397 * supposed type of the trigger records data block.
398 * This method will return either kHeaderContainsWrongType or
399 * kHeaderContainsWrongRecordWidth as the reason code.
400 * [in] \param block The data block to check.
401 * [out] \param reason If this is not NULL, then the variable pointed to
402 * by this pointer will be filled with the reason code describing why
403 * the header is not valid, if and only if a problem is found with
405 * \returns true if there is no problem with the header and false otherwise.
407 static bool HeaderOk(const AliHLTMUONTriggerRecordsBlockStruct& block, WhyNotValid* reason = NULL)
409 AliHLTUInt32_t count = 1;
410 return HeaderOk(block, reason, count);
414 * Method used to check if the header information corresponds to the
415 * supposed type of the trigger debug information data block.
416 * This method will return either kHeaderContainsWrongType or
417 * kHeaderContainsWrongRecordWidth as the reason code.
418 * [in] \param block The data block to check.
419 * [out] \param reason If this is not NULL, then the variable pointed to
420 * by this pointer will be filled with the reason code describing why
421 * the header is not valid, if and only if a problem is found with
423 * \returns true if there is no problem with the header and false otherwise.
425 static bool HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block, WhyNotValid* reason = NULL)
427 AliHLTUInt32_t count = 1;
428 return HeaderOk(block, reason, count);
432 * Method used to check if the header information corresponds to the
433 * supposed type of the reconstructed hits data block.
434 * This method will return either kHeaderContainsWrongType or
435 * kHeaderContainsWrongRecordWidth as the reason code.
436 * [in] \param block The data block to check.
437 * [out] \param reason If this is not NULL, then the variable pointed to
438 * by this pointer will be filled with the reason code describing why
439 * the header is not valid, if and only if a problem is found with
441 * \returns true if there is no problem with the header and false otherwise.
443 static bool HeaderOk(const AliHLTMUONRecHitsBlockStruct& block, WhyNotValid* reason = NULL)
445 AliHLTUInt32_t count = 1;
446 return HeaderOk(block, reason, count);
450 * Method used to check if the header information corresponds to the
451 * supposed type of the clusters data block.
452 * This method will return either kHeaderContainsWrongType or
453 * kHeaderContainsWrongRecordWidth as the reason code.
454 * [in] \param block The data block to check.
455 * [out] \param reason If this is not NULL, then the variable pointed to
456 * by this pointer will be filled with the reason code describing why
457 * the header is not valid, if and only if a problem is found with
459 * \returns true if there is no problem with the header and false otherwise.
461 static bool HeaderOk(const AliHLTMUONClustersBlockStruct& block, WhyNotValid* reason = NULL)
463 AliHLTUInt32_t count = 1;
464 return HeaderOk(block, reason, count);
468 * Method used to check if the header information corresponds to the
469 * supposed type of the channels data block.
470 * This method will return either kHeaderContainsWrongType or
471 * kHeaderContainsWrongRecordWidth as the reason code.
472 * [in] \param block The data block to check.
473 * [out] \param reason If this is not NULL, then the variable pointed to
474 * by this pointer will be filled with the reason code describing why
475 * the header is not valid, if and only if a problem is found with
477 * \returns true if there is no problem with the header and false otherwise.
479 static bool HeaderOk(const AliHLTMUONChannelsBlockStruct& block, WhyNotValid* reason = NULL)
481 AliHLTUInt32_t count = 1;
482 return HeaderOk(block, reason, count);
486 * Method used to check if the header information corresponds to the
487 * supposed type of the Manso tracks data block.
488 * This method will return either kHeaderContainsWrongType or
489 * kHeaderContainsWrongRecordWidth as the reason code.
490 * [in] \param block The data block to check.
491 * [out] \param reason If this is not NULL, then the variable pointed to
492 * by this pointer will be filled with the reason code describing why
493 * the header is not valid, if and only if a problem is found with
495 * \returns true if there is no problem with the header and false otherwise.
497 static bool HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block, WhyNotValid* reason = NULL)
499 AliHLTUInt32_t count = 1;
500 return HeaderOk(block, reason, count);
504 * Method used to check if the header information corresponds to the
505 * supposed type of the Manso candidates data block.
506 * This method will return either kHeaderContainsWrongType or
507 * kHeaderContainsWrongRecordWidth as the reason code.
508 * [in] \param block The data block to check.
509 * [out] \param reason If this is not NULL, then the variable pointed to
510 * by this pointer will be filled with the reason code describing why
511 * the header is not valid, if and only if a problem is found with
513 * \returns true if there is no problem with the header and false otherwise.
515 static bool HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block, WhyNotValid* reason = NULL)
517 AliHLTUInt32_t count = 1;
518 return HeaderOk(block, reason, count);
522 * Method used to check if the header information corresponds to the
523 * supposed type of the single tracks dHLT trigger decision data block.
524 * This method will return either kHeaderContainsWrongType or
525 * kHeaderContainsWrongRecordWidth as the reason code.
526 * [in] \param block The data block to check.
527 * [out] \param reason If this is not NULL, then the variable pointed to
528 * by this pointer will be filled with the reason code describing why
529 * the header is not valid, if and only if a problem is found with
531 * \returns true if there is no problem with the header and false otherwise.
533 static bool HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block, WhyNotValid* reason = NULL)
535 AliHLTUInt32_t count = 1;
536 return HeaderOk(block, reason, count);
540 * Method used to check if the header information corresponds to the
541 * supposed type of the track pairs dHLT trigger decision data block.
542 * This method will return either kHeaderContainsWrongType or
543 * kHeaderContainsWrongRecordWidth as the reason code.
544 * [in] \param block The data block to check.
545 * [out] \param reason If this is not NULL, then the variable pointed to
546 * by this pointer will be filled with the reason code describing why
547 * the header is not valid, if and only if a problem is found with
549 * \returns true if there is no problem with the header and false otherwise.
551 static bool HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block, WhyNotValid* reason = NULL)
553 AliHLTUInt32_t count = 1;
554 return HeaderOk(block, reason, count);
558 * Methods used to check if the header information corresponds to the
559 * supposed type of the data block.
560 * If the 'reason' parameter should point to an array which will store
561 * the reason codes indicating the problems with the data block.
562 * The 'reasonCount' parameter should initialy contain the number of
563 * elements that can be stored in reason. When the method exits it will
564 * store the number of elements in the 'reason' array actually filled.
566 static bool HeaderOk(
567 const AliHLTMUONTriggerRecordsBlockStruct& block,
568 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
571 static bool HeaderOk(
572 const AliHLTMUONTrigRecsDebugBlockStruct& block,
573 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
576 static bool HeaderOk(
577 const AliHLTMUONRecHitsBlockStruct& block,
578 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
581 static bool HeaderOk(
582 const AliHLTMUONClustersBlockStruct& block,
583 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
586 static bool HeaderOk(
587 const AliHLTMUONChannelsBlockStruct& block,
588 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
591 static bool HeaderOk(
592 const AliHLTMUONMansoTracksBlockStruct& block,
593 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
596 static bool HeaderOk(
597 const AliHLTMUONMansoCandidatesBlockStruct& block,
598 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
601 static bool HeaderOk(
602 const AliHLTMUONSinglesDecisionBlockStruct& block,
603 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
606 static bool HeaderOk(
607 const AliHLTMUONPairsDecisionBlockStruct& block,
608 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
612 * This method is used to check more extensively if the integrity of the
613 * trigger record structure is OK and returns true in that case.
614 * [in] \param tr The trigger record structure to check.
615 * [out] \param reason If this is not NULL, then it will be filled with
616 * the reason code describing why the structure is not valid, if and
617 * only if a problem is found with the data.
618 * \returns true if there is no problem with the structure and false otherwise.
620 static bool IntegrityOk(
621 const AliHLTMUONTriggerRecordStruct& tr,
622 WhyNotValid* reason = NULL
625 AliHLTUInt32_t count = 1;
626 return IntegrityOk(tr, reason, count);
630 * This method is used to check more extensively if the integrity of the
631 * dHLT raw internal data block is OK and returns true in that case.
632 * [in] \param block The trigger record data block to check.
633 * [out] \param reason If this is not NULL, then it will be filled with
634 * the reason code describing why the data block is not valid, if and
635 * only if a problem is found with the data.
636 * [out] \param recordNum If this is not NULL, then it will be filled with
637 * the number of the trigger record that had a problem. This value will
638 * only contain a valid value if the method RecordNumberWasSet(*reason)
639 * returns true. Thus, 'reason' must be set.
640 * \returns true if there is no problem with the data and false otherwise.
642 static bool IntegrityOk(
643 const AliHLTMUONTriggerRecordsBlockStruct& block,
644 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
647 AliHLTUInt32_t count = 1;
648 return IntegrityOk(block, reason, recordNum, count);
652 * This method is used to check more extensively if the integrity of the
653 * trigger record debug information structure is OK and returns true in that case.
654 * [in] \param trigInfo The trigger record debug information structure to check.
655 * [out] \param reason If this is not NULL, then it will be filled with
656 * the reason code describing why the structure is not valid, if and
657 * only if a problem is found with the data.
658 * \returns true if there is no problem with the structure and false otherwise.
660 static bool IntegrityOk(
661 const AliHLTMUONTrigRecInfoStruct& trigInfo,
662 WhyNotValid* reason = NULL
665 AliHLTUInt32_t count = 1;
666 return IntegrityOk(trigInfo, reason, count);
670 * This method is used to check more extensively if the integrity of the
671 * dHLT raw internal data block is OK and returns true in that case.
672 * [in] \param block The trigger record debugging information data block to check.
673 * [out] \param reason If this is not NULL, then it will be filled with
674 * the reason code describing why the data block is not valid, if and
675 * only if a problem is found with the data.
676 * [out] \param recordNum If this is not NULL, then it will be filled with
677 * the number of the trigger record debug information structure that had
678 * a problem. This value will only contain a valid value if the method
679 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
680 * \returns true if there is no problem with the data and false otherwise.
682 static bool IntegrityOk(
683 const AliHLTMUONTrigRecsDebugBlockStruct& block,
684 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
687 AliHLTUInt32_t count = 1;
688 return IntegrityOk(block, reason, recordNum, count);
692 * This method is used to check more extensively if the integrity of the
693 * reconstructed hit structure is OK and returns true in that case.
694 * [in] \param hit The reconstructed hit structure to check.
695 * [out] \param reason If this is not NULL, then it will be filled with
696 * the reason code describing why the structure is not valid, if and
697 * only if a problem is found with the data.
698 * \returns true if there is no problem with the data and false otherwise.
700 static bool IntegrityOk(
701 const AliHLTMUONRecHitStruct& hit,
702 WhyNotValid* reason = NULL
705 AliHLTUInt32_t count = 1;
706 return IntegrityOk(hit, reason, count);
710 * This method is used to check more extensively if the integrity of the
711 * dHLT raw internal data block is OK and returns true in that case.
712 * [in] \param block The reconstructed hits data block to check.
713 * [out] \param reason If this is not NULL, then it will be filled with
714 * the reason code describing why the data block is not valid, if and
715 * only if a problem is found with the data.
716 * [out] \param recordNum If this is not NULL, then it will be filled with
717 * the number of the cluster structure that had a problem. This value
718 * will only contain a valid value if the method
719 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
720 * \returns true if there is no problem with the data and false otherwise.
722 static bool IntegrityOk(
723 const AliHLTMUONRecHitsBlockStruct& block,
724 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
727 AliHLTUInt32_t count = 1;
728 return IntegrityOk(block, reason, recordNum, count);
732 * This method is used to check more extensively if the integrity of the
733 * cluster data structure is OK and returns true in that case.
734 * [in] \param cluster The cluster structure to check.
735 * [out] \param reason If this is not NULL, then it will be filled with
736 * the reason code describing why the structure is not valid, if and
737 * only if a problem is found with the data.
738 * \returns true if there is no problem with the data and false otherwise.
740 static bool IntegrityOk(
741 const AliHLTMUONClusterStruct& cluster,
742 WhyNotValid* reason = NULL
745 AliHLTUInt32_t count = 1;
746 return IntegrityOk(cluster, reason, count);
750 * This method is used to check more extensively if the integrity of the
751 * dHLT raw internal data block is OK and returns true in that case.
752 * [in] \param block The clusters data block to check.
753 * [out] \param reason If this is not NULL, then it will be filled with
754 * the reason code describing why the data block is not valid, if and
755 * only if a problem is found with the data.
756 * [out] \param recordNum If this is not NULL, then it will be filled with
757 * the number of the cluster structure that had a problem. This value
758 * will only contain a valid value if the method
759 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
760 * \returns true if there is no problem with the data and false otherwise.
762 static bool IntegrityOk(
763 const AliHLTMUONClustersBlockStruct& block,
764 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
767 AliHLTUInt32_t count = 1;
768 return IntegrityOk(block, reason, recordNum, count);
772 * This method is used to check more extensively if the integrity of the
773 * channel data structure is OK and returns true in that case.
774 * [in] \param cluster The channel structure to check.
775 * [out] \param reason If this is not NULL, then it will be filled with
776 * the reason code describing why the structure is not valid, if and
777 * only if a problem is found with the data.
778 * \returns true if there is no problem with the data and false otherwise.
780 static bool IntegrityOk(
781 const AliHLTMUONChannelStruct& channel,
782 WhyNotValid* reason = NULL
785 AliHLTUInt32_t count = 1;
786 return IntegrityOk(channel, reason, count);
790 * This method is used to check more extensively if the integrity of the
791 * dHLT raw internal data block is OK and returns true in that case.
792 * [in] \param block The ADC channels data block to check.
793 * [out] \param reason If this is not NULL, then it will be filled with
794 * the reason code describing why the data block is not valid, if and
795 * only if a problem is found with the data.
796 * [out] \param recordNum If this is not NULL, then it will be filled with
797 * the number of the channel structure that had a problem. This value
798 * will only contain a valid value if the method
799 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
800 * \returns true if there is no problem with the data and false otherwise.
802 static bool IntegrityOk(
803 const AliHLTMUONChannelsBlockStruct& block,
804 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
807 AliHLTUInt32_t count = 1;
808 return IntegrityOk(block, reason, recordNum, count);
812 * This method is used to check more extensively if the integrity of the
813 * Manso track structure is OK and returns true in that case.
814 * [in] \param track The Manso track structure to check.
815 * [out] \param reason If this is not NULL, then it will be filled with
816 * the reason code describing why the structure is not valid, if and
817 * only if a problem is found with the data.
818 * \returns true if there is no problem with the structure and false otherwise.
820 static bool IntegrityOk(
821 const AliHLTMUONMansoTrackStruct& track,
822 WhyNotValid* reason = NULL
825 AliHLTUInt32_t count = 1;
826 return IntegrityOk(track, reason, count);
830 * This method is used to check more extensively if the integrity of the
831 * dHLT raw internal data block is OK and returns true in that case.
832 * [in] \param block The Manso track data block to check.
833 * [out] \param reason If this is not NULL, then it will be filled with
834 * the reason code describing why the data block is not valid, if and
835 * only if a problem is found with the data.
836 * [out] \param recordNum If this is not NULL, then it will be filled with
837 * the number of the Manso track structure that had a problem.
838 * This value will only contain a valid value if the method
839 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
840 * \returns true if there is no problem with the data and false otherwise.
842 static bool IntegrityOk(
843 const AliHLTMUONMansoTracksBlockStruct& block,
844 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
847 AliHLTUInt32_t count = 1;
848 return IntegrityOk(block, reason, recordNum, count);
852 * This method is used to check more extensively if the integrity of the
853 * Manso track candidate structure is OK and returns true in that case.
854 * [in] \param candidate The Manso track candidate structure to check.
855 * [out] \param reason If this is not NULL, then it will be filled with
856 * the reason code describing why the structure is not valid, if and
857 * only if a problem is found with the data.
858 * \returns true if there is no problem with the structure and false otherwise.
860 static bool IntegrityOk(
861 const AliHLTMUONMansoCandidateStruct& candidate,
862 WhyNotValid* reason = NULL
865 AliHLTUInt32_t count = 1;
866 return IntegrityOk(candidate, reason, count);
870 * This method is used to check more extensively if the integrity of the
871 * dHLT raw internal data block is OK and returns true in that case.
872 * [in] \param block The Manso track candidate data block to check.
873 * [out] \param reason If this is not NULL, then it will be filled with
874 * the reason code describing why the data block is not valid, if and
875 * only if a problem is found with the data.
876 * [out] \param recordNum If this is not NULL, then it will be filled with
877 * the number of the Manso track candidate structure that had a problem.
878 * This value will only contain a valid value if the method
879 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
880 * \returns true if there is no problem with the data and false otherwise.
882 static bool IntegrityOk(
883 const AliHLTMUONMansoCandidatesBlockStruct& block,
884 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
887 AliHLTUInt32_t count = 1;
888 return IntegrityOk(block, reason, recordNum, count);
892 * This method is used to check more extensively if the integrity of the
893 * single track trigger decision structure is OK and returns true in that case.
894 * [in] \param decision The trigger decision structure to check.
895 * [out] \param reason If this is not NULL, then it will be filled with
896 * the reason code describing why the structure is not valid, if and
897 * only if a problem is found with the data.
898 * \returns true if there is no problem with the structure and false otherwise.
900 static bool IntegrityOk(
901 const AliHLTMUONTrackDecisionStruct& decision,
902 WhyNotValid* reason = NULL
905 AliHLTUInt32_t count = 1;
906 return IntegrityOk(decision, reason, count);
910 * This method is used to check more extensively if the integrity of the
911 * dHLT raw internal data block is OK and returns true in that case.
912 * [in] \param block The single track trigger decision data block to check.
913 * [out] \param reason If this is not NULL, then it will be filled with
914 * the reason code describing why the data block is not valid, if and
915 * only if a problem is found with the data.
916 * [out] \param recordNum If this is not NULL, then it will be filled with
917 * the number of the single track trigger decision structure that had
918 * a problem. This value will only contain a valid value if the method
919 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
920 * \returns true if there is no problem with the data and false otherwise.
922 static bool IntegrityOk(
923 const AliHLTMUONSinglesDecisionBlockStruct& block,
924 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
927 AliHLTUInt32_t count = 1;
928 return IntegrityOk(block, reason, recordNum, count);
932 * This method is used to check more extensively if the integrity of the
933 * track pair trigger decision structure is OK and returns true in that case.
934 * [in] \param decision The trigger decision structure to check.
935 * [out] \param reason If this is not NULL, then it will be filled with
936 * the reason code describing why the structure is not valid, if and
937 * only if a problem is found with the data.
938 * \returns true if there is no problem with the structure and false otherwise.
940 static bool IntegrityOk(
941 const AliHLTMUONPairDecisionStruct& decision,
942 WhyNotValid* reason = NULL
945 AliHLTUInt32_t count = 1;
946 return IntegrityOk(decision, reason, count);
950 * This method is used to check more extensively if the integrity of the
951 * dHLT raw internal data block is OK and returns true in that case.
952 * [in] \param block The track pair trigger decision data block to check.
953 * [out] \param reason If this is not NULL, then it will be filled with
954 * the reason code describing why the data block is not valid, if and
955 * only if a problem is found with the data.
956 * [out] \param recordNum If this is not NULL, then it will be filled with
957 * the number of the track pairs trigger decision structure that had
958 * a problem. This value will only contain a valid value if the method
959 * RecordNumberWasSet(*reason) returns true. Thus, 'reason' must be set.
960 * \returns true if there is no problem with the data and false otherwise.
962 static bool IntegrityOk(
963 const AliHLTMUONPairsDecisionBlockStruct& block,
964 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
967 AliHLTUInt32_t count = 1;
968 return IntegrityOk(block, reason, recordNum, count);
972 * Methods used to check more extensively if the integrity of various
973 * types of data blocks are Ok and returns true in that case.
974 * These can be slow and should generally only be used for debugging.
975 * The methods are able to return multiple reasons for the problems related
976 * to the data block under test.
978 static bool IntegrityOk(
979 const AliHLTMUONTriggerRecordStruct& tr,
980 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
983 static bool IntegrityOk(
984 const AliHLTMUONTriggerRecordsBlockStruct& block,
985 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
986 AliHLTUInt32_t& reasonCount
989 static bool IntegrityOk(
990 const AliHLTMUONTrigRecInfoStruct& trigInfo,
991 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
994 static bool IntegrityOk(
995 const AliHLTMUONTrigRecsDebugBlockStruct& block,
996 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
997 AliHLTUInt32_t& reasonCount
1000 static bool IntegrityOk(
1001 const AliHLTMUONRecHitStruct& hit,
1002 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1005 static bool IntegrityOk(
1006 const AliHLTMUONRecHitsBlockStruct& block,
1007 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1008 AliHLTUInt32_t& reasonCount
1011 static bool IntegrityOk(
1012 const AliHLTMUONClusterStruct& cluster,
1013 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1016 static bool IntegrityOk(
1017 const AliHLTMUONClustersBlockStruct& block,
1018 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1019 AliHLTUInt32_t& reasonCount
1022 static bool IntegrityOk(
1023 const AliHLTMUONChannelStruct& channel,
1024 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1027 static bool IntegrityOk(
1028 const AliHLTMUONChannelsBlockStruct& block,
1029 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1030 AliHLTUInt32_t& reasonCount
1033 static bool IntegrityOk(
1034 const AliHLTMUONMansoTrackStruct& track,
1035 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1038 static bool IntegrityOk(
1039 const AliHLTMUONMansoTracksBlockStruct& block,
1040 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1041 AliHLTUInt32_t& reasonCount
1044 static bool IntegrityOk(
1045 const AliHLTMUONMansoCandidateStruct& candidate,
1046 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1049 static bool IntegrityOk(
1050 const AliHLTMUONMansoCandidatesBlockStruct& block,
1051 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1052 AliHLTUInt32_t& reasonCount
1055 static bool IntegrityOk(
1056 const AliHLTMUONTrackDecisionStruct& decision,
1057 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1060 static bool IntegrityOk(
1061 const AliHLTMUONSinglesDecisionBlockStruct& block,
1062 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1063 AliHLTUInt32_t& reasonCount
1066 static bool IntegrityOk(
1067 const AliHLTMUONPairDecisionStruct& decision,
1068 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1071 static bool IntegrityOk(
1072 const AliHLTMUONPairsDecisionBlockStruct& block,
1073 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1074 AliHLTUInt32_t& reasonCount
1078 * Returns true if the \em recordNum in the corresponding IntegrityOk method
1079 * would have been set, if it returned false and a reason was set.
1080 * This helper method makes it easy to test if the \em recordNum parameter
1081 * is filled with a valid value or not.
1083 static bool RecordNumberWasSet(WhyNotValid reason);
1086 // Should never have to create, copy or destroy this object.
1088 AliHLTMUONUtils(const AliHLTMUONUtils& obj);
1089 virtual ~AliHLTMUONUtils();
1090 AliHLTMUONUtils& operator = (const AliHLTMUONUtils& obj);
1092 ClassDef(AliHLTMUONUtils, 0); // Interface for helpful dHLT utility methods.
1095 //_____________________________________________________________________________
1097 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONUtils::WhyNotValid reason)
1099 /// Stream operator for the WhyNotValid enumeration for usage with
1100 /// std::ostream classes. Allows usages such as:
1101 /// AliHLTMUONUtils::WhyNotValid r; std::cout << r;
1103 stream << AliHLTMUONUtils::FailureReasonToString(reason);
1107 //_____________________________________________________________________________
1109 // Since c++ is missing a finally "keyword" we define one. Its usage is identical
1110 // to a try..finally statement in Java etc.. however, since it is officialy a macro
1111 // one must use the ( ) brackets instead of { }
1112 // If the compiler supports __finally use it otherwise make our own.
1113 #if defined(__BORLANDC__)
1114 # define finally(str) __finally{str}
1116 # define finally(code) \
1123 #endif // __BORLANDC__
1125 // Here we define the DebugTrace(message) macro for easy embedding of debug
1126 // information into the dimuon HLT code. Its usage is meant to be for generating
1127 // traces of the program which are only useful during full scale debugging.
1128 // Log messages should use the standard HLT logging mechanisms.
1129 // The output is only generated in programs compiled with the DEBUG directive
1130 // defined. Here is a usage example:
1133 // DebugTrace("some debug information.");
1136 // One can also use C++ ostream operators and manipulators like so:
1140 // DebugTrace("x = " << x << " and y = 0x" << std::hex << y );
1144 # include <iostream>
1145 # define DebugTrace(message) {std::cout << message << std::endl;}
1147 # define DebugTrace(message)
1151 #endif // ALIHLTMUONUTILS_H