]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/AliHLTMUONUtils.cxx
Coding conventions: making const Get functions
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONUtils.cxx
CommitLineData
26a4668d 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
6253e09b 18///
19/// @file AliHLTMUONUtils.cxx
20/// @author Artur Szostak <artursz@iafrica.com>
21/// @date
22/// @brief Implementation of AliHLTMUONUtils utility routines.
23///
26a4668d 24
25#include "AliHLTMUONUtils.h"
b727f838 26#include "AliHLTMUONConstants.h"
c8ec7c7e 27#include "AliHLTMUONTriggerRecordsBlockStruct.h"
28#include "AliHLTMUONTrigRecsDebugBlockStruct.h"
29#include "AliHLTMUONTriggerChannelsBlockStruct.h"
30#include "AliHLTMUONRecHitsBlockStruct.h"
31#include "AliHLTMUONClustersBlockStruct.h"
32#include "AliHLTMUONChannelsBlockStruct.h"
90a74d7a 33#include "AliHLTMUONMansoTracksBlockStruct.h"
34#include "AliHLTMUONMansoCandidatesBlockStruct.h"
35#include "AliHLTMUONSinglesDecisionBlockStruct.h"
b12fe461 36#include "AliHLTMUONPairsDecisionBlockStruct.h"
90a74d7a 37#include <cassert>
26a4668d 38
39
b727f838 40AliHLTUInt32_t AliHLTMUONUtils::PackTriggerRecordFlags(
e6357f88 41 AliHLTMUONParticleSign sign, const bool hitset[4]
b727f838 42 )
26a4668d 43{
6253e09b 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
b727f838 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 }
26a4668d 60
b727f838 61 return flags | (hitset[0] ? 0x1 : 0) | (hitset[1] ? 0x2 : 0)
62 | (hitset[2] ? 0x4 : 0) | (hitset[3] ? 0x8 : 0);
63}
64
65
66void AliHLTMUONUtils::UnpackTriggerRecordFlags(
90a74d7a 67 AliHLTUInt32_t flags, AliHLTMUONParticleSign& sign, bool hitset[4]
b727f838 68 )
69{
6253e09b 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
b727f838 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 }
e6357f88 86 hitset[0] = (flags & 0x1) == 0x1;
87 hitset[1] = (flags & 0x2) == 0x2;
88 hitset[2] = (flags & 0x4) == 0x4;
89 hitset[3] = (flags & 0x8) == 0x8;
b727f838 90}
91
92
90a74d7a 93AliHLTUInt32_t AliHLTMUONUtils::PackTrackDecisionBits(bool highPt, bool lowPt)
94{
6253e09b 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
90a74d7a 103 return (highPt ? 0x2 : 0) | (lowPt ? 0x1 : 0);
104}
105
106
107void AliHLTMUONUtils::UnpackTrackDecisionBits(
108 AliHLTUInt32_t bits, bool& highPt, bool& lowPt
109 )
110{
6253e09b 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
90a74d7a 120 lowPt = (bits & 0x1) == 1;
121 highPt = (bits & 0x2) == 1;
122}
123
124
125AliHLTUInt32_t AliHLTMUONUtils::PackPairDecisionBits(
126 bool highMass, bool lowMass, bool unlike,
127 AliHLTUInt8_t highPtCount, AliHLTUInt8_t lowPtCount
128 )
129{
6253e09b 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
90a74d7a 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
156void AliHLTMUONUtils::UnpackPairDecisionBits(
157 AliHLTUInt32_t bits, bool& highMass, bool& lowMass, bool& unlike,
158 AliHLTUInt8_t& highPtCount, AliHLTUInt8_t& lowPtCount
159 )
160{
6253e09b 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
90a74d7a 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
e6357f88 181AliHLTUInt32_t AliHLTMUONUtils::PackSpecBits(
182 const bool ddl[22]
183 )
184{
6253e09b 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
e6357f88 196 // Pack the bits into the following format:
197 // bit: [ 31 - 22 ][ 21 ][ 20 ][ 19 - 0 ]
80606a9f 198 // field: [ reserved, set to zero ][ TRGDDL2817 ][ TRGDDL2816 ][ TRKDDLS ]
e6357f88 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
211void AliHLTMUONUtils::UnpackSpecBits(
212 AliHLTUInt32_t bits, bool ddl[22]
213 )
214{
6253e09b 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
e6357f88 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
698c9498 231bool AliHLTMUONUtils::HeaderOk(
232 const AliHLTMUONTriggerRecordsBlockStruct& block,
233 WhyNotValid* reason
234 )
b727f838 235{
6253e09b 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
b727f838 244 // The block must have the correct type.
698c9498 245 if (block.fHeader.fType != kTriggerRecordsDataBlock)
246 {
247 if (reason != NULL) *reason = kHeaderContainsWrongType;
248 return false;
249 }
250
90a74d7a 251 // The block's record width must be the correct size.
b727f838 252 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerRecordStruct))
698c9498 253 {
254 if (reason != NULL) *reason = kHeaderContainsWrongRecordWidth;
26a4668d 255 return false;
698c9498 256 }
257
b727f838 258 return true;
259}
26a4668d 260
90a74d7a 261
c8ec7c7e 262bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
263{
6253e09b 264 ///
265 /// Methods used to check if the header information corresponds to the
266 /// supposed type of the data block.
267 ///
268
c8ec7c7e 269 // The block must have the correct type.
270 if (block.fHeader.fType != kTrigRecsDebugDataBlock) return false;
90a74d7a 271 // The block's record width must be the correct size.
c8ec7c7e 272 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTrigRecInfoStruct))
273 return false;
274 return true;
275}
276
90a74d7a 277
c8ec7c7e 278bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
279{
6253e09b 280 ///
281 /// Methods used to check if the header information corresponds to the
282 /// supposed type of the data block.
283 ///
284
c8ec7c7e 285 // The block must have the correct type.
286 if (block.fHeader.fType != kTriggerChannelsDataBlock) return false;
90a74d7a 287 // The block's record width must be the correct size.
c8ec7c7e 288 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONTriggerChannelStruct))
289 return false;
290 return true;
291}
292
90a74d7a 293
b727f838 294bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONRecHitsBlockStruct& block)
295{
6253e09b 296 ///
297 /// Methods used to check if the header information corresponds to the
298 /// supposed type of the data block.
299 ///
300
b727f838 301 // The block must have the correct type.
302 if (block.fHeader.fType != kRecHitsDataBlock) return false;
90a74d7a 303 // The block's record width must be the correct size.
b727f838 304 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONRecHitStruct))
26a4668d 305 return false;
b727f838 306 return true;
307}
26a4668d 308
90a74d7a 309
b727f838 310bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONClustersBlockStruct& block)
311{
6253e09b 312 ///
313 /// Methods used to check if the header information corresponds to the
314 /// supposed type of the data block.
315 ///
316
b727f838 317 // The block must have the correct type.
318 if (block.fHeader.fType != kClustersDataBlock) return false;
90a74d7a 319 // The block's record width must be the correct size.
b727f838 320 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONClusterStruct))
321 return false;
322 return true;
323}
26a4668d 324
90a74d7a 325
b727f838 326bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONChannelsBlockStruct& block)
327{
6253e09b 328 ///
329 /// Methods used to check if the header information corresponds to the
330 /// supposed type of the data block.
331 ///
332
b727f838 333 // The block must have the correct type.
334 if (block.fHeader.fType != kChannelsDataBlock) return false;
90a74d7a 335 // The block's record width must be the correct size.
b727f838 336 if (block.fHeader.fRecordWidth != sizeof(AliHLTMUONChannelStruct))
26a4668d 337 return false;
b727f838 338 return true;
339}
340
341
90a74d7a 342bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoTracksBlockStruct& block)
343{
6253e09b 344 ///
345 /// Methods used to check if the header information corresponds to the
346 /// supposed type of the data block.
347 ///
348
90a74d7a 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
358bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
359{
6253e09b 360 ///
361 /// Methods used to check if the header information corresponds to the
362 /// supposed type of the data block.
363 ///
364
90a74d7a 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
374bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
375{
6253e09b 376 ///
377 /// Methods used to check if the header information corresponds to the
378 /// supposed type of the data block.
379 ///
380
90a74d7a 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
390bool AliHLTMUONUtils::HeaderOk(const AliHLTMUONPairsDecisionBlockStruct& block)
391{
6253e09b 392 ///
393 /// Methods used to check if the header information corresponds to the
394 /// supposed type of the data block.
395 ///
396
90a74d7a 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
406bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordStruct& tr)
407{
6253e09b 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
90a74d7a 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
b727f838 434bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerRecordsBlockStruct& block)
435{
6253e09b 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
b727f838 442 if (not HeaderOk(block)) return false;
26a4668d 443
b727f838 444 // Check if any ID is duplicated.
445 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
446 {
b12fe461 447 AliHLTInt32_t id = block.fTriggerRecord[i].fId;
b727f838 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
90a74d7a 455 // Check integrity of individual trigger records.
b727f838 456 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
457 {
90a74d7a 458 if (not IntegrityOk(block.fTriggerRecord[i])) return false;
b727f838 459 }
460
461 return true;
462}
463
90a74d7a 464
c8ec7c7e 465bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrigRecsDebugBlockStruct& block)
466{
6253e09b 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
c8ec7c7e 473 if (not HeaderOk(block)) return false;
474 return true;
475}
476
90a74d7a 477
c8ec7c7e 478bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTriggerChannelsBlockStruct& block)
479{
6253e09b 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
c8ec7c7e 486 if (not HeaderOk(block)) return false;
487 return true;
488}
b727f838 489
90a74d7a 490
b727f838 491bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONRecHitsBlockStruct& block)
492{
6253e09b 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
b727f838 499 if (not HeaderOk(block)) return false;
500 return true;
501}
502
503
504bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONClustersBlockStruct& block)
505{
6253e09b 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
b727f838 512 if (not HeaderOk(block)) return false;
b727f838 513
c8ec7c7e 514 // Check if any ID is duplicated.
515 for (AliHLTUInt32_t i = 0; i < block.fHeader.fNrecords; i++)
516 {
b12fe461 517 AliHLTInt32_t id = block.fCluster[i].fId;
c8ec7c7e 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
b727f838 525 return true;
526}
527
90a74d7a 528
b727f838 529bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONChannelsBlockStruct& block)
530{
6253e09b 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
b727f838 537 if (not HeaderOk(block)) return false;
26a4668d 538 return true;
539}
90a74d7a 540
541
542bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTrackStruct& track)
543{
6253e09b 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
90a74d7a 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
570bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoTracksBlockStruct& block)
571{
6253e09b 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
90a74d7a 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 {
b12fe461 583 AliHLTInt32_t id = block.fTrack[i].fId;
90a74d7a 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
601bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONMansoCandidatesBlockStruct& block)
602{
6253e09b 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
90a74d7a 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
621bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONTrackDecisionStruct& decision)
622{
6253e09b 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
90a74d7a 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
636bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONSinglesDecisionBlockStruct& block)
637{
6253e09b 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
90a74d7a 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
656bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairDecisionStruct& decision)
657{
6253e09b 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
90a74d7a 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
684bool AliHLTMUONUtils::IntegrityOk(const AliHLTMUONPairsDecisionBlockStruct& block)
685{
6253e09b 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
90a74d7a 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}