LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ServiceTable.cxx
Go to the documentation of this file.
7 
11 
14 
15 #include <iostream>
16 
17 using namespace evdb;
18 
19 std::map<std::string, int> ServiceTable::fgCategoryOverrides;
20 
21 //......................................................................
22 
23 bool ServiceTable::IsDrawingService(const std::string& s)
24 {
25  if(fgCategoryOverrides.count(s))
27 
28  return (s.find("DrawingOptions")!=std::string::npos);
29 }
30 
31 //......................................................................
32 
34  cet::exempt_ptr<Reconfigurable> s)
35 {
36  ServiceTableEntry entry;
37  entry.fName = ps.get<std::string>("service_type");
38  entry.fCurrentParamSet = ps;
39  entry.fParamSet = "";
41  entry.fService = s;
42 
43  fServices.emplace_back(std::move(entry));
44 }
45 
46 //......................................................................
47 
49 {
50  static ServiceTable s;
51  return s;
52 }
53 
54 //......................................................................
55 
56 void ServiceTable::Edit(unsigned int i)
57 {
58  assert(i < fServices.size());
60 }
61 
62 //......................................................................
63 
65 {
66  // Look to see if we have any new service configurations to apply
67  for (auto& s : fServices) {
68  if (s.fParamSet.empty()) continue;
69 
70  LOG_DEBUG("ServiceTable") << "Applying edits for "
71  << s.fName
72  << "\n"
73  << s.fParamSet;
74 
75  try {
77  //
78  // Each of the next 2 lines may throw on error: should check.
79  //
80  fhicl::make_ParameterSet(s.fParamSet, pset);
81  s.fParamSet.clear();
82  s.fService->do_reconfigure(pset);
83  s.fCurrentParamSet = pset;
84  }
85  catch (fhicl::exception const& e) {
86  LOG_ERROR("ServiceTable") << "Error parsing the new configuration:\n"
87  << e
88  << "\nRe-configuration has been ignored for service: "
89  << s.fName;
90  }
91  }
92 }
93 
94 //......................................................................
95 
96 void ServiceTable::OverrideCategory(std::string const& s, int const cat)
97 {
98  fgCategoryOverrides[s] = cat;
99 }
100 
101 //......................................................................
102 
104 {
105  assert(id < fServices.size());
106  return fServices[id].fCurrentParamSet;
107 }
108 
109 //......................................................................
110 
112 
void RegisterService(fhicl::ParameterSet const &ps, cet::exempt_ptr< Reconfigurable > s)
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
Float_t s
Definition: plot.C:23
static ServiceTable & Instance()
Collection of Services used in the event display.
Definition: ServiceTable.h:36
cet::exempt_ptr< Reconfigurable > fService
Definition: ServiceTable.h:30
static std::map< std::string, int > fgCategoryOverrides
Definition: ServiceTable.h:53
void Edit(unsigned int i)
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
Manage all things related to colors for the event display.
#define LOG_ERROR(category)
static constexpr int kEXPERIMENT_SERVICE
Definition: ServiceTable.h:20
static bool IsDrawingService(std::string const &s)
Top-level interface to all parameter sets.
T get(std::string const &key) const
Definition: ParameterSet.h:231
Pop-up window for editing parameter sets.
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
fhicl::ParameterSet const & GetParameterSet(unsigned int i) const
#define LOG_DEBUG(id)
Interface to services and their configurations.
fhicl::ParameterSet fCurrentParamSet
Definition: ServiceTable.h:27
static void OverrideCategory(std::string const &s, int cat)
Information about a service required by the event display.
Definition: ServiceTable.h:25
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33