]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDtrack.cxx
Added methods for finding a given module in the DDL map (F. Prino)
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.cxx
index b048d0dc4ec305b172365f2895dc40a5bd70dac6..6b7cfc65b3353ff260056fcd7ece6cab6f04a8fd 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliKalmanTrack.h"
 #include "AliLog.h"
 #include "AliTrackPointArray.h"
+#include "TPolyMarker3D.h"
 
 ClassImp(AliESDtrack)
 
@@ -688,11 +689,10 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
     break;
 
   case kTRDout: case kTRDin: case kTRDrefit:
-    index=fFriendTrack->GetTRDindices();
+    index     = fFriendTrack->GetTRDindices();
     fTRDLabel = t->GetLabel(); 
-    fTRDchi2=t->GetChi2();
-    fTRDncls=6;//t->GetNumberOfTracklets(); //t->GetNumberOfClusters();
-    //for (Int_t i=0;i<fTRDncls;i++) index[i]=t->GetClusterIndex(i);
+    fTRDchi2  = t->GetChi2();
+    fTRDncls  = t->GetNumberOfClusters();
     for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
     
     fTRDsignal=t->GetPIDsignal();
@@ -1134,58 +1134,28 @@ Bool_t AliESDtrack::RelateToVertex
 
   if (!vtx) return kFALSE;
 
-  Double_t alpha=GetAlpha();
-  Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
-  Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
-  Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
-  Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
-  x-=xv; y-=yv;
+  Double_t dz[2],cov[3];
+  if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
 
-  //Estimate the impact parameter neglecting the track curvature
-  Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
-  if (d > maxd) return kFALSE; 
-
-  //Propagate to the DCA
-  Double_t crv=kB2C*b*GetParameter()[4];
-  if (TMath::Abs(b) < kAlmost0Field) crv=0.;
-
-  Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
-  sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv);
-  if (TMath::Abs(tgfv)>0.) cs = sn/tgfv;
-  else cs=1.;
-
-  x = xv*cs + yv*sn;
-  yv=-xv*sn + yv*cs; xv=x;
-
-  if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
-
-  fD = GetParameter()[0] - yv;
-  fZ = GetParameter()[1] - zv;
+  fD = dz[0];
+  fZ = dz[1];  
+  fCdd = cov[0];
+  fCdz = cov[1];
+  fCzz = cov[2];
   
-  Double_t cov[6]; vtx->GetCovMatrix(cov);
-
-  //***** Improvements by A.Dainese
-  alpha=GetAlpha(); sn=TMath::Sin(alpha); cs=TMath::Cos(alpha);
-  Double_t s2ylocvtx = cov[0]*sn*sn + cov[2]*cs*cs - 2.*cov[1]*cs*sn;
-  fCdd = GetCovariance()[0] + s2ylocvtx;   // neglecting correlations
-  fCdz = GetCovariance()[1];               // between (x,y) and z
-  fCzz = GetCovariance()[2] + cov[5];      // in vertex's covariance matrix
-  //*****
+  Double_t covar[6]; vtx->GetCovMatrix(covar);
+  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
+  Double_t c[3]={covar[2],0.,covar[5]};
 
-  {//Try to constrain 
-    Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]};
-    Double_t chi2=GetPredictedChi2(p,c);
+  Double_t chi2=GetPredictedChi2(p,c);
+  if (chi2>77.) return kFALSE;
 
-    if (chi2>77.) return kFALSE;
-
-    AliExternalTrackParam tmp(*this);
-    if (!tmp.Update(p,c)) return kFALSE;
-
-    fCchi2=chi2;
-    if (!fCp) fCp=new AliExternalTrackParam();
-    new (fCp) AliExternalTrackParam(tmp);
-  }
+  delete fCp;
+  fCp=new AliExternalTrackParam(*this);  
 
+  if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
+  
+  fCchi2=chi2;
   return kTRUE;
 }
 
@@ -1233,3 +1203,59 @@ void AliESDtrack::Print(Option_t *) const {
   }
 } 
 
+
+//
+// Draw functionality
+// Origin: Marian Ivanov, Marian.Ivanov@cern.ch
+//
+void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
+  //
+  // Fill points in the polymarker
+  //
+  TObjArray arrayRef;
+  arrayRef.AddLast(new AliExternalTrackParam(*this));
+  if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
+  if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
+  //
+  Double_t mpos[3]={0,0,0};
+  Int_t entries=arrayRef.GetEntries();
+  for (Int_t i=0;i<entries;i++){
+    Double_t pos[3];
+    ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
+    mpos[0]+=pos[0]/entries;
+    mpos[1]+=pos[1]/entries;
+    mpos[2]+=pos[2]/entries;    
+  }
+  // Rotate to the mean position
+  //
+  Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
+  for (Int_t i=0;i<entries;i++){
+    Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
+    if (!res) delete arrayRef.RemoveAt(i);
+  }
+  Int_t counter=0;
+  for (Double_t r=minR; r<maxR; r+=stepR){
+    Double_t sweight=0;
+    Double_t mlpos[3]={0,0,0};
+    for (Int_t i=0;i<entries;i++){
+      Double_t point[3]={0,0,0};
+      AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
+      if (!param) continue;
+      if (param->GetXYZAt(r,magF,point)){
+       Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
+       sweight+=weight;
+       mlpos[0]+=point[0]*weight;
+       mlpos[1]+=point[1]*weight;
+       mlpos[2]+=point[2]*weight;
+      }
+    }
+    if (sweight>0){
+      mlpos[0]/=sweight;
+      mlpos[1]/=sweight;
+      mlpos[2]/=sweight;      
+      pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
+      printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
+      counter++;
+    }
+  }
+}