MCSFitProducer_module.cc
Go to the documentation of this file.
5 
6 #include "fhiclcpp/types/Atom.h"
7 #include "fhiclcpp/types/Table.h"
9 
12 
14 
15 #include <memory>
16 
17 namespace trkf {
18  /**
19  * @file MCSFitProducer_module.cc
20  * @class trkf::MCSFitProducer
21  *
22  * @brief Producer for TrajectoryMCSFitter.
23  *
24  * Producer for TrajectoryMCSFitter, which performs a Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Track or Trajectory.
25  * It reads a recob::Track collection and produces a collection of recob::MCSFitResult where the elements are in the same order as the input collection (no explicit association is written).
26  *
27  * For configuration options see MCSFitProducer#Inputs and MCSFitProducer#Config
28  *
29  * @author G. Cerati (FNAL, MicroBooNE), based on code from L. Kalousis and D. Kaleko
30  * @date 2017
31  * @version 1.0
32  */
34  public:
35 
36  struct Inputs {
37  using Name = fhicl::Name;
40  Name("inputLabel"),
41  Comment("Label of recob::TrackTrajectory Collection to be fit")
42  };
43  };
44 
45  struct Config {
46  using Name = fhicl::Name;
48  Name("inputs"),
49  };
51  Name("fitter")
52  };
53  };
55 
56  explicit MCSFitProducer(Parameters const & p);
58 
59  // Plugins should not be copied or assigned.
60  MCSFitProducer(MCSFitProducer const &) = delete;
61  MCSFitProducer(MCSFitProducer &&) = delete;
62  MCSFitProducer & operator = (MCSFitProducer const &) = delete;
64 
65  private:
66  void produce(art::Event & e) override;
67 
71  };
72 }
73 
75  : EDProducer{p}, p_(p), mcsfitter(p_().fitter)
76 {
77  inputTag = art::InputTag(p_().inputs().inputLabel());
78  produces<std::vector<recob::MCSFitResult> >();
79 }
80 
82 
84 {
85  //
86  auto output = std::make_unique<std::vector<recob::MCSFitResult> >();
87  //
89  bool ok = e.getByLabel(inputTag,inputH);
90  if (!ok) throw cet::exception("MCSFitProducer") << "Cannot find input art::Handle with inputTag " << inputTag;
91  const auto& inputVec = *(inputH.product());
92  for (const auto& element : inputVec) {
93  //fit
95  output->emplace_back(std::move(result));
96  }
97  e.put(std::move(output));
98 }
99 
MCSFitProducer & operator=(MCSFitProducer const &)=delete
static QCString result
MCSFitProducer(Parameters const &p)
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
ChannelGroupService::Name Name
recob::MCSFitResult fitMcs(const recob::TrackTrajectory &traj) const
Producer for TrajectoryMCSFitter.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
void produce(art::Event &e) override
def move(depos, offset)
Definition: depos.py:107
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
Definition: MCSFitResult.h:19
#define Comment
fhicl::Atom< art::InputTag > inputLabel
Provides recob::Track data product.
TrajectoryMCSFitter mcsfitter
Class for Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Trac...
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33