CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDLooperBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: <package>
4 // Module: EDLooperBase
5 //
6 // Author: Valentin Kuznetsov
7 // Created: Wed Jul 5 11:44:26 EDT 2006
8 
28 
29 namespace edm {
30 
31  EDLooperBase::EDLooperBase() : iCounter_(0), act_table_(nullptr), moduleChanger_(nullptr),
32  moduleDescription_("Looper", "looper"),
33  moduleCallingContext_(&moduleDescription_)
34  { }
36 
37  void
40  }
41 
44  edm::ProcessingController& ioController, StreamContext* streamContext) {
45 
47  streamContext->setEventID(eventPrincipal.id());
48  streamContext->setRunIndex(eventPrincipal.luminosityBlockPrincipal().runPrincipal().index());
49  streamContext->setLuminosityBlockIndex(eventPrincipal.luminosityBlockPrincipal().index());
50  streamContext->setTimestamp(eventPrincipal.time());
51  ParentContext parentContext(streamContext);
52  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
54 
56  try {
57  status = duringLoop(event, es, ioController);
58  }
59  catch(cms::Exception& e) {
60  e.addContext("Calling the 'duringLoop' method of a looper");
62  if (action != exception_actions::Rethrow) {
63  edm::printCmsExceptionWarning("SkipEvent", e);
64  }
65  else {
66  throw;
67  }
68  }
69  return status;
70  }
71 
74  return endOfLoop(es, iCounter_);
75  }
76 
77  void
79  ++iCounter_;
80 
81  std::set<edm::eventsetup::EventSetupRecordKey> const& keys = modifyingRecords();
82  for_all(keys,
84  esp, std::placeholders::_1));
85  }
86 
89 
91 
92  void EDLooperBase::doBeginRun(RunPrincipal& iRP, EventSetup const& iES, ProcessContext* processContext) {
94  LuminosityBlockID(iRP.run(), 0),
95  iRP.index(),
97  iRP.beginTime(),
98  processContext);
99  ParentContext parentContext(&globalContext);
100  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
102  beginRun(run,iES);
103  }
104 
105  void EDLooperBase::doEndRun(RunPrincipal& iRP, EventSetup const& iES, ProcessContext* processContext){
107  LuminosityBlockID(iRP.run(), 0),
108  iRP.index(),
110  iRP.endTime(),
111  processContext);
112  ParentContext parentContext(&globalContext);
113  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
115  endRun(run,iES);
116  }
119  iLB.id(),
120  iLB.runPrincipal().index(),
121  iLB.index(),
122  iLB.beginTime(),
123  processContext);
124  ParentContext parentContext(&globalContext);
125  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
127  beginLuminosityBlock(luminosityBlock,iES);
128  }
131  iLB.id(),
132  iLB.runPrincipal().index(),
133  iLB.index(),
134  iLB.beginTime(),
135  processContext);
136  ParentContext parentContext(&globalContext);
137  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
139  endLuminosityBlock(luminosityBlock,iES);
140  }
141 
142  void EDLooperBase::beginRun(Run const&, EventSetup const&){}
143  void EDLooperBase::endRun(Run const&, EventSetup const&){}
146 
148 
149 
150  std::set<eventsetup::EventSetupRecordKey>
152  {
153  return std::set<eventsetup::EventSetupRecordKey> ();
154  }
155 
156  void
158  scheduleInfo_ = std::make_unique<ScheduleInfo>(iInfo);
159  }
160  void
162  moduleChanger_ = iChanger;
163  }
164 
166  return moduleChanger_;
167  }
169  return scheduleInfo_.get();
170  }
171 
172 }
RunPrincipal const & runPrincipal() const
void setTimestamp(Timestamp const &v)
Definition: StreamContext.h:69
virtual Status endOfLoop(EventSetup const &, unsigned int iCounter)=0
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:155
Timestamp const & beginTime() const
unsigned int iCounter_
Definition: EDLooperBase.h:148
EventID const & id() const
virtual ~EDLooperBase() noexcept(false)
Definition: EDLooperBase.cc:35
#define noexcept
std::string const & category() const
Definition: Exception.cc:183
exception_actions::ActionCodes find(const std::string &category) const
LuminosityBlockIndex index() const
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
RunNumber_t run() const
Definition: RunPrincipal.h:61
#define nullptr
void doBeginLuminosityBlock(LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
virtual Status duringLoop(Event const &, EventSetup const &, ProcessingController &)=0
void doEndRun(RunPrincipal &, EventSetup const &, ProcessContext *)
virtual std::set< eventsetup::EventSetupRecordKey > modifyingRecords() const
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Called after all event modules have processed the begin of a LuminosityBlock.
void setTransition(Transition v)
Definition: StreamContext.h:65
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
Timestamp const & time() const
Status doEndOfLoop(EventSetup const &es)
Definition: EDLooperBase.cc:73
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:154
Status doDuringLoop(EventPrincipal &eventPrincipal, EventSetup const &es, ProcessingController &, StreamContext *)
Definition: EDLooperBase.cc:43
void setLuminosityBlockIndex(LuminosityBlockIndex const &v)
Definition: StreamContext.h:68
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Timestamp const & beginTime() const
Definition: RunPrincipal.h:73
Timestamp const & endTime() const
Definition: RunPrincipal.h:77
virtual void endOfJob()
Definition: EDLooperBase.cc:90
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
ScheduleInfo const * scheduleInfo() const
This returns a non-zero value after the constructor has been called.
static LuminosityBlockIndex invalidLuminosityBlockIndex()
void setModuleChanger(ModuleChanger *)
edm::propagate_const< std::unique_ptr< ScheduleInfo > > scheduleInfo_
Definition: EDLooperBase.h:151
ExceptionToActionTable const * act_table_
Definition: EDLooperBase.h:149
void copyInfo(ScheduleInfo const &)
virtual void beginOfJob()
Definition: EDLooperBase.cc:88
void addContext(std::string const &context)
Definition: Exception.cc:227
virtual void endRun(Run const &, EventSetup const &)
Called after all event modules have processed the end of a Run.
void prepareForNextLoop(eventsetup::EventSetupProvider *esp)
Definition: EDLooperBase.cc:78
virtual void beginRun(Run const &, EventSetup const &)
Called after all event modules have processed the begin of a Run.
string action
Definition: mps_fire.py:28
RunIndex index() const
Definition: RunPrincipal.h:53
virtual void startingNewLoop(unsigned int)=0
void setEventID(EventID const &v)
Definition: StreamContext.h:66
void doEndLuminosityBlock(LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
ModuleChanger * moduleChanger()
This only returns a non-zero value during the call to endOfLoop.
edm::propagate_const< ModuleChanger * > moduleChanger_
Definition: EDLooperBase.h:152
volatile std::atomic< bool > shutdown_flag false
void doBeginRun(RunPrincipal &, EventSetup const &, ProcessContext *)
Definition: EDLooperBase.cc:92
void setRunIndex(RunIndex const &v)
Definition: StreamContext.h:67
virtual void attachTo(ActivityRegistry &)
Override this method if you need to monitor the state of the processing.
void doStartingNewLoop()
Definition: EDLooperBase.cc:38
Definition: Run.h:42
tuple status
Definition: mps_update.py:57
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e)
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Called after all event modules have processed the end of a LuminosityBlock.