]>
Commit | Line | Data |
---|---|---|
ce565086 | 1 | // ************************************************************************** |
fbb9b71b | 2 | // This file is property of and copyright by the ALICE HLT Project * |
00d07bcd | 3 | // ALICE Experiment at CERN, All rights reserved. * |
4 | // * | |
5 | // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> * | |
6 | // Ivan Kisel <kisel@kip.uni-heidelberg.de> * | |
7 | // for The ALICE HLT Project. * | |
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. * | |
ce565086 | 16 | // * |
00d07bcd | 17 | //*************************************************************************** |
18 | ||
19 | #include "AliHLTTPCCAHitArea.h" | |
20 | #include "AliHLTTPCCATracker.h" | |
00d07bcd | 21 | #include "AliHLTTPCCAHit.h" |
22 | ||
693d2443 | 23 | /* |
fbb9b71b | 24 | GPUd() void AliHLTTPCCAHitAreaInit( AliHLTTPCCAHitArea &a, AliHLTTPCCAGrid &grid, const unsigned short *content, unsigned int hitoffset, float y, float z, float dy, float dz ) |
25 | { | |
00d07bcd | 26 | // initialisation |
27 | ||
00d07bcd | 28 | a.HitOffset() = hitoffset; |
29 | a.Y() = y; | |
30 | a.Z() = z; | |
fbb9b71b | 31 | a.MinZ() = z-dz; |
00d07bcd | 32 | a.MaxZ() = z+dz; |
33 | a.MinY() = y-dy; | |
34 | a.MaxY() = y+dy; | |
fbb9b71b | 35 | unsigned int bYmin, bZmin, bYmax; |
00d07bcd | 36 | grid.GetBin(a.MinY(), a.MinZ(), bYmin, bZmin); |
fbb9b71b | 37 | grid.GetBin(a.MaxY(), a.MaxZ(), bYmax, a.BZmax()); |
00d07bcd | 38 | a.BDY() = bYmax - bYmin + 1; |
39 | a.Ny() = grid.Ny(); | |
4687b8fc | 40 | a.IndYmin() = bZmin*a.Ny() + bYmin; |
41 | a.Iz() = bZmin; | |
42 | a.HitYfst() = content[a.IndYmin()]; | |
fbb9b71b | 43 | a.HitYlst() = content[a.IndYmin() + a.BDY()]; |
44 | a.Ih() = a.HitYfst(); | |
00d07bcd | 45 | } |
693d2443 | 46 | */ |
00d07bcd | 47 | |
48 | ||
fbb9b71b | 49 | GPUd() void AliHLTTPCCAHitArea::Init( const AliHLTTPCCAGrid &grid, const unsigned short *content, unsigned int hitoffset, float y, float z, float dy, float dz ) |
50 | { | |
00d07bcd | 51 | //initialisation |
693d2443 | 52 | |
53 | fHitOffset = hitoffset; | |
54 | fY = y; | |
55 | fZ = z; | |
fbb9b71b | 56 | fMinZ = z - dz; |
57 | fMaxZ = z + dz; | |
58 | fMinY = y - dy; | |
59 | fMaxY = y + dy; | |
60 | unsigned int bYmin, bZmin, bYmax; | |
61 | grid.GetBin( fMinY, fMinZ, bYmin, bZmin ); | |
62 | grid.GetBin( fMaxY, fMaxZ, bYmax, fBZmax ); | |
693d2443 | 63 | fBDY = bYmax - bYmin + 1; |
64 | fNy = grid.Ny(); | |
fbb9b71b | 65 | fIndYmin = bZmin * fNy + bYmin; |
693d2443 | 66 | fIz = bZmin; |
67 | fHitYfst = content[fIndYmin]; | |
fbb9b71b | 68 | fHitYlst = content[fIndYmin + fBDY]; |
69 | fIh = fHitYfst; | |
00d07bcd | 70 | } |
71 | ||
693d2443 | 72 | |
fbb9b71b | 73 | GPUd() int AliHLTTPCCAHitArea::GetNext( AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, const unsigned short *content, AliHLTTPCCAHit &h ) |
74 | { | |
00d07bcd | 75 | // get next hit index |
fbb9b71b | 76 | float y0 = row.Grid().YMin(); |
77 | float z0 = row.Grid().ZMin(); | |
78 | float stepY = row.HstepY(); | |
79 | float stepZ = row.HstepZ(); | |
693d2443 | 80 | const uint4* tmpint4 = tracker.RowData() + row.FullOffset(); |
fbb9b71b | 81 | const ushort2 *hits = reinterpret_cast<const ushort2*>( tmpint4 ); |
4687b8fc | 82 | |
fbb9b71b | 83 | int ret = -1; |
84 | do { | |
85 | while ( fIh >= fHitYlst ) { | |
86 | if ( fIz >= fBZmax ) return -1; | |
00d07bcd | 87 | fIz++; |
88 | fIndYmin += fNy; | |
4687b8fc | 89 | fHitYfst = content[fIndYmin]; |
90 | fHitYlst = content[fIndYmin + fBDY]; | |
00d07bcd | 91 | fIh = fHitYfst; |
92 | } | |
4687b8fc | 93 | |
94 | { | |
95 | ushort2 hh = hits[fIh]; | |
693d2443 | 96 | h.SetY( y0 + hh.x*stepY ); |
97 | h.SetZ( z0 + hh.y*stepZ ); | |
4687b8fc | 98 | } |
fbb9b71b | 99 | //h = tracker.Hits()[ fHitOffset + fIh ]; |
100 | ||
101 | if ( 1 && ( h.Z() > fMaxZ || h.Z() < fMinZ || h.Y() < fMinY || h.Y() > fMaxY ) ) { //SG!!! | |
00d07bcd | 102 | fIh++; |
103 | continue; | |
104 | } | |
105 | ret = fIh; | |
106 | fIh++; | |
107 | break; | |
fbb9b71b | 108 | } while ( 1 ); |
109 | return ret; | |
00d07bcd | 110 | } |
111 | ||
112 | ||
113 | ||
fbb9b71b | 114 | GPUd() int AliHLTTPCCAHitArea::GetBest( AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, const unsigned short *content, AliHLTTPCCAHit &h ) |
00d07bcd | 115 | { |
116 | // get closest hit in the area | |
fbb9b71b | 117 | int best = -1; |
118 | float ds = 1.e10; | |
119 | do { | |
00d07bcd | 120 | AliHLTTPCCAHit hh; |
fbb9b71b | 121 | int ih = GetNext( tracker, row, content, hh ); |
122 | if ( ih < 0 ) break; | |
123 | float dy = hh.Y() - fY; | |
124 | float dz = hh.Z() - fZ; | |
125 | float dds = dy * dy + dz * dz; | |
126 | if ( dds < ds ) { | |
00d07bcd | 127 | ds = dds; |
128 | best = ih; | |
129 | h = hh; | |
130 | } | |
fbb9b71b | 131 | } while ( 1 ); |
00d07bcd | 132 | |
133 | return best; | |
134 | } | |
135 |