00001 #include "TrackingTools/Producers/interface/AnalyticalPropagatorESProducer.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 AnalyticalPropagatorESProducer::AnalyticalPropagatorESProducer(const edm::ParameterSet & p) 00016 { 00017 std::string myname = p.getParameter<std::string>("ComponentName"); 00018 pset_ = p; 00019 setWhatProduced(this,myname); 00020 } 00021 00022 AnalyticalPropagatorESProducer::~AnalyticalPropagatorESProducer() {} 00023 00024 boost::shared_ptr<Propagator> 00025 AnalyticalPropagatorESProducer::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 00033 std::string pdir = pset_.getParameter<std::string>("PropagationDirection"); 00034 double dphiCut = pset_.getParameter<double>("MaxDPhi"); 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 AnalyticalPropagator(&(*magfield), dir,dphiCut)); 00043 return _propagator; 00044 } 00045 00046