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 
44 #include "fhiclcpp/ParameterSet.h"
46 
47 #define DEFINE_ART_EMPTYEVENTTIMESTAMP_PLUGIN(klass) \
48  CET_PROVIDE_FILE_PATH() \
49  FHICL_PROVIDE_ALLOWED_CONFIGURATION(klass) \
50  DEFINE_BASIC_PLUGIN(klass, art::EmptyEventTimestampPlugin)
51 
52 namespace art {
53  class EmptyEventTimestampPlugin;
54 
55  // Forward declarations.
56  class Event;
57  class EventID;
58  class Run;
59  class RunID;
60  class SubRun;
61  class SubRunID;
62 } // namespace art
63 
64 namespace cet {
65  template <>
66  struct PluginTypeDeducer<art::EmptyEventTimestampPlugin> {
67  static std::string const value;
68  };
69 } // namespace cet
70 
72 public:
74 
75  void doBeginJob();
76  void doEndJob();
77  void doBeginRun(Run const& r);
78  Timestamp doBeginRunTimestamp(RunID const& rid);
79  void doBeginSubRun(SubRun const& sr);
80  Timestamp doBeginSubRunTimestamp(SubRunID const& srid);
81 
82  Timestamp doEventTimestamp(EventID const& e);
83 
84  void doRewind();
85 
86  virtual ~EmptyEventTimestampPlugin() = default;
87 
88 private:
90 
91  virtual void beginJob(){};
92  virtual void endJob(){};
93  virtual void beginRun(Run const&){};
94  virtual Timestamp
96  {
97  return lastEventTimestamp_;
98  };
99  virtual void beginSubRun(SubRun const&){};
100  virtual Timestamp
102  {
103  return lastEventTimestamp_;
104  };
105 
106  virtual Timestamp eventTimestamp(EventID const&) = 0;
107 
108  virtual void rewind() = 0;
109 };
110 #endif /* art_Framework_Core_EmptyEventTimestampPlugin_h */
111 
112 inline void
114 {
115  beginJob();
116 }
117 
118 inline void
120 {
121  endJob();
122 }
123 
124 inline void
126 {
127  beginRun(r);
128 }
129 
130 inline art::Timestamp
132 {
133  return beginRunTimestamp(rid);
134 }
135 
136 inline void
138 {
139  beginSubRun(sr);
140 }
141 
142 inline art::Timestamp
144 {
145  return beginSubRunTimestamp(srid);
146 }
147 
148 inline art::Timestamp
150 {
151  lastEventTimestamp_ = eventTimestamp(eid);
152  return lastEventTimestamp_;
153 }
154 
155 inline void
157 {
158  rewind();
159 }
160 
161 // Local Variables:
162 // mode: c++
163 // End:
Timestamp doEventTimestamp(EventID const &e)
Definition: Run.h:21
Timestamp doBeginRunTimestamp(RunID const &rid)
void beginJob()
caf::StandardRecord * sr
virtual Timestamp beginSubRunTimestamp(SubRunID const &)
TRandom3 r(0)
Timestamp doBeginSubRunTimestamp(SubRunID const &srid)
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
Float_t e
Definition: plot.C:35
virtual Timestamp beginRunTimestamp(RunID const &)
virtual void beginSubRun(SubRun const &)
enum BeamMode string