CMS 3D CMS Logo

KFTrajectorySmootherESProducer.cc
Go to the documentation of this file.
3 
8 
9 
14 
15 
19 #include <memory>
20 
21 
22 namespace {
23 
24  class KFTrajectorySmootherESProducer final : public edm::ESProducer{
25  public:
26  KFTrajectorySmootherESProducer(const edm::ParameterSet & p);
27  ~KFTrajectorySmootherESProducer();
28  std::shared_ptr<TrajectorySmoother> produce(const TrajectoryFitterRecord &);
29 
30  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
32  desc.add<std::string>("ComponentName","KFSmoother");
33  desc.add<std::string>("Propagator","PropagatorWithMaterial");
34  desc.add<std::string>("Updator","KFUpdator");
35  desc.add<std::string>("Estimator","Chi2");
36  desc.add<std::string>("RecoGeometry","GlobalDetLayerGeometry");
37  desc.add<double>("errorRescaling",100);
38  desc.add<int>("minHits",3);
39  descriptions.add("KFTrajectorySmoother", desc);
40  }
41 
42 
43  private:
44  edm::ParameterSet pset_;
45  };
46 
47 
48  KFTrajectorySmootherESProducer::KFTrajectorySmootherESProducer(const edm::ParameterSet & p)
49  {
50  std::string myname = p.getParameter<std::string>("ComponentName");
51  pset_ = p;
52  setWhatProduced(this,myname);
53  }
54 
55  KFTrajectorySmootherESProducer::~KFTrajectorySmootherESProducer() {}
56 
57  std::shared_ptr<TrajectorySmoother>
58  KFTrajectorySmootherESProducer::produce(const TrajectoryFitterRecord & iRecord){
59 
60  std::string pname = pset_.getParameter<std::string>("Propagator");
61  std::string uname = pset_.getParameter<std::string>("Updator");
62  std::string ename = pset_.getParameter<std::string>("Estimator");
63  std::string gname = pset_.getParameter<std::string>("RecoGeometry");
64  double rescaleFactor = pset_.getParameter<double>("errorRescaling");
65  int minHits = pset_.getParameter<int>("minHits");
66 
71 
72 
73  iRecord.getRecord<TrackingComponentsRecord>().get(pname, prop);
74  iRecord.getRecord<TrackingComponentsRecord>().get(uname, upd);
75  iRecord.getRecord<TrackingComponentsRecord>().get(ename, est);
76  iRecord.getRecord<RecoGeometryRecord>().get(gname,geo);
77 
78  return std::make_shared<KFTrajectorySmoother>(prop.product(),
79  upd.product(),
80  est.product(),
81  rescaleFactor,
82  minHits,
83  geo.product());
84 
85  }
86 }
87 
88 
90 DEFINE_FWK_EVENTSETUP_MODULE(KFTrajectorySmootherESProducer);
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
T const * product() const
Definition: ESHandle.h:86