]>
Commit | Line | Data |
---|---|---|
c8ec7c7e | 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 AliHLTMUONTrigRecsDebugBlockStruct.cxx | |
20 | * @author Artur Szostak <artursz@iafrica.com> | |
21 | * @date | |
22 | * @brief Implementation of useful stream and comparison operators. | |
23 | */ | |
24 | ||
25 | #include "AliHLTMUONTrigRecsDebugBlockStruct.h" | |
26 | #include "AliHLTMUONUtils.h" | |
27 | #include <cassert> | |
28 | ||
29 | ||
30 | std::ostream& operator << ( | |
31 | std::ostream& stream, const AliHLTMUONTrigRecInfoStruct& info | |
32 | ) | |
33 | { | |
34 | stream << "{fTrigRecId = " << info.fTrigRecId | |
4a8fa4aa | 35 | << ", fDetElemId = [" << info.fDetElemId[0] |
36 | << ", " << info.fDetElemId[1] | |
37 | << ", " << info.fDetElemId[2] | |
38 | << ", " << info.fDetElemId[3] | |
39 | << "], fZmiddle = " << info.fZmiddle | |
c8ec7c7e | 40 | << ", fBl = " << info.fBl |
a090ff22 | 41 | << ", fL0Struct = {fX2X1 = " << std::showbase << std::hex |
42 | << info.fL0Struct.fX2X1 | |
43 | << ", fX4X3 = " << info.fL0Struct.fX4X3 | |
44 | << ", fY2Y1 = " << info.fL0Struct.fY2Y1 | |
45 | << ", fY4Y3 = " << info.fL0Struct.fY4Y3 | |
46 | << ", fTriggerBits = " << info.fL0Struct.fTriggerBits | |
47 | << std::dec << "}}"; | |
c8ec7c7e | 48 | return stream; |
49 | } | |
50 | ||
51 | ||
52 | std::ostream& operator << ( | |
53 | std::ostream& stream, | |
54 | const AliHLTMUONTrigRecsDebugBlockStruct& block | |
55 | ) | |
56 | { | |
57 | assert( AliHLTMUONUtils::IntegrityOk(block) ); | |
58 | ||
23ad6161 | 59 | const AliHLTMUONTrigRecInfoStruct* trigRecInfo = |
60 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&block + 1); | |
c8ec7c7e | 61 | stream << "{fHeader = " << block.fHeader << ", fTrigRecInfo[] = ["; |
23ad6161 | 62 | if (block.fHeader.fNrecords > 0) stream << trigRecInfo[0]; |
c8ec7c7e | 63 | for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++) |
23ad6161 | 64 | stream << ", " << trigRecInfo[i]; |
c8ec7c7e | 65 | stream << "]}"; |
66 | return stream; | |
67 | } | |
68 | ||
69 | ||
70 | bool operator == ( | |
71 | const AliHLTMUONTrigRecsDebugBlockStruct& a, | |
72 | const AliHLTMUONTrigRecsDebugBlockStruct& b | |
73 | ) | |
74 | { | |
75 | assert( AliHLTMUONUtils::IntegrityOk(a) ); | |
76 | assert( AliHLTMUONUtils::IntegrityOk(b) ); | |
77 | ||
23ad6161 | 78 | const AliHLTMUONTrigRecInfoStruct* trigRecInfoA = |
79 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&a + 1); | |
80 | const AliHLTMUONTrigRecInfoStruct* trigRecInfoB = | |
81 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&b + 1); | |
82 | ||
c8ec7c7e | 83 | // First check if the blocks have the same header. If they do then check |
84 | // if all debug information is the same. In either case if we find a | |
85 | // difference return false. | |
86 | if (a.fHeader != b.fHeader) return false; | |
87 | for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++) | |
23ad6161 | 88 | if (trigRecInfoA[i] != trigRecInfoB[i]) return false; |
c8ec7c7e | 89 | return true; |
90 | } |