1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 * @file AliHLTMUONTrigRecsDebugBlockStruct.cxx
20 * @author Artur Szostak <artursz@iafrica.com>
22 * @brief Implementation of useful stream and comparison operators.
25 #include "AliHLTMUONTrigRecsDebugBlockStruct.h"
26 #include "AliHLTMUONUtils.h"
30 std::ostream& operator << (
31 std::ostream& stream, const AliHLTMUONTrigRecInfoStruct& info
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
52 std::ostream& operator << (
54 const AliHLTMUONTrigRecsDebugBlockStruct& block
57 assert( AliHLTMUONUtils::IntegrityOk(block) );
59 const AliHLTMUONTrigRecInfoStruct* trigRecInfo =
60 reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&block + 1);
61 stream << "{fHeader = " << block.fHeader << ", fTrigRecInfo[] = [";
62 if (block.fHeader.fNrecords > 0) stream << trigRecInfo[0];
63 for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
64 stream << ", " << trigRecInfo[i];
71 const AliHLTMUONTrigRecsDebugBlockStruct& a,
72 const AliHLTMUONTrigRecsDebugBlockStruct& b
75 assert( AliHLTMUONUtils::IntegrityOk(a) );
76 assert( AliHLTMUONUtils::IntegrityOk(b) );
78 const AliHLTMUONTrigRecInfoStruct* trigRecInfoA =
79 reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&a + 1);
80 const AliHLTMUONTrigRecInfoStruct* trigRecInfoB =
81 reinterpret_cast<const AliHLTMUONTrigRecInfoStruct*>(&b + 1);
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++)
88 if (trigRecInfoA[i] != trigRecInfoB[i]) return false;