CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TrackPropagation/Geant4e/plugins/GeantPropagatorESProducer.cc

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