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  setWhatProduced(this, p.getParameter<std::string>("ComponentName"))
63  .setConsumes(standardToken_, edm::ESInputTag("", p.getParameter<std::string>("standardFitter")))
64  .setConsumes(looperToken_, 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);
ConfigurationDescriptions.h
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
ghostTrackVertexReco_cff.fitType
fitType
Definition: ghostTrackVertexReco_cff.py:10
TrajectoryFitter::setHitCloner
virtual void setHitCloner(TkCloner const *)=0
TrajectoryFitter::clone
virtual std::unique_ptr< TrajectoryFitter > clone() const =0
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TkCloner
Definition: TkCloner.h:15
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrajectoryFitterRecord
Definition: TrajectoryFitterRecord.h:12
TrajectoryFitter.h
HLT_2018_cff.standardFitter
standardFitter
Definition: HLT_2018_cff.py:5913
TrajectoryFitterRecord.h
ParameterSetDescription.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
HLT_2018_cff.looperFitter
looperFitter
Definition: HLT_2018_cff.py:5914
edm::ESGetToken
Definition: EventSetup.h:48
ModuleFactory.h
TrajectoryFitter
Definition: TrajectoryFitter.h:19
type
type
Definition: HCALResponse.h:21
standard
Trajectory
Definition: Trajectory.h:38
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
TrajectorySeed
Definition: TrajectorySeed.h:17
edm::ESProducer
Definition: ESProducer.h:101
ParameterSet.h
TrajectoryFitter::fitOne
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0