CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IDGeneratorSourceBase.h
Go to the documentation of this file.
1 #ifndef Framework_Sources_IDGeneratorSourceBase_h
2 #define Framework_Sources_IDGeneratorSourceBase_h
3 
4 /*----------------------------------------------------------------------
5 ----------------------------------------------------------------------*/
6 
16 
17 #include <memory>
18 #include <vector>
19 
20 namespace edm {
21  class ParameterSet;
23  template <typename BASE>
24  class IDGeneratorSourceBase : public BASE {
25  public:
26  explicit IDGeneratorSourceBase(ParameterSet const& pset, InputSourceDescription const& desc, bool realData);
27  ~IDGeneratorSourceBase() noexcept(false) override;
28 
29  unsigned int numberEventsInRun() const { return numberEventsInRun_; }
30  unsigned int numberEventsInLumi() const { return numberEventsInLumi_; }
31  TimeValue_t presentTime() const { return presentTime_; }
32  unsigned int timeBetweenEvents() const { return timeBetweenEvents_; }
33  unsigned int eventCreationDelay() const { return eventCreationDelay_; }
34  unsigned int numberEventsInThisRun() const { return numberEventsInThisRun_; }
35  unsigned int numberEventsInThisLumi() const { return numberEventsInThisLumi_; }
36  EventID const& eventID() const { return eventID_; }
37  RunNumber_t run() const { return eventID_.run(); }
38  EventNumber_t event() const { return eventID_.event(); }
40 
41  static void fillDescription(ParameterSetDescription& desc);
42 
43  protected:
44  template <typename F>
45  void doReadEvent(EventPrincipal& eventPrincipal, F&& f) {
46  assert(BASE::eventCached() || BASE::processingMode() != BASE::RunsLumisAndEvents);
48  auto history = BASE::processHistoryRegistry().getMapped(aux.processHistoryID());
49  eventPrincipal.fillEventPrincipal(aux, history);
50  f(eventPrincipal);
51  BASE::resetEventCached();
52  }
53 
54  private:
55  typename BASE::ItemType getNextItemType() final;
56  virtual void initialize(EventID& id, TimeValue_t& time, TimeValue_t& interval);
57  virtual bool setRunAndEventInfo(EventID& id, TimeValue_t& time, EventAuxiliary::ExperimentType& etype) = 0;
58  virtual bool noFiles() const;
59  virtual size_t fileIndex() const;
60  void beginJob() override;
61 
62  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override;
63  std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
64  void skip(int offset) override;
65  void rewind_() override;
66 
68  void retreatToPrevious(EventID& eventID, TimeValue_t& time);
70 
72  unsigned int numberEventsInRun_;
73  unsigned int numberEventsInLumi_;
77  unsigned int eventCreationDelay_; /* microseconds */
78 
79  unsigned int numberEventsInThisRun_;
85  EventAuxiliary::ExperimentType eType_;
86  };
87 } // namespace edm
88 #endif
RunNumber_t run() const
Definition: EventID.h:38
virtual void initialize(EventID &id, TimeValue_t &time, TimeValue_t &interval)
EventNumber_t event() const
Definition: EventID.h:40
void doReadEvent(EventPrincipal &eventPrincipal, F &&f)
~IDGeneratorSourceBase() noexcept(false) override
tuple interval
Definition: MergeJob_cfg.py:20
virtual size_t fileIndex() const
IDGeneratorSourceBase(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
BASE::ItemType getNextItemType() final
unsigned long long EventNumber_t
assert(be >=bs)
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
unsigned int LuminosityBlockNumber_t
unsigned int timeBetweenEvents() const
unsigned int numberEventsInRun() const
virtual bool setRunAndEventInfo(EventID &id, TimeValue_t &time, EventAuxiliary::ExperimentType &etype)=0
EventNumber_t const zerothEvent_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
EventNumber_t event() const
void retreatToPrevious(EventID &eventID, TimeValue_t &time)
EventID const & eventID() const
RunNumber_t runForLumi(LuminosityBlockNumber_t) const
LuminosityBlockNumber_t luminosityBlock() const
unsigned int numberEventsInThisRun() const
unsigned long long TimeValue_t
Definition: Timestamp.h:28
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
static void fillDescription(ParameterSetDescription &desc)
void advanceToNext(EventID &eventID, TimeValue_t &time)
std::vector< edm::LuminosityBlockID > firstLumiForRuns_
ProcessHistoryID const & processHistoryID() const
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
unsigned int numberEventsInLumi() const
void skip(int offset) override
unsigned int RunNumber_t
unsigned int eventCreationDelay() const
TimeValue_t presentTime() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
unsigned int numberEventsInThisLumi() const
EventAuxiliary::ExperimentType eType_