File indexing completed on 2024-04-06 12:04:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <iostream>
0021
0022
0023 #include "DataFormats/FWLite/interface/RunBase.h"
0024 #include "DataFormats/Common/interface/FunctorHandleExceptionFactory.h"
0025 #include "FWCore/Utilities/interface/do_nothing_deleter.h"
0026 #include "FWCore/Utilities/interface/EDMException.h"
0027 #include "FWCore/Utilities/interface/TypeID.h"
0028
0029 static const edm::ProductID s_id;
0030 static edm::BranchDescription const s_branch = edm::BranchDescription(edm::BranchDescription());
0031 static const edm::Provenance s_prov(std::shared_ptr<edm::BranchDescription const>(&s_branch, edm::do_nothing_deleter()),
0032 s_id);
0033
0034 namespace fwlite {
0035 RunBase::RunBase() {}
0036
0037 RunBase::~RunBase() {}
0038
0039 edm::BasicHandle RunBase::getByLabelImpl(std::type_info const& iWrapperInfo,
0040 std::type_info const& ,
0041 const edm::InputTag& iTag) const {
0042 edm::WrapperBase* prod = nullptr;
0043 void* prodPtr = ∏
0044 getByLabel(iWrapperInfo,
0045 iTag.label().c_str(),
0046 iTag.instance().empty() ? static_cast<char const*>(nullptr) : iTag.instance().c_str(),
0047 iTag.process().empty() ? static_cast<char const*>(nullptr) : iTag.process().c_str(),
0048 prodPtr);
0049 if (prod == nullptr || !prod->isPresent()) {
0050 edm::TypeID productType(iWrapperInfo);
0051
0052 edm::BasicHandle failed(edm::makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
0053 std::shared_ptr<cms::Exception> whyFailed(std::make_shared<edm::Exception>(edm::errors::ProductNotFound));
0054 *whyFailed << "getByLabel: Found zero products matching all criteria\n"
0055 << "Looking for type: " << productType << "\n"
0056 << "Looking for module label: " << iTag.label() << "\n"
0057 << "Looking for productInstanceName: " << iTag.instance() << "\n"
0058 << (iTag.process().empty() ? "" : "Looking for process: ") << iTag.process() << "\n";
0059 return whyFailed;
0060 }));
0061 return failed;
0062 }
0063 edm::BasicHandle value(prod, &s_prov);
0064 return value;
0065 }
0066 }