LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
MCSFitProducer_module.cc
Go to the documentation of this file.
7 
9 
10 #include "fhiclcpp/ParameterSet.h"
11 #include "fhiclcpp/types/Atom.h"
12 #include "fhiclcpp/types/Table.h"
15 
18 
20 
21 #include <memory>
22 
23 namespace trkf {
40  public:
41 
42  struct Inputs {
43  using Name = fhicl::Name;
46  Name("inputLabel"),
47  Comment("Label of recob::TrackTrajectory Collection to be fit")
48  };
49  };
50 
51  struct Config {
52  using Name = fhicl::Name;
54  Name("inputs"),
55  };
57  Name("fitter")
58  };
59  };
61 
62  explicit MCSFitProducer(Parameters const & p);
64 
65  // Plugins should not be copied or assigned.
66  MCSFitProducer(MCSFitProducer const &) = delete;
67  MCSFitProducer(MCSFitProducer &&) = delete;
68  MCSFitProducer & operator = (MCSFitProducer const &) = delete;
70 
71  void produce(art::Event & e) override;
72 
73  private:
77  };
78 }
79 
81  : p_(p), mcsfitter(p_().fitter)
82 {
83  inputTag = art::InputTag(p_().inputs().inputLabel());
84  produces<std::vector<recob::MCSFitResult> >();
85 }
86 
88 
90 {
91  //
92  auto output = std::make_unique<std::vector<recob::MCSFitResult> >();
93  //
95  bool ok = e.getByLabel(inputTag,inputH);
96  if (!ok) throw cet::exception("MCSFitProducer") << "Cannot find input art::Handle with inputTag " << inputTag;
97  const auto& inputVec = *(inputH.product());
98  for (const auto& element : inputVec) {
99  //fit
100  recob::MCSFitResult result = mcsfitter.fitMcs(element);
101  output->emplace_back(std::move(result));
102  }
103  e.put(std::move(output));
104 }
105 
MCSFitProducer & operator=(MCSFitProducer const &)=delete
MCSFitProducer(Parameters const &p)
Producer for TrajectoryMCSFitter.
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
Provides recob::Track data product.
void produce(art::Event &e) override
recob::MCSFitResult fitMcs(const recob::TrackTrajectory &traj, bool momDepConst=true) const
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 &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
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:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33