All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | List of all members
testing::ProviderSetupClass< detinfo::DetectorPropertiesStandard > Struct Template Reference

Set up a detinfo::DetectorPropertiesStandard from a parameter set. More...

#include <DetectorPropertiesStandardTestHelpers.h>

Static Public Member Functions

static std::unique_ptr
< detinfo::DetectorPropertiesStandard
setup (fhicl::ParameterSet const &pset, detinfo::DetectorPropertiesStandard::providers_type const &providers)
 

Detailed Description

template<>
struct testing::ProviderSetupClass< detinfo::DetectorPropertiesStandard >

Set up a detinfo::DetectorPropertiesStandard from a parameter set.

Parameters
psetparameter set for the configuration
providerspack of providers needed by DetectorPropertiesService
Returns
pointer to a newly created and set up DetectorPropertiesService

This class specialisation enables the support of SetupProvider() methods of testing::TesterEnvironment. The resulting setup call will be something like:

env.SetupProviderFor
  <detinfo::DetectorPropertiesStandard, detinfo::DetectorProperties>
  (pset, env.ProviderPackFor<detinfo::DetectorPropertiesStandard>());

(note the use of SetupProviderFor() to register the service also as an implementation of DetectorProperties interface). This implicitly assumes that whatever service providers detinfo::DetectorPropertiesStandard needs, they have already been set up in the environment.

Definition at line 55 of file DetectorPropertiesStandardTestHelpers.h.

Member Function Documentation

static std::unique_ptr<detinfo::DetectorPropertiesStandard> testing::ProviderSetupClass< detinfo::DetectorPropertiesStandard >::setup ( fhicl::ParameterSet const &  pset,
detinfo::DetectorPropertiesStandard::providers_type const &  providers 
)
inlinestatic

Definition at line 58 of file DetectorPropertiesStandardTestHelpers.h.

60  {
61  // some feedback about whether we are using the right configuration
62  std::string ServiceProviderPath;
63  if (pset.get_if_present("service_provider", ServiceProviderPath)) {
64  std::string ServiceProviderName = ServiceProviderPath;
65  size_t iSlash = ServiceProviderPath.rfind('/');
66  if (iSlash != std::string::npos) ServiceProviderName.erase(0, iSlash + 1);
67 
68  if (ServiceProviderName == "DetectorPropertiesServiceStandard") {
69  MF_LOG_TRACE("ProviderSetup") << "Verified service implementation for "
70  "DetectorPropertiesService"
71  ": '"
72  << ServiceProviderPath << "'";
73  }
74  else {
75  // this means you should not be using the simple set up...
76  mf::LogWarning("setupProvider")
77  << "This set up is for a DetectorPropertiesStandard provider.\n"
78  "Your configuration specifies a '"
79  << ServiceProviderPath
80  << "' service implementation"
81  " that is not known to use that provider.";
82  }
83  }
84 
85  //
86  // create the new DetectorPropertiesStandard service provider
87  //
88  // we choose to ignore a configuration parameter that is known to be used
89  // by the art services but unknown to the provider; in this way we can use
90  // for this test the same configuration as for art-based tests.
91  //
92  std::set<std::string> ignore_keys({"InheritNumberTimeSamples"});
93  return std::make_unique<detinfo::DetectorPropertiesStandard>(
94  pset,
95  providers.get<geo::GeometryCore>(),
96  providers.get<detinfo::LArProperties>(),
97  ignore_keys);
98  } // setup()
Description of geometry of one entire detector.

The documentation for this struct was generated from the following file: