EmptyEventTimestampPlugin.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_EmptyEventTimestampPlugin_h
2 #define art_Framework_Core_EmptyEventTimestampPlugin_h
3 
4 ////////////////////////////////////////////////////////////////////////
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 // * doRewind() is called when EmptyEvent is asked to rewind to its
24 // initial conditions.
25 //
26 // General notes.
27 //
28 // * Subclasses implementing this interface *must* implement
29 // eventTimestamp() and rewind(). Other entry points are optional.
30 //
31 // * Subclasses should not provide a header file: any communication with
32 // the plugin is accomplished solely via the base class interface.
33 //
34 // * Use the macro DEFINE_EMPTYEVENTTIMESTAMP_PLUGIN(<classname>) (see
35 // below) at the bottom of your implementation file to declare your
36 // plugin to the art system.
37 //
38 ////////////////////////////////////////////////////////////////////////
39 
46 #include "fhiclcpp/ParameterSet.h"
48 
49 #define DEFINE_ART_EMPTYEVENTTIMESTAMP_PLUGIN(klass) \
50  CET_PROVIDE_FILE_PATH() \
51  FHICL_PROVIDE_ALLOWED_CONFIGURATION(klass) \
52  DEFINE_BASIC_PLUGIN(klass, art::EmptyEventTimestampPlugin)
53 
54 namespace art {
55  class EmptyEventTimestampPlugin;
56 } // namespace art
57 
58 namespace cet {
59  template <>
60  struct PluginTypeDeducer<art::EmptyEventTimestampPlugin> {
61  static std::string const value;
62  };
63 } // namespace cet
64 
66 public:
68 
69  void doBeginJob();
70  void doEndJob();
71  void doBeginRun(Run const& r);
72  Timestamp doBeginRunTimestamp(RunID const& rid);
73  void doBeginSubRun(SubRun const& sr);
74  Timestamp doBeginSubRunTimestamp(SubRunID const& srid);
75 
76  Timestamp doEventTimestamp(EventID const& e);
77 
78  void doRewind();
79 
80  virtual ~EmptyEventTimestampPlugin() = default;
81 
82 private:
84 
85  virtual void
87  {}
88  virtual void
90  {}
91  virtual void
92  beginRun(Run const&)
93  {}
94  virtual Timestamp
96  {
97  return lastEventTimestamp_;
98  }
99  virtual void
101  {}
102  virtual Timestamp
104  {
105  return lastEventTimestamp_;
106  }
107 
108  virtual Timestamp eventTimestamp(EventID const&) = 0;
109 
110  virtual void rewind() = 0;
111 };
112 
113 #endif /* art_Framework_Core_EmptyEventTimestampPlugin_h */
114 
115 inline void
117 {
118  beginJob();
119 }
120 
121 inline void
123 {
124  endJob();
125 }
126 
127 inline void
129 {
130  beginRun(r);
131 }
132 
133 inline art::Timestamp
135 {
136  return beginRunTimestamp(rid);
137 }
138 
139 inline void
141 {
142  beginSubRun(sr);
143 }
144 
145 inline art::Timestamp
147 {
148  return beginSubRunTimestamp(srid);
149 }
150 
151 inline art::Timestamp
153 {
154  lastEventTimestamp_ = eventTimestamp(eid);
155  return lastEventTimestamp_;
156 }
157 
158 inline void
160 {
161  rewind();
162 }
163 
164 // Local Variables:
165 // mode: c++
166 // End:
Timestamp doEventTimestamp(EventID const &e)
std::string string
Definition: nybbler.cc:12
Definition: Run.h:17
Timestamp doBeginRunTimestamp(RunID const &rid)
const double e
void beginJob()
Definition: Breakpoints.cc:14
virtual Timestamp beginSubRunTimestamp(SubRunID const &)
Timestamp doBeginSubRunTimestamp(SubRunID const &srid)
static constexpr double sr
Definition: Units.h:166
virtual Timestamp beginRunTimestamp(RunID const &)
virtual void beginSubRun(SubRun const &)