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 
17 
18 #include <string>
19 #include <iostream>
20 #include <fstream>
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;
43 
44  cout << myname << line << endl;
45  cout << myname << "Get Geometry service." << endl;
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 }
std::string string
Definition: nybbler.cc:12
static void load_services(std::string const &config)
art framework interface to geometry description
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
int main(int argc, const char *argv[])
int test_Geometry(string gname)
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)