]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDtrack.cxx
Adding more bins in QA (Alis)
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDtrack.cxx
index a5256e919e56525b375610d68d20a4665e1bdc34..451a83c99ac883abcd1d08934569a81fe7545a7e 100644 (file)
@@ -71,8 +71,8 @@ Bool_t AliHMPIDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
   if (xk == GetX()) {
     return kTRUE;
   }
-  Double_t bz   = GetBz();
-  if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
+  Double_t b[3]; GetBxByBz(b);
+  if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) {
     return kFALSE;
   }
   if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) { 
@@ -139,7 +139,7 @@ Bool_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
 
     GetXYZ(xyz0);      
     Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
-    Rotate(alpha,kTRUE);
+    if(!Rotate(alpha,kTRUE)) return kFALSE;
     GetXYZ(xyz0);      
     if (!GetProlongation(x,y,z)) return kFALSE;
     xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha); 
@@ -156,7 +156,7 @@ Bool_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
 
   GetXYZ(xyz0);        
   Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
-  Rotate(alpha,kTRUE);
+  if(!Rotate(alpha,kTRUE)) return kFALSE;
   GetXYZ(xyz0);        
   if (!GetProlongation(r,y,z)) return kFALSE;
   xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha); 
@@ -190,29 +190,19 @@ Bool_t AliHMPIDtrack::PropagateTo(const AliCluster3D *c) {
   Double_t      p[3]={c->GetX(), c->GetY(), c->GetZ()};
   Double_t  covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
   Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
-  Double_t bz=GetBz();
-  
+  Double_t bz=-GetBz();
+    
   if(!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE;
   if(IsStartedTimeIntegral()) 
     {
       Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ));
       if (GetX()<oldX) d=-d;
       AddTimeStep(d);
-  }
+    }
   return kTRUE;
 }//PropagateTo()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Double_t AliHMPIDtrack::GetBz() const {
-  // 
-  // Arguments: none
-  // Returns: Bz component of the magnetic field (kG)
-  //
-  if (AliTracker::UniformField()) return AliTracker::GetBz();
-  Double_t r[3]; GetXYZ(r);
-  return AliTracker::GetBz(r);
-}//GetBz()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const {
+Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3]) const {
   //+++++++++++++++++++++++++++++++++++++++++    
   // Origin: K. Shileev (Kirill.Shileev@cern.ch)
   // Finds point of intersection (if exists) of the helix with the plane. 
@@ -226,10 +216,10 @@ Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz)
   //estimates initial helix length up to plane
   Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
   Double_t dist=99999,distPrev=dist;
-  Double_t x[3],p[3]; 
+  Double_t p[3],x[3]; 
   while(TMath::Abs(dist)>0.00001){
     //calculates helix at the distance s from x0 ALONG the helix
-    Propagate(s,x,p,bz);
+    Propagate(s,x,p);
     //distance between current helix position and plane
     dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];  
     if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
@@ -242,35 +232,7 @@ Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz)
   return kTRUE;
 }//Intersect()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDtrack::Intersect(AliHMPIDtrack *pTrk,Double_t pnt[3], Double_t norm[3]) {
-  // Finds point of intersection (if exists) of the helix with the plane. 
-  // Stores result in fX and fP.   
-  // Arguments: planePoint,planeNorm - the plane defined by any plane's point 
-  // and vector, normal to the plane
-  // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
-  Double_t x0[3]; pTrk->GetXYZ(x0); //get track position in MARS
-  Double_t dist=99999,distPrev=dist;
-  Double_t x[3],p[3],
-  pntrad= TMath::Sqrt(pnt[0]*pnt[0]+pnt[1]*pnt[1]);
-  while(TMath::Abs(dist)> 0.000001){//0.00001){
-    //calculates helix at the distance s from x0 ALONG the helix
-    pTrk->PropagateTo(pntrad);pTrk->GetXYZ(x);pTrk->GetPxPyPz(p); 
-    //distance between current helix position and plane
-    dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
-    pntrad=pntrad-dist*0.7;
-    //Printf("--- 111 --- dist %lf",dist);
-    if(TMath::Abs(2.0*dist) >= TMath::Abs(distPrev)) {return kFALSE;}
-    distPrev=dist;
-  }
-  //on exit pnt is intersection point,norm is track vector at that point, 
-  //Printf("--- 222 --- dist %lf",dist);
-  Printf("");
-  for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
-  return kTRUE;
-}//Intersect()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_t bz) const {
+void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3]) const {
   //+++++++++++++++++++++++++++++++++++++++++    
   // Origin: K. Shileev (Kirill.Shileev@cern.ch)
   // Extrapolate track along simple helix in magnetic field
@@ -280,6 +242,9 @@ void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_
   // The momentum returned for straight-line tracks is meaningless !
   //+++++++++++++++++++++++++++++++++++++++++    
   GetXYZ(x);    
+  Double_t bField[3];
+  TGeoGlobalMagField::Instance()->Field(x,bField);
+  Double_t bz = -bField[2];
   if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
      Double_t unit[3]; GetDirection(unit);
      x[0]+=unit[0]*len;