Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:17

0001 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicRefittedTrackState.h"
0002 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
0003 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0004 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicPerigeeConversions.h"
0005 
0006 KinematicRefittedTrackState::KinematicRefittedTrackState(const KinematicState& st, const AlgebraicVector4& mv) {
0007   state = st;
0008   momentumAtVertex = mv;
0009 }
0010 
0011 AlgebraicVector6 KinematicRefittedTrackState::parameters() const {
0012   KinematicPerigeeConversions conv;
0013   return conv.extendedPerigeeFromKinematicParameters(state, state.globalPosition()).vector();
0014 }
0015 
0016 AlgebraicSymMatrix66 KinematicRefittedTrackState::covariance() const {
0017   throw VertexException("KinematicRefittedTrackState::Fishy covariance called");
0018   return AlgebraicSymMatrix66();
0019 }
0020 
0021 AlgebraicVector7 KinematicRefittedTrackState::kinematicParameters() const {
0022   return state.kinematicParameters().vector();
0023 }
0024 
0025 AlgebraicSymMatrix77 KinematicRefittedTrackState::kinematicParametersCovariance() const {
0026   return state.kinematicParametersError().matrix();
0027 }
0028 
0029 FreeTrajectoryState KinematicRefittedTrackState::freeTrajectoryState() const { return state.freeTrajectoryState(); }
0030 
0031 GlobalPoint KinematicRefittedTrackState::position() const { return state.globalPosition(); }
0032 
0033 AlgebraicVector4 KinematicRefittedTrackState::kinematicMomentumVector() const {
0034   GlobalVector mm = state.globalMomentum();
0035   AlgebraicVector4 mr;
0036   mr[0] = mm.x();
0037   mr[1] = mm.y();
0038   mr[2] = mm.z();
0039   mr[3] = state.mass();
0040   return mr;
0041 }
0042 
0043 AlgebraicVector4 KinematicRefittedTrackState::momentumVector() const { return momentumAtVertex; }
0044 
0045 TrajectoryStateOnSurface KinematicRefittedTrackState::trajectoryStateOnSurface(const Surface& surface) const {
0046   AnalyticalPropagator thePropagator(state.magneticField(), anyDirection);
0047   return thePropagator.propagate(freeTrajectoryState(), surface);
0048 }
0049 
0050 TrajectoryStateOnSurface KinematicRefittedTrackState::trajectoryStateOnSurface(const Surface& surface,
0051                                                                                const Propagator& propagator) const {
0052   std::unique_ptr<Propagator> thePropagator(propagator.clone());
0053   thePropagator->setPropagationDirection(anyDirection);
0054   return thePropagator->propagate(freeTrajectoryState(), surface);
0055 }
0056 
0057 double KinematicRefittedTrackState::weight() const { return 1.; }
0058 
0059 ReferenceCountingPointer<RefittedTrackState<6> > KinematicRefittedTrackState::stateWithNewWeight(
0060     const double newWeight) const {
0061   std::cout << "WARNING: Change weight for Kinematic state called, weigt will stay to be equal 1." << std::endl;
0062   return RefCountedRefittedTrackState(const_cast<KinematicRefittedTrackState*>(this));
0063 }
0064 
0065 std::vector<ReferenceCountingPointer<RefittedTrackState<6> > > KinematicRefittedTrackState::components() const {
0066   std::vector<RefCountedRefittedTrackState> result;
0067   result.reserve(1);
0068   result.push_back(RefCountedRefittedTrackState(const_cast<KinematicRefittedTrackState*>(this)));
0069   return result;
0070 }
0071 
0072 reco::TransientTrack KinematicRefittedTrackState::transientTrack() const {
0073   throw VertexException("KinematicRefittedTrackState::Can Not write a TransientTrack");
0074   //  TransientTrackFromFTSFactory factory;
0075   //   return factory.build(freeTrajectoryState());
0076 }