Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunesw
test
ArtServices
test_LArSeedService.cxx
Go to the documentation of this file.
1
// test_LArSeedService.cxx
2
3
// David Adams
4
// September 2015
5
//
6
// This test demonstrates how to configure and use the LArSoft SeedService
7
// service outside the art framework.
8
9
#include "nurandom/RandomUtils/NuRandomService.h"
10
11
#include <string>
12
#include <iostream>
13
#include "
dunecore/ArtSupport/ArtServiceHelper.h
"
14
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
15
#include "
art/Framework/Core/detail/EngineCreator.h
"
16
#include "CLHEP/Random/RandomEngine.h"
17
18
using
std::string
;
19
using
std::cout;
20
using
std::endl
;
21
22
int
test_LArSeedService
(
string
gname) {
23
const
string
myname =
"test_LArSeedService: "
;
24
cout << myname <<
"Starting test"
<<
endl
;
25
#ifdef NDEBUG
26
cout << myname <<
"NDEBUG must be off."
<<
endl
;
27
abort();
28
#endif
29
string
line
=
"-----------------------------"
;
30
31
std::string
const
config
{
"NuRandomService: { endOfJobSummary: true policy: random}"
};
32
ArtServiceHelper::load_services
(
config
);
33
34
cout << myname << line <<
endl
;
35
cout << myname <<
"Get NuRandomService service."
<<
endl
;
36
art::ServiceHandle<rndm::NuRandomService>
psrv;
37
38
cout << myname << line <<
endl
;
39
cout << myname <<
"Use NuRandomService service."
<<
endl
;
40
try
{
41
cout <<
" Seed: "
<< psrv->getSeed() <<
endl
;
42
}
catch
(...) {
43
cout <<
" Service use raised an exception."
<<
endl
;
44
cout <<
" Allow this for now."
<<
endl
;
45
}
46
47
cout << myname << line <<
endl
;
48
cout <<
"Done."
<<
endl
;
49
return
0;
50
}
51
52
int
main
() {
53
string
gname =
"dune35t4apa_v6"
;
54
test_LArSeedService
(gname);
55
return
0;
56
}
art::ServiceHandle
Definition:
ServiceHandle.h:37
EngineCreator.h
ArtServiceHelper.h
string
std::string string
Definition:
nybbler.cc:12
ArtServiceHelper::load_services
static void load_services(std::string const &config)
Definition:
ArtServiceHelper.cxx:15
ServiceHandle.h
config
static Config * config
Definition:
config.cpp:1054
main
int main()
Definition:
test_LArSeedService.cxx:52
test_LArSeedService
int test_LArSeedService(string gname)
Definition:
test_LArSeedService.cxx:22
pduneana::line
void line(double t, double *p, double &x, double &y, double &z)
Definition:
PDSPAnalyzer_module.cc:4741
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11