StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiTrack.cxx
1 #include <Stiostream.h>
2 #include <stdexcept>
3 #include <stdlib.h>
4 
5 //#include "StEventTypes.h"
6 #include "Sti/StiHit.h"
7 #include "Sti/StiTrack.h"
8 #include "Sti/StiTrackFitter.h"
9 #include "Sti/StiTrackFinder.h"
10 #include "Sti/StiTrackFitter.h"
11 #include "Sti/Base/Filter.h"
12 
13 StiTrackFinder * StiTrack::trackFinder = 0;
14 StiTrackFitter * StiTrack::trackFitter = 0;
15 
16 //______________________________________________________________________________
17 StiTrack::StiTrack()
18 {
19  mId = 0;
20 }
21 
22 //______________________________________________________________________________
23 ostream& operator<<(ostream& os, const StiTrack& track)
24 {
25  try
26  {
27  os << "Id: " << track.getId()
28  <<" Chi2: "<<track.getChi2()
29  <<" q: "<<track.getCharge()
30  <<" pt: "<<track.getPt()
31  <<" eta: "<<track.getPseudoRapidity()
32  <<" tanLambda: "<<track.getTanL()
33  <<" phi: "<<track.getPhi()
34  <<" points/fit/max: "<<track.getPointCount()
35  <<"/"<<track.getFitPointCount()
36  <<"/"<<track.getMaxPointCount()<<endl;
37  }
38  catch (runtime_error & rte)
39  {
40  os << " Run-time Error while accessing track parameters: " << rte.what() << endl;
41  }
42  catch (logic_error & le)
43  {
44  os << " Logic Error while accessing track parameters: " << le.what() << endl;
45  }
46  return os;
47 }
48 
49 //______________________________________________________________________________
50 void StiTrack::setTrackFinder(StiTrackFinder * finder)
51 {
52  trackFinder = finder;
53 }
54 
55 //______________________________________________________________________________
56 void StiTrack::setTrackFitter(StiTrackFitter * fitter)
57 {
58  trackFitter = fitter;
59 }
60 
61 //______________________________________________________________________________
62 StiTrackFinder * StiTrack::getTrackFinder()
63 {
64  return trackFinder;
65 }
66 
67 //______________________________________________________________________________
68 StiTrackFitter * StiTrack::getTrackFitter()
69 {
70  return trackFitter;
71 }
72 
73 
74 //______________________________________________________________________________
75 int StiTrack::fit(int direction)
76 {
77  return trackFitter->fit(this,direction);
78 }
79 
80 //______________________________________________________________________________
81 bool StiTrack::find(int direction)
82 {
83  return trackFinder->find(this,direction);
84 }
85 
86 
87 //______________________________________________________________________________
88 double StiTrack::getValue(int key) const
89 {
90  double value;
91  switch (key)
92  {
93  case kCharge: value = getCharge(); break;
94  case kMass: value = getMass(); break;
95  case kChi2: value = getChi2(); break;
96  case kDca2: value = 0.;break;// getDca2(); break;
97  case kDca3: value = 0.;break;// getDca3(); break;
98  case kFlag: value = getFlag(); break;
99  case kPointCount: value = getPointCount(); break;
100  case kFitPointCount: value = getFitPointCount(); break;
101  case kGapCount: value = getGapCount(); break;
102  case kTrackLength: value = getTrackLength(); break;
103  case kMaxPointCount: value = getMaxPointCount(); break;
104  case kTpcDedx: value = 0; break;
105  case kSvtDedx: value = 0; break;
106  case kCurvature: value = getCurvature(); break;
107  case kP: value = getP(); break;
108  case kPt: value = getPt(); break;
109  case kRapidity: value = getRapidity(); break;
110  case kPseudoRapidity: value = getPseudoRapidity(); break;
111  case kPhi: value = getPhi(); break;
112  case kTanL: value = getTanL(); break;
113  default: value = -999999.; break;
114  }
115  return value;
116 }
117 //______________________________________________________________________________
118 StiTrack &StiTrack::operator=(const StiTrack &tk)
119 {
120  mId = tk.mId;
121  return *this;
122 }
123 
124 
virtual int getCharge() const =0
Get charge of the particle that produced this track.
virtual double getChi2() const =0
Get chi2 of this track.
Abstract definition of a Track.
Definition: StiTrack.h:59
virtual bool find(StiTrack *track, int direction, double rmin=0)
Find/extend the given track, in the given direction.
An abstract class defining the interface to the track finder.
virtual double getMass() const =0
Get mass of the particle that produced this track.