CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/Alignment/TwoBodyDecay/src/TwoBodyDecayFitter.cc

Go to the documentation of this file.
00001 #include "Alignment/TwoBodyDecay/interface/TwoBodyDecayFitter.h"
00002 
00003 TwoBodyDecayFitter::TwoBodyDecayFitter( const edm::ParameterSet & config ) :
00004   theVertexFinder( new DefaultLinearizationPointFinder() ),
00005   theLinPointFinder( new TwoBodyDecayLinearizationPointFinder( config ) ),
00006   theEstimator( new TwoBodyDecayEstimator( config ) ) {}
00007 
00008 
00009 TwoBodyDecayFitter::TwoBodyDecayFitter( const edm::ParameterSet & config,
00010                                         const LinearizationPointFinder* vf,
00011                                         const TwoBodyDecayLinearizationPointFinder* lpf,
00012                                         const TwoBodyDecayEstimator* est ) :
00013   theVertexFinder( vf->clone() ),
00014   theLinPointFinder( lpf->clone() ),
00015   theEstimator( est->clone() ) {}
00016 
00017 
00018 TwoBodyDecayFitter::~TwoBodyDecayFitter( void ) {}
00019 
00020 
00021 const TwoBodyDecay TwoBodyDecayFitter::estimate( const std::vector< reco::TransientTrack >& tracks,
00022                                                  const TwoBodyDecayVirtualMeasurement& vm ) const
00023 {
00024   // get geometrical linearization point
00025   GlobalPoint linVertex = theVertexFinder->getLinearizationPoint( tracks );
00026 
00027   // create linearized track states
00028   std::vector< RefCountedLinearizedTrackState > linTracks;
00029   linTracks.push_back( theLinTrackStateFactory.linearizedTrackState( linVertex, tracks[0] ) );
00030   linTracks.push_back( theLinTrackStateFactory.linearizedTrackState( linVertex, tracks[1] ) );
00031 
00032   // get full linearization point (geomatrical & kinematical)
00033   const TwoBodyDecayParameters linPoint = theLinPointFinder->getLinearizationPoint( linTracks, vm.primaryMass(), vm.secondaryMass() );
00034 
00035   // make the fit
00036   return theEstimator->estimate( linTracks, linPoint, vm );
00037 }
00038 
00039 
00040 const TwoBodyDecay TwoBodyDecayFitter::estimate( const std::vector< reco::TransientTrack >& tracks,
00041                                                  const std::vector< TrajectoryStateOnSurface >& tsos,
00042                                                  const TwoBodyDecayVirtualMeasurement& vm ) const
00043 {
00044   // get geometrical linearization point
00045   std::vector< FreeTrajectoryState > freeTrajStates;
00046   freeTrajStates.push_back( *tsos[0].freeState() );
00047   freeTrajStates.push_back( *tsos[1].freeState() );
00048   GlobalPoint linVertex = theVertexFinder->getLinearizationPoint( freeTrajStates );
00049 
00050   // create linearized track states
00051   std::vector< RefCountedLinearizedTrackState > linTracks;
00052   linTracks.push_back( theLinTrackStateFactory.linearizedTrackState( linVertex, tracks[0], tsos[0] ) );
00053   linTracks.push_back( theLinTrackStateFactory.linearizedTrackState( linVertex, tracks[1], tsos[1] ) );
00054 
00055   // get full linearization point (geomatrical & kinematical)
00056   const TwoBodyDecayParameters linPoint = theLinPointFinder->getLinearizationPoint( linTracks, vm.primaryMass(), vm.secondaryMass() );
00057 
00058   // make the fit
00059   return theEstimator->estimate( linTracks, linPoint, vm );
00060 }