/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
DataFormats/FWLite/src/EventBase.cc
105 строк
4 KB
Christopher Jones
using for ProductDescription
27 янв 2025, 17:16
27 янв 2025, 17:16
9fe870c
Код
Авторство
О чём код?
// -*- C++ -*- // // Package: FWLite // Class : EventBase // // Implementation: // <Notes on implementation> // // Original Author: Charles Plager // Created: // // system include files #include <iostream> #include <memory> // user include files #include "DataFormats/FWLite/interface/EventBase.h" #include "DataFormats/Common/interface/BasicHandle.h" #include "DataFormats/Common/interface/FunctorHandleExceptionFactory.h" #include "DataFormats/Common/interface/WrapperBase.h" #include "DataFormats/Provenance/interface/ProductID.h" #include "FWCore/Utilities/interface/do_nothing_deleter.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/TypeID.h" static const edm::ProductID s_id; static edm::ProductDescription const s_branch = edm::ProductDescription(edm::ProductDescription()); static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch, edm::do_nothing_deleter()), s_id); namespace fwlite { EventBase::EventBase() {} EventBase::~EventBase() {} edm::BasicHandle EventBase::getByLabelImpl(std::type_info const& iWrapperInfo, std::type_info const& /*iProductInfo*/, const edm::InputTag& iTag) const { edm::WrapperBase const* prod = nullptr; void* prodPtr = ∏ getByLabel(iWrapperInfo, iTag.label().c_str(), iTag.instance().empty() ? static_cast<char const*>(nullptr) : iTag.instance().c_str(), iTag.process().empty() ? static_cast<char const*>(nullptr) : iTag.process().c_str(), prodPtr); if (prod == nullptr || !prod->isPresent()) { edm::TypeID productType(iWrapperInfo); edm::BasicHandle failed(edm::makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> { std::shared_ptr<cms::Exception> whyFailed(std::make_shared<edm::Exception>(edm::errors::ProductNotFound)); *whyFailed << "getByLabel: Found zero products matching all criteria\n" << "Looking for type: " << productType << "\n" << "Looking for module label: " << iTag.label() << "\n" << "Looking for productInstanceName: " << iTag.instance() << "\n" << (iTag.process().empty() ? "" : "Looking for process: ") << iTag.process() << "\n" << "The data is registered in the file but is not available for this event\n"; return whyFailed; })); return failed; } edm::BasicHandle value(prod, &s_prov); return value; } edm::BasicHandle EventBase::getByTokenImpl(std::type_info const& iProdInfo, edm::EDGetToken iToken) const { edm::WrapperBase const* prod = nullptr; getByTokenImp(iToken, prod); if (prod == nullptr || !prod->isPresent()) { edm::TypeID productType(iProdInfo); edm::BasicHandle failed(edm::makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> { std::shared_ptr<cms::Exception> whyFailed(std::make_shared<edm::Exception>(edm::errors::ProductNotFound)); *whyFailed << "getByToken: Found zero products matching all criteria\n" << "Looking for type: " << productType << "\n" << "The data is registered in the file but is not available for this event\n"; return whyFailed; })); return failed; } edm::BasicHandle value(prod, &s_prov); return value; } edm::BasicHandle EventBase::getImpl(std::type_info const& iProductInfo, const edm::ProductID& pid) const { edm::WrapperBase const* prod = getByProductID(pid); if (prod == nullptr || !prod->isPresent()) { edm::TypeID productType(iProductInfo); edm::BasicHandle failed(edm::makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> { std::shared_ptr<cms::Exception> whyFailed(std::make_shared<edm::Exception>(edm::errors::ProductNotFound)); *whyFailed << "EventBase::getImpl: getByProductID found no product with the\n" << "requested ProductID " << pid << "\n" << "Expected type: " << productType << "\n"; return whyFailed; })); return failed; } edm::BasicHandle value(prod, &s_prov); return value; } } // namespace fwlite