CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
edm::EventPrincipal Class Reference

#include <EventPrincipal.h>

Inheritance diagram for edm::EventPrincipal:
edm::Principal edm::EDProductGetter

Public Types

typedef EventAuxiliary Auxiliary
 
typedef Principal Base
 
typedef Base::ConstProductPtr ConstProductPtr
 
- Public Types inherited from edm::Principal
typedef std::vector< BasicHandleBasicHandleVec
 
typedef boost::filter_iterator
< FilledProductPtr,
ProductHolderCollection::const_iterator > 
const_iterator
 
typedef ProductHolderBase const * ConstProductPtr
 
typedef std::string ProcessName
 
typedef
ProcessHistory::const_iterator 
ProcessNameConstIterator
 
typedef std::vector
< boost::shared_ptr
< ProductHolderBase > > 
ProductHolderCollection
 
typedef boost::shared_ptr
< ProductHolderBase
SharedProductPtr
 
typedef
ProductHolderCollection::size_type 
size_type
 

Public Member Functions

EventAuxiliary const & aux () const
 
ProductID branchIDToProductID (BranchID const &bid) const
 
BranchListIndexes const & branchListIndexes () const
 
boost::shared_ptr< BranchMapperbranchMapperPtr () const
 
int bunchCrossing () const
 
void clearEventPrincipal ()
 
 EventPrincipal (boost::shared_ptr< ProductRegistry const > reg, boost::shared_ptr< BranchIDListHelper const > branchIDListHelper, ProcessConfiguration const &pc, HistoryAppender *historyAppender)
 
EventSelectionIDVector const & eventSelectionIDs () const
 
EventAuxiliary::ExperimentType ExperimentType () const
 
void fillEventPrincipal (EventAuxiliary const &aux, boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs=boost::shared_ptr< EventSelectionIDVector >(), boost::shared_ptr< BranchListIndexes > branchListIndexes=boost::shared_ptr< BranchListIndexes >(), boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), DelayedReader *reader=0)
 
BasicHandle getByProductID (ProductID const &oid) const
 
WrapperHolder getIt (ProductID const &pid) const
 
Provenance getProvenance (ProductID const &pid) const
 
EventID const & id () const
 
bool isReal () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
LuminosityBlockPrincipal const & luminosityBlockPrincipal () const
 
LuminosityBlockPrincipalluminosityBlockPrincipal ()
 
bool luminosityBlockPrincipalPtrValid ()
 
void mergeMappers (EventPrincipal const &other)
 
void put (ConstBranchDescription const &bd, WrapperOwningHolder const &edp, ProductProvenance const &productProvenance)
 
void putOnRead (ConstBranchDescription const &bd, void const *product, ProductProvenance const &productProvenance)
 
RunNumber_t run () const
 
RunPrincipal const & runPrincipal () const
 
void setLuminosityBlockPrincipal (boost::shared_ptr< LuminosityBlockPrincipal > const &lbp)
 
void setUnscheduledHandler (boost::shared_ptr< UnscheduledHandler > iHandler)
 
int storeNumber () const
 
Timestamp const & time () const
 
boost::shared_ptr
< UnscheduledHandler
unscheduledHandler () const
 
 ~EventPrincipal ()
 
- Public Member Functions inherited from edm::Principal
void addAliasedProduct (boost::shared_ptr< ConstBranchDescription > bd)
 
void addInputProduct (boost::shared_ptr< ConstBranchDescription > bd)
 
void addScheduledProduct (boost::shared_ptr< ConstBranchDescription > bd)
 
void addSourceProduct (boost::shared_ptr< ConstBranchDescription > bd)
 
void addUnscheduledProduct (boost::shared_ptr< ConstBranchDescription > bd)
 
void adjustIndexesAfterProductRegistryAddition ()
 
bool adjustToNewProductRegistry (ProductRegistry const &reg)
 
const_iterator begin () const
 
BranchType const & branchType () const
 
void clearPrincipal ()
 
void deleteProduct (BranchID const &id)
 
const_iterator end () const
 
void fillPrincipal (ProcessHistoryID const &hist, DelayedReader *reader)
 
ProductData const * findProductByTag (TypeID const &typeID, InputTag const &tag) const
 
void getAllProvenance (std::vector< Provenance const * > &provenances) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process) const
 
BasicHandle getByToken (KindOfType kindOfType, TypeID const &typeID, ProductHolderIndex index, bool skipCurrentProcess, bool &ambiguous) const
 
OutputHandle getForOutput (BranchID const &bid, bool getProd) const
 
void getManyByType (TypeID const &typeID, BasicHandleVec &results) const
 
ConstProductPtr getProductByIndex (ProductHolderIndex const &oid, bool resolveProd, bool fillOnDemand) const
 
ConstProductPtr getProductHolder (BranchID const &oid, bool resolveProd, bool fillOnDemand) const
 
Provenance getProvenance (BranchID const &bid) const
 
bool isComplete () const
 
std::vector< unsigned int > const & lookupProcessOrder () const
 
 Principal (boost::shared_ptr< ProductRegistry const > reg, boost::shared_ptr< ProductHolderIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender)
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
EDProductGetter const * prodGetter () const
 
ProductHolderIndexHelper const & productLookup () const
 
ProductRegistry const & productRegistry () const
 
DelayedReaderreader () const
 
void recombine (Principal &other, std::vector< BranchID > const &bids)
 
void resolveProduct (ProductHolderBase const &phb, bool fillOnDemand) const
 
size_t size () const
 
virtual ~Principal ()
 
- Public Member Functions inherited from edm::EDProductGetter
 EDProductGetter ()
 
virtual ~EDProductGetter ()
 

Static Public Attributes

static int const invalidBunchXing = EventAuxiliary::invalidBunchXing
 
static int const invalidStoreNumber = EventAuxiliary::invalidStoreNumber
 

Private Member Functions

BranchID pidToBid (ProductID const &pid) const
 
virtual void resolveProduct_ (ProductHolderBase const &phb, bool fillOnDemand) const override
 
virtual bool unscheduledFill (std::string const &moduleLabel) const override
 

Private Attributes

EventAuxiliary aux_
 
boost::shared_ptr
< BranchIDListHelper const > 
branchIDListHelper_
 
boost::shared_ptr
< BranchListIndexes
branchListIndexes_
 
std::map< BranchListIndex,
ProcessIndex
branchListIndexToProcessIndex_
 
boost::shared_ptr< BranchMapperbranchMapperPtr_
 
boost::shared_ptr
< EventSelectionIDVector
eventSelectionIDs_
 
boost::shared_ptr
< LuminosityBlockPrincipal
luminosityBlockPrincipal_
 
std::vector< std::string > moduleLabelsRunning_
 
boost::shared_ptr
< UnscheduledHandler
unscheduledHandler_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProductGetter
static void assignEDProductGetter (EDProductGetter const *&)
 
static EDProductGetter const * switchProductGetter (EDProductGetter const *)
 These can only be used internally by the framework. More...
 
- Protected Member Functions inherited from edm::Principal
void addProduct_ (std::auto_ptr< ProductHolderBase > phb)
 
void addProductOrThrow (std::auto_ptr< ProductHolderBase > phb)
 
void checkUniquenessAndType (WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
 
ProductHolderBasegetExistingProduct (BranchID const &branchID)
 
ProductHolderBasegetExistingProduct (ProductHolderBase const &phb)
 
void putOrMerge (WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
 
void putOrMerge (WrapperOwningHolder const &prod, ProductProvenance &prov, ProductHolderBase *productHolder)
 

Detailed Description

Definition at line 40 of file EventPrincipal.h.

Member Typedef Documentation

Definition at line 42 of file EventPrincipal.h.

Definition at line 43 of file EventPrincipal.h.

Definition at line 45 of file EventPrincipal.h.

Constructor & Destructor Documentation

edm::EventPrincipal::EventPrincipal ( boost::shared_ptr< ProductRegistry const >  reg,
boost::shared_ptr< BranchIDListHelper const >  branchIDListHelper,
ProcessConfiguration const &  pc,
HistoryAppender historyAppender 
)

Definition at line 21 of file EventPrincipal.cc.

25  :
26  Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender),
27  aux_(),
33  branchIDListHelper_(branchIDListHelper),
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
EventAuxiliary aux_
std::vector< EventSelectionID > EventSelectionIDVector
boost::shared_ptr< BranchMapper > branchMapperPtr_
std::vector< BranchListIndex > BranchListIndexes
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
boost::shared_ptr< BranchListIndexes > branchListIndexes_
boost::shared_ptr< BranchIDListHelper const > branchIDListHelper_
std::vector< std::string > moduleLabelsRunning_
edm::EventPrincipal::~EventPrincipal ( )
inline

Definition at line 53 of file EventPrincipal.h.

53 {}

Member Function Documentation

EventAuxiliary const& edm::EventPrincipal::aux ( ) const
inline
ProductID edm::EventPrincipal::branchIDToProductID ( BranchID const &  bid) const

Definition at line 170 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexToProcessIndex_, edm::hlt::Exception, i, edm::BranchID::isValid(), and edm::errors::NotFound.

Referenced by fillEventPrincipal(), and edm::Event::makeProductID().

170  {
171  if(!bid.isValid()) {
172  throw Exception(errors::NotFound, "InvalidID")
173  << "branchIDToProductID: invalid BranchID supplied\n";
174  }
175  typedef BranchIDListHelper::BranchIDToIndexMap BIDToIndexMap;
176  typedef BIDToIndexMap::const_iterator Iter;
177  typedef std::pair<Iter, Iter> IndexRange;
178 
179  IndexRange range = branchIDListHelper_->branchIDToIndexMap().equal_range(bid);
180  for(Iter it = range.first; it != range.second; ++it) {
181  BranchListIndex blix = it->second.first;
182  std::map<BranchListIndex, ProcessIndex>::const_iterator i = branchListIndexToProcessIndex_.find(blix);
183  if(i != branchListIndexToProcessIndex_.end()) {
184  ProductIndex productIndex = it->second.second;
185  ProcessIndex processIndex = i->second;
186  return ProductID(processIndex+1, productIndex+1);
187  }
188  }
189  // cannot throw, because some products may legitimately not have product ID's (e.g. pile-up).
190  return ProductID();
191  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
std::multimap< BranchID, IndexPair > BranchIDToIndexMap
unsigned short ProcessIndex
Definition: ProductID.h:25
boost::shared_ptr< BranchIDListHelper const > branchIDListHelper_
unsigned short ProductIndex
Definition: ProductID.h:26
BranchListIndexes const & edm::EventPrincipal::branchListIndexes ( ) const

Definition at line 257 of file EventPrincipal.cc.

References branchListIndexes_.

Referenced by fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), edm::SubProcess::write(), and edm::RootOutputFile::writeOne().

257  {
258  return *branchListIndexes_;
259  }
boost::shared_ptr< BranchListIndexes > branchListIndexes_
boost::shared_ptr<BranchMapper> edm::EventPrincipal::branchMapperPtr ( ) const
inline
int edm::EventPrincipal::bunchCrossing ( ) const
inline

Definition at line 93 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::bunchCrossing().

93  {
94  return aux().bunchCrossing();
95  }
int bunchCrossing() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::clearEventPrincipal ( )

Definition at line 38 of file EventPrincipal.cc.

References aux_, branchListIndexes_, branchListIndexToProcessIndex_, branchMapperPtr_, edm::Principal::clearPrincipal(), eventSelectionIDs_, luminosityBlockPrincipal_, moduleLabelsRunning_, and unscheduledHandler_.

Referenced by edm::VectorInputSource::clearEventPrincipal(), and edm::EventProcessor::readAndProcessEvent().

38  {
40  aux_ = EventAuxiliary();
42  branchMapperPtr_.reset();
43  unscheduledHandler_.reset();
44  moduleLabelsRunning_.clear();
45  eventSelectionIDs_->clear();
46  branchListIndexes_->clear();
48  }
void clearPrincipal()
Definition: Principal.cc:280
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
EventAuxiliary aux_
boost::shared_ptr< BranchMapper > branchMapperPtr_
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
boost::shared_ptr< BranchListIndexes > branchListIndexes_
std::vector< std::string > moduleLabelsRunning_
EventSelectionIDVector const & edm::EventPrincipal::eventSelectionIDs ( ) const

Definition at line 252 of file EventPrincipal.cc.

References eventSelectionIDs_.

Referenced by edm::Event::eventSelectionIDs(), fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), edm::SubProcess::write(), and edm::RootOutputFile::writeOne().

252  {
253  return *eventSelectionIDs_;
254  }
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType ( ) const
inline

Definition at line 89 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::experimentType().

89  {
90  return aux().experimentType();
91  }
ExperimentType experimentType() const
EventAuxiliary const & aux() const
void edm::EventPrincipal::fillEventPrincipal ( EventAuxiliary const &  aux,
boost::shared_ptr< EventSelectionIDVector eventSelectionIDs = boost::shared_ptr<EventSelectionIDVector>(),
boost::shared_ptr< BranchListIndexes branchListIndexes = boost::shared_ptr<BranchListIndexes>(),
boost::shared_ptr< BranchMapper mapper = boost::shared_ptr<BranchMapper>(new BranchMapper),
DelayedReader reader = 0 
)

Definition at line 51 of file EventPrincipal.cc.

References aux(), aux_, branchIDToProductID(), branchListIndexes(), branchListIndexes_, branchListIndexToProcessIndex_, branchMapperPtr(), branchMapperPtr_, eventSelectionIDs(), eventSelectionIDs_, edm::Principal::fillPrincipal(), edm::InEvent, edm::EventAuxiliary::processHistoryID(), edm::Principal::processHistoryID(), parseEventContent::prod, edm::Principal::productRegistry(), and edm::Principal::reader().

Referenced by edm::RawInputSource::makeEvent(), edm::StreamerInputSource::read(), edm::RootFile::readCurrentEvent(), LHESource::readEvent_(), edm::DaqSource::readEvent_(), edm::ProducerSourceBase::readEvent_(), and edm::SubProcess::write().

55  {
57  aux_ = aux;
58  if(eventSelectionIDs) {
60  }
61  aux_.setProcessHistoryID(processHistoryID());
62 
63  branchMapperPtr_ = mapper;
64 
65  if(branchListIndexes) {
67  }
68 
69  if(productRegistry().productProduced(InEvent)) {
70  // Add index into BranchIDListRegistry for products produced this process
71  branchListIndexes_->push_back(productRegistry().producedBranchListIndex());
72  }
73 
74  // Fill in helper map for Branch to ProductID mapping
75  ProcessIndex pix = 0;
76  for(auto const& blindex : *branchListIndexes_) {
77  branchListIndexToProcessIndex_.insert(std::make_pair(blindex, pix));
78  ++pix;
79  }
80 
81  // Fill in the product ID's in the product holders.
82  for(auto const& prod : *this) {
83  if (prod->singleProduct()) {
84  prod->setProvenance(branchMapperPtr(), processHistoryID(), branchIDToProductID(prod->branchDescription().branchID()));
85  }
86  }
87  }
ProductRegistry const & productRegistry() const
Definition: Principal.h:135
EventSelectionIDVector const & eventSelectionIDs() const
std::map< BranchListIndex, ProcessIndex > branchListIndexToProcessIndex_
EventAuxiliary aux_
BranchListIndexes const & branchListIndexes() const
ProductID branchIDToProductID(BranchID const &bid) const
boost::shared_ptr< BranchMapper > branchMapperPtr_
boost::shared_ptr< BranchMapper > branchMapperPtr() const
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:129
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
unsigned short ProcessIndex
Definition: ProductID.h:25
DelayedReader * reader() const
Definition: Principal.h:154
boost::shared_ptr< BranchListIndexes > branchListIndexes_
ProcessHistoryID const & processHistoryID() const
void fillPrincipal(ProcessHistoryID const &hist, DelayedReader *reader)
Definition: Principal.cc:303
EventAuxiliary const & aux() const
BasicHandle edm::EventPrincipal::getByProductID ( ProductID const &  oid) const

Definition at line 204 of file EventPrincipal.cc.

References edm::hlt::Exception, edm::Principal::getProductHolder(), pidToBid(), edm::errors::ProductNotFound, and edm::throwProductDeletedException().

Referenced by edm::Event::getByProductID_(), and getIt().

204  {
205  BranchID bid = pidToBid(pid);
206  ConstProductPtr const phb = getProductHolder(bid, true, true);
207  if(phb == nullptr) {
208  boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID"));
209  *whyFailed
210  << "get by product ID: no product with given id: " << pid << "\n";
211  return BasicHandle(whyFailed);
212  }
213 
214  // Was this already deleted?
215  if(phb->productWasDeleted()) {
217  }
218  // Check for case where we tried on demand production and
219  // it failed to produce the object
220  if(phb->onDemand()) {
221  boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID"));
222  *whyFailed
223  << "get by product ID: no product with given id: " << pid << "\n"
224  << "onDemand production failed to produce it.\n";
225  return BasicHandle(whyFailed);
226  }
227  return BasicHandle(phb->productData());
228  }
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstProductPtr const phb)
BranchID pidToBid(ProductID const &pid) const
ConstProductPtr getProductHolder(BranchID const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:399
Base::ConstProductPtr ConstProductPtr
WrapperHolder edm::EventPrincipal::getIt ( ProductID const &  pid) const
virtual

Reimplemented from edm::Principal.

Definition at line 231 of file EventPrincipal.cc.

References getByProductID(), and edm::BasicHandle::wrapperHolder().

231  {
232  return getByProductID(pid).wrapperHolder();
233  }
BasicHandle getByProductID(ProductID const &oid) const
WrapperHolder wrapperHolder() const
Definition: BasicHandle.h:106
Provenance edm::EventPrincipal::getProvenance ( ProductID const &  pid) const

Definition at line 236 of file EventPrincipal.cc.

References pidToBid().

Referenced by edm::Event::getProvenance(), and edm::RootOutputFile::insertAncestors().

236  {
237  BranchID bid = pidToBid(pid);
238  return getProvenance(bid);
239  }
BranchID pidToBid(ProductID const &pid) const
Provenance getProvenance(ProductID const &pid) const
EventID const& edm::EventPrincipal::id ( void  ) const
inline
bool edm::EventPrincipal::isReal ( ) const
inline

Definition at line 85 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::isRealData().

85  {
86  return aux().isRealData();
87  }
bool isRealData() const
EventAuxiliary const & aux() const
LuminosityBlockNumber_t edm::EventPrincipal::luminosityBlock ( ) const
inline
LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal ( ) const
inline

Definition at line 63 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by runPrincipal().

63  {
65  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal ( )
inline

Definition at line 67 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

67  {
69  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
bool edm::EventPrincipal::luminosityBlockPrincipalPtrValid ( )
inline

Definition at line 71 of file EventPrincipal.h.

References luminosityBlockPrincipal_.

Referenced by edm::EventProcessor::readAndProcessEvent().

71  {
72  return (luminosityBlockPrincipal_) ? true : false;
73  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
void edm::EventPrincipal::mergeMappers ( EventPrincipal const &  other)
inline

Definition at line 144 of file EventPrincipal.h.

References branchMapperPtr(), and branchMapperPtr_.

Referenced by edm::PoolSource::readEvent_().

144  {
145  branchMapperPtr_->mergeMappers(other.branchMapperPtr());
146  }
boost::shared_ptr< BranchMapper > branchMapperPtr_
BranchID edm::EventPrincipal::pidToBid ( ProductID const &  pid) const
private

Definition at line 161 of file EventPrincipal.cc.

References branchIDListHelper_, branchListIndexes_, edm::hlt::Exception, edm::ProductID::isValid(), edm::productIDToBranchID(), and edm::errors::ProductNotFound.

Referenced by getByProductID(), and getProvenance().

161  {
162  if(!pid.isValid()) {
163  throw Exception(errors::ProductNotFound, "InvalidID")
164  << "get by product ID: invalid ProductID supplied\n";
165  }
167  }
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
boost::shared_ptr< BranchListIndexes > branchListIndexes_
boost::shared_ptr< BranchIDListHelper const > branchIDListHelper_
void edm::EventPrincipal::put ( ConstBranchDescription const &  bd,
WrapperOwningHolder const &  edp,
ProductProvenance const &  productProvenance 
)

Definition at line 100 of file EventPrincipal.cc.

References edm::ConstBranchDescription::branchID(), branchMapperPtr(), edm::Principal::checkUniquenessAndType(), edm::hlt::Exception, edm::Principal::getExistingProduct(), edm::errors::InsertFailure, edm::WrapperHolder::isValid(), and edm::ProductHolderBase::putProduct().

Referenced by edm::Event::commit_aux(), LHESource::readEvent_(), and edm::DaqSource::readEvent_().

103  {
104 
105  // assert commented out for DaqSource. When DaqSource no longer uses put(), the assert can be restored.
106  //assert(produced());
107  if(!edp.isValid()) {
108  throw Exception(errors::InsertFailure, "Null Pointer")
109  << "put: Cannot put because ptr to product is null."
110  << "\n";
111  }
112  branchMapperPtr()->insertIntoSet(productProvenance);
113  ProductHolderBase* phb = getExistingProduct(bd.branchID());
114  assert(phb);
115  checkUniquenessAndType(edp, phb);
116  // ProductHolder assumes ownership
117  phb->putProduct(edp, productProvenance);
118  }
void checkUniquenessAndType(WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
Definition: Principal.cc:746
boost::shared_ptr< BranchMapper > branchMapperPtr() const
ProductHolderBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:353
void edm::EventPrincipal::putOnRead ( ConstBranchDescription const &  bd,
void const *  product,
ProductProvenance const &  productProvenance 
)

Definition at line 121 of file EventPrincipal.cc.

References edm::ConstBranchDescription::branchID(), branchMapperPtr(), edm::Principal::checkUniquenessAndType(), edm::Principal::getExistingProduct(), edm::ProductData::getInterface(), edm::ConstBranchDescription::produced(), edm::ProductHolderBase::productData(), and edm::ProductHolderBase::putProduct().

Referenced by edm::StreamerInputSource::read().

124  {
125 
126  assert(!bd.produced());
127  branchMapperPtr()->insertIntoSet(productProvenance);
128  ProductHolderBase* phb = getExistingProduct(bd.branchID());
129  assert(phb);
130  WrapperOwningHolder const edp(product, phb->productData().getInterface());
131  checkUniquenessAndType(edp, phb);
132  // ProductHolder assumes ownership
133  phb->putProduct(edp, productProvenance);
134  }
void checkUniquenessAndType(WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
Definition: Principal.cc:746
boost::shared_ptr< BranchMapper > branchMapperPtr() const
ProductHolderBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:353
void edm::EventPrincipal::resolveProduct_ ( ProductHolderBase const &  phb,
bool  fillOnDemand 
) const
overrideprivatevirtual

Reimplemented from edm::Principal.

Definition at line 137 of file EventPrincipal.cc.

References edm::ProductHolderBase::branchDescription(), edm::Principal::checkUniquenessAndType(), edm::ProductData::getInterface(), edm::getProduct(), edm::ProductHolderBase::onDemand(), edm::ConstBranchDescription::produced(), edm::ProductHolderBase::product(), edm::ProductHolderBase::productData(), edm::ProductHolderBase::productUnavailable(), edm::ProductHolderBase::putProduct(), edm::Principal::reader(), edm::ProductHolderBase::resolvedModuleLabel(), and unscheduledFill().

137  {
138  // Try unscheduled production.
139  if(phb.onDemand()) {
140  if(fillOnDemand) {
141  unscheduledFill(phb.resolvedModuleLabel());
142  }
143  return;
144  }
145 
146  if(phb.branchDescription().produced()) return; // nothing to do.
147  if(phb.product()) return; // nothing to do.
148  if(phb.productUnavailable()) return; // nothing to do.
149  if(!reader()) return; // nothing to do.
150 
151  // must attempt to load from persistent store
152  BranchKey const bk = BranchKey(phb.branchDescription());
153  WrapperOwningHolder edp(reader()->getProduct(bk, phb.productData().getInterface(), this));
154 
155  // Now fix up the ProductHolder
156  checkUniquenessAndType(edp, &phb);
157  phb.putProduct(edp);
158  }
void checkUniquenessAndType(WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
Definition: Principal.cc:746
virtual bool unscheduledFill(std::string const &moduleLabel) const override
T const * getProduct(RefCore const &ref)
Definition: RefCoreGet.h:33
DelayedReader * reader() const
Definition: Principal.h:154
RunNumber_t edm::EventPrincipal::run ( void  ) const
inline

Definition at line 109 of file EventPrincipal.h.

References id(), and edm::EventID::run().

Referenced by Types.LuminosityBlockID::cppID(), edm::EventProcessor::readAndProcessEvent(), and edm::PoolSource::readEvent_().

109  {
110  return id().run();
111  }
RunNumber_t run() const
Definition: EventID.h:42
EventID const & id() const
RunPrincipal const & edm::EventPrincipal::runPrincipal ( ) const

Definition at line 95 of file EventPrincipal.cc.

References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().

95  {
97  }
RunPrincipal const & runPrincipal() const
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
void edm::EventPrincipal::setLuminosityBlockPrincipal ( boost::shared_ptr< LuminosityBlockPrincipal > const &  lbp)

Definition at line 90 of file EventPrincipal.cc.

References luminosityBlockPrincipal_.

Referenced by edm::EventProcessor::readAndProcessEvent(), and edm::SubProcess::write().

90  {
92  }
boost::shared_ptr< LuminosityBlockPrincipal > luminosityBlockPrincipal_
void edm::EventPrincipal::setUnscheduledHandler ( boost::shared_ptr< UnscheduledHandler iHandler)

Definition at line 242 of file EventPrincipal.cc.

References unscheduledHandler_.

Referenced by edm::Schedule::setupOnDemandSystem().

242  {
243  unscheduledHandler_ = iHandler;
244  }
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
int edm::EventPrincipal::storeNumber ( ) const
inline

Definition at line 97 of file EventPrincipal.h.

References aux(), and edm::EventAuxiliary::storeNumber().

97  {
98  return aux().storeNumber();
99  }
int storeNumber() const
EventAuxiliary const & aux() const
Timestamp const& edm::EventPrincipal::time ( ) const
inline
bool edm::EventPrincipal::unscheduledFill ( std::string const &  moduleLabel) const
overrideprivatevirtual

Implements edm::Principal.

Definition at line 262 of file EventPrincipal.cc.

References edm::hlt::Exception, edm::find_in_all(), i, edm::errors::LogicError, moduleLabelsRunning_, and unscheduledHandler_.

Referenced by resolveProduct_().

262  {
263 
264  // If it is a module already currently running in unscheduled
265  // mode, then there is a circular dependency related to which
266  // EDProducts modules require and produce. There is no safe way
267  // to recover from this. Here we check for this problem and throw
268  // an exception.
269  std::vector<std::string>::const_iterator i =
270  find_in_all(moduleLabelsRunning_, moduleLabel);
271 
272  if(i != moduleLabelsRunning_.end()) {
274  << "Hit circular dependency while trying to run an unscheduled module.\n"
275  << "Current implementation of unscheduled execution cannot always determine\n"
276  << "the proper order for module execution. It is also possible the modules\n"
277  << "have a built in circular dependence that will not work with any order.\n"
278  << "In the first case, scheduling some or all required modules in paths will help.\n"
279  << "In the second case, the modules themselves will have to be fixed.\n";
280  }
281 
282  moduleLabelsRunning_.push_back(moduleLabel);
283 
284  if(unscheduledHandler_) {
285  unscheduledHandler_->tryToFill(moduleLabel, *const_cast<EventPrincipal*>(this));
286  }
287  moduleLabelsRunning_.pop_back();
288  return true;
289  }
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
std::vector< std::string > moduleLabelsRunning_
boost::shared_ptr< UnscheduledHandler > edm::EventPrincipal::unscheduledHandler ( ) const

Definition at line 247 of file EventPrincipal.cc.

References unscheduledHandler_.

Referenced by edm::getUnscheduledHandler().

247  {
248  return unscheduledHandler_;
249  }
boost::shared_ptr< UnscheduledHandler > unscheduledHandler_

Member Data Documentation

EventAuxiliary edm::EventPrincipal::aux_
private

Definition at line 160 of file EventPrincipal.h.

Referenced by aux(), clearEventPrincipal(), and fillEventPrincipal().

boost::shared_ptr<BranchIDListHelper const> edm::EventPrincipal::branchIDListHelper_
private

Definition at line 174 of file EventPrincipal.h.

Referenced by branchIDToProductID(), and pidToBid().

boost::shared_ptr<BranchListIndexes> edm::EventPrincipal::branchListIndexes_
private
std::map<BranchListIndex, ProcessIndex> edm::EventPrincipal::branchListIndexToProcessIndex_
private

Definition at line 178 of file EventPrincipal.h.

Referenced by branchIDToProductID(), clearEventPrincipal(), and fillEventPrincipal().

boost::shared_ptr<BranchMapper> edm::EventPrincipal::branchMapperPtr_
private
boost::shared_ptr<EventSelectionIDVector> edm::EventPrincipal::eventSelectionIDs_
private

Definition at line 172 of file EventPrincipal.h.

Referenced by clearEventPrincipal(), eventSelectionIDs(), and fillEventPrincipal().

int const edm::EventPrincipal::invalidBunchXing = EventAuxiliary::invalidBunchXing
static

Definition at line 46 of file EventPrincipal.h.

int const edm::EventPrincipal::invalidStoreNumber = EventAuxiliary::invalidStoreNumber
static

Definition at line 47 of file EventPrincipal.h.

boost::shared_ptr<LuminosityBlockPrincipal> edm::EventPrincipal::luminosityBlockPrincipal_
private
std::vector<std::string> edm::EventPrincipal::moduleLabelsRunning_
mutableprivate

Definition at line 170 of file EventPrincipal.h.

Referenced by clearEventPrincipal(), and unscheduledFill().

boost::shared_ptr<UnscheduledHandler> edm::EventPrincipal::unscheduledHandler_
private