CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoVertex/LinearizationPointFinders/src/FallbackLinearizationPointFinder.cc

Go to the documentation of this file.
00001 #include "RecoVertex/LinearizationPointFinders/interface/FallbackLinearizationPointFinder.h"
00002 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00003 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00004 #include "RecoVertex/VertexTools/interface/FsmwModeFinder3d.h"
00005 
00006 FallbackLinearizationPointFinder::FallbackLinearizationPointFinder ( 
00007     const ModeFinder3d & m ) : theModeFinder ( m.clone() ) {}
00008 
00009 GlobalPoint FallbackLinearizationPointFinder::getLinearizationPoint(
00010     const std::vector<FreeTrajectoryState> & tracks ) const
00011 {
00012   return GlobalPoint(0.,0.,0.);
00013 }
00014 
00015 GlobalPoint FallbackLinearizationPointFinder::getLinearizationPoint(
00016     const std::vector<reco::TransientTrack> & tracks ) const
00017 {
00018     switch ( tracks.size() )
00019     {
00020       case 0:
00021         return GlobalPoint ( 0.,0.,0. );
00022       case 1:
00023         return tracks.begin()->impactPointState().globalPosition();
00024       default:
00025       {
00026         std::vector < std::pair < GlobalPoint, float > > wtracks;
00027         wtracks.reserve ( tracks.size() - 1 );
00028         for ( std::vector< reco::TransientTrack >::const_iterator i=tracks.begin(); 
00029               i!=tracks.end() ; ++i )
00030         {
00031             std::pair < GlobalPoint, float > tmp ( 
00032                 i->impactPointState().globalPosition(), 1. );
00033             wtracks.push_back ( tmp );
00034         }
00035         return (*theModeFinder) ( wtracks );
00036       }
00037     }
00038   return GlobalPoint ( 0.,0.,0. );
00039 }