All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShowerCalibrationGaloreScaleService_service.cc
Go to the documentation of this file.
1 /**
2  * @file ShowerCalibrationGaloreScaleService_service.cc
3  * @brief A shower calibration service providing a single calibration factor
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date April 28, 2016
6  * @see ShowerCalibrationGaloreScale.h
7  * @ingroup ShowerCalibrationGalore
8  *
9  *
10  */
11 
12 /// LArSoft libraries
15 #include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() (for includers)
16 
17 // framework libraries
18 #include "art/Framework/Services/Registry/ServiceTable.h"
19 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
20 
21 // C/C++ standard libraries
22 #include <memory> // std::unique_ptr<>, std::make_unique()
23 
24 
25 namespace lar {
26  namespace example {
27 
28  /**
29  * @brief A shower calibration art service returning a single factor
30  * @ingroup ShowerCalibrationGalore
31  * @see @ref ShowerCalibrationGalore "ShowerCalibrationGalore example overview"
32  *
33  * See the ShowerCalibrationGaloreScale provider documentation for
34  * configuration instructions and implementation details.
35  *
36  * See the ShowerCalibrationGalore provider class documentation for an
37  * explanation of the interface.
38  *
39  * Use this service and its provider by its interface only:
40  *
41  * lar::example::ShowerCalibrationGalore const* calib
42  * = lar::providerFrom<lar::example::ShowerCalibrationGaloreService>();
43  *
44  * The code does not need to mention, nor to include, nor to link to
45  * `ShowerCalibrationGaloreScaleService` service.
46  *
47  *
48  * Configuration parameters
49  * -------------------------
50  *
51  * In addition to the service provider:
52  *
53  * * *service_provider* must be set to
54  * `"ShowerCalibrationGaloreScaleService"` in order to tell _art_ to
55  * load this implementation.
56  *
57  */
60  {
61 
62  public:
63  /// type of service provider implementation
65 
66  /// art service interface class
68 
69  /// Type of configuration parameter (for art description)
70  using Parameters
71  = art::ServiceTable<typename ShowerCalibrationGaloreScale::Config>;
72 
73 
74  /// Constructor (using a configuration table)
76  (Parameters const& config, art::ActivityRegistry&)
77  : prov(std::make_unique<ShowerCalibrationGaloreScale>(config()))
78  {}
79 
80 
81  private:
82  std::unique_ptr<ShowerCalibrationGaloreScale> prov; ///< service provider
83 
84  /// Returns a constant pointer to the service provider
85  virtual ShowerCalibrationGalore const* do_provider() const override
86  { return prov.get(); }
87 
88  }; // ShowerCalibrationGaloreScaleService
89 
90  } // namespace example
91 } // namespace lar
92 
93 
94 DECLARE_ART_SERVICE_INTERFACE_IMPL(
97  LEGACY
98  )
99 
100 #include "art/Framework/Services/Registry/ServiceDefinitionMacros.h"
101 
102 DEFINE_ART_SERVICE_INTERFACE_IMPL(
105  )
ShowerCalibrationGaloreScaleService(Parameters const &config, art::ActivityRegistry &)
Constructor (using a configuration table)
art::ServiceTable< typename ShowerCalibrationGaloreScale::Config > Parameters
Type of configuration parameter (for art description)
Utilities related to art service access.
A shower calibration service provider applying a uniform scale.
lar::ServiceProviderInterfaceWrapper< ShowerCalibrationGalore > ShowerCalibrationGaloreService
Interface for a shower calibration art service.
Shower calibration service provider applying a uniform energy scale.
A shower calibration art service returning a single factor.
virtual ShowerCalibrationGalore const * do_provider() const override
Returns a constant pointer to the service provider.
Interface for a shower calibration art service.
std::unique_ptr< ShowerCalibrationGaloreScale > prov
service provider
Service returning a provider interface.
Interface for a shower calibration service provider.