FairRoot/PandaRoot
PndCAMCTrack.cxx
Go to the documentation of this file.
1 // $Id: PndCAMCTrack.cxx,v 1.3 2011/01/31 17:18:28 fisyak Exp $
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 // Developed by: Igor Kulakov <I.Kulakov@gsi.de> *
11 // Maksym Zyzak <M.Zyzak@gsi.de> *
12 // *
13 // Permission to use, copy, modify and distribute this software and its *
14 // documentation strictly for non-commercial purposes is hereby granted *
15 // without fee, provided that the above copyright notice appears in all *
16 // copies and that both the copyright notice and this permission notice *
17 // appear in the supporting documentation. The authors make no claims *
18 // about the suitability of this software for any purpose. It is *
19 // provided "as is" without express or implied warranty. *
20 // *
21 //***************************************************************************
22 
23 
24 #include "PndCAMCTrack.h"
25 #include "PndCAMath.h"
26 #include "TParticle.h"
27 #include "TDatabasePDG.h"
28 
29 
31  : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
32 {
33  //* Default constructor
34 }
35 
36 
37 PndCAMCTrack::PndCAMCTrack( const TParticle *part )
38  : fPDG( 0 ), fP( 0 ), fPt( 0 ), fNHits( 0 ), fNMCPoints( 0 ), fFirstMCPointID( 0 ), fNReconstructed( 0 ), fSet( 0 ), fNTurns( 0 )
39 {
40  //* Constructor from TParticle
41 
42  for ( int i = 0; i < 7; i++ ) fPar[i] = 0;
43  for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
44  fP = 0;
45  fPt = 0;
46 
47  if ( !part ) return;
48  TLorentzVector mom, vtx;
49  part->ProductionVertex( vtx );
50  part->Momentum( mom );
51  fPar[0] = part->Vx();
52  fPar[1] = part->Vy();
53  fPar[2] = part->Vz();
54  fP = part->P();
55  fPt = part->Pt();
56  float pi = ( fP > 1.e-4 ) ? 1. / fP : 0;
57  fPar[3] = part->Px() * pi;
58  fPar[4] = part->Py() * pi;
59  fPar[5] = part->Pz() * pi;
60  fPar[6] = 0;
61  fPDG = part->GetPdgCode();
62  if ( CAMath::Abs( fPDG ) < 100000 ) {
63  TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
64  if ( pPDG ) fPar[6] = pPDG->Charge() / 3.0 * pi;
65  }
66 }
67 
68 // void PndCAMCTrack::SetTPCPar( float X, float Y, float Z,
69 // float Px, float Py, float Pz )
70 // {
71 // //* Set parameters at TPC entrance
72 
73 // for ( int i = 0; i < 7; i++ ) fTPCPar[i] = 0;
74 
75 // fTPCPar[0] = X;
76 // fTPCPar[1] = Y;
77 // fTPCPar[2] = Z;
78 // float p = CAMath::Sqrt( Px * Px + Py * Py + Pz * Pz );
79 // float pi = ( p > 1.e-4 ) ? 1. / p : 0;
80 // fTPCPar[3] = Px * pi;
81 // fTPCPar[4] = Py * pi;
82 // fTPCPar[5] = Pz * pi;
83 // fTPCPar[6] = 0;
84 // if ( CAMath::Abs( fPDG ) < 100000 ) {
85 // TParticlePDG *pPDG = TDatabasePDG::Instance()->GetParticle( fPDG );
86 // if ( pPDG ) fTPCPar[6] = pPDG->Charge() / 3.0 * pi;
87 // }
88 // }
89 
91 {
92  out << a.fMotherId << " " << a.fPDG << std::endl;
93  for (int i = 0; i < 7; i++) out << a.fPar[i] << " ";
94  out << std::endl;
95  for (int i = 0; i < 7; i++) out << a.fTPCPar[i] << " ";
96  out << std::endl;
97  out << a.fP << " " << a.fPt << std::endl;
98  out << a.fNHits << " " << a.fNMCPoints << " " << a.fFirstMCPointID << std::endl;
99  return out << a.fNReconstructed << " " << a.fSet << " " << a.fNTurns << std::endl;
100 }
101 
102 
104 {
105  in >> a.fMotherId;
106  in >> a.fPDG;
107  for (int i = 0; i < 7; i++) in >> a.fPar[i];
108  for (int i = 0; i < 7; i++) in >> a.fTPCPar[i];
109  in >> a.fP >> a.fPt;
110  in >> a.fNHits >> a.fNMCPoints >> a.fFirstMCPointID;
111  return in >> a.fNReconstructed >> a.fSet >> a.fNTurns;
112 }
113 
int fFirstMCPointID
Definition: PndCAMCTrack.h:95
Int_t i
Definition: run_full.C:25
int fNReconstructed
Definition: PndCAMCTrack.h:96
#define pi
Definition: createSTT.C:60
Double_t mom
Definition: plot_dirc.C:14
for(int j=0;j< ncounts;j++)
static T Abs(const T &x)
Definition: PndCAMath.h:39
Int_t a
Definition: anaLmdDigi.C:126
basic_ostream< char, char_traits< char > > ostream
istream & operator>>(istream &in, PndCAMCTrack &a)
basic_istream< char, char_traits< char > > istream
TFile * out
Definition: reco_muo.C:20
TParticlePDG * fPDG
Definition: poormantracks.C:18
float fTPCPar[7]
Definition: PndCAMCTrack.h:91
ostream & operator<<(ostream &out, const PndCAMCTrack &a)
float fPar[7]
Definition: PndCAMCTrack.h:90