1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
6 * Artur Szostak <artursz@iafrica.com> *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 // $Id: AliHLTMUONTracksBlockStruct.cxx 36627 2009-11-10 19:21:49Z aszostak $
20 /// @file AliHLTMUONTracksBlockStruct.cxx
21 /// @author Artur Szostak <artursz@iafrica.com>
23 /// @brief Implementation of useful stream and comparison operators.
25 /// The tracks data block is an internal dimuon HLT data block structure
26 /// generated by the tracker components.
29 #include "AliHLTMUONTracksBlockStruct.h"
30 #include "AliHLTMUONUtils.h"
34 std::ostream& operator << (
35 std::ostream& stream, const AliHLTMUONTrackStruct& track
38 stream << "{fId = " << track.fFlags
39 << ", fTrigRec = " << track.fTrigRec
40 << ", fFlags = " << std::showbase << std::hex
41 << track.fFlags << std::dec
42 << ", fPx = " << track.fPx
43 << ", fPy = " << track.fPy
44 << ", fPz = " << track.fPz
45 << ", fInverseBendingMomentum = " << track.fInverseBendingMomentum
46 << ", fThetaX = " << track.fThetaX
47 << ", fThetaX = " << track.fThetaY
48 << ", fX = " << track.fX
49 << ", fY = " << track.fY
50 << ", fZ = " << track.fZ
51 << ", fChi2 = " << track.fChi2;
52 for (AliHLTUInt32_t i = 0; i < 16; i++)
54 stream << ", fHit[" << i << "] = " << track.fHit[0];
61 std::ostream& operator << (
63 const AliHLTMUONTracksBlockStruct& block
66 assert( AliHLTMUONUtils::IntegrityOk(block) );
68 const AliHLTMUONTrackStruct* track =
69 reinterpret_cast<const AliHLTMUONTrackStruct*>(&block + 1);
70 stream << "{fHeader = " << block.fHeader << ", fTrack[] = [";
71 if (block.fHeader.fNrecords > 0) stream << track[0];
72 for (AliHLTUInt32_t i = 1; i < block.fHeader.fNrecords; i++)
73 stream << ", " << track[i];
80 const AliHLTMUONTrackStruct& a,
81 const AliHLTMUONTrackStruct& b
84 bool result = a.fId == b.fId and a.fTrigRec == b.fTrigRec
85 and a.fFlags == b.fFlags and a.fPx == b.fPx and a.fPy == b.fPy
86 and a.fPz == b.fPz and a.fInverseBendingMomentum == b.fInverseBendingMomentum
87 and a.fThetaX == b.fThetaX and a.fThetaY == b.fThetaY
88 and a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ and a.fChi2 == b.fChi2;
89 for (AliHLTUInt32_t i = 0; i < 16; i++)
91 result &= (a.fHit[i] == b.fHit[i]);
98 const AliHLTMUONTracksBlockStruct& a,
99 const AliHLTMUONTracksBlockStruct& b
102 assert( AliHLTMUONUtils::IntegrityOk(a) );
103 assert( AliHLTMUONUtils::IntegrityOk(b) );
105 const AliHLTMUONTrackStruct* trackA =
106 reinterpret_cast<const AliHLTMUONTrackStruct*>(&a + 1);
107 const AliHLTMUONTrackStruct* trackB =
108 reinterpret_cast<const AliHLTMUONTrackStruct*>(&b + 1);
110 // First check if the blocks have the same header. If they do then check
111 // if every track is the same. In either case if we find a difference
113 if (a.fHeader != b.fHeader) return false;
114 for (AliHLTUInt32_t i = 0; i < a.fHeader.fNrecords; i++)
115 if (trackA[i] != trackB[i]) return false;