/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/TrkFitter/TrkFitter-00-01-11/src/TrkSimpleRep.cxx

Go to the documentation of this file.
00001 // File and Version Information:
00002 //      $Id: TrkSimpleRep.cxx,v 1.1.1.1 2005/04/21 06:26:56 maqm Exp $
00003 //
00004 // Description:
00005 //      implementation for TrkSimpleHelix
00006 //
00007 // Author(s): Steve Schaffner
00008 //------------------------------------------------------------------------
00009 //#include "BaBar/BaBar.h"
00010 #include "TrkFitter/TrkSimpleRep.h"
00011 #include "TrkBase/TrkHitOnTrk.h"
00012 #include "TrkBase/TrkSimpTraj.h"
00013 #include "TrkBase/TrkParams.h"
00014 #include "TrkBase/TrkPoca.h"
00015 #include "TrkBase/TrkMomCalculator.h"
00016 #include "TrkBase/TrkRecoTrk.h"
00017 #include "BField/BField.h"//yzhang debug
00018 class BField;
00019 #include "TrkBase/TrkErrCode.h"
00020 #include "MdcRecoUtil/BesVectorErr.h"
00021 #include "MdcRecoUtil/BesPointErr.h"
00022 #include "CLHEP/Vector/ThreeVector.h"
00023 
00024 TrkSimpleRep::TrkSimpleRep(const TrkHotList* inHots,
00025                            TrkRecoTrk* trk, PdtPid::PidType hypo) :
00026   TrkRep(inHots, trk, hypo)
00027 {
00028   setChisq(-1.);
00029 }
00030 
00031 TrkSimpleRep::TrkSimpleRep(TrkRecoTrk* trk, PdtPid::PidType hypo, int nact,
00032                            int nsv, int ndc, double chi2,
00033                            double stFndRng, double endFndRng) :
00034   TrkRep(trk, hypo, nact, nsv, ndc, stFndRng, endFndRng)
00035 {
00036   setChisq(chi2);
00037 }
00038 
00039 // copy ctor
00040 TrkSimpleRep::TrkSimpleRep(const TrkSimpleRep& right,
00041                            TrkRecoTrk* trk, PdtPid::PidType hypo)  :
00042   TrkRep(right, trk, hypo), _fitter(right._fitter), _chisq(right._chisq)
00043 {
00044   _hotList.reset( right.hotList()->clone(this) );
00045 }
00046 
00047 TrkSimpleRep::~TrkSimpleRep()
00048 {
00049 }
00050 
00051 TrkSimpleRep&
00052 TrkSimpleRep::operator=(const TrkSimpleRep &right)
00053 {
00054   _chisq = right._chisq;
00055   TrkRep::operator=(right);
00056   return *this;
00057 }
00058 
00059 TrkErrCode
00060 TrkSimpleRep::fit()
00061 {
00062   if (!hitCapable()) {
00063     setValid(false);
00064     return TrkErrCode(TrkErrCode::fail,100,
00065                       "Tried to fit without a list of hits.");
00066   }
00067   TrkErrCode error = _fitter.fit(*hotList(), simpTraj());
00068   if (error.failure()) {
00069     setValid(false);
00070   }
00071   else {
00072     setValid(true);
00073     setCurrent(true);
00074   }
00075   setChisq(_fitter.lastChisq());
00076   return error;
00077 }
00078 
00079 int
00080 TrkSimpleRep::nDof() const
00081 {
00082   return nActive() - simpTraj().parameters()->nPar();
00083 }
00084 
00085 double
00086 TrkSimpleRep::chisq() const
00087 {
00088   // Note possible inefficiency in calling virtual simpTraj(); implementation 
00089   //    could be moved to derived classes instead.  
00090   return _chisq;
00091   //  return simpTraj().parameters()->chisquared();
00092 }
00093 
00094 void
00095 TrkSimpleRep::setChisq(double c)
00096 {
00097   // See inefficiency comment above.
00098   //  simpTraj().parameters()->setChisquared(c);
00099   _chisq = c;
00100 }
00101 
00102 Hep3Vector
00103 TrkSimpleRep::momentum(double fltL) const
00104 {
00105   const BField& theField = parentTrack()->bField();
00106   return TrkMomCalculator::vecMom(simpTraj(), theField, fltL);
00107 }
00108 
00109 double
00110 TrkSimpleRep::pt(double fltL) const
00111 {
00112   const BField& theField = parentTrack()->bField();
00113   return TrkMomCalculator::ptMom(simpTraj(), theField, fltL);
00114 }
00115 
00116 int
00117 TrkSimpleRep::charge() const
00118 {
00119   const BField& theField = parentTrack()->bField();
00120   return TrkMomCalculator::charge(simpTraj(), theField, 0.);
00121 }
00122 
00123 BesVectorErr
00124 TrkSimpleRep::momentumErr(double fltL) const
00125 {
00126   const BField& theField = parentTrack()->bField();
00127   return TrkMomCalculator::errMom(simpTraj(), theField, fltL);
00128 }
00129 
00130 /*
00131  * added on 7/17/98 to accomplish vertexing interface (M.Bondioli)
00132  * implementation temporarily needed to assure no compile crashes
00133  * elsewhere.
00134  */
00135 
00136 HepMatrix
00137 TrkSimpleRep::posmomCov(double fltL) const
00138 {
00139   const BField& theField = parentTrack()->bField();
00140   return TrkMomCalculator::posmomCov(simpTraj(), theField, fltL);
00141 }
00142 
00143 void
00144 TrkSimpleRep::getAllCovs(double fltL,
00145                         HepSymMatrix& xxCov,
00146                         HepSymMatrix& ppCov,
00147                         HepMatrix&    xpCov) const
00148 {
00149   const BField& theField = parentTrack()->bField();
00150   TrkMomCalculator::getAllCovs(simpTraj(), theField, fltL,
00151                                xxCov,ppCov,xpCov);
00152 }
00153 
00154 void TrkSimpleRep::getAllWeights(double fltL,
00155                                  HepVector& pos,
00156                                  HepVector& mom,
00157                                  HepSymMatrix& xxWeight,
00158                                  HepSymMatrix& ppWeight,
00159                                  HepMatrix&    xpWeight) const
00160 {
00161   const BField& theField = parentTrack()->bField();
00162   TrkMomCalculator::getAllWeights(simpTraj(), theField, fltL,
00163                                    pos,mom,xxWeight,ppWeight,xpWeight);
00164 }
00165 
00166 void TrkSimpleRep::getAllWeights(const HepPoint3D& pt,
00167                                  HepVector& pos,
00168                                  HepVector& mom,
00169                                  HepSymMatrix& xxWeight,
00170                                  HepSymMatrix& ppWeight,
00171                                  HepMatrix&    xpWeight)const
00172 {
00173   double fltL=0;
00174   TrkPoca poca(traj(),fltL, pt);
00175   fltL = poca.flt1();
00176   getAllWeights(fltL,pos,mom,xxWeight,ppWeight,xpWeight);
00177 }

Generated on Tue Nov 29 23:13:44 2016 for BOSS_7.0.2 by  doxygen 1.4.7