CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

edm::BranchIDListHelper Class Reference

#include <BranchIDListHelper.h>

List of all members.

Public Types

typedef std::multimap
< BranchID, IndexPair
BranchIDToIndexMap
typedef std::map
< BranchListIndex,
BranchListIndex
BranchListIndexMapper
typedef std::pair
< BranchListIndex,
ProductIndex
IndexPair

Public Member Functions

 BranchIDListHelper ()
BranchIDToIndexMap const & branchIDToIndexMap () const

Static Public Member Functions

static void clearRegistries ()
static void fixBranchListIndexes (BranchListIndexes &indexes)
static bool updateFromInput (BranchIDLists const &bidlists, std::string const &fileName)
static void updateRegistries (ProductRegistry const &reg)

Private Attributes

BranchIDToIndexMap branchIDToIndexMap_
BranchListIndexMapper branchListIndexMapper_

Detailed Description

Definition at line 13 of file BranchIDListHelper.h.


Member Typedef Documentation

Definition at line 16 of file BranchIDListHelper.h.

Definition at line 17 of file BranchIDListHelper.h.

Definition at line 15 of file BranchIDListHelper.h.


Constructor & Destructor Documentation

edm::BranchIDListHelper::BranchIDListHelper ( )

Definition at line 9 of file BranchIDListHelper.cc.


Member Function Documentation

BranchIDToIndexMap const& edm::BranchIDListHelper::branchIDToIndexMap ( ) const [inline]

Definition at line 24 of file BranchIDListHelper.h.

References branchIDToIndexMap_.

Referenced by updateFromInput(), and updateRegistries().

void edm::BranchIDListHelper::clearRegistries ( ) [static]

Definition at line 77 of file BranchIDListHelper.cc.

References edm::detail::ThreadSafeIndexedRegistry< T, E >::data(), edm::detail::ThreadSafeIndexedRegistry< T, E >::extra(), and instance.

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

                                      {
    BranchIDListRegistry& breg = *BranchIDListRegistry::instance();
    breg.data().clear();
    breg.extra().branchIDToIndexMap_.clear();
    breg.extra().branchListIndexMapper_.clear();
  }
void edm::BranchIDListHelper::fixBranchListIndexes ( BranchListIndexes indexes) [static]

Definition at line 68 of file BranchIDListHelper.cc.

References alignCSCRings::e, edm::detail::ThreadSafeIndexedRegistry< T, E >::extra(), i, and instance.

Referenced by edm::StreamerInputSource::deserializeEvent(), and TFWLiteSelectorBasic::Process().

                                                                     {
    BranchIDListRegistry& breg = *BranchIDListRegistry::instance();
    BranchListIndexMapper& branchListIndexMapper = breg.extra().branchListIndexMapper_;
    for(BranchListIndexes::iterator i = indexes.begin(), e = indexes.end(); i != e; ++i) {
      *i = branchListIndexMapper[*i];
    }
  }
bool edm::BranchIDListHelper::updateFromInput ( BranchIDLists const &  bidlists,
std::string const &  fileName 
) [static]

Definition at line 14 of file BranchIDListHelper.cc.

References branchIDToIndexMap(), edm::detail::ThreadSafeIndexedRegistry< T, E >::data(), edm::detail::ThreadSafeIndexedRegistry< T, E >::extra(), edm::find_in_all(), i, edm::detail::ThreadSafeIndexedRegistry< T, E >::insertMapped(), instance, and j.

Referenced by edm::StreamerInputSource::mergeIntoRegistry(), edm::RootFile::RootFile(), and TFWLiteSelectorBasic::setupNewFile().

                                                                                        {
    bool unchanged = true;
    BranchIDListRegistry& breg = *BranchIDListRegistry::instance();
    BranchIDListRegistry::collection_type& bdata = breg.data();
    BranchIDToIndexMap& branchIDToIndexMap = breg.extra().branchIDToIndexMap_;
    BranchListIndexMapper& branchListIndexMapper = breg.extra().branchListIndexMapper_;
    branchListIndexMapper.clear();
    typedef BranchIDLists::const_iterator Iter;
    typedef BranchIDListRegistry::const_iterator RegIter;
    for(Iter it = bidlists.begin(), itEnd = bidlists.end(); it != itEnd; ++it) {
      BranchListIndex oldBlix = it - bidlists.begin();
      RegIter j = find_in_all(bdata, *it);
      BranchListIndex blix = j - bdata.begin();
      if(j == bdata.end()) {
        breg.insertMapped(*it);
        for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
          ProductIndex pix = i - it->begin();
          branchIDToIndexMap.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
        }
      }
      branchListIndexMapper.insert(std::make_pair(oldBlix, blix));
      if(oldBlix != blix) {
        unchanged = false;
      }
    }
    return unchanged;
  }
void edm::BranchIDListHelper::updateRegistries ( ProductRegistry const &  reg) [static]

Definition at line 43 of file BranchIDListHelper.cc.

References branchIDToIndexMap(), edm::detail::ThreadSafeIndexedRegistry< T, E >::data(), edm::detail::ThreadSafeIndexedRegistry< T, E >::extra(), i, edm::InEvent, edm::detail::ThreadSafeIndexedRegistry< T, E >::insertMapped(), instance, edm::ProductRegistry::productList(), and edm::ProductRegistry::setProducedBranchListIndex().

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

                                                                  {
    BranchIDList bidlist;
    // Add entries for current process for ProductID to BranchID mapping.
    for(ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
        it != itEnd; ++it) {
      if(it->second.produced()) {
        if(it->second.branchType() == InEvent) {
          bidlist.push_back(it->second.branchID().id());
        }
      }
    }
    BranchIDListRegistry& breg = *BranchIDListRegistry::instance();
    BranchIDToIndexMap& branchIDToIndexMap = breg.extra().branchIDToIndexMap_;
    if(!bidlist.empty()) {
      BranchListIndex blix = breg.data().size();
      preg.setProducedBranchListIndex(blix);
      breg.insertMapped(bidlist);
      for(BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
        ProductIndex pix = i - bidlist.begin();
        branchIDToIndexMap.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
      }
    }
  }

Member Data Documentation

Definition at line 27 of file BranchIDListHelper.h.

Referenced by branchIDToIndexMap().

Definition at line 28 of file BranchIDListHelper.h.