LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evdb::ServiceTable Class Reference

Collection of Services used in the event display. More...

#include "ServiceTable.h"

Public Member Functions

void RegisterService (fhicl::ParameterSet const &ps, cet::exempt_ptr< Reconfigurable > s)
 
void Edit (unsigned int i)
 
void ApplyEdits ()
 
fhicl::ParameterSet const & GetParameterSet (unsigned int i) const
 

Static Public Member Functions

static ServiceTableInstance ()
 
static bool IsDrawingService (std::string const &s)
 
static void OverrideCategory (std::string const &s, int cat)
 

Public Attributes

std::vector< ServiceTableEntryfServices
 

Private Member Functions

 ServiceTable ()
 

Static Private Attributes

static std::map< std::string, int > fgCategoryOverrides
 

Detailed Description

Collection of Services used in the event display.

Definition at line 36 of file ServiceTable.h.

Constructor & Destructor Documentation

ServiceTable::ServiceTable ( )
private

Definition at line 111 of file ServiceTable.cxx.

111 {}

Member Function Documentation

void ServiceTable::ApplyEdits ( )

Definition at line 64 of file ServiceTable.cxx.

References e, fServices, LOG_DEBUG, LOG_ERROR, fhicl::make_ParameterSet(), and s.

Referenced by evdb::EventDisplay::postProcessEvent().

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 }
Float_t s
Definition: plot.C:23
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
#define LOG_ERROR(category)
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
#define LOG_DEBUG(id)
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void ServiceTable::Edit ( unsigned int  i)

Definition at line 56 of file ServiceTable.cxx.

References fServices.

Referenced by evdb::EditMenu::MenuSelect().

57 {
58  assert(i < fServices.size());
60 }
Top-level interface to all parameter sets.
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
fhicl::ParameterSet const & ServiceTable::GetParameterSet ( unsigned int  i) const

Definition at line 103 of file ServiceTable.cxx.

References fServices.

Referenced by evdb::ParameterSetEditFrame::ParameterSetEditFrame().

104 {
105  assert(id < fServices.size());
106  return fServices[id].fCurrentParamSet;
107 }
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
bool ServiceTable::IsDrawingService ( std::string const &  s)
static

Definition at line 23 of file ServiceTable.cxx.

References fgCategoryOverrides, and evdb::kDRAWING_SERVICE.

Referenced by RegisterService().

24 {
25  if(fgCategoryOverrides.count(s))
27 
28  return (s.find("DrawingOptions")!=std::string::npos);
29 }
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
Float_t s
Definition: plot.C:23
static std::map< std::string, int > fgCategoryOverrides
Definition: ServiceTable.h:53
void ServiceTable::OverrideCategory ( std::string const &  s,
int  cat 
)
static

Definition at line 96 of file ServiceTable.cxx.

References fgCategoryOverrides, and s.

97 {
98  fgCategoryOverrides[s] = cat;
99 }
Float_t s
Definition: plot.C:23
static std::map< std::string, int > fgCategoryOverrides
Definition: ServiceTable.h:53
void ServiceTable::RegisterService ( fhicl::ParameterSet const &  ps,
cet::exempt_ptr< Reconfigurable s 
)

Definition at line 33 of file ServiceTable.cxx.

References evdb::ServiceTableEntry::fCategory, evdb::ServiceTableEntry::fCurrentParamSet, evdb::ServiceTableEntry::fName, evdb::ServiceTableEntry::fParamSet, evdb::ServiceTableEntry::fService, fServices, fhicl::ParameterSet::get(), IsDrawingService(), evdb::kDRAWING_SERVICE, evdb::kEXPERIMENT_SERVICE, and s.

Referenced by evdb::Reconfigurable::Reconfigurable().

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 }
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
Float_t s
Definition: plot.C:23
cet::exempt_ptr< Reconfigurable > fService
Definition: ServiceTable.h:30
static constexpr int kEXPERIMENT_SERVICE
Definition: ServiceTable.h:20
static bool IsDrawingService(std::string const &s)
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
fhicl::ParameterSet fCurrentParamSet
Definition: ServiceTable.h:27
Information about a service required by the event display.
Definition: ServiceTable.h:25

Member Data Documentation

std::map< std::string, int > ServiceTable::fgCategoryOverrides
staticprivate

Definition at line 53 of file ServiceTable.h.

Referenced by IsDrawingService(), and OverrideCategory().


The documentation for this class was generated from the following files: