Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-31 02:19:08

0001 // a))*- C++ -*-
0002 //
0003 // Package:     DataFormats/FWLite
0004 // Class  :     LuminosityBlockBase
0005 //
0006 /**\class LuminosityBlockBase LuminosityBlockBase.h DataFormats/FWLite/interface/LuminosityBlockBase.h
0007 
0008    Description: <one line class summary>
0009 
0010    Usage:
0011    <usage>
0012 
0013 */
0014 //
0015 // Original Author:  Eric Vaandering
0016 //         Created:  Wed Jan  13 15:01:20 EDT 2007
0017 //
0018 
0019 // system include files
0020 #include <iostream>
0021 
0022 // user include files
0023 #include "DataFormats/FWLite/interface/LuminosityBlockBase.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::ProductDescription const s_branch = edm::ProductDescription(edm::ProductDescription());
0031 static const edm::Provenance s_prov(std::shared_ptr<edm::ProductDescription const>(&s_branch,
0032                                                                                    edm::do_nothing_deleter()),
0033                                     s_id);
0034 
0035 namespace fwlite {
0036   LuminosityBlockBase::LuminosityBlockBase() {}
0037 
0038   LuminosityBlockBase::~LuminosityBlockBase() {}
0039 
0040   edm::BasicHandle LuminosityBlockBase::getByLabelImpl(std::type_info const& iWrapperInfo,
0041                                                        std::type_info const& /*iProductInfo*/,
0042                                                        const edm::InputTag& iTag) const {
0043     edm::WrapperBase* prod = nullptr;
0044     void* prodPtr = &prod;
0045     getByLabel(iWrapperInfo,
0046                iTag.label().c_str(),
0047                iTag.instance().empty() ? static_cast<char const*>(nullptr) : iTag.instance().c_str(),
0048                iTag.process().empty() ? static_cast<char const*>(nullptr) : iTag.process().c_str(),
0049                prodPtr);
0050     if (prod == nullptr || !prod->isPresent()) {
0051       edm::TypeID productType(iWrapperInfo);
0052 
0053       edm::BasicHandle failed(edm::makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
0054         std::shared_ptr<cms::Exception> whyFailed(std::make_shared<edm::Exception>(edm::errors::ProductNotFound));
0055         *whyFailed << "getByLabel: Found zero products matching all criteria\n"
0056                    << "Looking for type: " << productType << "\n"
0057                    << "Looking for module label: " << iTag.label() << "\n"
0058                    << "Looking for productInstanceName: " << iTag.instance() << "\n"
0059                    << (iTag.process().empty() ? "" : "Looking for process: ") << iTag.process() << "\n";
0060         return whyFailed;
0061       }));
0062       return failed;
0063     }
0064     edm::BasicHandle value(prod, &s_prov);
0065     return value;
0066   }
0067 }  // namespace fwlite