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 
Handle.h
anyDirection
Definition: PropagationDirection.h:4
edm::ESInputTag
Definition: ESInputTag.h:87
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
SmartPropagatorESProducer::theEpsilon
double theEpsilon
Definition: SmartPropagatorESProducer.cc:39
ESProducer.h
oppositeToMomentum
Definition: PropagationDirection.h:4
SmartPropagatorESProducer::magToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
Definition: SmartPropagatorESProducer.cc:40
cc
SmartPropagatorESProducer::trackerToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > trackerToken_
Definition: SmartPropagatorESProducer.cc:41
SmartPropagatorESProducer::~SmartPropagatorESProducer
~SmartPropagatorESProducer() override
Destructor.
Definition: SmartPropagatorESProducer.cc:70
IdealMagneticFieldRecord.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
SmartPropagatorESProducer::muonToken_
edm::ESGetToken< Propagator, TrackingComponentsRecord > muonToken_
Definition: SmartPropagatorESProducer.cc:42
edm::ParameterSet
Definition: ParameterSet.h:47
MagneticField.h
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
SmartPropagator.h
PropagationDirection.h
ModuleFactory.h
std
Definition: JetResolutionObject.h:76
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
TrackingComponentsRecord.h
Exception
Definition: hltDiff.cc:246
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
EventSetup.h
SmartPropagatorESProducer::produce
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
Definition: SmartPropagatorESProducer.cc:72
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
edm::ESProducer
Definition: ESProducer.h:104
SmartPropagatorESProducer::SmartPropagatorESProducer
SmartPropagatorESProducer(const edm::ParameterSet &)
Constructor.
Definition: SmartPropagatorESProducer.cc:48
ParameterSet.h
SmartPropagatorESProducer
Definition: SmartPropagatorESProducer.cc:26
alongMomentum
Definition: PropagationDirection.h:4
SmartPropagatorESProducer::thePropagationDirection
PropagationDirection thePropagationDirection
Definition: SmartPropagatorESProducer.cc:38
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12