]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONUtils.cxx
Fixing coding violations and getting rid of warnings.
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONUtils.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 ///
19 /// @file   AliHLTMUONUtils.cxx
20 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @date   
22 /// @brief  Implementation of AliHLTMUONUtils utility routines.
23 ///
24
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"
37 #include <cassert>
38
39
40 AliHLTUInt32_t AliHLTMUONUtils::PackTriggerRecordFlags(
41                 AliHLTMUONParticleSign sign, const bool hitset[4]
42         )
43 {
44         ///
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
49         ///                was set/filled.
50         /// @return  Returns the 32 bit packed word.
51         ///
52         
53         AliHLTUInt32_t flags;
54         switch (sign)
55         {
56         case kSignMinus: flags = 0x80000000; break;
57         case kSignPlus:  flags = 0x40000000; break;
58         default:         flags = 0x00000000; break;
59         }
60
61         return flags | (hitset[0] ? 0x1 : 0) | (hitset[1] ? 0x2 : 0)
62                 | (hitset[2] ? 0x4 : 0) | (hitset[3] ? 0x8 : 0);
63 }
64
65
66 void AliHLTMUONUtils::UnpackTriggerRecordFlags(
67                 AliHLTUInt32_t flags, AliHLTMUONParticleSign& sign, bool hitset[4]
68         )
69 {
70         ///
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.
77         ///
78         
79         AliHLTUInt32_t signbits = flags & 0xC0000000;
80         switch (signbits)
81         {
82         case 0x80000000: sign = kSignMinus;   break;
83         case 0x40000000: sign = kSignPlus;    break;
84         default:         sign = kSignUnknown; break;
85         }
86         hitset[0] = (flags & 0x1) == 0x1;
87         hitset[1] = (flags & 0x2) == 0x2;
88         hitset[2] = (flags & 0x4) == 0x4;
89         hitset[3] = (flags & 0x8) == 0x8;
90 }
91
92
93 AliHLTUInt32_t AliHLTMUONUtils::PackTrackDecisionBits(bool highPt, bool lowPt)
94 {
95         ///
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.
101         ///
102         
103         return (highPt ? 0x2 : 0) | (lowPt ? 0x1 : 0);
104 }
105
106
107 void AliHLTMUONUtils::UnpackTrackDecisionBits(
108                 AliHLTUInt32_t bits, bool& highPt, bool& lowPt
109         )
110 {
111         ///
112         /// This unpacks the AliHLTMUONTrackDecisionStruct::fTriggerBits bits into
113         /// its component fields.
114         /// @param bits  The trigger bits from an AliHLTMUONTrackDecisionStruct
115         ///              structure.
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.
118         ///
119         
120         lowPt  = (bits & 0x1) == 1;
121         highPt = (bits & 0x2) == 1;
122 }
123
124
125 AliHLTUInt32_t AliHLTMUONUtils::PackPairDecisionBits(
126                 bool highMass, bool lowMass, bool unlike,
127                 AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount
128         )
129 {
130         ///
131         /// This packs the given parameters into the bits of a word appropriate
132         /// for AliHLTMUONPairDecisionStruct::fTriggerBits.
133         ///
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
138         ///                    in the pair.
139         /// @param lowPtCount  The number of tracks that passed the low pt cut
140         ///                    in the pair.
141         /// @return  Returns the 32 bit packed word.
142         ///
143         /// Note: Must have highPtCount + lowPtCount <= 2 and unlike == true if
144         /// highMass or lowMass is true.
145         ///
146         
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 );
150         
151         return (highMass ? 0x40 : 0) | (lowMass ? 0x20 : 0) | (unlike ? 0x10 : 0)
152                 | ((highPtCount & 0x3) << 2) | (lowPtCount & 0x3);
153 }
154
155
156 void AliHLTMUONUtils::UnpackPairDecisionBits(
157                 AliHLTUInt32_t bits, bool& highMass, bool& lowMass, bool& unlike,
158                 AliHLTUInt8_t& highPtCount, AliHLTUInt8_t& lowPtCount
159         )
160 {
161         ///
162         /// This unpacks the AliHLTMUONPairDecisionStruct::fTriggerBits bits into
163         /// its component fields.
164         /// @param bits  The trigger bits from an AliHLTMUONPairDecisionStruct
165         ///              structure.
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.
171         ///
172         
173         highMass = (bits & 0x40) == 1;
174         lowMass  = (bits & 0x20) == 1;
175         unlike   = (bits & 0x10) == 1;
176         highPtCount = (bits & 0xC) >> 2;
177         lowPtCount = bits & 0x3;
178 }
179
180
181 AliHLTUInt32_t AliHLTMUONUtils::PackSpecBits(
182                 const bool ddl[22]
183         )
184 {
185         ///
186         /// This packs the given parameters into the 32bit Pub/Sub specification
187         /// word in the data block descriptor.
188         ///
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.
194         ///
195         
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;
207         return bits;
208 }
209
210
211 void AliHLTMUONUtils::UnpackSpecBits(
212                 AliHLTUInt32_t bits, bool ddl[22]
213         )
214 {
215         ///
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.
223         ///
224         
225         // Perform the inverse operation of PackSpecBits.
226         for (int i = 0; i < 22; i++)
227                 ddl[i] = ((bits >> i) & 0x1) == 1;
228 }
229
230
231 bool AliHLTMUONUtils::HeaderOk(
232                 const AliHLTMUONTriggerRecordsBlockStruct& block,
233                 WhyNotValid* reason
234         )
235 {
236         ///
237         /// Methods used to check if the header information corresponds to the
238         /// supposed type of the data block.
239         /// If the 'reason' parameter is not NULL then these methods will fill the
240         /// memory pointed to by reason with a code describing of why the header
241         /// is not valid, if and only if a problem is found with the data.
242         ///
243          
244         // The block must have the correct type.
245         if (block.fHeader.fType != kTriggerRecordsDataBlock)
246         {
247                 if (reason != NULL) *reason = kHeaderContainsWrongType;
248                 return false;
249         }
250         
251         // The block's record width must be the correct size.
252         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerRecordStruct))
253         {
254                 if (reason != NULL) *reason = kHeaderContainsWrongRecordWidth;
255                 return false;
256         }
257         
258         return true;
259 }
260
261
262 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
263 {
264         ///
265         /// Methods used to check if the header information corresponds to the
266         /// supposed type of the data block.
267         ///
268         
269         // The block must have the correct type.
270         if (block.fHeader.fType != kTrigRecsDebugDataBlock) return false;
271         // The block's record width must be the correct size.
272         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrigRecInfoStruct))
273                 return false;
274         return true;
275 }
276
277
278 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
279 {
280         ///
281         /// Methods used to check if the header information corresponds to the
282         /// supposed type of the data block.
283         ///
284         
285         // The block must have the correct type.
286         if (block.fHeader.fType != kTriggerChannelsDataBlock) return false;
287         // The block's record width must be the correct size.
288         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerChannelStruct))
289                 return false;
290         return true;
291 }
292
293
294 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONRecHitsBlockStruct& block)
295 {
296         ///
297         /// Methods used to check if the header information corresponds to the
298         /// supposed type of the data block.
299         ///
300         
301         // The block must have the correct type.
302         if (block.fHeader.fType != kRecHitsDataBlock) return false;
303         // The block's record width must be the correct size.
304         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONRecHitStruct))
305                 return false;
306         return true;
307 }
308
309
310 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONClustersBlockStruct& block)
311 {
312         ///
313         /// Methods used to check if the header information corresponds to the
314         /// supposed type of the data block.
315         ///
316         
317         // The block must have the correct type.
318         if (block.fHeader.fType != kClustersDataBlock) return false;
319         // The block's record width must be the correct size.
320         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONClusterStruct))
321                 return false;
322         return true;
323 }
324
325
326 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONChannelsBlockStruct& block)
327 {
328         ///
329         /// Methods used to check if the header information corresponds to the
330         /// supposed type of the data block.
331         ///
332         
333         // The block must have the correct type.
334         if (block.fHeader.fType != kChannelsDataBlock) return false;
335         // The block's record width must be the correct size.
336         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONChannelStruct))
337                 return false;
338         return true;
339 }
340
341
342 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block)
343 {
344         ///
345         /// Methods used to check if the header information corresponds to the
346         /// supposed type of the data block.
347         ///
348         
349         // The block must have the correct type.
350         if (block.fHeader.fType != kMansoTracksDataBlock) return false;
351         // The block's record width must be the correct size.
352         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONMansoTrackStruct))
353                 return false;
354         return true;
355 }
356
357
358 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
359 {
360         ///
361         /// Methods used to check if the header information corresponds to the
362         /// supposed type of the data block.
363         ///
364         
365         // The block must have the correct type.
366         if (block.fHeader.fType != kMansoCandidatesDataBlock) return false;
367         // The block's record width must be the correct size.
368         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONMansoCandidateStruct))
369                 return false;
370         return true;
371 }
372
373
374 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
375 {
376         ///
377         /// Methods used to check if the header information corresponds to the
378         /// supposed type of the data block.
379         ///
380         
381         // The block must have the correct type.
382         if (block.fHeader.fType != kSinglesDecisionDataBlock) return false;
383         // The block's record width must be the correct size.
384         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrackDecisionStruct))
385                 return false;
386         return true;
387 }
388
389
390 bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block)
391 {
392         ///
393         /// Methods used to check if the header information corresponds to the
394         /// supposed type of the data block.
395         ///
396         
397         // The block must have the correct type.
398         if (block.fHeader.fType != kPairsDecisionDataBlock) return false;
399         // The block's record width must be the correct size.
400         if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONPairDecisionStruct))
401                 return false;
402         return true;
403 }
404
405
406 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordStruct& tr)
407 {
408         ///
409         /// Methods used to check more extensively if the integrity of various
410         /// types of data blocks are Ok and returns true in that case.
411         /// These can be slow and should generally only be used for debugging.
412         ///
413         
414         // Make sure that the reserved bits in the fFlags field are set
415         // to zero.
416         if ((tr.fFlags & 0x3FFFFFF0) != 0) return false;
417
418         // Make sure the sign is not invalid.
419         if ((tr.fFlags & 0xC0000000) == 3) return false;
420
421         // Check that fHit[i] is nil if the corresponding bit in the
422         // flags word is zero.
423         const AliHLTMUONRecHitStruct& nilhit
424                 = AliHLTMUONConstants::NilRecHitStruct();
425         if ((tr.fFlags & 0x1) == 0 and tr.fHit[0] != nilhit) return false;
426         if ((tr.fFlags & 0x2) == 0 and tr.fHit[1] != nilhit) return false;
427         if ((tr.fFlags & 0x4) == 0 and tr.fHit[2] != nilhit) return false;
428         if ((tr.fFlags & 0x8) == 0 and tr.fHit[3] != nilhit) return false;
429
430         return true;
431 }
432
433
434 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordsBlockStruct& block)
435 {
436         ///
437         /// Methods used to check more extensively if the integrity of various
438         /// types of data blocks are Ok and returns true in that case.
439         /// These can be slow and should generally only be used for debugging.
440         ///
441         
442         if (not HeaderOk(block)) return false;
443
444         // Check if any ID is duplicated.
445         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
446         {
447                 AliHLTInt32_t id = block.fTriggerRecord[i].fId;
448                 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
449                 {
450                         if (id == block.fTriggerRecord[j].fId)
451                                 return false;
452                 }
453         }
454
455         // Check integrity of individual trigger records.
456         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
457         {
458                 if (not IntegrityOk(block.fTriggerRecord[i])) return false;
459         }
460
461         return true;
462 }
463
464
465 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
466 {
467         ///
468         /// Methods used to check more extensively if the integrity of various
469         /// types of data blocks are Ok and returns true in that case.
470         /// These can be slow and should generally only be used for debugging.
471         ///
472         
473         if (not HeaderOk(block)) return false;
474         return true;
475 }
476
477
478 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
479 {
480         ///
481         /// Methods used to check more extensively if the integrity of various
482         /// types of data blocks are Ok and returns true in that case.
483         /// These can be slow and should generally only be used for debugging.
484         ///
485         
486         if (not HeaderOk(block)) return false;
487         return true;
488 }
489
490
491 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONRecHitsBlockStruct& block)
492 {
493         ///
494         /// Methods used to check more extensively if the integrity of various
495         /// types of data blocks are Ok and returns true in that case.
496         /// These can be slow and should generally only be used for debugging.
497         ///
498         
499         if (not HeaderOk(block)) return false;
500         return true;
501 }
502
503
504 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONClustersBlockStruct& block)
505 {
506         ///
507         /// Methods used to check more extensively if the integrity of various
508         /// types of data blocks are Ok and returns true in that case.
509         /// These can be slow and should generally only be used for debugging.
510         ///
511         
512         if (not HeaderOk(block)) return false;
513
514         // Check if any ID is duplicated.
515         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
516         {
517                 AliHLTInt32_t id = block.fCluster[i].fId;
518                 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
519                 {
520                         if (id == block.fCluster[j].fId)
521                                 return false;
522                 }
523         }
524         
525         return true;
526 }
527
528
529 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONChannelsBlockStruct& block)
530 {
531         ///
532         /// Methods used to check more extensively if the integrity of various
533         /// types of data blocks are Ok and returns true in that case.
534         /// These can be slow and should generally only be used for debugging.
535         ///
536         
537         if (not HeaderOk(block)) return false;
538         return true;
539 }
540
541
542 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTrackStruct& track)
543 {
544         ///
545         /// Methods used to check more extensively if the integrity of various
546         /// types of data blocks are Ok and returns true in that case.
547         /// These can be slow and should generally only be used for debugging.
548         ///
549         
550         // Make sure that the reserved bits in the fFlags field are set
551         // to zero.
552         if ((track.fFlags & 0x3FFFFFF0) != 0) return false;
553
554         // Make sure the sign is not invalid.
555         if ((track.fFlags & 0xC0000000) == 0xC0000000) return false;
556
557         // Check that fHit[i] is nil if the corresponding bit in the
558         // flags word is zero.
559         const AliHLTMUONRecHitStruct& nilhit
560                 = AliHLTMUONConstants::NilRecHitStruct();
561         if ((track.fFlags & 0x1) == 0 and track.fHit[0] != nilhit) return false;
562         if ((track.fFlags & 0x2) == 0 and track.fHit[1] != nilhit) return false;
563         if ((track.fFlags & 0x4) == 0 and track.fHit[2] != nilhit) return false;
564         if ((track.fFlags & 0x8) == 0 and track.fHit[3] != nilhit) return false;
565         
566         return true;
567 }
568
569
570 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTracksBlockStruct& block)
571 {
572         ///
573         /// Methods used to check more extensively if the integrity of various
574         /// types of data blocks are Ok and returns true in that case.
575         /// These can be slow and should generally only be used for debugging.
576         ///
577         
578         if (not HeaderOk(block)) return false;
579
580         // Check if any ID is duplicated.
581         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
582         {
583                 AliHLTInt32_t id = block.fTrack[i].fId;
584                 for (AliHLTUInt32_t j = i+1; i < block.fHeader.fNrecords; j++)
585                 {
586                         if (id == block.fTrack[j].fId)
587                                 return false;
588                 }
589         }
590
591         // Check that the tracks have integrity.
592         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
593         {
594                 if (not IntegrityOk(block.fTrack[i])) return false;
595         }
596
597         return true;
598 }
599
600
601 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
602 {
603         ///
604         /// Methods used to check more extensively if the integrity of various
605         /// types of data blocks are Ok and returns true in that case.
606         /// These can be slow and should generally only be used for debugging.
607         ///
608         
609         if (not HeaderOk(block)) return false;
610
611         // Check that the tracks have integrity.
612         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
613         {
614                 if (not IntegrityOk(block.fCandidate[i].fTrack)) return false;
615         }
616         
617         return true;
618 }
619
620
621 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrackDecisionStruct& decision)
622 {
623         ///
624         /// Methods used to check more extensively if the integrity of various
625         /// types of data blocks are Ok and returns true in that case.
626         /// These can be slow and should generally only be used for debugging.
627         ///
628         
629         // Make sure that the reserved bits in the fTriggerBits field are set
630         // to zero.
631         if ((decision.fTriggerBits & 0xFFFFFFFC) != 0) return false;
632         return true;
633 }
634
635
636 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
637 {
638         ///
639         /// Methods used to check more extensively if the integrity of various
640         /// types of data blocks are Ok and returns true in that case.
641         /// These can be slow and should generally only be used for debugging.
642         ///
643         
644         if (not HeaderOk(block)) return false;
645
646         // Check that the trigger bits for each track have integrity.
647         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
648         {
649                 if (not IntegrityOk(block.fDecision[i])) return false;
650         }
651         
652         return true;
653 }
654
655
656 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairDecisionStruct& decision)
657 {
658         ///
659         /// Methods used to check more extensively if the integrity of various
660         /// types of data blocks are Ok and returns true in that case.
661         /// These can be slow and should generally only be used for debugging.
662         ///
663         
664         // Make sure that the reserved bits in the fTriggerBits field are set
665         // to zero.
666         if ((decision.fTriggerBits & 0xFFFFFF80) != 0) return false;
667         
668         // The high mass or low mass bits can only be set if unlike bit is set.
669         if ((decision.fTriggerBits & 0x00000010) == 0
670             and (decision.fTriggerBits & 0x00000060) != 0
671            )
672                 return false;
673         
674         // Neither the high pt (hipt) or low pt (lopt) count bits can be > 2.
675         // And the sum must not be > 2.
676         AliHLTUInt8_t lowPtCount = (decision.fTriggerBits & 0x00000003);
677         AliHLTUInt8_t highPtCount = (decision.fTriggerBits & 0x0000000C) >> 2;
678         if (lowPtCount + highPtCount > 2) return false;
679         
680         return true;
681 }
682
683
684 bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairsDecisionBlockStruct& block)
685 {
686         ///
687         /// Methods used to check more extensively if the integrity of various
688         /// types of data blocks are Ok and returns true in that case.
689         /// These can be slow and should generally only be used for debugging.
690         ///
691         
692         if (not HeaderOk(block)) return false;
693
694         // Check that the trigger bits for each track pair have integrity.
695         for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
696         {
697                 if (not IntegrityOk(block.fDecision[i])) return false;
698         }
699         
700         return true;
701 }