Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
SimFilters
FilterNoMCParticles_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
/// \file FilterNoMCParticles_module.cc
3
/// \brief Simple EDFilter filter events with no MCParticles
4
///
5
/// \author echurch@fnal.gov
6
////////////////////////////////////////////////////////////////////////
7
8
/// Framework includes
9
#include "
art/Framework/Core/ModuleMacros.h
"
10
#include "
art/Framework/Core/SharedFilter.h
"
11
#include "
art/Framework/Principal/Event.h
"
12
#include "
art/Framework/Principal/Handle.h
"
13
#include "
fhiclcpp/ParameterSet.h
"
14
15
// LArSoft Includes
16
#include "
nusimdata/SimulationBase/MCParticle.h
"
17
18
#include <vector>
19
20
/// Geant4 interface
21
namespace
simfilter
{
22
23
class
FilterNoMCParticles
:
public
art::SharedFilter
{
24
public
:
25
explicit
FilterNoMCParticles
(
fhicl::ParameterSet
const
& pset,
26
art::ProcessingFrame
const
&);
27
28
private
:
29
bool
filter
(
art::Event
&,
art::ProcessingFrame
const
&)
override
;
30
std::string
const
fLArG4ModuleLabel
;
31
};
32
33
}
// namespace simfilter
34
35
namespace
simfilter
{
36
37
//-----------------------------------------------------------------------
38
// Constructor
39
FilterNoMCParticles::FilterNoMCParticles
(
fhicl::ParameterSet
const
& pset,
40
art::ProcessingFrame
const
&)
41
:
SharedFilter
{pset}
42
,
fLArG4ModuleLabel
{pset.get<
std::string
>(
"LArG4ModuleLabel"
,
"NoLabel"
)}
43
{
44
async<art::InEvent>();
45
}
46
47
//-----------------------------------------------------------------------
48
bool
49
FilterNoMCParticles::filter
(
art::Event
&
evt
,
art::ProcessingFrame
const
&)
50
{
51
auto
const
& mcps =
52
*evt.
getValidHandle
<std::vector<simb::MCParticle>>(
fLArG4ModuleLabel
);
53
return
not mcps.empty();
54
}
55
56
}
// namespace simfilter
57
58
DEFINE_ART_MODULE
(
simfilter::FilterNoMCParticles
)
Handle.h
string
std::string string
Definition:
nybbler.cc:12
art::SharedFilter
Definition:
SharedFilter.h:17
SharedFilter.h
art::SharedFilter::SharedFilter
SharedFilter(fhicl::ParameterSet const &pset)
Definition:
SharedFilter.h:22
MCParticle.h
Particle class.
simfilter::FilterNoMCParticles::fLArG4ModuleLabel
std::string const fLArG4ModuleLabel
Definition:
FilterNoMCParticles_module.cc:30
simfilter::FilterNoMCParticles::filter
bool filter(art::Event &, art::ProcessingFrame const &) override
Definition:
FilterNoMCParticles_module.cc:49
ParameterSet.h
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
art::ProcessingFrame
Definition:
ProcessingFrame.h:8
art::DataViewImpl::getValidHandle
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition:
DataViewImpl.h:441
ModuleMacros.h
simfilter::FilterNoMCParticles::FilterNoMCParticles
FilterNoMCParticles(fhicl::ParameterSet const &pset, art::ProcessingFrame const &)
Definition:
FilterNoMCParticles_module.cc:39
art::Event
Definition:
Event.h:22
tca::evt
TCEvent evt
Definition:
DataStructs.cxx:7
Event.h
simfilter
Framework includes.
Definition:
FilterCryostatNus_module.cc:27
simfilter::FilterNoMCParticles
Definition:
FilterNoMCParticles_module.cc:23
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11