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>
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}"};
33 
34  cout << myname << line << endl;
35  cout << myname << "Get NuRandomService service." << endl;
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 }
std::string string
Definition: nybbler.cc:12
static void load_services(std::string const &config)
static Config * config
Definition: config.cpp:1054
int main()
int test_LArSeedService(string gname)
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)