CMS 3D CMS Logo

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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MinMETProducerT (const edm::ParameterSet &cfg)
 
 ~MinMETProducerT ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< TMETCollection
 
typedef std::vector< edm::InputTagvInputTag
 
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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 
)
inlineoverrideprivate

Definition at line 48 of file MinMETProducerT.h.

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

49  {
50  auto outputMETs = std::make_unique<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(std::move(outputMETs));
84  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
vInputToken src_token_
long double T
def move(src, dest)
Definition: eostools.py:510

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