LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
EmptyEventTimestampPlugin.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_EmptyEventTimestampPlugin_h
2 #define art_Framework_Core_EmptyEventTimestampPlugin_h
3 
5 // EmptyEventTimestampPlugin
6 //
7 // The base class for user-defined timestamp generating plugins specific
8 // to EmptyEvent.
9 //
10 // TimestampPlugin: { plugin_type: <pluginClassName> ... }
11 //
12 // Note that there is currently no use case for allowing multiple
13 // plugins in a given job.
14 //
15 // Entry points are called as indicated by their names, with the
16 // following extra notes:
17 //
18 // * doEventTimeStamp() will always be called prior to
19 // doBeginRunTimestamp() and friends, allowing a default
20 // implementation of (e.g) beginRunTimestamp() to use the last
21 // generated event timestamp.
22 //
23 // General notes.
24 //
25 // * Subclasses implementing this interface *must* implement
26 // eventTimestamp(). Other entry points are optional.
27 //
28 // * Subclasses should not provide a header file: any communication with
29 // the plugin is accomplished solely via the base class interface.
30 //
31 // * Use the macro DEFINE_EMPTYEVENTTIMESTAMP_PLUGIN(<classname>) (see
32 // below) at the bottom of your implementation file to declare your
33 // plugin to the art system.
34 //
36 
41 #include "cetlib/PluginTypeDeducer.h"
42 #include "cetlib/ProvideFilePathMacro.h"
43 #include "fhiclcpp/ParameterSet.h"
45 
46 #define DEFINE_ART_EMPTYEVENTTIMESTAMP_PLUGIN(klass) \
47  CET_PROVIDE_FILE_PATH() \
48  FHICL_PROVIDE_ALLOWED_CONFIGURATION(klass) \
49  DEFINE_BASIC_PLUGIN(klass, art::EmptyEventTimestampPlugin)
50 
51 namespace art {
52  class EmptyEventTimestampPlugin;
53 } // namespace art
54 
55 namespace cet {
56  template <>
57  struct PluginTypeDeducer<art::EmptyEventTimestampPlugin> {
58  static std::string const value;
59  };
60 } // namespace cet
61 
63 public:
65 
66  void doBeginJob();
67  void doEndJob();
68  void doBeginRun(Run const& r);
69  Timestamp doBeginRunTimestamp(RunID const& rid);
70  void doBeginSubRun(SubRun const& sr);
71  Timestamp doBeginSubRunTimestamp(SubRunID const& srid);
72 
73  Timestamp doEventTimestamp(EventID const& e);
74 
75  virtual ~EmptyEventTimestampPlugin() = default;
76 
77 private:
79 
80  virtual void
82  {}
83  virtual void
85  {}
86  virtual void
87  beginRun(Run const&)
88  {}
89  virtual Timestamp
91  {
92  return lastEventTimestamp_;
93  }
94  virtual void
96  {}
97  virtual Timestamp
99  {
100  return lastEventTimestamp_;
101  }
102 
103  virtual Timestamp eventTimestamp(EventID const&) = 0;
104 };
105 
106 inline void
108 {
109  beginJob();
110 }
111 
112 inline void
114 {
115  endJob();
116 }
117 
118 inline void
120 {
121  beginRun(r);
122 }
123 
124 inline art::Timestamp
126 {
127  return beginRunTimestamp(rid);
128 }
129 
130 inline void
132 {
133  beginSubRun(sr);
134 }
135 
136 inline art::Timestamp
138 {
139  return beginSubRunTimestamp(srid);
140 }
141 
142 inline art::Timestamp
144 {
145  lastEventTimestamp_ = eventTimestamp(eid);
146  return lastEventTimestamp_;
147 }
148 
149 #endif /* art_Framework_Core_EmptyEventTimestampPlugin_h */
150 
151 // Local Variables:
152 // mode: c++
153 // End:
TRandom r
Definition: spectrum.C:23
Timestamp doEventTimestamp(EventID const &e)
Definition: Run.h:37
Timestamp doBeginRunTimestamp(RunID const &rid)
void beginJob()
Definition: Breakpoints.cc:14
virtual Timestamp beginSubRunTimestamp(SubRunID const &)
Timestamp doBeginSubRunTimestamp(SubRunID const &srid)
Definition: MVAAlg.h:12
Float_t e
Definition: plot.C:35
virtual Timestamp beginRunTimestamp(RunID const &)
virtual void beginSubRun(SubRun const &)