00001 #include "PropagatorWithMaterialESProducer.h" 00002 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.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 PropagatorWithMaterialESProducer::PropagatorWithMaterialESProducer(const edm::ParameterSet & p) 00017 { 00018 std::string myname = p.getParameter<std::string>("ComponentName"); 00019 pset_ = p; 00020 setWhatProduced(this,myname); 00021 } 00022 00023 PropagatorWithMaterialESProducer::~PropagatorWithMaterialESProducer() {} 00024 00025 boost::shared_ptr<Propagator> 00026 PropagatorWithMaterialESProducer::produce(const TrackingComponentsRecord & iRecord){ 00027 // if (_propagator){ 00028 // delete _propagator; 00029 // _propagator = 0; 00030 // } 00031 ESHandle<MagneticField> magfield; 00032 iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield ); 00033 00034 00035 std::string pdir = pset_.getParameter<std::string>("PropagationDirection"); 00036 double mass = pset_.getParameter<double>("Mass"); 00037 double maxDPhi = pset_.getParameter<double>("MaxDPhi"); 00038 bool useRK = pset_.getParameter<bool>("useRungeKutta"); 00039 bool useOldAnalPropLogic = pset_.existsAs<bool>("useOldAnalPropLogic") ? 00040 pset_.getParameter<bool>("useOldAnalPropLogic") : true; 00041 double ptMin = pset_.existsAs<double>("ptMin") ? pset_.getParameter<double>("ptMin") : -1.0; 00042 00043 PropagationDirection dir = alongMomentum; 00044 00045 if (pdir == "oppositeToMomentum") dir = oppositeToMomentum; 00046 if (pdir == "alongMomentum") dir = alongMomentum; 00047 if (pdir == "anyDirection") dir = anyDirection; 00048 00049 _propagator = boost::shared_ptr<Propagator>(new PropagatorWithMaterial(dir, mass, &(*magfield), 00050 maxDPhi,useRK,ptMin, 00051 useOldAnalPropLogic)); 00052 return _propagator; 00053 } 00054 00055