CMS 3D CMS Logo

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 
25 // user include files
29 
30 // forward declarations
31 namespace edm {
32 #if !defined(TEST_NO_FWD_DECL)
33  class EventProcessor;
34  class LuminosityBlockPrincipal;
35  class WaitingTaskHolder;
37 #endif
38 
40  public:
41  LuminosityBlockProcessingStatus(EventProcessor* iEP, unsigned int iNStreams, std::shared_ptr<void> iRunResource)
42  : run_(std::move(iRunResource)), eventProcessor_(iEP), nStreamsStillProcessingLumi_(iNStreams) {}
43 
44  std::shared_ptr<LuminosityBlockPrincipal>& lumiPrincipal() { return lumiPrincipal_; }
45 
48  //free lumi for next usage
49  lumiPrincipal_.reset();
51  }
52 
54 
58 
59  bool isLumiEnding() const { return lumiEnding_; }
60  void endLumi() { lumiEnding_ = true; }
61 
62  bool continuingLumi() const { return continuingLumi_; }
63  void haveContinuedLumi() { continuingLumi_ = false; }
65 
66  bool haveStartedNextLumi() const { return startedNextLumi_; }
67  void startNextLumi() { startedNextLumi_ = true; }
68 
71 
74 
75  //These should only be called while in the InputSource's task queue
76  void updateLastTimestamp(edm::Timestamp const& iTime) {
77  if (iTime > endTime_) {
78  endTime_ = iTime;
79  }
80  }
81  edm::Timestamp const& lastTimestamp() const { return endTime_; }
82 
84 
85  const IOVSyncValue nextSyncValue() const { return nextSyncValue_; }
86 
87  std::shared_ptr<void> const& runResource() const { return run_; }
88 
89  //Called once all events in Lumi have been processed
90  void setEndTime();
91 
92  private:
93  // ---------- member data --------------------------------
94  std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
95  std::shared_ptr<void> run_;
99  std::atomic<unsigned int> nStreamsStillProcessingLumi_{0}; //read/write as streams finish lumi so must be atomic
101  std::atomic<char> endTimeSetStatus_{0};
102  bool stopProcessingEvents_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
104  false}; //read/write in m_sourceQueue NOTE: This is a useful cache instead of recalculating each call
105  bool continuingLumi_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
106  bool startedNextLumi_{false}; //read/write in m_sourceQueue
109  };
110 } // namespace edm
111 
112 #endif
void setResumer(LimitedTaskQueue::Resumer iResumer)
std::shared_ptr< void > const & runResource() const
std::atomic< unsigned int > nStreamsStillProcessingLumi_
std::shared_ptr< LuminosityBlockPrincipal > & lumiPrincipal()
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
void updateLastTimestamp(edm::Timestamp const &iTime)
HLT enums.
LuminosityBlockProcessingStatus(EventProcessor *iEP, unsigned int iNStreams, std::shared_ptr< void > iRunResource)
def move(src, dest)
Definition: eostools.py:511