#include <TMatrixDSym.h>
#include "AliExternalTrackParam.h"
#include "AliESDVertex.h"
+#include "TPolyMarker3D.h"
#include "AliLog.h"
ClassImp(AliExternalTrackParam)
for (Int_t i = 0; i < 15; i++) fC[i] = 0;
}
+//_____________________________________________________________________________
+void AliExternalTrackParam::AddCovariance(const Double_t c[15]) {
+ //
+ // Add "something" to the track covarince matrix.
+ // May be needed to account for unknown mis-calibration/mis-alignment
+ //
+ fC[0] +=c[0];
+ fC[1] +=c[1]; fC[2] +=c[2];
+ fC[3] +=c[3]; fC[4] +=c[4]; fC[5] +=c[5];
+ fC[6] +=c[6]; fC[7] +=c[7]; fC[8] +=c[8]; fC[9] +=c[9];
+ fC[10]+=c[10]; fC[11]+=c[11]; fC[12]+=c[12]; fC[13]+=c[13]; fC[14]+=c[14];
+}
+
+
Double_t AliExternalTrackParam::GetP() const {
//---------------------------------------------------------------------
// This function returns the track momentum
//Multiple scattering******************
if (xOverX0 != 0) {
Double_t theta2=14.1*14.1/(beta2*p2*1e6)*TMath::Abs(xOverX0);
+ if(theta2>TMath::Pi()*TMath::Pi()) return kFALSE;
//Double_t theta2=1.0259e-6*14*14/28/(beta2*p2)*TMath::Abs(d)*9.36*2.33;
fC22 += theta2*(1.- fP2*fP2)*(1. + fP3*fP3);
fC33 += theta2*(1. + fP3*fP3)*(1. + fP3*fP3);
Double_t e=TMath::Sqrt(p2 + mass*mass);
if ( TMath::Abs(dE) > 0.3*e ) return kFALSE; //30% energy loss is too much!
fP4*=(1.- e/p2*dE);
+ if (TMath::Abs(fP4)>100.) return kFALSE; // Do not track below 10 MeV/c
+
// Approximate energy loss fluctuation (M.Ivanov)
const Double_t knst=0.07; // To be tuned.
//Multiple scattering******************
if (d!=0) {
Double_t theta2=14.1*14.1/(beta2*p2*1e6)*TMath::Abs(d);
+ if(theta2>TMath::Pi()*TMath::Pi()) return kFALSE;
//Double_t theta2=1.0259e-6*14*14/28/(beta2*p2)*TMath::Abs(d)*9.36*2.33;
fC22 += theta2*(1.- fP2*fP2)*(1. + fP3*fP3);
fC33 += theta2*(1. + fP3*fP3)*(1. + fP3*fP3);
if (TMath::Abs(dt1)/(TMath::Abs(t1)+1.e-3) < 1.e-4)
if (TMath::Abs(dt2)/(TMath::Abs(t2)+1.e-3) < 1.e-4) {
if ((gt1*gt1+gt2*gt2) > 1.e-4/dy2/dy2)
- AliWarning(" stopped at not a stationary point !");
+ AliDebug(1," stopped at not a stationary point !");
Double_t lmb=h11+h22; lmb=lmb-TMath::Sqrt(lmb*lmb-4*det);
if (lmb < 0.)
- AliWarning(" stopped at not a minimum !");
+ AliDebug(1," stopped at not a minimum !");
break;
}
if (dd<dm) break;
dt1*=0.5; dt2*=0.5;
if (div>512) {
- AliWarning(" overshoot !"); break;
+ AliDebug(1," overshoot !"); break;
}
}
dm=dd;
}
- if (max<=0) AliWarning(" too many iterations !");
+ if (max<=0) AliDebug(1," too many iterations !");
Double_t cs=TMath::Cos(GetAlpha());
Double_t sn=TMath::Sin(GetAlpha());
}
-
-
-Bool_t AliExternalTrackParam::PropagateToDCA(const AliESDVertex *vtx, Double_t b, Double_t maxd){
+Bool_t AliExternalTrackParam::PropagateToDCA(const AliESDVertex *vtx,
+Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]) {
//
- // Try to relate this track to the vertex "vtx",
+ // Propagate this track to the DCA to vertex "vtx",
// if the (rough) transverse impact parameter is not bigger then "maxd".
// Magnetic field is "b" (kG).
//
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;
+ Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
x-=xv; y-=yv;
//Estimate the impact parameter neglecting the track curvature
if (d > maxd) return kFALSE;
//Propagate to the DCA
- Double_t crv=0.299792458e-3*b*GetParameter()[4];
+ 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); cs=TMath::Sqrt(1.- sn*sn);
+ 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;
+
+ if (dz==0) return kTRUE;
+ dz[0] = GetParameter()[0] - yv;
+ dz[1] = GetParameter()[1] - zv;
+
+ if (covar==0) return kTRUE;
+ 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;
+ covar[0] = GetCovariance()[0] + s2ylocvtx; // neglecting correlations
+ covar[1] = GetCovariance()[1]; // between (x,y) and z
+ covar[2] = GetCovariance()[2] + cov[5]; // in vertex's covariance matrix
+ //*****
+
return kTRUE;
}
return kTRUE;
}
+
+
+//
+// Draw functionality.
+// Origin: Marian Ivanov, Marian.Ivanov@cern.ch
+//
+
+void AliExternalTrackParam::DrawTrack(Float_t magf, Float_t minR, Float_t maxR, Float_t stepR){
+ //
+ // Draw track line
+ //
+ if (minR>maxR) return ;
+ if (stepR<=0) return ;
+ Int_t npoints = TMath::Nint((maxR-minR)/stepR)+1;
+ if (npoints<1) return;
+ TPolyMarker3D *polymarker = new TPolyMarker3D(npoints);
+ FillPolymarker(polymarker, magf,minR,maxR,stepR);
+ polymarker->Draw();
+}
+
+//
+void AliExternalTrackParam::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
+ //
+ // Fill points in the polymarker
+ //
+ Int_t counter=0;
+ for (Double_t r=minR; r<maxR; r+=stepR){
+ Double_t point[3];
+ GetXYZAt(r,magF,point);
+ pol->SetPoint(counter,point[0],point[1], point[2]);
+ printf("xyz\t%f\t%f\t%f\n",point[0], point[1],point[2]);
+ counter++;
+ }
+}