LCOV - code coverage report
Current view: top level - STEER/ESD - AliKFVertex.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 65 1.5 %
Date: 2016-06-14 17:26:59 Functions: 1 6 16.7 %

          Line data    Source code
       1             : //----------------------------------------------------------------------------
       2             : // Implementation of the AliKFVertex class
       3             : // .
       4             : // @author  S.Gorbunov, I.Kisel
       5             : // @version 1.0
       6             : // @since   13.05.07
       7             : // 
       8             : // Class to reconstruct and store primary and secondary vertices
       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 "AliKFVertex.h"
      20             : 
      21         172 : ClassImp(AliKFVertex)
      22             : 
      23             : 
      24           0 : AliKFVertex::AliKFVertex( const AliVVertex &vertex ): fIsConstrained(0)
      25           0 : {
      26             :   // Constructor from ALICE VVertex
      27             : 
      28           0 :   vertex.GetXYZ( fP );
      29           0 :   vertex.GetCovarianceMatrix( fC );  
      30           0 :   fChi2 = vertex.GetChi2();  
      31           0 :   fNDF = 2*vertex.GetNContributors() - 3;
      32           0 :   fQ = 0;
      33           0 :   fAtProductionVertex = 0;
      34           0 :   fIsLinearized = 0;
      35           0 :   fSFromDecay = 0;
      36           0 : }
      37             : 
      38             : /*
      39             : void     AliKFVertex::Print(Option_t* ) const
      40             : {  
      41             :   cout<<"AliKFVertex position:    "<<GetX()<<" "<<GetY()<<" "<<GetZ()<<endl;
      42             :   cout<<"AliKFVertex cov. matrix: "<<GetCovariance(0)<<endl;
      43             :   cout<<"                         "<<GetCovariance(1)<<" "<<GetCovariance(2)<<endl;
      44             :   cout<<"                         "<<GetCovariance(3)<<" "<<GetCovariance(4)<<" "<<GetCovariance(5)<<endl;
      45             : }
      46             :   */
      47             : 
      48             : void AliKFVertex::SetBeamConstraint( Double_t x, Double_t y, Double_t z, 
      49             :                                      Double_t errX, Double_t errY, Double_t errZ )
      50             : {
      51             :   // Set beam constraint to the vertex
      52           0 :   fP[0] = x;
      53           0 :   fP[1] = y;
      54           0 :   fP[2] = z;
      55           0 :   fC[0] = errX*errX;
      56           0 :   fC[1] = 0;
      57           0 :   fC[2] = errY*errY;
      58           0 :   fC[3] = 0;
      59           0 :   fC[4] = 0;
      60           0 :   fC[5] = errZ*errZ;
      61           0 :   fIsConstrained = 1;
      62           0 : }
      63             : 
      64             : void AliKFVertex::SetBeamConstraintOff()
      65             : {
      66           0 :   fIsConstrained = 0;
      67           0 : }
      68             : 
      69             : void AliKFVertex::ConstructPrimaryVertex( const AliKFParticle *vDaughters[], 
      70             :                                           int NDaughters, Bool_t vtxFlag[],
      71             :                                           Double_t ChiCut  )
      72             : {
      73             :   //* Primary vertex finder with simple rejection of outliers
      74             : 
      75           0 :   if( NDaughters<2 ) return;
      76           0 :   double constrP[3]={fP[0], fP[1], fP[2]};
      77           0 :   double constrC[6]={fC[0], fC[1], fC[2], fC[3], fC[4], fC[5]};
      78             : 
      79           0 :   Construct( vDaughters, NDaughters, 0, -1, fIsConstrained );
      80             : 
      81           0 :   SetVtxGuess( fVtxGuess[0], fVtxGuess[1], fVtxGuess[2] );
      82             : 
      83           0 :   for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 1;
      84             : 
      85             :   Int_t nRest = NDaughters;
      86           0 :   while( nRest>2 )
      87             :     {    
      88             :       Double_t worstChi = 0.;
      89             :       Int_t worstDaughter = 0;
      90           0 :       for( Int_t it=0; it<NDaughters; it++ ){
      91           0 :         if( !vtxFlag[it] ) continue;    
      92           0 :         const AliKFParticle &p = *(vDaughters[it]);
      93           0 :         AliKFVertex tmp = *this - p;
      94           0 :         Double_t chi = p.GetDeviationFromVertex( tmp );      
      95           0 :         if( worstChi < chi ){
      96             :           worstChi = chi;
      97             :           worstDaughter = it;
      98           0 :         }
      99           0 :       }
     100           0 :       if( worstChi < ChiCut ) break;
     101             :       
     102           0 :       vtxFlag[worstDaughter] = 0;    
     103           0 :       *this -= *(vDaughters[worstDaughter]);
     104           0 :       nRest--;
     105           0 :     } 
     106             : 
     107           0 :   if( nRest>=2 ){// final refit     
     108           0 :     SetVtxGuess( fP[0], fP[1], fP[2] );
     109           0 :     if( fIsConstrained ){
     110           0 :       fP[0] = constrP[0];
     111           0 :       fP[1] = constrP[1];
     112           0 :       fP[2] = constrP[2];
     113           0 :       for( int i=0; i<6; i++ ) fC[i] = constrC[i];
     114           0 :     }
     115             :     int nDaughtersNew=0;
     116           0 :     const AliKFParticle **vDaughtersNew=new const AliKFParticle *[NDaughters];
     117           0 :     for( int i=0; i<NDaughters; i++ ){
     118           0 :       if( vtxFlag[i] )  vDaughtersNew[nDaughtersNew++] = vDaughters[i];
     119             :     }
     120           0 :     Construct( vDaughtersNew, nDaughtersNew, 0, -1, fIsConstrained );
     121           0 :     delete[] vDaughtersNew;
     122           0 :   }
     123             : 
     124           0 :   if( nRest<=2 && GetChi2()>ChiCut*ChiCut*GetNDF() ){
     125           0 :     for( int i=0; i<NDaughters; i++ ) vtxFlag[i] = 0;
     126           0 :     fNDF = -3;
     127           0 :     fChi2 = 0;
     128           0 :   }
     129           0 : }

Generated by: LCOV version 1.11