ServiceTable.cxx
Go to the documentation of this file.
1 ///
2 /// \file EventDisplayBase/ServiceTable.h
3 /// \brief Interface to services and their configurations
4 /// \author messier@indiana.edu
5 ///
7 
11 
14 
15 #include <iostream>
16 
17 using namespace evdb;
18 
19 std::map<std::string, int> ServiceTable::fgCategoryOverrides;
20 
21 //......................................................................
22 
24 {
25  if(fgCategoryOverrides.count(s))
27 
28  return (s.find("DrawingOptions")!=std::string::npos);
29 }
30 
31 //......................................................................
32 
35 {
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 
97 {
99 }
100 
101 //......................................................................
102 
104 {
105  assert(id < fServices.size());
106  return fServices[id].fCurrentParamSet;
107 }
108 
109 //......................................................................
110 
112 
113 ////////////////////////////////////////////////////////////////////////
void RegisterService(fhicl::ParameterSet const &ps, cet::exempt_ptr< Reconfigurable > s)
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
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.
Definition: Display3DPad.h:11
const XML_Char * s
Definition: expat.h:262
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
assert(nhit_max >=nhit_nbins)
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
Interface to services and their configurations.
Float_t e
Definition: plot.C:35
def entry(str)
Definition: HTMLTools.py:26
#define LOG_ERROR(stream)
Definition: Messenger.h:129
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
enum BeamMode string