1 #ifndef HLTrigger_JetMET_plugins_HLTMultiplicityValueProducerFromNestedCollection_h 2 #define HLTrigger_JetMET_plugins_HLTMultiplicityValueProducerFromNestedCollection_h 14 template <
class INP_TYPE,
class OUT_TYPE>
29 template <
class INP_TYPE,
class OUT_TYPE>
32 : src_token_(consumes<INP_TYPE>(iConfig.getParameter<
edm::
InputTag>(
"src"))),
33 defaultValue_(iConfig.getParameter<OUT_TYPE>(
"defaultValue")) {
37 template <
class INP_TYPE,
class OUT_TYPE>
40 auto const& objHandle(
iEvent.getHandle(src_token_));
42 if (objHandle.isValid()) {
43 LogDebug(
"Input") <<
"size of input collection: " << objHandle->size();
46 for (
auto const&
obj : *objHandle) {
47 objMult +=
obj.size();
50 LogDebug(
"Output") <<
"size of output objects: " << objMult;
52 iEvent.put(std::make_unique<OUT_TYPE>(objMult));
54 iEvent.put(std::make_unique<OUT_TYPE>(defaultValue_));
58 template <
class INP_TYPE,
class OUT_TYPE>
63 desc.add<OUT_TYPE>(
"defaultValue", 0)->setComment(
"default output value (used when input collection is unavailable)");
67 #endif // HLTrigger_JetMET_plugins_HLTMultiplicityValueProducerFromNestedCollection_h void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
~HLTMultiplicityValueProducerFromNestedCollection() override
OUT_TYPE const defaultValue_
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< INP_TYPE > const src_token_
HLTMultiplicityValueProducerFromNestedCollection(edm::ParameterSet const &)