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 ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector< TMETCollection
 
typedef std::vector
< edm::InputTag
vInputTag
 
typedef std::vector
< edm::EDGetTokenT
< METCollection > > 
vInputToken
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es) override
 

Private Attributes

std::string moduleLabel_
 
vInputTag src_
 
vInputToken src_token_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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

Definition at line 28 of file MinMETProducerT.h.

Member Typedef Documentation

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

Definition at line 30 of file MinMETProducerT.h.

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

Definition at line 88 of file MinMETProducerT.h.

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

Definition at line 90 of file MinMETProducerT.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file MinMETProducerT.h.

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

34  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
35  {
36  src_ = cfg.getParameter<vInputTag>("src");
37 
38  for ( vInputTag::const_iterator src_i = src_.begin();
39  src_i != src_.end(); ++src_i ) {
40  src_token_.push_back( consumes<METCollection>(*src_i) );
41  }
42  produces<METCollection>();
43  }
T getParameter(std::string const &) const
std::vector< edm::InputTag > vInputTag
vInputToken src_token_
std::string moduleLabel_
template<typename T >
MinMETProducerT< T >::~MinMETProducerT ( )
inline

Definition at line 44 of file MinMETProducerT.h.

44 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 48 of file MinMETProducerT.h.

References edm::Event::getByToken(), edm::Event::put(), and MinMETProducerT< T >::src_token_.

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

Member Data Documentation

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

Definition at line 89 of file MinMETProducerT.h.

Referenced by MinMETProducerT< T >::MinMETProducerT().

template<typename T >
vInputToken MinMETProducerT< T >::src_token_
private