CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MinMETProducerT< T > Class Template Reference

#include <MinMETProducerT.h>

Inheritance diagram for MinMETProducerT< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MinMETProducerT (const edm::ParameterSet &cfg)
 
 ~MinMETProducerT ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector< TMETCollection
 
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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename T>
class MinMETProducerT< T >

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

Author
Christian Veelken, LLR
Version
Revision:
1.2
Id:
MinMETProducerT.h,v 1.2 2013/03/06 19:31:56 vadler Exp

Definition at line 29 of file MinMETProducerT.h.

Member Typedef Documentation

template<typename T >
typedef std::vector<T> MinMETProducerT< T >::METCollection
private

Definition at line 31 of file MinMETProducerT.h.

template<typename T >
typedef std::vector<edm::InputTag> MinMETProducerT< T >::vInputTag
private

Definition at line 80 of file MinMETProducerT.h.

Constructor & Destructor Documentation

template<typename T >
MinMETProducerT< T >::MinMETProducerT ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 35 of file MinMETProducerT.h.

References edm::ParameterSet::getParameter(), and MinMETProducerT< T >::src_.

36  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
37  {
38  src_ = cfg.getParameter<vInputTag>("src");
39 
40  produces<METCollection>();
41  }
T getParameter(std::string const &) const
std::vector< edm::InputTag > vInputTag
std::string moduleLabel_
template<typename T >
MinMETProducerT< T >::~MinMETProducerT ( )
inline

Definition at line 42 of file MinMETProducerT.h.

42 {}

Member Function Documentation

template<typename T >
void MinMETProducerT< T >::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivatevirtual

Implements edm::EDProducer.

Definition at line 46 of file MinMETProducerT.h.

References edm::Event::getByLabel(), edm::Event::put(), and MinMETProducerT< T >::src_.

47  {
48  std::auto_ptr<METCollection> outputMETs(new METCollection());
49 
50  // check that all MET collections given as input have the same number of entries
51  int numMEtObjects = -1;
52  for ( vInputTag::const_iterator src_i = src_.begin();
53  src_i != src_.end(); ++src_i ) {
55  evt.getByLabel(*src_i, inputMETs);
56  if ( numMEtObjects == -1 ) numMEtObjects = inputMETs->size();
57  else if ( numMEtObjects != (int)inputMETs->size() )
58  throw cms::Exception("MinMETProducer::produce")
59  << "Mismatch in number of input MET objects !!\n";
60  }
61 
62  for ( int iMEtObject = 0; iMEtObject < numMEtObjects; ++iMEtObject ) {
63  const T* minMET = 0;
64  for ( vInputTag::const_iterator src_i = src_.begin();
65  src_i != src_.end(); ++src_i ) {
67  evt.getByLabel(*src_i, inputMETs);
68  const T& inputMET = inputMETs->at(iMEtObject);
69  if ( minMET == 0 || inputMET.pt() < minMET->pt() ) minMET = &inputMET;
70  }
71  assert(minMET);
72  outputMETs->push_back(T(*minMET));
73  }
74 
75  evt.put(outputMETs);
76  }
std::vector< T > METCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
long double T

Member Data Documentation

template<typename T >
std::string MinMETProducerT< T >::moduleLabel_
private
template<typename T >
vInputTag MinMETProducerT< T >::src_
private