CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/RecoVertex/KinematicFitPrimitives/src/TransientTrackKinematicStateBuilder.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFitPrimitives/interface/TransientTrackKinematicStateBuilder.h"
00002 
00003 using namespace reco;
00004 
00005 
00006 KinematicState TransientTrackKinematicStateBuilder::operator()(const TransientTrack& track, 
00007                                          const ParticleMass& m, float m_sigma) const 
00008 { 
00009 // FreeTrajectoryState * recState = track.impactPointState().freeState(); 
00010  return buildState(*(track.impactPointState().freeState()), m, m_sigma);
00011 } 
00012 
00013 KinematicState
00014 TransientTrackKinematicStateBuilder::operator()(const KinematicParameters& par,
00015         const KinematicParametersError& er, const TrackCharge& ch,
00016         const MagneticField* field) const
00017 {
00018   return KinematicState(par, er, ch, field);
00019 }
00020  
00021 KinematicState TransientTrackKinematicStateBuilder::operator()(const TransientTrack& track, 
00022                           const GlobalPoint& point, const ParticleMass& m,float m_sigma) const
00023 {
00024 //  FreeTrajectoryState  recState = track.trajectoryStateClosestToPoint(point).theState();
00025  return buildState( track.trajectoryStateClosestToPoint(point).theState(), m, m_sigma);
00026 } 
00027 
00028 KinematicState TransientTrackKinematicStateBuilder::operator()(const FreeTrajectoryState& state,
00029                         const ParticleMass& mass,float m_sigma) const
00030 {
00031 //building initial kinematic state 
00032  return buildState(state,mass,m_sigma); 
00033 }
00034 
00035 KinematicState TransientTrackKinematicStateBuilder::operator()(const FreeTrajectoryState& state,
00036                         const ParticleMass& mass,float m_sigma, const GlobalPoint& point) const
00037 {
00038 //building initial kinematic state 
00039  KinematicState res = buildState(state,mass,m_sigma);
00040  
00041 //and propagating it to given point if needed
00042  GlobalPoint inPos = state.position();
00043  if((inPos.x() != point.x())||(inPos.y() != point.y())||(inPos.z() != point.z()))
00044  {res = propagator.propagateToTheTransversePCA(res,point);}  
00045  return res; 
00046 }
00047                             
00048 PerigeeKinematicState TransientTrackKinematicStateBuilder::operator()(const KinematicState& state, 
00049                                                                   const GlobalPoint& point)const
00050 {
00051  KinematicState nState = propagator.propagateToTheTransversePCA(state, point);
00052  return PerigeeKinematicState(nState, point);
00053 }       
00054 using namespace std;
00055 KinematicState
00056 TransientTrackKinematicStateBuilder::buildState(const FreeTrajectoryState & state, 
00057         const ParticleMass& mass, float m_sigma) const
00058 { 
00059  AlgebraicVector7 par;
00060  AlgebraicSymMatrix77 cov;
00061  par(0) = state.position().x();
00062  par(1) = state.position().y();
00063  par(2) = state.position().z();
00064       
00065 //getting the state of TransientTrack at the point
00066  par(3) = state.momentum().x();
00067  par(4) = state.momentum().y();
00068  par(5) = state.momentum().z();
00069  par(6) = mass;
00070 
00071 //cartesian covariance matrix (x,y,z,p_x,p_y,p_z)
00072 //and mass-related components stays unchanged
00073 // if(!state.hasCartesianError()) throw VertexException("KinematicStateClosestToPointBuilder:: FTS passed has no error matrix!");
00074 
00075   FreeTrajectoryState curvFts(state.parameters(), state.curvilinearError());
00076 
00077 //   cout <<"Transformation\n"<<curvFts.cartesianError().matrix()<<endl;
00078  cov.Place_at(curvFts.cartesianError().matrix(),0,0);
00079  cov(6,6) = m_sigma * m_sigma;
00080 
00081 //making parameters & error
00082  KinematicParameters wPar(par);
00083  KinematicParametersError wEr(cov);
00084  return KinematicState(wPar,wEr,state.charge(), &state.parameters().magneticField());
00085 }