#include <MinMETProducerT.h>
Public Member Functions | |
MinMETProducerT (const edm::ParameterSet &cfg) | |
~MinMETProducerT () | |
Private Types | |
typedef std::vector< T > | METCollection |
typedef std::vector < edm::InputTag > | vInputTag |
Private Member Functions | |
void | produce (edm::Event &evt, const edm::EventSetup &es) override |
Private Attributes | |
std::string | moduleLabel_ |
vInputTag | src_ |
Produce MET object representing the minimum missing transverse energy of set of MET objects given as input
NOTE: class is templated to that it works with reco::CaloMET as well as with reco::PFMET objects as input
Definition at line 29 of file MinMETProducerT.h.
typedef std::vector<T> MinMETProducerT< T >::METCollection [private] |
Definition at line 31 of file MinMETProducerT.h.
typedef std::vector<edm::InputTag> MinMETProducerT< T >::vInputTag [private] |
Definition at line 80 of file MinMETProducerT.h.
MinMETProducerT< T >::MinMETProducerT | ( | const edm::ParameterSet & | cfg | ) | [inline, explicit] |
Definition at line 35 of file MinMETProducerT.h.
References edm::ParameterSet::getParameter(), and MinMETProducerT< T >::src_.
: moduleLabel_(cfg.getParameter<std::string>("@module_label")) { src_ = cfg.getParameter<vInputTag>("src"); produces<METCollection>(); }
MinMETProducerT< T >::~MinMETProducerT | ( | ) | [inline] |
Definition at line 42 of file MinMETProducerT.h.
{}
void MinMETProducerT< T >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [inline, override, private, virtual] |
Implements edm::EDProducer.
Definition at line 46 of file MinMETProducerT.h.
References edm::Event::getByLabel(), edm::Event::put(), and MinMETProducerT< T >::src_.
{ std::auto_ptr<METCollection> outputMETs(new METCollection()); // check that all MET collections given as input have the same number of entries int numMEtObjects = -1; for ( vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i ) { edm::Handle<METCollection> inputMETs; evt.getByLabel(*src_i, inputMETs); if ( numMEtObjects == -1 ) numMEtObjects = inputMETs->size(); else if ( numMEtObjects != (int)inputMETs->size() ) throw cms::Exception("MinMETProducer::produce") << "Mismatch in number of input MET objects !!\n"; } for ( int iMEtObject = 0; iMEtObject < numMEtObjects; ++iMEtObject ) { const T* minMET = 0; for ( vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i ) { edm::Handle<METCollection> inputMETs; evt.getByLabel(*src_i, inputMETs); const T& inputMET = inputMETs->at(iMEtObject); if ( minMET == 0 || inputMET.pt() < minMET->pt() ) minMET = &inputMET; } assert(minMET); outputMETs->push_back(T(*minMET)); } evt.put(outputMETs); }
std::string MinMETProducerT< T >::moduleLabel_ [private] |
Definition at line 78 of file MinMETProducerT.h.
vInputTag MinMETProducerT< T >::src_ [private] |
Definition at line 81 of file MinMETProducerT.h.
Referenced by MinMETProducerT< T >::MinMETProducerT(), and MinMETProducerT< T >::produce().