CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::root::FWLiteDelayedReader Class Reference

Inheritance diagram for edm::root::FWLiteDelayedReader:
edm::DelayedReader

List of all members.

Public Member Functions

 FWLiteDelayedReader ()
void set (boost::shared_ptr< ProductRegistry const > iReg)
void setEntry (Long64_t iEntry)
void setTree (TTree *iTree)

Private Member Functions

 boost::shared_ptr (reg_)
virtual std::auto_ptr< EDProductgetProduct_ (BranchKey const &k, EDProductGetter const *ep) const
virtual std::auto_ptr
< EventEntryDescription
getProvenance_ (BranchKey const &) const

Private Attributes

Long64_t entry_
TTree * eventTree_

Detailed Description

Definition at line 57 of file TFWLiteSelectorBasic.cc.


Constructor & Destructor Documentation

edm::root::FWLiteDelayedReader::FWLiteDelayedReader ( ) [inline]

Definition at line 59 of file TFWLiteSelectorBasic.cc.

: entry_(-1),eventTree_(0),reg_() {}

Member Function Documentation

edm::root::FWLiteDelayedReader::boost::shared_ptr ( reg_  ) [private]
std::auto_ptr< EDProduct > edm::root::FWLiteDelayedReader::getProduct_ ( BranchKey const &  k,
EDProductGetter const *  ep 
) const [private, virtual]

Implements edm::DelayedReader.

Definition at line 74 of file TFWLiteSelectorBasic.cc.

References edm::BranchDescription::branchName(), edm::BranchDescription::className(), entry_, eventTree_, Exception, newFWLiteAna::fullName, gen::k, parseEventContent::prod, edm::errors::ProductNotFound, and edm::wrappedClassName().

                                                                                        {
      ProductRegistry::ProductList::const_iterator itFind= reg_->productList().find(k);
      if(itFind == reg_->productList().end()) {
        throw Exception(errors::ProductNotFound)<<"could not find entry for product "<<k;
      }
      BranchDescription const& bDesc = itFind->second;

      TBranch* branch= eventTree_->GetBranch(bDesc.branchName().c_str());
      if(0 == branch) {
        throw cms::Exception("MissingBranch")
        <<"could not find branch named '"<<bDesc.branchName()<<"'"
        <<"\n Perhaps the data being requested was not saved in this file?";
      }
      //find the class type
      std::string const fullName = wrappedClassName(bDesc.className());
      Reflex::Type classType = Reflex::Type::ByName(fullName);
      if(classType == Reflex::Type()) {
        throw cms::Exception("MissingDictionary")
        <<"could not find dictionary for type '"<<fullName<<"'"
        <<"\n Please make sure all the necessary libraries are available.";
        return std::auto_ptr<EDProduct>();
      }

      //use reflex to create an instance of it
      Reflex::Object wrapperObj = classType.Construct();
      if(0 == wrapperObj.Address()) {
        throw cms::Exception("FailedToCreate") <<"could not create an instance of '"<<fullName<<"'";
      }
      void* address  = wrapperObj.Address();
      branch->SetAddress(&address);

      Reflex::Object edProdObj = wrapperObj.CastObject(Reflex::Type::ByName("edm::EDProduct"));

      EDProduct* prod = reinterpret_cast<EDProduct*>(edProdObj.Address());

      if(0 == prod) {
        throw cms::Exception("FailedConversion")
        << "failed to convert a '" << fullName
        << "' to a edm::EDProduct."
        << "Please contact developers since something is very wrong.";
      }
      branch->GetEntry(entry_);
      return std::auto_ptr<EDProduct>(prod);
    }
virtual std::auto_ptr<EventEntryDescription> edm::root::FWLiteDelayedReader::getProvenance_ ( BranchKey const &  ) const [inline, private, virtual]

Definition at line 65 of file TFWLiteSelectorBasic.cc.

                                                                                        {
        return std::auto_ptr<EventEntryDescription>();
      }
void edm::root::FWLiteDelayedReader::set ( boost::shared_ptr< ProductRegistry const >  iReg) [inline]

Definition at line 62 of file TFWLiteSelectorBasic.cc.

{ reg_ = iReg;}
void edm::root::FWLiteDelayedReader::setEntry ( Long64_t  iEntry) [inline]

Definition at line 60 of file TFWLiteSelectorBasic.cc.

References entry_.

{ entry_ = iEntry; }
void edm::root::FWLiteDelayedReader::setTree ( TTree *  iTree) [inline]

Definition at line 61 of file TFWLiteSelectorBasic.cc.

References eventTree_.

{eventTree_ = iTree;}

Member Data Documentation

Definition at line 68 of file TFWLiteSelectorBasic.cc.

Referenced by getProduct_(), and setEntry().

Definition at line 69 of file TFWLiteSelectorBasic.cc.

Referenced by getProduct_(), and setTree().