CMS 3D CMS Logo

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
std::unique_ptr< WrapperBasegetProduct (BranchKey const &k, EDProductGetter const *ep, ModuleCallingContext const *mcc=nullptr)
 
void mergeReaders (DelayedReader *other)
 
void reset ()
 
std::pair< SharedResourcesAcquirer *, std::recursive_mutex * > sharedResources () const
 
virtual ~DelayedReader ()
 

Private Member Functions

std::unique_ptr< WrapperBasegetProduct_ (BranchKey const &k, EDProductGetter const *ep) override
 
virtual std::unique_ptr< EventEntryDescriptiongetProvenance_ (BranchKey const &) const
 
std::unique_ptr< WrapperBasegetTheProduct (BranchKey const &k) const
 
void mergeReaders_ (DelayedReader *) override
 
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal () const override
 
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal () const override
 
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 91 of file TFWLiteSelectorBasic.cc.

References getTheProduct().

Referenced by set().

91  {
92  return getTheProduct(k);
93  }
std::unique_ptr< WrapperBase > getTheProduct(BranchKey const &k) const
int k[5][pyjets_maxn]
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 96 of file TFWLiteSelectorBasic.cc.

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

Referenced by getProduct_(), and set().

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

Implements edm::DelayedReader.

Definition at line 75 of file TFWLiteSelectorBasic.cc.

75 {}
signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* edm::root::FWLiteDelayedReader::postEventReadFromSourceSignal ( ) const
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 81 of file TFWLiteSelectorBasic.cc.

81  {
82  return nullptr;
83  };
signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* edm::root::FWLiteDelayedReader::preEventReadFromSourceSignal ( ) const
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 78 of file TFWLiteSelectorBasic.cc.

78  {
79  return nullptr;
80  }
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.

References getProduct_(), getTheProduct(), and gen::k.

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

Referenced by getTheProduct(), and setEntry().

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

Definition at line 86 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().