Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Integration
TestFilter_module.cc
Go to the documentation of this file.
1
#include "
art/Framework/Core/EDFilter.h
"
2
#include "
art/Framework/Core/ModuleMacros.h
"
3
4
#include "
fhiclcpp/types/Atom.h
"
5
6
#include <cassert>
7
8
namespace
{
9
using namespace
fhicl
;
10
struct
Config {
11
Atom<unsigned>
acceptValue{
Name
(
"acceptValue"
), 1};
12
Atom<bool>
onlyOne{
Name
(
"onlyOne"
),
false
};
13
};
14
}
// namespace
15
16
namespace
arttest
{
17
class
TestFilter;
18
}
19
20
class
arttest::TestFilter
:
public
art::EDFilter
{
21
public
:
22
using
Parameters
=
Table<Config>
;
23
explicit
TestFilter
(
Parameters
const
&);
24
25
private
:
26
bool
filter
(
art::Event
&
e
)
override
;
27
28
unsigned
count_{};
29
unsigned
const
acceptRate_
;
// how many out of 100 will be accepted?
30
bool
const
onlyOne_
;
31
};
32
33
// -------
34
35
// -----------------------------------------------------------------
36
37
arttest::TestFilter::TestFilter
(
Parameters
const
&
ps
)
38
: EDFilter{ps},
acceptRate_
{
ps
().acceptValue()},
onlyOne_
{
ps
().onlyOne()}
39
{}
40
41
bool
42
arttest::TestFilter::filter
(
art::Event
&)
43
{
44
++
count_
;
45
if
(
onlyOne_
)
46
return
count_
%
acceptRate_
== 0;
47
else
48
return
count_
% 100 <=
acceptRate_
;
49
}
50
51
DEFINE_ART_MODULE
(
arttest::TestFilter
)
fhicl::Table< Config >
art::EDFilter
Definition:
EDFilter.h:17
genie::units::ps
static const double ps
Definition:
Units.h:103
arttest::TestFilter
Definition:
TestFilter_module.cc:20
filter
Framework includes.
Definition:
ADCFilter_module.cc:35
e
const double e
Definition:
gUpMuFluxGen.cxx:165
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:68
EDFilter.h
fhicl
parameter set interface
Definition:
prune_configuration.h:9
arttest
Definition:
GroupSelector_t.h:4
fhicl::Atom< unsigned >
ModuleMacros.h
arttest::TestFilter::filter
bool filter(art::Event &e) override
Definition:
TestFilter_module.cc:42
art::Event
Definition:
Event.h:40
arttest::TestFilter::acceptRate_
unsigned const acceptRate_
Definition:
TestFilter_module.cc:29
arttest::TestFilter::TestFilter
TestFilter(Parameters const &)
Definition:
TestFilter_module.cc:37
Atom.h
arttest::TestFilter::onlyOne_
bool const onlyOne_
Definition:
TestFilter_module.cc:30
arttest::TestFilter::count_
unsigned count_
Definition:
TestFilter_module.cc:28
Name
AdcRoiViewer::Name Name
Definition:
AdcRoiViewer_tool.cc:30
Generated by
1.8.11