]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCAMCTrack.cxx
bug fixed
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAMCTrack.cxx
CommitLineData
d54804bf 1// $Id$
2//***************************************************************************
3// This file is property of and copyright by the ALICE HLT Project *
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. *
17//***************************************************************************
18
19#include "AliHLTTPCCAMCTrack.h"
20#include "TParticle.h"
21#include "TDatabasePDG.h"
00d07bcd 22#include "AliHLTTPCCAMath.h"
d54804bf 23
24
25AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack()
eb30eb49 26 : fPDG(0), fP(0), fPt(0), fNHits(0), fNMCPoints(0), fFirstMCPointID(0), fNReconstructed(0), fSet(0), fNTurns(0)
d54804bf 27{
28 //* Default constructor
29}
30
31
32AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack( const TParticle *part )
eb30eb49 33 : fPDG(0), fP(0), fPt(0), fNHits(0), fNMCPoints(0), fFirstMCPointID(0), fNReconstructed(0), fSet(0), fNTurns(0)
d54804bf 34{
35 //* Constructor from TParticle
36
37 for( Int_t i=0; i<7; i++ ) fPar[i] = 0;
eb30eb49 38 for( Int_t i=0; i<7; i++ ) fTPCPar[i] = 0;
d54804bf 39 fP = 0;
40 fPt = 0;
41
42 if( !part ) return;
43 TLorentzVector mom, vtx;
44 part->ProductionVertex(vtx);
45 part->Momentum(mom);
46 fPar[0] = part->Vx();
47 fPar[1] = part->Vy();
48 fPar[2] = part->Vz();
49 fP = part->P();
50 fPt = part->Pt();
51 Double_t pi = ( fP >1.e-4 ) ?1./fP :0;
52 fPar[3] = part->Px()*pi;
53 fPar[4] = part->Py()*pi;
54 fPar[5] = part->Pz()*pi;
55 fPar[6] = 0;
eb30eb49 56 fPDG = part->GetPdgCode();
00d07bcd 57 if ( CAMath::Abs(fPDG) < 100000 ){
eb30eb49 58 TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle(fPDG);
d54804bf 59 if( pPDG ) fPar[6] = pPDG->Charge()/3.0*pi;
60 }
61}
eb30eb49 62
63void AliHLTTPCCAMCTrack::SetTPCPar( Float_t X, Float_t Y, Float_t Z,
64 Float_t Px, Float_t Py, Float_t Pz )
65{
66 //* Set parameters at TPC entrance
67
68 for( Int_t i=0; i<7; i++ ) fTPCPar[i] = 0;
69
70 fTPCPar[0] = X;
71 fTPCPar[1] = Y;
72 fTPCPar[2] = Z;
00d07bcd 73 Double_t p = CAMath::Sqrt(Px*Px + Py*Py + Pz*Pz);
eb30eb49 74 Double_t pi = ( p >1.e-4 ) ?1./p :0;
75 fTPCPar[3] = Px*pi;
76 fTPCPar[4] = Py*pi;
77 fTPCPar[5] = Pz*pi;
78 fTPCPar[6] = 0;
00d07bcd 79 if ( CAMath::Abs(fPDG) < 100000 ){
eb30eb49 80 TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle(fPDG);
81 if( pPDG ) fTPCPar[6] = pPDG->Charge()/3.0*pi;
82 }
83}