test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RootDelayedReader.h
Go to the documentation of this file.
1 #ifndef IOPool_Input_RootDelayedReader_h
2 #define IOPool_Input_RootDelayedReader_h
3 
4 /*----------------------------------------------------------------------
5 
6 RootDelayedReader.h // used by ROOT input sources
7 
8 ----------------------------------------------------------------------*/
9 
13 #include "RootTree.h"
14 
15 #include <map>
16 #include <memory>
17 #include <string>
18 
19 class TClass;
20 namespace edm {
21  class InputFile;
22  class RootTree;
24  class Exception;
25 
26  //------------------------------------------------------------
27  // Class RootDelayedReader: pretends to support file reading.
28  //
29 
31  public:
34  typedef roottree::BranchMap::const_iterator iterator;
37  RootTree const& tree,
38  std::shared_ptr<InputFile> filePtr,
39  InputType inputType);
40 
41  virtual ~RootDelayedReader();
42 
43  RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
44  RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
45 
46  private:
47  virtual std::unique_ptr<WrapperBase> getProduct_(BranchKey const& k, EDProductGetter const* ep) const override;
48  virtual void mergeReaders_(DelayedReader* other) override {nextReader_ = other;}
49  virtual void reset_() override {nextReader_ = nullptr;}
50  SharedResourcesAcquirer* sharedResources_() const override;
51 
52  BranchMap const& branches() const {return tree_.branches();}
53  iterator branchIter(BranchKey const& k) const {return branches().find(k);}
54  bool found(iterator const& iter) const {return iter != branches().end();}
55  BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; }
56  // NOTE: filePtr_ appears to be unused, but is needed to prevent
57  // the file containing the branch from being reclaimed.
58  RootTree const& tree_;
59  std::shared_ptr<InputFile> filePtr_;
61  std::unique_ptr<SharedResourcesAcquirer> resourceAcquirer_;
64  //If a fatal exception happens we need to make a copy so we can
65  // rethrow that exception on other threads. This avoids TTree
66  // non-exception safety problems on later calls to TTree.
67  mutable std::unique_ptr<Exception> lastException_;
68  }; // class RootDelayedReader
69  //------------------------------------------------------------
70 }
71 #endif
InputType
Definition: InputType.h:5
virtual void reset_() override
virtual void mergeReaders_(DelayedReader *other) override
RootTree const & tree_
roottree::BranchMap BranchMap
BranchInfo const & getBranchInfo(iterator const &iter) const
virtual std::unique_ptr< WrapperBase > getProduct_(BranchKey const &k, EDProductGetter const *ep) const override
DelayedReader * nextReader_
std::map< BranchKey const, BranchInfo > BranchMap
Definition: RootTree.h:55
RootDelayedReader(RootTree const &tree, std::shared_ptr< InputFile > filePtr, InputType inputType)
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:41
roottree::BranchMap::const_iterator iterator
std::unique_ptr< Exception > lastException_
RootDelayedReader & operator=(RootDelayedReader const &)=delete
bool found(iterator const &iter) const
roottree::BranchInfo BranchInfo
SharedResourcesAcquirer * sharedResources_() const override
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_
std::shared_ptr< InputFile > filePtr_
roottree::EntryNumber EntryNumber
BranchMap const & branches() const
Definition: RootTree.cc:172
iterator branchIter(BranchKey const &k) const
BranchMap const & branches() const