1 #ifndef HLTrigger_JetMET_plugins_HLTMultiplicityValueProducer_h
2 #define HLTrigger_JetMET_plugins_HLTMultiplicityValueProducer_h
16 template <
class INP_TYPE,
class OUT_TYPE>
32 template <
class INP_TYPE,
class OUT_TYPE>
34 : src_token_(consumes<edm::
View<INP_TYPE>>(iConfig.getParameter<edm::
InputTag>(
"src"))),
36 defaultValue_(iConfig.getParameter<OUT_TYPE>(
"defaultValue")) {
40 template <
class INP_TYPE,
class OUT_TYPE>
44 auto const& objHandle(iEvent.
getHandle(src_token_));
46 if (objHandle.isValid()) {
47 LogDebug(
"Input") <<
"size of input collection: " << objHandle->size();
50 for (
auto const&
obj : *objHandle) {
51 if (strObjSelector_(
obj)) {
56 LogDebug(
"Output") <<
"size of selected input objects: " << objMult;
58 iEvent.
put(std::make_unique<OUT_TYPE>(objMult));
60 iEvent.
put(std::make_unique<OUT_TYPE>(defaultValue_));
64 template <
class INP_TYPE,
class OUT_TYPE>
68 desc.
add<
std::string>(
"cut",
"")->setComment(
"string for StringCutObjectSelector");
69 desc.
add<OUT_TYPE>(
"defaultValue", 0)->setComment(
"default output value (used when input collection is unavailable)");
73 #endif // HLTrigger_JetMET_plugins_HLTMultiplicityValueProducer_h
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
OUT_TYPE const defaultValue_
~HLTMultiplicityValueProducer() override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
StringCutObjectSelector< INP_TYPE, true > const strObjSelector_
HLTMultiplicityValueProducer(edm::ParameterSet const &)
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< edm::View< INP_TYPE > > const src_token_