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 updateFromParent (BranchIDLists const &bidlists)
 
void updateFromRegistry (ProductRegistry const &reg)
 

Private Attributes

BranchIDLists branchIDLists_
 
BranchIDToIndexMap branchIDToIndexMap_
 
std::vector< BranchListIndexinputIndexToJobIndex_
 
BranchIDLists::size_type nAlreadyCopied_
 
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  :
16  {}
BranchIDLists::size_type nAlreadyCopied_
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 36 of file BranchIDListHelper.h.

References branchIDLists_.

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

Definition at line 37 of file BranchIDListHelper.h.

References branchIDToIndexMap_.

37 {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 88 of file BranchIDListHelper.cc.

References i, and inputIndexToJobIndex_.

88  {
89  for(BranchListIndex& i : indexes) {
90  assert(i<inputIndexToJobIndex_.size());
92  }
93  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
std::vector< BranchListIndex > inputIndexToJobIndex_
bool edm::BranchIDListHelper::hasProducedProducts ( ) const
inline

Definition at line 39 of file BranchIDListHelper.h.

References max(), and producedBranchListIndex_.

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

Definition at line 33 of file BranchIDListHelper.h.

References branchIDLists_.

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

Definition at line 38 of file BranchIDListHelper.h.

References producedBranchListIndex_.

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

Definition at line 19 of file BranchIDListHelper.cc.

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

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

19  {
20  //The BranchIDLists is a list of lists
21  // this routine compares bidlists to branchIDLists_ to see if a list
22  // in branchIDLists_ is already in bidlist and if it isn't we insert
23  // that new list into branchIDLists_
24  bool unchanged = true;
25  inputIndexToJobIndex_.clear();
26  inputIndexToJobIndex_.resize(bidlists.size());
27  for(auto it = bidlists.begin(), itEnd = bidlists.end(); it != itEnd; ++it) {
28  BranchListIndex oldBlix = it - bidlists.begin();
29  auto j = find_in_all(branchIDLists_, *it);
30  BranchListIndex blix = j - branchIDLists_.begin();
31  if(j == branchIDLists_.end()) {
32  branchIDLists_.push_back(*it);
33  for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
34  ProductIndex pix = i - it->begin();
35  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
36  }
37  }
38  inputIndexToJobIndex_[oldBlix]=blix;
39  if(oldBlix != blix) {
40  unchanged = false;
41  }
42  }
43  return unchanged;
44  }
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::updateFromParent ( BranchIDLists const &  bidlists)

Definition at line 47 of file BranchIDListHelper.cc.

References branchIDLists_, branchIDToIndexMap_, i, inputIndexToJobIndex_, and nAlreadyCopied_.

47  {
48 
49  inputIndexToJobIndex_.resize(bidlists.size());
50  for(auto it = bidlists.begin() + nAlreadyCopied_, itEnd = bidlists.end(); it != itEnd; ++it) {
51  BranchListIndex oldBlix = it - bidlists.begin();
52  BranchListIndex blix = branchIDLists_.size();
53  branchIDLists_.push_back(*it);
54  for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
55  ProductIndex pix = i - it->begin();
56  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
57  }
58  inputIndexToJobIndex_[oldBlix]=blix;
59  }
60  nAlreadyCopied_ = bidlists.size();
61  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
BranchIDLists::size_type nAlreadyCopied_
BranchIDToIndexMap branchIDToIndexMap_
unsigned short ProductIndex
Definition: ProductID.h:26
std::vector< BranchListIndex > inputIndexToJobIndex_
void edm::BranchIDListHelper::updateFromRegistry ( ProductRegistry const &  reg)

Definition at line 64 of file BranchIDListHelper.cc.

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

64  {
65  BranchIDList bidlist;
66  // Add entries for current process for ProductID to BranchID mapping.
67  for(ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
68  it != itEnd; ++it) {
69  if(it->second.produced()) {
70  if(it->second.branchType() == InEvent) {
71  bidlist.push_back(it->second.branchID().id());
72  }
73  }
74  }
75  if(!bidlist.empty()) {
76  BranchListIndex blix = branchIDLists_.size();
78  //preg.setProducedBranchListIndex(blix);
79  branchIDLists_.push_back(bidlist);
80  for(BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
81  ProductIndex pix = i - bidlist.begin();
82  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
83  }
84  }
85  }
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:369

Member Data Documentation

BranchIDLists edm::BranchIDListHelper::branchIDLists_
private
BranchIDToIndexMap edm::BranchIDListHelper::branchIDToIndexMap_
private
std::vector<BranchListIndex> edm::BranchIDListHelper::inputIndexToJobIndex_
private

Definition at line 46 of file BranchIDListHelper.h.

Referenced by fixBranchListIndexes(), updateFromInput(), and updateFromParent().

BranchIDLists::size_type edm::BranchIDListHelper::nAlreadyCopied_
private

Definition at line 48 of file BranchIDListHelper.h.

Referenced by updateFromParent().

BranchListIndex edm::BranchIDListHelper::producedBranchListIndex_
private