GoodBeamlineEventFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: GoodBeamlineEventFilter
3 // Plugin Type: filter (art v2_12_01)
4 // File: GoodBeamlineEventFilter_module.cc
5 //
6 // John Rabaey::jrabaey@udallas.edu
7 //
8 // Description: ToF filter module
9 ////////////////////////////////////////////////////////////////////////
10 
18 #include "fhiclcpp/ParameterSet.h"
23 
26 #include "BeamlineRecoBase/ToF.h"
28 
29 #include <iostream>
30 
31 namespace beamlinereco {
33  public:
35 
36  bool filter(art::Event &e);
37  void reconfigure(const fhicl::ParameterSet &p);
38 
39  private:
44  bool fRequireWC;
46 
47  };
48 }
49 
51 {
52  reconfigure(p);
53 }
54 
56  fToFRecoLabel = pset.get<art::InputTag>("ToFRecoLabel");
57  fWCRecoLabel = pset.get<art::InputTag>("WCRecoLabel");
58  fCherenkovRecoLabel = pset.get<art::InputTag>("CherenkovRecoLabel");
59  fRequireToF = pset.get<bool>("RequireToF");
60  fRequireWC = pset.get<bool>("RequireWC");
61  fRequireCherenkov = pset.get<bool>("RequireCherenkov");
62 }
63 
65 {
66  // Get ToF objects
68  std::vector<art::Ptr<brb::ToF>> tofs;
69  if (e.getByLabel(fToFRecoLabel, tofHandle)) art::fill_ptr_vector(tofs, tofHandle);
70 
71  // Cherenkov
73  std::vector<art::Ptr<brb::BeamlineDigit>> cherenkovs;
74  if (e.getByLabel(fCherenkovRecoLabel, cherenkovHandle))
75  art::fill_ptr_vector(cherenkovs, cherenkovHandle);
76 
77  // Get WC reco
79  std::vector<art::Ptr<brb::WCTrack>> wcs;
80  if (e.getByLabel(fWCRecoLabel, wcHandle))
81  art::fill_ptr_vector(wcs, wcHandle);
82 
83  bool hasToF = tofs.size() > 0;
84  bool hasWC = wcs.size() > 0;
85  bool hasCherenkov = cherenkovs.size() > 0;
86 
87  if ((!fRequireToF || hasToF) &&
88  (!fRequireWC || hasWC) &&
89  (!fRequireCherenkov || hasCherenkov)) {
90  return true;
91  }
92 
93  return false;
94 }
95 
96 
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
Encapsulation of reconstructed digitizer &#39;hits&#39;. Used for ToF PMTs and SiPMs, and Cherenkov and Muon ...
T get(std::string const &key) const
Definition: ParameterSet.h:231
Encapsulation of reconstructed Time-of-Flight (ToF) information. Part of beamline reconstruction for ...
Encapsulation of reconstructed Wire Chamber track. Part of beamline reconstruction for NOvA test beam...
void reconfigure(const fhicl::ParameterSet &p)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Encapsulation of reconstructed PID information from detectors in the beamline (ToF, WCs, Cherenkov). Part of beamline reconstruction for NOvA test beam.
Float_t e
Definition: plot.C:35