StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGammaTrack.cxx
1 #include "StMuDSTMaker/COMMON/StMuTrack.h"
2 #include "StGammaTrack.h"
3 
4 ClassImp(StGammaTrack);
5 
7 // Constructor //
9 StGammaTrack::StGammaTrack()
10 {
11  id = 0;
12  flag = -1;
13  charge = 0;
14  nhits = 0;
15  dEdx = 0;
16 }
17 
19 // Overloaded Constructor //
21 StGammaTrack::StGammaTrack(StMuTrack* track)
22 {
23 
24  id = track->id();
25  flag = track->flag();
26  charge = track->charge();
27  nhits = track->nHitsFit();
28  dEdx = track->dEdx() / keV;
29  type = track->type();
30  momentum = track->momentum().xyz();
31  dca = track->dcaGlobal().xyz();
32  helix = track->helix();
33  outerHelix = track->outerHelix();
34 
35 }
36 
38 // Destructor //
40 StGammaTrack::~StGammaTrack()
41 {}
42 
43 
45 // Project the track out to radius R. See //
46 // StRoot/StEmcUtil/projection/StEmcPosition.h //
48 TVector3 StGammaTrack::positionAtRadius(Double_t radius) const
49 {
50 
51  static const pair<double, double> VALUE(999999999., 999999999.); // No solution
52 
53  if(outerHelix.origin().perp() < radius)
54  {
55 
56  pair<double, double> ss = outerHelix.pathLength(radius);
57 
58  if(finite(ss.first) && finite(ss.second) && ss != VALUE)
59  {
60 
61  double s = 0;
62 
63  if( (ss.first > 0 && ss.second > 0) || (ss.first >= 0 && ss.second < 0) )
64  {
65  s = ss.first;
66  }
67  else if(ss.first < 0 && ss.second >= 0)
68  {
69  s = ss.second;
70  }
71 
72  if(s > 0) return outerHelix.at(s).xyz();
73 
74  }
75  }
76 
77  return TVector3(0,0,0);
78 
79 }
80 
81 
83 // Project the track out to distance z //
85 TVector3 StGammaTrack::positionAtZ(Double_t z) const
86 {
87 
88  if( fabs(outerHelix.origin().z()) < fabs(z) )
89  {
90 
91  StThreeVector<double> r(0, 0, z);
92  StThreeVector<double> n(0, 0, 1);
93 
94  double s = outerHelix.pathLength(r, n);
95 
96  if (finite(s) && s != StHelix::NoSolution && s > 0)
97  {
98  return outerHelix.at(s).xyz();
99  }
100 
101  }
102 
103  return TVector3(0, 0, 0);
104 
105 }
short type() const
Returns the track type: 0=global, 1=primary, etc (see StEvent manual for type information) ...
Definition: StMuTrack.h:229
Int_t charge
track type 0=global 1=primary ...
Definition: StGammaTrack.h:40
Int_t flag
id of the track
Definition: StGammaTrack.h:38
StPhysicalHelix outerHelix
Returns inner helix (first measured point)
Definition: StGammaTrack.h:46
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
TVector3 momentum
energy loss in keV
Definition: StGammaTrack.h:43
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Definition: StHelix.cc:351
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
Definition: StMuTrack.cxx:407
UShort_t nHitsFit() const
Return total number of hits used in fit.
Definition: StMuTrack.h:239
short flag() const
Returns flag, (see StEvent manual for type information)
Definition: StMuTrack.h:230
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
const StThreeVector< double > & origin() const
-sign(q*B);
Definition: StHelix.hh:224
Int_t nhits
track charge
Definition: StGammaTrack.h:41
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:260
StPhysicalHelix helix
Distance of closest approach.
Definition: StGammaTrack.h:45
Float_t dEdx
nhits along track
Definition: StGammaTrack.h:42
Double_t dEdx() const
Returns measured dE/dx value.
Definition: StMuTrack.h:248
Int_t type
track flag
Definition: StGammaTrack.h:39
TVector3 positionAtRadius(Double_t radius) const
Returns outer helix (last measured point)
TVector3 positionAtZ(Double_t z) const
Returns (0,0,0) if failed.
StThreeVectorF dcaGlobal(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex of associated global track.
Definition: StMuTrack.cxx:371
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)
Definition: StMuTrack.cxx:412