Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Integration
ConcurrentEngineRetrieval_module.cc
Go to the documentation of this file.
1
//========================================================================
2
// ConcurrentEngineRetrieval
3
//
4
// This is module that is intended to test the parallel retrieval/use
5
// of a RandomNumberGenerator engine. Two tests are performed:
6
//
7
// (1) Create multiple distributions in the c'tor, but do not
8
// directly call RandomNumberGenerator::getEngine during the
9
// testing of the random-number-generator.
10
//
11
// (2) Create multiple distributions simultaneously be calling
12
// RandomNumberGenerator::getEngine in multiple threads.
13
// ========================================================================
14
15
#include "
cetlib/quiet_unit_test.hpp
"
16
17
#include "
art/Framework/Core/ModuleMacros.h
"
18
#include "
art/Framework/Core/ReplicatedAnalyzer.h
"
19
#include "
art/Framework/Services/Optional/RandomNumberGenerator.h
"
20
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
21
#include "
art/Utilities/ScheduleID.h
"
22
#include "
art/Utilities/ScheduleIteration.h
"
23
#include "
cetlib/SimultaneousFunctionSpawner.h
"
24
#include "
cetlib/test_macros.h
"
25
26
#include "CLHEP/Random/RandFlat.h"
27
28
#include <algorithm>
29
#include <functional>
30
#include <vector>
31
32
namespace
art
{
33
namespace
test
{
34
35
class
ConcurrentEngineRetrieval
:
public
ReplicatedAnalyzer
{
36
public
:
37
explicit
ConcurrentEngineRetrieval
(
fhicl::ParameterSet
const
&
p
,
38
ProcessingFrame
const
&);
39
40
private
:
41
void
analyze
(
art::Event
const
&,
art::ProcessingFrame
const
&)
override
;
42
CLHEP::RandFlat
dist_
;
43
};
44
45
ConcurrentEngineRetrieval::ConcurrentEngineRetrieval
(
46
fhicl::ParameterSet
const
&
p
,
47
ProcessingFrame
const
&
frame
)
48
:
ReplicatedAnalyzer
{
p
, frame},
dist_
{
createEngine
(
p
.get<
int
>(
"seed"
))}
49
{}
50
51
void
52
ConcurrentEngineRetrieval::analyze
(
art::Event
const
&,
53
art::ProcessingFrame
const
&)
54
{
55
std::vector<std::size_t> numbers(5);
56
std::size_t constexpr random_range{1000};
57
std::generate_n(numbers.begin(), numbers.size(), [
this
] {
58
return
dist_
.fireInt(random_range);
59
});
60
// Find way to verify this for all schedules?
61
}
62
63
}
// namespace test
64
}
// namespace art
65
66
DEFINE_ART_MODULE
(
art::test::ConcurrentEngineRetrieval
)
art::detail::EngineCreator::createEngine
base_engine_t & createEngine(seed_t seed)
Definition:
EngineCreator.cc:24
test_macros.h
RandomNumberGenerator.h
art::ReplicatedAnalyzer
Definition:
ReplicatedAnalyzer.h:22
test
Definition:
test.py:1
art::test::ConcurrentEngineRetrieval::ConcurrentEngineRetrieval
ConcurrentEngineRetrieval(fhicl::ParameterSet const &p, ProcessingFrame const &)
Definition:
ConcurrentEngineRetrieval_module.cc:45
ServiceHandle.h
ReplicatedAnalyzer.h
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:68
SimultaneousFunctionSpawner.h
art::ProcessingFrame
Definition:
ProcessingFrame.h:8
quiet_unit_test.hpp
ModuleMacros.h
art::test::ConcurrentEngineRetrieval
Definition:
ConcurrentEngineRetrieval_module.cc:35
bestFitnesses.frame
frame
Definition:
bestFitnesses.py:161
test.p
p
Definition:
test.py:228
art::test::ConcurrentEngineRetrieval::analyze
void analyze(art::Event const &, art::ProcessingFrame const &) override
Definition:
ConcurrentEngineRetrieval_module.cc:52
art::Event
Definition:
Event.h:40
art
Definition:
BasicOptionsHandler.h:11
art::test::ConcurrentEngineRetrieval::dist_
CLHEP::RandFlat dist_
Definition:
ConcurrentEngineRetrieval_module.cc:42
ScheduleID.h
ScheduleIteration.h
fhicl::ParameterSet
Definition:
ParameterSet.h:34
Generated by
1.8.11