CMS 3D CMS Logo

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 
14 #include "RootTree.h"
15 
16 #include <map>
17 #include <memory>
18 #include <string>
19 #include <exception>
20 
21 class TClass;
22 namespace edm {
23  class InputFile;
24  class RootTree;
26  class Exception;
27 
28  //------------------------------------------------------------
29  // Class RootDelayedReader: pretends to support file reading.
30  //
31 
33  public:
37  RootDelayedReader(RootTree const& tree, std::shared_ptr<InputFile> filePtr, InputType inputType);
38 
39  ~RootDelayedReader() override;
40 
41  RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
42  RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
43 
45  const final {
47  }
49  const final {
51  }
52 
53  void setSignals(
54  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* preEventReadSource,
55  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* postEventReadSource) {
56  preEventReadFromSourceSignal_ = preEventReadSource;
57  postEventReadFromSourceSignal_ = postEventReadSource;
58  }
59 
60  private:
61  std::unique_ptr<WrapperBase> getProduct_(BranchID const& k, EDProductGetter const* ep) override;
63  void reset_() override { nextReader_ = nullptr; }
64  std::pair<SharedResourcesAcquirer*, std::recursive_mutex*> sharedResources_() const override;
65 
66  BranchMap const& branches() const { return tree_.branches(); }
67  BranchInfo const* getBranchInfo(BranchID const& k) const { return branches().find(k); }
68  // NOTE: filePtr_ appears to be unused, but is needed to prevent
69  // the file containing the branch from being reclaimed.
70  RootTree const& tree_;
73  std::unique_ptr<SharedResourcesAcquirer>
74  resourceAcquirer_; // We do not use propagate_const because the acquirer is itself mutable.
75  std::shared_ptr<std::recursive_mutex> mutex_;
78 
80  nullptr;
82  nullptr;
83 
84  //If a fatal exception happens we need to make a copy so we can
85  // rethrow that exception on other threads. This avoids TTree
86  // non-exception safety problems on later calls to TTree.
87  mutable std::exception_ptr lastException_;
88  }; // class RootDelayedReader
89  //------------------------------------------------------------
90 } // namespace edm
91 #endif
void mergeReaders_(DelayedReader *other) override
InputType
Definition: InputType.h:5
BranchInfo const * getBranchInfo(BranchID const &k) const
RootTree const & tree_
roottree::BranchMap BranchMap
std::shared_ptr< std::recursive_mutex > mutex_
std::pair< SharedResourcesAcquirer *, std::recursive_mutex * > sharedResources_() const override
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const final
BranchInfo const * find(BranchID const &iKey) const
Definition: RootTree.h:74
std::exception_ptr lastException_
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal_
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
RootDelayedReader(RootTree const &tree, std::shared_ptr< InputFile > filePtr, InputType inputType)
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const final
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:50
RootDelayedReader & operator=(RootDelayedReader const &)=delete
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal_
int k[5][pyjets_maxn]
roottree::BranchInfo BranchInfo
std::unique_ptr< WrapperBase > getProduct_(BranchID const &k, EDProductGetter const *ep) override
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_
edm::propagate_const< std::shared_ptr< InputFile > > filePtr_
edm::propagate_const< TClass * > wrapperBaseTClass_
HLT enums.
roottree::EntryNumber EntryNumber
BranchMap const & branches() const
Definition: RootTree.cc:176
Definition: tree.py:1
edm::propagate_const< DelayedReader * > nextReader_
BranchMap const & branches() const