LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
BlockingPrescaler_module.cc
Go to the documentation of this file.
1
// BlockingPrescaler.
3
//
4
// Accept m in n events with offset. So, for blockSize (m) = 5,
5
// stepSize (n) = 7 and offset = 4, the filter will accept events 5-9
6
// inclusive, 12-16 inclusive, 19-23 inclusive, etc.
7
//
8
// Note that BlockingPrescaler prescales based on the number of events
9
// seen by this module, *not* the event number as recorded by EventID.
10
//
12
13
#include "
art/Framework/Core/EDFilter.h
"
14
#include "
art/Framework/Core/Frameworkfwd.h
"
15
#include "
art/Framework/Core/ModuleMacros.h
"
16
#include "
fhiclcpp/types/Atom.h
"
17
18
using namespace
fhicl
;
19
20
namespace
art
{
21
class
BlockingPrescaler;
22
}
23
24
// ======================================================================
25
26
class
art::BlockingPrescaler
:
public
EDFilter
{
27
public
:
28
struct
Config
{
29
Atom<size_t>
blockSize{
Name
(
"blockSize"
), 1};
30
Atom<size_t>
stepSize{
Name
(
"stepSize"
)};
31
Atom<size_t>
offset{
Name
(
"offset"
), 0};
32
};
33
34
using
Parameters
=
EDFilter::Table<Config>
;
35
explicit
BlockingPrescaler
(
Parameters
const
&);
36
37
virtual
bool
filter
(
Event
&)
override
;
38
39
private
:
40
size_t
count_{};
41
size_t
const
m_
;
// accept m in n (sequentially).
42
size_t
const
n_
;
43
size_t
const
offset_
;
// First accepted event is 1 + offset.
44
45
};
// BlockingPrescaler
46
47
// ======================================================================
48
49
art::BlockingPrescaler::BlockingPrescaler
(
Parameters
const
& config)
50
: m_{config().blockSize()}
51
,
n_
{config().stepSize()}
52
,
offset_
{config().offset()}
53
{}
54
55
bool
56
art::BlockingPrescaler::filter
(
Event
&)
57
{
58
bool
const
result{(
count_
>=
offset_
) && ((
count_
-
offset_
) %
n_
) <
m_
};
59
++
count_
;
60
return
result;
61
}
62
63
DEFINE_ART_MODULE
(
art::BlockingPrescaler
)
art::EDFilter
Definition:
EDFilter.h:30
art::BlockingPrescaler
Definition:
BlockingPrescaler_module.cc:26
art::ProducerTable
Definition:
ProducerTable.h:19
Frameworkfwd.h
filter
Framework includes.
Definition:
ADCFilter_module.cc:35
art::BlockingPrescaler::Config
Definition:
BlockingPrescaler_module.cc:28
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:42
EDFilter.h
fhicl
parameter set interface
Definition:
ServiceProviderWrappers.h:37
fhicl::Atom< size_t >
ModuleMacros.h
art::BlockingPrescaler::BlockingPrescaler
BlockingPrescaler(Parameters const &)
Definition:
BlockingPrescaler_module.cc:49
art::BlockingPrescaler::offset_
size_t const offset_
Definition:
BlockingPrescaler_module.cc:43
art::Event
Definition:
Event.h:42
art::BlockingPrescaler::filter
virtual bool filter(Event &) override
Definition:
BlockingPrescaler_module.cc:56
Atom.h
art
HLT enums.
Definition:
ServiceProviderWrappers.h:36
art::BlockingPrescaler::n_
size_t const n_
Definition:
BlockingPrescaler_module.cc:42
art::BlockingPrescaler::count_
size_t count_
Definition:
BlockingPrescaler_module.cc:40
fhicl::Name
Definition:
Name.h:11
art::BlockingPrescaler::m_
size_t const m_
Definition:
BlockingPrescaler_module.cc:41
art
Framework
Modules
BlockingPrescaler_module.cc
Generated on Thu Jul 26 2018 13:09:41 for LArSoft by
1.8.11