All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MuonTrackFilter_module.cc
Go to the documentation of this file.
1 // Framework includes
2 #include "art/Framework/Core/EDFilter.h"
3 #include "art/Framework/Core/ModuleMacros.h"
4 #include "art/Framework/Principal/Event.h"
5 #include "fhiclcpp/ParameterSet.h"
6 #include "art/Framework/Principal/Handle.h"
7 #include "canvas/Persistency/Common/Ptr.h"
8 #include "canvas/Persistency/Common/PtrVector.h"
9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #include "art_root_io/TFileService.h"
11 #include "messagefacility/MessageLogger/MessageLogger.h"
12 
13 // LArSoft includes
18 
19 // SBN/SBND includes
21 
22 // ROOT includes
23 
24 // C++ includes
25 #include <vector>
26 #include <algorithm>
27 #include <stdlib.h>
28 #include <iostream>
29 
30 class MuonTrackFilter : public art::EDFilter {
31 public:
32  explicit MuonTrackFilter(fhicl::ParameterSet const& p);
33  virtual bool filter(art::Event& e) override;
34  void reconfigure(fhicl::ParameterSet const& p);
35  virtual ~MuonTrackFilter() { }
36 
37 private:
38  // services
39  art::ServiceHandle<art::TFileService> tfs;
40 };
41 
42 MuonTrackFilter::MuonTrackFilter(fhicl::ParameterSet const& p): EDFilter{p}
43 {}
44 
45 void MuonTrackFilter::reconfigure(fhicl::ParameterSet const& p)
46 {}
47 
48 bool MuonTrackFilter::filter(art::Event& evt)
49 {
50  bool pass = false;
51  int ncts = 0;
52  art::Handle<std::vector<sbnd::comm::MuonTrack> > muonTrackListHandle;
53  std::vector<art::Ptr<sbnd::comm::MuonTrack> > muontrklist;
54  if (evt.getByLabel("MuonTrackProducer", muonTrackListHandle)) {
55  art::fill_ptr_vector(muontrklist, muonTrackListHandle);
56  ncts = muontrklist.size();
57  }
58  if (ncts > 0){
59  pass = true;
60  }
61  return pass;
62 }
63 // A macro required for a JobControl module.
64 DEFINE_ART_MODULE(MuonTrackFilter)
MuonTrackFilter(fhicl::ParameterSet const &p)
art::ServiceHandle< art::TFileService > tfs
virtual bool filter(art::Event &e) override
Declaration of signal hit object.
pdgs p
Definition: selectors.fcl:22
void reconfigure(fhicl::ParameterSet const &p)
Encapsulate the geometry of a wire.
Encapsulate the construction of a single detector plane.
do i e
TCEvent evt
Definition: DataStructs.cxx:8
art framework interface to geometry description