StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPeCTrack.cxx
1 //
3 // Revision 1.0 2000/12/15 Pablo Yepes: yepes@rice.edu
4 //
6 #include <Stiostream.h>
7 #include "StPeCTrack.h"
8 #include "StEventTypes.h"
9 #include "BetheBloch.h"
10 // this is the old BB, used for P00hm
11 //#include "myBetheBloch.h"
12 
13 #include <math.h>
14 ClassImp(StPeCTrack)
15 
17 }
18 
19 StPeCTrack::~StPeCTrack() {
20 }
21 
22 #ifndef __CINT__
23 StPeCTrack::StPeCTrack ( Int_t _primary, StTrack* trk) {
24  set ( _primary, trk ) ;
25 }
26 
27 StPeCTrack::StPeCTrack(Int_t _primary, StMuTrack* trk, StMuEvent* event)
28 {
29  set (_primary, trk, event);
30 }
31 
32 void StPeCTrack::set ( Int_t _primary, StTrack* trk) {
33  key = trk->key() ;
34  primary = _primary ;
35  charge = trk->geometry()->charge();
36  pt = trk->geometry()->momentum().perp();
37  p = trk->geometry()->momentum().mag();
38  psi = trk->geometry()->momentum().phi();
39  eta = -::log(tan(trk->geometry()->momentum().theta()/2.));
40  phi0 = trk->geometry()->origin().phi();
41  z0 = trk->geometry()->origin().z();
42  r0 = trk->geometry()->origin().perp();
43 
44 
45  // cout << "Flag: " << trk->flag() << " primary " << _primary << endl;
46  dedx = 0. ;
47  dedxZel = -9999.;
48  dedxZmu = -9999.;
49  dedxZpi = -9999.;
50  dedxZk = -9999.;
51  dedxZp = -9999.;
52  length = -9999.;
53  StSPtrVecTrackPidTraits& traits = trk->pidTraits();
54  if ( &traits ) {
55  StDedxPidTraits *dedxPid = 0 ;
56  Int_t NTraits = traits.size();
57  for( Int_t i=0; i<NTraits; i++) {
58  if ( traits[i]->detector() == kTpcId ){
59  dedxPid = dynamic_cast<StDedxPidTraits*>(traits[i]);
60  if ( dedxPid && dedxPid->method() == kTruncatedMeanIdentifier )break;
61  }
62  }
63  if ( dedxPid ){
64  length= dedxPid->length();
65  dedx = dedxPid->mean();
66  dedxZel = getZdEdx(mMassElectron);
67  dedxZmu = getZdEdx(mMassMuon);
68  dedxZpi = getZdEdx(mMassPion);
69  dedxZk = getZdEdx(mMassKaon);
70  dedxZp = getZdEdx(mMassProton);
71  nSigmaEl =0; // later, not filled from StEvent
72  nSigmaPi =0;
73  nSigmaK =0;
74  nSigmaP =0;
75 
76  }
77  // nHits = trk->detectorInfo()->numberOfPoints() ; RD
78  }
79 //printf ( "pt psi eta r0 phi0 z0 nHits %f %f %f %f %f %f %f \n",
80 // pt, psi, eta, r0, phi0, z0, nHits ) ;
81 
82 
83 }
84 
85 void StPeCTrack::set(Int_t _primary, StMuTrack* trk, StMuEvent *event)
86 {
87  key = trk->id();
88  primary = _primary;
89  charge = trk->charge();
90  pt = trk->momentum().perp();
91  p = trk->momentum().mag();
92  psi = trk->momentum().phi();
93  eta = -::log(tan(trk->momentum().theta()/2.));
94  phi0 = trk->firstPoint().phi();
95  z0 = trk->firstPoint().z();
96  r0 = trk->firstPoint().perp();
97  length= trk->length(); // hope this is correct // needed for dedxZ
98  vertexIndex = trk->vertexIndex();
99  vtxX = event->primaryVertexPosition(vertexIndex).x();
100  vtxY = event->primaryVertexPosition(vertexIndex).y();
101  vtxZ = event->primaryVertexPosition(vertexIndex).z();
102 
103  dedx = trk->dEdx();
104  // OLd
105  // dedxZel = getZdEdx(mMassElectron);
106  // dedxZmu = getZdEdx(mMassMuon);
107  // dedxZpi = getZdEdx(mMassPion);
108  // dedxZk = getZdEdx(mMassKaon);
109  // dedxZp = getZdEdx(mMassProton);
110  // probabilities from muDst
111  dedxZel = trk->pidProbElectron();
112  dedxZmu = -9999; // not done in muDst
113  dedxZpi = trk->pidProbPion();
114  dedxZk = trk->pidProbKaon();
115  dedxZp = trk->pidProbProton();
116 
117  nSigmaEl = trk->nSigmaElectron();
118  // nSignaMu = -9999; // not done in muDst
119  nSigmaPi = trk->nSigmaPion();
120  nSigmaK = trk->nSigmaKaon();
121  nSigmaP = trk->nSigmaProton();
122 
123  nHits = trk->nHits();
124 
125 
126 
127 
128 // printf ( "pt psi eta r0 phi0 z0 nHits %f %f %f %f %f %f %f \n",
129 //pt, psi, eta, r0, phi0, z0, nHits ) ;
130 
131 
132 
133  return;
134 }
135 
136 // Private Helper
137 Float_t StPeCTrack::getZdEdx(Float_t mass) {
138  // old; FLK
139  //static myBetheBloch bb;
140 
141  if ( ! mass || length<=0. ) { return -9999; }
142  Double_t betaGamma = p / mass ;
143  // old
144  // Double_t dedxBB = bb(betaGamma);
145  Double_t dedxBB= BetheBloch::Sirrf(betaGamma, length);
146 
147  if (p && dedx && dedxBB ) {
148  return log ( dedx/dedxBB);
149  } else {
150  // cout << "dEdx Pion F*** Up ! p " << p << " dedx "
151  // <<dedx << " dedxBB " << dedxBB << endl;
152  return -9999.;
153  }
154 }
155 
156 #endif /*__CINT__*/
157 
158 
159 
160 
Double_t pidProbKaon() const
Returns Aihong&#39;s probability of being a kaon.
Definition: StMuTrack.h:242
Double_t pidProbElectron() const
Returns Aihong&#39;s probability of being an electron.
Definition: StMuTrack.h:240
Int_t vertexIndex() const
Returns index of associated primary vertex.
Definition: StMuTrack.cxx:600
short id() const
Returns the track id(or key), is unique for a track node, i.e. global and primary tracks have the sam...
Definition: StMuTrack.h:228
Double_t length() const
Returns length of track (cm) from primary vertex to last measured point.
Definition: StMuTrack.cxx:416
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
Double_t nSigmaPion() const
Returns Craig&#39;s distance to the calculated dE/dx band for pions in units of sigma.
Definition: StMuTrack.h:245
Double_t pidProbProton() const
Returns Aihong&#39;s probability of being a proton.
Definition: StMuTrack.h:243
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
Definition: StMuTrack.h:261
Double_t nSigmaElectron() const
Returns Craig&#39;s distance to the calculated dE/dx band for electrons in units of sigma.
Definition: StMuTrack.h:244
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:260
UShort_t nHits() const
Bingchu.
Definition: StMuTrack.h:237
Double_t dEdx() const
Returns measured dE/dx value.
Definition: StMuTrack.h:248
Double_t nSigmaProton() const
Returns Craig&#39;s distance to the calculated dE/dx band for protons in units of sigma.
Definition: StMuTrack.h:247
Double_t nSigmaKaon() const
Returns Craig&#39;s distance to the calculated dE/dx band for kaons in units of sigma.
Definition: StMuTrack.h:246
Double_t pidProbPion() const
Returns Aihong&#39;s probability of being a pion.
Definition: StMuTrack.h:241