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::shared_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::shared_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 66 of file TFWLiteSelectorBasic.cc.

Constructor & Destructor Documentation

◆ FWLiteDelayedReader()

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

Definition at line 68 of file TFWLiteSelectorBasic.cc.

68 : entry_(-1), eventTree_(nullptr) {}

Member Function Documentation

◆ getProduct_()

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

Implements edm::DelayedReader.

Definition at line 98 of file TFWLiteSelectorBasic.cc.

98  {
99  return getTheProduct(k);
100  }

References getTheProduct(), and dqmdumpme::k.

◆ getProvenance_()

virtual std::unique_ptr<EventEntryDescription> edm::root::FWLiteDelayedReader::getProvenance_ ( BranchKey const &  ) const
inlineprivatevirtual

Definition at line 78 of file TFWLiteSelectorBasic.cc.

78  {
79  return std::unique_ptr<EventEntryDescription>();
80  }

◆ getTheProduct()

std::unique_ptr< WrapperBase > edm::root::FWLiteDelayedReader::getTheProduct ( BranchID const &  k) const
private

Definition at line 102 of file TFWLiteSelectorBasic.cc.

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

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, dqmdumpme::k, dumpMFGeometry_cfg::prod, edm::errors::ProductNotFound, AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().

Referenced by getProduct_().

◆ mergeReaders_()

void edm::root::FWLiteDelayedReader::mergeReaders_ ( DelayedReader )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 81 of file TFWLiteSelectorBasic.cc.

81 {}

◆ postEventReadFromSourceSignal()

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

Implements edm::DelayedReader.

Definition at line 88 of file TFWLiteSelectorBasic.cc.

89  {
90  return nullptr;
91  };

◆ preEventReadFromSourceSignal()

signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* edm::root::FWLiteDelayedReader::preEventReadFromSourceSignal ( ) const
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 84 of file TFWLiteSelectorBasic.cc.

85  {
86  return nullptr;
87  }

◆ reset_()

void edm::root::FWLiteDelayedReader::reset_ ( )
inlineoverrideprivatevirtual

Implements edm::DelayedReader.

Definition at line 82 of file TFWLiteSelectorBasic.cc.

82 {}

◆ set()

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

Definition at line 71 of file TFWLiteSelectorBasic.cc.

71  {
72  bidToDesc_ = std::move(iMap);
73  }

References bidToDesc_, and eostools::move().

◆ setEntry()

void edm::root::FWLiteDelayedReader::setEntry ( Long64_t  iEntry)
inline

Definition at line 69 of file TFWLiteSelectorBasic.cc.

69 { entry_ = iEntry; }

References entry_.

◆ setTree()

void edm::root::FWLiteDelayedReader::setTree ( TTree *  iTree)
inline

Definition at line 70 of file TFWLiteSelectorBasic.cc.

70 { eventTree_ = iTree; }

References eventTree_.

Member Data Documentation

◆ bidToDesc_

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

Definition at line 95 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and set().

◆ entry_

Long64_t edm::root::FWLiteDelayedReader::entry_
private

Definition at line 91 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setEntry().

◆ eventTree_

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

Definition at line 94 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setTree().

edm::TypeWithDict::byName
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:174
edm::root::FWLiteDelayedReader::bidToDesc_
std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > bidToDesc_
Definition: TFWLiteSelectorBasic.cc:95
edm::errors::ProductNotFound
Definition: EDMException.h:33
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
dqmdumpme.k
k
Definition: dqmdumpme.py:60
newFWLiteAna.fullName
fullName
Definition: newFWLiteAna.py:122
edm::wrappedClassName
std::string wrappedClassName(std::string const &iFullName)
Definition: WrappedClassName.cc:4
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::root::FWLiteDelayedReader::eventTree_
TTree * eventTree_
Definition: TFWLiteSelectorBasic.cc:94
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
edm::root::FWLiteDelayedReader::getTheProduct
std::unique_ptr< WrapperBase > getTheProduct(BranchID const &k) const
Definition: TFWLiteSelectorBasic.cc:102
edm::root::FWLiteDelayedReader::entry_
Long64_t entry_
Definition: TFWLiteSelectorBasic.cc:91