LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MCParticleHitMatching_module.cc
Go to the documentation of this file.
1 
20 // Framework includes
25 #include "fhiclcpp/ParameterSet.h"
26 
27 #include <memory>
28 
29 // LArSoft
31 
33 
35 
36 namespace t0 {
37  class MCParticleHitMatching;
38 
40  public:
41  explicit MCParticleHitMatching(fhicl::ParameterSet const& p);
42  // The destructor generated by the compiler is fine for classes
43  // without bare pointers or other resource use.
44 
45  // Plugins should not be copied or assigned.
50 
51  private:
52  // Required functions.
53  void produce(art::Event& e) override;
54 
55  // For keeping track of the replacement backtracker
56  std::unique_ptr<IHitParticleAssociations> fHitParticleAssociations;
58  };
59 
61  {
62  // Get the tool for MC Truth matching
63  //const fhicl::ParameterSet& hitPartAssnsParams = pset.get<fhicl::ParameterSet>("HitParticleAssociations"); // unused
64 
65  fOverrideRealData = pset.get<bool>("OverrideRealData", false);
66 
67  // Get the tool for MC Truth matching
68  fHitParticleAssociations = art::make_tool<IHitParticleAssociations>(
69  pset.get<fhicl::ParameterSet>("HitParticleAssociations"));
70 
71  produces<HitParticleAssociations>();
72  }
73 
75  {
76  if (evt.isRealData() && !fOverrideRealData) return;
77 
78  std::unique_ptr<HitParticleAssociations> MCPartHitassn(new HitParticleAssociations);
79 
80  fHitParticleAssociations->CreateHitParticleAssociations(evt, MCPartHitassn.get());
81 
82  evt.put(std::move(MCPartHitassn));
83  } // Produce
84 
86 } // end namespace
MCParticleHitMatching(fhicl::ParameterSet const &p)
code to link reconstructed objects back to the MC truth information
MCParticleHitMatching & operator=(MCParticleHitMatching const &)=delete
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
bool isRealData() const
Definition: Event.cc:53
Particle class.
bool fOverrideRealData
if real data, tell it to run anyway (=0)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
void produce(art::Event &e) override
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
std::unique_ptr< IHitParticleAssociations > fHitParticleAssociations
TCEvent evt
Definition: DataStructs.cxx:8
Float_t e
Definition: plot.C:35