CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

edm::RootDelayedReader Class Reference

#include <RootDelayedReader.h>

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

List of all members.

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 ()

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

data doxygen doxygen gen CMSSW_4_2_8 src IOPool Input src RootDelayedReader cc 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 15 of file RootDelayedReader.cc.

                                         :
   entryNumber_(entry),
   branches_(bMap),
   tree_(tree),
   filePtr_(filePtr),
   nextReader_(),
   fileFormatVersion_(fileFormatVersion) {}

edm::RootDelayedReader::~RootDelayedReader ( ) [virtual]

Definition at line 27 of file RootDelayedReader.cc.


Member Function Documentation

BranchMap const& edm::RootDelayedReader::branches ( ) const [inline, private]

Definition at line 47 of file RootDelayedReader.h.

References branches_.

Referenced by branchIter(), and found().

{return *branches_;}
iterator edm::RootDelayedReader::branchIter ( BranchKey const &  k) const [inline, private]

Definition at line 48 of file RootDelayedReader.h.

References branches().

{return branches().find(k);}
bool edm::RootDelayedReader::found ( iterator const &  iter) const [inline, private]

Definition at line 49 of file RootDelayedReader.h.

References branches().

{return iter != branches().end();}
BranchInfo const& edm::RootDelayedReader::getBranchInfo ( iterator const &  iter) const [inline, private]

Definition at line 50 of file RootDelayedReader.h.

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

Implements edm::DelayedReader.

Definition at line 30 of file RootDelayedReader.cc.

                      {
      if (nextReader_) {
        return nextReader_->getProduct(k, ep);
      } else {
        return std::auto_ptr<EDProduct>();
      }
    }
    roottree::BranchInfo const& branchInfo = getBranchInfo(iter);
    TBranch *br = branchInfo.productBranch_;
    if (br == 0) {
      if (nextReader_) {
        return nextReader_->getProduct(k, ep);
      } else {
        return std::auto_ptr<EDProduct>();
      }
    }
    setRefCoreStreamer(ep, !fileFormatVersion_.splitProductIDs(), !fileFormatVersion_.productIDIsInt());
    TClass *cp = branchInfo.classCache_;
    if(0 == cp) {
      branchInfo.classCache_ = gROOT->GetClass(branchInfo.branchDescription_.wrappedName().c_str());
      cp = branchInfo.classCache_;
      TClass *edProductClass = gROOT->GetClass("edm::EDProduct");
      branchInfo.offsetToEDProduct_ = edProductClass->GetBaseClassOffset(edProductClass);
    }
    void *p = cp->New();

    // A union is used to avoid possible copies during the triple cast that would otherwise be needed.
    //std::auto_ptr<EDProduct> edp(static_cast<EDProduct *>(static_cast<void *>(static_cast<unsigned char *>(p) + branchInfo.offsetToEDProduct_)));
    union {
      void* vp;
      unsigned char* ucp;
      EDProduct* edp;
    } pointerUnion;
    pointerUnion.vp = p;
    pointerUnion.ucp += branchInfo.offsetToEDProduct_;
    std::auto_ptr<EDProduct> edp(pointerUnion.edp);

    br->SetAddress(&p);
    tree_.getEntry(br, entryNumber_);
    setRefCoreStreamer(!fileFormatVersion_.splitProductIDs());
    return edp;
  }
}
virtual void edm::RootDelayedReader::mergeReaders_ ( boost::shared_ptr< DelayedReader other) [inline, private, virtual]

Reimplemented from edm::DelayedReader.

Definition at line 46 of file RootDelayedReader.h.

References nextReader_.

{nextReader_ = other;}

Member Data Documentation

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

Definition at line 52 of file RootDelayedReader.h.

Referenced by branches().

Definition at line 51 of file RootDelayedReader.h.

Definition at line 58 of file RootDelayedReader.h.

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 mergeReaders_().

Definition at line 55 of file RootDelayedReader.h.