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< std::unordered_map< unsigned int, BranchDescription const * >> iMap)
 
void setEntry (Long64_t iEntry)
 
void setTree (TTree *iTree)
 
- Public Member Functions inherited from edm::DelayedReader
std::unique_ptr< WrapperBasegetProduct (BranchID 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_ (BranchID const &k, EDProductGetter const *ep) override
 
virtual std::unique_ptr< EventEntryDescriptiongetProvenance_ (BranchKey const &) const
 
std::unique_ptr< WrapperBasegetTheProduct (BranchID 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
 

Private Attributes

std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > bidToDesc_
 
Long64_t entry_
 
TTree * eventTree_
 

Detailed Description

Definition at line 64 of file TFWLiteSelectorBasic.cc.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Implements edm::DelayedReader.

Definition at line 92 of file TFWLiteSelectorBasic.cc.

References getTheProduct().

Referenced by set().

92  {
93  return getTheProduct(k);
94  }
int k[5][pyjets_maxn]
std::unique_ptr< WrapperBase > getTheProduct(BranchID const &k) const
virtual std::unique_ptr<EventEntryDescription> edm::root::FWLiteDelayedReader::getProvenance_ ( BranchKey const &  ) const
inlineprivatevirtual

Definition at line 73 of file TFWLiteSelectorBasic.cc.

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

Definition at line 97 of file TFWLiteSelectorBasic.cc.

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

Referenced by getProduct_(), and set().

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

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

Implements edm::DelayedReader.

Definition at line 82 of file TFWLiteSelectorBasic.cc.

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

Implements edm::DelayedReader.

Definition at line 79 of file TFWLiteSelectorBasic.cc.

79  {
80  return nullptr;
81  }
void edm::root::FWLiteDelayedReader::reset_ ( )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 77 of file TFWLiteSelectorBasic.cc.

77 {}
void edm::root::FWLiteDelayedReader::set ( std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * >>  iMap)
inline

Definition at line 69 of file TFWLiteSelectorBasic.cc.

References bidToDesc_, getProduct_(), getTheProduct(), gen::k, and eostools::move().

69 { bidToDesc_ = std::move(iMap);}
std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > bidToDesc_
def move(src, dest)
Definition: eostools.py:510
void edm::root::FWLiteDelayedReader::setEntry ( Long64_t  iEntry)
inline

Definition at line 67 of file TFWLiteSelectorBasic.cc.

References entry_.

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

Definition at line 68 of file TFWLiteSelectorBasic.cc.

References eventTree_.

Member Data Documentation

std::shared_ptr<std::unordered_map<unsigned int, BranchDescription const*> > edm::root::FWLiteDelayedReader::bidToDesc_
private
Long64_t edm::root::FWLiteDelayedReader::entry_
private

Definition at line 84 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setEntry().

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

Definition at line 87 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().