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:
38  RootTree const& tree,
39  std::shared_ptr<InputFile> filePtr,
40  InputType inputType);
41 
42  ~RootDelayedReader() override;
43 
44  RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
45  RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
46 
49  }
52  }
53 
54  void setSignals(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> resourceAcquirer_; // We do not use propagate_const because the acquirer is itself mutable.
74  std::shared_ptr<std::recursive_mutex> mutex_;
77 
80 
81  //If a fatal exception happens we need to make a copy so we can
82  // rethrow that exception on other threads. This avoids TTree
83  // non-exception safety problems on later calls to TTree.
84  mutable std::exception_ptr lastException_;
85  }; // class RootDelayedReader
86  //------------------------------------------------------------
87 }
88 #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:77
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:178
Definition: tree.py:1
edm::propagate_const< DelayedReader * > nextReader_
BranchMap const & branches() const