CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
edm::BranchIDListHelper Class Reference

#include <BranchIDListHelper.h>

Public Types

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

Public Member Functions

 BranchIDListHelper ()
 
BranchIDLists const & branchIDLists () const
 
BranchIDToIndexMap const & branchIDToIndexMap () const
 
void fixBranchListIndexes (BranchListIndexes &indexes) const
 Called by sources to convert their read indexes into the indexes used by the job. More...
 
bool hasProducedProducts () const
 
BranchIDListsmutableBranchIDLists ()
 
BranchListIndex producedBranchListIndex () const
 
bool updateFromInput (BranchIDLists const &bidlists)
 
void updateFromRegistry (ProductRegistry const &reg)
 

Private Attributes

BranchIDLists branchIDLists_
 
BranchIDToIndexMap branchIDToIndexMap_
 
std::vector< BranchListIndexinputIndexToJobIndex_
 
BranchListIndex producedBranchListIndex_
 

Detailed Description

Definition at line 15 of file BranchIDListHelper.h.

Member Typedef Documentation

Definition at line 18 of file BranchIDListHelper.h.

Definition at line 17 of file BranchIDListHelper.h.

Constructor & Destructor Documentation

edm::BranchIDListHelper::BranchIDListHelper ( )

Definition at line 10 of file BranchIDListHelper.cc.

10  :
15  {}
const T & max(const T &a, const T &b)
BranchListIndex producedBranchListIndex_
BranchIDToIndexMap branchIDToIndexMap_
std::vector< BranchListIndex > inputIndexToJobIndex_

Member Function Documentation

BranchIDLists const& edm::BranchIDListHelper::branchIDLists ( ) const
inline

Definition at line 33 of file BranchIDListHelper.h.

References branchIDLists_.

33 {return branchIDLists_;}
BranchIDToIndexMap const& edm::BranchIDListHelper::branchIDToIndexMap ( ) const
inline

Definition at line 34 of file BranchIDListHelper.h.

References branchIDToIndexMap_.

34 {return branchIDToIndexMap_;}
BranchIDToIndexMap branchIDToIndexMap_
void edm::BranchIDListHelper::fixBranchListIndexes ( BranchListIndexes indexes) const

Called by sources to convert their read indexes into the indexes used by the job.

Definition at line 70 of file BranchIDListHelper.cc.

References i, and inputIndexToJobIndex_.

70  {
71  for(BranchListIndex& i : indexes) {
72  assert(i<inputIndexToJobIndex_.size());
74  }
75  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
std::vector< BranchListIndex > inputIndexToJobIndex_
bool edm::BranchIDListHelper::hasProducedProducts ( ) const
inline

Definition at line 36 of file BranchIDListHelper.h.

References max(), and producedBranchListIndex_.

36  {
38  }
const T & max(const T &a, const T &b)
BranchListIndex producedBranchListIndex_
BranchIDLists& edm::BranchIDListHelper::mutableBranchIDLists ( )
inline

Definition at line 30 of file BranchIDListHelper.h.

References branchIDLists_.

30 {return branchIDLists_;}
BranchListIndex edm::BranchIDListHelper::producedBranchListIndex ( ) const
inline

Definition at line 35 of file BranchIDListHelper.h.

References producedBranchListIndex_.

BranchListIndex producedBranchListIndex_
bool edm::BranchIDListHelper::updateFromInput ( BranchIDLists const &  bidlists)

Definition at line 18 of file BranchIDListHelper.cc.

References branchIDLists_, branchIDToIndexMap_, edm::find_in_all(), i, inputIndexToJobIndex_, and j.

Referenced by edm::StreamerInputSource::mergeIntoRegistry().

18  {
19  //The BranchIDLists is a list of lists
20  // this routine compares bidlists to branchIDLists_ to see if a list
21  // in branchIDLists_ is already in bidlist and if it isn't we insert
22  // that new list into branchIDLists_
23  bool unchanged = true;
24  inputIndexToJobIndex_.clear();
25  inputIndexToJobIndex_.resize(bidlists.size());
26  for(auto it = bidlists.begin(), itEnd = bidlists.end(); it != itEnd; ++it) {
27  BranchListIndex oldBlix = it - bidlists.begin();
28  auto j = find_in_all(branchIDLists_, *it);
29  BranchListIndex blix = j - branchIDLists_.begin();
30  if(j == branchIDLists_.end()) {
31  branchIDLists_.push_back(*it);
32  for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
33  ProductIndex pix = i - it->begin();
34  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
35  }
36  }
37  inputIndexToJobIndex_[oldBlix]=blix;
38  if(oldBlix != blix) {
39  unchanged = false;
40  }
41  }
42  return unchanged;
43  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
int j
Definition: DBlmapReader.cc:9
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
BranchIDToIndexMap branchIDToIndexMap_
unsigned short ProductIndex
Definition: ProductID.h:26
std::vector< BranchListIndex > inputIndexToJobIndex_
void edm::BranchIDListHelper::updateFromRegistry ( ProductRegistry const &  reg)

Definition at line 46 of file BranchIDListHelper.cc.

References branchIDLists_, branchIDToIndexMap_, i, edm::InEvent, producedBranchListIndex_, and edm::ProductRegistry::productList().

46  {
47  BranchIDList bidlist;
48  // Add entries for current process for ProductID to BranchID mapping.
49  for(ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
50  it != itEnd; ++it) {
51  if(it->second.produced()) {
52  if(it->second.branchType() == InEvent) {
53  bidlist.push_back(it->second.branchID().id());
54  }
55  }
56  }
57  if(!bidlist.empty()) {
58  BranchListIndex blix = branchIDLists_.size();
60  //preg.setProducedBranchListIndex(blix);
61  branchIDLists_.push_back(bidlist);
62  for(BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
63  ProductIndex pix = i - bidlist.begin();
64  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
65  }
66  }
67  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
BranchListIndex producedBranchListIndex_
BranchIDToIndexMap branchIDToIndexMap_
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
unsigned short ProductIndex
Definition: ProductID.h:26
preg
Definition: Schedule.cc:362

Member Data Documentation

BranchIDLists edm::BranchIDListHelper::branchIDLists_
private
BranchIDToIndexMap edm::BranchIDListHelper::branchIDToIndexMap_
private

Definition at line 42 of file BranchIDListHelper.h.

Referenced by branchIDToIndexMap(), updateFromInput(), and updateFromRegistry().

std::vector<BranchListIndex> edm::BranchIDListHelper::inputIndexToJobIndex_
private

Definition at line 43 of file BranchIDListHelper.h.

Referenced by fixBranchListIndexes(), and updateFromInput().

BranchListIndex edm::BranchIDListHelper::producedBranchListIndex_
private