CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include "SeedFromConsecutiveHitsTripletOnlyCreator.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 #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h"
00010 
00011 
00012 GlobalTrajectoryParameters SeedFromConsecutiveHitsTripletOnlyCreator::initialKinematic(
00013       const SeedingHitSet& hits, 
00014       const TrackingRegion & region, 
00015       const edm::EventSetup& es) const
00016 {
00017   GlobalTrajectoryParameters kine;
00018 
00019   const TransientTrackingRecHit::ConstRecHitPointer& tth1 = hits[0];
00020   const TransientTrackingRecHit::ConstRecHitPointer& tth2 = hits[1];
00021   const TransientTrackingRecHit::ConstRecHitPointer& tth3 = hits[2];
00022 
00023   FastHelix helix(tth3->globalPosition(), tth2->globalPosition(), tth1->globalPosition(), es, tth1->globalPosition());
00024   kine = helix.stateAtVertex().parameters();
00025 
00026   edm::ESHandle<MagneticField> bfield;
00027   es.get<IdealMagneticFieldRecord>().get(bfield);
00028   bool isBOFF = ( std::abs(bfield->inTesla(GlobalPoint(0,0,0)).z()) < 1e-3 );
00029   if (isBOFF && (theBOFFMomentum > 0)) {
00030     kine = GlobalTrajectoryParameters(kine.position(),
00031                               kine.momentum().unit() * theBOFFMomentum,
00032                               kine.charge(),
00033                               &*bfield);
00034   }
00035   return kine;
00036 }