]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/src/AliL3Track.cxx
New class to make V2 clusters starting from digits or hits (fast simulation). Origin...
[u/mrichter/AliRoot.git] / HLT / src / AliL3Track.cxx
index 6f85aac86eae8b94e4b4bcf0ade7c538308c677a..7056ecd4589c2a87305521c1a5aaf901162b2868 100644 (file)
@@ -3,15 +3,14 @@
 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>
 //*-- Copyright &copy ASV
 
+#include "AliL3StandardIncludes.h"
 
 #include "AliL3RootTypes.h"
-
-#include "AliL3Defs.h"
 #include "AliL3Logging.h"
 #include "AliL3Track.h"
 #include "AliL3Transform.h"
 #include "AliL3Vertex.h"
-#include <math.h>
+
 
 //_____________________________________________________________
 // AliL3Track
@@ -50,7 +49,7 @@ AliL3Track::AliL3Track()
   fIsLocal=true;
   fRowRange[0]=0;
   fRowRange[1]=0;
-  memset(fHitNumbers,0,176*sizeof(UInt_t));
+  memset(fHitNumbers,0,159*sizeof(UInt_t));
 }
 
 void AliL3Track::Set(AliL3Track *tpt){
@@ -66,7 +65,9 @@ void AliL3Track::Set(AliL3Track *tpt){
   SetTgl(tpt->GetTgl());
   SetCharge(tpt->GetCharge());
   SetHits(tpt->GetNHits(),(UInt_t *)tpt->GetHitNumbers());
-
+#ifdef do_mc
+  SetMCid(tpt->GetMCid());
+#endif
 }
 
 Int_t AliL3Track::Compare(const AliL3Track *track) const
@@ -85,19 +86,20 @@ Double_t AliL3Track::GetP() const
 {
   // Returns total momentum.  
   return fabs(GetPt())*sqrt(1. + GetTgl()*GetTgl());
-
 }
 
 Double_t AliL3Track::GetPseudoRapidity() const
 {
   return 0.5 * log((GetP() + GetPz()) / (GetP() - GetPz()));
 }
+
 /*
 Double_t AliL3Track::GetEta() const
 {
   return GetPseudoRapidity();
 }
 */
+
 Double_t AliL3Track::GetRapidity() const
 {
   Double_t m_pi = 0.13957;
@@ -152,10 +154,10 @@ void AliL3Track::Rotate(Int_t slice,Bool_t tolocal)
 }
 
 void AliL3Track::CalculateHelix(){
-  //Calculate Radius, CenterX and Centery from Psi, X0, Y0
+  //Calculate Radius, CenterX and CenterY from Psi, X0, Y0
   //
   
-  fRadius = fPt / (BFACT*BField);
+  fRadius = fPt / (BFACT*AliL3Transform::GetBField());
   if(fRadius) fKappa = -fQ*1./fRadius;
   else fRadius = 999999;  //just zero
   Double_t trackPhi0 = fPsi + fQ *0.5 * pi;
@@ -180,16 +182,20 @@ Double_t AliL3Track::GetCrossingAngle(Int_t padrow)
   
   //Take the dot product of the tangent vector of the track, and
   //vector perpendicular to the padrow.
+  //In order to do this, we need the tangent vector to the track at the
+  //point. This is done by rotating the radius vector by 90 degrees;
+  //rotation matrix: (  0  1 )
+  //                 ( -1  0 )
   
   Double_t tangent[2];
-  tangent[1] = (xyz[0] - GetCenterX())/GetRadius();
   tangent[0] = -1.*(xyz[1] - GetCenterY())/GetRadius();
-
+  tangent[1] = (xyz[0] - GetCenterX())/GetRadius();
+  
   Double_t perp_padrow[2] = {1,0}; //locally in slice
-
+  
   Double_t cos_beta = fabs(tangent[0]*perp_padrow[0] + tangent[1]*perp_padrow[1]);
+  if(cos_beta > 1) cos_beta=1;
   return acos(cos_beta);
-  
 }
 
 Bool_t AliL3Track::GetCrossingPoint(Int_t padrow,Float_t *xyz) 
@@ -218,12 +224,12 @@ Bool_t AliL3Track::GetCrossingPoint(Int_t padrow,Float_t *xyz)
   
   Double_t yHit = xyz[1];
   Double_t angle1 = atan2((yHit - GetCenterY()),(xHit - GetCenterX()));
-  if(angle1 < 0) angle1 += 2.*Pi;
+  if(angle1 < 0) angle1 += 2.*AliL3Transform::Pi();
   Double_t angle2 = atan2((GetFirstPointY() - GetCenterY()),(GetFirstPointX() - GetCenterX()));
-  if(angle2 < 0) angle2 += 2.*Pi;
+  if(angle2 < 0) angle2 += 2.*AliL3Transform::Pi();
   Double_t diff_angle = angle1 - angle2;
-  diff_angle = fmod(diff_angle,2*Pi);
-  if((GetCharge()*diff_angle) > 0) diff_angle = diff_angle - GetCharge()*2.*Pi;
+  diff_angle = fmod(diff_angle,2*AliL3Transform::Pi());
+  if((GetCharge()*diff_angle) > 0) diff_angle = diff_angle - GetCharge()*2.*AliL3Transform::Pi();
   Double_t s_tot = fabs(diff_angle)*GetRadius();
   Double_t zHit = GetFirstPointZ() + s_tot*GetTgl();
   xyz[2] = zHit;
@@ -233,11 +239,11 @@ Bool_t AliL3Track::GetCrossingPoint(Int_t padrow,Float_t *xyz)
 
 
 Bool_t AliL3Track::CalculateReferencePoint(Double_t angle,Double_t radius){
-  // Global coordinate: crossing point with y = ax+ b; a=tan(angle-Pi/2);
+  // Global coordinate: crossing point with y = ax+ b; a=tan(angle-AliL3Transform::Pi()/2);
   //
-  const Double_t rr=radius;//132; //position of referece plane
-  const Double_t xr = cos(angle) *rr;
-  const Double_t yr = sin(angle) *rr;
+  const Double_t rr=radius;//132; //position of reference plane
+  const Double_t xr = cos(angle) * rr;
+  const Double_t yr = sin(angle) * rr;
   
   Double_t a = tan(angle-pi/2);
   Double_t b = yr - a * xr;
@@ -285,8 +291,8 @@ Bool_t AliL3Track::CalculateReferencePoint(Double_t angle,Double_t radius){
 Bool_t AliL3Track::CalculateEdgePoint(Double_t angle){
   // Global coordinate: crossing point with y = ax; a=tan(angle);
   //
-  Double_t rmin=80;  //min Radius of TPC
-  Double_t rmax=260; //max Radius of TPC
+  Double_t rmin=AliL3Transform::Row2X(AliL3Transform::GetFirstRow(-1));  //min Radius of TPC
+  Double_t rmax=AliL3Transform::Row2X(AliL3Transform::GetLastRow(-1)); //max Radius of TPC
 
   Double_t a = tan(angle);
   Double_t pp=(fCenterX+a*fCenterY)/(1+pow(a,2));
@@ -409,15 +415,15 @@ void AliL3Track::GetClosestPoint(AliL3Vertex *vertex,Double_t &closest_x,Double_
   
   //Get the z coordinate:
   Double_t angle1 = atan2((closest_y-GetCenterY()),(closest_x-GetCenterX()));
-  if(angle1 < 0) angle1 = angle1 + 2*Pi;
+  if(angle1 < 0) angle1 = angle1 + 2*AliL3Transform::Pi();
  
   Double_t angle2 = atan2((GetFirstPointY()-GetCenterY()),(GetFirstPointX()-GetCenterX()));
-  if(angle2 < 0) angle2 = angle2 + 2*Pi;
+  if(angle2 < 0) angle2 = angle2 + 2*AliL3Transform::Pi();
   
   Double_t diff_angle = angle1 - angle2;
-  diff_angle = fmod(diff_angle,2*Pi);
+  diff_angle = fmod(diff_angle,2*AliL3Transform::Pi());
   
-  if((GetCharge()*diff_angle) < 0) diff_angle = diff_angle + GetCharge()*2*Pi;
+  if((GetCharge()*diff_angle) < 0) diff_angle = diff_angle + GetCharge()*2*AliL3Transform::Pi();
   Double_t s_tot = fabs(diff_angle)*GetRadius();
   
   closest_z = GetFirstPointZ() - s_tot*GetTgl();