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 58 of file TFWLiteSelectorBasic.cc.

Constructor & Destructor Documentation

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

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

References getTheProduct().

78  {
79  return getTheProduct(k);
80  }
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 67 of file TFWLiteSelectorBasic.cc.

67  {
68  return std::auto_ptr<EventEntryDescription>();
69  }
std::unique_ptr< WrapperBase > edm::root::FWLiteDelayedReader::getTheProduct ( BranchKey const &  k) const
private

Definition at line 83 of file TFWLiteSelectorBasic.cc.

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

Referenced by getProduct_().

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

Implements edm::DelayedReader.

Definition at line 70 of file TFWLiteSelectorBasic.cc.

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

Implements edm::DelayedReader.

Definition at line 71 of file TFWLiteSelectorBasic.cc.

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

Definition at line 63 of file TFWLiteSelectorBasic.cc.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

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

Definition at line 61 of file TFWLiteSelectorBasic.cc.

References entry_.

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

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

Referenced by getTheProduct(), and setEntry().

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

Definition at line 73 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().