27 #ifndef TEST_GEOMETRY_UNIT_TEST_BASE_H 28 #define TEST_GEOMETRY_UNIT_TEST_BASE_H 37 #include "cetlib/search_path.h" 46 #include <type_traits> 125 SurfaceY: 200. # in cm, vertical distance to the surface 126 Name: "lartpcdetector" 127 GDML: "LArTPCdetector.gdml" 128 ROOT: "LArTPCdetector.gdml" 129 SortingParameters: { tool_type: GeoObjectSorterStandard } 178 template <
typename ConfigurationClass,
typename ObjectSorter>
220 return this->
template Provider<geo::GeometryCore>();
231 virtual std::unique_ptr<geo::GeometryCore> CreateNewGeometry()
const;
238 template <
typename ObjectSorter>
241 if constexpr (std::is_constructible_v<ObjectSorter>) {
242 return std::make_unique<ObjectSorter>();
244 else if constexpr (std::is_constructible_v<ObjectSorter, fhicl::ParameterSet>) {
245 return std::make_unique<ObjectSorter>(pset);
250 template <
typename ConfigurationClass,
typename ObjectSorter>
253 mf::LogInfo(
"Test") << config.ApplicationName() <<
" completed.";
266 template <
typename ConfigurationClass,
typename ObjectSorter>
267 std::unique_ptr<geo::GeometryCore>
270 std::string ProviderParameterSetPath = this->Config().GeometryParameterSetPath();
273 this->Parameters().template get<fhicl::ParameterSet>(ProviderParameterSetPath);
275 return std::make_unique<geo::GeometryCore>(
277 std::make_unique<geo::GeometryBuilderStandard>(
279 createSorter<ObjectSorter>(ProviderConfig.get<
fhicl::ParameterSet>(
"SortingParameters", {})));
282 template <
typename ConfigurationClass,
typename ObjectSorter>
285 TesterEnvironment_t::Setup();
286 this->AcquireProvider(CreateNewGeometry());
287 mf::LogInfo(
"Test") << config.ApplicationName() <<
" Geometry setup complete.";
292 #endif // TEST_GEOMETRY_UNIT_TEST_BASE_H BasicGeometryEnvironmentConfiguration()
Default constructor; this is what is used in Boost unit test.
GeometryTesterEnvironment(bool bSetup=true)
Constructor: sets everything up and declares the test started.
static std::string GeometryServiceName()
Returns the name of the service.
virtual std::unique_ptr< geo::GeometryCore > CreateNewGeometry() const
Creates a new geometry.
geo::GeometryCore const * Geometry() const noexcept
void LocalInit()
Initialize with some default values.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
BasicGeometryEnvironmentConfiguration(int argc, char **argv, std::string name)
Class holding a configuration for a test environment.
void SetDefaultGeometryConfiguration(std::string cfg)
Sets a string describing the default parameter set to configure geometry.
void SetGeometryParameterSetPath(std::string path)
Sets the FHiCL path for the geometry configuration.
auto createSorter(fhicl::ParameterSet const &pset[[maybe_unused]])
void AddDefaultServiceConfiguration(std::string service_name, std::string service_cfg)
Adds a default configuration for the specified service.
Access the description of the physical detector geometry.
std::string ServiceParameterSetPath(std::string name) const
FHiCL path for the configuration of the service.
BasicGeometryEnvironmentConfiguration(std::string name)
Constructor; accepts the name as parameter.
void Setup()
The complete initialization, ran at construction by default.
std::string DefaultServiceConfiguration(std::string service_name) const
A string describing the default parameter set to configure the test.
Environment for a geometry test.
BasicGeometryEnvironmentConfiguration(int argc, char **argv)
Constructor: acquires parameters from the command line.
GeometryTesterEnvironment(ConfigurationClass const &cfg_obj, bool bSetup=true)
Setup from a configuration.
std::string DefaultGeometryConfiguration() const
A string describing the default parameter set to configure geometry.
Description of the physical geometry of one entire detector.
A test environment with some support for service providers.
Class holding a configuration for a test environment.
virtual ~GeometryTesterEnvironment()
Destructor: closing remarks.
std::string GeometryParameterSetPath() const
A string describing the default parameter set to configure geometry.
Base class for unit tests using FHiCL configuration.
ConfigurationClass config
instance of the configurer
void SetServiceParameterSetPath(std::string service_name, std::string path)
Sets the FHiCL path for the configuration of a test algorithm.
GeometryTesterEnvironment(ConfigurationClass &&cfg_obj, bool bSetup=true)
Setup from a configuration.