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 #include "boost/bind.hpp"
30 
31 
32 namespace edm {
33 
34  EDLooperBase::EDLooperBase() : iCounter_(0), act_table_(nullptr), moduleChanger_(nullptr),
35  moduleDescription_("Looper", "looper"),
36  moduleCallingContext_(&moduleDescription_)
37  { }
39 
40  void
43  }
44 
47  edm::ProcessingController& ioController, StreamContext* streamContext) {
48 
50  streamContext->setEventID(eventPrincipal.id());
51  streamContext->setRunIndex(eventPrincipal.luminosityBlockPrincipal().runPrincipal().index());
52  streamContext->setLuminosityBlockIndex(eventPrincipal.luminosityBlockPrincipal().index());
53  streamContext->setTimestamp(eventPrincipal.time());
54  ParentContext parentContext(streamContext);
55  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
57 
59  try {
60  status = duringLoop(event, es, ioController);
61  }
62  catch(cms::Exception& e) {
63  e.addContext("Calling the 'duringLoop' method of a looper");
65  if (action != exception_actions::Rethrow) {
66  edm::printCmsExceptionWarning("SkipEvent", e);
67  }
68  else {
69  throw;
70  }
71  }
72  return status;
73  }
74 
77  return endOfLoop(es, iCounter_);
78  }
79 
80  void
82  ++iCounter_;
83 
84  std::set<edm::eventsetup::EventSetupRecordKey> const& keys = modifyingRecords();
85  for_all(keys,
87  esp, _1));
88  }
89 
92 
94 
95  void EDLooperBase::doBeginRun(RunPrincipal& iRP, EventSetup const& iES, ProcessContext* processContext) {
97  LuminosityBlockID(iRP.run(), 0),
98  iRP.index(),
100  iRP.beginTime(),
101  processContext);
102  ParentContext parentContext(&globalContext);
103  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
105  beginRun(run,iES);
106  }
107 
108  void EDLooperBase::doEndRun(RunPrincipal& iRP, EventSetup const& iES, ProcessContext* processContext){
110  LuminosityBlockID(iRP.run(), 0),
111  iRP.index(),
113  iRP.endTime(),
114  processContext);
115  ParentContext parentContext(&globalContext);
116  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
118  endRun(run,iES);
119  }
122  iLB.id(),
123  iLB.runPrincipal().index(),
124  iLB.index(),
125  iLB.beginTime(),
126  processContext);
127  ParentContext parentContext(&globalContext);
128  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
130  beginLuminosityBlock(luminosityBlock,iES);
131  }
134  iLB.id(),
135  iLB.runPrincipal().index(),
136  iLB.index(),
137  iLB.beginTime(),
138  processContext);
139  ParentContext parentContext(&globalContext);
140  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
142  endLuminosityBlock(luminosityBlock,iES);
143  }
144 
145  void EDLooperBase::beginRun(Run const&, EventSetup const&){}
146  void EDLooperBase::endRun(Run const&, EventSetup const&){}
149 
151 
152 
153  std::set<eventsetup::EventSetupRecordKey>
155  {
156  return std::set<eventsetup::EventSetupRecordKey> ();
157  }
158 
159  void
161  scheduleInfo_ = std::auto_ptr<ScheduleInfo>(new ScheduleInfo(iInfo));
162  }
163  void
165  moduleChanger_ = iChanger;
166  }
167 
169  return moduleChanger_;
170  }
172  return scheduleInfo_.get();
173  }
174 
175 }
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:154
Timestamp const & beginTime() const
std::auto_ptr< ScheduleInfo > scheduleInfo_
Definition: EDLooperBase.h:150
unsigned int iCounter_
Definition: EDLooperBase.h:147
EventID const & id() const
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:76
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:153
Status doDuringLoop(EventPrincipal &eventPrincipal, EventSetup const &es, ProcessingController &, StreamContext *)
Definition: EDLooperBase.cc:46
void setLuminosityBlockIndex(LuminosityBlockIndex const &v)
Definition: StreamContext.h:68
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Timestamp const & beginTime() const
Definition: RunPrincipal.h:73
ModuleChanger const * moduleChanger() const
This only returns a non-zero value during the call to endOfLoop.
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e, edm::JobReport *jobRep=0, int rc=-1)
Timestamp const & endTime() const
Definition: RunPrincipal.h:77
virtual void endOfJob()
Definition: EDLooperBase.cc:93
ModuleChanger const * moduleChanger_
Definition: EDLooperBase.h:151
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()
ExceptionToActionTable const * act_table_
Definition: EDLooperBase.h:148
void copyInfo(ScheduleInfo const &)
virtual void beginOfJob()
Definition: EDLooperBase.cc:91
void setModuleChanger(ModuleChanger const *)
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:81
virtual void beginRun(Run const &, EventSetup const &)
Called after all event modules have processed the begin of a Run.
RunIndex index() const
Definition: RunPrincipal.h:53
virtual void startingNewLoop(unsigned int)=0
void setEventID(EventID const &v)
Definition: StreamContext.h:66
virtual ~EDLooperBase()
Definition: EDLooperBase.cc:38
void doEndLuminosityBlock(LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
tuple status
Definition: ntuplemaker.py:245
void doBeginRun(RunPrincipal &, EventSetup const &, ProcessContext *)
Definition: EDLooperBase.cc:95
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:41
Definition: Run.h:41
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Called after all event modules have processed the end of a LuminosityBlock.