LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MCSFitProducer_module.cc
Go to the documentation of this file.
5 
7 #include "fhiclcpp/types/Atom.h"
8 #include "fhiclcpp/types/Table.h"
9 
12 
14 
15 #include <memory>
16 
17 namespace trkf {
34  public:
35  struct Inputs {
36  using Name = fhicl::Name;
39  Name("inputLabel"),
40  Comment("Label of recob::TrackTrajectory Collection to be fit")};
41  };
42 
43  struct Config {
44  using Name = fhicl::Name;
46  Name("inputs"),
47  };
49  };
51 
52  explicit MCSFitProducer(Parameters const& p);
54 
55  // Plugins should not be copied or assigned.
56  MCSFitProducer(MCSFitProducer const&) = delete;
57  MCSFitProducer(MCSFitProducer&&) = delete;
58  MCSFitProducer& operator=(MCSFitProducer const&) = delete;
60 
61  private:
62  void produce(art::Event& e) override;
63 
67  };
68 }
69 
71  : EDProducer{p}, p_(p), mcsfitter(p_().fitter)
72 {
73  inputTag = art::InputTag(p_().inputs().inputLabel());
74  produces<std::vector<recob::MCSFitResult>>();
75 }
76 
78 
80 {
81  //
82  auto output = std::make_unique<std::vector<recob::MCSFitResult>>();
83  //
85  bool ok = e.getByLabel(inputTag, inputH);
86  if (!ok)
87  throw cet::exception("MCSFitProducer")
88  << "Cannot find input art::Handle with inputTag " << inputTag;
89  const auto& inputVec = *(inputH.product());
90  for (const auto& element : inputVec) {
91  //fit
92  recob::MCSFitResult result = mcsfitter.fitMcs(element);
93  output->emplace_back(std::move(result));
94  }
95  e.put(std::move(output));
96 }
97 
MCSFitProducer & operator=(MCSFitProducer const &)=delete
MCSFitProducer(Parameters const &p)
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
recob::MCSFitResult fitMcs(const recob::TrackTrajectory &traj) const
Producer for TrajectoryMCSFitter.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
void produce(art::Event &e) override
Provides recob::Track data product.
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
Definition: MCSFitResult.h:19
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
fhicl::Atom< art::InputTag > inputLabel
TrajectoryMCSFitter mcsfitter
Class for Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Trac...
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33