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 AliHLTMUONChannelsBlockStruct.cxx
20 /// @author Artur Szostak <artursz@iafrica.com>
22 /// @brief Implementation of the stream and comparison operators.
24 /// The channels blocks are internal dimuon HLT block structures containing
25 /// debugging information about channels that belong to reconstructed
29 #include "AliHLTMUONChannelsBlockStruct.h"
30 #include "AliHLTMUONUtils.h"
33 std::ostream& operator << (
34 std::ostream& stream, const AliHLTMUONChannelStruct& channel
37 stream << "{fClusterId = " << channel.fClusterId
38 << ", fBusPatch = " << channel.fBusPatch
39 << ", fManu = " << channel.fManu
40 << ", fChannelAddress = " << channel.fChannelAddress
41 << ", fSignal = " << channel.fSignal
42 << ", fRawDataWord = " << std::showbase << std::hex
43 << channel.fRawDataWord << std::dec << "}";
48 std::ostream& operator << (
49 std::ostream& stream, const AliHLTMUONChannelsBlockStruct& block
52 assert( AliHLTMUONUtils::IntegrityOk(block) );
54 const AliHLTMUONChannelStruct* channel =
55 reinterpret_cast<const AliHLTMUONChannelStruct*>(&block + 1);
56 stream << "{fHeader = " << block.fHeader << ", fChannel[] = [";
57 if (block.fHeader.fNrecords > 0) stream << channel[0];
58 for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
59 stream << ", " << channel[i];
66 const AliHLTMUONChannelsBlockStruct& a,
67 const AliHLTMUONChannelsBlockStruct& b
70 assert( AliHLTMUONUtils::IntegrityOk(a) );
71 assert( AliHLTMUONUtils::IntegrityOk(b) );
73 const AliHLTMUONChannelStruct* channelA =
74 reinterpret_cast<const AliHLTMUONChannelStruct*>(&a + 1);
75 const AliHLTMUONChannelStruct* channelB =
76 reinterpret_cast<const AliHLTMUONChannelStruct*>(&b + 1);
78 // First check if the blocks have the same header. If they do then check
79 // if every channel is the same. In either case if we find a difference
81 if (a.fHeader != b.fHeader) return false;
82 for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
83 if (channelA[i] != channelB[i]) return false;