#include <EventPrincipal.h>
Definition at line 36 of file EventPrincipal.h.
Definition at line 38 of file EventPrincipal.h.
typedef Principal edm::EventPrincipal::Base |
Definition at line 39 of file EventPrincipal.h.
Reimplemented from edm::Principal.
Definition at line 41 of file EventPrincipal.h.
edm::EventPrincipal::EventPrincipal | ( | boost::shared_ptr< ProductRegistry const > | reg, |
ProcessConfiguration const & | pc | ||
) |
Definition at line 19 of file EventPrincipal.cc.
: Base(reg, pc, InEvent), aux_(), luminosityBlockPrincipal_(), unscheduledHandler_(), moduleLabelsRunning_(), eventSelectionIDs_(), branchListIndexes_(), branchListIndexToProcessIndex_() {}
edm::EventPrincipal::~EventPrincipal | ( | ) | [inline] |
Definition at line 47 of file EventPrincipal.h.
{}
EventAuxiliary const& edm::EventPrincipal::aux | ( | ) | const [inline] |
Definition at line 90 of file EventPrincipal.h.
References aux_.
Referenced by bunchCrossing(), ExperimentType(), id(), isReal(), edm::isSameEvent(), edm::StreamSerializer::serializeEvent(), storeNumber(), time(), and edm::RootOutputFile::writeOne().
{ return *aux_; }
Definition at line 161 of file EventPrincipal.cc.
References branchListIndexToProcessIndex_, Exception, i, edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), edm::BranchID::isValid(), and edm::errors::NotFound.
Referenced by fillEventPrincipal(), edm::Event::makeProductID(), and oldToNewProductID_().
{ 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; BIDToIndexMap const& branchIDToIndexMap = BranchIDListRegistry::instance()->extra().branchIDToIndexMap(); IndexRange range = 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 235 of file EventPrincipal.cc.
References branchListIndexes_.
Referenced by fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), and edm::RootOutputFile::writeOne().
{ return *branchListIndexes_; }
int const edm::EventPrincipal::bunchCrossing | ( | ) | const [inline] |
Definition at line 82 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::bunchCrossing().
{ return aux().bunchCrossing(); }
void edm::EventPrincipal::clearEventPrincipal | ( | ) |
Definition at line 32 of file EventPrincipal.cc.
References aux_, branchListIndexes_, branchListIndexToProcessIndex_, edm::Principal::clearPrincipal(), eventSelectionIDs_, luminosityBlockPrincipal_, moduleLabelsRunning_, and unscheduledHandler_.
Referenced by edm::EventProcessor::readAndProcessEvent().
{ clearPrincipal(); aux_.reset(); luminosityBlockPrincipal_.reset(); unscheduledHandler_.reset(); moduleLabelsRunning_.clear(); eventSelectionIDs_.reset(); branchListIndexes_.reset(); branchListIndexToProcessIndex_.clear(); }
EventSelectionIDVector const & edm::EventPrincipal::eventSelectionIDs | ( | ) | const |
Definition at line 230 of file EventPrincipal.cc.
References eventSelectionIDs_.
Referenced by edm::Event::eventSelectionIDs(), fillEventPrincipal(), edm::StreamSerializer::serializeEvent(), and edm::RootOutputFile::writeOne().
{ return *eventSelectionIDs_; }
EventAuxiliary::ExperimentType edm::EventPrincipal::ExperimentType | ( | ) | const [inline] |
Definition at line 78 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::experimentType().
{ return aux().experimentType(); }
void edm::EventPrincipal::fillEventPrincipal | ( | std::auto_ptr< EventAuxiliary > | aux, |
boost::shared_ptr< LuminosityBlockPrincipal > | lbp, | ||
boost::shared_ptr< EventSelectionIDVector > | eventSelectionIDs = boost::shared_ptr<EventSelectionIDVector>(new EventSelectionIDVector) , |
||
boost::shared_ptr< BranchListIndexes > | branchListIndexes = boost::shared_ptr<BranchListIndexes>(new BranchListIndexes) , |
||
boost::shared_ptr< BranchMapper > | mapper = boost::shared_ptr<BranchMapper>(new BranchMapper) , |
||
boost::shared_ptr< DelayedReader > | rtrv = boost::shared_ptr<DelayedReader>(new NoDelayedReader) |
||
) |
Definition at line 44 of file EventPrincipal.cc.
References aux_, edm::Principal::begin(), branchIDToProductID(), branchListIndexes(), branchListIndexes_, branchListIndexToProcessIndex_, edm::Principal::end(), eventSelectionIDs(), eventSelectionIDs_, edm::Principal::fillPrincipal(), edm::BranchIDListHelper::fixBranchListIndexes(), edm::InEvent, luminosityBlockPrincipal_, edm::Principal::processHistoryID(), edm::Principal::productRegistry(), and edm::Principal::setProcessHistory().
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::RawInputSource::makeEvent(), TFWLiteSelectorBasic::Process(), and edm::ConfigurableInputSource::reallyReadEvent().
{ fillPrincipal(aux->processHistoryID(), mapper, rtrv); aux_.reset(aux.release()); luminosityBlockPrincipal_ = lbp; eventSelectionIDs_ = eventSelectionIDs; branchListIndexes_ = branchListIndexes; if(luminosityBlockPrincipal_) { setProcessHistory(*luminosityBlockPrincipal_); aux_->setProcessHistoryID(processHistoryID()); } mapper->processHistoryID() = processHistoryID(); BranchIDListHelper::fixBranchListIndexes(*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 for(BranchListIndexes::const_iterator it = branchListIndexes_->begin(), itEnd = branchListIndexes_->end(); it != itEnd; ++it) { ProcessIndex pix = it - branchListIndexes_->begin(); branchListIndexToProcessIndex_.insert(std::make_pair(*it, pix)); } // Fill in the product ID's in the groups. for(const_iterator it = this->begin(), itEnd = this->end(); it != itEnd; ++it) { (*it)->setProvenance(mapper, branchIDToProductID((*it)->branchDescription().branchID())); } }
BasicHandle edm::EventPrincipal::getByProductID | ( | ProductID const & | oid | ) | const |
Definition at line 186 of file EventPrincipal.cc.
References Exception, g, edm::Principal::getGroup(), pidToBid(), and edm::errors::ProductNotFound.
Referenced by edm::Event::getByProductID_(), and getIt().
{ BranchID bid = pidToBid(pid); SharedConstGroupPtr const& g = getGroup(bid, true, true); if(g.get() == 0) { 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); } // Check for case where we tried on demand production and // it failed to produce the object if(g->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(g->product(), g->provenance()); }
Reimplemented from edm::Principal.
Definition at line 209 of file EventPrincipal.cc.
References getByProductID(), and edm::BasicHandle::wrapper().
{ return getByProductID(pid).wrapper(); }
Provenance edm::EventPrincipal::getProvenance | ( | ProductID const & | pid | ) | const |
Definition at line 214 of file EventPrincipal.cc.
References pidToBid().
Referenced by edm::Event::getProvenance().
{ BranchID bid = pidToBid(pid); return getProvenance(bid); }
EventID const& edm::EventPrincipal::id | ( | void | ) | const [inline] |
Definition at line 66 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::DataMixingModule::addPileups(), edm::MixingModule::addPileups(), edm::DataMixingSiPixelWorker::addSiPixelPileups(), edm::DataMixingSiStripWorker::addSiStripPileups(), edm::DataMixingSiStripRawWorker::addSiStripPileups(), edm::NoDelayedReader::getProduct_(), luminosityBlock(), edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::EventProcessor::readAndProcessEvent(), edm::InputSource::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 const edm::EventPrincipal::isReal | ( | ) | const [inline] |
Definition at line 74 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::isRealData().
{ return aux().isRealData(); }
LuminosityBlockNumber_t edm::EventPrincipal::luminosityBlock | ( | ) | const [inline] |
Definition at line 94 of file EventPrincipal.h.
References id(), and edm::EventID::luminosityBlock().
Referenced by edm::InputSource::readEvent(), and edm::StreamerOutputModuleBase::serializeEvent().
{ return id().luminosityBlock(); }
LuminosityBlockPrincipal& edm::EventPrincipal::luminosityBlockPrincipal | ( | ) | [inline] |
Definition at line 62 of file EventPrincipal.h.
References luminosityBlockPrincipal_.
{ return *luminosityBlockPrincipal_; }
LuminosityBlockPrincipal const& edm::EventPrincipal::luminosityBlockPrincipal | ( | ) | const [inline] |
Definition at line 58 of file EventPrincipal.h.
References luminosityBlockPrincipal_.
Referenced by runPrincipal().
{ return *luminosityBlockPrincipal_; }
ProductID edm::EventPrincipal::oldToNewProductID_ | ( | ProductID const & | oldProductID | ) | const [private, virtual] |
Reimplemented from edm::EDProductGetter.
Definition at line 270 of file EventPrincipal.cc.
References branchIDToProductID(), edm::Principal::branchMapperPtr(), and edm::BranchID::isValid().
{ BranchID bid = branchMapperPtr()->oldProductIDToBranchID(oldProductID); if(!bid.isValid()) return oldProductID; return branchIDToProductID(bid); }
Definition at line 152 of file EventPrincipal.cc.
References branchListIndexes_, runTheMatrix::data, Exception, edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), 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, BranchIDListRegistry::instance()->data(), *branchListIndexes_); }
void edm::EventPrincipal::put | ( | ConstBranchDescription const & | bd, |
std::auto_ptr< EDProduct > | edp, | ||
std::auto_ptr< ProductProvenance > | productProvenance | ||
) |
Definition at line 94 of file EventPrincipal.cc.
References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), edm::Principal::checkUniquenessAndType(), Exception, g, edm::Principal::getExistingGroup(), edm::errors::InsertFailure, edm::ConstBranchDescription::produced(), and edm::Group::putProduct().
Referenced by edm::Event::commit_aux().
{ assert(bd.produced()); if(edp.get() == 0) { throw Exception(errors::InsertFailure, "Null Pointer") << "put: Cannot put because auto_ptr to product is null." << "\n"; } branchMapperPtr()->insert(*productProvenance); Group *g = getExistingGroup(bd.branchID()); assert(g); checkUniquenessAndType(edp, g); // Group assumes ownership g->putProduct(edp, productProvenance); }
void edm::EventPrincipal::putOnRead | ( | ConstBranchDescription const & | bd, |
std::auto_ptr< EDProduct > | edp, | ||
std::auto_ptr< ProductProvenance > | productProvenance | ||
) |
Definition at line 114 of file EventPrincipal.cc.
References edm::ConstBranchDescription::branchID(), edm::Principal::branchMapperPtr(), edm::Principal::checkUniquenessAndType(), g, edm::Principal::getExistingGroup(), edm::ConstBranchDescription::produced(), and edm::Group::putProduct().
Referenced by edm::StreamerInputSource::deserializeEvent().
{ assert(!bd.produced()); branchMapperPtr()->insert(*productProvenance); Group *g = getExistingGroup(bd.branchID()); assert(g); checkUniquenessAndType(edp, g); // Group assumes ownership g->putProduct(edp, productProvenance); }
void edm::EventPrincipal::resolveProduct_ | ( | Group const & | g, |
bool | fillOnDemand | ||
) | const [private, virtual] |
Reimplemented from edm::Principal.
Definition at line 129 of file EventPrincipal.cc.
References edm::Group::branchDescription(), edm::Principal::checkUniquenessAndType(), edm::getProduct(), edm::ConstBranchDescription::moduleLabel(), edm::Group::onDemand(), edm::ConstBranchDescription::produced(), edm::Group::product(), edm::Group::productUnavailable(), edm::Group::putProduct(), edm::Principal::store(), and unscheduledFill().
{ // Try unscheduled production. if(g.onDemand()) { if(fillOnDemand) { unscheduledFill(g.branchDescription().moduleLabel()); } return; } if(g.branchDescription().produced()) return; // nothing to do. if(g.product()) return; // nothing to do. if(g.productUnavailable()) return; // nothing to do. // must attempt to load from persistent store BranchKey const bk = BranchKey(g.branchDescription()); std::auto_ptr<EDProduct> edp(store()->getProduct(bk, this)); // Now fix up the Group checkUniquenessAndType(edp, &g); g.putProduct(edp); }
RunNumber_t edm::EventPrincipal::run | ( | void | ) | const [inline] |
Definition at line 98 of file EventPrincipal.h.
References id(), and edm::EventID::run().
Referenced by edm::InputSource::readEvent().
{ return id().run(); }
RunPrincipal const & edm::EventPrincipal::runPrincipal | ( | ) | const |
Definition at line 84 of file EventPrincipal.cc.
References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().
{ return luminosityBlockPrincipal().runPrincipal(); }
RunPrincipal & edm::EventPrincipal::runPrincipal | ( | ) |
Definition at line 89 of file EventPrincipal.cc.
References luminosityBlockPrincipal(), and edm::LuminosityBlockPrincipal::runPrincipal().
{ return luminosityBlockPrincipal().runPrincipal(); }
void edm::EventPrincipal::setUnscheduledHandler | ( | boost::shared_ptr< UnscheduledHandler > | iHandler | ) |
Definition at line 220 of file EventPrincipal.cc.
References unscheduledHandler_.
Referenced by edm::Schedule::setupOnDemandSystem().
{ unscheduledHandler_ = iHandler; }
int const edm::EventPrincipal::storeNumber | ( | ) | const [inline] |
Definition at line 86 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::storeNumber().
{ return aux().storeNumber(); }
Timestamp const& edm::EventPrincipal::time | ( | ) | const [inline] |
Definition at line 70 of file EventPrincipal.h.
References aux(), and edm::EventAuxiliary::time().
Referenced by edm::OccurrenceTraits< EventPrincipal, BranchActionBegin >::preScheduleSignal(), edm::EventProcessor::readAndProcessEvent(), edm::InputSource::readEvent(), and edm::AsciiOutputModule::write().
{ return aux().time(); }
bool edm::EventPrincipal::unscheduledFill | ( | std::string const & | moduleLabel | ) | const [private, virtual] |
Implements edm::Principal.
Definition at line 240 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 225 of file EventPrincipal.cc.
References unscheduledHandler_.
Referenced by edm::WorkerT< T >::implDoBegin().
{ return unscheduledHandler_; }
boost::scoped_ptr<EventAuxiliary> edm::EventPrincipal::aux_ [private] |
Definition at line 147 of file EventPrincipal.h.
Referenced by aux(), clearEventPrincipal(), and fillEventPrincipal().
boost::shared_ptr<BranchListIndexes> edm::EventPrincipal::branchListIndexes_ [private] |
Definition at line 158 of file EventPrincipal.h.
Referenced by branchListIndexes(), clearEventPrincipal(), fillEventPrincipal(), and pidToBid().
std::map<BranchListIndex, ProcessIndex> edm::EventPrincipal::branchListIndexToProcessIndex_ [private] |
Definition at line 160 of file EventPrincipal.h.
Referenced by branchIDToProductID(), clearEventPrincipal(), and fillEventPrincipal().
boost::shared_ptr<EventSelectionIDVector> edm::EventPrincipal::eventSelectionIDs_ [private] |
Definition at line 156 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), eventSelectionIDs(), and fillEventPrincipal().
int const edm::EventPrincipal::invalidBunchXing = EventAuxiliary::invalidBunchXing [static] |
Definition at line 42 of file EventPrincipal.h.
int const edm::EventPrincipal::invalidStoreNumber = EventAuxiliary::invalidStoreNumber [static] |
Definition at line 43 of file EventPrincipal.h.
boost::shared_ptr<LuminosityBlockPrincipal> edm::EventPrincipal::luminosityBlockPrincipal_ [private] |
Definition at line 149 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), fillEventPrincipal(), and luminosityBlockPrincipal().
std::vector<std::string> edm::EventPrincipal::moduleLabelsRunning_ [mutable, private] |
Definition at line 154 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), and unscheduledFill().
boost::shared_ptr<UnscheduledHandler> edm::EventPrincipal::unscheduledHandler_ [private] |
Definition at line 152 of file EventPrincipal.h.
Referenced by clearEventPrincipal(), setUnscheduledHandler(), unscheduledFill(), and unscheduledHandler().