CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoVertex/KinematicFitPrimitives/src/PerigeeKinematicState.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFitPrimitives/interface/PerigeeKinematicState.h"
00002 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicPerigeeConversions.h"
00003 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToCurvilinear.h"
00004 #include "TrackingTools/TrajectoryState/interface/PerigeeConversions.h"
00005 
00006 PerigeeKinematicState::PerigeeKinematicState(const KinematicState& state, const GlobalPoint& pt):
00007  point(pt), inState(state),  errorIsAvailable(true),vl(true)
00008 {
00009  if(!(state.isValid())) throw VertexException("PerigeeKinematicState::kinematic state passed is not valid!");
00010 
00011 //working with parameters:
00012  KinematicPerigeeConversions conversions;
00013  par  = conversions.extendedPerigeeFromKinematicParameters(state,pt);
00014    
00015 //creating the error
00016  AlgebraicSymMatrix77 err = state.kinematicParametersError().matrix();
00017 
00018 //making jacobian for curvilinear frame
00019  JacobianCartesianToCurvilinear jj(state.freeTrajectoryState().parameters());  
00020  AlgebraicMatrix67 ki2cu;
00021  ki2cu.Place_at(jj.jacobian(),0,0);
00022  ki2cu(5,6) = 1.;
00023  AlgebraicMatrix66 cu2pe;
00024  PerigeeConversions pc;
00025  cu2pe.Place_at(pc.jacobianCurvilinear2Perigee(state.freeTrajectoryState()),0,0);
00026  cu2pe(5,5) = 1.;
00027  AlgebraicMatrix67 jacobian = cu2pe*ki2cu;
00028 
00029  cov = ExtendedPerigeeTrajectoryError(ROOT::Math::Similarity(jacobian, err));
00030 
00031 }
00032 
00033 /*
00034 AlgebraicMatrix PerigeeKinematicState::jacobianKinematicToExPerigee(const KinematicState& state,
00035                                                                     const GlobalPoint& pt)const
00036 {
00037  
00038  AlgebraicMatrix jac(6,7,0);
00039  jac(6,7) = 1;
00040  jac(5,3) = 1;
00041  AlgebraicVector par = state.kinematicParameters().vector();
00042  GlobalVector impactDistance = state.globalPosition() - point;
00043  double field = TrackingTools::FakeField::Field::inGeVPerCentimeter(state.globalPosition()).z();
00044  double signTC = -state.particleCharge();
00045  double theta = state.globalMomentum().theta();
00046  double phi = state.globalMomentum().phi();
00047  double ptr  = state.globalMomentum().transverse();
00048  double transverseCurvature = field/ptr*signTC;
00049 //making a proper sign for epsilon
00050  double positiveMomentumPhi  = ((phi>0) ? phi : (2*M_PI + phi)); 
00051  double positionPhi = impactDistance.phi();
00052  double positivePositionPhi =
00053    ( (positionPhi>0) ? positionPhi : (2*M_PI+positionPhi) );
00054  double phiDiff = positiveMomentumPhi - positivePositionPhi;
00055  if (phiDiff<0.0) phiDiff+= (2*M_PI);
00056  double signEpsilon = ( (phiDiff > M_PI) ? -1.0 : 1.0);
00057 
00058  double epsilon = signEpsilon *
00059                   sqrt(impactDistance.x()*impactDistance.x() +
00060                        impactDistance.y()*impactDistance.y());
00061 
00062 //jacobian corrections
00063 
00064 //  jac(1,4) = -(field*signTC/(transverseCurvature*transverseCurvature))* cos(phi);
00065 //  jac(1,5) = -(field*signTC/(transverseCurvature*transverseCurvature))* sin(phi);
00066 //  jac(1,6) = -(field*signTC/(transverseCurvature*transverseCurvature))*tan(theta);
00067  
00068  jac(1,4) = (1/ptr*signTC) * cos(phi);
00069  jac(1,5) = (1/ptr*signTC) * sin(phi);
00070  jac(1,6) = (1/ptr*signTC) * tan(theta);
00071  
00072  jac(2,6) = (ptr)/(cos(theta) * cos(theta));
00073  jac(3,1) = - epsilon * cos(phi);
00074  jac(3,2) = - epsilon * sin(phi);
00075 
00076 
00077 // jac(3,4) = 
00078  jac(3,4) = - ptr * sin(phi);
00079  jac(3,5) =  ptr * cos(phi);
00080  jac(4,1) = - sin(phi);
00081  jac(4,2) =  cos(phi);
00082  return jac;
00083  
00084 }
00085 
00086 
00087 
00088 AlgebraicMatrix PerigeeKinematicState::jacobianExPerigeeToKinematic(const ExtendedPerigeeTrajectoryParameters& state, 
00089                                                                     const GlobalPoint& point)const
00090 {
00091 
00092  AlgebraicMatrix jac(7,6,0);
00093  return jac;
00094  
00095 }
00096 */
00097 //temporary method move