All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions
geometry_sbnd_test.cxx File Reference

Unit test for geometry on SBND detector. More...

#include "sbndcode/Geometry/ChannelMapSBNDAlg.h"
#include "test/Geometry/geometry_unit_test_sbnd.h"
#include "larcorealg/test/Geometry/GeometryTestAlg.h"
#include "larcorealg/Geometry/GeometryCore.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

Go to the source code of this file.

Typedefs

using SBNDGeometryConfiguration = sbnd::testing::SBNDGeometryEnvironmentConfiguration< geo::ChannelMapSBNDAlg >
 
using SBNDGeometryTestEnvironment = testing::GeometryTesterEnvironment< SBNDGeometryConfiguration >
 

Functions

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

Detailed Description

Unit test for geometry on SBND detector.

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

Usage: geometry_sbnd_test [ConfigurationFile [GeometryTestParameterSet]]

By default, GeometryTestParameterSet is set to "physics.analyzers.geotest".

Definition in file geometry_sbnd_test.cxx.

Typedef Documentation

Definition at line 36 of file geometry_sbnd_test.cxx.

Definition at line 46 of file geometry_sbnd_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 70 of file geometry_sbnd_test.cxx.

70  {
71 
72  SBNDGeometryConfiguration config("geometry_test_SBND");
73  config.SetMainTesterParameterSetName("geotest");
74 
75  //
76  // parameter parsing
77  //
78  int iParam = 0;
79 
80  // first argument: configuration file (mandatory)
81  if (++iParam < argc) config.SetConfigurationPath(argv[iParam]);
82 
83  // second argument: path of the parameter set for geometry test configuration
84  // (optional; default: "physics.analysers.geotest");
85  // if no path is provided, we have a empty default configuration;
86  // if path is provided, we don't have any default configuration
87  // and if the configuration is missing there will be an error
88  if (++iParam < argc) config.SetMainTesterParameterSetPath(argv[iParam]);
89  else config.AddDefaultTesterConfiguration("");
90 
91  // third argument: path of the parameter set for geometry configuration
92  // (optional; default: "services.Geometry" from the inherited object)
93  if (++iParam < argc) config.SetGeometryParameterSetPath(argv[iParam]);
94 
95  //
96  // testing environment setup
97  //
99 
100  //
101  // run the test algorithm
102  //
103 
104  // 1. we initialize it from the configuration in the environment,
106 
107  // 2. we set it up with the geometry from the environment
108  Tester.Setup(*TestEnvironment.Geometry());
109 
110  // 3. then we run it!
111  unsigned int nErrors = Tester.Run();
112 
113  // 4. And finally we cross fingers.
114  if (nErrors > 0) {
115  mf::LogError("geometry_test_SBND") << nErrors << " errors detected!";
116  }
117 
118  return nErrors;
119 } // main()
fhicl::ParameterSet TesterParameters(std::string test_name) const
Returns the configuration of the specified test.
Performs tests on the geometry as seen by Geometry service.
virtual void Setup(geo::GeometryCore const &new_geo)
Runs the test.
A test environment with some support for service providers.
testing::TesterEnvironment< testing::BasicEnvironmentConfiguration > TestEnvironment