CMS 3D CMS Logo

SmartPropagatorESProducer.cc
Go to the documentation of this file.
1 
8 
11 
17 
20 
23 
24 #include <memory>
25 
27 public:
30 
32  ~SmartPropagatorESProducer() override;
33 
34  // Operations
35  std::unique_ptr<Propagator> produce(const TrackingComponentsRecord&);
36 
37 private:
39  double theEpsilon;
43 };
44 
45 using namespace edm;
46 using namespace std;
47 
49  string myname = parameterSet.getParameter<string>("ComponentName");
50 
51  string propDir = parameterSet.getParameter<string>("PropagationDirection");
52 
53  if (propDir == "oppositeToMomentum")
54  thePropagationDirection = oppositeToMomentum;
55  else if (propDir == "alongMomentum")
56  thePropagationDirection = alongMomentum;
57  else if (propDir == "anyDirection")
58  thePropagationDirection = anyDirection;
59  else
60  throw cms::Exception("SmartPropagatorESProducer") << "Wrong fit direction chosen in SmartPropagatorESProducer";
61 
62  theEpsilon = parameterSet.getParameter<double>("Epsilon");
63 
64  auto cc = setWhatProduced(this, myname);
65  magToken_ = cc.consumes();
66  trackerToken_ = cc.consumes(edm::ESInputTag("", parameterSet.getParameter<string>("TrackerPropagator")));
67  muonToken_ = cc.consumes(edm::ESInputTag("", parameterSet.getParameter<string>("MuonPropagator")));
68 }
69 
71 
72 std::unique_ptr<Propagator> SmartPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord) {
73  return std::make_unique<SmartPropagator>(
74  iRecord.get(trackerToken_), iRecord.get(muonToken_), &iRecord.get(magToken_), thePropagationDirection, theEpsilon);
75 }
76 
edm::ESGetToken< Propagator, TrackingComponentsRecord > trackerToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PropagationDirection thePropagationDirection
PropagationDirection
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
SmartPropagatorESProducer(const edm::ParameterSet &)
Constructor.
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
~SmartPropagatorESProducer() override
Destructor.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > muonToken_
HLT enums.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const