]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCADef.h
bug fix: reconstruction crash when the output buffer size exceed
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCADef.h
1 //-*- Mode: C++ -*-
2
3 //* This file is property of and copyright by the ALICE HLT Project        *
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //* See cxx source for full Copyright notice                               *
6
7 #ifndef ALIHLTTPCCADEF_H
8 #define ALIHLTTPCCADEF_H
9
10
11 /**
12  * Definitions needed for AliHLTTPCCATracker
13  *
14  */
15
16 //#define HLTCA_STANDALONE // compilation w/o root
17 #define HLTCA_INTERNAL_PERFORMANCE
18
19 #ifdef __CUDACC__
20 #define HLTCA_GPUCODE
21 #endif //__CUDACC__
22
23 #ifdef WIN32
24 #ifndef R__WIN32
25 #define R__WIN32
26 #endif //!R__WIN32
27 #endif //WIN32
28
29 #ifdef R__WIN32
30 #ifdef INTEL_RUNTIME
31 #pragma warning(disable : 1786)
32 #pragma warning(disable : 1478)
33 #pragma warning(disable : 161)
34 #endif //INTEL_RUNTIME
35
36 #ifdef VSNET_RUNTIME
37 #pragma warning(disable : 4616)
38 #pragma warning(disable : 4996)
39 #pragma warning(disable : 1684)
40 #endif //VSNET_RUNTIME
41 #endif //R__WIN32
42
43 #ifdef HLTCA_STANDALONE
44
45 // class TObject{};
46
47 #ifdef ClassDef
48 #undef ClassDef
49 #endif //ClassDef
50
51 #ifdef ClassTmp
52 #undef ClassTmp
53 #endif //ClassTmp
54
55 #define ClassDef(name,id)
56 #define ClassImp(name)
57
58 typedef unsigned char  UChar_t;     //Unsigned Character 1 byte (unsigned char)
59 #ifdef R__B64    // Note: Long_t and ULong_t are currently not portable types
60 typedef int            Seek_t;      //File pointer (int)
61 typedef long           Long_t;      //Signed long integer 8 bytes (long)
62 typedef unsigned long  ULong_t;     //Unsigned long integer 8 bytes (unsigned long)
63 #else
64 typedef int            Seek_t;      //File pointer (int)
65 typedef long           Long_t;      //Signed long integer 4 bytes (long)
66 typedef unsigned long  ULong_t;     //Unsigned long integer 4 bytes (unsigned long)
67 #endif //R__B64
68 typedef float          Float16_t;   //Float 4 bytes written with a truncated mantissa
69 typedef double         Double32_t;  //Double 8 bytes in memory, written as a 4 bytes float
70 typedef char           Text_t;      //General string (char)
71 typedef unsigned char  Byte_t;      //Byte (8 bits) (unsigned char)
72 typedef short          Version_t;   //Class version identifier (short)
73 typedef const char     Option_t;    //Option string (const char)
74 typedef int            Ssiz_t;      //String size (int)
75 typedef float          Real_t;      //TVector and TMatrix element type (float)
76 #if defined(R__WIN32) && !defined(__CINT__)
77 typedef __int64          Long64_t;  //Portable signed long integer 8 bytes
78 typedef unsigned __int64 ULong64_t; //Portable unsigned long integer 8 bytes
79 #else
80 typedef long long          Long64_t; //Portable signed long integer 8 bytes
81 typedef unsigned long long ULong64_t;//Portable unsigned long integer 8 bytes
82 #endif //R__WIN32 && !__CINT__
83 typedef double         Axis_t;      //Axis values type (double)
84 typedef double         Stat_t;      //Statistics type (double)
85 typedef short          Font_t;      //Font number (short)
86 typedef short          Style_t;     //Style number (short)
87 typedef short          Marker_t;    //Marker number (short)
88 typedef short          Width_t;     //Line width (short)
89 typedef short          Color_t;     //Color number (short)
90 typedef short          SCoord_t;    //Screen coordinates (short)
91 typedef double         Coord_t;     //Pad world coordinates (double)
92 typedef float          Angle_t;     //Graphics angle (float)
93 typedef float          Size_t;      //Attribute size (float)
94
95 #else
96
97 #include "Rtypes.h"
98 #include "AliHLTDataTypes.h"
99
100 namespace AliHLTTPCCADefinitions
101 {
102   extern const AliHLTComponentDataType fgkTrackletsDataType;
103   extern const AliHLTComponentDataType fgkCompressedInputDataType;
104 }
105
106 #endif //HLTCA_STANDALONE
107
108 //#define EXTERN_ROW_HITS
109 #define TRACKLET_SELECTOR_MIN_HITS 10
110 #define REPRODUCIBLE_CLUSTER_SORTING
111 //#define FAST_NEIGHBOURS_FINDER
112
113 #ifdef HLTCA_GPUCODE
114 #define ALIHLTTPCCANEIGHBOURS_FINDER_MAX_NNEIGHUP 6
115 #define ALIHLTTPCCANEIGHBOURS_FINDER_MAX_FGRIDCONTENTUPDOWN 1000
116 #define ALIHLTTPCCASTARTHITSFINDER_MAX_FROWSTARTHITS 3500
117 #define ALIHLTTPCCATRACKLET_CONSTRUCTOR_TEMP_MEM 1536                                   //Max amount of hits in a row that can be stored in shared memory, make sure this is divisible by ROW ALIGNMENT
118 #else
119 #define ALIHLTTPCCANEIGHBOURS_FINDER_MAX_NNEIGHUP 20
120 #define ALIHLTTPCCANEIGHBOURS_FINDER_MAX_FGRIDCONTENTUPDOWN 7000
121 #define ALIHLTTPCCASTARTHITSFINDER_MAX_FROWSTARTHITS 10000
122 #define ALIHLTTPCCATRACKLET_CONSTRUCTOR_TEMP_MEM 15000
123 #endif //HLTCA_GPUCODE
124
125 #ifdef HLTCA_GPUCODE
126
127 #define GPUd() __device__
128 #define GPUhd() __host__ __device__
129 #define GPUh() __host__ inline
130 #define GPUg() __global__
131
132 #define GPUshared() __shared__
133 #define GPUsync() __syncthreads()
134
135 #else
136
137 #define GPUd()
138 #define GPUhd()
139 #define GPUg()
140 #define GPUh()
141 #define GPUshared()
142 #define GPUsync()
143
144 struct float2 { float x; float y; };
145 struct uchar2 { unsigned char x, y; };
146 struct short2 { short x, y; };
147 struct ushort2 { unsigned short x, y; };
148 struct int2 { int x, y; };
149 struct int3 { int x, y, z; };
150 struct int4 { int x, y, z, w; };
151 struct uint1 { unsigned int x; };
152 struct uint2 { unsigned int x, y; };
153 struct uint3 { unsigned int x, y, z; };
154 struct uint4 { unsigned int x, y, z, w; };
155
156 #ifdef R__WIN32
157 #include <float.h>
158
159 inline bool finite(float x)
160 {
161         return(x <= FLT_MAX);
162 }
163 #endif //R__WIN32
164
165 #endif //HLTCA_GPUCODE
166
167 /*
168  * Helper for compile-time verification of correct API usage
169  */
170
171 #ifndef HLTCA_GPUCODE
172 namespace
173 {
174   template<bool> struct HLTTPCCA_STATIC_ASSERT_FAILURE;
175   template<> struct HLTTPCCA_STATIC_ASSERT_FAILURE<true> {};
176 }
177
178 #define HLTTPCCA_STATIC_ASSERT_CONCAT_HELPER(a, b) a##b
179 #define HLTTPCCA_STATIC_ASSERT_CONCAT(a, b) HLTTPCCA_STATIC_ASSERT_CONCAT_HELPER(a, b)
180 #define STATIC_ASSERT(cond, msg) \
181   typedef HLTTPCCA_STATIC_ASSERT_FAILURE<cond> HLTTPCCA_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__); \
182   HLTTPCCA_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__) Error_##msg; \
183   (void) Error_##msg
184 #else
185 #define STATIC_ASSERT(a, b)
186 #endif //!HLTCA_GPUCODE
187
188 namespace
189 {
190   template<typename T1>
191   void UNUSED_PARAM1( const T1 & ) {}
192   template<typename T1, typename T2>
193   void UNUSED_PARAM2( const T1 &, const T2 & ) {}
194   template<typename T1, typename T2, typename T3>
195   void UNUSED_PARAM3( const T1 &, const T2 &, const T3 & ) {}
196   template<typename T1, typename T2, typename T3, typename T4>
197   void UNUSED_PARAM4( const T1 &, const T2 &, const T3 &, const T4 & ) {}
198   template<typename T1, typename T2, typename T3, typename T4, typename T5>
199   void UNUSED_PARAM5( const T1 &, const T2 &, const T3 &, const T4 &, const T5 & ) {}
200   template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
201   void UNUSED_PARAM6( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 & ) {}
202   template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
203   void UNUSED_PARAM7( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 & ) {}
204   template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
205   void UNUSED_PARAM8( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 & ) {}
206   template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
207   void UNUSED_PARAM9( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 &, const T9 & ) {}
208 }
209
210 #define UNROLL2(var, code) code;var++;code;var++;
211 #define UNROLL4(var, code) UNROLL2(var, code) UNROLL2(var, code)
212 #define UNROLL8(var, code) UNROLL4(var, code) UNROLL4(var, code)
213 #define UNROLL16(var, code) UNROLL8(var, code) UNROLL8(var, code)
214 #define UNROLL32(var, code) UNROLL16(var, code) UNROLL16(var, code)
215
216 #endif //ALIHLTTPCCADEF_H