CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::root::FWLiteDelayedReader Class Reference
Inheritance diagram for edm::root::FWLiteDelayedReader:
edm::DelayedReader

Public Member Functions

 FWLiteDelayedReader ()
 
void set (std::shared_ptr< ProductRegistry const > iReg)
 
void setEntry (Long64_t iEntry)
 
void setTree (TTree *iTree)
 
- 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

virtual std::unique_ptr
< WrapperBase
getProduct_ (BranchKey const &k, EDProductGetter const *ep) const override
 
virtual std::auto_ptr
< EventEntryDescription
getProvenance_ (BranchKey const &) const
 
std::unique_ptr< WrapperBasegetTheProduct (BranchKey const &k) const
 
virtual void mergeReaders_ (DelayedReader *) override
 
virtual void reset_ () override
 
 std::shared_ptr (reg_)
 

Private Attributes

Long64_t entry_
 
TTree * eventTree_
 

Detailed Description

Definition at line 62 of file TFWLiteSelectorBasic.cc.

Constructor & Destructor Documentation

edm::root::FWLiteDelayedReader::FWLiteDelayedReader ( )
inline

Definition at line 64 of file TFWLiteSelectorBasic.cc.

Member Function Documentation

std::unique_ptr< WrapperBase > edm::root::FWLiteDelayedReader::getProduct_ ( BranchKey const &  k,
EDProductGetter const *  ep 
) const
overrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 82 of file TFWLiteSelectorBasic.cc.

References getTheProduct().

82  {
83  return getTheProduct(k);
84  }
std::unique_ptr< WrapperBase > getTheProduct(BranchKey const &k) const
virtual std::auto_ptr<EventEntryDescription> edm::root::FWLiteDelayedReader::getProvenance_ ( BranchKey const &  ) const
inlineprivatevirtual

Definition at line 71 of file TFWLiteSelectorBasic.cc.

71  {
72  return std::auto_ptr<EventEntryDescription>();
73  }
std::unique_ptr< WrapperBase > edm::root::FWLiteDelayedReader::getTheProduct ( BranchKey const &  k) const
private

Definition at line 87 of file TFWLiteSelectorBasic.cc.

References edm::ObjectWithDict::address(), edm::BranchDescription::branchName(), edm::TypeWithDict::byName(), edm::ObjectWithDict::castObject(), edm::BranchDescription::className(), entry_, eventTree_, edm::hlt::Exception, newFWLiteAna::fullName, relval_steps::k, parseEventContent::prod, edm::errors::ProductNotFound, AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().

Referenced by getProduct_().

87  {
88  ProductRegistry::ProductList::const_iterator itFind= reg_->productList().find(k);
89  if(itFind == reg_->productList().end()) {
90  throw Exception(errors::ProductNotFound) << "could not find entry for product " << k;
91  }
92  BranchDescription const& bDesc = itFind->second;
93 
94  TBranch* branch= eventTree_->GetBranch(bDesc.branchName().c_str());
95  if(nullptr == branch) {
96  throw cms::Exception("MissingBranch")
97  << "could not find branch named '" << bDesc.branchName() << "'"
98  << "\n Perhaps the data being requested was not saved in this file?";
99  }
100  //find the class type
101  std::string const fullName = wrappedClassName(bDesc.className());
102  TypeWithDict classType = TypeWithDict::byName(fullName);
103  if(!bool(classType)) {
104  throw cms::Exception("MissingDictionary")
105  << "could not find dictionary for type '" << fullName << "'"
106  << "\n Please make sure all the necessary libraries are available.";
107  }
108 
109  //create an instance of it
110  ObjectWithDict wrapperObj = classType.construct();
111  if(nullptr == wrapperObj.address()) {
112  throw cms::Exception("FailedToCreate") << "could not create an instance of '" << fullName << "'";
113  }
114  void* address = wrapperObj.address();
115  branch->SetAddress(&address);
116  ObjectWithDict edProdObj = wrapperObj.castObject(TypeWithDict::byName("edm::WrapperBase"));
117 
118  WrapperBase* prod = reinterpret_cast<WrapperBase*>(edProdObj.address());
119 
120  if(nullptr == prod) {
121  throw cms::Exception("FailedConversion")
122  << "failed to convert a '" << fullName
123  << "' to a edm::WrapperBase."
124  << "Please contact developers since something is very wrong.";
125  }
126  branch->GetEntry(entry_);
127  return std::unique_ptr<WrapperBase>(prod);
128  }
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
string fullName
std::string wrappedClassName(std::string const &iFullName)
virtual void edm::root::FWLiteDelayedReader::mergeReaders_ ( DelayedReader )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 74 of file TFWLiteSelectorBasic.cc.

74 {}
virtual void edm::root::FWLiteDelayedReader::reset_ ( )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 75 of file TFWLiteSelectorBasic.cc.

75 {}
void edm::root::FWLiteDelayedReader::set ( std::shared_ptr< ProductRegistry const >  iReg)
inline

Definition at line 67 of file TFWLiteSelectorBasic.cc.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

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

Definition at line 65 of file TFWLiteSelectorBasic.cc.

References entry_.

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

Definition at line 66 of file TFWLiteSelectorBasic.cc.

References eventTree_.

edm::root::FWLiteDelayedReader::std::shared_ptr ( reg_  )
private

Member Data Documentation

Long64_t edm::root::FWLiteDelayedReader::entry_
private

Definition at line 76 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setEntry().

TTree* edm::root::FWLiteDelayedReader::eventTree_
private

Definition at line 77 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().