Typedefs | Functions
geometry_iterator_loop_test.cxx File Reference

Test for geometry iterator loops on a standard detector. More...

#include "test/Geometry/GeometryIteratorLoopTestAlg.h"
#include "test/Geometry/geometry_unit_test_base.h"
#include "larcorealg/Geometry/GeometryCore.h"
#include "larcorealg/Geometry/ChannelMapStandardAlg.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

Go to the source code of this file.

Typedefs

using StandardGeometryConfiguration = testing::BasicGeometryEnvironmentConfiguration< geo::ChannelMapStandardAlg >
 
using StandardGeometryTestEnvironment = testing::GeometryTesterEnvironment< StandardGeometryConfiguration >
 

Functions

int main (int argc, char const **argv)
 Runs the test. More...
 

Detailed Description

Test for geometry iterator loops on a standard detector.

Date
May 7th, 2015
Author
petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov

Usage: geometry_iterator_loop_test [ConfigurationFile [GeometryTestParameterSet]]

By default, an internal configuration is used or GeometryTestParameterSet is set to "physics.analysers.geotest".

This unit test uses geometry_unit_test_base.h to build an environment with a geometry set up. For an example of use with Boost unit test module, see geometry_iterator_test.cxx .

Definition in file geometry_iterator_loop_test.cxx.

Typedef Documentation

Definition at line 38 of file geometry_iterator_loop_test.cxx.

Definition at line 48 of file geometry_iterator_loop_test.cxx.

Function Documentation

int main ( int  argc,
char const **  argv 
)

Runs the test.


Parameters
argcnumber of arguments in argv
argvarguments to the function
Returns
number of detected errors (0 on success)
Exceptions
cet::exceptionmost of error situations throw

The arguments in argv are: 0. name of the executable ("Geometry_test")

  1. path to the FHiCL configuration file
  2. FHiCL path to the configuration of the geometry test (default: physics.analysers.geotest)
  3. FHiCL path to the configuration of the geometry (default: services.Geometry)

Definition at line 72 of file geometry_iterator_loop_test.cxx.

72  {
73 
74  StandardGeometryConfiguration config("geometry_iterator_loop_test");
75 
76  //
77  // parameter parsing
78  //
79  int iParam = 0;
80 
81  // first argument: configuration file (mandatory)
82  if (++iParam < argc) config.SetConfigurationPath(argv[iParam]);
83 
84  // second argument: path of the parameter set for geometry test configuration
85  // (optional; default: "physics.analysers.geotest")
86  if (++iParam < argc) config.SetMainTesterParameterSetPath(argv[iParam]);
87 
88  // third argument: path of the parameter set for geometry configuration
89  // (optional; default: "services.Geometry" from the inherited object)
90  if (++iParam < argc) config.SetGeometryParameterSetPath(argv[iParam]);
91 
92  //
93  // testing environment setup
94  //
96 
97  //
98  // run the test algorithm
99  //
100 
101  // 1. we initialize it from the configuration in the environment,
102  geo::GeometryIteratorLoopTestAlg Tester(TestEnvironment.TesterParameters());
103 
104  // 2. we set it up with the geometry from the environment
105  Tester.Setup(*(TestEnvironment.Provider<geo::GeometryCore>()));
106 
107  // 3. then we run it!
108  unsigned int nErrors = Tester.Run();
109 
110  // 4. And finally we cross fingers.
111  if (nErrors > 0) {
112  mf::LogError("geometry_iterator_loop_test")
113  << nErrors << " errors detected!";
114  }
115 
116  return nErrors;
117 } // main()
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
static Config * config
Definition: config.cpp:1054
virtual void Setup(geo::GeometryCore const &new_geo)
Algorithm set up.
Description of geometry of one entire detector.
testing::TesterEnvironment< testing::BasicEnvironmentConfiguration > TestEnvironment
testing::GeometryTesterEnvironment< StandardGeometryConfiguration > StandardGeometryTestEnvironment