]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCAMCTrack.cxx
coverity warning 10034 fixed
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAMCTrack.cxx
CommitLineData
d54804bf 1// $Id$
ce565086 2// **************************************************************************
fbb9b71b 3// This file is property of and copyright by the ALICE HLT Project *
d54804bf 4// ALICE Experiment at CERN, All rights reserved. *
5// *
6// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7// Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8// for The ALICE HLT Project. *
9// *
10// Permission to use, copy, modify and distribute this software and its *
11// documentation strictly for non-commercial purposes is hereby granted *
12// without fee, provided that the above copyright notice appears in all *
13// copies and that both the copyright notice and this permission notice *
14// appear in the supporting documentation. The authors make no claims *
15// about the suitability of this software for any purpose. It is *
16// provided "as is" without express or implied warranty. *
ce565086 17// *
d54804bf 18//***************************************************************************
19
ce565086 20
d54804bf 21#include "AliHLTTPCCAMCTrack.h"
4687b8fc 22#include "AliHLTTPCCAMath.h"
d54804bf 23#include "TParticle.h"
24#include "TDatabasePDG.h"
d54804bf 25
26
27AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack()
fbb9b71b 28 : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
d54804bf 29{
30 //* Default constructor
b89b930b 31 for( int i=0;i<7; i++){
32 fPar[i] = 0;
33 fTPCPar[i] = 0;
34 }
d54804bf 35}
36
37
38AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack( const TParticle *part )
fbb9b71b 39 : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
d54804bf 40{
41 //* Constructor from TParticle
42
fbb9b71b 43 for ( int i = 0; i < 7; i++ ) fPar[i] = 0;
44 for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
d54804bf 45 fP = 0;
46 fPt = 0;
47
fbb9b71b 48 if ( !part ) return;
d54804bf 49 TLorentzVector mom, vtx;
fbb9b71b 50 part->ProductionVertex( vtx );
51 part->Momentum( mom );
d54804bf 52 fPar[0] = part->Vx();
53 fPar[1] = part->Vy();
54 fPar[2] = part->Vz();
55 fP = part->P();
56 fPt = part->Pt();
fbb9b71b 57 double pi = ( fP > 1.e-4 ) ? 1. / fP : 0;
58 fPar[3] = part->Px() * pi;
59 fPar[4] = part->Py() * pi;
60 fPar[5] = part->Pz() * pi;
d54804bf 61 fPar[6] = 0;
fbb9b71b 62 fPDG = part->GetPdgCode();
63 if ( CAMath::Abs( fPDG ) < 100000 ) {
64 TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
65 if ( pPDG ) fPar[6] = pPDG->Charge() / 3.0 * pi;
d54804bf 66 }
67}
eb30eb49 68
fbb9b71b 69void AliHLTTPCCAMCTrack::SetTPCPar( float X, float Y, float Z,
70 float Px, float Py, float Pz )
eb30eb49 71{
72 //* Set parameters at TPC entrance
73
fbb9b71b 74 for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
eb30eb49 75
76 fTPCPar[0] = X;
77 fTPCPar[1] = Y;
78 fTPCPar[2] = Z;
fbb9b71b 79 double p = CAMath::Sqrt( Px * Px + Py * Py + Pz * Pz );
80 double pi = ( p > 1.e-4 ) ? 1. / p : 0;
81 fTPCPar[3] = Px * pi;
82 fTPCPar[4] = Py * pi;
83 fTPCPar[5] = Pz * pi;
eb30eb49 84 fTPCPar[6] = 0;
fbb9b71b 85 if ( CAMath::Abs( fPDG ) < 100000 ) {
86 TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
87 if ( pPDG ) fTPCPar[6] = pPDG->Charge() / 3.0 * pi;
eb30eb49 88 }
89}