Line data Source code
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 0 : stream << "{fTrigRecId = " << info.fTrigRecId
35 0 : << ", fDetElemId = [" << info.fDetElemId[0]
36 0 : << ", " << info.fDetElemId[1]
37 0 : << ", " << info.fDetElemId[2]
38 0 : << ", " << info.fDetElemId[3]
39 0 : << "], fZmiddle = " << info.fZmiddle
40 0 : << ", fBl = " << info.fBl
41 0 : << ", fL0Struct = {fX2X1 = " << std::showbase << std::hex
42 0 : << info.fL0Struct.fX2X1
43 0 : << ", fX4X3 = " << info.fL0Struct.fX4X3
44 0 : << ", fY2Y1 = " << info.fL0Struct.fY2Y1
45 0 : << ", fY4Y3 = " << info.fL0Struct.fY4Y3
46 0 : << ", fTriggerBits = " << info.fL0Struct.fTriggerBits
47 0 : << std::dec << "}"
48 0 : << ", fL0StructPrev = {fX2X1 = " << std::showbase << std::hex
49 0 : << info.fL0StructPrev.fX2X1
50 0 : << ", fX4X3 = " << info.fL0StructPrev.fX4X3
51 0 : << ", fY2Y1 = " << info.fL0StructPrev.fY2Y1
52 0 : << ", fY4Y3 = " << info.fL0StructPrev.fY4Y3
53 0 : << ", fTriggerBits = " << info.fL0StructPrev.fTriggerBits
54 0 : << std::dec << "}"
55 0 : << ", fL0StructNext = {fX2X1 = " << std::showbase << std::hex
56 0 : << info.fL0StructNext.fX2X1
57 0 : << ", fX4X3 = " << info.fL0StructNext.fX4X3
58 0 : << ", fY2Y1 = " << info.fL0StructNext.fY2Y1
59 0 : << ", fY4Y3 = " << info.fL0StructNext.fY4Y3
60 0 : << ", fTriggerBits = " << info.fL0StructNext.fTriggerBits
61 0 : << std::dec << "}}";
62 0 : return stream;
63 : }
64 :
65 :
66 : std::ostream& operator << (
67 : std::ostream& stream,
68 : const AliHLTMUONTrigRecsDebugBlockStruct& block
69 : )
70 : {
71 0 : assert( AliHLTMUONUtils::IntegrityOk(block) );
72 :
73 : const AliHLTMUONTrigRecInfoStruct* trigRecInfo =
74 0 : reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&block + 1);
75 0 : stream << "{fHeader = " << block.fHeader << ", fTrigRecInfo[] = [";
76 0 : if (block.fHeader.fNrecords > 0) stream << trigRecInfo[0];
77 0 : for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
78 0 : stream << ", " << trigRecInfo[i];
79 0 : stream << "]}";
80 0 : return stream;
81 : }
82 :
83 :
84 : bool operator == (
85 : const AliHLTMUONTrigRecInfoStruct& a,
86 : const AliHLTMUONTrigRecInfoStruct& b
87 : )
88 : {
89 0 : return a.fTrigRecId == b.fTrigRecId and a.fDetElemId == b.fDetElemId
90 0 : and a.fZmiddle == b.fZmiddle and a.fBl == b.fBl
91 0 : and a.fL0Struct.fX2X1 == b.fL0Struct.fX2X1
92 0 : and a.fL0Struct.fX4X3 == b.fL0Struct.fX4X3
93 0 : and a.fL0Struct.fY2Y1 == b.fL0Struct.fY2Y1
94 0 : and a.fL0Struct.fY4Y3 == b.fL0Struct.fY4Y3
95 0 : and a.fL0Struct.fTriggerBits == b.fL0Struct.fTriggerBits
96 0 : and a.fL0StructPrev.fX2X1 == b.fL0StructPrev.fX2X1
97 0 : and a.fL0StructPrev.fX4X3 == b.fL0StructPrev.fX4X3
98 0 : and a.fL0StructPrev.fY2Y1 == b.fL0StructPrev.fY2Y1
99 0 : and a.fL0StructPrev.fY4Y3 == b.fL0StructPrev.fY4Y3
100 0 : and a.fL0StructPrev.fTriggerBits == b.fL0StructPrev.fTriggerBits
101 0 : and a.fL0StructNext.fX2X1 == b.fL0StructNext.fX2X1
102 0 : and a.fL0StructNext.fX4X3 == b.fL0StructNext.fX4X3
103 0 : and a.fL0StructNext.fY2Y1 == b.fL0StructNext.fY2Y1
104 0 : and a.fL0StructNext.fY4Y3 == b.fL0StructNext.fY4Y3
105 0 : and a.fL0StructNext.fTriggerBits == b.fL0StructNext.fTriggerBits;
106 : }
107 :
108 :
109 : bool operator == (
110 : const AliHLTMUONTrigRecsDebugBlockStruct& a,
111 : const AliHLTMUONTrigRecsDebugBlockStruct& b
112 : )
113 : {
114 0 : assert( AliHLTMUONUtils::IntegrityOk(a) );
115 0 : assert( AliHLTMUONUtils::IntegrityOk(b) );
116 :
117 : const AliHLTMUONTrigRecInfoStruct* trigRecInfoA =
118 0 : reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&a + 1);
119 : const AliHLTMUONTrigRecInfoStruct* trigRecInfoB =
120 0 : 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 0 : if (a.fHeader != b.fHeader) return false;
126 0 : for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
127 0 : if (trigRecInfoA[i] != trigRecInfoB[i]) return false;
128 0 : return true;
129 0 : }
|