Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-15 05:17:35

0001 //
0002 // Original Author:  Matt Rudolph
0003 //         Created:  Sat Mar 28 20:13:08 CET 2009
0004 //
0005 //
0006 
0007 // system include files
0008 #include <memory>
0009 
0010 // user include files
0011 #include "FWCore/Framework/interface/ModuleFactory.h"
0012 #include "FWCore/Framework/interface/ESProducer.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 
0015 #include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
0016 #include "TrackingTools/PatternTools/interface/TSCBLBuilderWithPropagator.h"
0017 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0018 
0019 //
0020 // class decleration
0021 //
0022 
0023 class TSCBLBuilderWithPropagatorESProducer : public edm::ESProducer {
0024 public:
0025   TSCBLBuilderWithPropagatorESProducer(const edm::ParameterSet&);
0026   ~TSCBLBuilderWithPropagatorESProducer() override;
0027 
0028   typedef std::unique_ptr<TrajectoryStateClosestToBeamLineBuilder> ReturnType;
0029 
0030   ReturnType produce(const TrackingComponentsRecord&);
0031 
0032 private:
0033   // ----------member data ---------------------------
0034   edm::ESGetToken<Propagator, TrackingComponentsRecord> propToken_;
0035   const std::string myName_;
0036   const std::string propName_;
0037 };
0038 
0039 //
0040 // constructors and destructor
0041 //
0042 TSCBLBuilderWithPropagatorESProducer::TSCBLBuilderWithPropagatorESProducer(const edm::ParameterSet& p)
0043     : myName_(p.getParameter<std::string>("ComponentName")), propName_(p.getParameter<std::string>("Propagator")) {
0044   auto cc = setWhatProduced(this, myName_);
0045   //now do what ever other initialization is needed
0046   propToken_ = cc.consumes(edm::ESInputTag{"", propName_});
0047 }
0048 
0049 TSCBLBuilderWithPropagatorESProducer::~TSCBLBuilderWithPropagatorESProducer() = default;
0050 
0051 //
0052 // member functions
0053 //
0054 // ------------ method called to produce the data  ------------
0055 TSCBLBuilderWithPropagatorESProducer::ReturnType TSCBLBuilderWithPropagatorESProducer::produce(
0056     const TrackingComponentsRecord& iRecord) {
0057   using namespace edm::es;
0058 
0059   const Propagator* pro = &iRecord.get(propToken_);
0060   auto pTSCBLBuilderWithPropagator = std::make_unique<TSCBLBuilderWithPropagator>(*pro);
0061   return pTSCBLBuilderWithPropagator;
0062 }
0063 
0064 //define this as a plug-in
0065 DEFINE_FWK_EVENTSETUP_MODULE(TSCBLBuilderWithPropagatorESProducer);