]>
Commit | Line | Data |
---|---|---|
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 19 May 2007 | |
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 | |
35 | << ", fDetElemId = [" << info.fDetElemId[0] | |
36 | << ", " << info.fDetElemId[1] | |
37 | << ", " << info.fDetElemId[2] | |
38 | << ", " << info.fDetElemId[3] | |
39 | << "], fZmiddle = " << info.fZmiddle | |
40 | << ", fBl = " << info.fBl | |
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 << "}" | |
48 | << ", fL0StructPrev = {fX2X1 = " << std::showbase << std::hex | |
49 | << info.fL0StructPrev.fX2X1 | |
50 | << ", fX4X3 = " << info.fL0StructPrev.fX4X3 | |
51 | << ", fY2Y1 = " << info.fL0StructPrev.fY2Y1 | |
52 | << ", fY4Y3 = " << info.fL0StructPrev.fY4Y3 | |
53 | << ", fTriggerBits = " << info.fL0StructPrev.fTriggerBits | |
54 | << std::dec << "}" | |
55 | << ", fL0StructNext = {fX2X1 = " << std::showbase << std::hex | |
56 | << info.fL0StructNext.fX2X1 | |
57 | << ", fX4X3 = " << info.fL0StructNext.fX4X3 | |
58 | << ", fY2Y1 = " << info.fL0StructNext.fY2Y1 | |
59 | << ", fY4Y3 = " << info.fL0StructNext.fY4Y3 | |
60 | << ", fTriggerBits = " << info.fL0StructNext.fTriggerBits | |
61 | << std::dec << "}}"; | |
62 | return stream; | |
63 | } | |
64 | ||
65 | ||
66 | std::ostream& operator << ( | |
67 | std::ostream& stream, | |
68 | const AliHLTMUONTrigRecsDebugBlockStruct& block | |
69 | ) | |
70 | { | |
71 | assert( AliHLTMUONUtils::IntegrityOk(block) ); | |
72 | ||
73 | const AliHLTMUONTrigRecInfoStruct* trigRecInfo = | |
74 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&block + 1); | |
75 | stream << "{fHeader = " << block.fHeader << ", fTrigRecInfo[] = ["; | |
76 | if (block.fHeader.fNrecords > 0) stream << trigRecInfo[0]; | |
77 | for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++) | |
78 | stream << ", " << trigRecInfo[i]; | |
79 | stream << "]}"; | |
80 | return stream; | |
81 | } | |
82 | ||
83 | ||
84 | bool operator == ( | |
85 | const AliHLTMUONTrigRecInfoStruct& a, | |
86 | const AliHLTMUONTrigRecInfoStruct& b | |
87 | ) | |
88 | { | |
89 | return a.fTrigRecId == b.fTrigRecId and a.fDetElemId == b.fDetElemId | |
90 | and a.fZmiddle == b.fZmiddle and a.fBl == b.fBl | |
91 | and a.fL0Struct.fX2X1 == b.fL0Struct.fX2X1 | |
92 | and a.fL0Struct.fX4X3 == b.fL0Struct.fX4X3 | |
93 | and a.fL0Struct.fY2Y1 == b.fL0Struct.fY2Y1 | |
94 | and a.fL0Struct.fY4Y3 == b.fL0Struct.fY4Y3 | |
95 | and a.fL0Struct.fTriggerBits == b.fL0Struct.fTriggerBits | |
96 | and a.fL0StructPrev.fX2X1 == b.fL0StructPrev.fX2X1 | |
97 | and a.fL0StructPrev.fX4X3 == b.fL0StructPrev.fX4X3 | |
98 | and a.fL0StructPrev.fY2Y1 == b.fL0StructPrev.fY2Y1 | |
99 | and a.fL0StructPrev.fY4Y3 == b.fL0StructPrev.fY4Y3 | |
100 | and a.fL0StructPrev.fTriggerBits == b.fL0StructPrev.fTriggerBits | |
101 | and a.fL0StructNext.fX2X1 == b.fL0StructNext.fX2X1 | |
102 | and a.fL0StructNext.fX4X3 == b.fL0StructNext.fX4X3 | |
103 | and a.fL0StructNext.fY2Y1 == b.fL0StructNext.fY2Y1 | |
104 | and a.fL0StructNext.fY4Y3 == b.fL0StructNext.fY4Y3 | |
105 | and a.fL0StructNext.fTriggerBits == b.fL0StructNext.fTriggerBits; | |
106 | } | |
107 | ||
108 | ||
109 | bool operator == ( | |
110 | const AliHLTMUONTrigRecsDebugBlockStruct& a, | |
111 | const AliHLTMUONTrigRecsDebugBlockStruct& b | |
112 | ) | |
113 | { | |
114 | assert( AliHLTMUONUtils::IntegrityOk(a) ); | |
115 | assert( AliHLTMUONUtils::IntegrityOk(b) ); | |
116 | ||
117 | const AliHLTMUONTrigRecInfoStruct* trigRecInfoA = | |
118 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&a + 1); | |
119 | const AliHLTMUONTrigRecInfoStruct* trigRecInfoB = | |
120 | reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&b + 1); | |
121 | ||
122 | // First check if the blocks have the same header. If they do then check | |
123 | // if all debug information is the same. In either case if we find a | |
124 | // difference return false. | |
125 | if (a.fHeader != b.fHeader) return false; | |
126 | for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++) | |
127 | if (trigRecInfoA[i] != trigRecInfoB[i]) return false; | |
128 | return true; | |
129 | } |