CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

edm::Principal Class Reference

#include <Principal.h>

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

List of all members.

Public Types

typedef std::vector< BasicHandleBasicHandleVec
typedef boost::filter_iterator
< FilledGroupPtr,
GroupCollection::const_iterator > 
const_iterator
typedef Group const * ConstGroupPtr
typedef std::vector
< boost::shared_ptr< Group > > 
GroupCollection
typedef std::string ProcessName
typedef
ProcessHistory::const_iterator 
ProcessNameConstIterator
typedef boost::shared_ptr< GroupSharedGroupPtr
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 &reg)
const_iterator begin () const
boost::shared_ptr< BranchMapperbranchMapperPtr () const
BranchType const & branchType () const
void clearPrincipal ()
const_iterator end () const
void fillPrincipal (ProcessHistoryID const &hist, boost::shared_ptr< BranchMapper > mapper, DelayedReader *reader)
ProductData const * findGroupByTag (TypeID const &typeID, InputTag const &tag) const
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
ConstGroupPtr 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
DelayedReaderreader () const
void recombine (Principal &other, std::vector< BranchID > const &bids)
size_t size () const
virtual ~Principal ()

Protected Member Functions

void addGroup_ (std::auto_ptr< Group > g)
void addGroupOrThrow (std::auto_ptr< Group > g)
void checkUniquenessAndType (WrapperOwningHolder const &prod, Group const *group) const
GroupgetExistingGroup (BranchID const &branchID)
GroupgetExistingGroup (Group const &g)
ConstGroupPtr const getGroupByIndex (ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
ProcessHistoryprocessHistoryUpdate ()
void putOrMerge (WrapperOwningHolder const &prod, Group const *group) const
void putOrMerge (WrapperOwningHolder const &prod, ProductProvenance &prov, Group *group)
void resolveProduct (Group const &g, bool fillOnDemand) const
void setProcessHistory (Principal const &principal)

Private Types

typedef TransientProductLookupMap TypeLookup

Private Member Functions

size_t findGroup (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const
ProductData const * findGroupByLabel (TypeID const &typeID, TypeLookup const &typeLookup, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
size_t findGroups (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandleVec &results) const
virtual WrapperHolder getIt (ProductID const &) const
virtual void resolveProduct_ (Group const &, bool) const
virtual bool unscheduledFill (std::string const &moduleLabel) const =0

Private Attributes

boost::shared_ptr< BranchMapperbranchMapperPtr_
BranchType branchType_
GroupCollection groups_
boost::shared_ptr
< ProductRegistry const > 
preg_
ProcessConfiguration const * processConfiguration_
ProcessHistoryID processHistoryID_
boost::scoped_ptr< ProcessHistoryprocessHistoryPtr_
std::set< void const * > productPtrs_
DelayedReaderreader_

Detailed Description

Definition at line 50 of file Principal.h.


Member Typedef Documentation

Definition at line 56 of file Principal.h.

typedef boost::filter_iterator<FilledGroupPtr, GroupCollection::const_iterator> edm::Principal::const_iterator

Definition at line 53 of file Principal.h.

Reimplemented in edm::EventPrincipal.

Definition at line 55 of file Principal.h.

typedef std::vector<boost::shared_ptr<Group> > edm::Principal::GroupCollection

Definition at line 52 of file Principal.h.

typedef std::string edm::Principal::ProcessName

Definition at line 60 of file Principal.h.

Definition at line 54 of file Principal.h.

typedef boost::shared_ptr<Group> edm::Principal::SharedGroupPtr

Definition at line 59 of file Principal.h.

typedef GroupCollection::size_type edm::Principal::size_type

Definition at line 57 of file Principal.h.

Definition at line 195 of file Principal.h.


Constructor & Destructor Documentation

edm::Principal::Principal ( boost::shared_ptr< ProductRegistry const >  reg,
ProcessConfiguration const &  pc,
BranchType  bt 
)

Definition at line 81 of file Principal.cc.

References addGroupInput(), addGroupScheduled(), addGroupSource(), addOnDemandGroup(), branchType_, edm::InEvent, and LaserTracksInput_cfi::source.

                                      :
    EDProductGetter(),
    processHistoryPtr_(new ProcessHistory),
    processHistoryID_(processHistoryPtr_->id()),
    processConfiguration_(&pc),
    groups_(reg->constProductList().size(), SharedGroupPtr()),
    preg_(reg),
    branchMapperPtr_(new BranchMapper),
    reader_(),
    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 119 of file Principal.cc.

                        {
  }

Member Function Documentation

void edm::Principal::addGroup_ ( std::auto_ptr< Group g) [protected]

Definition at line 235 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 173 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 249 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 Exception(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 161 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 167 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 179 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 710 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 139 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]
boost::shared_ptr<BranchMapper> edm::Principal::branchMapperPtr ( ) const [inline]
BranchType const& edm::Principal::branchType ( ) const [inline]

Definition at line 142 of file Principal.h.

References branchType_.

Referenced by maybeFlushCache().

{return branchType_;}
void edm::Principal::checkUniquenessAndType ( WrapperOwningHolder const &  prod,
Group const *  group 
) const [protected]

Definition at line 671 of file Principal.cc.

References edm::Group::branchDescription(), edm::ConstBranchDescription::branchName(), edm::Group::checkType(), edm::WrapperHolder::isValid(), parseEventContent::prod, productPtrs_, reset(), edm::second(), edm::throwCorruptionException(), and edm::WrapperHolder::wrapper().

Referenced by edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), putOrMerge(), and edm::EventPrincipal::resolveProduct_().

                                                                                         {
    if(!prod.isValid()) 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.wrapper()).second;
    if(alreadyPresent) {
      g->checkType(prod);
      const_cast<WrapperOwningHolder&>(prod).reset();
      throwCorruptionException("checkUniquenessAndType", g->branchDescription().branchName());
    }
    // Checks that the real type of the product matches the branch.
    g->checkType(prod);
  }
void edm::Principal::clearPrincipal ( )

Definition at line 186 of file Principal.cc.

References begin(), branchMapperPtr_, end(), i, processHistoryID_, processHistoryPtr_, productPtrs_, and reader_.

Referenced by edm::EventPrincipal::clearEventPrincipal().

                            {
    processHistoryPtr_->clear();
    processHistoryID_ = processHistoryPtr_->id();
    branchMapperPtr_->reset();
    reader_ = 0;
    for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
      (*i)->resetProductData();
    }
    productPtrs_.clear();
  }
const_iterator edm::Principal::end ( void  ) const [inline]
void edm::Principal::fillPrincipal ( ProcessHistoryID const &  hist,
boost::shared_ptr< BranchMapper mapper,
DelayedReader reader 
)
size_t edm::Principal::findGroup ( TypeID const &  typeID,
TypeLookup const &  typeLookup,
SelectorBase const &  selector,
BasicHandle result 
) const [private]

Definition at line 439 of file Principal.cc.

References branchType_, prof2calltree::count, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::BasicHandle::isValid(), edm::SelectorBase::match(), edm::max(), edm::maybeThrowMissingDictionaryException(), preg_, 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 throw an exception.
    // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
    std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
    if(range.first == range.second) {
      maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
    }

    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
        ConstGroupPtr 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->productData());
            }
            ++count;
          }
        }
      }
    }
    if(count != 1) result = BasicHandle();
    return count;
  }
ProductData const * 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 
) const [private]

Definition at line 491 of file Principal.cc.

References edm::TransientProductLookupMap::begin(), branchType_, edm::TransientProductLookupMap::end(), edm::TransientProductLookupMap::equal_range(), edm::TransientProductLookupMap::fillCount(), getGroupByIndex(), edm::maybeThrowMissingDictionaryException(), preg_, and resolveProduct().

Referenced by findGroupByTag(), and getByLabel().

                                                    {

    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();
      }
      // We check for a missing dictionary.  We do this only in this error leg.
      // A class without a dictionary cannot be in an Event/Lumi/Run.
      // We check if the class has a dictionary.  If it does not, we throw an exception.
      // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
      std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const typeRange = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
      if(typeRange.first == typeRange.second) {
        maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
      }
      return 0;
    }

    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 0;
        }
      } // end if(toBeCached)
    }

    for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) {
      if(it->isFirst() && it != range.first) {
        return 0;
      }
      if(!processName.empty() && processName != it->branchDescription()->processName()) {
        continue;
      }
      //now see if the data is actually available
      ConstGroupPtr 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
          return &group->productData();
        }
      }
    }
    return 0;
  }
ProductData const * edm::Principal::findGroupByTag ( TypeID const &  typeID,
InputTag const &  tag 
) const

Definition at line 575 of file Principal.cc.

References edm::InputTag::cachedOffset(), edm::InputTag::fillCount(), findGroupByLabel(), edm::InputTag::instance(), edm::InputTag::label(), preg_, edm::InputTag::process(), and edm::throwNotFoundException().

Referenced by edm::getProductByTag().

                                                                           {
    ProductData const* productData =
        findGroupByLabel(typeID,
                         preg_->productLookup(),
                         tag.label(),
                         tag.instance(),
                         tag.process(),
                         tag.cachedOffset(),
                         tag.fillCount());
    if(productData == 0) {
      throwNotFoundException("findProductByTag", typeID, tag);
    }
    return productData;
  }
size_t edm::Principal::findGroups ( TypeID const &  typeID,
TypeLookup const &  typeLookup,
SelectorBase const &  selector,
BasicHandleVec results 
) const [private]

Definition at line 399 of file Principal.cc.

References branchType_, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::SelectorBase::match(), edm::maybeThrowMissingDictionaryException(), preg_, 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 throw an exception.
    // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
    std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
    if(range.first == range.second) {
      maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
    }

    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
        ConstGroupPtr 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->productData());
            results.push_back(bh);
          }
        }
      }
    }
    return results.size();
  }
void edm::Principal::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 625 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 314 of file Principal.cc.

References findGroupByLabel(), label, edm::makeNotFoundException(), preg_, and query::result.

Referenced by edm::check().

                                              {

    ProductData const* result = findGroupByLabel(productType,
                                                 preg_->productLookup(),
                                                 label,
                                                 productInstanceName,
                                                 processName,
                                                 cachedOffset,
                                                 fillCount);

    if(result == 0) {
      boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getByLabel", productType, label, productInstanceName, processName);
      return BasicHandle(whyFailed);
    }
    return BasicHandle(*result);
  }
BasicHandle edm::Principal::getBySelector ( TypeID const &  tid,
SelectorBase const &  s 
) const

Definition at line 294 of file Principal.cc.

References findGroup(), edm::makeNotFoundException(), preg_, query::result, runTheMatrix::sel, and edm::throwMultiFoundException().

                                                          {
    BasicHandle result;

    int nFound = findGroup(productType,
                           preg_->productLookup(),
                           sel,
                           result);

    if(nFound == 0) {
      boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getBySelector", productType);
      return BasicHandle(whyFailed);
    }
    if(nFound > 1) {
      throwMultiFoundException("getBySelector", nFound, productType);
    }
    return result;
  }
BasicHandle edm::Principal::getByType ( TypeID const &  tid) const

Definition at line 351 of file Principal.cc.

References findGroup(), edm::makeNotFoundException(), preg_, query::result, runTheMatrix::sel, and edm::throwMultiFoundException().

                                                      {

    BasicHandle result;
    MatchAllSelector sel;

    int nFound = findGroup(productType,
                           preg_->productLookup(),
                           sel,
                           result);

    if(nFound == 0) {
      boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getByType", productType);
      return BasicHandle(whyFailed);
    }

    if(nFound > 1) {
      throwMultiFoundException("getByType", nFound, productType);
    }
    return result;
  }
Group * edm::Principal::getExistingGroup ( BranchID const &  branchID) [protected]
Group * edm::Principal::getExistingGroup ( Group const &  g) [protected]

Definition at line 228 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 591 of file Principal.cc.

References g, getGroup(), edm::errors::LogicError, and edm::throwGroupNotFoundException().

Referenced by edm::check(), edm::RootOutputFile::fillBranches(), edm::StreamSerializer::serializeEvent(), and edm::ProvenanceCheckerOutputModule::write().

                                                                 {
    ConstGroupPtr const g = getGroup(bid, getProd, false);
    if(g == 0) {
      throwGroupNotFoundException("getForOutput", errors::LogicError, bid);
    }
    if(!g->provenance() || (!g->product() && !g->productProvenancePtr())) {
      return OutputHandle();
    }
    return OutputHandle(WrapperHolder(g->product().get(), g->productData().getInterface()), &g->branchDescription(), g->productProvenancePtr());
  }
Principal::ConstGroupPtr const edm::Principal::getGroup ( BranchID const &  oid,
bool  resolveProd,
bool  fillOnDemand 
) const
Principal::ConstGroupPtr const edm::Principal::getGroupByIndex ( ProductTransientIndex const &  oid,
bool  resolveProd,
bool  fillOnDemand 
) const [protected]

Definition at line 281 of file Principal.cc.

References g, groups_, getHLTprescales::index, and resolveProduct().

Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroup().

                                                                                                          {

    ConstGroupPtr const g = groups_[index].get();
    if(0 == g) {
      return g;
    }
    if(resolveProd && !g->productUnavailable()) {
      this->resolveProduct(*g, fillOnDemand);
    }
    return g;
  }
WrapperHolder edm::Principal::getIt ( ProductID const &  ) const [private, virtual]

Implements edm::EDProductGetter.

Reimplemented in edm::EventPrincipal.

Definition at line 652 of file Principal.cc.

                                         {
    assert(0);
    return WrapperHolder();
  }
void edm::Principal::getMany ( TypeID const &  tid,
SelectorBase const &  sel,
BasicHandleVec results 
) const

Definition at line 338 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 373 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 386 of file Principal.cc.

References findGroup(), preg_, and query::result.

                                                            {

    // One new argument is the element lookup container
    // Otherwise this just passes through the arguments to findGroup
    return findGroup(typeID,
                     preg_->elementLookup(),
                     selector,
                     result);
  }
Provenance edm::Principal::getProvenance ( BranchID const &  bid) const

Definition at line 603 of file Principal.cc.

References g, getGroup(), edm::errors::ProductNotFound, edm::throwGroupNotFoundException(), and unscheduledFill().

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

                                                    {
    ConstGroupPtr const g = getGroup(bid, false, true);
    if(g == 0) {
      throwGroupNotFoundException("getProvenance", errors::ProductNotFound, bid);
    }

    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()) {
      throwGroupNotFoundException("getProvenance(onDemand)", errors::ProductNotFound, bid);
    }

    return *g->provenance();
  }
void edm::Principal::maybeFlushCache ( TypeID const &  tid,
InputTag const &  tag 
) const

Definition at line 658 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]
ProcessHistory const& edm::Principal::processHistory ( ) const [inline]

Definition at line 117 of file Principal.h.

References processHistoryPtr_.

Referenced by edm::StreamSerializer::serializeEvent(), and edm::AsciiOutputModule::write().

                                                 {
      return *processHistoryPtr_;
    }
ProcessHistoryID const& edm::Principal::processHistoryID ( ) const [inline]
ProcessHistory& edm::Principal::processHistoryUpdate ( ) [inline, protected]

Definition at line 157 of file Principal.h.

References processHistoryPtr_.

Referenced by edm::RunPrincipal::addToProcessHistory().

                                           {
      return *processHistoryPtr_;
    }
EDProductGetter const* edm::Principal::prodGetter ( ) const [inline]

Definition at line 84 of file Principal.h.

{return this;}
ProductRegistry const& edm::Principal::productRegistry ( ) const [inline]
void edm::Principal::putOrMerge ( WrapperOwningHolder const &  prod,
Group const *  group 
) const [protected]
void edm::Principal::putOrMerge ( WrapperOwningHolder const &  prod,
ProductProvenance prov,
Group group 
) [protected]

Definition at line 698 of file Principal.cc.

References edm::Group::checkType(), checkUniquenessAndType(), edm::Group::mergeProduct(), edm::Group::putOrMergeProduct(), and edm::Group::putProduct().

                                                                                          {
    bool willBePut = g->putOrMergeProduct();
    if(willBePut) {
      checkUniquenessAndType(prod, g);
      g->putProduct(prod, prov);
    } else {
      g->checkType(prod);
      g->mergeProduct(prod, prov);
    }
  }
DelayedReader* edm::Principal::reader ( ) const [inline]
void edm::Principal::recombine ( Principal other,
std::vector< BranchID > const &  bids 
)

Definition at line 639 of file Principal.cc.

References branchMapperPtr(), branchMapperPtr_, groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, edm::DelayedReader::mergeReaders(), preg_, reader(), and reader_.

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

                                                                        {
    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]);
    }
    reader_->mergeReaders(other.reader());
    branchMapperPtr_->mergeMappers(other.branchMapperPtr());
  }
void edm::Principal::resolveProduct ( Group const &  g,
bool  fillOnDemand 
) const [inline, protected]

Definition at line 178 of file Principal.h.

References resolveProduct_().

Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroupByIndex().

{resolveProduct_(g, fillOnDemand);}
virtual void edm::Principal::resolveProduct_ ( Group const &  ,
bool   
) const [inline, private, virtual]

Reimplemented in edm::EventPrincipal.

Definition at line 216 of file Principal.h.

Referenced by resolveProduct().

{}
void edm::Principal::setProcessHistory ( Principal const &  principal) [protected]
size_t edm::Principal::size ( void  ) const

Definition at line 126 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().

                        {
    size_t size = 0U;
    for(const_iterator it = this->begin(), itEnd = this->end(); it != itEnd; ++it) {
      Group const& g = **it;
      if(!g.productUnavailable() && !g.onDemand() && !g.branchDescription().dropped()) {
        ++size;
      }
    }
    return size;
  }
virtual bool edm::Principal::unscheduledFill ( std::string const &  moduleLabel) const [private, pure virtual]

Member Data Documentation

boost::shared_ptr<BranchMapper> edm::Principal::branchMapperPtr_ [private]

Definition at line 233 of file Principal.h.

Referenced by branchMapperPtr(), clearPrincipal(), fillPrincipal(), and recombine().

boost::shared_ptr<ProductRegistry const> edm::Principal::preg_ [private]

Definition at line 222 of file Principal.h.

Referenced by fillPrincipal(), and processConfiguration().

Definition at line 220 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), processHistoryID(), and setProcessHistory().

boost::scoped_ptr<ProcessHistory> edm::Principal::processHistoryPtr_ [private]
std::set<void const*> edm::Principal::productPtrs_ [mutable, private]

Definition at line 240 of file Principal.h.

Referenced by checkUniquenessAndType(), and clearPrincipal().

Definition at line 237 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), reader(), and recombine().