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 | Static Public Member Functions | Private Attributes
edm::BranchIDListHelper Class Reference

#include <BranchIDListHelper.h>

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.

9  :
BranchListIndexMapper branchListIndexMapper_
BranchIDToIndexMap branchIDToIndexMap_

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().

24 {return branchIDToIndexMap_;}
BranchIDToIndexMap branchIDToIndexMap_
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 edm::detail::ThreadSafeIndexedRegistry< T, E >::instance().

Referenced by edm::EventProcessor::init(), and edm::EventProcessor::~EventProcessor().

77  {
79  breg.data().clear();
80  breg.extra().branchIDToIndexMap_.clear();
81  breg.extra().branchListIndexMapper_.clear();
82  }
edm::detail::ThreadSafeIndexedRegistry< BranchIDList, BranchIDListHelper > BranchIDListRegistry
static ThreadSafeIndexedRegistry * instance()
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 edm::detail::ThreadSafeIndexedRegistry< T, E >::instance().

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

68  {
70  BranchListIndexMapper& branchListIndexMapper = breg.extra().branchListIndexMapper_;
71  for(BranchListIndexes::iterator i = indexes.begin(), e = indexes.end(); i != e; ++i) {
72  *i = branchListIndexMapper[*i];
73  }
74  }
int i
Definition: DBlmapReader.cc:9
edm::detail::ThreadSafeIndexedRegistry< BranchIDList, BranchIDListHelper > BranchIDListRegistry
static ThreadSafeIndexedRegistry * instance()
std::map< BranchListIndex, BranchListIndex > BranchListIndexMapper
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(), edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), and j.

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

14  {
15  bool unchanged = true;
17  BranchIDListRegistry::collection_type& bdata = breg.data();
18  BranchIDToIndexMap& branchIDToIndexMap = breg.extra().branchIDToIndexMap_;
19  BranchListIndexMapper& branchListIndexMapper = breg.extra().branchListIndexMapper_;
20  branchListIndexMapper.clear();
21  typedef BranchIDLists::const_iterator Iter;
23  for(Iter it = bidlists.begin(), itEnd = bidlists.end(); it != itEnd; ++it) {
24  BranchListIndex oldBlix = it - bidlists.begin();
25  RegIter j = find_in_all(bdata, *it);
26  BranchListIndex blix = j - bdata.begin();
27  if(j == bdata.end()) {
28  breg.insertMapped(*it);
29  for(BranchIDList::const_iterator i = it->begin(), iEnd = it->end(); i != iEnd; ++i) {
30  ProductIndex pix = i - it->begin();
31  branchIDToIndexMap.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
32  }
33  }
34  branchListIndexMapper.insert(std::make_pair(oldBlix, blix));
35  if(oldBlix != blix) {
36  unchanged = false;
37  }
38  }
39  return unchanged;
40  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
BranchIDToIndexMap const & branchIDToIndexMap() const
edm::detail::ThreadSafeIndexedRegistry< BranchIDList, BranchIDListHelper > BranchIDListRegistry
collection_type::const_iterator const_iterator
static ThreadSafeIndexedRegistry * instance()
int j
Definition: DBlmapReader.cc:9
std::multimap< BranchID, IndexPair > BranchIDToIndexMap
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
std::map< BranchListIndex, BranchListIndex > BranchListIndexMapper
unsigned short ProductIndex
Definition: ProductID.h:26
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(), edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), edm::ProductRegistry::productList(), and edm::ProductRegistry::setProducedBranchListIndex().

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

43  {
44  BranchIDList bidlist;
45  // Add entries for current process for ProductID to BranchID mapping.
46  for(ProductRegistry::ProductList::const_iterator it = preg.productList().begin(), itEnd = preg.productList().end();
47  it != itEnd; ++it) {
48  if(it->second.produced()) {
49  if(it->second.branchType() == InEvent) {
50  bidlist.push_back(it->second.branchID().id());
51  }
52  }
53  }
55  BranchIDToIndexMap& branchIDToIndexMap = breg.extra().branchIDToIndexMap_;
56  if(!bidlist.empty()) {
57  BranchListIndex blix = breg.data().size();
58  preg.setProducedBranchListIndex(blix);
59  breg.insertMapped(bidlist);
60  for(BranchIDList::const_iterator i = bidlist.begin(), iEnd = bidlist.end(); i != iEnd; ++i) {
61  ProductIndex pix = i - bidlist.begin();
62  branchIDToIndexMap.insert(std::make_pair(BranchID(*i), std::make_pair(blix, pix)));
63  }
64  }
65  }
int i
Definition: DBlmapReader.cc:9
unsigned short BranchListIndex
BranchIDToIndexMap const & branchIDToIndexMap() const
edm::detail::ThreadSafeIndexedRegistry< BranchIDList, BranchIDListHelper > BranchIDListRegistry
static ThreadSafeIndexedRegistry * instance()
std::multimap< BranchID, IndexPair > BranchIDToIndexMap
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
unsigned short ProductIndex
Definition: ProductID.h:26

Member Data Documentation

BranchIDToIndexMap edm::BranchIDListHelper::branchIDToIndexMap_
private

Definition at line 27 of file BranchIDListHelper.h.

Referenced by branchIDToIndexMap().

BranchListIndexMapper edm::BranchIDListHelper::branchListIndexMapper_
private

Definition at line 28 of file BranchIDListHelper.h.