CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoVertex/KinematicFitPrimitives/src/KinematicRefittedTrackState.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicRefittedTrackState.h"
00002 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00003 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00004 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicPerigeeConversions.h"
00005 
00006 
00007 KinematicRefittedTrackState::KinematicRefittedTrackState(const KinematicState& st,
00008                 const AlgebraicVector4& mv)             
00009 {
00010   state = st;
00011   momentumAtVertex = mv;
00012 }
00013 
00014 AlgebraicVector6 KinematicRefittedTrackState::parameters() const
00015 {
00016   KinematicPerigeeConversions conv;
00017   return conv.extendedPerigeeFromKinematicParameters(state,state.globalPosition()).vector();
00018 }
00019   
00020 AlgebraicSymMatrix66 KinematicRefittedTrackState::covariance() const 
00021 {
00022   throw VertexException("KinematicRefittedTrackState::Fishy covariance called");
00023   return AlgebraicSymMatrix66();
00024 }
00025 
00026 AlgebraicVector7 KinematicRefittedTrackState::kinematicParameters() const
00027 {return state.kinematicParameters().vector();}
00028 
00029 AlgebraicSymMatrix77 KinematicRefittedTrackState::kinematicParametersCovariance() const
00030 {return state.kinematicParametersError().matrix();}
00031 
00032 
00033 FreeTrajectoryState KinematicRefittedTrackState::freeTrajectoryState() const
00034 {
00035  return state.freeTrajectoryState();
00036 }
00037 
00038 GlobalPoint KinematicRefittedTrackState::position() const
00039 {return state.globalPosition();}
00040 
00041 AlgebraicVector4 KinematicRefittedTrackState::kinematicMomentumVector() const
00042 {
00043  GlobalVector mm = state.globalMomentum();
00044  AlgebraicVector4 mr;
00045  mr[0] = mm.x();
00046  mr[1] = mm.y();
00047  mr[2] = mm.z();
00048  mr[3] = state.mass();
00049  return mr;
00050 }
00051 
00052 AlgebraicVector4 KinematicRefittedTrackState::momentumVector() const
00053 {
00054  return momentumAtVertex;
00055 }
00056 
00057 
00058 TrajectoryStateOnSurface KinematicRefittedTrackState::trajectoryStateOnSurface(const Surface & surface) const
00059 {
00060   AnalyticalPropagator thePropagator(state.magneticField(), anyDirection);
00061  return thePropagator.propagate(freeTrajectoryState(), surface);
00062 }
00063 
00064 TrajectoryStateOnSurface KinematicRefittedTrackState::trajectoryStateOnSurface(const Surface & surface, 
00065                                                    const Propagator & propagator) const
00066 {
00067  std::auto_ptr<Propagator> thePropagator( propagator.clone());
00068  thePropagator->setPropagationDirection(anyDirection);
00069  return thePropagator->propagate(freeTrajectoryState(), surface);
00070 }
00071                                                    
00072  double KinematicRefittedTrackState::weight() const
00073 { return 1.;}
00074 
00075 ReferenceCountingPointer<RefittedTrackState<6> >  KinematicRefittedTrackState::stateWithNewWeight
00076         (const double newWeight) const
00077 {
00078  std::cout<<"WARNING: Change weight for Kinematic state called, weigt will stay to be equal 1."<<std::endl;
00079  return RefCountedRefittedTrackState( 
00080                                 const_cast<KinematicRefittedTrackState*>(this));
00081 }
00082 
00083 std::vector< ReferenceCountingPointer<RefittedTrackState<6> > > KinematicRefittedTrackState::components() const
00084 {
00085  std::vector<RefCountedRefittedTrackState> result; result.reserve(1);
00086  result.push_back(RefCountedRefittedTrackState( 
00087                                 const_cast<KinematicRefittedTrackState*>(this)));
00088  return result;
00089 }                                                  
00090 
00091 
00092 
00093 reco::TransientTrack KinematicRefittedTrackState::transientTrack() const
00094 {
00095   throw VertexException("KinematicRefittedTrackState::Can Not write a TransientTrack");
00096 //  TransientTrackFromFTSFactory factory;
00097 //   return factory.build(freeTrajectoryState());
00098 }