]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCTrack.cxx
removing unused classes from repository
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTrack.cxx
index 980143a733b2b482361c4e029689f2fc479021af..d3c213fc5501dc2c3d3ad9a3b1c4cdd6ced7ca65 100644 (file)
@@ -2,11 +2,12 @@
 // Original: AliHLTTrack.cxx,v 1.32 2005/06/14 10:55:21 cvetan 
 
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Authors: Anders Vestbo, Uli Frankenfeld                                *
- *          Matthias Richter <Matthias.Richter@ift.uib.no>                *
- *          for The ALICE Off-line Project.                               *
+ * Primary Authors: Anders Vestbo, Uli Frankenfeld, maintained by         *
+ *                  Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  for The ALICE HLT Project.                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
  * documentation strictly for non-commercial purposes is hereby granted   *
@@ -56,6 +57,7 @@ AliHLTTPCTrack::AliHLTTPCTrack()
   fPterr(0),
   fPsierr(0),
   fZ0err(0),
+  fY0err(0),
   fTanlerr(0),
 
   fPhi0(0),
@@ -69,7 +71,8 @@ AliHLTTPCTrack::AliHLTTPCTrack()
   fIsLocal(true),
   //  fRowRange({0,0}),
 
-  fPID(0)
+  fPID(0),
+  fId(-1)
 {
   //Constructor
   fRowRange[0]=0;
@@ -80,7 +83,7 @@ AliHLTTPCTrack::AliHLTTPCTrack()
 
   SetFirstPoint(0,0,0);
   SetLastPoint(0,0,0);
-  memset(fHitNumbers,0,159*sizeof(UInt_t));
+  memset(fHitNumbers,0,fgkHitArraySize*sizeof(UInt_t));
 }
 
 void AliHLTTPCTrack::Copy(AliHLTTPCTrack *tpt)
@@ -98,13 +101,14 @@ void AliHLTTPCTrack::Copy(AliHLTTPCTrack *tpt)
   SetPterr(tpt->GetPterr());
   SetPsierr(tpt->GetPsierr());
   SetTglerr(tpt->GetTglerr());
+  SetZ0err(tpt->GetZ0err());
+  SetY0err(tpt->GetY0err());
   SetCharge(tpt->GetCharge());
   SetHits(tpt->GetNHits(),(UInt_t *)tpt->GetHitNumbers());
-#ifdef do_mc
   SetMCid(tpt->GetMCid());
-#endif
   SetPID(tpt->GetPID());
   SetSector(tpt->GetSector());
+  SetId( tpt->GetId());
 }
 
 Int_t AliHLTTPCTrack::Compare(const AliHLTTPCTrack *track) const
@@ -131,13 +135,6 @@ Double_t AliHLTTPCTrack::GetPseudoRapidity() const
   return 0.5 * log((GetP() + GetPz()) / (GetP() - GetPz()));
 }
 
-/*
-Double_t AliHLTTPCTrack::GetEta() const
-{
-  return GetPseudoRapidity();
-}
-*/
-
 Double_t AliHLTTPCTrack::GetRapidity() const
 { 
   //get rap
@@ -200,31 +197,27 @@ void AliHLTTPCTrack::Rotate(Int_t slice,Bool_t tolocal)
 void AliHLTTPCTrack::CalculateHelix()
 {
   // fit assigned clusters to helix
-// #### -B0-CHANGE-START == JMT
-    // for straight line fit
-    if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
-       fRadius = 999999;  //just zero
-
-       SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
-       SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
-    }
-    // for helix fit
-    else { 
-// #### -B0-UNCHANGED-START == JMT
-       //Calculate Radius, CenterX and CenterY from Psi, X0, Y0
-       fRadius = fPt / (AliHLTTPCTransform::GetBFieldValue());
-       if(fRadius) fKappa = -fQ*1./fRadius;
-       else fRadius = 999999;  //just zero
-       Double_t trackPhi0 = fPsi + fQ * AliHLTTPCTransform::PiHalf();
-       
-       fCenterX = fFirstPoint[0] - fRadius *  cos(trackPhi0);
-       fCenterY = fFirstPoint[1] - fRadius *  sin(trackPhi0);
-       
-       SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
-       SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
-// #### -B0-UNCHANGED-END == JMT
-    }
-// #### -B0-CHANGE-END == JMT
+  // for straight line fit
+  if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
+    fRadius = 999999;  //just zero
+    
+    SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
+    SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
+  }
+  // for helix fit
+  else { 
+    //Calculate Radius, CenterX and CenterY from Psi, X0, Y0
+    fRadius = fPt / (AliHLTTPCTransform::GetBFieldValue());
+    if(fRadius) fKappa = -fQ*1./fRadius;
+    else fRadius = 999999;  //just zero
+    Double_t trackPhi0 = fPsi + fQ * AliHLTTPCTransform::PiHalf();
+    
+    fCenterX = fFirstPoint[0] - fRadius *  cos(trackPhi0);
+    fCenterY = fFirstPoint[1] - fRadius *  sin(trackPhi0);
+    
+    SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
+    SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
+  }
 }
 
 Double_t AliHLTTPCTrack::GetCrossingAngle(Int_t padrow,Int_t slice) 
@@ -275,63 +268,57 @@ Bool_t AliHLTTPCTrack::GetCrossingPoint(Int_t padrow,Float_t *xyz)
   
   Double_t xHit = AliHLTTPCTransform::Row2X(padrow);
 
-// BEGINN ############################################## MODIFIY JMT
 //if (xHit < xyz[0]){
 //    LOG(AliHLTTPCLog::kError,"AliHLTTPCTRACK::GetCrossingPoint","")<< "Track doesn't cross padrow " 
 //                             << padrow <<"(x=" << xHit << "). Smallest x=" << xyz[0] << ENDLOG;
 //      return false;
 //}
-// END ################################################# MODIFIY JMT
 
-// #### -B0-CHANGE-START == JMT
   // for straight line fit
-    if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
-
-       Double_t yHit = GetFirstPointY() + (Double_t) tan( GetPsi() ) * (xHit - GetFirstPointX());   
-       
-       Double_t s = (xHit - GetFirstPointX())*(xHit - GetFirstPointX()) + (yHit - GetFirstPointY())*(yHit - GetFirstPointY()); 
-       
-       Double_t zHit = GetFirstPointZ() + s * GetTgl();
-
-       xyz[0] = xHit;
-       xyz[1] = yHit;
-       xyz[2] = zHit;
-    }
-    // for helix fit
+  if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
+    
+    Double_t yHit = GetFirstPointY() + (Double_t) tan( GetPsi() ) * (xHit - GetFirstPointX());   
+    
+    Double_t s = (xHit - GetFirstPointX())*(xHit - GetFirstPointX()) + (yHit - GetFirstPointY())*(yHit - GetFirstPointY()); 
+    
+    Double_t zHit = GetFirstPointZ() + s * GetTgl();
+    
+    xyz[0] = xHit;
+    xyz[1] = yHit;
+    xyz[2] = zHit;
+  }
+  // for helix fit
     else { 
-// #### -B0-UNCHANGED-START == JMT
-       xyz[0] = xHit;
-       Double_t aa = (xHit - GetCenterX())*(xHit - GetCenterX());
-       Double_t r2 = GetRadius()*GetRadius();
-       if(aa > r2)
-           return false;
-       
-       Double_t aa2 = sqrt(r2 - aa);
-       Double_t y1 = GetCenterY() + aa2;
-       Double_t y2 = GetCenterY() - aa2;
-       xyz[1] = y1;
-       if(fabs(y2) < fabs(y1)) xyz[1] = y2;
-       
-       Double_t yHit = xyz[1];
-       Double_t angle1 = atan2((yHit - GetCenterY()),(xHit - GetCenterX()));
-       if(angle1 < 0) angle1 += 2.*AliHLTTPCTransform::Pi();
-       Double_t angle2 = atan2((GetFirstPointY() - GetCenterY()),(GetFirstPointX() - GetCenterX()));
-       if(angle2 < 0) angle2 += AliHLTTPCTransform::TwoPi();
-       
-       Double_t diffangle = angle1 - angle2;
-       diffangle = fmod(diffangle,AliHLTTPCTransform::TwoPi());
-       if((GetCharge()*diffangle) > 0) diffangle = diffangle - GetCharge()*AliHLTTPCTransform::TwoPi();
-       
-       Double_t stot = fabs(diffangle)*GetRadius();
-       
-       Double_t zHit = GetFirstPointZ() + stot*GetTgl();
-       
-       xyz[2] = zHit;
-// #### -B0-UNCHANGED-END == JMT
+      xyz[0] = xHit;
+      Double_t aa = (xHit - GetCenterX())*(xHit - GetCenterX());
+      Double_t r2 = GetRadius()*GetRadius();
+      if(aa > r2)
+       return false;
+      
+      Double_t aa2 = sqrt(r2 - aa);
+      Double_t y1 = GetCenterY() + aa2;
+      Double_t y2 = GetCenterY() - aa2;
+      xyz[1] = y1;
+      if(fabs(y2) < fabs(y1)) xyz[1] = y2;
+      
+      Double_t yHit = xyz[1];
+      Double_t angle1 = atan2((yHit - GetCenterY()),(xHit - GetCenterX()));
+      if(angle1 < 0) angle1 += 2.*AliHLTTPCTransform::Pi();
+      Double_t angle2 = atan2((GetFirstPointY() - GetCenterY()),(GetFirstPointX() - GetCenterX()));
+      if(angle2 < 0) angle2 += AliHLTTPCTransform::TwoPi();
+      
+      Double_t diffangle = angle1 - angle2;
+      diffangle = fmod(diffangle,AliHLTTPCTransform::TwoPi());
+      if((GetCharge()*diffangle) > 0) diffangle = diffangle - GetCharge()*AliHLTTPCTransform::TwoPi();
+      
+      Double_t stot = fabs(diffangle)*GetRadius();
+      
+      Double_t zHit = GetFirstPointZ() + stot*GetTgl();
+      
+      xyz[2] = zHit;
     }
-// #### -B0-CHANGE-END == JMT
-
-    return true;
+  
+  return true;
 }
 
 Bool_t AliHLTTPCTrack::CalculateReferencePoint(Double_t angle,Double_t radius)
@@ -500,69 +487,65 @@ void AliHLTTPCTrack::UpdateToFirstPoint()
   //However, if you later on want to do more precise local calculations, such
   //as impact parameter, residuals etc, you need to give the track parameters
   //according to the actual fit.
-// #### -B0-CHANGE-START == JMT
-    // for straight line fit
-    if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
-       Double_t xc = GetCenterX() - GetFirstPointX();
-       Double_t yc = GetCenterY() - GetFirstPointY();
-
-       Double_t xn = (Double_t) sin( GetPsi() );
-       Double_t yn = -1. * (Double_t) cos( GetPsi() );
-
-       Double_t d = xc*xn + yc*yn;
-
-       Double_t distx = d * xn;
-       Double_t disty = d * yn;
-
-       Double_t point[2];
-
-       point[0] = distx + GetFirstPointX();
-       point[1] = disty + GetFirstPointY();
-
-       //Update the track parameters
-       SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
-       SetPhi0(atan2(point[1],point[0]));
-       SetFirstPoint(point[0],point[1],GetZ0());
-    }
-    // for helix fit
-    else { 
-// #### -B0-UNCHANGED-START == JMT
-       Double_t xc = GetCenterX() - GetFirstPointX();
-       Double_t yc = GetCenterY() - GetFirstPointY();
-       
-       Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
-       Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
-       Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1);
-       
-       Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
-       Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
-       Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2);
-       
-       //Choose the closest:
-       Double_t point[2];
-       if(distance1 < distance2)
-       {
-           point[0] = distx1 + GetFirstPointX();
-           point[1] = disty1 + GetFirstPointY();
-       }
-       else
-       {
-           point[0] = distx2 + GetFirstPointX();
-           point[1] = disty2 + GetFirstPointY();
-       }
-
-       Double_t pointpsi = atan2(point[1]-GetCenterY(),point[0]-GetCenterX());
-       pointpsi -= GetCharge()*AliHLTTPCTransform::PiHalf();
-       if(pointpsi < 0) pointpsi += AliHLTTPCTransform::TwoPi();
-       
-       //Update the track parameters
-       SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
-       SetPhi0(atan2(point[1],point[0]));
-       SetFirstPoint(point[0],point[1],GetZ0());
-       SetPsi(pointpsi);
-// #### -B0-UNCHANGED-END == JMT
-    }
-// #### -B0-CHANGE-END == JMT
+  // for straight line fit
+  if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
+    Double_t xc = GetCenterX() - GetFirstPointX();
+    Double_t yc = GetCenterY() - GetFirstPointY();
+    
+    Double_t xn = (Double_t) sin( GetPsi() );
+    Double_t yn = -1. * (Double_t) cos( GetPsi() );
+    
+    Double_t d = xc*xn + yc*yn;
+    
+    Double_t distx = d * xn;
+    Double_t disty = d * yn;
+    
+    Double_t point[2];
+    
+    point[0] = distx + GetFirstPointX();
+    point[1] = disty + GetFirstPointY();
+    
+    //Update the track parameters
+    SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
+    SetPhi0(atan2(point[1],point[0]));
+    SetFirstPoint(point[0],point[1],GetZ0());
+  }
+  // for helix fit
+  else { 
+    Double_t xc = GetCenterX() - GetFirstPointX();
+    Double_t yc = GetCenterY() - GetFirstPointY();
+    
+    Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
+    Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
+    Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1);
+    
+    Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
+    Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
+    Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2);
+    
+    //Choose the closest:
+    Double_t point[2];
+    if(distance1 < distance2)
+      {
+       point[0] = distx1 + GetFirstPointX();
+       point[1] = disty1 + GetFirstPointY();
+      }
+    else
+      {
+       point[0] = distx2 + GetFirstPointX();
+       point[1] = disty2 + GetFirstPointY();
+      }
+    
+    Double_t pointpsi = atan2(point[1]-GetCenterY(),point[0]-GetCenterX());
+    pointpsi -= GetCharge()*AliHLTTPCTransform::PiHalf();
+    if(pointpsi < 0) pointpsi += AliHLTTPCTransform::TwoPi();
+    
+    //Update the track parameters
+    SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
+    SetPhi0(atan2(point[1],point[0]));
+    SetFirstPoint(point[0],point[1],GetZ0());
+    SetPsi(pointpsi);
+  }
 }
 
 void AliHLTTPCTrack::GetClosestPoint(AliHLTTPCVertex *vertex,Double_t &closestX,Double_t &closestY,Double_t &closestZ)
@@ -609,12 +592,10 @@ void AliHLTTPCTrack::GetClosestPoint(AliHLTTPCVertex *vertex,Double_t &closestX,
   closestZ = GetFirstPointZ() - stot*GetTgl();
 }
 
-void AliHLTTPCTrack::Print() const
+void AliHLTTPCTrack::Print(Option_t* /*option*/) const
 { 
 //print out parameters of track
-// BEGINN ############################################## MODIFIY JMT
 
-#if 1
  LOG(AliHLTTPCLog::kInformational,"AliHLTTPCTrack::Print","Print values")
     <<"NH="<<fNHits<<" "<<fMCid<<" K="<<fKappa<<" R="<<fRadius<<" Cx="<<fCenterX<<" Cy="<<fCenterY<<" MVT="
     <<fFromMainVertex<<" Row0="<<fRowRange[0]<<" Row1="<<fRowRange[1]<<" Sector="<<fSector<<" Q="<<fQ<<" TgLam="
@@ -624,20 +605,6 @@ void AliHLTTPCTrack::Print() const
     <<fPoint[0]<<" "<<fPoint[1]<<" "<<fPoint[2]<<" "<<fPointPsi<<" "<<fIsPoint<<" local="
     <<fIsLocal<<" "<<fPID<<ENDLOG; 
 
-
-
-#else
-  LOG(AliHLTTPCLog::kInformational,"AliHLTTPCTrack::Print","Print values")
-    <<fNHits<<" "<<fMCid<<" "<<fKappa<<" "<<fRadius<<" "<<fCenterX<<" "<<fCenterY<<" "
-    <<fFromMainVertex<<" "<<fRowRange[0]<<" "<<fRowRange[1]<<" "<<fSector<<" "<<fQ<<" "
-    <<fTanl<<" "<<fPsi<<" "<<fPt<<" "<<fLength<<" "<<fPterr<<" "<<fPsierr<<" "<<fZ0err<<" "
-    <<fTanlerr<<" "<<fPhi0<<" "<<fR0<<" "<<fZ0<<" "<<fFirstPoint[0]<<" "<<fFirstPoint[1]<<" "
-    <<fFirstPoint[2]<<" "<<fLastPoint[0]<<" "<<fLastPoint[1]<<" "<<fLastPoint[2]<<" "
-    <<fPoint[0]<<" "<<fPoint[1]<<" "<<fPoint[2]<<" "<<fPointPsi<<" "<<fIsPoint<<" "
-    <<fIsLocal<<" "<<fPID<<ENDLOG; 
-#endif
-
-// END ################################################# MODIFIY JMT
 }
 
 int AliHLTTPCTrack::Convert2AliKalmanTrack()
@@ -649,39 +616,161 @@ int AliHLTTPCTrack::Convert2AliKalmanTrack()
   // sector A00 starts at 3 o'clock, sectors are counted counterclockwise
   // median of sector 00 is at 10 degrees, median of sector A04 at 90
   //
-  Double_t alpha = 0;
-  alpha = fmod((2*GetSector()+1)*(TMath::Pi()/18),2*TMath::Pi());
-  if      (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
-  else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
 
+  Double_t charge=(double) GetCharge();
+  Double_t param[5];
+  param[1] = GetFirstPointZ();
+  param[3] = GetTgl();
+  param[4] = charge*(1.0/GetPt());
+
+  Double_t alpha, phi, xl, yl;
+
+  // rotate to local coordinates if necessary
+
+  if(GetSector() == -1){ // track in global coordinates
+
+    alpha = TMath::ATan2(GetFirstPointY(),GetFirstPointX());
+    double sinAlpha = TMath::Sin(alpha);
+    double cosAlpha = TMath::Cos(alpha);   
+
+    phi = GetPsi() - alpha;
+    xl =  GetFirstPointX()*cosAlpha + GetFirstPointY()*sinAlpha;    
+    yl = -GetFirstPointX()*sinAlpha + GetFirstPointY()*cosAlpha;
+
+  } else{ // track in local coordinates
+
+    alpha = (GetSector()+0.5)*(TMath::TwoPi()/18);
+    phi = GetPsi();    
+    xl = GetFirstPointX();
+    yl = GetFirstPointY();
+
+    // normalize alpha to [-Pi,+Pi]
+
+    alpha = alpha - TMath::TwoPi() * TMath::Floor( alpha /TMath::TwoPi()+.5);
+  }
+  
+  // extra rotation to keep phi in the range (-Pi/2,+Pi/2)
+  {  
+    const Double_t kMaxPhi = TMath::PiOver2() - 10./180.*TMath::Pi(); 
+    
+    // normalize phi to [-Pi,+Pi]
+    
+    phi = phi - TMath::TwoPi() * TMath::Floor( phi /TMath::TwoPi()+.5);
+    
+    if( phi >= kMaxPhi )
+      {      
+       alpha += TMath::PiOver2();
+       phi   -= TMath::PiOver2();
+       Double_t xtmp = xl;
+       xl =  yl;
+       yl = -xtmp;
+      } 
+    else if( phi <= -kMaxPhi )
+      {      
+       alpha += -TMath::PiOver2();
+       phi   -= -TMath::PiOver2();
+       Double_t xtmp = xl;
+       xl = -yl;
+       yl =  xtmp;
+      }
+  }
+
+  param[0] = yl;
+  param[2] = TMath::Sin(phi);
+  
   //covariance matrix
   Double_t cov[15]={
-    0.,
-    0.,  0.,
-    0.,  0.,  0.,
-    0.,  0.,  0.,  0.,
-    0.,  0.,  0.,  0.,  0.
+    GetY0err(),                         //Error in Y (Y and X are the same)
+    0.,  GetZ0err(),                    //Error in Z
+    0.,  0.,  GetPsierr(),              //Error for Psi
+    0.,  0.,  0.,  GetTglerr(),         //Error for Tgl
+    0.,  0.,  0.,  0.,  GetPterr()      //Error for Pt
   };
 
-  Double_t xhit = GetFirstPointX();
-  Double_t xx[5];
-  xx[0] = GetFirstPointY();
-  xx[1] = GetFirstPointZ();
-  xx[2] = TMath::Sin(GetPsi());
-  xx[3] = GetTgl();
-  xx[4] = GetPt();
-  //cout << "xhit=" << xhit << " y=" << xx[0] << " z=" << xx[1] << endl;
-  //cout << "alpha=" << alpha << endl;
-
-  // the Set function was not available in earlier versions, check required in
-  // configure.ac
+  Int_t nCluster = GetNHits();
+  fdEdx=0;
+
+  // the Set function was not available in earlier versions, check done
+  // during configure; for the AliRoot build, by default ON
 #ifdef EXTERNALTRACKPARAM_V1
 #warning track conversion to ESD format needs AliRoot version > v4-05-04
   //TODO (Feb 07): make this a real warning when logging system is adapted
   //HLTWarning("track conversion to ESD format needs AliRoot version > v4-05-04");
 #else
-  Set(xhit,alpha,xx,cov);
+  Set(xl,alpha,param,cov);
+  SetNumberOfClusters(nCluster);
+  SetChi2(0.);
+  SetFakeRatio(0.);
+  SetMass(0.13957);
 #endif
 
   return iResult;
 }
+
+void AliHLTTPCTrack::SetHits(Int_t nhits,UInt_t *hits)
+{
+  // set hit array
+  if (!hits) return;
+  if (nhits>fgkHitArraySize) {
+    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTrack::SetHits","too many hits")
+      << "too many hits (" << nhits << ") for hit array of size " << fgkHitArraySize << ENDLOG; 
+    SetNHits(fgkHitArraySize);
+  } else {
+    SetNHits(nhits);
+  }
+  memcpy(fHitNumbers,hits,fNHits*sizeof(UInt_t));
+}
+
+Double_t AliHLTTPCTrack::GetLengthXY() const
+{
+  //calculates the length of the arc in XY-plane. This is the length of the track in XY-plane.
+  //Using a^2 = b^2 + c^2 - 2bc * cosA for finding the angle between first and last point.
+  //Length of arc is arc = r*A. Where A is the angle between first and last point.
+
+  Double_t dx = GetLastPointX()-GetFirstPointX();
+  Double_t dy = GetLastPointY()-GetFirstPointY();
+  Double_t a = TMath::Sqrt((dx*dx)+(dy*dy)); 
+  Double_t r = GetRadius();
+  Double_t r2 = r*r;
+
+  Double_t A = TMath::ACos((r2+r2-(a*a))/(2*r2));
+
+  return r*A;
+}
+
+Double_t AliHLTTPCTrack::GetLengthTot() const
+{
+  //Calculates the length of the track in 3D
+
+
+
+
+
+  return 100.0;
+
+}
+
+int AliHLTTPCTrack::CheckConsistency()
+{
+  // Check consistency of all members
+  int iResult=0;
+  if (CheckDoubleMember(&fPterr,   0., "fPterr")<0) iResult=-EDOM;
+  if (CheckDoubleMember(&fPsierr,  0., "fPsierr")<0) iResult=-EDOM;
+  if (CheckDoubleMember(&fZ0err,   0., "fZ0err")<0) iResult=-EDOM;
+  if (CheckDoubleMember(&fY0err,   0., "fY0err")<0) iResult=-EDOM;  
+  if (CheckDoubleMember(&fTanlerr, 0., "fTanlerr")<0) iResult=-EDOM;
+  return iResult;
+}
+
+int AliHLTTPCTrack::CheckDoubleMember(double* pMember, double def, const char* name) const
+{
+  // Check consistency of a Double member
+  if (!pMember) return -EINVAL;
+  if (TMath::Abs(*pMember)>kVeryBig) {
+    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTrack","member consistency")
+      << "invalid Double number %f" << *pMember << " in member " << name << ENDLOG; 
+    *pMember=def;
+    return -EDOM;
+  }
+  return 0;
+}