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 {
41 
42  public:
43  LuminosityBlockProcessingStatus(EventProcessor* iEP, unsigned int iNStreams, std::shared_ptr<void> iRunResource):
44  run_(std::move(iRunResource)) , eventProcessor_(iEP), nStreamsStillProcessingLumi_(iNStreams){}
45 
46  std::shared_ptr<LuminosityBlockPrincipal>& lumiPrincipal() { return lumiPrincipal_;}
47 
50  }
52  //free lumi for next usage
53  lumiPrincipal_.reset();
55  }
56 
58  return 0 == (--nStreamsStillProcessingLumi_);
59  }
60 
64 
65  bool isLumiEnding() const {return lumiEnding_;}
66  void endLumi() { lumiEnding_ = true;}
67 
68  bool continuingLumi() const { return continuingLumi_;}
69  void haveContinuedLumi() { continuingLumi_ = false; }
71 
72  bool haveStartedNextLumi() const { return startedNextLumi_;}
73  void startNextLumi() { startedNextLumi_ = true;}
74 
77 
80 
81  //These should only be called while in the InputSource's task queue
82  void updateLastTimestamp( edm::Timestamp const& iTime) {
83  if (iTime> endTime_) { endTime_ = iTime;}
84  }
85  edm::Timestamp const& lastTimestamp() const { return endTime_;}
86 
88  nextSyncValue_ = std::move(iValue);
89  }
90 
91  const IOVSyncValue nextSyncValue() const { return nextSyncValue_;}
92 
93  std::shared_ptr<void> const& runResource() const {return run_;}
94 
95  //Called once all events in Lumi have been processed
96  void setEndTime();
97  private:
98  // ---------- member data --------------------------------
99  std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
100  std::shared_ptr<void> run_;
104  std::atomic<unsigned int> nStreamsStillProcessingLumi_{0}; //read/write as streams finish lumi so must be atomic
106  std::atomic<char> endTimeSetStatus_{0};
107  bool stopProcessingEvents_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
108  bool lumiEnding_{false}; //read/write in m_sourceQueue NOTE: This is a useful cache instead of recalculating each call
109  bool continuingLumi_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
110  bool startedNextLumi_{false}; //read/write in m_sourceQueue
113 
114 
115 };
116 }
117 
118 #endif
void setResumer(LimitedTaskQueue::Resumer iResumer)
std::shared_ptr< void > const & runResource() const
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