LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Prescaler_module.cc
Go to the documentation of this file.
1
// ======================================================================
2
//
3
// Prescaler_plugin
4
//
5
// ======================================================================
6
7
#include "
art/Framework/Core/EDFilter.h
"
8
#include "
art/Framework/Core/Frameworkfwd.h
"
9
#include "
art/Framework/Core/ModuleMacros.h
"
10
#include "
fhiclcpp/types/Atom.h
"
11
12
namespace
art
{
13
class
Prescaler
;
14
}
15
using namespace
fhicl
;
16
using
art::Prescaler
;
17
18
// ======================================================================
19
20
class
art::Prescaler
:
public
EDFilter
{
21
public
:
22
struct
Config
{
23
Atom<int>
prescaleFactor{
Name
(
"prescaleFactor"
)};
24
Atom<int>
prescaleOffset{
Name
(
"prescaleOffset"
)};
25
};
26
27
using
Parameters
=
EDFilter::Table<Config>
;
28
explicit
Prescaler
(
Parameters
const
&);
29
30
bool
filter
(
Event
&)
override
;
31
32
private
:
33
int
count_{};
34
int
const
n_
;
// accept one in n
35
int
const
36
offset_
;
// with offset,
37
// i.e. sequence of events does not have to start at first event
38
39
};
// Prescaler
40
41
// ======================================================================
42
43
Prescaler::Prescaler
(
Parameters
const
& config)
44
: n_{config().prescaleFactor()},
offset_
{config().prescaleOffset()}
45
{}
46
47
bool
48
Prescaler::filter
(
Event
&)
49
{
50
return
++
count_
%
n_
==
offset_
;
51
}
52
53
DEFINE_ART_MODULE
(
Prescaler
)
art::EDFilter
Definition:
EDFilter.h:30
art::Prescaler::count_
int count_
Definition:
Prescaler_module.cc:33
art::Prescaler::filter
bool filter(Event &) override
Definition:
Prescaler_module.cc:48
art::ProducerTable
Definition:
ProducerTable.h:19
Frameworkfwd.h
filter
Framework includes.
Definition:
ADCFilter_module.cc:35
art::Prescaler::n_
int const n_
Definition:
Prescaler_module.cc:34
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:42
EDFilter.h
art::Prescaler::Prescaler
Prescaler(Parameters const &)
Definition:
Prescaler_module.cc:43
fhicl
parameter set interface
Definition:
ServiceProviderWrappers.h:37
fhicl::Atom< int >
art::Prescaler::Config
Definition:
Prescaler_module.cc:22
ModuleMacros.h
art::Prescaler::offset_
int const offset_
Definition:
Prescaler_module.cc:36
art::Prescaler
Definition:
Prescaler_module.cc:20
art::Event
Definition:
Event.h:42
Atom.h
art
HLT enums.
Definition:
ServiceProviderWrappers.h:36
fhicl::Name
Definition:
Name.h:11
art
Framework
Modules
Prescaler_module.cc
Generated on Wed Dec 12 2018 14:42:33 for LArSoft by
1.8.11