00001 #ifndef IOPool_Input_RootDelayedReader_h 00002 #define IOPool_Input_RootDelayedReader_h 00003 00004 /*---------------------------------------------------------------------- 00005 00006 RootDelayedReader.h // used by ROOT input sources 00007 00008 ----------------------------------------------------------------------*/ 00009 00010 #include "DataFormats/Provenance/interface/BranchKey.h" 00011 #include "DataFormats/Provenance/interface/FileFormatVersion.h" 00012 #include "FWCore/Framework/interface/DelayedReader.h" 00013 #include "RootTree.h" 00014 00015 #include "boost/shared_ptr.hpp" 00016 #include "boost/utility.hpp" 00017 00018 #include <map> 00019 #include <memory> 00020 #include <string> 00021 00022 namespace edm { 00023 class InputFile; 00024 class RootTree; 00025 00026 //------------------------------------------------------------ 00027 // Class RootDelayedReader: pretends to support file reading. 00028 // 00029 00030 class RootDelayedReader : public DelayedReader, private boost::noncopyable { 00031 public: 00032 typedef roottree::BranchInfo BranchInfo; 00033 typedef roottree::BranchMap BranchMap; 00034 typedef roottree::BranchMap::const_iterator iterator; 00035 typedef roottree::EntryNumber EntryNumber; 00036 RootDelayedReader( 00037 RootTree const& tree, 00038 FileFormatVersion const& fileFormatVersion, 00039 boost::shared_ptr<InputFile> filePtr); 00040 00041 virtual ~RootDelayedReader(); 00042 00043 private: 00044 virtual WrapperOwningHolder getProduct_(BranchKey const& k, WrapperInterfaceBase const* interface, EDProductGetter const* ep) const; 00045 virtual void mergeReaders_(DelayedReader* other) {nextReader_ = other;} 00046 virtual void reset_() {nextReader_ = 0;} 00047 BranchMap const& branches() const {return tree_.branches();} 00048 EntryNumber const& entryNumber() const {return tree_.entryNumber();} 00049 iterator branchIter(BranchKey const& k) const {return branches().find(k);} 00050 bool found(iterator const& iter) const {return iter != branches().end();} 00051 BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; } 00052 // NOTE: filePtr_ appears to be unused, but is needed to prevent 00053 // the file containing the branch from being reclaimed. 00054 RootTree const& tree_; 00055 boost::shared_ptr<InputFile> filePtr_; 00056 DelayedReader* nextReader_; 00057 FileFormatVersion const& fileFormatVersion_; 00058 }; // class RootDelayedReader 00059 //------------------------------------------------------------ 00060 } 00061 #endif