Line data Source code
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 :
20 :
21 : #include "AliHLTTPCCAMCTrack.h"
22 : #include "AliHLTTPCCAMath.h"
23 : #include "TParticle.h"
24 : #include "TDatabasePDG.h"
25 :
26 :
27 : AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack()
28 0 : : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
29 0 : {
30 : //* Default constructor
31 0 : for( int i=0;i<7; i++){
32 0 : fPar[i] = 0;
33 0 : fTPCPar[i] = 0;
34 : }
35 0 : }
36 :
37 :
38 : AliHLTTPCCAMCTrack::AliHLTTPCCAMCTrack( const TParticle *part )
39 0 : : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
40 0 : {
41 : //* Constructor from TParticle
42 :
43 0 : for ( int i = 0; i < 7; i++ ) fPar[i] = 0;
44 0 : for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
45 0 : fP = 0;
46 0 : fPt = 0;
47 :
48 0 : if ( !part ) return;
49 0 : TLorentzVector mom, vtx;
50 0 : part->ProductionVertex( vtx );
51 0 : part->Momentum( mom );
52 0 : fPar[0] = part->Vx();
53 0 : fPar[1] = part->Vy();
54 0 : fPar[2] = part->Vz();
55 0 : fP = part->P();
56 0 : fPt = part->Pt();
57 0 : double pi = ( fP > 1.e-4 ) ? 1. / fP : 0;
58 0 : fPar[3] = part->Px() * pi;
59 0 : fPar[4] = part->Py() * pi;
60 0 : fPar[5] = part->Pz() * pi;
61 0 : fPar[6] = 0;
62 0 : fPDG = part->GetPdgCode();
63 0 : if ( CAMath::Abs( fPDG ) < 100000 ) {
64 0 : TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
65 0 : if ( pPDG ) fPar[6] = pPDG->Charge() / 3.0 * pi;
66 0 : }
67 0 : }
68 :
69 : void AliHLTTPCCAMCTrack::SetTPCPar( float X, float Y, float Z,
70 : float Px, float Py, float Pz )
71 : {
72 : //* Set parameters at TPC entrance
73 :
74 0 : for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
75 :
76 0 : fTPCPar[0] = X;
77 0 : fTPCPar[1] = Y;
78 0 : fTPCPar[2] = Z;
79 0 : double p = CAMath::Sqrt( Px * Px + Py * Py + Pz * Pz );
80 0 : double pi = ( p > 1.e-4 ) ? 1. / p : 0;
81 0 : fTPCPar[3] = Px * pi;
82 0 : fTPCPar[4] = Py * pi;
83 0 : fTPCPar[5] = Pz * pi;
84 0 : fTPCPar[6] = 0;
85 0 : if ( CAMath::Abs( fPDG ) < 100000 ) {
86 0 : TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
87 0 : if ( pPDG ) fTPCPar[6] = pPDG->Charge() / 3.0 * pi;
88 0 : }
89 0 : }
|