]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCAGrid.cxx
add fallback compile info of library
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAGrid.cxx
CommitLineData
d54804bf 1// $Id$
2//***************************************************************************
3// This file is property of and copyright by the ALICE HLT Project *
4// ALICE Experiment at CERN, All rights reserved. *
5// *
6// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7// Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8// for The ALICE HLT Project. *
9// *
10// Permission to use, copy, modify and distribute this software and its *
11// documentation strictly for non-commercial purposes is hereby granted *
12// without fee, provided that the above copyright notice appears in all *
13// copies and that both the copyright notice and this permission notice *
14// appear in the supporting documentation. The authors make no claims *
15// about the suitability of this software for any purpose. It is *
16// provided "as is" without express or implied warranty. *
17//***************************************************************************
18
19#include "AliHLTTPCCAGrid.h"
20#include "TMath.h"
21
22AliHLTTPCCAGrid::AliHLTTPCCAGrid(const AliHLTTPCCAGrid&)
23 :fGrid(0),fNy(0),fNz(0),fN(0),
24 fYMin(0),fYMax(0),fZMin(0),fZMax(0),fStepYInv(0),fStepZInv(0)
25{
26 //* dummy
27}
28
29AliHLTTPCCAGrid& AliHLTTPCCAGrid::operator=(const AliHLTTPCCAGrid&)
30{
31 //* dummy
32 return *this;
33}
34
35void AliHLTTPCCAGrid::Create( Float_t yMin, Float_t yMax, Float_t zMin, Float_t zMax, Int_t n )
36{
37 //* Create the grid
38
39 fYMin = TMath::Min(yMin,yMax);
40 fYMax = TMath::Max(yMin,yMax);
41 fZMin = TMath::Min(zMin,zMax);
42 fZMax = TMath::Max(zMin,zMax);
43 fNy = fNz = (Int_t) TMath::Sqrt( (Float_t) n );
44 fNy = TMath::Max(fNy,1);
45 fNz = TMath::Max(fNz,1);
46 fN = fNy*fNz;
47 if( fGrid ) delete[] fGrid;
48 fGrid = new void*[fN];
49 for( Int_t i=0; i<fN; i++ ) fGrid[i] = 0;
50 fStepYInv = (fYMax - fYMin);
51 fStepZInv = (fZMax - fZMin);
52 fStepYInv = ( fStepYInv>1.e-4 ) ?(fNy-1)/fStepYInv :0;
53 fStepZInv = ( fStepZInv>1.e-4 ) ?(fNz-1)/fStepZInv :0;
54}
55
56void **AliHLTTPCCAGrid::Get( Float_t Y, Float_t Z ) const
57{
58 //* get the bin pointer
59
60 Int_t yBin = (Int_t) ( (Y-fYMin)*fStepYInv );
61 Int_t zBin = (Int_t) ( (Z-fZMin)*fStepZInv );
62 if( yBin<0 ) yBin = 0;
63 else if( yBin>=fNy ) yBin = fNy - 1;
64 if( zBin<0 ) zBin = 0;
65 else if( zBin>=fNz ) zBin = fNz - 1;
66 return fGrid + zBin*fNy + yBin;
67}