]> 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 22ccd5593531f2402532144b467d96965921c785..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())) { 
@@ -119,7 +119,7 @@ Int_t AliHMPIDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
 }
  
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
+Bool_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
 {
   //
   // Propagate track to the radial position
@@ -139,9 +139,9 @@ Int_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);      
-    GetProlongation(x,y,z);
+    if (!GetProlongation(x,y,z)) return kFALSE;
     xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha); 
     xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
     xyz1[2] = z;
@@ -156,9 +156,9 @@ Int_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);        
-  GetProlongation(r,y,z);
+  if (!GetProlongation(r,y,z)) return kFALSE;
   xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha); 
   xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
   xyz1[2] = z;
@@ -168,10 +168,8 @@ Int_t   AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
   if (param[1] <= 0) {
     param[1] = 100000000;
   }
-  PropagateTo(r,param[1],param[0]*param[4]);
-
-  return 0;
-
+  return PropagateTo(r,param[1],param[0]*param[4]);
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Double_t AliHMPIDtrack::GetPredictedChi2(const AliCluster3D *c) const {
@@ -192,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. 
@@ -224,15 +212,14 @@ Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz)
   // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
   //+++++++++++++++++++++++++++++++++++++++++    
   Double_t x0[3]; GetXYZ(x0); //get track position in MARS
-  //Printf("xxx Intersect OLD: bz: %lf xxx",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;}
@@ -245,53 +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.
-  
-  //Printf(":::::: 111 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
-  
-  Double_t bz=-1.0*GetBz();  
-  Double_t x0[3]; pTrk->GetXYZ(x0); //get track position in MARS
-  //Printf(":::::: 222 :::::: x0: %lf x1: %lf x2: %lf",x0[0],x0[1],x0[2]);
-
-  Double_t rad;
-  //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]; 
-  while(TMath::Abs(dist)>0.00001){
-    //calculates helix at the distance s from x0 ALONG the helix
-    Propagate(s,x,p,bz);
-    
-    //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;}
-    distPrev=dist;
-    s-=dist;
-  }
-   // Printf(":::::: 333 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
-  //on exit pnt is intersection point,norm is track vector at that point, 
-  //all in MARS
-  rad=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); 
-  PropagateTo(rad);       //propagate with the average dens. rad. lenght
-  GetXYZAt(rad,bz,x); 
-  GetPxPyPz(p);                                                       //propagate to the radial distance of the PC or the Radiator    
-  for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
- // Printf(":::::: 444 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
- /*
-   pEsdTrk->SetHMPIDpx(p[0]);
-  pEsdTrk->SetHMPIDpy(p[1]);
-  pEsdTrk->SetHMPIDpz(p[2]);
-  */
-  
-  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
@@ -301,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;   
@@ -324,3 +268,24 @@ void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_
   }
 }//Propagate()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDtrack::Update(const AliHMPIDCluster *pClu, Double_t /*chisq*/, Int_t /*index*/)
+{
+  //
+  // Arguments: AliCluster3D, chi sq, and clu index
+  // Returns: kTRUE if the track parameters are successfully updated
+  Double_t p[2]={pClu->GetY(), pClu->GetZ()};
+  Double_t cov[3]={pClu->GetSigmaY2(), 0., pClu->GetSigmaZ2()};
+  if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
+
+  /*
+  AliTracker::FillResiduals(this,p,cov,pClu->GetVolumeId());
+
+  Int_t n=GetNumberOfClusters();
+  fIndex[n]=index;
+  SetNumberOfClusters(n+1);
+  SetChi2(GetChi2()+chisq);
+*/
+  return kTRUE;
+
+}//Update()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++