CMS 3D CMS Logo

AnalyticalPropagatorESProducer.cc
Go to the documentation of this file.
6 
9 
15 
16 #include <string>
17 #include <memory>
18 
19 using namespace edm;
20 
22 public:
24  std::unique_ptr<Propagator> produce(const TrackingComponentsRecord&);
25 
27 
28 private:
30  const double dphiCut_;
32 };
33 
35  : magToken_{setWhatProduced(this, p.getParameter<std::string>("ComponentName"))
37  edm::ESInputTag("", p.getParameter<std::string>("SimpleMagneticField")))},
38  dphiCut_{p.getParameter<double>("MaxDPhi")},
39  dir_{[](std::string const& pdir) {
40  if (pdir == "oppositeToMomentum")
41  return oppositeToMomentum;
42  if (pdir == "alongMomentum")
43  return alongMomentum;
44  if (pdir == "anyDirection")
45  return anyDirection;
46  return alongMomentum;
47  }(p.getParameter<std::string>("PropagationDirection"))} {}
48 
51  desc.add<std::string>("ComponentName")->setComment("the data label assigned to the Propagator");
52  desc.add<std::string>("SimpleMagneticField", "")->setComment("the data label used to retrieve the MagneticField");
53  desc.add<std::string>("PropagationDirection");
54  desc.add<double>("MaxDPhi");
55 
56  oDesc.addDefault(desc);
57 }
58 
59 std::unique_ptr<Propagator> AnalyticalPropagatorESProducer::produce(const TrackingComponentsRecord& iRecord) {
60  return std::make_unique<AnalyticalPropagator>(&iRecord.get(magToken_), dir_, dphiCut_);
61 }
62 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::unique_ptr< Propagator > produce(const TrackingComponentsRecord &)
static const char dir_[]
PropagationDirection
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magToken_
static void fillDescriptions(edm::ConfigurationDescriptions &oDesc)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
AnalyticalPropagatorESProducer(const edm::ParameterSet &p)
HLT enums.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const