#include <DataFormats/Provenance/interface/BranchMapper.h>
Public Member Functions | |
BranchMapper (bool delayedRead) | |
BranchMapper () | |
boost::shared_ptr< EventEntryInfo > | branchToEntryInfo (BranchID const &bid) const |
void | insert (EventEntryInfo const &entryInfo) |
ProductID | maxProductID () const |
void | mergeMappers (boost::shared_ptr< BranchMapper > other) |
BranchID | productToBranch (ProductID const &pid) const |
void | setDelayedRead (bool value) |
void | write (std::ostream &os) const |
virtual | ~BranchMapper () |
Private Types | |
typedef std::map< ProductID, eiSet::const_iterator > | eiMap |
typedef std::set< EventEntryInfo > | eiSet |
Private Member Functions | |
void | readProvenance () const |
virtual void | readProvenance_ () const |
Static Private Member Functions | |
static bool | fpred (eiSet::value_type const &a, eiSet::value_type const &b) |
Private Attributes | |
bool | delayedRead_ |
eiMap | entryInfoMap_ |
eiSet | entryInfoSet_ |
boost::shared_ptr< BranchMapper > | nextMapper_ |
Definition at line 25 of file BranchMapper.h.
typedef std::map<ProductID, eiSet::const_iterator> edm::BranchMapper::eiMap [private] |
Definition at line 49 of file BranchMapper.h.
typedef std::set<EventEntryInfo> edm::BranchMapper::eiSet [private] |
Definition at line 48 of file BranchMapper.h.
edm::BranchMapper::BranchMapper | ( | ) |
Definition at line 9 of file BranchMapper.cc.
00009 : 00010 entryInfoSet_(), 00011 entryInfoMap_(), 00012 nextMapper_(), 00013 delayedRead_(false) 00014 { }
edm::BranchMapper::BranchMapper | ( | bool | delayedRead | ) | [explicit] |
Definition at line 16 of file BranchMapper.cc.
00016 : 00017 entryInfoSet_(), 00018 entryInfoMap_(), 00019 nextMapper_(), 00020 delayedRead_(delayedRead) 00021 { }
virtual edm::BranchMapper::~BranchMapper | ( | ) | [inline, virtual] |
boost::shared_ptr< EventEntryInfo > edm::BranchMapper::branchToEntryInfo | ( | BranchID const & | bid | ) | const |
Definition at line 41 of file BranchMapper.cc.
References entryInfoSet_, it, nextMapper_, and readProvenance().
Referenced by edm::RootOutputFile::insertAncestors(), and edm::markAncestors().
00041 { 00042 readProvenance(); 00043 EventEntryInfo ei(bid); 00044 eiSet::const_iterator it = entryInfoSet_.find(ei); 00045 if (it == entryInfoSet_.end()) { 00046 if (nextMapper_) { 00047 return nextMapper_->branchToEntryInfo(bid); 00048 } else { 00049 return boost::shared_ptr<EventEntryInfo>(); 00050 } 00051 } 00052 return boost::shared_ptr<EventEntryInfo>(new EventEntryInfo(*it)); 00053 }
bool edm::BranchMapper::fpred | ( | eiSet::value_type const & | a, | |
eiSet::value_type const & | b | |||
) | [static, private] |
void edm::BranchMapper::insert | ( | EventEntryInfo const & | entryInfo | ) |
Definition at line 32 of file BranchMapper.cc.
References entryInfoMap_, entryInfoSet_, edm::EventEntryInfo::productID(), and readProvenance().
Referenced by edm::BranchMapperWithReader< T >::readProvenance_().
00032 { 00033 readProvenance(); 00034 entryInfoSet_.insert(entryInfo); 00035 if (!entryInfoMap_.empty()) { 00036 entryInfoMap_.insert(std::make_pair(entryInfo.productID(), entryInfoSet_.find(entryInfo))); 00037 } 00038 }
ProductID edm::BranchMapper::maxProductID | ( | ) | const |
Definition at line 99 of file BranchMapper.cc.
References entryInfoSet_, fpred(), it, and readProvenance().
00099 { 00100 readProvenance(); 00101 if (entryInfoSet_.empty()) { 00102 return ProductID(0); 00103 } else { 00104 eiSet::const_iterator it = std::max_element(entryInfoSet_.begin(), entryInfoSet_.end(), fpred); 00105 return it->productID(); 00106 } 00107 }
void edm::BranchMapper::mergeMappers | ( | boost::shared_ptr< BranchMapper > | other | ) | [inline] |
Definition at line 73 of file BranchMapper.cc.
References entryInfoMap_, entryInfoSet_, i, it, python::multivaluedict::map(), nextMapper_, and readProvenance().
Referenced by fwlite::BranchMapReader::productToBranch().
00073 { 00074 readProvenance(); 00075 if (entryInfoMap_.empty()) { 00076 eiMap & map = const_cast<eiMap &>(entryInfoMap_); 00077 for (eiSet::const_iterator i = entryInfoSet_.begin(), iEnd = entryInfoSet_.end(); 00078 i != iEnd; ++i) { 00079 map.insert(std::make_pair(i->productID(), i)); 00080 } 00081 } 00082 eiMap::const_iterator it = entryInfoMap_.find(pid); 00083 if (it == entryInfoMap_.end()) { 00084 if (nextMapper_) { 00085 return nextMapper_->productToBranch(pid); 00086 } else { 00087 return BranchID(); 00088 } 00089 } 00090 return it->second->branchID(); 00091 }
void edm::BranchMapper::readProvenance | ( | ) | const [private] |
Definition at line 24 of file BranchMapper.cc.
References delayedRead_, and readProvenance_().
Referenced by branchToEntryInfo(), insert(), maxProductID(), and productToBranch().
00024 { 00025 if (delayedRead_) { 00026 delayedRead_ = false; 00027 readProvenance_(); 00028 } 00029 }
virtual void edm::BranchMapper::readProvenance_ | ( | ) | const [inline, private, virtual] |
Reimplemented in edm::BranchMapperWithReader< T >.
Definition at line 53 of file BranchMapper.h.
Referenced by readProvenance().
Definition at line 45 of file BranchMapper.h.
References delayedRead_.
00045 { delayedRead_ = value; }
void edm::BranchMapper::write | ( | std::ostream & | os | ) | const |
Referenced by edm::operator<<().
bool edm::BranchMapper::delayedRead_ [mutable, private] |
eiMap edm::BranchMapper::entryInfoMap_ [private] |
eiSet edm::BranchMapper::entryInfoSet_ [private] |
Definition at line 55 of file BranchMapper.h.
Referenced by branchToEntryInfo(), insert(), maxProductID(), and productToBranch().
boost::shared_ptr<BranchMapper> edm::BranchMapper::nextMapper_ [private] |
Definition at line 59 of file BranchMapper.h.
Referenced by branchToEntryInfo(), mergeMappers(), and productToBranch().