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

References getTheProduct().

Referenced by set().

97  {
98  return getTheProduct(k);
99  }
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 77 of file TFWLiteSelectorBasic.cc.

77  {
78  return std::unique_ptr<EventEntryDescription>();
79  }
std::unique_ptr< WrapperBase > edm::root::FWLiteDelayedReader::getTheProduct ( BranchID const &  k) const
private

Definition at line 101 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, newFWLiteAna::fullName, edm::BranchID::id(), dqmdumpme::k, dumpMFGeometry_cfg::prod, edm::errors::ProductNotFound, AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().

Referenced by getProduct_(), and set().

101  {
102  auto itFind = bidToDesc_->find(k.id());
103  if (itFind == bidToDesc_->end()) {
104  throw Exception(errors::ProductNotFound) << "could not find entry for product " << k;
105  }
106  BranchDescription const& bDesc = *(itFind->second);
107 
108  TBranch* branch = eventTree_->GetBranch(bDesc.branchName().c_str());
109  if (nullptr == branch) {
110  throw cms::Exception("MissingBranch") << "could not find branch named '" << bDesc.branchName() << "'"
111  << "\n Perhaps the data being requested was not saved in this file?";
112  }
113  //find the class type
114  std::string const fullName = wrappedClassName(bDesc.className());
115  TypeWithDict classType = TypeWithDict::byName(fullName);
116  if (!bool(classType)) {
117  throw cms::Exception("MissingDictionary") << "could not find dictionary for type '" << fullName << "'"
118  << "\n Please make sure all the necessary libraries are available.";
119  }
120 
121  //create an instance of it
122  ObjectWithDict wrapperObj = classType.construct();
123  if (nullptr == wrapperObj.address()) {
124  throw cms::Exception("FailedToCreate") << "could not create an instance of '" << fullName << "'";
125  }
126  void* address = wrapperObj.address();
127  branch->SetAddress(&address);
128  ObjectWithDict edProdObj = wrapperObj.castObject(TypeWithDict::byName("edm::WrapperBase"));
129 
130  WrapperBase* prod = reinterpret_cast<WrapperBase*>(edProdObj.address());
131 
132  if (nullptr == prod) {
133  throw cms::Exception("FailedConversion") << "failed to convert a '" << fullName << "' 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:74
std::string wrappedClassName(std::string const &iFullName)
void edm::root::FWLiteDelayedReader::mergeReaders_ ( DelayedReader )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 80 of file TFWLiteSelectorBasic.cc.

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

Implements edm::DelayedReader.

Definition at line 87 of file TFWLiteSelectorBasic.cc.

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

Implements edm::DelayedReader.

Definition at line 83 of file TFWLiteSelectorBasic.cc.

84  {
85  return nullptr;
86  }
void edm::root::FWLiteDelayedReader::reset_ ( )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 81 of file TFWLiteSelectorBasic.cc.

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

Definition at line 70 of file TFWLiteSelectorBasic.cc.

References bidToDesc_, SiStripBadComponentsDQMServiceTemplate_cfg::ep, getProduct_(), getTheProduct(), dqmdumpme::k, and eostools::move().

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

Definition at line 68 of file TFWLiteSelectorBasic.cc.

References entry_.

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

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

Referenced by getTheProduct(), and setEntry().

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

Definition at line 93 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().