|
|
#include <FWCore/FWLite/interface/BareRootProductGetter.h>
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 43 of file BareRootProductGetter.h.
◆ IdToBuffers
◆ BareRootProductGetter() [1/2]
BareRootProductGetter::BareRootProductGetter |
( |
| ) |
|
◆ ~BareRootProductGetter()
BareRootProductGetter::~BareRootProductGetter |
( |
| ) |
|
|
override |
◆ BareRootProductGetter() [2/2]
◆ createNewBuffer()
Definition at line 221 of file BareRootProductGetter.cc.
233 if (!
bool(classType)) {
235 <<
"\n Please make sure all the necessary libraries are available.";
239 TClass* rootClassType = TClass::GetClass(classType.typeInfo());
240 if (
nullptr == rootClassType) {
241 throw cms::Exception(
"MissingRootDictionary") <<
"could not find a ROOT dictionary for type '" <<
fullName <<
"'"
242 <<
"\n Please make sure all the necessary libraries are available.";
245 void* address = rootClassType->New();
247 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
249 static_cast<edm::WrapperBase const*>(rootClassType->DynamicCast(edproductTClass, address,
true));
250 if (
nullptr ==
prod) {
251 throw cms::Exception(
"FailedConversion") <<
"failed to convert a '" <<
fullName <<
"' to a edm::WrapperBase."
252 <<
"Please contact developers since something is very wrong.";
263 branch->SetAddress(address);
References b, MicroEventContent_cff::branch, fwlite::BranchMapReader::branchIDToBranch(), branchMap_, edm::BranchDescription::branchName(), edm::TypeWithDict::byName(), edm::BranchDescription::className(), Exception, newFWLiteAna::fullName, fwlite::BranchMapReader::getEventTree(), idToBuffers_, eostools::move(), dumpMFGeometry_cfg::prod, AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().
Referenced by getIt().
◆ getIt() [1/2]
Definition at line 105 of file BareRootProductGetter.cc.
107 IdToBuffers::iterator itBuffer =
idToBuffers_.find(branchID);
117 buffer = &(itBuffer->second);
120 throw cms::Exception(
"NullBuffer") <<
"Found a null buffer which is supposed to hold the data item."
121 <<
"\n Please contact developers since this message should not happen.";
123 if (
nullptr ==
buffer->branch_) {
124 throw cms::Exception(
"NullBranch") <<
"The TBranch which should hold the data item is null."
125 <<
"\n Please contact the developers since this message should not happen.";
127 if (
buffer->eventEntry_ != eventEntry) {
132 void* address =
buffer->class_->New();
134 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
136 static_cast<edm::WrapperBase const*>(
buffer->class_->DynamicCast(edproductTClass, address,
true));
138 if (
nullptr ==
prod) {
140 <<
"' to a edm::WrapperBase."
141 <<
"Please contact developers since something is very wrong.";
143 buffer->address_ = address;
144 buffer->product_ = std::shared_ptr<edm::WrapperBase const>(
prod);
147 address = &(
buffer->address_);
148 buffer->branch_->SetAddress(address);
150 buffer->branch_->GetEntry(eventEntry);
151 buffer->eventEntry_ = eventEntry;
155 <<
"Calling GetEntry with index " << eventEntry <<
"for branch " <<
buffer->branch_->GetName() <<
" failed.";
158 return buffer->product_.get();
References edmScanValgrind::buffer, createNewBuffer(), Exception, idToBuffers_, and dumpMFGeometry_cfg::prod.
◆ getIt() [2/2]
Implements edm::EDProductGetter.
Definition at line 71 of file BareRootProductGetter.cc.
73 TFile* currentFile = dynamic_cast<TFile*>(gROOT->GetListOfFiles()->Last());
74 if (
nullptr == currentFile) {
75 throw cms::Exception(
"FileNotFound") <<
"unable to find the TFile '" << gROOT->GetListOfFiles()->Last() <<
"'\n"
76 <<
"retrieved by calling 'gROOT->GetListOfFiles()->Last()'\n"
77 <<
"Please check the list of files.";
84 if (
nullptr == eventTree) {
88 <<
"'\n Please check that the file is a standard CMS ROOT format.\n"
89 <<
"If the above is not the file you expect then please open your data file after all other files.";
91 Long_t eventEntry = eventTree->GetReadEntry();
96 <<
"please call GetEntry for the 'Events' TTree for each event in order to make edm::Ref's work."
97 <<
"\n Also be sure to call 'SetAddress' for all Branches after calling the GetEntry.";
102 return getIt(branchID, eventEntry);
References branchMap_, edm::poolNames::eventTreeName(), Exception, fwlite::BranchMapReader::getEventTree(), fwlite::BranchMapReader::getFile(), idToBuffers_, fwlite::BranchMapReader::productToBranchID(), fwlite::BranchMapReader::updateEvent(), and fwlite::BranchMapReader::updateFile().
Referenced by getThinnedAssociation(), getThinnedProduct(), and getThinnedProducts().
◆ getThinnedAssociation()
Definition at line 268 of file BareRootProductGetter.cc.
271 if (wrapperBase ==
nullptr) {
273 <<
"BareRootProductGetter::getThinnedAssociation, product ThinnedAssociation not found.\n";
277 <<
"BareRootProductGetter::getThinnedAssociation, product has wrong type, not a ThinnedAssociation.\n";
283 return thinnedAssociation;
References watchdog::const, edm::WrapperBase::dynamicTypeInfo(), Exception, getIt(), edm::errors::LogicError, and wrapper.
Referenced by getThinnedKeyFrom(), getThinnedProduct(), and getThinnedProducts().
◆ getThinnedKeyFrom()
Implements edm::EDProductGetter.
Definition at line 187 of file BareRootProductGetter.cc.
193 return std::monostate{};
196 return std::monostate{};
206 if (
auto factory = std::get_if<edm::detail::GetThinnedKeyFromExceptionFactory>(&
ret)) {
207 return [
func = *factory]() {
209 ex.addContext(
"Calling BareRootProductGetter::getThinnedKeyFrom()");
216 ex.
addContext(
"Calling BareRootProductGetter::getThinnedKeyFrom()");
References cms::Exception::addContext(), branchMap_, TrackCollections2monitor_cff::func, fwlite::BranchMapReader::getEventTree(), getThinnedAssociation(), edm::detail::getThinnedKeyFrom_implementation(), edm::BranchID::isValid(), crabWrapper::key, class-composition::parent, fwlite::BranchMapReader::productToBranchID(), runTheMatrix::ret, and fwlite::BranchMapReader::thinnedAssociationsHelper().
◆ getThinnedProduct()
std::optional< std::tuple< edm::WrapperBase const *, unsigned int > > BareRootProductGetter::getThinnedProduct |
( |
edm::ProductID const & |
pid, |
|
|
unsigned int |
key |
|
) |
| const |
|
overridevirtual |
◆ getThinnedProducts()
void BareRootProductGetter::getThinnedProducts |
( |
edm::ProductID const & |
pid, |
|
|
std::vector< edm::WrapperBase const * > & |
foundContainers, |
|
|
std::vector< unsigned int > & |
keys |
|
) |
| const |
|
overridevirtual |
◆ operator=()
◆ transitionIndex_()
unsigned int BareRootProductGetter::transitionIndex_ |
( |
| ) |
const |
|
inlineoverrideprivatevirtual |
◆ branchMap_
◆ idToBuffers_
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &pid, unsigned int key, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID)
ret
prodAgent to be discontinued
static TypeWithDict byName(std::string const &name)
std::string const & eventTreeName()
void addContext(std::string const &context)
const edm::BranchDescription & branchIDToBranch(const edm::BranchID &bid) const
static HepMC::HEPEVT_Wrapper wrapper
edm::BranchID productToBranchID(const edm::ProductID &pid)
TTree const * getEventTree() const
bool updateEvent(Long_t eventEntry)
bool updateFile(TFile *file)
std::variant< unsigned int, GetThinnedKeyFromExceptionFactory, std::monostate > getThinnedKeyFrom_implementation(ProductID const &parentID, BranchID const &parent, unsigned int key, ProductID const &thinnedID, BranchID thinned, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F &&getThinnedAssociation)
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID, Long_t eventEntry) const
fwlite::BranchMapReader branchMap_
const edm::ThinnedAssociationsHelper & thinnedAssociationsHelper() const
std::type_info const & dynamicTypeInfo() const
edm::WrapperBase const * getIt(edm::ProductID const &) const override
Buffer * createNewBuffer(edm::BranchID const &) const
std::string const & branchName() const
std::string wrappedClassName(std::string const &iFullName)
TFile const * getFile() const
std::string const & className() const
void getThinnedProducts(ProductID const &pid, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys)