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 22 of file RootDelayedReader.cc.

References edm::Primary.

25  :
26  tree_(tree),
27  filePtr_(filePtr),
28  nextReader_(),
29  resourceAcquirer_(inputType == InputType::Primary ? new SharedResourcesAcquirer(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader()) : static_cast<SharedResourcesAcquirer*>(nullptr)),
30  inputType_(inputType),
31  wrapperBaseTClass_(gROOT->GetClass("edm::WrapperBase")) {
32  }
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 34 of file RootDelayedReader.cc.

34  {
35  }
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);}
int k[5][pyjets_maxn]
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 43 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_.

43  {
45  if (!found(iter)) {
46  if (nextReader_) {
47  return nextReader_->getProduct(k, ep);
48  } else {
49  return std::unique_ptr<WrapperBase>();
50  }
51  }
52  roottree::BranchInfo const& branchInfo = getBranchInfo(iter);
53  TBranch* br = branchInfo.productBranch_;
54  if (br == nullptr) {
55  if (nextReader_) {
56  return nextReader_->getProduct(k, ep);
57  } else {
58  return std::unique_ptr<WrapperBase>();
59  }
60  }
61 
63  TClass* cp = branchInfo.classCache_;
64  if(nullptr == cp) {
65  branchInfo.classCache_ = gROOT->GetClass(branchInfo.branchDescription_.wrappedName().c_str());
66  cp = branchInfo.classCache_;
67  branchInfo.offsetToWrapperBase_ = cp->GetBaseClassOffset(wrapperBaseTClass_);
68  }
69  void* p = cp->New();
70  std::unique_ptr<WrapperBase> edp = getWrapperBasePtr(p, branchInfo.offsetToWrapperBase_);
71  br->SetAddress(&p);
72  tree_.getEntry(br, tree_.entryNumberForIndex(ep->transitionIndex()));
73  if(tree_.branchType() == InEvent) {
74  // CMS-THREADING For the primary input source calls to this function need to be serialized
76  }
77  setRefCoreStreamer(false);
78  return edp;
79  }
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:112
DelayedReader * nextReader_
virtual std::unique_ptr< WrapperBase > getProduct(BranchKey const &k, EDProductGetter const *ep)
BranchType branchType() const
Definition: RootTree.h:153
roottree::BranchMap::const_iterator iterator
int k[5][pyjets_maxn]
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 38 of file RootDelayedReader.cc.

References resourceAcquirer_.

38  {
39  return resourceAcquirer_.get();
40  }
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_().