// Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch //
///////////////////////////////////////////////////////////////////////////////
#include <TMatrixDSym.h>
+#include <TPolyMarker3D.h>
+#include <TVector3.h>
+
#include "AliExternalTrackParam.h"
#include "AliVVertex.h"
-#include "TPolyMarker3D.h"
-#include "TVector3.h"
#include "AliLog.h"
ClassImp(AliExternalTrackParam)
fAlpha(0.)
{
//
- // constructor from virtual track
+ // Constructor from virtual track,
+ // This is not a copy contructor !
//
+
+ if (vTrack->InheritsFrom("AliExternalTrackParam")) {
+ AliError("This is not a copy constructor. Use AliExternalTrackParam(const AliExternalTrackParam &) !");
+ AliWarning("Calling the default constructor...");
+ AliExternalTrackParam();
+ return;
+ }
+
Double_t xyz[3],pxpypz[3],cv[21];
vTrack->GetXYZ(xyz);
pxpypz[0]=vTrack->Px();
// x,y,z,px,py,pz and their 6x6 covariance matrix
// A.Dainese 10.10.08
- // Calculate alpha: the rotation angle of the corresponding local system
- fAlpha = TMath::ATan2(pxpypz[1],pxpypz[0]);
+ // Calculate alpha: the rotation angle of the corresponding local system.
+ //
+ // For global radial position inside the beam pipe, alpha is the
+ // azimuthal angle of the momentum projected on (x,y).
+ //
+ // For global radial position outside the beam pipe, alpha is the
+ // azimuthal angle of the centre of the TPC sector in which the point
+ // xyz lies
+ //
+ Double_t radPos2 = xyz[0]*xyz[0]+xyz[1]*xyz[1];
+ if (radPos2 < 3.*3.) { // inside beam pipe
+ fAlpha = TMath::ATan2(pxpypz[1],pxpypz[0]);
+ } else { // outside beam pipe
+ Float_t phiPos = TMath::Pi()+TMath::ATan2(-xyz[1], -xyz[0]);
+ fAlpha =
+ TMath::DegToRad()*(20*((((Int_t)(phiPos*TMath::RadToDeg()))/20))+10);
+ }
// Get the vertex of origin and the momentum
TVector3 ver(xyz[0],xyz[1],xyz[2]);
return;
}
-//_____________________________________________________________________________
-void AliExternalTrackParam::Set(Double_t x, Double_t alpha,
- const Double_t p[5], const Double_t cov[15]) {
- //
- // Sets the parameters
- //
- fX=x;
- fAlpha=alpha;
- for (Int_t i = 0; i < 5; i++) fP[i] = p[i];
- for (Int_t i = 0; i < 15; i++) fC[i] = cov[i];
-}
-
//_____________________________________________________________________________
void AliExternalTrackParam::Reset() {
//
Double_t p2=p*p;
Double_t beta2=p2/(p2 + mass*mass);
- //Multiple scattering******************
+ //Calculating the multiple scattering corrections******************
+ Double_t cC22 = 0.;
+ Double_t cC33 = 0.;
+ Double_t cC43 = 0.;
+ Double_t cC44 = 0.;
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);
- fC43 += theta2*fP3*fP4*(1. + fP3*fP3);
- fC44 += theta2*fP3*fP4*fP3*fP4;
+ if(theta2>TMath::Pi()*TMath::Pi()) return kFALSE;
+ cC22 = theta2*(1.- fP2*fP2)*(1. + fP3*fP3);
+ cC33 = theta2*(1. + fP3*fP3)*(1. + fP3*fP3);
+ cC43 = theta2*fP3*fP4*(1. + fP3*fP3);
+ cC44 = theta2*fP3*fP4*fP3*fP4;
}
- //Energy losses************************
+ //Calculating the energy loss corrections************************
+ Double_t cP4=1.;
if ((xTimesRho != 0.) && (beta2 < 1.)) {
- Double_t dE=Bethe(beta2)*xTimesRho;
+ Double_t dE=Bethe(p/mass)*xTimesRho;
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
+ cP4 = (1.- e/p2*dE);
+ if (TMath::Abs(fP4*cP4)>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.
Double_t sigmadE=knst*TMath::Sqrt(TMath::Abs(dE));
- fC44+=((sigmadE*e/p2*fP4)*(sigmadE*e/p2*fP4));
+ cC44 += ((sigmadE*e/p2*fP4)*(sigmadE*e/p2*fP4));
}
+ //Applying the corrections*****************************
+ fC22 += cC22;
+ fC33 += cC33;
+ fC43 += cC43;
+ fC44 += cC44;
+ fP4 *= cP4;
+
return kTRUE;
}
d*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2));
//Multiple scattering******************
+ Double_t cC22 = 0.;
+ Double_t cC33 = 0.;
+ Double_t cC43 = 0.;
+ Double_t cC44 = 0.;
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);
- fC43 += theta2*fP3*fP4*(1. + fP3*fP3);
- fC44 += theta2*fP3*fP4*fP3*fP4;
+ if(theta2>TMath::Pi()*TMath::Pi()) return kFALSE;
+ cC22 = theta2*(1.- fP2*fP2)*(1. + fP3*fP3);
+ cC33 = theta2*(1. + fP3*fP3)*(1. + fP3*fP3);
+ cC43 = theta2*fP3*fP4*(1. + fP3*fP3);
+ cC44 = theta2*fP3*fP4*fP3*fP4;
}
//Energy losses************************
+ Double_t cP4=1.;
if (x0!=0. && beta2<1) {
d*=x0;
- Double_t dE=Bethe(beta2)*d;
+ Double_t dE=Bethe(p/mass)*d;
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);
+ cP4 = (1.- e/p2*dE);
// Approximate energy loss fluctuation (M.Ivanov)
const Double_t knst=0.07; // To be tuned.
Double_t sigmadE=knst*TMath::Sqrt(TMath::Abs(dE));
- fC44+=((sigmadE*e/p2*fP4)*(sigmadE*e/p2*fP4));
+ cC44 += ((sigmadE*e/p2*fP4)*(sigmadE*e/p2*fP4));
}
+ fC22 += cC22;
+ fC33 += cC33;
+ fC43 += cC43;
+ fC44 += cC44;
+ fP4 *= cP4;
+
return kTRUE;
}
-Double_t ApproximateBetheBloch(Double_t beta2) {
+Double_t AliExternalTrackParam::BetheBlochAleph(Double_t bg,
+ Double_t kp1,
+ Double_t kp2,
+ Double_t kp3,
+ Double_t kp4,
+ Double_t kp5) {
+ //
+ // This is the empirical ALEPH parameterization of the Bethe-Bloch formula.
+ // It is normalized to 1 at the minimum.
+ //
+ // bg - beta*gamma
+ //
+ // The default values for the kp* parameters are for ALICE TPC.
+ // The returned value is in MIP units
+ //
+
+ Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
+
+ Double_t aa = TMath::Power(beta,kp4);
+ Double_t bb = TMath::Power(1./bg,kp5);
+
+ bb=TMath::Log(kp3+bb);
+
+ return (kp2-aa-bb)*kp1/aa;
+}
+
+Double_t AliExternalTrackParam::BetheBlochGeant(Double_t bg,
+ Double_t kp0,
+ Double_t kp1,
+ Double_t kp2,
+ Double_t kp3,
+ Double_t kp4) {
+ //
+ // This is the parameterization of the Bethe-Bloch formula inspired by Geant.
+ //
+ // bg - beta*gamma
+ // kp0 - density [g/cm^3]
+ // kp1 - density effect first junction point
+ // kp2 - density effect second junction point
+ // kp3 - mean excitation energy [GeV]
+ // kp4 - mean Z/A
+ //
+ // The default values for the kp* parameters are for silicon.
+ // The returned value is in [GeV/(g/cm^2)].
+ //
+
+ const Double_t mK = 0.307075e-3; // [GeV*cm^2/g]
+ const Double_t me = 0.511e-3; // [GeV/c^2]
+ const Double_t rho = kp0;
+ const Double_t x0 = kp1*2.303;
+ const Double_t x1 = kp2*2.303;
+ const Double_t mI = kp3;
+ const Double_t mZA = kp4;
+ const Double_t bg2 = bg*bg;
+ const Double_t maxT= 2*me*bg2; // neglecting the electron mass
+
+ //*** Density effect
+ Double_t d2=0.;
+ const Double_t x=TMath::Log(bg);
+ const Double_t lhwI=TMath::Log(28.816*1e-9*TMath::Sqrt(rho*mZA)/mI);
+ if (x > x1) {
+ d2 = lhwI + x - 0.5;
+ } else if (x > x0) {
+ const Double_t r=(x1-x)/(x1-x0);
+ d2 = lhwI + x - 0.5 + (0.5 - lhwI - x0)*r*r*r;
+ }
+
+ return mK*mZA*(1+bg2)/bg2*
+ (0.5*TMath::Log(2*me*bg2*maxT/(mI*mI)) - bg2/(1+bg2) - d2);
+}
+
+Double_t AliExternalTrackParam::BetheBlochSolid(Double_t bg) {
//------------------------------------------------------------------
- // This is an approximation of the Bethe-Bloch formula with
- // the density effect taken into account at beta*gamma > 3.5
- // (the approximation is reasonable only for solid materials)
+ // This is an approximation of the Bethe-Bloch formula,
+ // reasonable for solid materials.
+ // All the parameters are, in fact, for Si.
+ // The returned value is in [GeV]
//------------------------------------------------------------------
- if (beta2 >= 1) return kVeryBig;
- if (beta2/(1-beta2)>3.5*3.5)
- return 0.153e-3/beta2*(log(3.5*5940)+0.5*log(beta2/(1-beta2)) - beta2);
+ return BetheBlochGeant(bg);
+}
- return 0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2);
+Double_t AliExternalTrackParam::BetheBlochGas(Double_t bg) {
+ //------------------------------------------------------------------
+ // This is an approximation of the Bethe-Bloch formula,
+ // reasonable for gas materials.
+ // All the parameters are, in fact, for Ne.
+ // The returned value is in [GeV]
+ //------------------------------------------------------------------
+
+ const Double_t rho = 0.9e-3;
+ const Double_t x0 = 2.;
+ const Double_t x1 = 4.;
+ const Double_t mI = 140.e-9;
+ const Double_t mZA = 0.49555;
+
+ return BetheBlochGeant(bg,rho,x0,x1,mI,mZA);
}
Bool_t AliExternalTrackParam::Rotate(Double_t alpha) {
Double_t sf=fP2, cf=TMath::Sqrt(1.- fP2*fP2);
Double_t tmp=sf*ca - cf*sa;
- if (TMath::Abs(tmp) >= kAlmost1) return kFALSE;
+ if (TMath::Abs(tmp) >= kAlmost1) {
+ AliError(Form("Rotation failed ! %.10e",tmp));
+ return kFALSE;
+ }
fAlpha = alpha;
fX = x*ca + fP0*sa;
return kTRUE;
}
+Bool_t
+AliExternalTrackParam::Propagate(Double_t alpha, Double_t x, Double_t b) {
+ //------------------------------------------------------------------
+ // Transform this track to the local coord. system rotated
+ // by angle "alpha" (rad) with respect to the global coord. system,
+ // and propagate this track to the plane X=xk (cm) in the field "b" (kG)
+ //------------------------------------------------------------------
+
+ //Save the parameters
+ Double_t as=fAlpha;
+ Double_t xs=fX;
+ Double_t ps[5], cs[15];
+ for (Int_t i=0; i<5; i++) ps[i]=fP[i];
+ for (Int_t i=0; i<15; i++) cs[i]=fC[i];
+
+ if (Rotate(alpha))
+ if (PropagateTo(x,b)) return kTRUE;
+
+ //Restore the parameters, if the operation failed
+ fAlpha=as;
+ fX=xs;
+ for (Int_t i=0; i<5; i++) fP[i]=ps[i];
+ for (Int_t i=0; i<15; i++) fC[i]=cs[i];
+ return kFALSE;
+}
+
+
void AliExternalTrackParam::Propagate(Double_t len, Double_t x[3],
Double_t p[3], Double_t bz) const {
//+++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++
GetXYZ(x);
- if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
+ if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field || GetC(bz) < kAlmost0){ //straight-line tracks
Double_t unit[3]; GetDirection(unit);
x[0]+=unit[0]*len;
x[1]+=unit[1]*len;
Double_t phase=h[4]*t+h[2];
Double_t sn=TMath::Sin(phase), cs=TMath::Cos(phase);
- r[0] = h[5] + (sn - h[6])/h[4];
- r[1] = h[0] - (cs - h[7])/h[4];
+ r[0] = h[5];
+ r[1] = h[0];
+ if (TMath::Abs(h[4])>kAlmost0) {
+ r[0] += (sn - h[6])/h[4];
+ r[1] -= (cs - h[7])/h[4];
+ }
r[2] = h[1] + h[3]*t;
g[0] = cs; g[1]=sn; g[2]=h[3];
if (d > maxd) return kFALSE;
//Propagate to the DCA
- Double_t crv=kB2C*b*GetParameter()[4];
+ Double_t crv=GetC(b);
if (TMath::Abs(b) < kAlmost0Field) crv=0.;
Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
- Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+ Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
y = fP[0] + dx*(f1+f2)/(r1+r2);
return kTRUE;
}
Double_t dx=x-fX;
if(TMath::Abs(dx)<=kAlmost0) {z=fP[1]; return kTRUE;}
- Double_t f1=fP[2], f2=f1 + dx*fP[4]*b*kB2C;
+ Double_t f1=fP[2], f2=f1 + dx*GetC(b);
if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
- Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
+ Double_t r1=sqrt((1.-f1)*(1.+f1)), r2=sqrt((1.-f2)*(1.+f2));
z = fP[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*fP[3]; // Many thanks to P.Hristov !
return kTRUE;
}
if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
- Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+ Double_t r1=TMath::Sqrt((1.-f1)*(1.+f1)), r2=TMath::Sqrt((1.-f2)*(1.+f2));
r[0] = x;
r[1] = fP[0] + dx*(f1+f2)/(r1+r2);
- r[2] = fP[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fP[3];
+ r[2] = fP[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*fP[3];//Thanks to Andrea & Peter
+
return Local2GlobalPosition(r,fAlpha);
}
counter++;
}
}
+
+Int_t AliExternalTrackParam::GetIndex(Int_t i, Int_t j) const {
+ //
+ Int_t min = TMath::Min(i,j);
+ Int_t max = TMath::Max(i,j);
+
+ return min+(max+1)*max/2;
+}