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) override
 
virtual std::unique_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 63 of file TFWLiteSelectorBasic.cc.

Constructor & Destructor Documentation

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

Definition at line 65 of file TFWLiteSelectorBasic.cc.

Member Function Documentation

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

Implements edm::DelayedReader.

Definition at line 83 of file TFWLiteSelectorBasic.cc.

References getTheProduct().

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

Definition at line 72 of file TFWLiteSelectorBasic.cc.

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

Definition at line 88 of file TFWLiteSelectorBasic.cc.

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

Referenced by getProduct_().

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

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

Implements edm::DelayedReader.

Definition at line 76 of file TFWLiteSelectorBasic.cc.

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

Definition at line 68 of file TFWLiteSelectorBasic.cc.

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

Definition at line 66 of file TFWLiteSelectorBasic.cc.

References entry_.

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

Definition at line 67 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 77 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setEntry().

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

Definition at line 78 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().