00001 // system include files 00002 #include <memory> 00003 #include "boost/shared_ptr.hpp" 00004 00005 #include "SimTracker/TrackAssociatorESProducer/src/TrackAssociatorByHitsESProducer.hh" 00006 // user include files 00007 #include "FWCore/Framework/interface/ModuleFactory.h" 00008 #include "FWCore/Framework/interface/ESProducer.h" 00009 00010 #include "FWCore/Framework/interface/ESHandle.h" 00011 00012 #include "SimTracker/TrackAssociation/interface/TrackAssociatorByHits.h" 00013 #include "SimTracker/Records/interface/TrackAssociatorRecord.h" 00014 #include "MagneticField/Engine/interface/MagneticField.h" 00015 //#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 00016 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" 00017 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 00018 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00019 00020 // 00021 // constants, enums and typedefs 00022 // 00023 00024 // 00025 // static data member definitions 00026 // 00027 00028 // 00029 // constructors and destructor 00030 // 00031 TrackAssociatorByHitsESProducer::TrackAssociatorByHitsESProducer(const edm::ParameterSet& iConfig) 00032 { 00033 //the following line is needed to tell the framework what 00034 // data is being produced 00035 setWhatProduced(this,"TrackAssociatorByHits"); 00036 00037 //now do what ever other initialization is needed 00038 conf_=iConfig; 00039 } 00040 00041 00042 TrackAssociatorByHitsESProducer::~TrackAssociatorByHitsESProducer() 00043 { 00044 00045 // do anything here that needs to be done at desctruction time 00046 // (e.g. close files, deallocate resources etc.) 00047 00048 } 00049 00050 00051 // 00052 // member functions 00053 // 00054 00055 // ------------ method called to produce the data ------------ 00056 TrackAssociatorByHitsESProducer::ReturnType 00057 TrackAssociatorByHitsESProducer::produce(const TrackAssociatorRecord& iRecord) 00058 { 00059 using namespace edm::es; 00060 edm::ESHandle<MagneticField> theMF; 00061 iRecord.getRecord<IdealMagneticFieldRecord>().get(theMF); 00062 std::auto_ptr<TrackAssociatorBase> pTrackAssociatorBase (new TrackAssociatorByHits(conf_)); 00063 return pTrackAssociatorBase ; 00064 } 00065 00066 //define this as a plug-in