CMS 3D CMS Logo

FlexibleKFFittingSmootherESProducer.cc
Go to the documentation of this file.
1 
4 
9 
11 
13 
14 namespace {
15 
16  class FlexibleKFFittingSmoother final : public TrajectoryFitter {
17  public:
18  ~FlexibleKFFittingSmoother() override {}
19 
20  private:
22  FlexibleKFFittingSmoother(const TrajectoryFitter& standardFitter, const TrajectoryFitter& looperFitter)
23  : theStandardFitter(standardFitter.clone()), theLooperFitter(looperFitter.clone()) {}
24 
25  Trajectory fitOne(const Trajectory& t, fitType type) const override { return fitter(type)->fitOne(t, type); }
26 
27  Trajectory fitOne(const TrajectorySeed& aSeed,
28  const RecHitContainer& hits,
29  const TrajectoryStateOnSurface& firstPredTsos,
30  fitType type) const override {
31  return fitter(type)->fitOne(aSeed, hits, firstPredTsos, type);
32  }
33 
34  Trajectory fitOne(const TrajectorySeed& aSeed, const RecHitContainer& hits, fitType type) const override {
35  return fitter(type)->fitOne(aSeed, hits, type);
36  }
37 
38  std::unique_ptr<TrajectoryFitter> clone() const override {
39  return std::unique_ptr<TrajectoryFitter>(new FlexibleKFFittingSmoother(*theStandardFitter, *theLooperFitter));
40  }
41 
42  // FIXME a prototype: final inplementaiton may differ
43  void setHitCloner(TkCloner const* hc) override {
44  theStandardFitter->setHitCloner(hc);
45  theLooperFitter->setHitCloner(hc);
46  }
47 
48  private:
49  const TrajectoryFitter* fitter(fitType type) const {
50  return (type == standard) ? theStandardFitter.get() : theLooperFitter.get();
51  }
52 
53  const std::unique_ptr<TrajectoryFitter> theStandardFitter;
54  const std::unique_ptr<TrajectoryFitter> theLooperFitter;
55 
56  friend class FlexibleKFFittingSmootherESProducer;
57  };
58 
59  class FlexibleKFFittingSmootherESProducer : public edm::ESProducer {
60  public:
61  FlexibleKFFittingSmootherESProducer(const edm::ParameterSet& p) {
62  auto cc = setWhatProduced(this, p.getParameter<std::string>("ComponentName"));
63  standardToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("standardFitter")));
64  looperToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("looperFitter")));
65  }
66 
67  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
69  desc.add<std::string>("ComponentName", "FlexibleKFFittingSmoother");
70  desc.add<std::string>("standardFitter", "KFFittingSmootherWithOutliersRejectionAndRK");
71  desc.add<std::string>("looperFitter", "LooperFittingSmoother");
72  descriptions.add("FlexibleKFFittingSmoother", desc);
73  }
74 
75  std::unique_ptr<TrajectoryFitter> produce(const TrajectoryFitterRecord& iRecord) {
76  return std::unique_ptr<TrajectoryFitter>(
77  new FlexibleKFFittingSmoother(iRecord.get(standardToken_), iRecord.get(looperToken_)));
78  }
79 
80  private:
83  };
84 
85 } // namespace
86 
88 
89 DEFINE_FWK_EVENTSETUP_MODULE(FlexibleKFFittingSmootherESProducer);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
virtual void setHitCloner(TkCloner const *)=0
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
virtual std::unique_ptr< TrajectoryFitter > clone() const =0