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 
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 
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 
55  ProcessHistoryID const& historyID,
56  EventSelectionIDVector eventSelectionIDs,
57  BranchListIndexes branchListIndexes,
59  assert(BASE::eventCached() || BASE::processingMode() != BASE::RunsLumisAndEvents);
61  aux.setProcessHistoryID(historyID);
62  auto history = BASE::processHistoryRegistry().getMapped(aux.processHistoryID());
63  eventPrincipal.fillEventPrincipal(
64  aux, history, std::move(eventSelectionIDs), std::move(branchListIndexes), reader);
65  BASE::resetEventCached();
66  }
67 
68  private:
69  typename BASE::ItemTypeInfo getNextItemType() final;
70  virtual void initialize(EventID& id, TimeValue_t& time, TimeValue_t& interval);
71  virtual bool setRunAndEventInfo(EventID& id, TimeValue_t& time, EventAuxiliary::ExperimentType& etype) = 0;
72  virtual bool noFiles() const;
73  virtual size_t fileIndex() const;
74  void beginJob() override;
75 
77  std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
78  void skip(int offset) override;
79  void rewind_() override;
80 
84 
86  unsigned int numberEventsInRun_;
87  unsigned int numberEventsInLumi_;
91  unsigned int eventCreationDelay_; /* microseconds */
92 
93  unsigned int numberEventsInThisRun_;
99  EventAuxiliary::ExperimentType eType_;
100  };
101 } // namespace edm
102 #endif
virtual void initialize(EventID &id, TimeValue_t &time, TimeValue_t &interval)
RunNumber_t runForLumi(LuminosityBlockNumber_t) const
void doReadEvent(EventPrincipal &eventPrincipal, F &&f)
~IDGeneratorSourceBase() noexcept(false) override
unsigned int numberEventsInRun() const
unsigned int eventCreationDelay() const
IDGeneratorSourceBase(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
EventID const & eventID() const
unsigned int numberEventsInThisRun() const
unsigned long long EventNumber_t
Guid const & processGUID()
Definition: processGUID.cc:4
assert(be >=bs)
unsigned int LuminosityBlockNumber_t
std::vector< EventSelectionID > EventSelectionIDVector
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
unsigned int timeBetweenEvents() const
virtual bool setRunAndEventInfo(EventID &id, TimeValue_t &time, EventAuxiliary::ExperimentType &etype)=0
EventNumber_t const zerothEvent_
std::vector< BranchListIndex > BranchListIndexes
virtual size_t fileIndex() const
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
LuminosityBlockNumber_t luminosityBlock() const
void retreatToPrevious(EventID &eventID, TimeValue_t &time)
double f[11][100]
unsigned int numberEventsInLumi() const
void doReadEventWithDelayedReader(EventPrincipal &eventPrincipal, ProcessHistoryID const &historyID, EventSelectionIDVector eventSelectionIDs, BranchListIndexes branchListIndexes, DelayedReader *reader)
unsigned long long TimeValue_t
Definition: Timestamp.h:21
std::shared_ptr< RunAuxiliary > readRunAuxiliary_() override
RunNumber_t run() const
Definition: EventID.h:38
static void fillDescription(ParameterSetDescription &desc)
void advanceToNext(EventID &eventID, TimeValue_t &time)
std::vector< edm::LuminosityBlockID > firstLumiForRuns_
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
HLT enums.
void skip(int offset) override
unsigned int RunNumber_t
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
BASE::ItemTypeInfo getNextItemType() final
def move(src, dest)
Definition: eostools.py:511
EventNumber_t event() const
Definition: EventID.h:40
EventAuxiliary::ExperimentType eType_
unsigned int numberEventsInThisLumi() const