CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::RootDelayedReader Class Reference

#include <RootDelayedReader.h>

Inheritance diagram for edm::RootDelayedReader:
edm::DelayedReader

Public Types

typedef roottree::BranchInfo BranchInfo
 
typedef roottree::BranchMap BranchMap
 
typedef roottree::EntryNumber EntryNumber
 
typedef
roottree::BranchMap::const_iterator 
iterator
 

Public Member Functions

RootDelayedReaderoperator= (RootDelayedReader const &)=delete
 
 RootDelayedReader (RootTree const &tree, std::shared_ptr< InputFile > filePtr, InputType inputType)
 
 RootDelayedReader (RootDelayedReader const &)=delete
 
virtual ~RootDelayedReader ()
 
- Public Member Functions inherited from edm::DelayedReader
virtual std::unique_ptr
< WrapperBase
getProduct (BranchKey const &k, EDProductGetter const *ep)
 
void mergeReaders (DelayedReader *other)
 
void reset ()
 
SharedResourcesAcquirersharedResources () const
 
virtual ~DelayedReader ()
 

Private Member Functions

BranchMap const & branches () const
 
iterator branchIter (BranchKey const &k) const
 
bool found (iterator const &iter) const
 
BranchInfo const & getBranchInfo (iterator const &iter) const
 
virtual std::unique_ptr
< WrapperBase
getProduct_ (BranchKey const &k, EDProductGetter const *ep) const override
 
virtual void mergeReaders_ (DelayedReader *other) override
 
virtual void reset_ () override
 
SharedResourcesAcquirersharedResources_ () const override
 

Private Attributes

std::shared_ptr< InputFilefilePtr_
 
InputType inputType_
 
DelayedReadernextReader_
 
std::unique_ptr
< SharedResourcesAcquirer
resourceAcquirer_
 
RootTree const & tree_
 
TClass * wrapperBaseTClass_
 

Detailed Description

Definition at line 29 of file RootDelayedReader.h.

Member Typedef Documentation

Definition at line 31 of file RootDelayedReader.h.

Definition at line 32 of file RootDelayedReader.h.

Definition at line 34 of file RootDelayedReader.h.

typedef roottree::BranchMap::const_iterator edm::RootDelayedReader::iterator

Definition at line 33 of file RootDelayedReader.h.

Constructor & Destructor Documentation

edm::RootDelayedReader::RootDelayedReader ( RootTree const &  tree,
std::shared_ptr< InputFile filePtr,
InputType  inputType 
)

Definition at line 21 of file RootDelayedReader.cc.

References edm::Primary.

24  :
25  tree_(tree),
26  filePtr_(filePtr),
27  nextReader_(),
28  resourceAcquirer_(inputType == InputType::Primary ? new SharedResourcesAcquirer(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader()) : static_cast<SharedResourcesAcquirer*>(nullptr)),
29  inputType_(inputType),
30  wrapperBaseTClass_(TClass::GetClass("edm::WrapperBase")) {
31  }
RootTree const & tree_
DelayedReader * nextReader_
static SharedResourcesRegistry * instance()
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_
std::shared_ptr< InputFile > filePtr_
edm::RootDelayedReader::~RootDelayedReader ( )
virtual

Definition at line 33 of file RootDelayedReader.cc.

33  {
34  }
edm::RootDelayedReader::RootDelayedReader ( RootDelayedReader const &  )
delete

Member Function Documentation

BranchMap const& edm::RootDelayedReader::branches ( ) const
inlineprivate

Definition at line 51 of file RootDelayedReader.h.

References edm::RootTree::branches(), and tree_.

Referenced by branchIter(), and found().

51 {return tree_.branches();}
RootTree const & tree_
BranchMap const & branches() const
Definition: RootTree.cc:172
iterator edm::RootDelayedReader::branchIter ( BranchKey const &  k) const
inlineprivate

Definition at line 52 of file RootDelayedReader.h.

References branches().

Referenced by getProduct_().

52 {return branches().find(k);}
BranchMap const & branches() const
bool edm::RootDelayedReader::found ( iterator const &  iter) const
inlineprivate
BranchInfo const& edm::RootDelayedReader::getBranchInfo ( iterator const &  iter) const
inlineprivate

Definition at line 54 of file RootDelayedReader.h.

Referenced by getProduct_().

54 {return iter->second; }
std::unique_ptr< WrapperBase > edm::RootDelayedReader::getProduct_ ( BranchKey const &  k,
EDProductGetter const *  ep 
) const
overrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 42 of file RootDelayedReader.cc.

References beamvalidation::br, edm::roottree::BranchInfo::branchDescription_, branchIter(), edm::RootTree::branchType(), edm::roottree::BranchInfo::classCache_, CommonMethods::cp(), edm::RootTree::entryNumberForIndex(), found(), getBranchInfo(), edm::RootTree::getEntry(), edm::DelayedReader::getProduct(), edm::getWrapperBasePtr(), edm::InEvent, inputType_, getDQMSummary::iter, nextReader_, edm::roottree::BranchInfo::offsetToWrapperBase_, AlCaHLTBitMon_ParallelJobs::p, edm::roottree::BranchInfo::productBranch_, edm::InputFile::reportReadBranch(), edm::setRefCoreStreamer(), AlCaHLTBitMon_QueryRunRegistry::string, edm::EDProductGetter::transitionIndex(), tree_, edm::BranchDescription::wrappedName(), and wrapperBaseTClass_.

42  {
44  if (!found(iter)) {
45  if (nextReader_) {
46  return nextReader_->getProduct(k, ep);
47  } else {
48  return std::unique_ptr<WrapperBase>();
49  }
50  }
51  roottree::BranchInfo const& branchInfo = getBranchInfo(iter);
52  TBranch* br = branchInfo.productBranch_;
53  if (br == nullptr) {
54  if (nextReader_) {
55  return nextReader_->getProduct(k, ep);
56  } else {
57  return std::unique_ptr<WrapperBase>();
58  }
59  }
60 
62  TClass* cp = branchInfo.classCache_;
63  if(nullptr == cp) {
64  branchInfo.classCache_ = TClass::GetClass(branchInfo.branchDescription_.wrappedName().c_str());
65  cp = branchInfo.classCache_;
66  branchInfo.offsetToWrapperBase_ = cp->GetBaseClassOffset(wrapperBaseTClass_);
67  }
68  void* p = cp->New();
69  std::unique_ptr<WrapperBase> edp = getWrapperBasePtr(p, branchInfo.offsetToWrapperBase_);
70  br->SetAddress(&p);
71  tree_.getEntry(br, tree_.entryNumberForIndex(ep->transitionIndex()));
72  if(tree_.branchType() == InEvent) {
73  // CMS-THREADING For the primary input source calls to this function need to be serialized
75  }
76  setRefCoreStreamer(false);
77  return edp;
78  }
RootTree const & tree_
void setRefCoreStreamer(bool resetAll=false)
BranchInfo const & getBranchInfo(iterator const &iter) const
static void reportReadBranch(InputType inputType, std::string const &branchname)
Definition: InputFile.cc:119
DelayedReader * nextReader_
virtual std::unique_ptr< WrapperBase > getProduct(BranchKey const &k, EDProductGetter const *ep)
BranchType branchType() const
Definition: RootTree.h:154
roottree::BranchMap::const_iterator iterator
EntryNumber const & entryNumberForIndex(unsigned int index) const
Definition: RootTree.cc:92
bool found(iterator const &iter) const
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:355
iterator branchIter(BranchKey const &k) const
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
virtual void edm::RootDelayedReader::mergeReaders_ ( DelayedReader other)
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 47 of file RootDelayedReader.h.

References nextReader_.

47 {nextReader_ = other;}
DelayedReader * nextReader_
RootDelayedReader& edm::RootDelayedReader::operator= ( RootDelayedReader const &  )
delete
virtual void edm::RootDelayedReader::reset_ ( )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 48 of file RootDelayedReader.h.

References nextReader_.

48 {nextReader_ = nullptr;}
DelayedReader * nextReader_
SharedResourcesAcquirer * edm::RootDelayedReader::sharedResources_ ( ) const
overrideprivatevirtual

Reimplemented from edm::DelayedReader.

Definition at line 37 of file RootDelayedReader.cc.

References resourceAcquirer_.

37  {
38  return resourceAcquirer_.get();
39  }
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_

Member Data Documentation

std::shared_ptr<InputFile> edm::RootDelayedReader::filePtr_
private

Definition at line 58 of file RootDelayedReader.h.

InputType edm::RootDelayedReader::inputType_
private

Definition at line 61 of file RootDelayedReader.h.

Referenced by getProduct_().

DelayedReader* edm::RootDelayedReader::nextReader_
private

Definition at line 59 of file RootDelayedReader.h.

Referenced by getProduct_(), mergeReaders_(), and reset_().

std::unique_ptr<SharedResourcesAcquirer> edm::RootDelayedReader::resourceAcquirer_
private

Definition at line 60 of file RootDelayedReader.h.

Referenced by sharedResources_().

RootTree const& edm::RootDelayedReader::tree_
private

Definition at line 57 of file RootDelayedReader.h.

Referenced by branches(), and getProduct_().

TClass* edm::RootDelayedReader::wrapperBaseTClass_
private

Definition at line 62 of file RootDelayedReader.h.

Referenced by getProduct_().