CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkLineRep.cxx
Go to the documentation of this file.
1// File and Version Information:
2// $Id
3//
4// Description:
5// Implements circle track representation
6//
7// Author(s): Steve Schaffner
8//------------------------------------------------------------------------
9#include "MdcRecoUtil/Pdt.h"
12#include "TrkBase/TrkSimpTraj.h"
13#include "TrkBase/TrkRecoTrk.h"
15#include "MdcGeom/BesAngle.h"
16using std::endl;
17using std::ostream;
18
19// Construct from exchange paramters
20
22 TrkRecoTrk* trk,
23 PdtPid::PidType hypo,
24 const TrkHotList* inHots) :
25 TrkSimpleRep(inHots, trk, hypo),
26 _traj(inPar)
27
28{
29}
30
31// Construct from exchange paramters, no hits
33 PdtPid::PidType hypo, int nact, int nsv, int ndc, double chi2,
34 double stFndRng, double endFndRng) :
35 TrkSimpleRep(trk, hypo, nact, nsv, ndc, chi2, stFndRng, endFndRng),
36 _traj(inPar)
37{
38}
39
40// copy ctor
42 PdtPid::PidType hypo) :
43 TrkSimpleRep(right, trk, hypo), _traj(right._traj)
44{
45}
46
48{
49}
50
53{
54 TrkLineRep* newRep = new TrkLineRep(*this, theTrack, this->particleType());
55 newRep->setValid(fitValid());
56 newRep->setCurrent(fitCurrent());
57 return newRep;
58}
59
62{
63 TrkLineRep* newRep = new TrkLineRep(*this, parentTrack(), hypo);
64 newRep->setValid(fitValid());
65 newRep->setCurrent(fitCurrent()); // true for lines, anyway
66 return newRep;
67}
68
70TrkLineRep::helix(double ) const
71{
72 TrkExchangePar localPar(_traj.d0(), BesAngle(_traj.phi0()).rad(),
73 0.0, _traj.z0(), _traj.tanDip());
74 const HepSymMatrix& lineCov = _traj.parameters()->covariance();
75 HepSymMatrix& theCov = localPar.covariance();
76 int ex_d0 = TrkExchangePar::ex_d0 + 1;
77 int ex_phi0 = TrkExchangePar::ex_phi0 + 1;
78 int ex_z0 = TrkExchangePar::ex_z0 + 1;
79 int ex_tD = TrkExchangePar::ex_tanDip + 1;
80
81 int ln_d0 = TrkDifLineTraj::d0Ind + 1;
82 int ln_phi0 = TrkDifLineTraj::phi0Ind + 1;
83 int ln_z0 = TrkDifLineTraj::z0Ind + 1;
84 int ln_tD = TrkDifLineTraj::tanDipInd +1;
85
86 theCov(ex_d0, ex_d0) = lineCov(ln_d0, ln_d0);
87 theCov(ex_phi0, ex_d0) = lineCov(ln_phi0, ln_d0);
88 theCov(ex_phi0, ex_phi0) = lineCov(ln_phi0, ln_phi0);
89 theCov(ex_z0, ex_d0) = lineCov(ln_z0, ln_d0);
90 theCov(ex_z0, ex_phi0) = lineCov(ln_z0, ln_phi0);
91 theCov(ex_z0, ex_z0) = lineCov(ln_z0, ln_z0);
92 theCov(ex_tD, ex_d0) = lineCov(ln_tD, ln_d0);
93 theCov(ex_tD, ex_phi0) = lineCov(ln_tD, ln_phi0);
94 theCov(ex_tD, ex_z0) = lineCov(ln_tD, ln_z0);
95 theCov(ex_tD, ex_tD) = lineCov(ln_tD, ln_tD);
96
97 return localPar;
98}
99
100void
101TrkLineRep::print(ostream& ostr) const
102{
103 ostr <<"TrkLineRep "
104 << "phi0: " << BesAngle(_traj.phi0()).rad()
105 << " om: " << 0.0
106 << " d0: " << _traj.d0()
107 << " z0: " << _traj.z0()
108 << " tnDip: " << _traj.tanDip()
109 << endl;
110}
111
112void
113TrkLineRep::printAll(ostream& ostr) const
114{
115 print(ostr);
116}
117
120{
121 return _traj;
122}
123
124const TrkSimpTraj&
126{
127 return _traj;
128}
129
132{
133 return _traj;
134}
135
136const TrkDifTraj&
138{
139 return _traj;
140}
141
142double
143TrkLineRep::arrivalTime(double fltL) const
144{
145 static double cinv = 1./Constants::c;
146 double m_betainv=-9999.;
147 // Initialize cache
148 if (m_betainv < 0.0) {
149 double mass2 = Pdt::lookup(PdtPid::muon)->mass();
150 mass2 = mass2 * mass2;
151 double ptot2 = 100.; //10GeV;
152 //double ptot2 = momentum(0.).mag2();
153 assert(ptot2 != 0.0);
154 m_betainv = sqrt( (ptot2 + mass2)/ ptot2);
155 }
156 double tof = fltL * m_betainv * cinv;
157 return trackT0() + tof;
158}
double rad() const
Definition: BesAngle.h:118
static const double c
Definition: Constants.h:43
float mass() const
Definition: PdtEntry.h:55
PidType
Definition: PdtPid.h:11
@ muon
Definition: PdtPid.h:14
static PdtEntry * lookup(const std::string &name)
Definition: Pdt.cxx:207
double d0() const
double phi0() const
double tanDip() const
double z0() const
const HepSymMatrix & covariance() const
void setValid(bool v)
bool fitValid() const
Definition: TrkFitStatus.h:34
bool fitCurrent() const
Definition: TrkFitStatus.h:33
void setCurrent(bool c)
Definition: TrkFitStatus.h:39
virtual void print(std::ostream &ostr) const
Definition: TrkLineRep.cxx:101
virtual TrkLineRep * clone(TrkRecoTrk *newTrack) const
Definition: TrkLineRep.cxx:52
virtual TrkExchangePar helix(double fltLen) const
Definition: TrkLineRep.cxx:70
virtual TrkDifTraj & traj()
Definition: TrkLineRep.cxx:131
double arrivalTime(double fltLen) const
Definition: TrkLineRep.cxx:143
virtual void printAll(std::ostream &ostr) const
Definition: TrkLineRep.cxx:113
virtual TrkLineRep * cloneNewHypo(PdtPid::PidType hypo)
Definition: TrkLineRep.cxx:61
TrkLineRep(const TrkExchangePar &inPar, TrkRecoTrk *myTrack, PdtPid::PidType hypo, const TrkHotList *=0)
Definition: TrkLineRep.cxx:21
virtual ~TrkLineRep()
Definition: TrkLineRep.cxx:47
virtual TrkSimpTraj & simpTraj()
Definition: TrkLineRep.cxx:119
HepSymMatrix & covariance()
Definition: TrkParams.h:54
double trackT0() const
Definition: TrkRep.cxx:208
TrkRecoTrk * parentTrack()
Definition: TrkRep.h:82
virtual PdtPid::PidType particleType() const
Definition: TrkRep.cxx:308
TrkParams * parameters()
Definition: TrkSimpTraj.h:80