CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/TrackingTools/Producers/src/StraightLinePropagatorESProducer.cc

Go to the documentation of this file.
00001 #include "TrackingTools/Producers/interface/StraightLinePropagatorESProducer.h"
00002 #include "MagneticField/Engine/interface/MagneticField.h"
00003 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00004 
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/ModuleFactory.h"
00008 #include "FWCore/Framework/interface/ESProducer.h"
00009 
00010 #include <string>
00011 #include <memory>
00012 
00013 using namespace edm;
00014 
00015 StraightLinePropagatorESProducer::StraightLinePropagatorESProducer(const edm::ParameterSet & p) 
00016 {
00017   std::string myname = p.getParameter<std::string>("ComponentName");
00018   pset_ = p;
00019   setWhatProduced(this,myname);
00020 }
00021 
00022 StraightLinePropagatorESProducer::~StraightLinePropagatorESProducer() {}
00023 
00024 boost::shared_ptr<Propagator> 
00025 StraightLinePropagatorESProducer::produce(const TrackingComponentsRecord & iRecord){ 
00026 //   if (_propagator){
00027 //     delete _propagator;
00028 //     _propagator = 0;
00029 //   }
00030   ESHandle<MagneticField> magfield;
00031   iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
00032  std::string pdir = pset_.getParameter<std::string>("PropagationDirection");
00033 
00034   PropagationDirection dir = alongMomentum;
00035 
00036   if (pdir == "oppositeToMomentum, alongMomentum, anyDirection")
00037     if (pdir == "oppositeToMomentum") dir = oppositeToMomentum;
00038     if (pdir == "alongMomentum") dir = alongMomentum;
00039     if (pdir == "anyDirection") dir = anyDirection;
00040   _propagator  = boost::shared_ptr<Propagator>(new StraightLinePropagator(&(*magfield),dir));
00041   return _propagator;
00042 }
00043 
00044