CMS 3D CMS Logo

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 
15 
16 #include <memory>
17 #include <vector>
18 
19 namespace edm {
20  class ParameterSet;
22  template <typename BASE>
23  class IDGeneratorSourceBase : public BASE {
24  public:
25  explicit IDGeneratorSourceBase(ParameterSet const& pset, InputSourceDescription const& desc, bool realData);
26  ~IDGeneratorSourceBase() noexcept(false) override;
27 
28  unsigned int numberEventsInRun() const { return numberEventsInRun_; }
29  unsigned int numberEventsInLumi() const { return numberEventsInLumi_; }
30  TimeValue_t presentTime() const { return presentTime_; }
31  unsigned int timeBetweenEvents() const { return timeBetweenEvents_; }
32  unsigned int eventCreationDelay() const { return eventCreationDelay_; }
33  unsigned int numberEventsInThisRun() const { return numberEventsInThisRun_; }
34  unsigned int numberEventsInThisLumi() const { return numberEventsInThisLumi_; }
35  EventID const& eventID() const { return eventID_; }
36  RunNumber_t run() const { return eventID_.run(); }
37  EventNumber_t event() const { return eventID_.event(); }
39 
40  static void fillDescription(ParameterSetDescription& desc);
41 
42  protected:
43  template <typename F>
44  void doReadEvent(EventPrincipal& eventPrincipal, F&& f) {
45  assert(BASE::eventCached() || BASE::processingMode() != BASE::RunsLumisAndEvents);
47  eventPrincipal.fillEventPrincipal(aux, BASE::processHistoryRegistry());
48  f(eventPrincipal);
49  BASE::resetEventCached();
50  }
51 
52  private:
53  typename BASE::ItemType getNextItemType() final;
54  virtual void initialize(EventID& id, TimeValue_t& time, TimeValue_t& interval);
55  virtual bool setRunAndEventInfo(EventID& id, TimeValue_t& time, EventAuxiliary::ExperimentType& etype) = 0;
56  virtual bool noFiles() const;
57  virtual size_t fileIndex() const;
58  void beginJob() override;
59 
60  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override;
61  std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
62  void skip(int offset) override;
63  void rewind_() override;
64 
66  void retreatToPrevious(EventID& eventID, TimeValue_t& time);
68 
69  std::vector<edm::LuminosityBlockID> firstLumiForRuns_;
70  unsigned int numberEventsInRun_;
71  unsigned int numberEventsInLumi_;
75  unsigned int eventCreationDelay_; /* microseconds */
76 
77  unsigned int numberEventsInThisRun_;
84  };
85 } // namespace edm
86 #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)
virtual size_t fileIndex() const
IDGeneratorSourceBase(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
BASE::ItemType getNextItemType() final
unsigned long long EventNumber_t
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
~IDGeneratorSourceBase()(false) override
void retreatToPrevious(EventID &eventID, TimeValue_t &time)
EventID const & eventID() const
double f[11][100]
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
#define noexcept
static void fillDescription(ParameterSetDescription &desc)
void advanceToNext(EventID &eventID, TimeValue_t &time)
std::vector< edm::LuminosityBlockID > firstLumiForRuns_
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
HLT enums.
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_