CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/FastSimulation/ParticlePropagator/plugins/MagneticFieldMapESProducer.cc

Go to the documentation of this file.
00001 #include "FastSimulation/ParticlePropagator/plugins/MagneticFieldMapESProducer.h"
00002 #include "FastSimulation/TrackerSetup/interface/TrackerInteractionGeometryRecord.h"
00003 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00004 
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/ModuleFactory.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 
00009 #include <memory>
00010 
00011 MagneticFieldMapESProducer::MagneticFieldMapESProducer(const edm::ParameterSet & p) 
00012 {
00013     setWhatProduced(this);
00014     _label = p.getUntrackedParameter<std::string>("trackerGeometryLabel","");
00015 
00016     //    theTrackerMaterial = p.getParameter<edm::ParameterSet>("TrackerMaterial");
00017 
00018 }
00019 
00020 MagneticFieldMapESProducer::~MagneticFieldMapESProducer() {}
00021 
00022 boost::shared_ptr<MagneticFieldMap> 
00023 MagneticFieldMapESProducer::produce(const MagneticFieldMapRecord & iRecord){ 
00024 
00025   edm::ESHandle<TrackerInteractionGeometry> theInteractionGeometry;
00026   edm::ESHandle<MagneticField> theMagneticField;
00027   
00028   iRecord.getRecord<TrackerInteractionGeometryRecord>().get(_label, theInteractionGeometry );
00029   iRecord.getRecord<IdealMagneticFieldRecord>().get(theMagneticField );
00030 
00031   _map = boost::shared_ptr<MagneticFieldMap>
00032     (new MagneticFieldMap(&(*theMagneticField),&(*theInteractionGeometry)));
00033 
00034   return _map;
00035 
00036 }
00037 
00038 
00039 DEFINE_FWK_EVENTSETUP_MODULE(MagneticFieldMapESProducer);