LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
FilterNoMCParticles_module.cc
Go to the documentation of this file.
1 
13 #include "fhiclcpp/ParameterSet.h"
14 
15 // LArSoft Includes
17 
18 #include <vector>
19 
21 namespace simfilter {
22 
24  public:
25  explicit FilterNoMCParticles(fhicl::ParameterSet const& pset, art::ProcessingFrame const&);
26 
27  private:
28  bool filter(art::Event&, art::ProcessingFrame const&) override;
29  std::string const fLArG4ModuleLabel;
30  };
31 
32 } // namespace simfilter
33 
34 namespace simfilter {
35 
36  //-----------------------------------------------------------------------
37  // Constructor
39  art::ProcessingFrame const&)
40  : SharedFilter{pset}, fLArG4ModuleLabel{pset.get<std::string>("LArG4ModuleLabel", "NoLabel")}
41  {
42  async<art::InEvent>();
43  }
44 
45  //-----------------------------------------------------------------------
47  {
48  auto const& mcps = *evt.getValidHandle<std::vector<simb::MCParticle>>(fLArG4ModuleLabel);
49  return not mcps.empty();
50  }
51 
52 } // namespace simfilter
53 
SharedFilter(fhicl::ParameterSet const &pset)
Definition: SharedFilter.cc:6
Particle class.
bool filter(art::Event &, art::ProcessingFrame const &) override
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
FilterNoMCParticles(fhicl::ParameterSet const &pset, art::ProcessingFrame const &)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
TCEvent evt
Definition: DataStructs.cxx:8
Framework includes.