CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TrackingTools/PatternTools/plugins/TSCBLBuilderWithPropagatorESProducer.cc

Go to the documentation of this file.
00001 //
00002 // Original Author:  Matt Rudolph
00003 //         Created:  Sat Mar 28 20:13:08 CET 2009
00004 //
00005 //
00006 
00007 
00008 // system include files
00009 #include <memory>
00010 #include "boost/shared_ptr.hpp"
00011 
00012 // user include files
00013 #include "FWCore/Framework/interface/ModuleFactory.h"
00014 #include "FWCore/Framework/interface/ESProducer.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 
00017 #include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
00018 #include "TrackingTools/PatternTools/interface/TSCBLBuilderWithPropagator.h"
00019 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
00020 
00021 
00022 //
00023 // class decleration
00024 //
00025 
00026 class TSCBLBuilderWithPropagatorESProducer : public edm::ESProducer {
00027    public:
00028       TSCBLBuilderWithPropagatorESProducer(const edm::ParameterSet&);
00029       ~TSCBLBuilderWithPropagatorESProducer();
00030 
00031       typedef boost::shared_ptr<TrajectoryStateClosestToBeamLineBuilder> ReturnType;
00032 
00033       ReturnType produce(const TrackingComponentsRecord&);
00034    private:
00035       // ----------member data ---------------------------
00036       edm::ParameterSet pset_;
00037 };
00038 
00039 //
00040 // constants, enums and typedefs
00041 //
00042 
00043 //
00044 // static data member definitions
00045 //
00046 
00047 //
00048 // constructors and destructor
00049 //
00050 TSCBLBuilderWithPropagatorESProducer::TSCBLBuilderWithPropagatorESProducer(const edm::ParameterSet& p)
00051 {
00052    //the following line is needed to tell the framework what
00053    // data is being produced
00054   std::string myName = p.getParameter<std::string>("ComponentName");
00055   pset_ = p;
00056   setWhatProduced(this,myName);
00057 
00058    //now do what ever other initialization is needed
00059 }
00060 
00061 
00062 TSCBLBuilderWithPropagatorESProducer::~TSCBLBuilderWithPropagatorESProducer()
00063 {
00064  
00065    // do anything here that needs to be done at desctruction time
00066    // (e.g. close files, deallocate resources etc.)
00067 
00068 }
00069 
00070 
00071 //
00072 // member functions
00073 //
00074 
00075 // ------------ method called to produce the data  ------------
00076 TSCBLBuilderWithPropagatorESProducer::ReturnType
00077 TSCBLBuilderWithPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord)
00078 {
00079    using namespace edm::es;
00080    std::string propname = pset_.getParameter<std::string>("Propagator");
00081 
00082    edm::ESHandle<Propagator> theProp;
00083    iRecord.get(propname, theProp);
00084 
00085    const Propagator * pro = theProp.product();
00086 
00087    TSCBLBuilderWithPropagatorESProducer::ReturnType pTSCBLBuilderWithPropagator(new TSCBLBuilderWithPropagator(*pro)) ;
00088 
00089 
00090    return pTSCBLBuilderWithPropagator ;
00091 }
00092 
00093 //define this as a plug-in
00094 DEFINE_FWK_EVENTSETUP_MODULE(TSCBLBuilderWithPropagatorESProducer);