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 AliHLTMUONChannelsBlockStruct.cxx
20 : /// @author Artur Szostak <artursz@iafrica.com>
21 : /// @date 18 May 2007
22 : /// @brief Implementation of the stream and comparison operators.
23 : ///
24 : /// The channels blocks are internal dimuon HLT block structures containing
25 : /// debugging information about channels that belong to reconstructed
26 : /// hit clusters.
27 : ///
28 :
29 : #include "AliHLTMUONChannelsBlockStruct.h"
30 : #include "AliHLTMUONUtils.h"
31 : #include <cassert>
32 :
33 : std::ostream& operator << (
34 : std::ostream& stream, const AliHLTMUONChannelStruct& channel
35 : )
36 : {
37 0 : std::ios::fmtflags oldflags = stream.flags();
38 0 : stream << "{fClusterId = " << channel.fClusterId
39 0 : << ", fBusPatch = " << channel.fBusPatch
40 0 : << ", fManu = " << channel.fManu
41 0 : << ", fChannelAddress = " << channel.fChannelAddress
42 0 : << ", fSignal = " << channel.fSignal
43 0 : << ", fRawDataWord = " << std::showbase << std::hex
44 0 : << channel.fRawDataWord << std::dec << "}";
45 0 : stream.flags(oldflags);
46 0 : return stream;
47 : }
48 :
49 :
50 : std::ostream& operator << (
51 : std::ostream& stream, const AliHLTMUONChannelsBlockStruct& block
52 : )
53 : {
54 0 : assert( AliHLTMUONUtils::IntegrityOk(block) );
55 :
56 : const AliHLTMUONChannelStruct* channel =
57 0 : reinterpret_cast<const AliHLTMUONChannelStruct*>(&block + 1);
58 0 : stream << "{fHeader = " << block.fHeader << ", fChannel[] = [";
59 0 : if (block.fHeader.fNrecords > 0) stream << channel[0];
60 0 : for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
61 0 : stream << ", " << channel[i];
62 0 : stream << "]}";
63 0 : return stream;
64 : }
65 :
66 :
67 : bool operator == (
68 : const AliHLTMUONChannelsBlockStruct& a,
69 : const AliHLTMUONChannelsBlockStruct& b
70 : )
71 : {
72 0 : assert( AliHLTMUONUtils::IntegrityOk(a) );
73 0 : assert( AliHLTMUONUtils::IntegrityOk(b) );
74 :
75 : const AliHLTMUONChannelStruct* channelA =
76 0 : reinterpret_cast<const AliHLTMUONChannelStruct*>(&a + 1);
77 : const AliHLTMUONChannelStruct* channelB =
78 0 : reinterpret_cast<const AliHLTMUONChannelStruct*>(&b + 1);
79 :
80 : // First check if the blocks have the same header. If they do then check
81 : // if every channel is the same. In either case if we find a difference
82 : // return false.
83 0 : if (a.fHeader != b.fHeader) return false;
84 0 : for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
85 0 : if (channelA[i] != channelB[i]) return false;
86 0 : return true;
87 0 : }
|