CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::EDLooperBase Class Referenceabstract

#include <EDLooperBase.h>

Inheritance diagram for edm::EDLooperBase:
edm::EDConsumerBase edm::EDLooper edm::NavigateEventsLooper FWFFLooper EcalEleCalibLooper edm::ESProducerLooper edm::IterateNTimesLooper InvRingCalib MuScleFit __class__< T > AlignmentProducer Pi0FixedMassWindowCalibration ZeeCalibration

Public Types

enum  Status { kContinue, kStop }
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void attachTo (ActivityRegistry &)
 Override this method if you need to monitor the state of the processing. More...
 
void beginOfJob (EventSetupImpl const &)
 
virtual void beginOfJob (EventSetup const &)
 
virtual void beginOfJob ()
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetupImpl const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doEndOfLoop (EventSetupImpl const &es)
 
void doEndRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
virtual void endOfJob ()
 
void esPrefetchAsync (WaitingTaskHolder iTask, EventSetupImpl const &iImpl, Transition iTrans, ServiceToken const &iToken) const
 
virtual std::set
< eventsetup::EventSetupRecordKey
modifyingRecords () const
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder iTask, ServiceToken const &token, Transition iTrans, Principal const &iPrincipal, EventSetupImpl const &iImpl) const
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
 ~EDLooperBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Member Functions

virtual void beginLuminosityBlock (LuminosityBlock const &, EventSetup const &)
 Called after all event modules have processed the begin of a LuminosityBlock. More...
 
virtual void beginRun (Run const &, EventSetup const &)
 Called after all event modules have processed the begin of a Run. More...
 
virtual Status duringLoop (Event const &, EventSetup const &, ProcessingController &)=0
 
void edPrefetchAsync (WaitingTaskHolder iTask, ServiceToken const &token, Principal const &iPrincipal) const
 
virtual void endLuminosityBlock (LuminosityBlock const &, EventSetup const &)
 Called after all event modules have processed the end of a LuminosityBlock. More...
 
virtual Status endOfLoop (EventSetup const &, unsigned int iCounter)=0
 
virtual void endRun (Run const &, EventSetup const &)
 Called after all event modules have processed the end of a Run. More...
 
virtual void startingNewLoop (unsigned int)=0
 

Private Attributes

ExceptionToActionTable const * act_table_
 
unsigned int iCounter_
 
ModuleCallingContext moduleCallingContext_
 
edm::propagate_const
< ModuleChanger * > 
moduleChanger_
 
ModuleDescription moduleDescription_
 
edm::propagate_const
< std::unique_ptr
< ScheduleInfo > > 
scheduleInfo_
 

Detailed Description

Definition at line 80 of file EDLooperBase.h.

Member Enumeration Documentation

Enumerator
kContinue 
kStop 

Definition at line 82 of file EDLooperBase.h.

Constructor & Destructor Documentation

EDLooperBase::EDLooperBase ( )

Definition at line 39 of file EDLooperBase.cc.

40  : iCounter_(0),
41  act_table_(nullptr),
42  moduleChanger_(nullptr),
43  moduleDescription_("Looper", "looper"),
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
unsigned int iCounter_
Definition: EDLooperBase.h:164
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
ExceptionToActionTable const * act_table_
Definition: EDLooperBase.h:165
edm::propagate_const< ModuleChanger * > moduleChanger_
Definition: EDLooperBase.h:168
EDLooperBase::~EDLooperBase ( )
overridenoexcept

Definition at line 45 of file EDLooperBase.cc.

45 {}
edm::EDLooperBase::EDLooperBase ( EDLooperBase const &  )
delete

Member Function Documentation

void EDLooperBase::attachTo ( ActivityRegistry )
virtual

Override this method if you need to monitor the state of the processing.

Reimplemented in FWFFLooper.

Definition at line 190 of file EDLooperBase.cc.

190 {}
void EDLooperBase::beginLuminosityBlock ( LuminosityBlock const &  ,
EventSetup const &   
)
privatevirtual

Called after all event modules have processed the begin of a LuminosityBlock.

Reimplemented in AlignmentProducer.

Definition at line 187 of file EDLooperBase.cc.

Referenced by doBeginLuminosityBlock().

187 {}
void EDLooperBase::beginOfJob ( EventSetupImpl const &  iImpl)

Definition at line 96 of file EDLooperBase.cc.

References beginOfJob(), edm::BeginRun, edm::EDConsumerBase::esGetTokenIndices(), and moduleCallingContext_.

96  {
97  ESParentContext parentC(&moduleCallingContext_);
98  beginOfJob(EventSetup{iImpl,
99  static_cast<unsigned int>(Transition::BeginRun),
101  parentC,
102  false});
103  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
virtual void beginOfJob()
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
void EDLooperBase::beginOfJob ( EventSetup const &  )
virtual

Reimplemented in AlignmentProducer.

Definition at line 104 of file EDLooperBase.cc.

References beginOfJob().

104 { beginOfJob(); }
virtual void beginOfJob()
void EDLooperBase::beginOfJob ( )
virtual

Reimplemented in ZeeCalibration, Pi0FixedMassWindowCalibration, __class__< T >, EcalEleCalibLooper, and InvRingCalib.

Definition at line 105 of file EDLooperBase.cc.

Referenced by beginOfJob().

105 {}
void EDLooperBase::beginRun ( Run const &  ,
EventSetup const &   
)
privatevirtual

Called after all event modules have processed the begin of a Run.

Reimplemented in FWFFLooper, and AlignmentProducer.

Definition at line 185 of file EDLooperBase.cc.

Referenced by doBeginRun().

185 {}
void EDLooperBase::copyInfo ( ScheduleInfo const &  iInfo)

Definition at line 294 of file EDLooperBase.cc.

References scheduleInfo_.

294 { scheduleInfo_ = std::make_unique<ScheduleInfo>(iInfo); }
edm::propagate_const< std::unique_ptr< ScheduleInfo > > scheduleInfo_
Definition: EDLooperBase.h:167
void EDLooperBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal iLB,
EventSetupImpl const &  iES,
ProcessContext processContext 
)

Definition at line 142 of file EDLooperBase.cc.

References edm::BeginLuminosityBlock, beginLuminosityBlock(), edm::LuminosityBlockPrincipal::beginTime(), edm::EDConsumerBase::esGetTokenIndices(), edm::LuminosityBlockPrincipal::id(), edm::LuminosityBlockPrincipal::index(), edm::RunPrincipal::index(), edm::GlobalContext::kBeginLuminosityBlock, moduleCallingContext_, moduleDescription_, edm::LuminosityBlockPrincipal::runPrincipal(), and edm::LuminosityBlock::setConsumer().

144  {
145  GlobalContext globalContext(GlobalContext::Transition::kBeginLuminosityBlock,
146  iLB.id(),
147  iLB.runPrincipal().index(),
148  iLB.index(),
149  iLB.beginTime(),
150  processContext);
151  ParentContext parentContext(&globalContext);
152  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
153  LuminosityBlock luminosityBlock(iLB, moduleDescription_, &moduleCallingContext_, false);
154  luminosityBlock.setConsumer(this);
155  ESParentContext parentC(&moduleCallingContext_);
156  const EventSetup es{iES,
157  static_cast<unsigned int>(Transition::BeginLuminosityBlock),
159  parentC,
160  false};
161  beginLuminosityBlock(luminosityBlock, es);
162  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Called after all event modules have processed the begin of a LuminosityBlock.
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
void EDLooperBase::doBeginRun ( RunPrincipal iRP,
EventSetupImpl const &  iES,
ProcessContext processContext 
)

Definition at line 109 of file EDLooperBase.cc.

References edm::BeginRun, beginRun(), edm::RunPrincipal::beginTime(), edm::EDConsumerBase::esGetTokenIndices(), edm::RunPrincipal::index(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::GlobalContext::kBeginRun, moduleCallingContext_, moduleDescription_, edm::RunPrincipal::run(), submitPVValidationJobs::run, and edm::Run::setConsumer().

109  {
110  GlobalContext globalContext(GlobalContext::Transition::kBeginRun,
111  LuminosityBlockID(iRP.run(), 0),
112  iRP.index(),
114  iRP.beginTime(),
115  processContext);
116  ParentContext parentContext(&globalContext);
117  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
119  run.setConsumer(this);
120  ESParentContext parentC(&moduleCallingContext_);
121  const EventSetup es{
122  iES, static_cast<unsigned int>(Transition::BeginRun), esGetTokenIndices(Transition::BeginRun), parentC, false};
123  beginRun(run, es);
124  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
static LuminosityBlockIndex invalidLuminosityBlockIndex()
virtual void beginRun(Run const &, EventSetup const &)
Called after all event modules have processed the begin of a Run.
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
EDLooperBase::Status EDLooperBase::doDuringLoop ( edm::EventPrincipal eventPrincipal,
EventSetupImpl const &  es,
edm::ProcessingController ioController,
StreamContext streamContext 
)

Definition at line 49 of file EDLooperBase.cc.

References act_table_, mps_fire::action, cms::Exception::addContext(), cms::Exception::category(), duringLoop(), alignCSCRings::e, edm::EDConsumerBase::esGetTokenIndices(), edm::Event, edmPickEvents::event, edm::ExceptionToActionTable::find(), edm::EventPrincipal::id(), edm::LuminosityBlockPrincipal::index(), edm::RunPrincipal::index(), kContinue, edm::StreamContext::kEvent, edm::EventPrincipal::luminosityBlockPrincipal(), moduleCallingContext_, moduleDescription_, edm::printCmsExceptionWarning(), edm::exception_actions::Rethrow, edm::LuminosityBlockPrincipal::runPrincipal(), edm::StreamContext::setEventID(), edm::StreamContext::setLuminosityBlockIndex(), edm::StreamContext::setRunIndex(), edm::StreamContext::setTimestamp(), edm::StreamContext::setTransition(), mps_update::status, and edm::EventPrincipal::time().

52  {
53  streamContext->setTransition(StreamContext::Transition::kEvent);
54  streamContext->setEventID(eventPrincipal.id());
55  streamContext->setRunIndex(eventPrincipal.luminosityBlockPrincipal().runPrincipal().index());
56  streamContext->setLuminosityBlockIndex(eventPrincipal.luminosityBlockPrincipal().index());
57  streamContext->setTimestamp(eventPrincipal.time());
58  ParentContext parentContext(streamContext);
59  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
61  event.setConsumer(this);
62 
64  try {
65  ESParentContext parentC(&moduleCallingContext_);
66  const EventSetup es{
67  esi, static_cast<unsigned int>(Transition::Event), esGetTokenIndices(Transition::Event), parentC, false};
68  status = duringLoop(event, es, ioController);
69  } catch (cms::Exception& e) {
70  e.addContext("Calling the 'duringLoop' method of a looper");
72  if (action != exception_actions::Rethrow) {
73  edm::printCmsExceptionWarning("SkipEvent", e);
74  } else {
75  throw;
76  }
77  }
78  return status;
79  }
RunPrincipal const & runPrincipal() const
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
EventID const & id() const
list status
Definition: mps_update.py:107
std::string const & category() const
Definition: Exception.cc:143
exception_actions::ActionCodes find(const std::string &category) const
LuminosityBlockIndex index() const
virtual Status duringLoop(Event const &, EventSetup const &, ProcessingController &)=0
Timestamp const & time() const
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
ExceptionToActionTable const * act_table_
Definition: EDLooperBase.h:165
void addContext(std::string const &context)
Definition: Exception.cc:165
string action
Definition: mps_fire.py:183
RunIndex index() const
Definition: RunPrincipal.h:57
void printCmsExceptionWarning(char const *behavior, cms::Exception const &e)
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
void EDLooperBase::doEndLuminosityBlock ( LuminosityBlockPrincipal iLB,
EventSetupImpl const &  iES,
ProcessContext processContext 
)

Definition at line 163 of file EDLooperBase.cc.

References edm::LuminosityBlockPrincipal::beginTime(), edm::EndLuminosityBlock, endLuminosityBlock(), edm::EDConsumerBase::esGetTokenIndices(), edm::LuminosityBlockPrincipal::id(), edm::LuminosityBlockPrincipal::index(), edm::RunPrincipal::index(), edm::GlobalContext::kEndLuminosityBlock, moduleCallingContext_, moduleDescription_, edm::LuminosityBlockPrincipal::runPrincipal(), and edm::LuminosityBlock::setConsumer().

165  {
166  GlobalContext globalContext(GlobalContext::Transition::kEndLuminosityBlock,
167  iLB.id(),
168  iLB.runPrincipal().index(),
169  iLB.index(),
170  iLB.beginTime(),
171  processContext);
172  ParentContext parentContext(&globalContext);
173  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
174  LuminosityBlock luminosityBlock(iLB, moduleDescription_, &moduleCallingContext_, true);
175  luminosityBlock.setConsumer(this);
176  ESParentContext parentC(&moduleCallingContext_);
177  const EventSetup es{iES,
178  static_cast<unsigned int>(Transition::EndLuminosityBlock),
180  parentC,
181  false};
182  endLuminosityBlock(luminosityBlock, es);
183  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Called after all event modules have processed the end of a LuminosityBlock.
EDLooperBase::Status EDLooperBase::doEndOfLoop ( EventSetupImpl const &  es)

Definition at line 81 of file EDLooperBase.cc.

References endOfLoop(), edm::EndRun, edm::EDConsumerBase::esGetTokenIndices(), iCounter_, and moduleCallingContext_.

81  {
82  ESParentContext parentC(&moduleCallingContext_);
83  const EventSetup es{
84  esi, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
85  return endOfLoop(es, iCounter_);
86  }
virtual Status endOfLoop(EventSetup const &, unsigned int iCounter)=0
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
unsigned int iCounter_
Definition: EDLooperBase.h:164
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
void EDLooperBase::doEndRun ( RunPrincipal iRP,
EventSetupImpl const &  iES,
ProcessContext processContext 
)

Definition at line 126 of file EDLooperBase.cc.

References edm::EndRun, endRun(), edm::RunPrincipal::endTime(), edm::EDConsumerBase::esGetTokenIndices(), edm::RunPrincipal::index(), edm::LuminosityBlockIndex::invalidLuminosityBlockIndex(), edm::GlobalContext::kEndRun, moduleCallingContext_, moduleDescription_, edm::RunPrincipal::run(), submitPVValidationJobs::run, and edm::Run::setConsumer().

126  {
127  GlobalContext globalContext(GlobalContext::Transition::kEndRun,
128  LuminosityBlockID(iRP.run(), 0),
129  iRP.index(),
131  iRP.endTime(),
132  processContext);
133  ParentContext parentContext(&globalContext);
134  ModuleContextSentry moduleContextSentry(&moduleCallingContext_, parentContext);
136  run.setConsumer(this);
137  ESParentContext parentC(&moduleCallingContext_);
138  const EventSetup es{
139  iES, static_cast<unsigned int>(Transition::EndRun), esGetTokenIndices(Transition::EndRun), parentC, false};
140  endRun(run, es);
141  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
ModuleDescription moduleDescription_
Definition: EDLooperBase.h:170
static LuminosityBlockIndex invalidLuminosityBlockIndex()
virtual void endRun(Run const &, EventSetup const &)
Called after all event modules have processed the end of a Run.
ESProxyIndex const * esGetTokenIndices(edm::Transition iTrans) const
void EDLooperBase::doStartingNewLoop ( )

Definition at line 47 of file EDLooperBase.cc.

References iCounter_, and startingNewLoop().

unsigned int iCounter_
Definition: EDLooperBase.h:164
virtual void startingNewLoop(unsigned int)=0
virtual Status edm::EDLooperBase::duringLoop ( Event const &  ,
EventSetup const &  ,
ProcessingController  
)
privatepure virtual

Called after all event modules have had a chance to process the Event.

Implemented in FWFFLooper, edm::EDLooper, and edm::NavigateEventsLooper.

Referenced by doDuringLoop().

void EDLooperBase::edPrefetchAsync ( WaitingTaskHolder  iTask,
ServiceToken const &  token,
Principal const &  iPrincipal 
) const
private

Definition at line 201 of file EDLooperBase.cc.

References edm::Principal::branchType(), B2GTnPMonitor_cfi::item, mps_monitormerge::items, edm::EDConsumerBase::itemsToGetFrom(), moduleCallingContext_, edm::Principal::prefetchAsync(), and edm::ProductResolverIndexAmbiguous.

Referenced by prefetchAsync().

203  {
204  //Based on Worker edPrefetchAsync
205 
206  // Prefetch products the module declares it consumes
207  std::vector<ProductResolverIndexAndSkipBit> const& items = itemsToGetFrom(iPrincipal.branchType());
208 
209  for (auto const& item : items) {
210  ProductResolverIndex productResolverIndex = item.productResolverIndex();
211  bool skipCurrentProcess = item.skipCurrentProcess();
212  if (productResolverIndex != ProductResolverIndexAmbiguous) {
213  iPrincipal.prefetchAsync(iTask, productResolverIndex, skipCurrentProcess, token, &moduleCallingContext_);
214  }
215  }
216  }
unsigned int ProductResolverIndex
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType iType) const
void EDLooperBase::endLuminosityBlock ( LuminosityBlock const &  ,
EventSetup const &   
)
privatevirtual

Called after all event modules have processed the end of a LuminosityBlock.

Reimplemented in AlignmentProducer.

Definition at line 188 of file EDLooperBase.cc.

Referenced by doEndLuminosityBlock().

188 {}
void EDLooperBase::endOfJob ( )
virtual
virtual Status edm::EDLooperBase::endOfLoop ( EventSetup const &  ,
unsigned int  iCounter 
)
privatepure virtual

Called after the system has finished one loop over the events. Thar argument is a count of how many loops have been processed before this loo. For the first time through the events the argument will be 0.

Implemented in MuScleFit, ZeeCalibration, FWFFLooper, Pi0FixedMassWindowCalibration, EcalEleCalibLooper, InvRingCalib, edm::NavigateEventsLooper, AlignmentProducer, and edm::IterateNTimesLooper.

Referenced by doEndOfLoop().

void EDLooperBase::endRun ( Run const &  ,
EventSetup const &   
)
privatevirtual

Called after all event modules have processed the end of a Run.

Reimplemented in AlignmentProducer.

Definition at line 186 of file EDLooperBase.cc.

Referenced by doEndRun().

186 {}
void EDLooperBase::esPrefetchAsync ( WaitingTaskHolder  iTask,
EventSetupImpl const &  iImpl,
Transition  iTrans,
ServiceToken const &  iToken 
) const

Definition at line 218 of file EDLooperBase.cc.

References cms::cuda::assert(), edm::EDConsumerBase::esGetTokenIndicesVector(), edm::EDConsumerBase::esGetTokenRecordIndicesVector(), edm::EventSetupImpl::findImpl(), edm::WaitingTaskHolder::group(), watchdog::group, mps_fire::i, mps_monitormerge::items, edm::ServiceWeakToken::lock(), edm::make_waiting_task(), moduleCallingContext_, eostools::move(), edm::NumberOfEventSetupTransitions, edm::eventsetup::EventSetupRecordImpl::prefetchAsync(), edm::syncWait(), edm::EventSetupImpl::taskArena(), unpackBuffers-CaloStage2::token, and UNLIKELY.

Referenced by prefetchAsync().

221  {
222  //Based on Worker::esPrefetchAsync
224  return;
225  }
226  auto const& recs = esGetTokenRecordIndicesVector(iTrans);
227  auto const& items = esGetTokenIndicesVector(iTrans);
228 
229  assert(items.size() == recs.size());
230  if (items.empty()) {
231  return;
232  }
233 
234  //Thread case of 1 thread special. The master thread is doing a wait_for_all on the
235  // default tbb arena. It will not process any tasks on the es arena. We need to add a
236  // task that will synchronously do a wait_for_all in the es arena to be sure prefetching
237  // will work.
238 
239  if UNLIKELY (tbb::global_control::active_value(tbb::global_control::max_allowed_parallelism) == 1) {
240  auto taskGroup = iTask.group();
241  ServiceWeakToken weakToken = iToken;
242  taskGroup->run([this, task = std::move(iTask), iTrans, &iImpl, weakToken]() {
243  std::exception_ptr exceptPtr{};
244  iImpl.taskArena()->execute([this, iTrans, &iImpl, weakToken, &exceptPtr]() {
245  exceptPtr = syncWait([&](WaitingTaskHolder&& iHolder) {
246  auto const& recs = esGetTokenRecordIndicesVector(iTrans);
247  auto const& items = esGetTokenIndicesVector(iTrans);
248  auto hWaitTask = std::move(iHolder);
249  auto token = weakToken.lock();
250  for (size_t i = 0; i != items.size(); ++i) {
251  if (recs[i] != ESRecordIndex{}) {
252  auto rec = iImpl.findImpl(recs[i]);
253  if (rec) {
254  rec->prefetchAsync(hWaitTask, items[i], &iImpl, token, ESParentContext(&moduleCallingContext_));
255  }
256  }
257  }
258  }); //syncWait
259  }); //esTaskArena().execute
260  //note use of a copy gets around declaring the lambda as mutable
261  auto tempTask = task;
262  tempTask.doneWaiting(exceptPtr);
263  }); //group.run
264  } else {
265  auto group = iTask.group();
266  //We need iTask to run in the default arena since it is not an ES task
267  auto task = make_waiting_task(
268  [holder = WaitingTaskWithArenaHolder(std::move(iTask))](std::exception_ptr const* iExcept) mutable {
269  if (iExcept) {
270  holder.doneWaiting(*iExcept);
271  } else {
272  holder.doneWaiting(std::exception_ptr{});
273  }
274  });
275 
276  WaitingTaskHolder tempH(*group, task);
277  iImpl.taskArena()->execute([&]() {
278  for (size_t i = 0; i != items.size(); ++i) {
279  if (recs[i] != ESRecordIndex{}) {
280  auto rec = iImpl.findImpl(recs[i]);
281  if (rec) {
282  rec->prefetchAsync(tempH, items[i], &iImpl, iToken, ESParentContext(&moduleCallingContext_));
283  }
284  }
285  }
286  });
287  }
288  }
ModuleCallingContext moduleCallingContext_
Definition: EDLooperBase.h:171
std::exception_ptr syncWait(F &&iFunc)
std::vector< ESProxyIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
assert(be >=bs)
def move
Definition: eostools.py:511
FunctorWaitingTask< F > * make_waiting_task(F f)
Definition: WaitingTask.h:101
tuple group
Definition: watchdog.py:82
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
#define UNLIKELY(x)
Definition: Likely.h:21
std::set< eventsetup::EventSetupRecordKey > EDLooperBase::modifyingRecords ( ) const
virtual

Reimplemented in edm::ESProducerLooper.

Definition at line 290 of file EDLooperBase.cc.

Referenced by prepareForNextLoop().

290  {
291  return std::set<eventsetup::EventSetupRecordKey>();
292  }
ModuleChanger * EDLooperBase::moduleChanger ( )
protected

This only returns a non-zero value during the call to endOfLoop.

Definition at line 297 of file EDLooperBase.cc.

References moduleChanger_.

Referenced by FWFFLooper::endOfLoop().

297 { return moduleChanger_; }
edm::propagate_const< ModuleChanger * > moduleChanger_
Definition: EDLooperBase.h:168
EDLooperBase& edm::EDLooperBase::operator= ( EDLooperBase const &  )
delete
void EDLooperBase::prefetchAsync ( WaitingTaskHolder  iTask,
ServiceToken const &  token,
Transition  iTrans,
Principal const &  iPrincipal,
EventSetupImpl const &  iImpl 
) const

Definition at line 192 of file EDLooperBase.cc.

References edPrefetchAsync(), esPrefetchAsync(), and eostools::move().

196  {
197  esPrefetchAsync(iTask, iImpl, iTrans, token);
198  edPrefetchAsync(std::move(iTask), token, iPrincipal);
199  }
def move
Definition: eostools.py:511
void edPrefetchAsync(WaitingTaskHolder iTask, ServiceToken const &token, Principal const &iPrincipal) const
void esPrefetchAsync(WaitingTaskHolder iTask, EventSetupImpl const &iImpl, Transition iTrans, ServiceToken const &iToken) const
void EDLooperBase::prepareForNextLoop ( eventsetup::EventSetupProvider esp)

Definition at line 88 of file EDLooperBase.cc.

References edm::for_all(), iCounter_, relativeConstraints::keys, modifyingRecords(), and edm::eventsetup::EventSetupProvider::resetRecordPlusDependentRecords().

88  {
89  ++iCounter_;
90 
91  std::set<edm::eventsetup::EventSetupRecordKey> const& keys = modifyingRecords();
92  for_all(keys,
93  std::bind(&eventsetup::EventSetupProvider::resetRecordPlusDependentRecords, esp, std::placeholders::_1));
94  }
unsigned int iCounter_
Definition: EDLooperBase.h:164
virtual std::set< eventsetup::EventSetupRecordKey > modifyingRecords() const
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
void resetRecordPlusDependentRecords(EventSetupRecordKey const &)
Used when we need to force a Record to reset all its proxies.
const ScheduleInfo * EDLooperBase::scheduleInfo ( ) const
protected

This returns a non-zero value after the constructor has been called.

Definition at line 298 of file EDLooperBase.cc.

References scheduleInfo_.

Referenced by FWFFLooper::startingNewLoop().

298 { return scheduleInfo_.get(); }
edm::propagate_const< std::unique_ptr< ScheduleInfo > > scheduleInfo_
Definition: EDLooperBase.h:167
void edm::EDLooperBase::setActionTable ( ExceptionToActionTable const *  actionTable)
inline

Definition at line 120 of file EDLooperBase.h.

References act_table_.

120 { act_table_ = actionTable; }
ExceptionToActionTable const * act_table_
Definition: EDLooperBase.h:165
void EDLooperBase::setModuleChanger ( ModuleChanger iChanger)

Definition at line 295 of file EDLooperBase.cc.

References moduleChanger_.

295 { moduleChanger_ = iChanger; }
edm::propagate_const< ModuleChanger * > moduleChanger_
Definition: EDLooperBase.h:168
virtual void edm::EDLooperBase::startingNewLoop ( unsigned  int)
privatepure virtual

Called before system starts to loop over the events. The argument is a count of how many loops have been processed. For the first time through the events the argument will be 0.

Implemented in MuScleFit, ZeeCalibration, FWFFLooper, Pi0FixedMassWindowCalibration, __class__< T >, EcalEleCalibLooper, InvRingCalib, edm::NavigateEventsLooper, edm::IterateNTimesLooper, and AlignmentProducer.

Referenced by doStartingNewLoop().

Member Data Documentation

ExceptionToActionTable const* edm::EDLooperBase::act_table_
private

Definition at line 165 of file EDLooperBase.h.

Referenced by doDuringLoop(), and setActionTable().

unsigned int edm::EDLooperBase::iCounter_
private

Definition at line 164 of file EDLooperBase.h.

Referenced by doEndOfLoop(), doStartingNewLoop(), and prepareForNextLoop().

ModuleCallingContext edm::EDLooperBase::moduleCallingContext_
private
edm::propagate_const<ModuleChanger*> edm::EDLooperBase::moduleChanger_
private

Definition at line 168 of file EDLooperBase.h.

Referenced by moduleChanger(), and setModuleChanger().

ModuleDescription edm::EDLooperBase::moduleDescription_
private
edm::propagate_const<std::unique_ptr<ScheduleInfo> > edm::EDLooperBase::scheduleInfo_
private

Definition at line 167 of file EDLooperBase.h.

Referenced by copyInfo(), and scheduleInfo().