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