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

 RootDelayedReader (EntryNumber const &entry, boost::shared_ptr< BranchMap const > bMap, RootTree const &tree, FileFormatVersion const &fileFormatVersion, boost::shared_ptr< RootFile > filePtr)
 
virtual ~RootDelayedReader ()
 
- Public Member Functions inherited from edm::DelayedReader
std::auto_ptr< EDProductgetProduct (BranchKey const &k, EDProductGetter const *ep)
 
void mergeReaders (boost::shared_ptr< DelayedReader > other)
 
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::auto_ptr< EDProductgetProduct_ (BranchKey const &k, EDProductGetter const *ep) const
 
virtual void mergeReaders_ (boost::shared_ptr< DelayedReader > other)
 

Private Attributes

boost::shared_ptr< BranchMap
const > 
branches_
 
EntryNumber const entryNumber_
 
FileFormatVersion fileFormatVersion_
 
boost::shared_ptr< RootFilefilePtr_
 
boost::shared_ptr< DelayedReadernextReader_
 
RootTree const & tree_
 

Detailed Description

Definition at line 30 of file RootDelayedReader.h.

Member Typedef Documentation

Definition at line 32 of file RootDelayedReader.h.

Definition at line 33 of file RootDelayedReader.h.

Definition at line 35 of file RootDelayedReader.h.

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

Definition at line 34 of file RootDelayedReader.h.

Constructor & Destructor Documentation

edm::RootDelayedReader::RootDelayedReader ( EntryNumber const &  entry,
boost::shared_ptr< BranchMap const >  bMap,
RootTree const &  tree,
FileFormatVersion const &  fileFormatVersion,
boost::shared_ptr< RootFile filePtr 
)

Definition at line 14 of file RootDelayedReader.cc.

18  :
20  branches_(bMap),
21  tree_(tree),
22  filePtr_(filePtr),
23  nextReader_(),
24  fileFormatVersion_(fileFormatVersion) {}
RootTree const & tree_
boost::shared_ptr< BranchMap const > branches_
boost::shared_ptr< RootFile > filePtr_
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
boost::shared_ptr< DelayedReader > nextReader_
FileFormatVersion fileFormatVersion_
EntryNumber const entryNumber_
edm::RootDelayedReader::~RootDelayedReader ( )
virtual

Definition at line 26 of file RootDelayedReader.cc.

26 {}

Member Function Documentation

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

Definition at line 47 of file RootDelayedReader.h.

References branches_.

Referenced by branchIter(), and found().

47 {return *branches_;}
boost::shared_ptr< BranchMap const > branches_
iterator edm::RootDelayedReader::branchIter ( BranchKey const &  k) const
inlineprivate

Definition at line 48 of file RootDelayedReader.h.

References branches().

Referenced by getProduct_().

48 {return branches().find(k);}
int k[5][pyjets_maxn]
BranchMap const & branches() const
bool edm::RootDelayedReader::found ( iterator const &  iter) const
inlineprivate

Definition at line 49 of file RootDelayedReader.h.

References branches().

Referenced by getProduct_().

49 {return iter != branches().end();}
BranchMap const & branches() const
BranchInfo const& edm::RootDelayedReader::getBranchInfo ( iterator const &  iter) const
inlineprivate

Definition at line 50 of file RootDelayedReader.h.

Referenced by getProduct_().

50 {return iter->second; }
std::auto_ptr< EDProduct > edm::RootDelayedReader::getProduct_ ( BranchKey const &  k,
EDProductGetter const *  ep 
) const
privatevirtual

Implements edm::DelayedReader.

Definition at line 29 of file RootDelayedReader.cc.

References beamvalidation::br, edm::roottree::BranchInfo::branchDescription_, branchIter(), edm::roottree::BranchInfo::classCache_, CommonMethods::cp(), entryNumber_, fileFormatVersion_, found(), getBranchInfo(), edm::RootTree::getEntry(), nextReader_, edm::roottree::BranchInfo::offsetToEDProduct_, L1TEmulatorMonitor_cff::p, edm::roottree::BranchInfo::productBranch_, edm::FileFormatVersion::productIDIsInt(), edm::setRefCoreStreamer(), edm::FileFormatVersion::splitProductIDs(), tree_, and edm::ConstBranchDescription::wrappedName().

29  {
30  iterator iter = branchIter(k);
31  if (!found(iter)) {
32  if (nextReader_) {
33  return nextReader_->getProduct(k, ep);
34  } else {
35  return std::auto_ptr<EDProduct>();
36  }
37  }
38  roottree::BranchInfo const& branchInfo = getBranchInfo(iter);
39  TBranch *br = branchInfo.productBranch_;
40  if (br == 0) {
41  if (nextReader_) {
42  return nextReader_->getProduct(k, ep);
43  } else {
44  return std::auto_ptr<EDProduct>();
45  }
46  }
48  TClass *cp = branchInfo.classCache_;
49  if(0 == cp) {
50  branchInfo.classCache_ = gROOT->GetClass(branchInfo.branchDescription_.wrappedName().c_str());
51  cp = branchInfo.classCache_;
52  TClass *edProductClass = gROOT->GetClass("edm::EDProduct");
53  branchInfo.offsetToEDProduct_ = edProductClass->GetBaseClassOffset(edProductClass);
54  }
55  void *p = cp->New();
56 
57  // A union is used to avoid possible copies during the triple cast that would otherwise be needed.
58  //std::auto_ptr<EDProduct> edp(static_cast<EDProduct *>(static_cast<void *>(static_cast<unsigned char *>(p) + branchInfo.offsetToEDProduct_)));
59  union {
60  void* vp;
61  unsigned char* ucp;
62  EDProduct* edp;
63  } pointerUnion;
64  pointerUnion.vp = p;
65  pointerUnion.ucp += branchInfo.offsetToEDProduct_;
66  std::auto_ptr<EDProduct> edp(pointerUnion.edp);
67 
68  br->SetAddress(&p);
71  return edp;
72  }
RootTree const & tree_
void setRefCoreStreamer(bool resetAll=false)
BranchInfo const & getBranchInfo(iterator const &iter) const
roottree::BranchMap::const_iterator iterator
int k[5][pyjets_maxn]
bool found(iterator const &iter) const
boost::shared_ptr< DelayedReader > nextReader_
void getEntry(TBranch *branch, EntryNumber entry) const
Definition: RootTree.cc:169
FileFormatVersion fileFormatVersion_
EntryNumber const entryNumber_
iterator branchIter(BranchKey const &k) const
virtual void edm::RootDelayedReader::mergeReaders_ ( boost::shared_ptr< DelayedReader other)
inlineprivatevirtual

Reimplemented from edm::DelayedReader.

Definition at line 46 of file RootDelayedReader.h.

References nextReader_.

46 {nextReader_ = other;}
boost::shared_ptr< DelayedReader > nextReader_

Member Data Documentation

boost::shared_ptr<BranchMap const> edm::RootDelayedReader::branches_
private

Definition at line 52 of file RootDelayedReader.h.

Referenced by branches().

EntryNumber const edm::RootDelayedReader::entryNumber_
private

Definition at line 51 of file RootDelayedReader.h.

Referenced by getProduct_().

FileFormatVersion edm::RootDelayedReader::fileFormatVersion_
private

Definition at line 58 of file RootDelayedReader.h.

Referenced by getProduct_().

boost::shared_ptr<RootFile> edm::RootDelayedReader::filePtr_
private

Definition at line 56 of file RootDelayedReader.h.

boost::shared_ptr<DelayedReader> edm::RootDelayedReader::nextReader_
private

Definition at line 57 of file RootDelayedReader.h.

Referenced by getProduct_(), and mergeReaders_().

RootTree const& edm::RootDelayedReader::tree_
private

Definition at line 55 of file RootDelayedReader.h.

Referenced by getProduct_().