#include <EventPrincipal.h>
Definition at line 40 of file EventPrincipal.h.
Definition at line 42 of file EventPrincipal.h.
typedef Principal edm::EventPrincipal::Base |
Definition at line 43 of file EventPrincipal.h.
Reimplemented from edm::Principal.
Definition at line 45 of file EventPrincipal.h.
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.
: Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender), aux_(), luminosityBlockPrincipal_(), branchMapperPtr_(), unscheduledHandler_(), moduleLabelsRunning_(), eventSelectionIDs_(new EventSelectionIDVector), branchIDListHelper_(branchIDListHelper), branchListIndexes_(new BranchListIndexes), branchListIndexToProcessIndex_() {}
edm::EventPrincipal::~EventPrincipal | ( | ) | [inline] |
Definition at line 53 of file EventPrincipal.h.
{}
EventAuxiliary const& edm::EventPrincipal::aux | ( | ) | const [inline] |
Definition at line 101 of file EventPrincipal.h.
References aux_.
Referenced by bunchCrossing(), ExperimentType(), fillEventPrincipal(), id(), isReal(), edm::isSameEvent(), edm::StreamSerializer::serializeEvent(), storeNumber(), time(), edm::SubProcess::write(), and edm::RootOutputFile::writeOne().
{ return aux_; }
Definition at line 170 of file EventPrincipal.cc.
References branchIDListHelper_, branchListIndexToProcessIndex_, Exception, i, edm::BranchID::isValid(), and edm::errors::NotFound.
Referenced by fillEventPrincipal(), and edm::Event::makeProductID().
{ if(!bid.isValid()) { throw Exception(errors::NotFound, "InvalidID") << "branchIDToProductID: invalid BranchID supplied\n"; } typedef BranchIDListHelper::BranchIDToIndexMap BIDToIndexMap; typedef BIDToIndexMap::const_iterator Iter; typedef std::pair<Iter, Iter> IndexRange; IndexRange range = branchIDListHelper_->branchIDToIndexMap().equal_range(bid); for(Iter it = range.first; it != range.second; ++it) { BranchListIndex blix = it->second.first; std::map<BranchListIndex, ProcessIndex>::const_iterator i = branchListIndexToProcessIndex_.find(blix); if(i != branchListIndexToProcessIndex_.end()) { ProductIndex productIndex = it->second.second; ProcessIndex processIndex = i->second; return ProductID(processIndex+1, productIndex+1); } } // cannot throw, because some products may legitimately not have product ID's (e.g. pile-up). return ProductID(); }
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().
{ return *branchListIndexes_; }
boost::shared_ptr<BranchMapper> edm::EventPrincipal::branchMapperPtr | ( | ) | const [inline] |
Definition at line 115 of file EventPrincipal.h.
References branchMapperPtr_.
Referenced by fillEventPrincipal(), edm::RootOutputFile::insertAncestors(), mergeMappers(), put(), putOnRead(), edm::SubProcess::write(), and edm::ProvenanceCheckerOutputModule::write().
{return branchMapperPtr_;}
int edm::EventPrincipal::bunchCrossing | ( | ) | const [inline] |
Definition at line 93 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::bunchCrossing().
{ return aux().bunchCrossing(); }
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().
{ clearPrincipal(); aux_ = EventAuxiliary(); luminosityBlockPrincipal_.reset(); branchMapperPtr_.reset(); unscheduledHandler_.reset(); moduleLabelsRunning_.clear(); eventSelectionIDs_->clear(); branchListIndexes_->clear(); branchListIndexToProcessIndex_.clear(); }
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().
{ return *eventSelectionIDs_; }
EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType | ( | ) | const [inline] |
Definition at line 89 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::experimentType().
{ return aux().experimentType(); }
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(), LHESource::readEvent_(), edm::ProducerSourceBase::readEvent_(), and edm::SubProcess::write().
{ fillPrincipal(aux.processHistoryID(), reader); aux_ = aux; if(eventSelectionIDs) { eventSelectionIDs_ = eventSelectionIDs; } aux_.setProcessHistoryID(processHistoryID()); branchMapperPtr_ = mapper; if(branchListIndexes) { branchListIndexes_ = branchListIndexes; } if(productRegistry().productProduced(InEvent)) { // Add index into BranchIDListRegistry for products produced this process branchListIndexes_->push_back(productRegistry().producedBranchListIndex()); } // Fill in helper map for Branch to ProductID mapping ProcessIndex pix = 0; for(auto const& blindex : *branchListIndexes_) { branchListIndexToProcessIndex_.insert(std::make_pair(blindex, pix)); ++pix; } // Fill in the product ID's in the product holders. for(auto const& prod : *this) { if (prod->singleProduct()) { prod->setProvenance(branchMapperPtr(), processHistoryID(), branchIDToProductID(prod->branchDescription().branchID())); } } }
BasicHandle edm::EventPrincipal::getByProductID | ( | ProductID const & | oid | ) | const |
Definition at line 204 of file EventPrincipal.cc.
References Exception, edm::Principal::getProductHolder(), pidToBid(), edm::errors::ProductNotFound, and edm::throwProductDeletedException().
Referenced by edm::Event::getByProductID_(), and getIt().
{ BranchID bid = pidToBid(pid); ConstProductPtr const phb = getProductHolder(bid, true, true); if(phb == nullptr) { boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID")); *whyFailed << "get by product ID: no product with given id: " << pid << "\n"; return BasicHandle(whyFailed); } // Was this already deleted? if(phb->productWasDeleted()) { throwProductDeletedException(pid, phb); } // Check for case where we tried on demand production and // it failed to produce the object if(phb->onDemand()) { boost::shared_ptr<cms::Exception> whyFailed(new Exception(errors::ProductNotFound, "InvalidID")); *whyFailed << "get by product ID: no product with given id: " << pid << "\n" << "onDemand production failed to produce it.\n"; return BasicHandle(whyFailed); } return BasicHandle(phb->productData()); }
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().
{ return getByProductID(pid).wrapperHolder(); }
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().
{ BranchID bid = pidToBid(pid); return getProvenance(bid); }
EventID const& edm::EventPrincipal::id | ( | void | ) | const [inline] |
Definition at line 77 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::id().
Referenced by edm::DataMixingEMDigiWorker::addEMPileups(), edm::DataMixingEMWorker::addEMPileups(), edm::DataMixingGeneralTrackWorker::addGeneralTrackPileups(), edm::DataMixingHcalDigiWorker::addHcalPileups(), edm::DataMixingHcalWorker::addHcalPileups(), edm::DataMixingHcalDigiWorkerProd::addHcalPileups(), edm::DataMixingMuonWorker::addMuonPileups(), edm::DataMixingPileupCopy::addPileupInfo(), edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), edm::DataMixingSiStripRawWorker::addSiStripPileups(), edm::SecSourceAnalyzer::getBranches(), luminosityBlock(), edm::RecordEventID< T >::operator()(), edm::DataMixingModule::pileWorker(), edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::InputSource::readEvent(), edm::PoolSource::readEvent_(), edm::Schedule::reportSkipped(), run(), edm::StreamerOutputModuleBase::serializeEvent(), edm::StreamSerializer::serializeEvent(), edm::AsciiOutputModule::write(), edm::PoolOutputModule::write(), edm::GetProductCheckerOutputModule::write(), and edm::RootOutputFile::writeOne().
{ return aux().id(); }
bool edm::EventPrincipal::isReal | ( | ) | const [inline] |
Definition at line 85 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::isRealData().
{ return aux().isRealData(); }
LuminosityBlockNumber_t edm::EventPrincipal::luminosityBlock | ( | ) | const [inline] |
Definition at line 105 of file EventPrincipal.h.
References id(), and edm::EventID::luminosityBlock().
Referenced by edm::PoolSource::readEvent_(), and edm::StreamerOutputModuleBase::serializeEvent().
{ return id().luminosityBlock(); }
LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal | ( | ) | [inline] |
Definition at line 67 of file EventPrincipal.h.
References luminosityBlockPrincipal_.
{ return *luminosityBlockPrincipal_; }
LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal | ( | ) | const [inline] |
Definition at line 63 of file EventPrincipal.h.
References luminosityBlockPrincipal_.
Referenced by runPrincipal().
{ return *luminosityBlockPrincipal_; }
bool edm::EventPrincipal::luminosityBlockPrincipalPtrValid | ( | ) | [inline] |
Definition at line 71 of file EventPrincipal.h.
References luminosityBlockPrincipal_.
{ return (luminosityBlockPrincipal_) ? true : false; }
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_().
{ branchMapperPtr_->mergeMappers(other.branchMapperPtr()); }
Definition at line 161 of file EventPrincipal.cc.
References branchIDListHelper_, branchListIndexes_, Exception, edm::ProductID::isValid(), edm::productIDToBranchID(), and edm::errors::ProductNotFound.
Referenced by getByProductID(), and getProvenance().
{ if(!pid.isValid()) { throw Exception(errors::ProductNotFound, "InvalidID") << "get by product ID: invalid ProductID supplied\n"; } return productIDToBranchID(pid, branchIDListHelper_->branchIDLists(), *branchListIndexes_); }
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(), Exception, edm::Principal::getExistingProduct(), edm::errors::InsertFailure, edm::WrapperHolder::isValid(), and edm::ProductHolderBase::putProduct().
Referenced by edm::Event::commit_aux(), and LHESource::readEvent_().
{ // assert commented out for DaqSource. When DaqSource no longer uses put(), the assert can be restored. //assert(produced()); if(!edp.isValid()) { throw Exception(errors::InsertFailure, "Null Pointer") << "put: Cannot put because ptr to product is null." << "\n"; } branchMapperPtr()->insertIntoSet(productProvenance); ProductHolderBase* phb = getExistingProduct(bd.branchID()); assert(phb); checkUniquenessAndType(edp, phb); // ProductHolder assumes ownership phb->putProduct(edp, productProvenance); }
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().
{ assert(!bd.produced()); branchMapperPtr()->insertIntoSet(productProvenance); ProductHolderBase* phb = getExistingProduct(bd.branchID()); assert(phb); WrapperOwningHolder const edp(product, phb->productData().getInterface()); checkUniquenessAndType(edp, phb); // ProductHolder assumes ownership phb->putProduct(edp, productProvenance); }
void edm::EventPrincipal::resolveProduct_ | ( | ProductHolderBase const & | phb, |
bool | fillOnDemand | ||
) | const [override, private, virtual] |
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().
{ // Try unscheduled production. if(phb.onDemand()) { if(fillOnDemand) { unscheduledFill(phb.resolvedModuleLabel()); } return; } if(phb.branchDescription().produced()) return; // nothing to do. if(phb.product()) return; // nothing to do. if(phb.productUnavailable()) return; // nothing to do. if(!reader()) return; // nothing to do. // must attempt to load from persistent store BranchKey const bk = BranchKey(phb.branchDescription()); WrapperOwningHolder edp(reader()->getProduct(bk, phb.productData().getInterface(), this)); // Now fix up the ProductHolder checkUniquenessAndType(edp, &phb); phb.putProduct(edp); }
RunNumber_t edm::EventPrincipal::run | ( | void | ) | const [inline] |
Definition at line 109 of file EventPrincipal.h.
References id(), and edm::EventID::run().
Referenced by edm::PoolSource::readEvent_().
{ return id().run(); }
RunPrincipal const & edm::EventPrincipal::runPrincipal | ( | ) | const |
Definition at line 95 of file EventPrincipal.cc.
References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().
{ return luminosityBlockPrincipal().runPrincipal(); }
void edm::EventPrincipal::setLuminosityBlockPrincipal | ( | boost::shared_ptr< LuminosityBlockPrincipal > const & | lbp | ) |
Definition at line 90 of file EventPrincipal.cc.
References luminosityBlockPrincipal_.
Referenced by edm::SubProcess::write().
{ luminosityBlockPrincipal_ = lbp; }
void edm::EventPrincipal::setUnscheduledHandler | ( | boost::shared_ptr< UnscheduledHandler > | iHandler | ) |
Definition at line 242 of file EventPrincipal.cc.
References unscheduledHandler_.
Referenced by edm::Schedule::setupOnDemandSystem().
{ unscheduledHandler_ = iHandler; }
int edm::EventPrincipal::storeNumber | ( | ) | const [inline] |
Definition at line 97 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::storeNumber().
{ return aux().storeNumber(); }
Timestamp const& edm::EventPrincipal::time | ( | ) | const [inline] |
Definition at line 81 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::time().
Referenced by edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::InputSource::readEvent(), and edm::AsciiOutputModule::write().
{ return aux().time(); }
bool edm::EventPrincipal::unscheduledFill | ( | std::string const & | moduleLabel | ) | const [override, private, virtual] |
Implements edm::Principal.
Definition at line 262 of file EventPrincipal.cc.
References Exception, edm::find_in_all(), i, edm::errors::LogicError, moduleLabelsRunning_, and unscheduledHandler_.
Referenced by resolveProduct_().
{ // If it is a module already currently running in unscheduled // mode, then there is a circular dependency related to which // EDProducts modules require and produce. There is no safe way // to recover from this. Here we check for this problem and throw // an exception. std::vector<std::string>::const_iterator i = find_in_all(moduleLabelsRunning_, moduleLabel); if(i != moduleLabelsRunning_.end()) { throw Exception(errors::LogicError) << "Hit circular dependency while trying to run an unscheduled module.\n" << "Current implementation of unscheduled execution cannot always determine\n" << "the proper order for module execution. It is also possible the modules\n" << "have a built in circular dependence that will not work with any order.\n" << "In the first case, scheduling some or all required modules in paths will help.\n" << "In the second case, the modules themselves will have to be fixed.\n"; } moduleLabelsRunning_.push_back(moduleLabel); if(unscheduledHandler_) { unscheduledHandler_->tryToFill(moduleLabel, *const_cast<EventPrincipal*>(this)); } moduleLabelsRunning_.pop_back(); return true; }
boost::shared_ptr< UnscheduledHandler > edm::EventPrincipal::unscheduledHandler | ( | ) | const |
Definition at line 247 of file EventPrincipal.cc.
References unscheduledHandler_.
Referenced by edm::getUnscheduledHandler().
{ return unscheduledHandler_; }
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] |
Definition at line 176 of file EventPrincipal.h.
Referenced by branchListIndexes(), clearEventPrincipal(), fillEventPrincipal(), and pidToBid().
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] |
Definition at line 165 of file EventPrincipal.h.
Referenced by branchMapperPtr(), clearEventPrincipal(), fillEventPrincipal(), and mergeMappers().
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] |
Definition at line 162 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), luminosityBlockPrincipal(), luminosityBlockPrincipalPtrValid(), and setLuminosityBlockPrincipal().
std::vector<std::string> edm::EventPrincipal::moduleLabelsRunning_ [mutable, private] |
Definition at line 170 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), and unscheduledFill().
boost::shared_ptr<UnscheduledHandler> edm::EventPrincipal::unscheduledHandler_ [private] |
Definition at line 168 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), setUnscheduledHandler(), unscheduledFill(), and unscheduledHandler().