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

Simple instantiation-only test for LArPropertiesStandard. More...

#include "larcorealg/TestUtils/unit_test_base.h"
#include "lardataalg/DetectorInfo/LArPropertiesStandard.h"
#include "lardataalg/DetectorInfo/LArPropertiesStandardTestHelpers.h"

Go to the source code of this file.

Typedefs

using TestEnvironment = testing::TesterEnvironment< testing::BasicEnvironmentConfiguration >
 

Functions

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

Detailed Description

Simple instantiation-only test for LArPropertiesStandard.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
December 1st, 2015

Definition in file LArPropertiesStandard_test.cc.

Typedef Documentation

Definition at line 26 of file LArPropertiesStandard_test.cc.

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 ("LArPropertiesStandard_test")

  1. (mandatory) path to the FHiCL configuration file
  2. FHiCL path to the configuration of the test (default: physics.analyzers.larptest)
  3. FHiCL path to the configuration of LArProperties service (default: services.LArPropertiesService)

Definition at line 51 of file LArPropertiesStandard_test.cc.

51  {
52 
53  testing::BasicEnvironmentConfiguration config("larp_test");
54 
55  //
56  // parameter parsing
57  //
58  int iParam = 0;
59 
60  // first argument: configuration file (mandatory)
61  if (++iParam < argc) config.SetConfigurationPath(argv[iParam]);
62  else {
63  std::cerr << "FHiCL configuration file path required as first argument!"
64  << std::endl;
65  return 1;
66  }
67 
68  // second argument: path of the parameter set for geometry test configuration
69  // (optional; default does not have any tester)
70  if (++iParam < argc) config.SetMainTesterParameterSetPath(argv[iParam]);
71 
72  // third argument: path of the parameter set for LArProperties configuration
73  // (optional; default: "services.LArProperties" from the inherited object)
74  if (++iParam < argc)
75  config.SetServiceParameterSetPath("LArPropertiesService", argv[iParam]);
76 
77 
78  unsigned int nErrors = 0 /* Tester.Run() */ ;
79 
80  //
81  // testing environment setup
82  //
83  TestEnvironment TestEnv(config);
84 
85  // LArPropertiesStandard supports the simple set up; so we invoke it
86  TestEnv.SimpleProviderSetup<detinfo::LArPropertiesStandard>();
87 
88  //
89  // run the test algorithm
90  // (I leave it here for reference -- there is no test algorithm here)
91  //
92 
93  // 1. we initialize it from the configuration in the environment,
94 // MyTestAlgo Tester(TestEnv.TesterParameters());
95 
96  // 2. we set it up with the geometry from the environment
97 // Tester.Setup(*(TestEnv.LArProperties()));
98 
99  // 3. then we run it!
100  mf::LogInfo("larp_test")
101  << "The atomic number of liquid argon is "
102  << TestEnv.Provider<detinfo::LArProperties>()->AtomicNumber()
103  ;
104 
105  // 4. And finally we cross fingers.
106  if (nErrors > 0) {
107  mf::LogError("larp_test") << nErrors << " errors detected!";
108  }
109 
110  return nErrors;
111 } // main()
BEGIN_PROLOG could also be cerr
Class holding a configuration for a test environment.
A test environment with some support for service providers.
Properties related to liquid argon environment in the detector.