DetectorPropertiesServiceStandardGAr.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // DetectorPropertiesServiceStandardGAr.h
3 //
4 // Service interface for DetectorProperties functions
5 //
6 // jpaley@fnal.gov
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef DETECTORPROPERTIESSERVICESTANDARD_H
10 #define DETECTORPROPERTIESSERVICESTANDARD_H
11 
12 #include "fhiclcpp/ParameterSet.h"
13 #include "fhiclcpp/types/Atom.h"
20 
21 #include "DetectorInfo/DetectorPropertiesStandard.h"
23 #include "CoreUtils/ServiceUtil.h"
24 
25 ///General GArSoft Utilities
26 namespace gar {
27  namespace detinfo{
28 
29  /**
30  * @brief "Standard" implementation of DetectorProperties service
31  *
32  * This class wraps DetectorPropertiesStandard provider into a art service.
33  * It delivers the provider via the standard interface:
34  *
35  * detinfo::DetectorProperties const* detprop
36  * = ::art::ServiceHandle<detinfo::DetectorPropertiesStandard>()
37  * ->provider();
38  *
39  * or, using the standard interface in "CoreUtils/ServiceUtil.h":
40  *
41  * auto const* detprop
42  * = gar::providerFrom<detinfo::DetectorPropertiesStandard>();
43  *
44  * In addition to the functionality of the provider, this service allows
45  * to read the configuration from the input file, inherited from a previous
46  * run.
47  *
48  * Configuration parameters
49  * -------------------------
50  *
51  * This service passes the whole configuration down to its service provider,
52  * but it also reacts to:
53  * - *InheritNumberTimeSamples* (boolean; default: false): if true, the
54  * configuration database in the ROOT input file is queried and if a
55  * configuration for this service is found, it's used instead of the
56  * one from the current FHiCL configuration
57  *
58  */
59 
61 
62  public:
63 
64  // the following is currently not used for validation,
65  // but only for documentation
67 
68  // service-specific configuration
70  fhicl::Name("InheritNumberTimeSamples"),
71  fhicl::Comment(""),
72  false /* default value */
73  };
74 
75  // provider configuration
77 
78  }; // ServiceConfiguration_t
79 
80 
81  // this enables art to print the configuration help:
83 
86 
87  virtual void reconfigure(fhicl::ParameterSet const& pset) override;
89  void postOpenFile(std::string const& filename);
90 
91  virtual const provider_type* provider() const override { return fProp.get();}
92 
93  private:
94 
95  std::unique_ptr<detinfo::DetectorPropertiesStandard> fProp;
96  fhicl::ParameterSet fPS; ///< Original parameter set.
97 
98  bool fInheritNumberTimeSamples; ///< Flag saying whether to inherit NumberTimeSamples
99 
101 
102  }; // class DetectorPropertiesService
103  } //namespace detinfo
104 }
105 
108  LEGACY)
109 
110 #endif // DETECTORPROPERTIESSERVICESTANDARD_H
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
std::string string
Definition: nybbler.cc:12
DECLARE_ART_SERVICE_INTERFACE_IMPL(MySharedService, art::test::MyServiceInterface, SHARED) DEFINE_ART_SERVICE_INTERFACE_IMPL(MySharedService
ChannelGroupService::Name Name
string filename
Definition: train.py:213
std::unique_ptr< detinfo::DetectorPropertiesStandard > fProp
void preProcessEvent(::art::Event const &evt, art::ScheduleContext)
virtual void reconfigure(fhicl::ParameterSet const &pset) override
General LArSoft Utilities.
static constexpr double ps
Definition: Units.h:99
General GArSoft Utilities.
#define Comment
DetectorPropertiesServiceStandardGAr(fhicl::ParameterSet const &pset,::art::ActivityRegistry &reg)
TCEvent evt
Definition: DataStructs.cxx:7
"Standard" implementation of DetectorProperties service