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 RootFile; 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(EntryNumber const& entry, 00037 boost::shared_ptr<BranchMap const> bMap, 00038 RootTree const& tree, 00039 FileFormatVersion const& fileFormatVersion, 00040 boost::shared_ptr<RootFile> filePtr); 00041 00042 virtual ~RootDelayedReader(); 00043 00044 private: 00045 virtual std::auto_ptr<EDProduct> getProduct_(BranchKey const& k, EDProductGetter const* ep) const; 00046 virtual void mergeReaders_(boost::shared_ptr<DelayedReader> other) {nextReader_ = other;} 00047 BranchMap const& branches() const {return *branches_;} 00048 iterator branchIter(BranchKey const& k) const {return branches().find(k);} 00049 bool found(iterator const& iter) const {return iter != branches().end();} 00050 BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; } 00051 EntryNumber const entryNumber_; 00052 boost::shared_ptr<BranchMap const> branches_; 00053 // NOTE: filePtr_ appears to be unused, but is needed to prevent 00054 // the file containing the branch from being reclaimed. 00055 RootTree const& tree_; 00056 boost::shared_ptr<RootFile> filePtr_; 00057 boost::shared_ptr<DelayedReader> nextReader_; 00058 FileFormatVersion fileFormatVersion_; 00059 }; // class RootDelayedReader 00060 //------------------------------------------------------------ 00061 } 00062 #endif