//-*- Mode: C++ -*- // $Id: AliHLTTPCCATrackParam.h,v 1.3 2010/08/23 19:37:02 mzyzak Exp $ // ************************************************************************ // This file is property of and copyright by the ALICE HLT Project * // ALICE Experiment at CERN, All rights reserved. * // See cxx source for full Copyright notice * // * //************************************************************************* #ifndef ALIHLTTPCCATRACKPARAMARBB_H #define ALIHLTTPCCATRACKPARAMARBB_H #include "arbb.hpp" #include "AliHLTTPCCADef.h" class AliHLTTPCCATrackLinearisationArBB; /** * @class AliHLTTPCCATrackParam * * AliHLTTPCCATrackParam class describes the track parametrisation * which is used by the AliHLTTPCCATracker slice tracker. * */ using arbb::dense; using arbb::f32; using arbb::i32; using arbb::i16; using arbb::boolean; using arbb::fill; using arbb::pack; class AliHLTTPCCATrackParamArBB { // data and data connected functions public: i32 ArraySize; dense fX; // x position dense fSignCosPhi; // sign of cosPhi // phi = arctg (Dy/Dx) dense fP[5]; // 'active' track parameters: Y, Z, SinPhi, Dz/Ds (ds = sqrt( dx^2 + dy^2 )), q/Pt dense fC[15]; // the covariance matrix for Y,Z,SinPhi,.. dense fChi2; // the chi^2 value dense fNDF; // the Number of Degrees of Freedom void operator=( const AliHLTTPCCATrackParamArBB& a ) { fX = a.fX; fSignCosPhi = a.fSignCosPhi; for ( int k = 0; k < 5; ++k ) fP[k] = a.fP[k]; for ( int k = 0; k < 15; ++k ) fC[k] = a.fC[k]; fChi2 = a.fChi2; fNDF = a.fNDF; ArraySize = a.ArraySize; } struct AliHLTTPCCATrackFitParamArBB { dense fBethe; dense fE; dense fTheta2; dense fEP2; dense fSigmadE2; dense fK22; dense fK33; dense fK43; dense fK44; }; void Resize(i32 Size) { fX = fill(0.f, Size); fSignCosPhi = fill(0.f, Size); fChi2 = fill(0.f, Size); fNDF = fill(0, Size); for(int i=0; i<5; i++) { fP[i] = fill(0.f, Size); } for(int i=0; i<15; i++) { fC[i] = fill(0.f, Size); } ArraySize = Size; } void Pack(dense mask) { fX = pack(fX,mask); fSignCosPhi = pack(fSignCosPhi,mask); fChi2 = pack(fChi2,mask); fNDF = pack(fNDF,mask); for(int i=0; i<5; i++) { fP[i] = pack(fP[i],mask); } for(int i=0; i<15; i++) { fC[i] = pack(fC[i],mask); } ArraySize = fX.length(); } void Pack(dense mask, AliHLTTPCCATrackParamArBB& a) { a.fX = pack(fX,mask); a.fSignCosPhi = pack(fSignCosPhi,mask); a.fChi2 = pack(fChi2,mask); a.fNDF = pack(fNDF,mask); for(int i=0; i<5; i++) { a.fP[i] = pack(fP[i],mask); } for(int i=0; i<15; i++) { a.fC[i] = pack(fC[i],mask); } a.ArraySize = a.fX.length(); } void Select(dense mask, const AliHLTTPCCATrackParamArBB& a, const AliHLTTPCCATrackParamArBB& b) { fX = select(mask, a.fX, b.fX); fSignCosPhi = select(mask, a.fSignCosPhi, b.fSignCosPhi); fChi2 = select(mask, a.fChi2, b.fChi2); fNDF = select(mask, a.fNDF, b.fNDF); for(int i=0; i<5; i++) { fP[i] = select(mask, a.fP[i], b.fP[i]); } for(int i=0; i<15; i++) { fC[i] = select(mask, a.fC[i], b.fC[i]); } ArraySize = mask.length(); } void Select(dense mask, i32 iTr, const AliHLTTPCCATrackParamArBB& a, const AliHLTTPCCATrackParamArBB& b) { ArraySize = mask.length(); fX = select(mask, fill(a.fX[iTr],ArraySize), fill(b.fX[iTr],ArraySize)); fSignCosPhi = select(mask, fill(a.fSignCosPhi[iTr],ArraySize), fill(b.fSignCosPhi[iTr],ArraySize)); fChi2 = select(mask, fill(a.fChi2[iTr],ArraySize), fill(b.fChi2[iTr],ArraySize)); fNDF = select(mask, fill(a.fNDF[iTr],ArraySize), fill(b.fNDF[iTr],ArraySize)); for(int i=0; i<5; i++) { fP[i] = select(mask, fill(a.fP[i][iTr],ArraySize), fill(b.fP[i][iTr],ArraySize)); } for(int i=0; i<15; i++) { fC[i] = select(mask, fill(a.fC[i][iTr],ArraySize), fill(b.fC[i][iTr],ArraySize)); } } void Gather(arbb::dense indices) { fX = arbb::gather(fX,indices,0); fSignCosPhi = arbb::gather(fSignCosPhi,indices,0); fChi2 = arbb::gather(fChi2,indices,0); fNDF = arbb::gather(fNDF,indices,0); for(int i=0; i<5; i++) { fP[i] = arbb::gather(fP[i],indices,0); } for(int i=0; i<15; i++) { fC[i] = arbb::gather(fC[i],indices,0); } ArraySize = fX.length(); } void Gather(arbb::dense indices, AliHLTTPCCATrackParamArBB& a) { a.fX = arbb::gather(fX,indices,0); a.fSignCosPhi = arbb::gather(fSignCosPhi,indices,0); a.fChi2 = arbb::gather(fChi2,indices,0); a.fNDF = arbb::gather(fNDF,indices,0); for(int i=0; i<5; i++) { a.fP[i] = arbb::gather(fP[i],indices,0); } for(int i=0; i<15; i++) { a.fC[i] = arbb::gather(fC[i],indices,0); } a.ArraySize = a.fX.length(); } void Scatter(arbb::dense indices, AliHLTTPCCATrackParamArBB& a) { a.fX = arbb::scatter(fX,indices,a.fX); a.fSignCosPhi = arbb::scatter(fSignCosPhi,indices,a.fSignCosPhi); a.fChi2 = arbb::scatter(fChi2,indices,a.fChi2); a.fNDF = arbb::scatter(fNDF,indices,a.fNDF); for(int i=0; i<5; i++) { a.fP[i] = arbb::scatter(fP[i],indices,a.fP[i]); } for(int i=0; i<15; i++) { a.fC[i] = arbb::scatter(fC[i],indices,a.fC[i]); } a.ArraySize = a.fX.length(); } void SetElement(const i32 i1, const AliHLTTPCCATrackParamArBB& a, const i32 i2) { fX[i1] = a.fX[i2]; fSignCosPhi[i1] = a.fSignCosPhi[i2]; fChi2[i1] = a.fChi2[i2]; fNDF[i1] = a.fNDF[i2]; for(int i=0; i<5; i++) { fP[i][i1] = a.fP[i][i2]; } for(int i=0; i<15; i++) { fC[i][i1] = a.fC[i][i2]; } } //functionality public: AliHLTTPCCATrackParamArBB() { ArraySize = 0; } ~AliHLTTPCCATrackParamArBB() {}; // Accessors const dense& Par( int i ) const { return fP[i]; } const dense& Cov( int i ) const { return fC[i]; } dense X() const { return fX; } dense Y() const { return fP[0]; } dense Z() const { return fP[1]; } dense SinPhi() const { return fP[2]; } dense DzDs() const { return fP[3]; } dense QPt() const { return fP[4]; } dense SignCosPhi() const { return fSignCosPhi; } dense Chi2() const { return fChi2; } dense NDF() const { return fNDF; } dense Err2Y() const { return fC[0]; } dense Err2Z() const { return fC[2]; } dense Err2SinPhi() const { return fC[5]; } dense Err2DzDs() const { return fC[9]; } dense Err2QPt() const { return fC[14]; } void SetPar( int i, const dense &v ) { fP[i] = v; } void SetCov( int i, const dense &v ) { fC[i] = v; } void SetPar( int i, const dense &v, const dense &m ) { fP[i] = select( m, v, fP[i] ); } void SetCov( int i, const dense &v, const dense &m ) { fC[i] = select( m, v, fC[i] ); } void SetX( const dense &v ) { fX = v; } void SetY( const dense &v ) { fP[0] = v; } void SetZ( const dense &v ) { fP[1] = v; } void SetSinPhi( const dense &v ) { fP[2] = v; } void SetDzDs( const dense &v ) { fP[3] = v; } void SetQPt( const dense &v ) { fP[4] = v; } void SetSignCosPhi( const dense &v ) { fSignCosPhi = v; } void SetChi2( const dense &v ) { fChi2 = v; } void SetNDF( const dense &v ) { fNDF = v; } void SetX ( const dense &v, const dense &m ) { fX = select( m, v, fX ); }; void SetY ( const dense &v, const dense &m ) { SetPar( 0, v, m ); }; void SetZ ( const dense &v, const dense &m ) { SetPar( 1, v, m ); }; void SetSinPhi( const dense &v, const dense &m ) { SetPar( 2, v, m ); }; void SetDzDs ( const dense &v, const dense &m ) { SetPar( 3, v, m ); }; void SetQPt ( const dense &v, const dense &m ) { SetPar( 4, v, m ); }; // Get distance to track, point... void GetS( dense x, dense y, f32 Bz, dense &dS ); void GetDist2( i32 iTrack, i32 jTrack, f32 &Dist2 ); void GetDist2( dense iTrack, dense jTrack, dense &Dist2 ); void GetDist2( const dense &iTrack, const AliHLTTPCCATrackParamArBB& a, const dense &jTrack, dense &Dist2 ); void GetDistXZ2( i32 iTrack, i32 jTrack, f32 &DistXZ2 ); void GetDistXZ2( dense iTrack, dense jTrack, dense &DistXZ2 ); void GetDistXZ2( const dense &iTrack, const AliHLTTPCCATrackParamArBB& a, const dense &jTrack, dense &DistXZ2 ); void GetDistXZ2( const dense &iTrack, const AliHLTTPCCATrackParamArBB& a, const dense &jTrack, const dense &Alpha, dense &DistXZ2 ); void GetDCAPoint( dense x, dense y, dense z, dense &xp, dense &yp, dense &zp, f32 cBz ); // Functions, that are needed to add the material static void ApproximateBetheBloch( dense beta2, dense &approximation); static void BetheBlochGeant( dense bg2, dense &approximation, f32 kp0 = 2.33, f32 kp1 = 0.20, f32 kp2 = 3.00, f32 kp3 = 173e-9, f32 kp4 = 0.49848); static void BetheBlochSolid( dense bg, dense &approximation ); static void BetheBlochGas( dense bg, dense &approximation ); void CalculateFitParameters( AliHLTTPCCATrackFitParamArBB &par, f32 mass = 0.13957 ); void CorrectForMeanMaterial( dense &mask, dense xOverX0, dense xTimesRho, AliHLTTPCCATrackFitParamArBB par ); //Transport functions void TransportToX( dense &mask, dense x, AliHLTTPCCATrackLinearisationArBB &t0, f32 Bz, dense &DL, f32 maxSinPhi = .999); void TransportToX( dense &mask, dense x, dense sinPhi0, dense cosPhi0, f32 cBz, f32 maxSinPhi = .999 ); void TransportToX( dense &mask, dense x, f32 cBz, f32 maxSinPhi = .999 ); void TransportToX( dense &mask, const dense& x, const dense& sinPhi0, f32 cBz, f32 maxSinPhi = .999 ); // Transport, taking into account material void TransportToXWithMaterial( dense &mask, dense x, AliHLTTPCCATrackLinearisationArBB &t0, AliHLTTPCCATrackFitParamArBB &par, f32 cBz, f32 maxSinPhi= .999 ); void TransportToXWithMaterial( dense &mask, dense x, AliHLTTPCCATrackFitParamArBB &par, f32 cBz, f32 maxSinPhi= .999 ); void TransportToXWithMaterial( dense &mask, dense x, f32 cBz, f32 maxSinPhi = .999 ); //Rotation of the coordinate system void RotateXY( dense alpha, dense &x, dense &y, dense &sin ); void RotateXY( dense alpha, dense &x, dense &y, dense &sin, const i32 &iTr); void Rotate( dense &mask, dense alpha, f32 maxSinPhi = .999 ); void Rotate( dense &mask, dense alpha, AliHLTTPCCATrackLinearisationArBB &t0, f32 maxSinPhi = .999 ); //AliHLTTPCCATrackParam GetGlobalParam(f32 alpha) const; // alpha - angle of the current slice //Filtration void Filter( dense &mask, const dense y, const dense z, const dense err2Y, const dense err2Z, f32 maxSinPhi = .999 ); }; #endif //ALIHLTTPCCATRACKPARAMARBB_H