All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIOVChannelStatusService_service.cc
Go to the documentation of this file.
1 #include "art/Framework/Services/Registry/ActivityRegistry.h"
2 #include "art/Framework/Services/Registry/ServiceDefinitionMacros.h"
3 #include "art/Framework/Principal/Event.h"
4 #include "art/Persistency/Provenance/ScheduleContext.h"
5 #include "fhiclcpp/ParameterSet.h"
8 
9 namespace lariov{
10 
11  /**
12  \class SIOVChannelStatusService
13  art service implementation of ChannelStatusService. Implements
14  a channel status retrieval service for database scheme in which
15  all elements in a database folder share a common interval of validity
16  */
18 
19  public:
20 
21  SIOVChannelStatusService(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
22 
23  void PreProcessEvent(const art::Event& evt, art::ScheduleContext);
24 
25  private:
26 
27  const ChannelStatusProvider& DoGetProvider() const override {
28  return fProvider;
29  }
30 
31  const ChannelStatusProvider* DoGetProviderPtr() const override {
32  return &fProvider;
33  }
34 
36  };
37 }//end namespace lariov
38 
39 DECLARE_ART_SERVICE_INTERFACE_IMPL(lariov::SIOVChannelStatusService, lariov::ChannelStatusService, LEGACY)
40 
41 
42 namespace lariov{
43 
44  SIOVChannelStatusService::SIOVChannelStatusService(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg)
45  : fProvider(pset.get<fhicl::ParameterSet>("ChannelStatusProvider"))
46  {
47 
48  //register callback to update local database cache before each event is processed
49  reg.sPreProcessEvent.watch(this, &SIOVChannelStatusService::PreProcessEvent);
50 
51  }
52 
53 
54  void SIOVChannelStatusService::PreProcessEvent(const art::Event& evt, art::ScheduleContext) {
55 
56  //First grab an update from the database
57  fProvider.UpdateTimeStamp(evt.time().value());
58  }
59 
60 }//end namespace lariov
61 
62 DEFINE_ART_SERVICE_INTERFACE_IMPL(lariov::SIOVChannelStatusService, lariov::ChannelStatusService)
const ChannelStatusProvider & DoGetProvider() const override
Returns a reference to the service provider.
SIOVChannelStatusService(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
void UpdateTimeStamp(DBTimeStamp_t ts)
Update event time stamp.
void PreProcessEvent(const art::Event &evt, art::ScheduleContext)
Class providing information about the quality of channels.
Class providing information about the quality of channels.
Channel quality provider with information from configuration file.
const ChannelStatusProvider * DoGetProviderPtr() const override
Returns a pointer to the service provider.
TCEvent evt
Definition: DataStructs.cxx:8
Interface for experiment-specific service for channel quality info.
Service providing information about the quality of channels.