All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataSelect_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: DataSelect
3 // Plugin Type: filter (art v3_05_01)
4 // File: DataSelect_module.cc
5 //
6 // Module for selecting events based on the presence of data products.
7 //
8 // Useful for processing data events, which sometimes have missing
9 // data products.
10 ////////////////////////////////////////////////////////////////////////
11 
12 #include "art/Framework/Core/EDFilter.h"
13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Principal/Event.h"
15 #include "art/Framework/Principal/Handle.h"
16 #include "art/Framework/Principal/Run.h"
17 #include "art/Framework/Principal/SubRun.h"
18 #include "canvas/Utilities/InputTag.h"
19 #include "fhiclcpp/ParameterSet.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 
23 #include <memory>
24 
25 namespace sbn {
26  namespace util {
27  class DataSelect;
28  }
29 }
30 
31 
32 class sbn::util::DataSelect : public art::EDFilter {
33 public:
34  explicit DataSelect(fhicl::ParameterSet const& p);
35  // The compiler-generated destructor is fine for non-base
36  // classes without bare pointers or other resource use.
37 
38  // Plugins should not be copied or assigned.
39  DataSelect(DataSelect const&) = delete;
40  DataSelect(DataSelect&&) = delete;
41  DataSelect& operator=(DataSelect const&) = delete;
42  DataSelect& operator=(DataSelect&&) = delete;
43 
44  // Required functions.
45  bool filter(art::Event& e) override;
46 
47 private:
48 
49  // Declare member data here.
50  std::string fHitLabel;
51 };
52 
53 
54 sbn::util::DataSelect::DataSelect(fhicl::ParameterSet const& p)
55  : EDFilter{p},
56  fHitLabel(p.get<std::string>("HitLabel"))
57 {}
58 
60 {
61 
62  art::Handle<std::vector<recob::Hit>> hitHandle;
63  e.getByLabel(fHitLabel, hitHandle);
64 
65  return hitHandle.isValid();
66 }
67 
68 DEFINE_ART_MODULE(sbn::util::DataSelect)
Declaration of signal hit object.
pdgs p
Definition: selectors.fcl:22
DataSelect & operator=(DataSelect const &)=delete
bool filter(art::Event &e) override
do i e
DataSelect(fhicl::ParameterSet const &p)