//-*- 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" #include "AliHLTTPCCAMath.h" #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::u16; //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 AddEntry( u16 n = 1 ) { dense df32 = fill(-1,n); dense di16 = fill(-1,n); fX = cat( fX, df32 ); fSignCosPhi = cat( fSignCosPhi, df32 ); fChi2 = cat( fChi2, df32 ); fNDF = cat( fNDF, di16 ); for(int i=0; i< 5; i++) fP[i] = cat( fP[i], df32 ); for(int i=0; i<15; i++) fC[i] = cat( fC[i], df32 ); ArraySize = ArraySize + static_cast(n); }; void Resize( u16 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(const 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(); } //functionality public: AliHLTTPCCATrackParamArBB() { ArraySize = 0; } AliHLTTPCCATrackParamArBB(u16 size) { Resize(size); } ~AliHLTTPCCATrackParamArBB() {}; // Accessors const dense& Par( int i ) const { return fP[i]; } const dense& Cov( int i ) const { return fC[i]; } const dense& X() const { return fX; } const dense& Y() const { return fP[0]; } const dense& Z() const { return fP[1]; } const dense& SinPhi() const { return fP[2]; } const dense& DzDs() const { return fP[3]; } const dense& QPt() const { return fP[4]; } const dense& SignCosPhi() const { return fSignCosPhi; } const dense& Chi2() const { return fChi2; } const dense& NDF() const { return fNDF; } const dense& Err2Y() const { return fC[0]; } const dense& Err2Z() const { return fC[2]; } const dense& Err2SinPhi() const { return fC[5]; } const dense& Err2DzDs() const { return fC[9]; } const 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 ); }; void SetSignCosPhi ( const dense &v, const dense &m ) { fSignCosPhi = select( m, v, fSignCosPhi ); } void SetChi2 ( const dense &v, const dense &m ) { fChi2 = select( m, v, fChi2 ); } void SetNDF ( const dense &v, const dense &m ) { fNDF = select( m, v, fNDF ); } // Get distance to track, point... void GetS( dense x, dense y, f32 Bz, dense &dS ); void GetDist2( i32 iTrack, i32 jTrack, f32 &Dist2 ); void GetDistXZ2( i32 iTrack, i32 jTrack, f32 &DistXZ2 ); void GetDCAPoint( dense x, dense y, dense z, dense &xp, dense &yp, dense &zp, f32 cBz ); // TODO const referenses in parameters // 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 TransportToXLight( 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 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 ); void FilterLight( dense &mask, const dense& y, const dense& z, const dense& err2Y_, const dense& err2Z_, f32 maxSinPhi = .999 ); }; #endif //ALIHLTTPCCATRACKPARAMARBB_H