CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LuminosityBlockProcessingStatus.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_LuminosityBlockProcessingStatus_h
2 #define FWCore_Framework_LuminosityBlockProcessingStatus_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : LuminosityBlockProcessingStatus
7 //
16 //
17 // Original Author: root
18 // Created: Tue, 19 Dec 2017 14:24:57 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 #include <atomic>
24 #include <vector>
25 
26 // user include files
32 
33 // forward declarations
34 namespace edm {
35 #if !defined(TEST_NO_FWD_DECL)
36  class EventProcessor;
37  class LuminosityBlockPrincipal;
39 #endif
40 
42  public:
43  LuminosityBlockProcessingStatus(EventProcessor* iEP, unsigned int iNStreams, std::shared_ptr<void> iRunResource)
44  : run_(std::move(iRunResource)), eventProcessor_(iEP), nStreamsStillProcessingLumi_(iNStreams) {}
45 
48 
50 
51  std::shared_ptr<LuminosityBlockPrincipal>& lumiPrincipal() { return lumiPrincipal_; }
52 
55  //free lumi for next usage
56  lumiPrincipal_.reset();
58  }
59 
60  void resetResources();
61 
62  EventSetupImpl const& eventSetupImpl(unsigned subProcessIndex) const {
63  return *eventSetupImpls_.at(subProcessIndex);
64  }
65 
66  std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls() { return eventSetupImpls_; }
67  std::vector<std::shared_ptr<const EventSetupImpl>> const& eventSetupImpls() const { return eventSetupImpls_; }
68 
70 
72 
76 
77  bool isLumiEnding() const { return lumiEnding_; }
78  void endLumi() { lumiEnding_ = true; }
79 
80  bool continuingLumi() const { return continuingLumi_; }
81  void haveContinuedLumi() { continuingLumi_ = false; }
83 
84  bool haveStartedNextLumi() const { return startedNextLumi_; }
85  void startNextLumi() { startedNextLumi_ = true; }
86 
89 
92 
93  //These should only be called while in the InputSource's task queue
94  void updateLastTimestamp(edm::Timestamp const& iTime) {
95  if (iTime > endTime_) {
96  endTime_ = iTime;
97  }
98  }
99  edm::Timestamp const& lastTimestamp() const { return endTime_; }
100 
101  void setNextSyncValue(IOVSyncValue const& iValue) { nextSyncValue_ = iValue; }
102 
103  const IOVSyncValue nextSyncValue() const { return nextSyncValue_; }
104 
105  std::shared_ptr<void> const& runResource() const { return run_; }
106 
107  //Called once all events in Lumi have been processed
108  void setEndTime();
109 
110  private:
111  // ---------- member data --------------------------------
112  std::shared_ptr<void> run_;
114  std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
115  std::vector<std::shared_ptr<const EventSetupImpl>> eventSetupImpls_;
119  std::atomic<unsigned int> nStreamsStillProcessingLumi_{0}; //read/write as streams finish lumi so must be atomic
121  std::atomic<char> endTimeSetStatus_{0};
122  bool stopProcessingEvents_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
124  false}; //read/write in m_sourceQueue NOTE: This is a useful cache instead of recalculating each call
125  bool continuingLumi_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
126  bool startedNextLumi_{false}; //read/write in m_sourceQueue
129  };
130 } // namespace edm
131 
132 #endif
std::vector< std::shared_ptr< const EventSetupImpl > > & eventSetupImpls()
void setResumer(LimitedTaskQueue::Resumer iResumer)
std::shared_ptr< void > const & runResource() const
std::shared_ptr< LuminosityBlockPrincipal > & lumiPrincipal()
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
def move
Definition: eostools.py:511
void updateLastTimestamp(edm::Timestamp const &iTime)
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_
LuminosityBlockProcessingStatus const & operator=(LuminosityBlockProcessingStatus const &)=delete
LuminosityBlockProcessingStatus(EventProcessor *iEP, unsigned int iNStreams, std::shared_ptr< void > iRunResource)
void setNextSyncValue(IOVSyncValue const &iValue)
EventSetupImpl const & eventSetupImpl(unsigned subProcessIndex) const
std::vector< std::shared_ptr< const EventSetupImpl > > const & eventSetupImpls() const