CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/IOPool/Input/src/BranchMapperWithReader.cc

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------
00002 
00003 BranchMapperWithReader:
00004 
00005 ----------------------------------------------------------------------*/
00006 #include "BranchMapperWithReader.h"
00007 #include "DataFormats/Common/interface/RefCoreStreamer.h"
00008 #include "RootTree.h"
00009 
00010 namespace edm {
00011   BranchMapperWithReader::BranchMapperWithReader() :
00012          BranchMapper(true),
00013          rootTree_(0),
00014          infoVector_(),
00015          pInfoVector_(&infoVector_),
00016          oldProductIDToBranchIDMap_()
00017   { }
00018 
00019   BranchMapperWithReader::BranchMapperWithReader(RootTree* rootTree) :
00020          BranchMapper(true),
00021          rootTree_(rootTree),
00022          infoVector_(),
00023          pInfoVector_(&infoVector_),
00024          oldProductIDToBranchIDMap_()
00025   { }
00026 
00027   void
00028   BranchMapperWithReader::readProvenance_() const {
00029     setRefCoreStreamer(0, false, false);
00030     rootTree_->fillBranchEntryMeta(rootTree_->branchEntryInfoBranch(), pInfoVector_);
00031     setRefCoreStreamer(true);
00032     BranchMapperWithReader* me = const_cast<BranchMapperWithReader*>(this);
00033     for (ProductProvenanceVector::const_iterator it = infoVector_.begin(), itEnd = infoVector_.end();
00034       it != itEnd; ++it) {
00035       me->insert(*it);
00036     }
00037   }
00038 
00039   void
00040   BranchMapperWithReader::insertIntoMap(ProductID const& oldProductID, BranchID const& branchID) {
00041     oldProductIDToBranchIDMap_.insert(std::make_pair(oldProductID.oldID(), branchID));
00042   }
00043 
00044   BranchID
00045   BranchMapperWithReader::oldProductIDToBranchID_(ProductID const& oldProductID) const {
00046     std::map<unsigned int, BranchID>::const_iterator it = oldProductIDToBranchIDMap_.find(oldProductID.oldID());
00047     if(it == oldProductIDToBranchIDMap_.end()) {
00048       return BranchID();
00049     }
00050     return it->second;
00051   }
00052   
00053   void BranchMapperWithReader::reset_()
00054   {
00055     setDelayedRead(true);
00056     oldProductIDToBranchIDMap_.clear();
00057   }
00058 }