CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoTracker/TkSeedGenerator/plugins/SeedFromConsecutiveHitsStraightLineCreator.cc

Go to the documentation of this file.
00001 #include "SeedFromConsecutiveHitsStraightLineCreator.h"
00002 
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "MagneticField/Engine/interface/MagneticField.h"
00005 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00009 
00010 
00011 GlobalTrajectoryParameters SeedFromConsecutiveHitsStraightLineCreator::initialKinematic(
00012       const SeedingHitSet & hits,
00013       const TrackingRegion & region,
00014       const edm::EventSetup& es) const
00015 {
00016   GlobalTrajectoryParameters kine;
00017 
00018   const TransientTrackingRecHit::ConstRecHitPointer& tth1 = hits[0];
00019   const TransientTrackingRecHit::ConstRecHitPointer& tth2 = hits[1];
00020 
00021   const GlobalPoint& vertexPos = region.origin();
00022   edm::ESHandle<MagneticField> bfield;
00023   es.get<IdealMagneticFieldRecord>().get(bfield);
00024 
00025   // Assume initial state is straight line passing through beam spot
00026   // with direction given by innermost two seed hits (with big uncertainty)
00027   GlobalVector initMomentum(tth2->globalPosition() - tth1->globalPosition());
00028   double rescale = 1000./initMomentum.perp();
00029   initMomentum *= rescale; // set to approximately infinite momentum
00030   TrackCharge q = 1; // irrelevant, since infinite momentum
00031   kine = GlobalTrajectoryParameters(vertexPos, initMomentum, q, &*bfield);
00032 
00033   return kine;
00034 }
00035