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()];
50 GPUd() void AliHLTTPCCAHitArea::Init( const AliHLTTPCCAGrid &grid, UShort_t *content, UInt_t hitoffset, Float_t y, Float_t z, Float_t dy, Float_t dz )
54 fHitOffset = hitoffset;
61 UInt_t bYmin, bZmin, bYmax;
62 grid.GetBin( fMinY, fMinZ, bYmin, bZmin);
63 grid.GetBin( fMaxY, fMaxZ, bYmax, fBZmax);
64 fBDY = bYmax - bYmin + 1;
66 fIndYmin = bZmin*fNy + bYmin;
68 fHitYfst = content[fIndYmin];
69 fHitYlst = content[fIndYmin + fBDY];
74 GPUd() Int_t AliHLTTPCCAHitArea::GetNext(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
77 Float_t y0 = row.Grid().YMin();
78 Float_t z0 = row.Grid().ZMin();
79 Float_t stepY = row.HstepY();
80 Float_t stepZ = row.HstepZ();
81 const uint4* tmpint4 = tracker.RowData() + row.FullOffset();
82 const ushort2 *hits = reinterpret_cast<const ushort2*>(tmpint4);
86 while( fIh>=fHitYlst ){
87 if( fIz>=fBZmax ) return -1;
90 fHitYfst = content[fIndYmin];
91 fHitYlst = content[fIndYmin + fBDY];
96 ushort2 hh = hits[fIh];
97 h.SetY( y0 + hh.x*stepY );
98 h.SetZ( z0 + hh.y*stepZ );
100 //h = tracker.Hits()[ fHitOffset + fIh ];
102 if( 0 && (h.Z()>fMaxZ || h.Z()<fMinZ || h.Y()<fMinY || h.Y()>fMaxY )){ //SG!!!
115 GPUd() Int_t AliHLTTPCCAHitArea::GetBest(AliHLTTPCCATracker &tracker, const AliHLTTPCCARow &row, UShort_t *content, AliHLTTPCCAHit &h)
117 // get closest hit in the area
122 Int_t ih=GetNext( tracker, row, content, hh );
124 Float_t dy = hh.Y() - fY;
125 Float_t dz = hh.Z() - fZ;
126 Float_t dds = dy*dy+dz*dz;