]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/AliHLTMUONRecHitsBlockStruct.h
Adding header files common to dimuon HLT.
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONRecHitsBlockStruct.h
CommitLineData
26a4668d 1#ifndef ALIHLTMUONRECHITSBLOCKSTRUCT_H
2#define ALIHLTMUONRECHITSBLOCKSTRUCT_H
3/**************************************************************************
4 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Author: The ALICE Off-line Project. *
7 * Contributors are mentioned in the code where appropriate. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18/* $Id$ */
19
20/**
21 * @file AliHLTMUONRecHitsBlockStruct.h
22 * @author Indranil Das <indra.das@saha.ac.in>,
23 * Artur Szostak <artursz@iafrica.com>
24 * @date
25 * @brief Definition of internal dimuon HLT reconstructed hit block structure.
26 *
27 * The structures are defined with C linkage since C generally gives us more
28 * binary compatibility between compilers.
29 */
30
31#include "AliHLTMUONDataTypes.h"
32
33extern "C"
34{
35
36/**
37 * A 3D reconstructed hit point structure.
38 * These are used to store the hits reconstructed on the tracking or trigger
39 * chambers.
40 * Reconstructed hit values of (0, 0, 0) indicate an invalid or nil hit.
41 */
42struct AliHLTMUONRecHitStruct
43{
44 AliHLTFloat32_t fX; // X coordinate.
45 AliHLTFloat32_t fY; // Y coordinate.
46 AliHLTFloat32_t fZ; // Z coordinate.
47};
48
49/**
50 * AliHLTMUONRecHitsBlockStruct defines the format of the internal
51 * reconstructed hit data block.
52 */
53struct AliHLTMUONRecHitsBlockStruct
54{
55 AliHLTUInt32_t fNhits; // Number of hits in this block.
56 AliHLTMUONRecHitStruct fHit[/*fNhits*/]; // Array of reconstructed hits.
57};
58
59} // extern "C"
60
61
62/**
63 * Stream operator for usage with std::ostream classes which prints the
64 * reconstructed hit in the following format: {fX = xx, fY = yy, fZ = zz}
65 */
66inline std::ostream& operator << (
67 std::ostream& stream, const AliHLTMUONRecHitStruct& hit
68 )
69{
70 stream << "{fX = " << hit.fX << ", fY = " << hit.fY << ", fZ = "
71 << hit.fZ << "}";
72 return stream;
73}
74
75/**
76 * Stream operator for usage with std::ostream classes which prints the
77 * AliHLTMUONRecHitsBlockStruct in the following format:
78 * {fNhits = xx, fHit[] = [{..}, {..}, ...]}
79 */
80inline std::ostream& operator << (
81 std::ostream& stream, const AliHLTMUONRecHitsBlockStruct& block
82 )
83{
84 stream << "{fNhits = " << block.fNhits << ", fHit[] = [";
85 if (block.fNhits > 0) stream << block.fHit[0];
86 for (AliHLTUInt32_t i = 1; i < block.fNhits; i++)
87 stream << ", " << block.fHit[i];
88 stream << "]}";
89 return stream;
90}
91
92
93inline bool operator == (
94 const AliHLTMUONRecHitStruct& a, const AliHLTMUONRecHitStruct& b
95 )
96{
97 return a.fX == b.fX and a.fY == b.fY and a.fZ == b.fZ;
98}
99
100inline bool operator != (
101 const AliHLTMUONRecHitStruct& a, const AliHLTMUONRecHitStruct& b
102 )
103{
104 return not operator == (a, b);
105}
106
107
108inline bool operator == (
109 const AliHLTMUONRecHitsBlockStruct& a, const AliHLTMUONRecHitsBlockStruct& b
110 )
111{
112 // First check if the blocks have the same number of hits. If they do then
113 // check if every hit is the same. In either case if we find a difference
114 // return false.
115 if (a.fNhits != b.fNhits) return false;
116 for (AliHLTUInt32_t i = 0; i < a.fNhits; i++)
117 if (a.fHit[i] != b.fHit[i]) return false;
118 return true;
119}
120
121inline bool operator != (
122 const AliHLTMUONRecHitsBlockStruct& a, const AliHLTMUONRecHitsBlockStruct& b
123 )
124{
125 return not operator == (a, b);
126}
127
128#endif // ALIHLTMUONRECHITSBLOCKSTRUCT_H