Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunesw
test
ArtServices
test_Geometry.cxx
Go to the documentation of this file.
1
// test_Geometry.cxx
2
3
// David Adams
4
// September 2015
5
//
6
// This test demonstrates how to configure and use the LArSoft Geometry
7
// service outside the art framework. DUNE geometry and geometry helper
8
// service are used.
9
//
10
// Note the geometry service requires the experiment-specific geometry
11
// helper with the channel map also be loaded.
12
//
13
// See DXGeo/GeoHelper ctor from geometry name for an alternative to
14
// loading the geometry service outside the art framework.
15
16
#include "
larcore/Geometry/Geometry.h
"
17
18
#include <string>
19
#include <iostream>
20
#include <fstream>
21
#include "
dunecore/ArtSupport/ArtServiceHelper.h
"
22
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
23
24
using
std::string
;
25
using
std::cout;
26
using
std::endl
;
27
using
std::ofstream;
28
29
int
test_Geometry
(
string
gname) {
30
const
string
myname =
"test_Geometry: "
;
31
cout << myname <<
"Starting test"
<<
endl
;
32
#ifdef NDEBUG
33
cout << myname <<
"NDEBUG must be off."
<<
endl
;
34
abort();
35
#endif
36
string
line
=
"-----------------------------"
;
37
38
std::ostringstream oss;
39
oss <<
"#include \"geometry_dune.fcl\""
<<
endl
;
40
oss <<
"services.Geometry: @local::"
<< gname <<
endl
;
41
oss <<
"services.ExptGeoHelperInterface: @local::dune_geometry_helper"
<<
endl
;
42
ArtServiceHelper::load_services
(oss.str());
43
44
cout << myname << line <<
endl
;
45
cout << myname <<
"Get Geometry service."
<<
endl
;
46
art::ServiceHandle<geo::Geometry>
pgeo;
47
cout << myname << line <<
endl
;
48
cout << myname <<
"Geometry name: "
<< pgeo->
DetectorName
() <<
endl
;
49
50
cout << myname << line <<
endl
;
51
return
0;
52
}
53
54
int
main
(
int
argc,
const
char
*
argv
[]) {
55
string
gname =
"dune35t_geo"
;
56
if
( argc > 1 ) {
57
string
sarg = argv[1];
58
if
( sarg ==
"-h"
) {
59
cout << argv[0] <<
": GEOFCLNAME [dune35t_geo]"
;
60
return
0;
61
}
62
gname = sarg;
63
}
64
test_Geometry
(gname);
65
return
0;
66
}
art::ServiceHandle< geo::Geometry >
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
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
Geometry.h
art framework interface to geometry description
ServiceHandle.h
geo::GeometryCore::DetectorName
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Definition:
GeometryCore.h:1761
main
int main(int argc, const char *argv[])
Definition:
test_Geometry.cxx:54
test_Geometry
int test_Geometry(string gname)
Definition:
test_Geometry.cxx:29
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