12 #include "DataFormats/TestObjects/interface/Thing.h" 13 #include "DataFormats/TestObjects/interface/ThingCollection.h" 14 #include "DataFormats/TestObjects/interface/TrackOfThings.h" 20 bool threwException =
false;
26 <<
"Got edm::Exception with category code " << ex.
categoryCode() <<
" expected " << code <<
" message:\n" 29 threwException =
true;
31 if (not threwException) {
32 throw cms::Exception(
"TestFailure") <<
"Expected edm::Exception, but was not thrown";
54 : parentToken_{consumes<ThingCollection>(
pset.getParameter<
edm::InputTag>(
"parentTag"))},
55 thinnedToken_{consumes<ThingCollection>(
pset.getParameter<
edm::InputTag>(
"thinnedTag"))},
56 unrelatedToken_{consumes<ThingCollection>(
pset.getParameter<
edm::InputTag>(
"unrelatedTag"))},
57 trackToken_{consumes<TrackOfThingsCollection>(
pset.getParameter<
edm::InputTag>(
"trackTag"))} {}
83 if (
auto invalidParentRef =
85 invalidParentRef.isNonnull()) {
86 throw cms::Exception(
"TestFailure") <<
"Expected to get Null Ref when passing in a Ref to unrelated parent " 87 "collection, got a non-null Ref instead";
92 if (parentRef1.id() !=
track.ref1.id()) {
94 <<
"Ref1-to-parent ProductID " << parentRef1.id() <<
" expected " <<
track.ref1.id();
96 if (parentRef1.key() !=
track.ref1.key()) {
98 <<
"Ref1-to-parent key " << parentRef1.key() <<
" expected " <<
track.ref1.key();
102 if (thinnedRef1.id() != thinnedRefProd.id()) {
104 <<
"Ref1-to-thinned ProductID " << thinnedRef1.id() <<
" expected " << thinnedRefProd.id();
111 invalidThinnedRef.isNonnull()) {
112 throw cms::Exception(
"TestFailure") <<
"Expected to get Null Ref when passing in a RefProd to unrelated " 113 "thinned collection, got a non-null Ref instead";
virtual std::string explainSelf() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Code categoryCode() const
EDProductGetter const * productGetter() const
Accessor for product getter.
ThinnedRefFromTestAnalyzer(edm::ParameterSet const &pset)
const edm::EDGetTokenT< ThingCollection > thinnedToken_
const edm::EDGetTokenT< ThingCollection > unrelatedToken_
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
Ref< C, T, F > thinnedRefFrom(Ref< C, T, F > const &parent, RefProd< C > const &thinned, edm::EDProductGetter const &prodGetter)
Return a Ref to thinned collection corresponding to an element of the Ref to parent collection...
Ref< C, T, F > tryThinnedRefFrom(Ref< C, T, F > const &parent, RefProd< C > const &thinned, edm::EDProductGetter const &prodGetter)
Return a Ref to thinned collection corresponding to an element of the Ref to parent collection...
const edm::EDGetTokenT< ThingCollection > parentToken_
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
const edm::EDGetTokenT< TrackOfThingsCollection > trackToken_
void analyze(edm::StreamID streamID, edm::Event const &e, edm::EventSetup const &c) const override