1 #ifndef RecoMET_METProducers_MinMETProducerT_h
2 #define RecoMET_METProducers_MinMETProducerT_h
36 for (vInputTag::const_iterator src_i =
src_.begin(); src_i !=
src_.end(); ++src_i) {
37 src_token_.push_back(consumes<METCollection>(*src_i));
39 produces<METCollection>();
45 auto outputMETs = std::make_unique<METCollection>();
48 int numMEtObjects = -1;
51 for (
typename vInputToken::const_iterator src_i =
src_token_.begin(); src_i !=
src_token_.end(); ++src_i) {
55 if (numMEtObjects == -1)
56 numMEtObjects = inputMETs->size();
57 else if (numMEtObjects != (
int)inputMETs->size())
58 throw cms::Exception(
"MinMETProducer::produce") <<
"Mismatch in number of input MET objects !!\n";
61 for (
int iMEtObject = 0; iMEtObject < numMEtObjects; ++iMEtObject) {
62 const T* minMET =
nullptr;
65 for (
typename vInputToken::const_iterator src_i =
src_token_.begin(); src_i !=
src_token_.end(); ++src_i) {
69 const T& inputMET = inputMETs->at(iMEtObject);
70 if (minMET ==
nullptr || inputMET.pt() < minMET->pt())
74 outputMETs->push_back(
T(*minMET));
84 typedef std::vector<edm::EDGetTokenT<METCollection> >
vInputToken;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< edm::InputTag > vInputTag
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MinMETProducerT< reco::PFMET > MinPFMETProducer
std::vector< T > METCollection
std::vector< edm::EDGetTokenT< METCollection > > vInputToken
~MinMETProducerT() override
void produce(edm::Event &evt, const edm::EventSetup &es) override
MinMETProducerT< reco::CaloMET > MinCaloMETProducer
MinMETProducerT(const edm::ParameterSet &cfg)
T getParameter(std::string const &) const