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

◆ FWLiteDelayedReader()

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

Definition at line 67 of file TFWLiteSelectorBasic.cc.

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

Member Function Documentation

◆ getProduct_()

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.

97  {
98  return getTheProduct(k);
99  }

References getTheProduct(), and dqmdumpme::k.

◆ getProvenance_()

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  }

◆ getTheProduct()

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

Definition at line 101 of file TFWLiteSelectorBasic.cc.

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  }

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

80 {}

◆ postEventReadFromSourceSignal()

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  };

◆ preEventReadFromSourceSignal()

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  }

◆ reset_()

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

Implements edm::DelayedReader.

Definition at line 81 of file TFWLiteSelectorBasic.cc.

81 {}

◆ set()

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.

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

References bidToDesc_, and eostools::move().

◆ setEntry()

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

Definition at line 68 of file TFWLiteSelectorBasic.cc.

68 { entry_ = iEntry; }

References entry_.

◆ setTree()

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

Definition at line 69 of file TFWLiteSelectorBasic.cc.

69 { 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 94 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and set().

◆ entry_

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

Definition at line 90 of file TFWLiteSelectorBasic.cc.

Referenced by getTheProduct(), and setEntry().

◆ eventTree_

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

Definition at line 93 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:152
edm::root::FWLiteDelayedReader::bidToDesc_
std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > bidToDesc_
Definition: TFWLiteSelectorBasic.cc:94
edm::errors::ProductNotFound
Definition: EDMException.h:33
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
newFWLiteAna.fullName
fullName
Definition: newFWLiteAna.py:122
edm::wrappedClassName
std::string wrappedClassName(std::string const &iFullName)
Definition: WrappedClassName.cc:4
edm::root::FWLiteDelayedReader::eventTree_
TTree * eventTree_
Definition: TFWLiteSelectorBasic.cc:93
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
edm::root::FWLiteDelayedReader::getTheProduct
std::unique_ptr< WrapperBase > getTheProduct(BranchID const &k) const
Definition: TFWLiteSelectorBasic.cc:101
edm::root::FWLiteDelayedReader::entry_
Long64_t entry_
Definition: TFWLiteSelectorBasic.cc:90