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 
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::ItemType 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 
76  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override;
77  std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
78  void skip(int offset) override;
79  void rewind_() override;
80 
82  void retreatToPrevious(EventID& eventID, TimeValue_t& time);
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
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
Guid const & processGUID()
Definition: processGUID.cc:4
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
std::vector< EventSelectionID > EventSelectionIDVector
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::vector< BranchListIndex > BranchListIndexes
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
#define override(base_class)
EventNumber_t event() const
def move
Definition: eostools.py:511
void retreatToPrevious(EventID &eventID, TimeValue_t &time)
EventID const & eventID() const
tuple reader
Definition: DQM.py:105
void doReadEventWithDelayedReader(EventPrincipal &eventPrincipal, ProcessHistoryID const &historyID, EventSelectionIDVector eventSelectionIDs, BranchListIndexes branchListIndexes, DelayedReader *reader)
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 setProcessHistoryID(ProcessHistoryID const &phid)
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_