1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 /// @file AliHLTMUONUtils.cxx
20 /// @author Artur Szostak <artursz@iafrica.com>
22 /// @brief Implementation of AliHLTMUONUtils utility routines.
25 #include "AliHLTMUONUtils.h"
26 #include "AliHLTMUONConstants.h"
27 #include "AliHLTMUONTriggerRecordsBlockStruct.h"
28 #include "AliHLTMUONTrigRecsDebugBlockStruct.h"
29 #include "AliHLTMUONTriggerChannelsBlockStruct.h"
30 #include "AliHLTMUONRecHitsBlockStruct.h"
31 #include "AliHLTMUONClustersBlockStruct.h"
32 #include "AliHLTMUONChannelsBlockStruct.h"
33 #include "AliHLTMUONMansoTracksBlockStruct.h"
34 #include "AliHLTMUONMansoCandidatesBlockStruct.h"
35 #include "AliHLTMUONSinglesDecisionBlockStruct.h"
36 #include "AliHLTMUONPairsDecisionBlockStruct.h"
40 AliHLTUInt32_t AliHLTMUONUtils::PackTriggerRecordFlags(
41 AliHLTMUONParticleSign sign, const bool hitset[4]
45 /// This packs the given parameters into the bits of a word appropriate
46 /// for AliHLTMUONTriggerRecordStruct::fFlags.
47 /// @param sign The particle sign.
48 /// @param hitset Flags to indicate if the corresponding fHits[i] elements
50 /// @return Returns the 32 bit packed word.
56 case kSignMinus: flags = 0x80000000; break;
57 case kSignPlus: flags = 0x40000000; break;
58 default: flags = 0x00000000; break;
61 return flags | (hitset[0] ? 0x1 : 0) | (hitset[1] ? 0x2 : 0)
62 | (hitset[2] ? 0x4 : 0) | (hitset[3] ? 0x8 : 0);
66 void AliHLTMUONUtils::UnpackTriggerRecordFlags(
67 AliHLTUInt32_t flags, AliHLTMUONParticleSign& sign, bool hitset[4]
71 /// This unpacks the AliHLTMUONTriggerRecordStruct::fFlags bits into
72 /// its component fields.
73 /// @param flags The flags from an AliHLTMUONTriggerRecordStruct structure.
74 /// @param sign Sets this to the particle sign.
75 /// @param hitset Sets the array elements to indicate if the corresponding
76 /// fHits[i] element was set/filled.
79 AliHLTUInt32_t signbits = flags & 0xC0000000;
82 case 0x80000000: sign = kSignMinus; break;
83 case 0x40000000: sign = kSignPlus; break;
84 default: sign = kSignUnknown; break;
86 hitset[0] = (flags & 0x1) == 0x1;
87 hitset[1] = (flags & 0x2) == 0x2;
88 hitset[2] = (flags & 0x4) == 0x4;
89 hitset[3] = (flags & 0x8) == 0x8;
93 AliHLTUInt32_t AliHLTMUONUtils::PackTrackDecisionBits(bool highPt, bool lowPt)
96 /// This packs the given parameters into the bits of a word appropriate
97 /// for AliHLTMUONTrackDecisionStruct::fTriggerBits.
98 /// @param highPt Has the track passed the high pt cut.
99 /// @param lowPt Has the track passed the low pt cut.
100 /// @return Returns the 32 bit packed word.
103 return (highPt ? 0x2 : 0) | (lowPt ? 0x1 : 0);
107 void AliHLTMUONUtils::UnpackTrackDecisionBits(
108 AliHLTUInt32_t bits, bool& highPt, bool& lowPt
112 /// This unpacks the AliHLTMUONTrackDecisionStruct::fTriggerBits bits into
113 /// its component fields.
114 /// @param bits The trigger bits from an AliHLTMUONTrackDecisionStruct
116 /// @param highPt Sets this to the value of the high pt cut bit.
117 /// @param lowPt Sets this to the value of the low pt cut bit.
120 lowPt = (bits & 0x1) == 0x1;
121 highPt = (bits & 0x2) == 0x2;
125 AliHLTUInt32_t AliHLTMUONUtils::PackPairDecisionBits(
126 bool highMass, bool lowMass, bool unlike,
127 AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount
131 /// This packs the given parameters into the bits of a word appropriate
132 /// for AliHLTMUONPairDecisionStruct::fTriggerBits.
134 /// @param highMass Has the track pair passed the high invariant mass cut.
135 /// @param lowMass Has the track pair passed the low invariant mass cut.
136 /// @param unlike Does the track pair have unlike signs.
137 /// @param highPtCount The number of tracks that passed the high pt cut
139 /// @param lowPtCount The number of tracks that passed the low pt cut
141 /// @return Returns the 32 bit packed word.
143 /// Note: Must have highPtCount + lowPtCount <= 2 and unlike == true if
144 /// highMass or lowMass is true.
147 assert( highPtCount + lowPtCount <= 2 );
148 // highMass and lowMass must be false if unlike is false:
149 assert( not unlike ? (highMass == false and lowMass == false) : true );
151 return (highMass ? 0x40 : 0) | (lowMass ? 0x20 : 0) | (unlike ? 0x10 : 0)
152 | ((highPtCount & 0x3) << 2) | (lowPtCount & 0x3);
156 void AliHLTMUONUtils::UnpackPairDecisionBits(
157 AliHLTUInt32_t bits, bool& highMass, bool& lowMass, bool& unlike,
158 AliHLTUInt8_t& highPtCount, AliHLTUInt8_t& lowPtCount
162 /// This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
163 /// its component fields.
164 /// @param bits The trigger bits from an AliHLTMUONPairDecisionStruct
166 /// @param highMass Sets this to the value of the high invariant mass cut bit.
167 /// @param lowMass Sets this to the value of the low invariant mass cut bit.
168 /// @param unlike Sets this if the pair is unlike sign.
169 /// @param highPtCount Sets this to the high pt count bits.
170 /// @param lowPtCount Sets this to the low pt count bits.
173 highMass = (bits & 0x40) == 0x40;
174 lowMass = (bits & 0x20) == 0x20;
175 unlike = (bits & 0x10) == 0x10;
176 highPtCount = (bits & 0xC) >> 2;
177 lowPtCount = bits & 0x3;
181 AliHLTUInt32_t AliHLTMUONUtils::PackSpecBits(
186 /// This packs the given parameters into the 32bit Pub/Sub specification
187 /// word in the data block descriptor.
189 /// @param ddl The list of DDLs forming part of the readout. ddl[0]
190 /// indicates DDL number 2560, ddl[1] is for DDL 2561 and so
191 /// on up to ddl[19]. ddl[20] and ddl[21] will be for the
192 /// trigger DDLs 2816 and 2817 respectively.
193 /// @return Returns the 32 bit packed specification word.
196 // Pack the bits into the following format:
197 // bit: [ 31 - 22 ][ 21 ][ 20 ][ 19 - 0 ]
198 // field: [ reserved, set to zero ][ TRGDDL2817 ][ TRGDDL2816 ][ TRKDDLS ]
199 // Meaning of field acronyms:
200 // TRGDDL2816 - Trigger DDL number 2816.
201 // TRGDDL2817 - Trigger DDL number 2817.
202 // TRKDDLS - Tracking DDL flags where bit 0 will be for DDL number 2560,
203 // bit 1 for DDL no. 2561 etc. up to bit 19 which is for DDL 2579.
204 AliHLTUInt32_t bits = 0;
205 for (int i = 0; i < 22; i++)
206 bits |= (ddl[i] ? 0x1 : 0x0) << i;
211 void AliHLTMUONUtils::UnpackSpecBits(
212 AliHLTUInt32_t bits, bool ddl[22]
216 /// This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
217 /// its component fields.
218 /// @param bits The Pub/Sub specification word from a data block descriptor.
219 /// @param ddl The output list of DDLs forming part of the readout. ddl[0]
220 /// indicates DDL number 2560, ddl[1] is for DDL 2561 and so
221 /// on up to ddl[19]. ddl[20] and ddl[21] will be for the
222 /// trigger DDLs 2816 and 2817 respectively.
225 // Perform the inverse operation of PackSpecBits.
226 for (int i = 0; i < 22; i++)
227 ddl[i] = ((bits >> i) & 0x1) == 1;
231 AliHLTInt32_t AliHLTMUONUtils::DDLNumberToEquipId(AliHLTInt32_t ddlNo)
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.
240 if (0 <= ddlNo and ddlNo <= 19)
244 else if (20 <= ddlNo and ddlNo <= 21)
246 return 2816 + (ddlNo - 20);
255 AliHLTInt32_t AliHLTMUONUtils::EquipIdToDDLNumber(AliHLTInt32_t id)
258 /// This method converts the equipment ID number for a muon spectrometer
259 /// DDL to the DDL number in the range [0..21].
260 /// @param id The equipment ID of the DDL.
261 /// @return Returns the DDL number in the range [0..21] or -1 if the
262 /// equipment ID was invalid.
265 if (2560 <= id and id <= 2560+19)
269 else if (2816 <= id and id <= 2817)
271 return id - 2816 + 20;
280 AliHLTInt32_t AliHLTMUONUtils::SpecToEquipId(AliHLTUInt32_t spec)
283 /// This method converts a 32 bit data block specification for a MUON-HLT
284 /// data block into its corresponding DDL equipment ID number.
285 /// It is assumed that the specification is for a data block comming from
286 /// a single DDL source. If more than one DDL contributed to the data block
287 /// then -1 is returned.
288 /// @param spec The 32 bit specification for a data block.
289 /// @return Returns the equipment ID corresponding to the specification
290 /// or -1 if the specification was invalid.
293 for (AliHLTInt32_t ddlNo = 0; ddlNo < 20; ddlNo++)
295 if (spec == AliHLTUInt32_t(0x1 << ddlNo))
298 for (AliHLTInt32_t ddlNo = 20; ddlNo < 22; ddlNo++)
300 if (spec == AliHLTUInt32_t(0x1 << ddlNo))
301 return ddlNo - 20 + 2816;
307 AliHLTUInt32_t AliHLTMUONUtils::EquipIdToSpec(AliHLTInt32_t id)
310 /// This method converts a equipment ID number for a DDL into its corresponding
311 /// 32 bit data block specification for the MUON-HLT.
312 /// @param id The equipment ID number of the DDL.
313 /// @return Returns the 32 bit data block specification or 0x0 if the
314 /// equipment ID was invalid.
317 if (2560 <= id and id <= 2560+19)
319 return 0x1 << (id - 2560);
321 else if (2816 <= id and id <= 2817)
323 return 0x1 << (id - 2816 + 20);
332 AliHLTInt32_t AliHLTMUONUtils::SpecToDDLNumber(AliHLTUInt32_t spec)
335 /// This method converts a 32 bit data block specification for a MUON-HLT
336 /// data block into its corresponding DDL number in the range [0..21].
337 /// It is assumed that the specification is for a data block comming from
338 /// a single DDL source. If more than one DDL contributed to the data block
339 /// then -1 is returned.
340 /// @param spec The 32 bit specification for a data block.
341 /// @return Returns the corresponding DDL number for the specification
342 /// or -1 if the specification was invalid.
345 for (AliHLTInt32_t ddlNo = 0; ddlNo < 22; ddlNo++)
347 if (spec == AliHLTUInt32_t(0x1 << ddlNo))
354 AliHLTUInt32_t AliHLTMUONUtils::DDLNumberToSpec(AliHLTInt32_t ddlNo)
357 /// This method converts a DDL number in the range [0..21] into its
358 /// corresponding 32 bit data block specification for the MUON-HLT.
359 /// @param ddlNo The equipment ID number of the DDL.
360 /// @return Returns the 32 bit data block specification or 0x0 if the
361 /// DDL number was invalid (out of range).
364 if (0 <= ddlNo and ddlNo <= 21)
375 bool AliHLTMUONUtils::HeaderOk(
376 const AliHLTMUONTriggerRecordsBlockStruct& block,
381 /// Methods used to check if the header information corresponds to the
382 /// supposed type of the data block.
383 /// If the 'reason' parameter is not NULL then these methods will fill the
384 /// memory pointed to by reason with a code describing of why the header
385 /// is not valid, if and only if a problem is found with the data.
388 // The block must have the correct type.
389 if (block.fHeader.fType != kTriggerRecordsDataBlock)
391 if (reason != NULL) *reason = kHeaderContainsWrongType;
395 // The block's record width must be the correct size.
396 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerRecordStruct))
398 if (reason != NULL) *reason = kHeaderContainsWrongRecordWidth;
406 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
409 /// Methods used to check if the header information corresponds to the
410 /// supposed type of the data block.
413 // The block must have the correct type.
414 if (block.fHeader.fType != kTrigRecsDebugDataBlock) return false;
415 // The block's record width must be the correct size.
416 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrigRecInfoStruct))
422 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
425 /// Methods used to check if the header information corresponds to the
426 /// supposed type of the data block.
429 // The block must have the correct type.
430 if (block.fHeader.fType != kTriggerChannelsDataBlock) return false;
431 // The block's record width must be the correct size.
432 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerChannelStruct))
438 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONRecHitsBlockStruct& block)
441 /// Methods used to check if the header information corresponds to the
442 /// supposed type of the data block.
445 // The block must have the correct type.
446 if (block.fHeader.fType != kRecHitsDataBlock) return false;
447 // The block's record width must be the correct size.
448 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONRecHitStruct))
454 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONClustersBlockStruct& block)
457 /// Methods used to check if the header information corresponds to the
458 /// supposed type of the data block.
461 // The block must have the correct type.
462 if (block.fHeader.fType != kClustersDataBlock) return false;
463 // The block's record width must be the correct size.
464 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONClusterStruct))
470 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONChannelsBlockStruct& block)
473 /// Methods used to check if the header information corresponds to the
474 /// supposed type of the data block.
477 // The block must have the correct type.
478 if (block.fHeader.fType != kChannelsDataBlock) return false;
479 // The block's record width must be the correct size.
480 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONChannelStruct))
486 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block)
489 /// Methods used to check if the header information corresponds to the
490 /// supposed type of the data block.
493 // The block must have the correct type.
494 if (block.fHeader.fType != kMansoTracksDataBlock) return false;
495 // The block's record width must be the correct size.
496 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONMansoTrackStruct))
502 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
505 /// Methods used to check if the header information corresponds to the
506 /// supposed type of the data block.
509 // The block must have the correct type.
510 if (block.fHeader.fType != kMansoCandidatesDataBlock) return false;
511 // The block's record width must be the correct size.
512 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONMansoCandidateStruct))
518 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
521 /// Methods used to check if the header information corresponds to the
522 /// supposed type of the data block.
525 // The block must have the correct type.
526 if (block.fHeader.fType != kSinglesDecisionDataBlock) return false;
527 // The block's record width must be the correct size.
528 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrackDecisionStruct))
534 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block)
537 /// Methods used to check if the header information corresponds to the
538 /// supposed type of the data block.
541 // The block must have the correct type.
542 if (block.fHeader.fType != kPairsDecisionDataBlock) return false;
543 // The block's record width must be the correct size.
544 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONPairDecisionStruct))
550 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordStruct& tr)
553 /// Methods used to check more extensively if the integrity of various
554 /// types of data blocks are Ok and returns true in that case.
555 /// These can be slow and should generally only be used for debugging.
558 // Make sure that the reserved bits in the fFlags field are set
560 if ((tr.fFlags & 0x3FFFFFF0) != 0) return false;
562 // Make sure the sign is not invalid.
563 if ((tr.fFlags & 0xC0000000) == 3) return false;
565 // Check that fHit[i] is nil if the corresponding bit in the
566 // flags word is zero.
567 const AliHLTMUONRecHitStruct& nilhit
568 = AliHLTMUONConstants::NilRecHitStruct();
569 if ((tr.fFlags & 0x1) == 0 and tr.fHit[0] != nilhit) return false;
570 if ((tr.fFlags & 0x2) == 0 and tr.fHit[1] != nilhit) return false;
571 if ((tr.fFlags & 0x4) == 0 and tr.fHit[2] != nilhit) return false;
572 if ((tr.fFlags & 0x8) == 0 and tr.fHit[3] != nilhit) return false;
578 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordsBlockStruct& block)
581 /// Methods used to check more extensively if the integrity of various
582 /// types of data blocks are Ok and returns true in that case.
583 /// These can be slow and should generally only be used for debugging.
586 if (not HeaderOk(block)) return false;
588 const AliHLTMUONTriggerRecordStruct* triggerRecord =
589 reinterpret_cast<const AliHLTMUONTriggerRecordStruct*>(&block + 1);
591 // Check if any ID is duplicated.
592 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
594 AliHLTInt32_t id = triggerRecord[i].fId;
595 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
597 if (id == triggerRecord[j].fId)
602 // Check integrity of individual trigger records.
603 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
605 if (not IntegrityOk(triggerRecord[i])) return false;
612 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
615 /// Methods used to check more extensively if the integrity of various
616 /// types of data blocks are Ok and returns true in that case.
617 /// These can be slow and should generally only be used for debugging.
620 if (not HeaderOk(block)) return false;
625 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
628 /// Methods used to check more extensively if the integrity of various
629 /// types of data blocks are Ok and returns true in that case.
630 /// These can be slow and should generally only be used for debugging.
633 if (not HeaderOk(block)) return false;
638 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONRecHitsBlockStruct& block)
641 /// Methods used to check more extensively if the integrity of various
642 /// types of data blocks are Ok and returns true in that case.
643 /// These can be slow and should generally only be used for debugging.
646 if (not HeaderOk(block)) return false;
651 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONClustersBlockStruct& block)
654 /// Methods used to check more extensively if the integrity of various
655 /// types of data blocks are Ok and returns true in that case.
656 /// These can be slow and should generally only be used for debugging.
659 if (not HeaderOk(block)) return false;
661 const AliHLTMUONClusterStruct* cluster =
662 reinterpret_cast<const AliHLTMUONClusterStruct*>(&block + 1);
664 // Check if any ID is duplicated.
665 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
667 AliHLTInt32_t id = cluster[i].fId;
668 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
670 if (id == cluster[j].fId)
679 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONChannelsBlockStruct& block)
682 /// Methods used to check more extensively if the integrity of various
683 /// types of data blocks are Ok and returns true in that case.
684 /// These can be slow and should generally only be used for debugging.
687 if (not HeaderOk(block)) return false;
692 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTrackStruct& track)
695 /// Methods used to check more extensively if the integrity of various
696 /// types of data blocks are Ok and returns true in that case.
697 /// These can be slow and should generally only be used for debugging.
700 // Make sure that the reserved bits in the fFlags field are set
702 if ((track.fFlags & 0x3FFFFFF0) != 0) return false;
704 // Make sure the sign is not invalid.
705 if ((track.fFlags & 0xC0000000) == 0xC0000000) return false;
707 // Check that fHit[i] is nil if the corresponding bit in the
708 // flags word is zero.
709 const AliHLTMUONRecHitStruct& nilhit
710 = AliHLTMUONConstants::NilRecHitStruct();
711 if ((track.fFlags & 0x1) == 0 and track.fHit[0] != nilhit) return false;
712 if ((track.fFlags & 0x2) == 0 and track.fHit[1] != nilhit) return false;
713 if ((track.fFlags & 0x4) == 0 and track.fHit[2] != nilhit) return false;
714 if ((track.fFlags & 0x8) == 0 and track.fHit[3] != nilhit) return false;
720 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTracksBlockStruct& block)
723 /// Methods used to check more extensively if the integrity of various
724 /// types of data blocks are Ok and returns true in that case.
725 /// These can be slow and should generally only be used for debugging.
728 if (not HeaderOk(block)) return false;
730 const AliHLTMUONMansoTrackStruct* track =
731 reinterpret_cast<const AliHLTMUONMansoTrackStruct*>(&block + 1);
733 // Check if any ID is duplicated.
734 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
736 AliHLTInt32_t id = track[i].fId;
737 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
739 if (id == track[j].fId)
744 // Check that the tracks have integrity.
745 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
747 if (not IntegrityOk(track[i])) return false;
754 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
757 /// Methods used to check more extensively if the integrity of various
758 /// types of data blocks are Ok and returns true in that case.
759 /// These can be slow and should generally only be used for debugging.
762 if (not HeaderOk(block)) return false;
764 const AliHLTMUONMansoCandidateStruct* candidate =
765 reinterpret_cast<const AliHLTMUONMansoCandidateStruct*>(&block + 1);
767 // Check that the tracks have integrity.
768 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
770 if (not IntegrityOk(candidate[i].fTrack)) return false;
777 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrackDecisionStruct& decision)
780 /// Methods used to check more extensively if the integrity of various
781 /// types of data blocks are Ok and returns true in that case.
782 /// These can be slow and should generally only be used for debugging.
785 // Make sure that the reserved bits in the fTriggerBits field are set
787 if ((decision.fTriggerBits & 0xFFFFFFFC) != 0) return false;
792 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
795 /// Methods used to check more extensively if the integrity of various
796 /// types of data blocks are Ok and returns true in that case.
797 /// These can be slow and should generally only be used for debugging.
800 if (not HeaderOk(block)) return false;
802 const AliHLTMUONTrackDecisionStruct* decision =
803 reinterpret_cast<const AliHLTMUONTrackDecisionStruct*>(&block + 1);
805 // Check that the trigger bits for each track have integrity.
806 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
808 if (not IntegrityOk(decision[i])) return false;
815 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairDecisionStruct& decision)
818 /// Methods used to check more extensively if the integrity of various
819 /// types of data blocks are Ok and returns true in that case.
820 /// These can be slow and should generally only be used for debugging.
823 // Make sure that the reserved bits in the fTriggerBits field are set
825 if ((decision.fTriggerBits & 0xFFFFFF80) != 0) return false;
827 // The high mass or low mass bits can only be set if unlike bit is set.
828 if ((decision.fTriggerBits & 0x00000010) == 0
829 and (decision.fTriggerBits & 0x00000060) != 0
833 // Neither the high pt (hipt) or low pt (lopt) count bits can be > 2.
834 // And the sum must not be > 2.
835 AliHLTUInt8_t lowPtCount = (decision.fTriggerBits & 0x00000003);
836 AliHLTUInt8_t highPtCount = (decision.fTriggerBits & 0x0000000C) >> 2;
837 if (lowPtCount + highPtCount > 2) return false;
843 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairsDecisionBlockStruct& block)
846 /// Methods used to check more extensively if the integrity of various
847 /// types of data blocks are Ok and returns true in that case.
848 /// These can be slow and should generally only be used for debugging.
851 if (not HeaderOk(block)) return false;
853 const AliHLTMUONPairDecisionStruct* decision =
854 reinterpret_cast<const AliHLTMUONPairDecisionStruct*>(&block + 1);
856 // Check that the trigger bits for each track pair have integrity.
857 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
859 if (not IntegrityOk(decision[i])) return false;