#include <Principal.h>
Public Types | |
typedef std::vector< BasicHandle > | BasicHandleVec |
typedef boost::filter_iterator < FilledGroupPtr, GroupCollection::const_iterator > | const_iterator |
typedef std::vector < boost::shared_ptr< Group > > | GroupCollection |
typedef std::string | ProcessName |
typedef ProcessHistory::const_iterator | ProcessNameConstIterator |
typedef boost::shared_ptr < Group const > | SharedConstGroupPtr |
typedef boost::shared_ptr< Group > | SharedGroupPtr |
typedef GroupCollection::size_type | size_type |
Public Member Functions | |
void | addGroupInput (boost::shared_ptr< ConstBranchDescription > bd) |
void | addGroupScheduled (boost::shared_ptr< ConstBranchDescription > bd) |
void | addGroupSource (boost::shared_ptr< ConstBranchDescription > bd) |
void | addOnDemandGroup (boost::shared_ptr< ConstBranchDescription > bd) |
void | adjustIndexesAfterProductRegistryAddition () |
bool | adjustToNewProductRegistry (ProductRegistry const ®) |
const_iterator | begin () const |
boost::shared_ptr< BranchMapper > | branchMapperPtr () const |
BranchType const & | branchType () const |
void | clearPrincipal () |
const_iterator | end () const |
void | fillPrincipal (ProcessHistoryID const &hist, boost::shared_ptr< BranchMapper > mapper, boost::shared_ptr< DelayedReader > rtrv) |
void | getAllProvenance (std::vector< Provenance const * > &provenances) const |
BasicHandle | getByLabel (TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const |
BasicHandle | getBySelector (TypeID const &tid, SelectorBase const &s) const |
BasicHandle | getByType (TypeID const &tid) const |
OutputHandle | getForOutput (BranchID const &bid, bool getProd) const |
SharedConstGroupPtr const | getGroup (BranchID const &oid, bool resolveProd, bool fillOnDemand) const |
void | getMany (TypeID const &tid, SelectorBase const &, BasicHandleVec &results) const |
void | getManyByType (TypeID const &tid, BasicHandleVec &results) const |
size_t | getMatchingSequence (TypeID const &typeID, SelectorBase const &selector, BasicHandle &result) const |
Provenance | getProvenance (BranchID const &bid) const |
void | maybeFlushCache (TypeID const &tid, InputTag const &tag) const |
Principal (boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, BranchType bt) | |
ProcessConfiguration const & | processConfiguration () const |
ProcessHistory const & | processHistory () const |
ProcessHistoryID const & | processHistoryID () const |
EDProductGetter const * | prodGetter () const |
ProductRegistry const & | productRegistry () const |
void | recombine (Principal &other, std::vector< BranchID > const &bids) |
size_t | size () const |
boost::shared_ptr< DelayedReader > | store () const |
virtual | ~Principal () |
Protected Member Functions | |
void | addGroup_ (std::auto_ptr< Group > g) |
void | addGroupOrThrow (std::auto_ptr< Group > g) |
void | checkUniquenessAndType (std::auto_ptr< EDProduct > &prod, Group const *group) const |
Group * | getExistingGroup (BranchID const &branchID) |
Group * | getExistingGroup (Group const &g) |
SharedConstGroupPtr const | getGroupByIndex (ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const |
ProcessHistory & | processHistoryUpdate () |
void | putOrMerge (std::auto_ptr< EDProduct > prod, std::auto_ptr< ProductProvenance > prov, Group *group) |
void | putOrMerge (std::auto_ptr< EDProduct > prod, Group const *group) const |
void | resolveProduct (Group const &g, bool fillOnDemand) const |
void | setProcessHistory (Principal const &principal) |
void | swapBase (Principal &) |
Private Types | |
typedef TransientProductLookupMap | TypeLookup |
Private Member Functions | |
size_t | findGroup (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const |
bool | findGroupByLabel (TypeID const &typeID, TypeLookup const &typeLookup, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount, BasicHandle &result) const |
size_t | findGroups (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandleVec &results) const |
virtual EDProduct const * | getIt (ProductID const &) const |
virtual void | resolveProduct_ (Group const &g, bool fillOnDemand) const |
virtual bool | unscheduledFill (std::string const &moduleLabel) const =0 |
Private Attributes | |
boost::shared_ptr< BranchMapper > | branchMapperPtr_ |
BranchType | branchType_ |
GroupCollection | groups_ |
boost::shared_ptr < ProductRegistry const > | preg_ |
ProcessConfiguration const * | processConfiguration_ |
ProcessHistoryID | processHistoryID_ |
boost::shared_ptr< ProcessHistory > | processHistoryPtr_ |
std::set< EDProduct * > | productPtrs_ |
boost::shared_ptr< DelayedReader > | store_ |
Definition at line 45 of file Principal.h.
typedef std::vector<BasicHandle> edm::Principal::BasicHandleVec |
Definition at line 51 of file Principal.h.
typedef boost::filter_iterator<FilledGroupPtr, GroupCollection::const_iterator> edm::Principal::const_iterator |
Definition at line 48 of file Principal.h.
typedef std::vector<boost::shared_ptr<Group> > edm::Principal::GroupCollection |
Definition at line 47 of file Principal.h.
typedef std::string edm::Principal::ProcessName |
Definition at line 55 of file Principal.h.
Definition at line 49 of file Principal.h.
typedef boost::shared_ptr<Group const> edm::Principal::SharedConstGroupPtr |
Reimplemented in edm::EventPrincipal.
Definition at line 50 of file Principal.h.
typedef boost::shared_ptr<Group> edm::Principal::SharedGroupPtr |
Definition at line 54 of file Principal.h.
typedef GroupCollection::size_type edm::Principal::size_type |
Definition at line 52 of file Principal.h.
typedef TransientProductLookupMap edm::Principal::TypeLookup [private] |
Definition at line 189 of file Principal.h.
edm::Principal::Principal | ( | boost::shared_ptr< ProductRegistry const > | reg, |
ProcessConfiguration const & | pc, | ||
BranchType | bt | ||
) |
Definition at line 20 of file Principal.cc.
References addGroupInput(), addGroupScheduled(), addGroupSource(), addOnDemandGroup(), branchType_, edm::InEvent, and LaserTracksInput_cfi::source.
: EDProductGetter(), processHistoryPtr_(boost::shared_ptr<ProcessHistory>(new ProcessHistory)), processHistoryID_(processHistoryPtr_->id()), processConfiguration_(&pc), groups_(reg->constProductList().size(), SharedGroupPtr()), preg_(reg), branchMapperPtr_(), store_(), productPtrs_(), branchType_(bt) { //Now that these have been set, we can create the list of Branches we need. std::string const source("source"); ProductRegistry::ProductList const& prodsList = reg->productList(); for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(), itProdInfoEnd = prodsList.end(); itProdInfo != itProdInfoEnd; ++itProdInfo) { if (itProdInfo->second.branchType() == branchType_) { boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second)); if (bd->produced()) { if (bd->moduleLabel() == source) { addGroupSource(bd); } else if(bd->onDemand()) { assert(bt == InEvent); addOnDemandGroup(bd); } else { addGroupScheduled(bd); } } else { addGroupInput(bd); } } } }
edm::Principal::~Principal | ( | ) | [virtual] |
Definition at line 58 of file Principal.cc.
{ }
void edm::Principal::addGroup_ | ( | std::auto_ptr< Group > | g | ) | [protected] |
Definition at line 170 of file Principal.cc.
References edm::ConstBranchDescription::branchID(), edm::ConstBranchDescription::className(), edm::ConstBranchDescription::friendlyClassName(), g, groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, edm::ConstBranchDescription::moduleLabel(), preg_, and edm::ConstBranchDescription::processName().
Referenced by addGroupOrThrow().
{ ConstBranchDescription const& bd = group->branchDescription(); assert (!bd.className().empty()); assert (!bd.friendlyClassName().empty()); assert (!bd.moduleLabel().empty()); assert (!bd.processName().empty()); SharedGroupPtr g(group); ProductTransientIndex index = preg_->indexFrom(bd.branchID()); assert(index != ProductRegistry::kInvalidIndex); groups_[index] = g; }
void edm::Principal::addGroupInput | ( | boost::shared_ptr< ConstBranchDescription > | bd | ) |
Definition at line 112 of file Principal.cc.
References addGroupOrThrow(), and g.
Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().
{ std::auto_ptr<Group> g(new InputGroup(bd)); addGroupOrThrow(g); }
void edm::Principal::addGroupOrThrow | ( | std::auto_ptr< Group > | g | ) | [protected] |
Definition at line 184 of file Principal.cc.
References addGroup_(), Exception, edm::ConstBranchDescription::friendlyClassName(), g, getExistingGroup(), edm::errors::InsertFailure, edm::ConstBranchDescription::moduleLabel(), edm::ConstBranchDescription::processName(), and edm::ConstBranchDescription::productInstanceName().
Referenced by addGroupInput(), addGroupScheduled(), addGroupSource(), and addOnDemandGroup().
{ Group const* g = getExistingGroup(*group); if (g != 0) { ConstBranchDescription const& bd = group->branchDescription(); throw edm::Exception(edm::errors::InsertFailure,"AlreadyPresent") << "addGroupOrThrow: Problem found while adding product, " << "product already exists for (" << bd.friendlyClassName() << "," << bd.moduleLabel() << "," << bd.productInstanceName() << "," << bd.processName() << ")\n"; } addGroup_(group); }
void edm::Principal::addGroupScheduled | ( | boost::shared_ptr< ConstBranchDescription > | bd | ) |
Definition at line 100 of file Principal.cc.
References addGroupOrThrow(), and g.
Referenced by Principal().
{ std::auto_ptr<Group> g(new ScheduledGroup(bd)); addGroupOrThrow(g); }
void edm::Principal::addGroupSource | ( | boost::shared_ptr< ConstBranchDescription > | bd | ) |
Definition at line 106 of file Principal.cc.
References addGroupOrThrow(), and g.
Referenced by Principal().
{ std::auto_ptr<Group> g(new SourceGroup(bd)); addGroupOrThrow(g); }
void edm::Principal::addOnDemandGroup | ( | boost::shared_ptr< ConstBranchDescription > | bd | ) |
Definition at line 118 of file Principal.cc.
References addGroupOrThrow(), and g.
Referenced by Principal().
{ std::auto_ptr<Group> g(new UnscheduledGroup(bd)); addGroupOrThrow(g); }
void edm::Principal::adjustIndexesAfterProductRegistryAddition | ( | ) |
Definition at line 658 of file Principal.cc.
References addGroupInput(), begin(), branchType_, end(), groups_, i, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.
{ if (preg_->constProductList().size() > groups_.size()) { GroupCollection newGroups(preg_->constProductList().size(), SharedGroupPtr()); for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) { ProductTransientIndex index = preg_->indexFrom((*i)->branchDescription().branchID()); assert(index != ProductRegistry::kInvalidIndex); newGroups[index] = *i; } groups_.swap(newGroups); // Now we must add new groups for any new product registry entries. ProductRegistry::ProductList const& prodsList = preg_->productList(); for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(), itProdInfoEnd = prodsList.end(); itProdInfo != itProdInfoEnd; ++itProdInfo) { if (itProdInfo->second.branchType() == branchType_) { ProductTransientIndex index = preg_->indexFrom(itProdInfo->second.branchID()); assert(index != ProductRegistry::kInvalidIndex); if (!groups_[index]) { // no group. Must add one. The new entry must be an input group. assert(!itProdInfo->second.produced()); boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second)); addGroupInput(bd); } } } } }
bool edm::Principal::adjustToNewProductRegistry | ( | ProductRegistry const & | reg | ) |
Definition at line 78 of file Principal.cc.
References edm::Group::branchDescription(), edm::ConstBranchDescription::branchName(), branchType_, edm::ProductRegistry::constProductList(), g, getExistingGroup(), groups_, edm::ProductRegistry::productList(), and edm::Group::resetBranchDescription().
{ if(reg.constProductList().size() > groups_.size()) { return false; } ProductRegistry::ProductList const& prodsList = reg.productList(); for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(), itProdInfoEnd = prodsList.end(); itProdInfo != itProdInfoEnd; ++itProdInfo) { if (!itProdInfo->second.produced() && (itProdInfo->second.branchType() == branchType_)) { boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second)); Group *g = getExistingGroup(itProdInfo->second.branchID()); if (g == 0 || g->branchDescription().branchName() != bd->branchName()) { return false; } g->resetBranchDescription(bd); } } return true; }
const_iterator edm::Principal::begin | ( | void | ) | const [inline] |
Definition at line 130 of file Principal.h.
References groups_.
Referenced by adjustIndexesAfterProductRegistryAddition(), edm::check(), clearPrincipal(), edm::EventPrincipal::fillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), edm::RunPrincipal::fillRunPrincipal(), getAllProvenance(), edm::RunPrincipal::readImmediate(), edm::LuminosityBlockPrincipal::readImmediate(), size(), edm::OutputModule::updateBranchParents(), and edm::ProvenanceCheckerOutputModule::write().
boost::shared_ptr<BranchMapper> edm::Principal::branchMapperPtr | ( | ) | const [inline] |
Definition at line 139 of file Principal.h.
References branchMapperPtr_.
Referenced by edm::SubProcess::beginLuminosityBlock(), edm::SubProcess::beginRun(), edm::RootOutputFile::fillBranches(), edm::RootOutputFile::insertAncestors(), edm::EventPrincipal::oldToNewProductID_(), edm::LuminosityBlockPrincipal::put(), edm::RunPrincipal::put(), edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), edm::RunPrincipal::readImmediate(), edm::LuminosityBlockPrincipal::readImmediate(), recombine(), edm::SubProcess::write(), and edm::ProvenanceCheckerOutputModule::write().
{return branchMapperPtr_;}
BranchType const& edm::Principal::branchType | ( | ) | const [inline] |
Definition at line 137 of file Principal.h.
References branchType_.
Referenced by maybeFlushCache().
{return branchType_;}
void edm::Principal::checkUniquenessAndType | ( | std::auto_ptr< EDProduct > & | prod, |
Group const * | group | ||
) | const [protected] |
Definition at line 608 of file Principal.cc.
References edm::Group::branchDescription(), edm::ConstBranchDescription::branchName(), edm::Group::checkType(), edm::errors::EventCorruption, Exception, productPtrs_, and edm::second().
Referenced by edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), putOrMerge(), and edm::EventPrincipal::resolveProduct_().
{ if (prod.get() == 0) return; // These are defensive checks against things that should never happen, but have. // Checks that the same physical product has not already been put into the event. bool alreadyPresent = !productPtrs_.insert(prod.get()).second; if (alreadyPresent) { g->checkType(*prod.release()); throw edm::Exception(errors::EventCorruption) << "Product on branch " << g->branchDescription().branchName() << " occurs twice in the same event.\n"; } // Checks that the real type of the product matches the branch. g->checkType(*prod); }
void edm::Principal::clearPrincipal | ( | ) |
Definition at line 125 of file Principal.cc.
References begin(), branchMapperPtr_, end(), i, processHistoryID_, processHistoryPtr_, productPtrs_, and store_.
Referenced by edm::EventPrincipal::clearEventPrincipal().
{ processHistoryPtr_.reset(new ProcessHistory); processHistoryID_ = processHistoryPtr_->id(); branchMapperPtr_.reset(); store_.reset(); for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) { (*i)->resetGroupData(); } productPtrs_.clear(); }
const_iterator edm::Principal::end | ( | void | ) | const [inline] |
Definition at line 131 of file Principal.h.
References groups_.
Referenced by adjustIndexesAfterProductRegistryAddition(), edm::check(), clearPrincipal(), edm::EventPrincipal::fillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), edm::RunPrincipal::fillRunPrincipal(), getAllProvenance(), edm::RunPrincipal::readImmediate(), edm::LuminosityBlockPrincipal::readImmediate(), size(), edm::OutputModule::updateBranchParents(), and edm::ProvenanceCheckerOutputModule::write().
void edm::Principal::fillPrincipal | ( | ProcessHistoryID const & | hist, |
boost::shared_ptr< BranchMapper > | mapper, | ||
boost::shared_ptr< DelayedReader > | rtrv | ||
) |
Definition at line 138 of file Principal.cc.
References branchMapperPtr_, branchType_, newFWLiteAna::found, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Hash< I >::isValid(), edm::detail::ThreadSafeRegistry< KEY, T, E >::notEmpty(), preg_, processConfiguration_, processHistoryID_, processHistoryPtr_, edm::ProcessConfiguration::processName(), and store_.
Referenced by edm::EventPrincipal::fillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), and edm::RunPrincipal::fillRunPrincipal().
{ branchMapperPtr_ = mapper; store_ = rtrv; if (hist.isValid()) { ProcessHistoryRegistry& history(*ProcessHistoryRegistry::instance()); assert(history.notEmpty()); bool found = history.getMapped(hist, *processHistoryPtr_); assert(found); processHistoryID_ = processHistoryPtr_->id(); } preg_->productLookup().reorderIfNecessary(branchType_, *processHistoryPtr_, processConfiguration_->processName()); preg_->elementLookup().reorderIfNecessary(branchType_, *processHistoryPtr_, processConfiguration_->processName()); }
size_t edm::Principal::findGroup | ( | TypeID const & | typeID, |
TypeLookup const & | typeLookup, | ||
SelectorBase const & | selector, | ||
BasicHandle & | result | ||
) | const [private] |
Definition at line 392 of file Principal.cc.
References branchType_, prof2calltree::count, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::BasicHandle::isValid(), edm::SelectorBase::match(), edm::max(), and resolveProduct().
Referenced by getBySelector(), getByType(), and getMatchingSequence().
{ assert(!result.isValid()); size_t count = 0U; typedef TransientProductLookupMap TypeLookup; // A class without a dictionary cannot be in an Event/Lumi/Run. // First, we check if the class has a dictionary. If it does not, // we return immediately. std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID,branchType_)); if(range.first == range.second) { return 0; } unsigned int processLevelFound = std::numeric_limits<unsigned int>::max(); for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) { if(it->processIndex() > processLevelFound) { //this is for a less recent process and we've already found a match for a more recent process continue; } if(selector.match(*(it->branchDescription()))) { //now see if the data is actually available SharedConstGroupPtr const& group = getGroupByIndex(it->index(), false, false); // Skip product if not available. if (group && !group->productUnavailable()) { this->resolveProduct(*group, true); // If the product is a dummy filler, group will now be marked unavailable. // Unscheduled execution can fail to produce the EDProduct so check if (!group->productUnavailable() && !group->onDemand()) { if(it->processIndex() < processLevelFound) { processLevelFound = it->processIndex(); count = 0U; } if (count == 0U) { // Found a unique (so far) match, save it result = BasicHandle(group->product(), group->provenance()); } ++count; } } } } if (count != 1) result = BasicHandle(); return count; }
bool edm::Principal::findGroupByLabel | ( | TypeID const & | typeID, |
TypeLookup const & | typeLookup, | ||
std::string const & | moduleLabel, | ||
std::string const & | productInstanceName, | ||
std::string const & | processName, | ||
size_t & | cachedOffset, | ||
int & | fillCount, | ||
BasicHandle & | result | ||
) | const [private] |
Definition at line 444 of file Principal.cc.
References edm::TransientProductLookupMap::begin(), branchType_, edm::TransientProductLookupMap::end(), edm::TransientProductLookupMap::equal_range(), edm::TransientProductLookupMap::fillCount(), getGroupByIndex(), edm::BasicHandle::isValid(), and resolveProduct().
Referenced by getByLabel().
{ assert(!result.isValid()); typedef TransientProductLookupMap TypeLookup; bool isCached = (fillCount > 0 && fillCount == typeLookup.fillCount()); bool toBeCached = (fillCount >= 0 && !isCached); std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> range = (isCached ? std::make_pair(typeLookup.begin() + cachedOffset, typeLookup.end()) : typeLookup.equal_range(TypeInBranchType(typeID,branchType_), moduleLabel, productInstanceName)); if (toBeCached) { cachedOffset = range.first - typeLookup.begin(); fillCount = typeLookup.fillCount(); } if(range.first == range.second) { if (toBeCached) { cachedOffset = typeLookup.end() - typeLookup.begin(); } return false; } if (!processName.empty()) { if (isCached) { assert(processName == range.first->branchDescription()->processName()); range.second = range.first + 1; } else if (toBeCached) { bool processFound = false; for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) { if (it->isFirst() && it != range.first) { break; } if (processName == it->branchDescription()->processName()) { processFound = true; range.first = it; cachedOffset = range.first - typeLookup.begin(); range.second = range.first + 1; break; } } if (!processFound) { cachedOffset = typeLookup.end() - typeLookup.begin(); return false; } } // end if(toBeCached) } for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) { if (it->isFirst() && it != range.first) { return false; } if (!processName.empty() && processName != it->branchDescription()->processName()) { continue; } //now see if the data is actually available SharedConstGroupPtr const& group = getGroupByIndex(it->index(), false, false); // Skip product if not available. if (group && !group->productUnavailable()) { this->resolveProduct(*group, true); // If the product is a dummy filler, group will now be marked unavailable. // Unscheduled execution can fail to produce the EDProduct so check if (!group->productUnavailable() && !group->onDemand()) { // Found the match result = BasicHandle(group->product(), group->provenance()); return true; } } } return false; }
size_t edm::Principal::findGroups | ( | TypeID const & | typeID, |
TypeLookup const & | typeLookup, | ||
SelectorBase const & | selector, | ||
BasicHandleVec & | results | ||
) | const [private] |
Definition at line 352 of file Principal.cc.
References branchType_, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::SelectorBase::match(), and resolveProduct().
Referenced by getMany(), and getManyByType().
{ assert(results.empty()); typedef TransientProductLookupMap TypeLookup; // A class without a dictionary cannot be in an Event/Lumi/Run. // First, we check if the class has a dictionary. If it does not, // we return immediately. std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID,branchType_)); if(range.first == range.second) { return 0; } results.reserve(range.second - range.first); for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) { if(selector.match(*(it->branchDescription()))) { //now see if the data is actually available SharedConstGroupPtr const& group = getGroupByIndex(it->index(), false, false); // Skip product if not available. if (group && !group->productUnavailable()) { this->resolveProduct(*group, true); // If the product is a dummy filler, group will now be marked unavailable. // Unscheduled execution can fail to produce the EDProduct so check if (!group->productUnavailable() && !group->onDemand()) { // Found a good match, save it BasicHandle bh(group->product(), group->provenance()); results.push_back(bh); } } } } return results.size(); }
void edm::Principal::getAllProvenance | ( | std::vector< Provenance const * > & | provenances | ) | const |
Definition at line 562 of file Principal.cc.
References begin(), end(), and i.
Referenced by edm::Event::getAllProvenance(), edm::Run::getAllProvenance(), edm::LuminosityBlock::getAllProvenance(), and edm::AsciiOutputModule::write().
{ provenances.clear(); for (const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) { if ((*i)->provenanceAvailable()) { // We do not attempt to get the event/lumi/run status from the provenance, // because the per event provenance may have been dropped. if ((*i)->provenance()->product().present()) { provenances.push_back((*i)->provenance()); } } } }
BasicHandle edm::Principal::getByLabel | ( | TypeID const & | tid, |
std::string const & | label, | ||
std::string const & | productInstanceName, | ||
std::string const & | processName, | ||
size_t & | cachedOffset, | ||
int & | fillCount | ||
) | const |
Definition at line 254 of file Principal.cc.
References findGroupByLabel(), newFWLiteAna::found, label, preg_, edm::errors::ProductNotFound, and query::result.
Referenced by edm::check(), and edm::getProductByTag().
{ BasicHandle result; bool found = findGroupByLabel(productType, preg_->productLookup(), label, productInstanceName, processName, cachedOffset, fillCount, result); if (!found) { boost::shared_ptr<cms::Exception> whyFailed(new edm::Exception(edm::errors::ProductNotFound)); *whyFailed << "getByLabel: Found zero products matching all criteria\n" << "Looking for type: " << productType << "\n" << "Looking for module label: " << label << "\n" << "Looking for productInstanceName: " << productInstanceName << "\n" << (processName.empty() ? "" : "Looking for process: ") << processName << "\n"; return BasicHandle(whyFailed); } return result; }
BasicHandle edm::Principal::getBySelector | ( | TypeID const & | tid, |
SelectorBase const & | s | ||
) | const |
Definition at line 229 of file Principal.cc.
References Exception, findGroup(), preg_, edm::errors::ProductNotFound, query::result, and runTheMatrix::sel.
{ BasicHandle result; int nFound = findGroup(productType, preg_->productLookup(), sel, result); if (nFound == 0) { boost::shared_ptr<cms::Exception> whyFailed(new edm::Exception(edm::errors::ProductNotFound)); *whyFailed << "getBySelector: Found zero products matching all criteria\n" << "Looking for type: " << productType << "\n"; return BasicHandle(whyFailed); } if (nFound > 1) { throw edm::Exception(edm::errors::ProductNotFound) << "getBySelector: Found " << nFound << " products rather than one which match all criteria\n" << "Looking for type: " << productType << "\n"; } return result; }
BasicHandle edm::Principal::getByType | ( | TypeID const & | tid | ) | const |
Definition at line 300 of file Principal.cc.
References Exception, findGroup(), preg_, edm::errors::ProductNotFound, query::result, and runTheMatrix::sel.
{ BasicHandle result; MatchAllSelector sel; int nFound = findGroup(productType, preg_->productLookup(), sel, result); if (nFound == 0) { boost::shared_ptr<cms::Exception> whyFailed(new edm::Exception(edm::errors::ProductNotFound)); *whyFailed << "getByType: Found zero products matching all criteria\n" << "Looking for type: " << productType << "\n"; return BasicHandle(whyFailed); } if (nFound > 1) { throw edm::Exception(edm::errors::ProductNotFound) << "getByType: Found " << nFound << " products rather than one which match all criteria\n" << "Looking for type: " << productType << "\n"; } return result; }
Definition at line 155 of file Principal.cc.
References groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.
Referenced by addGroupOrThrow(), adjustToNewProductRegistry(), getExistingGroup(), edm::LuminosityBlockPrincipal::put(), edm::RunPrincipal::put(), edm::EventPrincipal::put(), and edm::EventPrincipal::putOnRead().
{ ProductTransientIndex index = preg_->indexFrom(branchID); assert(index != ProductRegistry::kInvalidIndex); SharedGroupPtr ptr = groups_.at(index); return ptr.get(); }
Definition at line 163 of file Principal.cc.
References edm::Group::branchDescription(), edm::ConstBranchDescription::branchID(), g, and getExistingGroup().
{ Group* g = getExistingGroup(group.branchDescription().branchID()); assert(0 == g || BranchKey(group.branchDescription()) == BranchKey(g->branchDescription())); return g; }
OutputHandle edm::Principal::getForOutput | ( | BranchID const & | bid, |
bool | getProd | ||
) | const |
Definition at line 523 of file Principal.cc.
References Exception, g, getGroup(), and edm::errors::LogicError.
Referenced by edm::check(), edm::RootOutputFile::fillBranches(), edm::StreamSerializer::serializeEvent(), and edm::ProvenanceCheckerOutputModule::write().
{ SharedConstGroupPtr const& g = getGroup(bid, getProd, false); if (g.get() == 0) { throw edm::Exception(edm::errors::LogicError, "Principal::getForOutput\n") << "No entry is present for this branch.\n" << "The branch id is " << bid << "\n" << "Contact a framework developer.\n"; } if (!g->provenance() || (!g->product() && !g->productProvenancePtr())) { return OutputHandle(); } return OutputHandle(g->product().get(), &g->branchDescription(), g->productProvenancePtr()); }
Principal::SharedConstGroupPtr const edm::Principal::getGroup | ( | BranchID const & | oid, |
bool | resolveProd, | ||
bool | fillOnDemand | ||
) | const |
Definition at line 207 of file Principal.cc.
References getGroupByIndex(), getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.
Referenced by edm::EventPrincipal::getByProductID(), getForOutput(), getProvenance(), and edm::SubProcess::propagateProducts().
{ ProductTransientIndex index = preg_->indexFrom(bid); if(index == ProductRegistry::kInvalidIndex){ return SharedConstGroupPtr(); } return getGroupByIndex(index, resolveProd, fillOnDemand); }
Principal::SharedConstGroupPtr const edm::Principal::getGroupByIndex | ( | ProductTransientIndex const & | oid, |
bool | resolveProd, | ||
bool | fillOnDemand | ||
) | const [protected] |
Definition at line 216 of file Principal.cc.
References g, groups_, getHLTprescales::index, and resolveProduct().
Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroup().
{ SharedConstGroupPtr const& g = groups_[index]; if (0 == g.get()) { return g; } if (resolveProd && !g->productUnavailable()) { this->resolveProduct(*g, fillOnDemand); } return g; }
Implements edm::EDProductGetter.
Reimplemented in edm::EventPrincipal.
Definition at line 589 of file Principal.cc.
{
assert(0);
return 0;
}
void edm::Principal::getMany | ( | TypeID const & | tid, |
SelectorBase const & | sel, | ||
BasicHandleVec & | results | ||
) | const |
Definition at line 287 of file Principal.cc.
References findGroups(), preg_, python::entryComment::results, and runTheMatrix::sel.
{ findGroups(productType, preg_->productLookup(), sel, results); return; }
void edm::Principal::getManyByType | ( | TypeID const & | tid, |
BasicHandleVec & | results | ||
) | const |
Definition at line 326 of file Principal.cc.
References findGroups(), preg_, python::entryComment::results, and runTheMatrix::sel.
{ MatchAllSelector sel; findGroups(productType, preg_->productLookup(), sel, results); return; }
size_t edm::Principal::getMatchingSequence | ( | TypeID const & | typeID, |
SelectorBase const & | selector, | ||
BasicHandle & | result | ||
) | const |
Definition at line 339 of file Principal.cc.
References findGroup(), preg_, and query::result.
Provenance edm::Principal::getProvenance | ( | BranchID const & | bid | ) | const |
Definition at line 538 of file Principal.cc.
References Exception, g, getGroup(), edm::errors::ProductNotFound, and unscheduledFill().
Referenced by edm::LuminosityBlock::getProvenance(), edm::Run::getProvenance(), edm::Event::getProvenance(), and edm::RootOutputFile::insertAncestors().
{ SharedConstGroupPtr const& g = getGroup(bid, false, true); if (g.get() == 0) { throw edm::Exception(edm::errors::ProductNotFound,"InvalidID") << "getProvenance: no product with given branch id: "<< bid << "\n"; } if (g->onDemand()) { unscheduledFill(g->branchDescription().moduleLabel()); } // We already tried to produce the unscheduled products above // If they still are not there, then throw if (g->onDemand()) { throw edm::Exception(edm::errors::ProductNotFound) << "getProvenance: no product with given BranchID: "<< bid <<"\n"; } return *g->provenance(); }
Definition at line 595 of file Principal.cc.
References branchType(), edm::InputTag::branchType(), edm::InputTag::cachedOffset(), edm::InputTag::fillCount(), productRegistry(), edm::InputTag::productRegistry(), and edm::InputTag::typeID().
Referenced by edm::getProductByTag().
{ if (tag.typeID() != tid || tag.branchType() != branchType() || tag.productRegistry() != &productRegistry()) { tag.fillCount() = 0; tag.cachedOffset() = 0U; tag.typeID() = tid; tag.branchType() = branchType(); tag.productRegistry() = &productRegistry(); } }
ProcessConfiguration const& edm::Principal::processConfiguration | ( | ) | const [inline] |
Definition at line 120 of file Principal.h.
References processConfiguration_.
Referenced by edm::RunPrincipal::addToProcessHistory(), and edm::RunPrincipal::checkProcessHistory().
{return *processConfiguration_;}
ProcessHistory const& edm::Principal::processHistory | ( | ) | const [inline] |
Definition at line 112 of file Principal.h.
References processHistoryPtr_.
Referenced by edm::StreamSerializer::serializeEvent(), and edm::AsciiOutputModule::write().
{ return *processHistoryPtr_; }
ProcessHistoryID const& edm::Principal::processHistoryID | ( | ) | const [inline] |
Definition at line 116 of file Principal.h.
References processHistoryID_.
Referenced by edm::SubProcess::beginLuminosityBlock(), DQMRootOutputModule::beginRun(), edm::SubProcess::beginRun(), edm::EventPrincipal::fillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), edm::RunPrincipal::fillRunPrincipal(), edm::Event::processHistoryID(), edm::SubProcess::write(), edm::RootOutputFile::writeLuminosityBlock(), edm::RootOutputFile::writeOne(), and edm::RootOutputFile::writeRun().
{ return processHistoryID_; }
ProcessHistory& edm::Principal::processHistoryUpdate | ( | ) | [inline, protected] |
Definition at line 149 of file Principal.h.
References processHistoryPtr_.
Referenced by edm::RunPrincipal::addToProcessHistory().
{ return *processHistoryPtr_; }
EDProductGetter const* edm::Principal::prodGetter | ( | ) | const [inline] |
Definition at line 79 of file Principal.h.
{return this;}
ProductRegistry const& edm::Principal::productRegistry | ( | ) | const [inline] |
Definition at line 122 of file Principal.h.
References preg_.
Referenced by edm::EventPrincipal::fillEventPrincipal(), edm::RunPrincipal::fillRunPrincipal(), maybeFlushCache(), and edm::ProvenanceCheckerOutputModule::write().
{return *preg_;}
void edm::Principal::putOrMerge | ( | std::auto_ptr< EDProduct > | prod, |
std::auto_ptr< ProductProvenance > | prov, | ||
Group * | group | ||
) | [protected] |
Definition at line 635 of file Principal.cc.
References edm::Group::checkType(), checkUniquenessAndType(), edm::Group::mergeProduct(), edm::Group::putOrMergeProduct(), and edm::Group::putProduct().
void edm::Principal::putOrMerge | ( | std::auto_ptr< EDProduct > | prod, |
Group const * | group | ||
) | const [protected] |
Definition at line 623 of file Principal.cc.
References edm::Group::checkType(), checkUniquenessAndType(), edm::Group::mergeProduct(), edm::Group::putOrMergeProduct(), and edm::Group::putProduct().
Referenced by edm::LuminosityBlockPrincipal::put(), edm::RunPrincipal::put(), edm::RunPrincipal::resolveProductImmediate(), and edm::LuminosityBlockPrincipal::resolveProductImmediate().
Definition at line 576 of file Principal.cc.
References branchMapperPtr(), branchMapperPtr_, groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, preg_, store(), and store_.
{ for (std::vector<BranchID>::const_iterator it = bids.begin(), itEnd = bids.end(); it != itEnd; ++it) { ProductTransientIndex index= preg_->indexFrom(*it); assert(index!=ProductRegistry::kInvalidIndex); ProductTransientIndex indexO = other.preg_->indexFrom(*it); assert(indexO!=ProductRegistry::kInvalidIndex); groups_[index].swap(other.groups_[indexO]); } store_->mergeReaders(other.store()); branchMapperPtr_->mergeMappers(other.branchMapperPtr()); }
void edm::Principal::resolveProduct | ( | Group const & | g, |
bool | fillOnDemand | ||
) | const [inline, protected] |
Definition at line 170 of file Principal.h.
References resolveProduct_().
Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroupByIndex().
{resolveProduct_(g, fillOnDemand);}
virtual void edm::Principal::resolveProduct_ | ( | Group const & | g, |
bool | fillOnDemand | ||
) | const [inline, private, virtual] |
Reimplemented in edm::EventPrincipal.
Definition at line 211 of file Principal.h.
Referenced by resolveProduct().
{}
void edm::Principal::setProcessHistory | ( | Principal const & | principal | ) | [protected] |
Definition at line 201 of file Principal.cc.
References processHistoryID_, and processHistoryPtr_.
Referenced by edm::RunPrincipal::addToProcessHistory(), edm::EventPrincipal::fillEventPrincipal(), and edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal().
{ *processHistoryPtr_ = *principal.processHistoryPtr_; processHistoryID_ = processHistoryPtr_->id(); }
size_t edm::Principal::size | ( | void | ) | const |
Definition at line 65 of file Principal.cc.
References begin(), edm::Group::branchDescription(), edm::ConstBranchDescription::dropped(), end(), g, edm::Group::onDemand(), and edm::Group::productUnavailable().
Referenced by edm::StreamerInputSource::deserializeEvent(), edm::SecSourceAnalyzer::getBranches(), and edm::Event::size().
boost::shared_ptr<DelayedReader> edm::Principal::store | ( | ) | const [inline] |
Definition at line 141 of file Principal.h.
References store_.
Referenced by edm::SubProcess::beginLuminosityBlock(), edm::SubProcess::beginRun(), recombine(), edm::EventPrincipal::resolveProduct_(), edm::RunPrincipal::resolveProductImmediate(), edm::LuminosityBlockPrincipal::resolveProductImmediate(), and edm::SubProcess::write().
{return store_;}
void edm::Principal::swapBase | ( | Principal & | iOther | ) | [protected] |
Definition at line 647 of file Principal.cc.
References branchMapperPtr_, groups_, preg_, processConfiguration_, processHistoryID_, processHistoryPtr_, store_, and edm::swap().
Referenced by edm::RunPrincipal::swap(), and edm::LuminosityBlockPrincipal::swap().
{ std::swap(processHistoryPtr_, iOther.processHistoryPtr_); std::swap(processHistoryID_, iOther.processHistoryID_); std::swap(processConfiguration_,iOther.processConfiguration_); std::swap(groups_,iOther.groups_); std::swap(preg_, iOther.preg_); std::swap(branchMapperPtr_,iOther.branchMapperPtr_); std::swap(store_,iOther.store_); }
virtual bool edm::Principal::unscheduledFill | ( | std::string const & | moduleLabel | ) | const [private, pure virtual] |
Implemented in edm::EventPrincipal, edm::LuminosityBlockPrincipal, and edm::RunPrincipal.
Referenced by getProvenance().
boost::shared_ptr<BranchMapper> edm::Principal::branchMapperPtr_ [private] |
Definition at line 228 of file Principal.h.
Referenced by branchMapperPtr(), clearPrincipal(), fillPrincipal(), recombine(), and swapBase().
BranchType edm::Principal::branchType_ [private] |
Definition at line 237 of file Principal.h.
Referenced by adjustIndexesAfterProductRegistryAddition(), adjustToNewProductRegistry(), branchType(), fillPrincipal(), findGroup(), findGroupByLabel(), findGroups(), and Principal().
GroupCollection edm::Principal::groups_ [private] |
Definition at line 220 of file Principal.h.
Referenced by addGroup_(), adjustIndexesAfterProductRegistryAddition(), adjustToNewProductRegistry(), begin(), end(), getExistingGroup(), getGroupByIndex(), recombine(), and swapBase().
boost::shared_ptr<ProductRegistry const> edm::Principal::preg_ [private] |
Definition at line 224 of file Principal.h.
Referenced by addGroup_(), adjustIndexesAfterProductRegistryAddition(), fillPrincipal(), getByLabel(), getBySelector(), getByType(), getExistingGroup(), getGroup(), getMany(), getManyByType(), getMatchingSequence(), productRegistry(), recombine(), and swapBase().
ProcessConfiguration const* edm::Principal::processConfiguration_ [private] |
Definition at line 217 of file Principal.h.
Referenced by fillPrincipal(), processConfiguration(), and swapBase().
Definition at line 215 of file Principal.h.
Referenced by clearPrincipal(), fillPrincipal(), processHistoryID(), setProcessHistory(), and swapBase().
boost::shared_ptr<ProcessHistory> edm::Principal::processHistoryPtr_ [private] |
Definition at line 213 of file Principal.h.
Referenced by clearPrincipal(), fillPrincipal(), processHistory(), processHistoryUpdate(), setProcessHistory(), and swapBase().
std::set<EDProduct *> edm::Principal::productPtrs_ [mutable, private] |
Definition at line 235 of file Principal.h.
Referenced by checkUniquenessAndType(), and clearPrincipal().
boost::shared_ptr<DelayedReader> edm::Principal::store_ [private] |
Definition at line 232 of file Principal.h.
Referenced by clearPrincipal(), fillPrincipal(), recombine(), store(), and swapBase().