00001 #include "DataFormats/Provenance/interface/BranchMapper.h" 00002 #include "FWCore/Utilities/interface/EDMException.h" 00003 00004 /* 00005 BranchMapper 00006 00007 */ 00008 00009 namespace edm { 00010 BranchMapper::BranchMapper() : 00011 entryInfoSet_(), 00012 nextMapper_(), 00013 delayedRead_(false), 00014 processHistoryID_() 00015 { } 00016 00017 BranchMapper::BranchMapper(bool delayedRead) : 00018 entryInfoSet_(), 00019 nextMapper_(), 00020 delayedRead_(delayedRead), 00021 processHistoryID_() 00022 { } 00023 00024 BranchMapper::~BranchMapper() {} 00025 00026 void 00027 BranchMapper::readProvenance() const { 00028 if (delayedRead_) { 00029 delayedRead_ = false; 00030 readProvenance_(); 00031 } 00032 } 00033 00034 void 00035 BranchMapper::insert(ProductProvenance const& entryInfo) { 00036 //NOTE:do not read provenance here because we only need the full 00037 // provenance when someone tries to access it not when doing the insert 00038 // doing the delay saves 20% of time when doing an analysis job 00039 //readProvenance(); 00040 entryInfoSet_.insert(entryInfo); 00041 } 00042 00043 boost::shared_ptr<ProductProvenance> 00044 BranchMapper::branchIDToProvenance(BranchID const& bid) const { 00045 readProvenance(); 00046 ProductProvenance ei(bid); 00047 eiSet::const_iterator it = entryInfoSet_.find(ei); 00048 if (it == entryInfoSet_.end()) { 00049 if (nextMapper_) { 00050 return nextMapper_->branchIDToProvenance(bid); 00051 } else { 00052 return boost::shared_ptr<ProductProvenance>(); 00053 } 00054 } 00055 return boost::shared_ptr<ProductProvenance>(new ProductProvenance(*it)); 00056 } 00057 00058 BranchID 00059 BranchMapper::oldProductIDToBranchID_(ProductID const& ) const { 00060 throw edm::Exception(errors::LogicError) 00061 << "Internal error: Illegal call of oldProductIDToBranchID_.\n" 00062 << "Please report this error to the Framework group\n"; 00063 } 00064 }