LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
StandaloneBasicSetup.h
Go to the documentation of this file.
1 
30 #ifndef LARCOREALG_GEOMETRY_STANDALONEBASICSETUP_H
31 #define LARCOREALG_GEOMETRY_STANDALONEBASICSETUP_H
32 
33 // utility libraries
34 #include "cetlib/filepath_maker.h" // cet::filepath_lookup_after1
35 #include "fhiclcpp/ParameterSet.h"
37 
38 // C/C++ standard libraries
39 #include <string>
40 
41 namespace lar {
42 
44  namespace standalone {
45 
46  //--------------------------------------------------------------------------
56  fhicl::ParameterSet ParseConfiguration(std::string configPath,
57  cet::filepath_maker& lookupPolicy);
58 
59  //--------------------------------------------------------------------------
72  fhicl::ParameterSet ParseConfiguration(std::string configPath);
73 
74  //--------------------------------------------------------------------------
88  void SetupMessageFacility(fhicl::ParameterSet const& pset, std::string applName = "standalone");
89 
90  //--------------------------------------------------------------------------
91 
92  } // namespace standalone
93 } // namespace lar
94 
95 //------------------------------------------------------------------------------
96 //--- inline implementation
97 //---
98 //------------------------------------------------------------------------------
100  cet::filepath_maker& lookupPolicy)
101 {
102  fhicl::ParameterSet pset;
103  pset = fhicl::ParameterSet::make(configPath, lookupPolicy);
104  return pset;
105 } // ParseConfiguration(string, filepath_maker)
106 
107 //------------------------------------------------------------------------------
109 {
110  cet::filepath_lookup_after1 policy("FHICL_FILE_PATH");
111  return ParseConfiguration(configPath, policy);
112 } // ParseConfiguration(string)
113 
114 //------------------------------------------------------------------------------
116  std::string applName /* = "standalone" */)
117 {
118  mf::StartMessageFacility(pset.get<fhicl::ParameterSet>("services.message"));
119  mf::SetApplicationName(applName);
120  mf::SetContextSinglet("main");
122 } // lar::standalone::SetupMessageFacility()
123 
124 //------------------------------------------------------------------------------
125 
126 #endif // LARCOREALG_GEOMETRY_STANDALONEBASICSETUP_H
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
void SetContextIteration(string const &val)
void SetupMessageFacility(fhicl::ParameterSet const &pset, std::string applName="standalone")
Sets up the message facility service.
void StartMessageFacility(fhicl::ParameterSet const &pset, string const &applicationName)
T get(std::string const &key) const
Definition: ParameterSet.h:314
LArSoft-specific namespace.
void SetContextSinglet(string const &val)
fhicl::ParameterSet ParseConfiguration(std::string configPath, cet::filepath_maker &lookupPolicy)
Parses a FHiCL configuration file.
void SetApplicationName(string const &applicationName)