LCOV - code coverage report
Current view: top level - STEER/ESD - AliKFParticle.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 24 249 9.6 %
Date: 2016-06-14 17:26:59 Functions: 6 28 21.4 %

          Line data    Source code
       1             : //----------------------------------------------------------------------------
       2             : // Implementation of the AliKFParticle class
       3             : // .
       4             : // @author  S.Gorbunov, I.Kisel
       5             : // @version 1.0
       6             : // @since   13.05.07
       7             : // 
       8             : // Class to reconstruct and store the decayed particle parameters.
       9             : // The method is described in CBM-SOFT note 2007-003, 
      10             : // ``Reconstruction of decayed particles based on the Kalman filter'', 
      11             : // http://www.gsi.de/documents/DOC-2007-May-14-1.pdf
      12             : //
      13             : // This class is ALICE interface to general mathematics in AliKFParticleCore
      14             : // 
      15             : //  -= Copyright &copy ALICE HLT Group =-
      16             : //____________________________________________________________________________
      17             : 
      18             : 
      19             : #include "AliKFParticle.h"
      20             : #include "TDatabasePDG.h"
      21             : #include "TParticlePDG.h"
      22             : #include "AliVTrack.h"
      23             : #include "AliVVertex.h"
      24             : 
      25             : #include "AliExternalTrackParam.h"
      26             : 
      27         172 : ClassImp(AliKFParticle)
      28             : 
      29             : Double_t AliKFParticle::fgBz = -5.;  //* Bz compoment of the magnetic field
      30             : 
      31          56 : AliKFParticle::AliKFParticle( const AliKFParticle &d1, const AliKFParticle &d2, Bool_t gamma )
      32         168 : {
      33          56 :   if (!gamma) {
      34          56 :     AliKFParticle mother;
      35          56 :     mother+= d1;
      36          56 :     mother+= d2;
      37          56 :     *this = mother;
      38          56 :   } else
      39           0 :     ConstructGamma(d1, d2);
      40         112 : }
      41             : 
      42             : void AliKFParticle::Create( const Double_t Param[], const Double_t Cov[], Int_t Charge, Int_t PID )
      43             : {
      44             :   // Constructor from "cartesian" track, PID hypothesis should be provided
      45             :   //
      46             :   // Param[6] = { X, Y, Z, Px, Py, Pz } - position and momentum
      47             :   // Cov [21] = lower-triangular part of the covariance matrix:
      48             :   //
      49             :   //                (  0  .  .  .  .  . )
      50             :   //                (  1  2  .  .  .  . )
      51             :   //  Cov. matrix = (  3  4  5  .  .  . ) - numbering of covariance elements in Cov[]
      52             :   //                (  6  7  8  9  .  . )
      53             :   //                ( 10 11 12 13 14  . )
      54             :   //                ( 15 16 17 18 19 20 )
      55         224 :   Double_t C[21];
      56        4928 :   for( int i=0; i<21; i++ ) C[i] = Cov[i];
      57             :   
      58         112 :   TParticlePDG* particlePDG = TDatabasePDG::Instance()->GetParticle(PID);
      59         336 :   Double_t mass = (particlePDG) ? particlePDG->Mass() :0.13957;
      60             :   
      61         112 :   AliKFParticleBase::Initialize( Param, C, Charge, mass );
      62         112 : }
      63             : 
      64             : void AliKFParticle::Create( const Double_t Param[], const Double_t Cov[], Int_t Charge, Double_t Mass )
      65             : {
      66             :   // Constructor from "cartesian" track, PID hypothesis should be provided
      67             :   //
      68             :   // Param[6] = { X, Y, Z, Px, Py, Pz } - position and momentum
      69             :   // Cov [21] = lower-triangular part of the covariance matrix:
      70             :   //
      71             :   //                (  0  .  .  .  .  . )
      72             :   //                (  1  2  .  .  .  . )
      73             :   //  Cov. matrix = (  3  4  5  .  .  . ) - numbering of covariance elements in Cov[]
      74             :   //                (  6  7  8  9  .  . )
      75             :   //                ( 10 11 12 13 14  . )
      76             :   //                ( 15 16 17 18 19 20 )
      77           0 :   Double_t C[21];
      78           0 :   for( int i=0; i<21; i++ ) C[i] = Cov[i];
      79             : 
      80           0 :   AliKFParticleBase::Initialize( Param, C, Charge, Mass );
      81           0 : }
      82             : 
      83         112 : AliKFParticle::AliKFParticle( const AliVTrack &track, Int_t PID )
      84         560 : {
      85             :   // Constructor from ALICE track, PID hypothesis should be provided
      86             : 
      87         112 :   track.GetXYZ(fP);
      88         112 :   track.PxPyPz(fP+3);
      89         224 :   fQ = track.Charge();
      90         112 :   track.GetCovarianceXYZPxPyPz( fC );
      91         112 :   Create(fP,fC,fQ,PID);
      92         224 : }
      93             : 
      94           0 : AliKFParticle::AliKFParticle( const AliExternalTrackParam &track, Double_t Mass, Int_t Charge )
      95           0 : {
      96             :   // Constructor from ALICE track, Mass and Charge hypothesis should be provided
      97             : 
      98           0 :   track.GetXYZ(fP);
      99           0 :   track.PxPyPz(fP+3);
     100           0 :   fQ = track.Charge()*TMath::Abs(Charge);
     101           0 :   fP[3] *= TMath::Abs(Charge);
     102           0 :   fP[4] *= TMath::Abs(Charge);
     103           0 :   fP[5] *= TMath::Abs(Charge);
     104             : 
     105           0 :   Double_t pt=1./TMath::Abs(track.GetParameter()[4]) * TMath::Abs(Charge);
     106           0 :   Double_t cs=TMath::Cos(track.GetAlpha()), sn=TMath::Sin(track.GetAlpha());
     107           0 :   Double_t r=TMath::Sqrt((1.-track.GetParameter()[2])*(1.+track.GetParameter()[2]));
     108             : 
     109           0 :   Double_t m00=-sn, m10=cs;
     110           0 :   Double_t m23=-pt*(sn + track.GetParameter()[2]*cs/r), m43=-pt*pt*(r*cs - track.GetParameter()[2]*sn);
     111           0 :   Double_t m24= pt*(cs - track.GetParameter()[2]*sn/r), m44=-pt*pt*(r*sn + track.GetParameter()[2]*cs);
     112           0 :   Double_t m35=pt, m45=-pt*pt*track.GetParameter()[3];
     113             : 
     114           0 :   m43*=track.GetSign();
     115           0 :   m44*=track.GetSign();
     116           0 :   m45*=track.GetSign();
     117             : 
     118           0 :   const Double_t *cTr = track.GetCovariance();
     119             : 
     120           0 :   fC[0 ] = cTr[0]*m00*m00;
     121           0 :   fC[1 ] = cTr[0]*m00*m10; 
     122           0 :   fC[2 ] = cTr[0]*m10*m10;
     123           0 :   fC[3 ] = cTr[1]*m00; 
     124           0 :   fC[4 ] = cTr[1]*m10; 
     125           0 :   fC[5 ] = cTr[2];
     126           0 :   fC[6 ] = m00*(cTr[3]*m23 + cTr[10]*m43); 
     127           0 :   fC[7 ] = m10*(cTr[3]*m23 + cTr[10]*m43); 
     128           0 :   fC[8 ] = cTr[4]*m23 + cTr[11]*m43; 
     129           0 :   fC[9 ] = m23*(cTr[5]*m23 + cTr[12]*m43)  +  m43*(cTr[12]*m23 + cTr[14]*m43);
     130           0 :   fC[10] = m00*(cTr[3]*m24 + cTr[10]*m44); 
     131           0 :   fC[11] = m10*(cTr[3]*m24 + cTr[10]*m44); 
     132           0 :   fC[12] = cTr[4]*m24 + cTr[11]*m44; 
     133           0 :   fC[13] = m23*(cTr[5]*m24 + cTr[12]*m44)  +  m43*(cTr[12]*m24 + cTr[14]*m44);
     134           0 :   fC[14] = m24*(cTr[5]*m24 + cTr[12]*m44)  +  m44*(cTr[12]*m24 + cTr[14]*m44);
     135           0 :   fC[15] = m00*(cTr[6]*m35 + cTr[10]*m45); 
     136           0 :   fC[16] = m10*(cTr[6]*m35 + cTr[10]*m45); 
     137           0 :   fC[17] = cTr[7]*m35 + cTr[11]*m45; 
     138           0 :   fC[18] = m23*(cTr[8]*m35 + cTr[12]*m45)  +  m43*(cTr[13]*m35 + cTr[14]*m45);
     139           0 :   fC[19] = m24*(cTr[8]*m35 + cTr[12]*m45)  +  m44*(cTr[13]*m35 + cTr[14]*m45); 
     140           0 :   fC[20] = m35*(cTr[9]*m35 + cTr[13]*m45)  +  m45*(cTr[13]*m35 + cTr[14]*m45);
     141             : 
     142           0 :   Create(fP,fC,fQ,Mass);
     143           0 : }
     144             : 
     145           0 : AliKFParticle::AliKFParticle( const AliVVertex &vertex )
     146           0 : {
     147             :   // Constructor from ALICE vertex
     148             : 
     149           0 :   vertex.GetXYZ( fP );
     150           0 :   vertex.GetCovarianceMatrix( fC );  
     151           0 :   fChi2 = vertex.GetChi2();
     152           0 :   fNDF = 2*vertex.GetNContributors() - 3;
     153           0 :   fQ = 0;
     154           0 :   fAtProductionVertex = 0;
     155           0 :   fIsLinearized = 0;
     156           0 :   fSFromDecay = 0;
     157           0 : }
     158             : 
     159             : void AliKFParticle::GetExternalTrackParam( const AliKFParticleBase &p, Double_t &X, Double_t &Alpha, Double_t P[5] ) 
     160             : {
     161             :   // Conversion to AliExternalTrackParam parameterization
     162             : 
     163           0 :   Double_t cosA = p.GetPx(), sinA = p.GetPy(); 
     164           0 :   Double_t pt = TMath::Sqrt(cosA*cosA + sinA*sinA);
     165             :   Double_t pti = 0;
     166           0 :   if( pt<1.e-4 ){
     167             :     cosA = 1;
     168             :     sinA = 0;
     169           0 :   } else {
     170           0 :     pti = 1./pt;
     171           0 :     cosA*=pti;
     172           0 :     sinA*=pti;
     173             :   }
     174           0 :   Alpha = TMath::ATan2(sinA,cosA);  
     175           0 :   X   = p.GetX()*cosA + p.GetY()*sinA;   
     176           0 :   P[0]= p.GetY()*cosA - p.GetX()*sinA;
     177           0 :   P[1]= p.GetZ();
     178           0 :   P[2]= 0;
     179           0 :   P[3]= p.GetPz()*pti;
     180           0 :   P[4]= p.GetQ()*pti;
     181           0 : }
     182             : 
     183             : Bool_t AliKFParticle::GetDistanceFromVertexXY( const Double_t vtx[], const Double_t Cv[], Double_t &val, Double_t &err ) const
     184             : {
     185             :   //* Calculate DCA distance from vertex (transverse impact parameter) in XY
     186             :   //* v = [xy], Cv=[Cxx,Cxy,Cyy ]-covariance matrix
     187             : 
     188             :   Bool_t ret = 0;
     189             :   
     190           0 :   Double_t mP[8];
     191           0 :   Double_t mC[36];
     192             :   
     193           0 :   Transport( GetDStoPoint(vtx), mP, mC );  
     194             : 
     195           0 :   Double_t dx = mP[0] - vtx[0];
     196           0 :   Double_t dy = mP[1] - vtx[1];
     197           0 :   Double_t px = mP[3];
     198           0 :   Double_t py = mP[4];
     199           0 :   Double_t pt = TMath::Sqrt(px*px + py*py);
     200             :   Double_t ex=0, ey=0;
     201           0 :   if( pt<1.e-4 ){
     202             :     ret = 1;
     203             :     pt = 1.;
     204           0 :     val = 1.e4;
     205           0 :   } else{
     206           0 :     ex = px/pt;
     207           0 :     ey = py/pt;
     208           0 :     val = dy*ex - dx*ey;
     209             :   }
     210             : 
     211           0 :   Double_t h0 = -ey;
     212             :   Double_t h1 = ex;
     213           0 :   Double_t h3 = (dy*ey + dx*ex)*ey/pt;
     214           0 :   Double_t h4 = -(dy*ey + dx*ex)*ex/pt;
     215             :   
     216           0 :   err = 
     217           0 :     h0*(h0*GetCovariance(0,0) + h1*GetCovariance(0,1) + h3*GetCovariance(0,3) + h4*GetCovariance(0,4) ) +
     218           0 :     h1*(h0*GetCovariance(1,0) + h1*GetCovariance(1,1) + h3*GetCovariance(1,3) + h4*GetCovariance(1,4) ) +
     219           0 :     h3*(h0*GetCovariance(3,0) + h1*GetCovariance(3,1) + h3*GetCovariance(3,3) + h4*GetCovariance(3,4) ) +
     220           0 :     h4*(h0*GetCovariance(4,0) + h1*GetCovariance(4,1) + h3*GetCovariance(4,3) + h4*GetCovariance(4,4) );
     221             : 
     222           0 :   if( Cv ){
     223           0 :     err+= h0*(h0*Cv[0] + h1*Cv[1] ) + h1*(h0*Cv[1] + h1*Cv[2] ); 
     224           0 :   }
     225             : 
     226           0 :   err = TMath::Sqrt(TMath::Abs(err));
     227             : 
     228           0 :   return ret;
     229           0 : }
     230             : 
     231             : Bool_t AliKFParticle::GetDistanceFromVertexXY( const Double_t vtx[], Double_t &val, Double_t &err ) const
     232             : {
     233           0 :   return GetDistanceFromVertexXY( vtx, 0, val, err );
     234             : }
     235             : 
     236             : 
     237             : Bool_t AliKFParticle::GetDistanceFromVertexXY( const AliKFParticle &Vtx, Double_t &val, Double_t &err ) const 
     238             : {
     239             :   //* Calculate distance from vertex [cm] in XY-plane
     240             : 
     241           0 :   return GetDistanceFromVertexXY( Vtx.fP, Vtx.fC, val, err );
     242             : }
     243             : 
     244             : Bool_t AliKFParticle::GetDistanceFromVertexXY( const AliVVertex &Vtx, Double_t &val, Double_t &err ) const 
     245             : {
     246             :   //* Calculate distance from vertex [cm] in XY-plane
     247             : 
     248           0 :   return GetDistanceFromVertexXY( AliKFParticle(Vtx), val, err );
     249           0 : }
     250             : 
     251             : Double_t AliKFParticle::GetDistanceFromVertexXY( const Double_t vtx[] ) const
     252             : {
     253             :   //* Calculate distance from vertex [cm] in XY-plane
     254           0 :   Double_t val, err;
     255           0 :   GetDistanceFromVertexXY( vtx, 0, val, err );
     256           0 :   return val;
     257           0 : }
     258             : 
     259             : Double_t AliKFParticle::GetDistanceFromVertexXY( const AliKFParticle &Vtx ) const 
     260             : {
     261             :   //* Calculate distance from vertex [cm] in XY-plane
     262             : 
     263           0 :   return GetDistanceFromVertexXY( Vtx.fP );
     264             : }
     265             : 
     266             : Double_t AliKFParticle::GetDistanceFromVertexXY( const AliVVertex &Vtx ) const 
     267             : {
     268             :   //* Calculate distance from vertex [cm] in XY-plane
     269             : 
     270           0 :   return GetDistanceFromVertexXY( AliKFParticle(Vtx).fP );
     271           0 : }
     272             : 
     273             : Double_t AliKFParticle::GetDistanceFromParticleXY( const AliKFParticle &p ) const 
     274             : {
     275             :   //* Calculate distance to other particle [cm]
     276             : 
     277           0 :   Double_t dS, dS1;
     278           0 :   GetDStoParticleXY( p, dS, dS1 );   
     279           0 :   Double_t mP[8], mC[36], mP1[8], mC1[36];
     280           0 :   Transport( dS, mP, mC ); 
     281           0 :   p.Transport( dS1, mP1, mC1 ); 
     282           0 :   Double_t dx = mP[0]-mP1[0]; 
     283           0 :   Double_t dy = mP[1]-mP1[1]; 
     284           0 :   return TMath::Sqrt(dx*dx+dy*dy);
     285           0 : }
     286             : 
     287             : Double_t AliKFParticle::GetDeviationFromParticleXY( const AliKFParticle &p ) const 
     288             : {
     289             :   //* Calculate sqrt(Chi2/ndf) deviation from other particle
     290             : 
     291           0 :   Double_t dS, dS1;
     292           0 :   GetDStoParticleXY( p, dS, dS1 );   
     293           0 :   Double_t mP1[8], mC1[36];
     294           0 :   p.Transport( dS1, mP1, mC1 ); 
     295             : 
     296           0 :   Double_t d[2]={ fP[0]-mP1[0], fP[1]-mP1[1] };
     297             : 
     298           0 :   Double_t sigmaS = .1+10.*TMath::Sqrt( (d[0]*d[0]+d[1]*d[1] )/
     299           0 :                                         (mP1[3]*mP1[3]+mP1[4]*mP1[4] )  );
     300             : 
     301           0 :   Double_t h[2] = { mP1[3]*sigmaS, mP1[4]*sigmaS };       
     302             :   
     303           0 :   mC1[0] +=h[0]*h[0];
     304           0 :   mC1[1] +=h[1]*h[0]; 
     305           0 :   mC1[2] +=h[1]*h[1]; 
     306             : 
     307           0 :   return GetDeviationFromVertexXY( mP1, mC1 )*TMath::Sqrt(2./1.);
     308           0 : }
     309             : 
     310             : 
     311             : Double_t AliKFParticle::GetDeviationFromVertexXY( const Double_t vtx[], const Double_t Cv[] ) const 
     312             : {
     313             :   //* Calculate sqrt(Chi2/ndf) deviation from vertex
     314             :   //* v = [xyz], Cv=[Cxx,Cxy,Cyy,Cxz,Cyz,Czz]-covariance matrix
     315             : 
     316           0 :   Double_t val, err;
     317           0 :   Bool_t problem = GetDistanceFromVertexXY( vtx, Cv, val, err );
     318           0 :   if( problem || err<1.e-20 ) return 1.e4;
     319           0 :   else return val/err;
     320           0 : }
     321             : 
     322             : 
     323             : Double_t AliKFParticle::GetDeviationFromVertexXY( const AliKFParticle &Vtx ) const  
     324             : {
     325             :   //* Calculate sqrt(Chi2/ndf) deviation from vertex
     326             :   //* v = [xyz], Cv=[Cxx,Cxy,Cyy,Cxz,Cyz,Czz]-covariance matrix
     327             : 
     328           0 :   return GetDeviationFromVertexXY( Vtx.fP, Vtx.fC );
     329             : }
     330             : 
     331             : Double_t AliKFParticle::GetDeviationFromVertexXY( const AliVVertex &Vtx ) const 
     332             : {
     333             :   //* Calculate sqrt(Chi2/ndf) deviation from vertex
     334             :   //* v = [xyz], Cv=[Cxx,Cxy,Cyy,Cxz,Cyz,Czz]-covariance matrix
     335             : 
     336           0 :   AliKFParticle v(Vtx);
     337           0 :   return GetDeviationFromVertexXY( v.fP, v.fC );
     338           0 : }
     339             : 
     340             : Double_t AliKFParticle::GetAngle  ( const AliKFParticle &p ) const 
     341             : {
     342             :   //* Calculate the opening angle between two particles
     343             : 
     344           0 :   Double_t dS, dS1;
     345           0 :   GetDStoParticle( p, dS, dS1 );   
     346           0 :   Double_t mP[8], mC[36], mP1[8], mC1[36];
     347           0 :   Transport( dS, mP, mC ); 
     348           0 :   p.Transport( dS1, mP1, mC1 ); 
     349           0 :   Double_t n = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] + mP[5]*mP[5] );
     350           0 :   Double_t n1= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] + mP1[5]*mP1[5] );
     351           0 :   n*=n1;
     352             :   Double_t a = 0;
     353           0 :   if( n>1.e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] + mP[5]*mP1[5] )/n;
     354           0 :   if (TMath::Abs(a)<1.) a = TMath::ACos(a);
     355           0 :   else a = (a>=0) ?0 :TMath::Pi();
     356           0 :   return a;
     357           0 : }
     358             : 
     359             : Double_t AliKFParticle::GetAngleXY( const AliKFParticle &p ) const 
     360             : {
     361             :   //* Calculate the opening angle between two particles in XY plane
     362             : 
     363           0 :   Double_t dS, dS1;
     364           0 :   GetDStoParticleXY( p, dS, dS1 );   
     365           0 :   Double_t mP[8], mC[36], mP1[8], mC1[36];
     366           0 :   Transport( dS, mP, mC ); 
     367           0 :   p.Transport( dS1, mP1, mC1 ); 
     368           0 :   Double_t n = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
     369           0 :   Double_t n1= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4] );
     370           0 :   n*=n1;
     371             :   Double_t a = 0;
     372           0 :   if( n>1.e-8 ) a = ( mP[3]*mP1[3] + mP[4]*mP1[4] )/n;
     373           0 :   if (TMath::Abs(a)<1.) a = TMath::ACos(a);
     374           0 :   else a = (a>=0) ?0 :TMath::Pi();
     375           0 :   return a;
     376           0 : }
     377             : 
     378             : Double_t AliKFParticle::GetAngleRZ( const AliKFParticle &p ) const 
     379             : {
     380             :   //* Calculate the opening angle between two particles in RZ plane
     381             : 
     382           0 :   Double_t dS, dS1;
     383           0 :   GetDStoParticle( p, dS, dS1 );   
     384           0 :   Double_t mP[8], mC[36], mP1[8], mC1[36];
     385           0 :   Transport( dS, mP, mC ); 
     386           0 :   p.Transport( dS1, mP1, mC1 ); 
     387           0 :   Double_t nr = TMath::Sqrt( mP[3]*mP[3] + mP[4]*mP[4] );
     388           0 :   Double_t n1r= TMath::Sqrt( mP1[3]*mP1[3] + mP1[4]*mP1[4]  );
     389           0 :   Double_t n = TMath::Sqrt( nr*nr + mP[5]*mP[5] );
     390           0 :   Double_t n1= TMath::Sqrt( n1r*n1r + mP1[5]*mP1[5] );
     391           0 :   n*=n1;
     392             :   Double_t a = 0;
     393           0 :   if( n>1.e-8 ) a = ( nr*n1r +mP[5]*mP1[5])/n; 
     394           0 :   if (TMath::Abs(a)<1.) a = TMath::ACos(a);
     395           0 :   else a = (a>=0) ?0 :TMath::Pi();
     396           0 :   return a;
     397           0 : }
     398             : 
     399             : 
     400             : /*
     401             : 
     402             : #include "AliExternalTrackParam.h"
     403             : 
     404             : void AliKFParticle::GetDStoParticleALICE( const AliKFParticleBase &p, 
     405             :                                            Double_t &DS, Double_t &DS1 ) 
     406             :   const
     407             : { 
     408             :   DS = DS1 = 0;   
     409             :   Double_t x1, a1, x2, a2;
     410             :   Double_t par1[5], par2[5], cov[15];
     411             :   for(int i=0; i<15; i++) cov[i] = 0;
     412             :   cov[0] = cov[2] = cov[5] = cov[9] = cov[14] = .001;
     413             : 
     414             :   GetExternalTrackParam( *this, x1, a1, par1 );
     415             :   GetExternalTrackParam( p, x2, a2, par2 );
     416             : 
     417             :   AliExternalTrackParam t1(x1,a1, par1, cov);
     418             :   AliExternalTrackParam t2(x2,a2, par2, cov);
     419             : 
     420             :   Double_t xe1=0, xe2=0;
     421             :   t1.GetDCA( &t2, -GetFieldAlice(), xe1, xe2 );
     422             :   t1.PropagateTo( xe1, -GetFieldAlice() );
     423             :   t2.PropagateTo( xe2, -GetFieldAlice() );
     424             : 
     425             :   Double_t xyz1[3], xyz2[3];
     426             :   t1.GetXYZ( xyz1 );
     427             :   t2.GetXYZ( xyz2 );
     428             :   
     429             :   DS = GetDStoPoint( xyz1 );
     430             :   DS1 = p.GetDStoPoint( xyz2 );
     431             : 
     432             :   return;
     433             : }
     434             : */
     435             : 
     436             :   // * Pseudo Proper Time of decay = (r*pt) / |pt| * M/|pt|
     437             : Double_t AliKFParticle::GetPseudoProperDecayTime( const AliKFParticle &pV, const Double_t& mass, Double_t* timeErr2 ) const
     438             : { // TODO optimize with respect to time and stability
     439           0 :   const Double_t ipt2 = 1/( Px()*Px() + Py()*Py() );
     440           0 :   const Double_t mipt2 = mass*ipt2;
     441           0 :   const Double_t dx = X() - pV.X();
     442           0 :   const Double_t dy = Y() - pV.Y();
     443             : 
     444           0 :   if ( timeErr2 ) {
     445             :       // -- calculate error = sigma(f(r)) = f'Cf'
     446             :       // r = {x,y,px,py,x_pV,y_pV}
     447             :       // df/dr = { px*m/pt^2,
     448             :       //     py*m/pt^2,
     449             :       //    ( x - x_pV )*m*(1/pt^2 - 2(px/pt^2)^2),
     450             :       //    ( y - y_pV )*m*(1/pt^2 - 2(py/pt^2)^2),
     451             :       //     -px*m/pt^2,
     452             :       //     -py*m/pt^2 }
     453           0 :     const Double_t f0 = Px()*mipt2;
     454           0 :     const Double_t f1 = Py()*mipt2;
     455           0 :     const Double_t mipt2derivative = mipt2*(1-2*Px()*Px()*ipt2);
     456           0 :     const Double_t f2 = dx*mipt2derivative;
     457           0 :     const Double_t f3 = -dy*mipt2derivative;
     458           0 :     const Double_t f4 = -f0;
     459           0 :     const Double_t f5 = -f1;
     460             : 
     461           0 :     const Double_t& mC00 =    GetCovariance(0,0);
     462           0 :     const Double_t& mC10 =    GetCovariance(0,1);
     463           0 :     const Double_t& mC11 =    GetCovariance(1,1);
     464           0 :     const Double_t& mC20 =    GetCovariance(3,0);
     465           0 :     const Double_t& mC21 =    GetCovariance(3,1);
     466           0 :     const Double_t& mC22 =    GetCovariance(3,3);
     467           0 :     const Double_t& mC30 =    GetCovariance(4,0);
     468           0 :     const Double_t& mC31 =    GetCovariance(4,1);
     469           0 :     const Double_t& mC32 =    GetCovariance(4,3);
     470           0 :     const Double_t& mC33 =    GetCovariance(4,4);
     471           0 :     const Double_t& mC44 = pV.GetCovariance(0,0);
     472           0 :     const Double_t& mC54 = pV.GetCovariance(1,0);
     473           0 :     const Double_t& mC55 = pV.GetCovariance(1,1);
     474             : 
     475           0 :     *timeErr2 =
     476           0 :       f5*mC55*f5 +
     477           0 :       f5*mC54*f4 +
     478           0 :       f4*mC44*f4 +
     479           0 :       f3*mC33*f3 +
     480           0 :       f3*mC32*f2 +
     481           0 :       f3*mC31*f1 +
     482           0 :       f3*mC30*f0 +
     483           0 :       f2*mC22*f2 +
     484           0 :       f2*mC21*f1 +
     485           0 :       f2*mC20*f0 +
     486           0 :       f1*mC11*f1 +
     487           0 :       f1*mC10*f0 +
     488           0 :       f0*mC00*f0;
     489           0 :   }
     490           0 :   return ( dx*Px() + dy*Py() )*mipt2;
     491             : }

Generated by: LCOV version 1.11