CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edmtest::TestGetByLabelAnalyzerT< T > Class Template Reference
Inheritance diagram for edmtest::TestGetByLabelAnalyzerT< T >:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &event, edm::EventSetup const &) const override
 
 TestGetByLabelAnalyzerT (edm::ParameterSet const &iPSet)
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::string const accessCategory_
 
std::string const getCategory_
 
edm::InputTag const src_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<typename T>
class edmtest::TestGetByLabelAnalyzerT< T >

Definition at line 10 of file TestGetByLabelAnalyzer.cc.

Constructor & Destructor Documentation

◆ TestGetByLabelAnalyzerT()

template<typename T >
edmtest::TestGetByLabelAnalyzerT< T >::TestGetByLabelAnalyzerT ( edm::ParameterSet const &  iPSet)
inline

Definition at line 12 of file TestGetByLabelAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter(), and edmtest::TestGetByLabelAnalyzerT< T >::src_.

13  : src_(iPSet.getUntrackedParameter<edm::InputTag>("src")),
14  getCategory_(iPSet.getUntrackedParameter<std::string>("getExceptionCategory")),
15  accessCategory_(iPSet.getUntrackedParameter<std::string>("accessExceptionCategory")) {
16  if (iPSet.getUntrackedParameter<bool>("consumes")) {
17  consumes<T>(src_);
18  }
19  }

Member Function Documentation

◆ analyze()

template<typename T >
void edmtest::TestGetByLabelAnalyzerT< T >::analyze ( edm::StreamID  ,
edm::Event const &  event,
edm::EventSetup const &   
) const
inlineoverridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 30 of file TestGetByLabelAnalyzer.cc.

References edmtest::TestGetByLabelAnalyzerT< T >::accessCategory_, validateAlignments::category, MillePedeFileConverter_cfg::e, Exception, EcalMonitorTask_cff::func, edmtest::TestGetByLabelAnalyzerT< T >::getCategory_, patZpeak::handle, edm::InputTag::instance(), edm::InputTag::label(), mps_check::msg, edmtest::TestGetByLabelAnalyzerT< T >::src_, AlCaHLTBitMon_QueryRunRegistry::string, and ctpps_dqm_sourceclient-live_cfg::test.

30  {
32 
33  auto test = [](std::string const& category, std::string const& msg, auto func) {
34  bool caught = false;
35  try {
36  func();
37  } catch (cms::Exception& e) {
38  caught = true;
39  if (category.empty())
40  throw;
41  if (e.category() != category) {
42  throw cms::Exception("Assert")
43  << "Expected cms::Exception from " << msg << " with category " << category << ", got " << e.category();
44  }
45  return false;
46  }
47  if (not category.empty() and not caught) {
48  throw cms::Exception("Assert") << "Expected cms::Exception to be thrown from " << msg << ", but got nothing";
49  }
50  return true;
51  };
52 
53  bool noException = test(getCategory_, "getByLabel(InputTag)", [&]() { event.getByLabel(src_, handle); });
54  if (noException) {
55  test(accessCategory_, "*handle from InputTag", [&]() { *handle; });
56  }
57 
58  noException =
59  test(getCategory_, "getByLabel(strings)", [&]() { event.getByLabel(src_.label(), src_.instance(), handle); });
60  if (noException) {
61  test(accessCategory_, "*handle from strings", [&]() { *handle; });
62  }
63  }
std::string const & instance() const
Definition: InputTag.h:37
std::string const & label() const
Definition: InputTag.h:36
tuple msg
Definition: mps_check.py:286

◆ fillDescriptions()

template<typename T >
static void edmtest::TestGetByLabelAnalyzerT< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 21 of file TestGetByLabelAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

21  {
23  desc.addUntracked<edm::InputTag>("src");
24  desc.addUntracked<std::string>("getExceptionCategory", "");
25  desc.addUntracked<std::string>("accessExceptionCategory", "");
26  desc.addUntracked<bool>("consumes", false);
27  descriptions.addDefault(desc);
28  }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ accessCategory_

template<typename T >
std::string const edmtest::TestGetByLabelAnalyzerT< T >::accessCategory_
private

◆ getCategory_

template<typename T >
std::string const edmtest::TestGetByLabelAnalyzerT< T >::getCategory_
private

◆ src_

template<typename T >
edm::InputTag const edmtest::TestGetByLabelAnalyzerT< T >::src_
private