1 //***************************************************************************
2 // This file is property of and copyright by the ALICE HLT Project *
3 // ALICE Experiment at CERN, All rights reserved. *
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. *
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 //***************************************************************************
18 #include "AliHLTTPCCAHitArea.h"
19 #include "AliHLTTPCCATracker.h"
20 #include "AliHLTTPCCAGrid.h"
21 #include "AliHLTTPCCAHit.h"
22 #include "AliHLTTPCCARow.h"
25 GPUd() void AliHLTTPCCAHitAreaInit( AliHLTTPCCAHitArea &a, AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
29 a.HitOffset() = hitoffset;
36 UInt_t bYmin, bZmin, bYmax;
37 grid.GetBin(a.MinY(), a.MinZ(), bYmin, bZmin);
38 grid.GetBin(a.MaxY(), a.MaxZ(), bYmax, a.BZmax());
39 a.BDY() = bYmax - bYmin + 1;
41 a.IndYmin() = bZmin*a.Ny() + bYmin;
43 a.HitYfst() = content[a.IndYmin()];
44 a.HitYlst() = content[a.IndYmin() + a.BDY()];
49 GPUd() void AliHLTTPCCAHitArea::Init( AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
52 AliHLTTPCCAHitAreaInit(*this, grid, content, hitoffset, y, z, dy, dz);
55 GPUd() Int_t AliHLTTPCCAHitArea::GetNext(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
58 Float_t y0 = row.Grid().YMin();
59 Float_t z0 = row.Grid().ZMin();
60 Float_t stepY = row.HstepY();
61 Float_t stepZ = row.HstepZ();
62 uint4* tmpint4 = tracker.RowData() + row.FullOffset();
63 ushort2 *hits = reinterpret_cast<ushort2*>(tmpint4);
67 while( fIh>=fHitYlst ){
68 if( fIz>=fBZmax ) return -1;
71 fHitYfst = content[fIndYmin];
72 fHitYlst = content[fIndYmin + fBDY];
77 ushort2 hh = hits[fIh];
78 h.Y() = y0 + hh.x*stepY;
79 h.Z() = z0 + hh.y*stepZ;
81 //h = tracker.Hits()[ fHitOffset + fIh ];
83 if( h.fZ>fMaxZ || h.fZ<fMinZ || h.fY<fMinY || h.fY>fMaxY ){
96 GPUd() Int_t AliHLTTPCCAHitArea::GetBest(AliHLTTPCCATracker &tracker, AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
98 // get closest hit in the area
103 Int_t ih=GetNext( tracker, row, content, hh );
105 Float_t dy = hh.fY - fY;
106 Float_t dz = hh.fZ - fZ;
107 Float_t dds = dy*dy+dz*dz;