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 input::BranchInfo BranchInfo
typedef input::BranchMap BranchMap
typedef input::EntryNumber EntryNumber
typedef
input::BranchMap::const_iterator 
iterator

Public Member Functions

 RootDelayedReader (EntryNumber const &entry, boost::shared_ptr< BranchMap const > bMap, boost::shared_ptr< TTreeCache > treeCache, boost::shared_ptr< InputFile > filePtr, FileFormatVersion const &fileFormatVersion)
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< InputFilefilePtr_
boost::shared_ptr< DelayedReadernextReader_
boost::shared_ptr< TTreeCache > treeCache_

Detailed Description

Definition at line 29 of file RootDelayedReader.h.


Member Typedef Documentation

Definition at line 33 of file RootDelayedReader.h.

Definition at line 31 of file RootDelayedReader.h.

Definition at line 32 of file RootDelayedReader.h.

typedef input::BranchMap::const_iterator edm::RootDelayedReader::iterator

Definition at line 34 of file RootDelayedReader.h.


Constructor & Destructor Documentation

data refman pasoursint CMSSW_4_1_8_patch12 src IOPool Input src RootDelayedReader cc edm::RootDelayedReader::RootDelayedReader ( EntryNumber const &  entry,
boost::shared_ptr< BranchMap const >  bMap,
boost::shared_ptr< TTreeCache >  treeCache,
boost::shared_ptr< InputFile filePtr,
FileFormatVersion const &  fileFormatVersion 
)

Definition at line 13 of file RootDelayedReader.cc.

                                                  :
   entryNumber_(entry),
   branches_(bMap),
   treeCache_(treeCache),
   filePtr_(filePtr),
   nextReader_(),
   fileFormatVersion_(fileFormatVersion) {}

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

Definition at line 25 of file RootDelayedReader.cc.


Member Function Documentation

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

Definition at line 46 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 47 of file RootDelayedReader.h.

References branches().

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

Definition at line 48 of file RootDelayedReader.h.

References branches().

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

Definition at line 49 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 28 of file RootDelayedReader.cc.

                      {
      if (nextReader_) {
        return nextReader_->getProduct(k, ep);
      } else {
        return std::auto_ptr<EDProduct>();
      }
    }
    input::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);
    input::getEntryWithCache(br, entryNumber_, treeCache_.get(), filePtr_.get());
    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 45 of file RootDelayedReader.h.

References nextReader_.

{nextReader_ = other;}

Member Data Documentation

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

Definition at line 51 of file RootDelayedReader.h.

Referenced by branches().

Definition at line 50 of file RootDelayedReader.h.

Definition at line 57 of file RootDelayedReader.h.

boost::shared_ptr<InputFile> edm::RootDelayedReader::filePtr_ [private]

Definition at line 55 of file RootDelayedReader.h.

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

Definition at line 56 of file RootDelayedReader.h.

Referenced by mergeReaders_().

boost::shared_ptr<TTreeCache> edm::RootDelayedReader::treeCache_ [private]

Definition at line 54 of file RootDelayedReader.h.