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 * Returns the detector element ID from the flags bits.
102 * [in] @param flags The flags from an AliHLTMUONRecHitStruct structure.
104 static AliHLTUInt16_t GetDetElemIdFromFlags(AliHLTUInt32_t flags)
106 return flags & 0xFFF;
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
115 * @return Returns the 32 bit packed word.
117 static AliHLTUInt32_t PackMansoTrackFlags(
118 AliHLTMUONParticleSign sign, const bool hitset[4]
121 return PackTriggerRecordFlags(sign, hitset);
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.
132 static void UnpackMansoTrackFlags(
133 AliHLTUInt32_t flags, // [in]
134 AliHLTMUONParticleSign& sign, // [out]
135 bool hitset[4] // [out]
138 UnpackTriggerRecordFlags(flags, sign, hitset);
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.
148 static AliHLTUInt32_t PackTrackDecisionBits(bool highPt, bool lowPt);
151 * This unpacks the AliHLTMUONTrackDecisionStruct::fTriggerBits bits into
152 * its component fields.
153 * @param bits The trigger bits from an AliHLTMUONTrackDecisionStruct
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.
158 static void UnpackTrackDecisionBits(
159 AliHLTUInt32_t bits, // [in]
160 bool& highPt, // [out]
165 * This packs the given parameters into the bits of a word appropriate
166 * for AliHLTMUONPairDecisionStruct::fTriggerBits.
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
173 * @param lowPtCount The number of tracks that passed the low pt cut
175 * @return Returns the 32 bit packed word.
177 * Note: Must have highPtCount + lowPtCount <= 2 and unlike == true if
178 * highMass or lowMass is true.
180 static AliHLTUInt32_t PackPairDecisionBits(
181 bool highMass, bool lowMass, bool unlike,
182 AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount
186 * This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
187 * its component fields.
188 * @param bits The trigger bits from an AliHLTMUONPairDecisionStruct
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.
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]
206 * This packs the given parameters into the 32bit Pub/Sub specification
207 * word in the data block descriptor.
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.
215 static AliHLTUInt32_t PackSpecBits(
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.
228 static void UnpackSpecBits(
229 AliHLTUInt32_t bits, // [in]
230 bool ddl[22] // [out]
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.
239 static AliHLTInt32_t DDLNumberToEquipId(AliHLTInt32_t ddlNo);
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.
248 static AliHLTInt32_t EquipIdToDDLNumber(AliHLTInt32_t id);
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.
260 static AliHLTInt32_t SpecToEquipId(AliHLTUInt32_t spec);
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.
269 static AliHLTUInt32_t EquipIdToSpec(AliHLTInt32_t id);
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.
281 static AliHLTInt32_t SpecToDDLNumber(AliHLTUInt32_t spec);
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).
290 static AliHLTUInt32_t DDLNumberToSpec(AliHLTInt32_t ddlNo);
293 * Returns true if the given specification was for a single trigger DDL.
295 static bool IsTriggerDDL(AliHLTUInt32_t spec)
297 AliHLTInt32_t ddl = SpecToDDLNumber(spec);
298 return (20 <= ddl and ddl <= 21);
302 * Returns true if the given specification was for a single tracker DDL.
304 static bool IsTrackerDDL(AliHLTUInt32_t spec)
306 AliHLTInt32_t ddl = SpecToDDLNumber(spec);
307 return (0 <= ddl and ddl <= 19);
311 * Returns true if the given specification is in principle valid.
312 * It checks if the bits that should be zero are indeed zero.
314 static bool IsSpecValid(AliHLTUInt32_t spec)
316 AliHLTUInt32_t mask = ~AliHLTUInt32_t((1 << 22) - 1); // First 22 bits indicate DDL number.
317 return (spec & mask) == 0x0;
321 * Returns true if the data specification indicates the data block contains
322 * information generated from a trigger DDL or data fragments thereof.
324 static bool ContainsDataFromTrigger(AliHLTUInt32_t spec)
326 AliHLTUInt32_t mask = AliHLTUInt32_t((1 << 22) - 1) & ~AliHLTUInt32_t((1 << 20) - 1);
327 return (spec & mask) != 0x0;
331 * Returns true if the data specification indicates the data block contains
332 * information generated from a tracker DDL or data fragments thereof.
334 static bool ContainsDataFromTracker(AliHLTUInt32_t spec)
336 AliHLTUInt32_t mask = AliHLTUInt32_t((1 << 20) - 1);
337 return (spec & mask) != 0x0;
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
347 static AliHLTMUONDataBlockType ParseCommandLineTypeString(const char* type);
350 * Converts a type ID to a type string to be used for the dHLT FilePublisher
351 * component configuration parameters for example.
353 static const char* DataBlockTypeToString(AliHLTMUONDataBlockType type);
356 * These codes indicate the reason why a data block failed its
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.
397 * This method converts the WhyNotValid enumeration to a string representation.
399 static const char* FailureReasonToString(WhyNotValid reason);
402 * This method returns a string containing a user readable message explaining
403 * the reason for failure described by the WhyNotValid enumeration.
405 static const char* FailureReasonToMessage(WhyNotValid reason);
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
417 * \returns true if there is no problem with the header and false otherwise.
419 static bool HeaderOk(const AliHLTMUONTriggerRecordsBlockStruct& block, WhyNotValid* reason = NULL)
421 AliHLTUInt32_t count = 1;
422 return HeaderOk(block, reason, count);
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
435 * \returns true if there is no problem with the header and false otherwise.
437 static bool HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block, WhyNotValid* reason = NULL)
439 AliHLTUInt32_t count = 1;
440 return HeaderOk(block, reason, count);
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
453 * \returns true if there is no problem with the header and false otherwise.
455 static bool HeaderOk(const AliHLTMUONRecHitsBlockStruct& block, WhyNotValid* reason = NULL)
457 AliHLTUInt32_t count = 1;
458 return HeaderOk(block, reason, count);
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
471 * \returns true if there is no problem with the header and false otherwise.
473 static bool HeaderOk(const AliHLTMUONClustersBlockStruct& block, WhyNotValid* reason = NULL)
475 AliHLTUInt32_t count = 1;
476 return HeaderOk(block, reason, count);
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
489 * \returns true if there is no problem with the header and false otherwise.
491 static bool HeaderOk(const AliHLTMUONChannelsBlockStruct& block, WhyNotValid* reason = NULL)
493 AliHLTUInt32_t count = 1;
494 return HeaderOk(block, reason, count);
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
507 * \returns true if there is no problem with the header and false otherwise.
509 static bool HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block, WhyNotValid* reason = NULL)
511 AliHLTUInt32_t count = 1;
512 return HeaderOk(block, reason, count);
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
525 * \returns true if there is no problem with the header and false otherwise.
527 static bool HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block, WhyNotValid* reason = NULL)
529 AliHLTUInt32_t count = 1;
530 return HeaderOk(block, reason, count);
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
543 * \returns true if there is no problem with the header and false otherwise.
545 static bool HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block, WhyNotValid* reason = NULL)
547 AliHLTUInt32_t count = 1;
548 return HeaderOk(block, reason, count);
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
561 * \returns true if there is no problem with the header and false otherwise.
563 static bool HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block, WhyNotValid* reason = NULL)
565 AliHLTUInt32_t count = 1;
566 return HeaderOk(block, reason, count);
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.
578 static bool HeaderOk(
579 const AliHLTMUONTriggerRecordsBlockStruct& block,
580 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
583 static bool HeaderOk(
584 const AliHLTMUONTrigRecsDebugBlockStruct& block,
585 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
588 static bool HeaderOk(
589 const AliHLTMUONRecHitsBlockStruct& block,
590 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
593 static bool HeaderOk(
594 const AliHLTMUONClustersBlockStruct& block,
595 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
598 static bool HeaderOk(
599 const AliHLTMUONChannelsBlockStruct& block,
600 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
603 static bool HeaderOk(
604 const AliHLTMUONMansoTracksBlockStruct& block,
605 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
608 static bool HeaderOk(
609 const AliHLTMUONMansoCandidatesBlockStruct& block,
610 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
613 static bool HeaderOk(
614 const AliHLTMUONSinglesDecisionBlockStruct& block,
615 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
618 static bool HeaderOk(
619 const AliHLTMUONPairsDecisionBlockStruct& block,
620 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
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.
632 static bool IntegrityOk(
633 const AliHLTMUONTriggerRecordStruct& tr,
634 WhyNotValid* reason = NULL
637 AliHLTUInt32_t count = 1;
638 return IntegrityOk(tr, reason, count);
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.
654 static bool IntegrityOk(
655 const AliHLTMUONTriggerRecordsBlockStruct& block,
656 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
659 AliHLTUInt32_t count = 1;
660 return IntegrityOk(block, reason, recordNum, count);
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.
672 static bool IntegrityOk(
673 const AliHLTMUONTrigRecInfoStruct& trigInfo,
674 WhyNotValid* reason = NULL
677 AliHLTUInt32_t count = 1;
678 return IntegrityOk(trigInfo, reason, count);
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.
694 static bool IntegrityOk(
695 const AliHLTMUONTrigRecsDebugBlockStruct& block,
696 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
699 AliHLTUInt32_t count = 1;
700 return IntegrityOk(block, reason, recordNum, count);
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.
712 static bool IntegrityOk(
713 const AliHLTMUONRecHitStruct& hit,
714 WhyNotValid* reason = NULL
717 AliHLTUInt32_t count = 1;
718 return IntegrityOk(hit, reason, count);
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.
734 static bool IntegrityOk(
735 const AliHLTMUONRecHitsBlockStruct& block,
736 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
739 AliHLTUInt32_t count = 1;
740 return IntegrityOk(block, reason, recordNum, count);
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.
752 static bool IntegrityOk(
753 const AliHLTMUONClusterStruct& cluster,
754 WhyNotValid* reason = NULL
757 AliHLTUInt32_t count = 1;
758 return IntegrityOk(cluster, reason, count);
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.
774 static bool IntegrityOk(
775 const AliHLTMUONClustersBlockStruct& block,
776 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
779 AliHLTUInt32_t count = 1;
780 return IntegrityOk(block, reason, recordNum, count);
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.
792 static bool IntegrityOk(
793 const AliHLTMUONChannelStruct& channel,
794 WhyNotValid* reason = NULL
797 AliHLTUInt32_t count = 1;
798 return IntegrityOk(channel, reason, count);
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.
814 static bool IntegrityOk(
815 const AliHLTMUONChannelsBlockStruct& block,
816 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
819 AliHLTUInt32_t count = 1;
820 return IntegrityOk(block, reason, recordNum, count);
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.
832 static bool IntegrityOk(
833 const AliHLTMUONMansoTrackStruct& track,
834 WhyNotValid* reason = NULL
837 AliHLTUInt32_t count = 1;
838 return IntegrityOk(track, reason, count);
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.
854 static bool IntegrityOk(
855 const AliHLTMUONMansoTracksBlockStruct& block,
856 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
859 AliHLTUInt32_t count = 1;
860 return IntegrityOk(block, reason, recordNum, count);
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.
872 static bool IntegrityOk(
873 const AliHLTMUONMansoCandidateStruct& candidate,
874 WhyNotValid* reason = NULL
877 AliHLTUInt32_t count = 1;
878 return IntegrityOk(candidate, reason, count);
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.
894 static bool IntegrityOk(
895 const AliHLTMUONMansoCandidatesBlockStruct& block,
896 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
899 AliHLTUInt32_t count = 1;
900 return IntegrityOk(block, reason, recordNum, count);
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.
912 static bool IntegrityOk(
913 const AliHLTMUONTrackDecisionStruct& decision,
914 WhyNotValid* reason = NULL
917 AliHLTUInt32_t count = 1;
918 return IntegrityOk(decision, reason, count);
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.
934 static bool IntegrityOk(
935 const AliHLTMUONSinglesDecisionBlockStruct& block,
936 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
939 AliHLTUInt32_t count = 1;
940 return IntegrityOk(block, reason, recordNum, count);
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.
952 static bool IntegrityOk(
953 const AliHLTMUONPairDecisionStruct& decision,
954 WhyNotValid* reason = NULL
957 AliHLTUInt32_t count = 1;
958 return IntegrityOk(decision, reason, count);
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.
974 static bool IntegrityOk(
975 const AliHLTMUONPairsDecisionBlockStruct& block,
976 WhyNotValid* reason = NULL, AliHLTUInt32_t* recordNum = NULL
979 AliHLTUInt32_t count = 1;
980 return IntegrityOk(block, reason, recordNum, count);
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.
990 static bool IntegrityOk(
991 const AliHLTMUONTriggerRecordStruct& tr,
992 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
995 static bool IntegrityOk(
996 const AliHLTMUONTriggerRecordsBlockStruct& block,
997 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
998 AliHLTUInt32_t& reasonCount
1001 static bool IntegrityOk(
1002 const AliHLTMUONTrigRecInfoStruct& trigInfo,
1003 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1006 static bool IntegrityOk(
1007 const AliHLTMUONTrigRecsDebugBlockStruct& block,
1008 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1009 AliHLTUInt32_t& reasonCount
1012 static bool IntegrityOk(
1013 const AliHLTMUONRecHitStruct& hit,
1014 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1017 static bool IntegrityOk(
1018 const AliHLTMUONRecHitsBlockStruct& block,
1019 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1020 AliHLTUInt32_t& reasonCount
1023 static bool IntegrityOk(
1024 const AliHLTMUONClusterStruct& cluster,
1025 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1028 static bool IntegrityOk(
1029 const AliHLTMUONClustersBlockStruct& block,
1030 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1031 AliHLTUInt32_t& reasonCount
1034 static bool IntegrityOk(
1035 const AliHLTMUONChannelStruct& channel,
1036 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1039 static bool IntegrityOk(
1040 const AliHLTMUONChannelsBlockStruct& block,
1041 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1042 AliHLTUInt32_t& reasonCount
1045 static bool IntegrityOk(
1046 const AliHLTMUONMansoTrackStruct& track,
1047 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1050 static bool IntegrityOk(
1051 const AliHLTMUONMansoTracksBlockStruct& block,
1052 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1053 AliHLTUInt32_t& reasonCount
1056 static bool IntegrityOk(
1057 const AliHLTMUONMansoCandidateStruct& candidate,
1058 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1061 static bool IntegrityOk(
1062 const AliHLTMUONMansoCandidatesBlockStruct& block,
1063 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1064 AliHLTUInt32_t& reasonCount
1067 static bool IntegrityOk(
1068 const AliHLTMUONTrackDecisionStruct& decision,
1069 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1072 static bool IntegrityOk(
1073 const AliHLTMUONSinglesDecisionBlockStruct& block,
1074 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1075 AliHLTUInt32_t& reasonCount
1078 static bool IntegrityOk(
1079 const AliHLTMUONPairDecisionStruct& decision,
1080 WhyNotValid* reason, AliHLTUInt32_t& reasonCount
1083 static bool IntegrityOk(
1084 const AliHLTMUONPairsDecisionBlockStruct& block,
1085 WhyNotValid* reason, AliHLTUInt32_t* recordNum,
1086 AliHLTUInt32_t& reasonCount
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.
1095 static bool RecordNumberWasSet(WhyNotValid reason);
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);
1105 ClassDef(AliHLTMUONUtils, 0); // Interface for helpful dHLT utility methods.
1108 //_____________________________________________________________________________
1110 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONUtils::WhyNotValid reason)
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;
1116 stream << AliHLTMUONUtils::FailureReasonToString(reason);
1120 //_____________________________________________________________________________
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}
1129 # define finally(code) \
1136 #endif // __BORLANDC__
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:
1146 // DebugTrace("some debug information.");
1149 // One can also use C++ ostream operators and manipulators like so:
1153 // DebugTrace("x = " << x << " and y = 0x" << std::hex << y );
1157 # include <iostream>
1158 # define DebugTrace(message) {std::cout << message << std::endl;}
1160 # define DebugTrace(message)
1164 #endif // ALIHLTMUONUTILS_H