00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "MdcRecoUtil/Pdt.h"
00010 #include "MdcRecoUtil/PdtEntry.h"
00011 #include "TrkFitter/TrkLineRep.h"
00012 #include "TrkBase/TrkSimpTraj.h"
00013 #include "TrkBase/TrkRecoTrk.h"
00014 #include "TrkBase/TrkExchangePar.h"
00015 #include "MdcGeom/BesAngle.h"
00016 using std::endl;
00017 using std::ostream;
00018
00019
00020
00021 TrkLineRep::TrkLineRep(const TrkExchangePar& inPar,
00022 TrkRecoTrk* trk,
00023 PdtPid::PidType hypo,
00024 const TrkHotList* inHots) :
00025 TrkSimpleRep(inHots, trk, hypo),
00026 _traj(inPar)
00027
00028 {
00029 }
00030
00031
00032 TrkLineRep::TrkLineRep(const TrkExchangePar& inPar, TrkRecoTrk* trk,
00033 PdtPid::PidType hypo, int nact, int nsv, int ndc, double chi2,
00034 double stFndRng, double endFndRng) :
00035 TrkSimpleRep(trk, hypo, nact, nsv, ndc, chi2, stFndRng, endFndRng),
00036 _traj(inPar)
00037 {
00038 }
00039
00040
00041 TrkLineRep::TrkLineRep(const TrkLineRep& right, TrkRecoTrk* trk,
00042 PdtPid::PidType hypo) :
00043 TrkSimpleRep(right, trk, hypo), _traj(right._traj)
00044 {
00045 }
00046
00047 TrkLineRep::~TrkLineRep()
00048 {
00049 }
00050
00051 TrkLineRep*
00052 TrkLineRep::clone(TrkRecoTrk* theTrack) const
00053 {
00054 TrkLineRep* newRep = new TrkLineRep(*this, theTrack, this->particleType());
00055 newRep->setValid(fitValid());
00056 newRep->setCurrent(fitCurrent());
00057 return newRep;
00058 }
00059
00060 TrkLineRep*
00061 TrkLineRep::cloneNewHypo(PdtPid::PidType hypo)
00062 {
00063 TrkLineRep* newRep = new TrkLineRep(*this, parentTrack(), hypo);
00064 newRep->setValid(fitValid());
00065 newRep->setCurrent(fitCurrent());
00066 return newRep;
00067 }
00068
00069 TrkExchangePar
00070 TrkLineRep::helix(double ) const
00071 {
00072 TrkExchangePar localPar(_traj.d0(), BesAngle(_traj.phi0()).rad(),
00073 0.0, _traj.z0(), _traj.tanDip());
00074 const HepSymMatrix& lineCov = _traj.parameters()->covariance();
00075 HepSymMatrix& theCov = localPar.covariance();
00076 int ex_d0 = TrkExchangePar::ex_d0 + 1;
00077 int ex_phi0 = TrkExchangePar::ex_phi0 + 1;
00078 int ex_z0 = TrkExchangePar::ex_z0 + 1;
00079 int ex_tD = TrkExchangePar::ex_tanDip + 1;
00080
00081 int ln_d0 = TrkDifLineTraj::d0Ind + 1;
00082 int ln_phi0 = TrkDifLineTraj::phi0Ind + 1;
00083 int ln_z0 = TrkDifLineTraj::z0Ind + 1;
00084 int ln_tD = TrkDifLineTraj::tanDipInd +1;
00085
00086 theCov(ex_d0, ex_d0) = lineCov(ln_d0, ln_d0);
00087 theCov(ex_phi0, ex_d0) = lineCov(ln_phi0, ln_d0);
00088 theCov(ex_phi0, ex_phi0) = lineCov(ln_phi0, ln_phi0);
00089 theCov(ex_z0, ex_d0) = lineCov(ln_z0, ln_d0);
00090 theCov(ex_z0, ex_phi0) = lineCov(ln_z0, ln_phi0);
00091 theCov(ex_z0, ex_z0) = lineCov(ln_z0, ln_z0);
00092 theCov(ex_tD, ex_d0) = lineCov(ln_tD, ln_d0);
00093 theCov(ex_tD, ex_phi0) = lineCov(ln_tD, ln_phi0);
00094 theCov(ex_tD, ex_z0) = lineCov(ln_tD, ln_z0);
00095 theCov(ex_tD, ex_tD) = lineCov(ln_tD, ln_tD);
00096
00097 return localPar;
00098 }
00099
00100 void
00101 TrkLineRep::print(ostream& ostr) const
00102 {
00103 ostr <<"TrkLineRep "
00104 << "phi0: " << BesAngle(_traj.phi0()).rad()
00105 << " om: " << 0.0
00106 << " d0: " << _traj.d0()
00107 << " z0: " << _traj.z0()
00108 << " tnDip: " << _traj.tanDip()
00109 << endl;
00110 }
00111
00112 void
00113 TrkLineRep::printAll(ostream& ostr) const
00114 {
00115 print(ostr);
00116 }
00117
00118 TrkSimpTraj&
00119 TrkLineRep::simpTraj()
00120 {
00121 return _traj;
00122 }
00123
00124 const TrkSimpTraj&
00125 TrkLineRep::simpTraj() const
00126 {
00127 return _traj;
00128 }
00129
00130 TrkDifTraj&
00131 TrkLineRep::traj()
00132 {
00133 return _traj;
00134 }
00135
00136 const TrkDifTraj&
00137 TrkLineRep::traj() const
00138 {
00139 return _traj;
00140 }
00141
00142 double
00143 TrkLineRep::arrivalTime(double fltL) const
00144 {
00145 static double cinv = 1./Constants::c;
00146 double m_betainv=-9999.;
00147
00148 if (m_betainv < 0.0) {
00149 double mass2 = Pdt::lookup(PdtPid::muon)->mass();
00150 mass2 = mass2 * mass2;
00151 double ptot2 = 100.;
00152
00153 assert(ptot2 != 0.0);
00154 m_betainv = sqrt( (ptot2 + mass2)/ ptot2);
00155 }
00156 double tof = fltL * m_betainv * cinv;
00157 return trackT0() + tof;
00158 }