CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
edm::BranchIDListHelper Class Reference

#include <BranchIDListHelper.h>

Public Types

typedef std::multimap< BranchID, IndexPairBranchIDToIndexMap
 
typedef std::pair< BranchListIndex, ProductIndexIndexPair
 

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

◆ BranchIDToIndexMap

Definition at line 18 of file BranchIDListHelper.h.

◆ IndexPair

Definition at line 17 of file BranchIDListHelper.h.

Constructor & Destructor Documentation

◆ BranchIDListHelper()

edm::BranchIDListHelper::BranchIDListHelper ( )

Member Function Documentation

◆ branchIDLists()

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

Definition at line 36 of file BranchIDListHelper.h.

36 { return branchIDLists_; }

References branchIDLists_.

◆ branchIDToIndexMap()

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

Definition at line 37 of file BranchIDListHelper.h.

37 { return branchIDToIndexMap_; }

References branchIDToIndexMap_.

◆ fixBranchListIndexes()

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 84 of file BranchIDListHelper.cc.

84  {
85  for (BranchListIndex& i : indexes) {
86  assert(i < inputIndexToJobIndex_.size());
88  }
89  }

References cms::cuda::assert(), mps_fire::i, and inputIndexToJobIndex_.

◆ hasProducedProducts()

bool edm::BranchIDListHelper::hasProducedProducts ( ) const
inline

◆ mutableBranchIDLists()

BranchIDLists& edm::BranchIDListHelper::mutableBranchIDLists ( )
inline

Definition at line 33 of file BranchIDListHelper.h.

33 { return branchIDLists_; }

References branchIDLists_.

◆ producedBranchListIndex()

BranchListIndex edm::BranchIDListHelper::producedBranchListIndex ( ) const
inline

Definition at line 38 of file BranchIDListHelper.h.

38 { return producedBranchListIndex_; }

References producedBranchListIndex_.

◆ updateFromInput()

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

Definition at line 17 of file BranchIDListHelper.cc.

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

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

◆ updateFromParent()

void edm::BranchIDListHelper::updateFromParent ( BranchIDLists const &  bidlists)

Definition at line 44 of file BranchIDListHelper.cc.

44  {
45  inputIndexToJobIndex_.resize(bidlists.size());
46  for (auto it = bidlists.begin() + nAlreadyCopied_, itEnd = bidlists.end(); it != itEnd; ++it) {
47  BranchListIndex oldBlix = it - bidlists.begin();
48  BranchListIndex blix = branchIDLists_.size();
49  branchIDLists_.push_back(*it);
50  for (BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
51  ProductIndex pix = i - it->begin();
52  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
53  }
54  inputIndexToJobIndex_[oldBlix] = blix;
55  }
56  nAlreadyCopied_ = bidlists.size();
57  }

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

◆ updateFromRegistry()

void edm::BranchIDListHelper::updateFromRegistry ( ProductRegistry const &  reg)

Definition at line 59 of file BranchIDListHelper.cc.

59  {
60  BranchIDList bidlist;
61  // Add entries for current process for ProductID to BranchID mapping.
62  for (ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
63  it != itEnd;
64  ++it) {
65  //In the case of the alias, we always use the original branches BranchID
66  if (it->second.produced() and not it->second.isAlias()) {
67  if (it->second.branchType() == InEvent) {
68  bidlist.push_back(it->second.branchID().id());
69  }
70  }
71  }
72  if (!bidlist.empty()) {
73  BranchListIndex blix = branchIDLists_.size();
75  //preg.setProducedBranchListIndex(blix);
76  branchIDLists_.push_back(bidlist);
77  for (BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
78  ProductIndex pix = i - bidlist.begin();
79  branchIDToIndexMap_.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
80  }
81  }
82  }

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

Member Data Documentation

◆ branchIDLists_

BranchIDLists edm::BranchIDListHelper::branchIDLists_
private

◆ branchIDToIndexMap_

BranchIDToIndexMap edm::BranchIDListHelper::branchIDToIndexMap_
private

◆ inputIndexToJobIndex_

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

Definition at line 44 of file BranchIDListHelper.h.

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

◆ nAlreadyCopied_

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

Definition at line 46 of file BranchIDListHelper.h.

Referenced by updateFromParent().

◆ producedBranchListIndex_

BranchListIndex edm::BranchIDListHelper::producedBranchListIndex_
private
mps_fire.i
i
Definition: mps_fire.py:428
edm::find_in_all
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:26
edm::BranchIDListHelper::branchIDLists_
BranchIDLists branchIDLists_
Definition: BranchIDListHelper.h:42
cms::cuda::assert
assert(be >=bs)
edm::BranchIDListHelper::branchIDToIndexMap_
BranchIDToIndexMap branchIDToIndexMap_
Definition: BranchIDListHelper.h:43
edm::ProductIndex
unsigned short ProductIndex
Definition: ProductID.h:26
edm::BranchIDListHelper::nAlreadyCopied_
BranchIDLists::size_type nAlreadyCopied_
Definition: BranchIDListHelper.h:46
edm::BranchIDList
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
edm::BranchListIndex
unsigned short BranchListIndex
Definition: BranchListIndex.h:17
edm::InEvent
Definition: BranchType.h:11
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::BranchIDListHelper::inputIndexToJobIndex_
std::vector< BranchListIndex > inputIndexToJobIndex_
Definition: BranchIDListHelper.h:44
edm::BranchIDListHelper::producedBranchListIndex_
BranchListIndex producedBranchListIndex_
Definition: BranchIDListHelper.h:45
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66