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<>

Public Member Functions

 MinMETProducerT (const edm::ParameterSet &cfg)
 
 ~MinMETProducerT () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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

◆ METCollection

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

Definition at line 29 of file MinMETProducerT.h.

◆ vInputTag

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

Definition at line 82 of file MinMETProducerT.h.

◆ vInputToken

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

Definition at line 84 of file MinMETProducerT.h.

Constructor & Destructor Documentation

◆ MinMETProducerT()

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

Definition at line 32 of file MinMETProducerT.h.

33  : moduleLabel_(cfg.getParameter<std::string>("@module_label")) {
34  src_ = cfg.getParameter<vInputTag>("src");
35 
36  for (vInputTag::const_iterator src_i = src_.begin(); src_i != src_.end(); ++src_i) {
37  src_token_.push_back(consumes<METCollection>(*src_i));
38  }
39  produces<METCollection>();
40  }

References looper::cfg, MinMETProducerT< T >::src_, and MinMETProducerT< T >::src_token_.

◆ ~MinMETProducerT()

template<typename T >
MinMETProducerT< T >::~MinMETProducerT ( )
inlineoverride

Definition at line 41 of file MinMETProducerT.h.

41 {}

Member Function Documentation

◆ produce()

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

Definition at line 44 of file MinMETProducerT.h.

44  {
45  auto outputMETs = std::make_unique<METCollection>();
46 
47  // check that all MET collections given as input have the same number of entries
48  int numMEtObjects = -1;
49  // for ( vInputTag::const_iterator src_i = src_.begin();
50  // src_i != src_.end(); ++src_i ) {
51  for (typename vInputToken::const_iterator src_i = src_token_.begin(); src_i != src_token_.end(); ++src_i) {
53  // evt.getByLabel(*src_i, inputMETs);
54  evt.getByToken(*src_i, inputMETs);
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";
59  }
60 
61  for (int iMEtObject = 0; iMEtObject < numMEtObjects; ++iMEtObject) {
62  const T* minMET = nullptr;
63  // for ( vInputTag::const_iterator src_i = src_.begin();
64  // src_i != src_.end(); ++src_i ) {
65  for (typename vInputToken::const_iterator src_i = src_token_.begin(); src_i != src_token_.end(); ++src_i) {
67  // evt.getByLabel(*src_i, inputMETs);
68  evt.getByToken(*src_i, inputMETs);
69  const T& inputMET = inputMETs->at(iMEtObject);
70  if (minMET == nullptr || inputMET.pt() < minMET->pt())
71  minMET = &inputMET;
72  }
73  assert(minMET);
74  outputMETs->push_back(T(*minMET));
75  }
76 
77  evt.put(std::move(outputMETs));
78  }

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

Member Data Documentation

◆ moduleLabel_

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

◆ src_

template<typename T >
vInputTag MinMETProducerT< T >::src_
private

Definition at line 83 of file MinMETProducerT.h.

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

◆ src_token_

template<typename T >
vInputToken MinMETProducerT< T >::src_token_
private
MinMETProducerT::src_
vInputTag src_
Definition: MinMETProducerT.h:83
MinMETProducerT::moduleLabel_
std::string moduleLabel_
Definition: MinMETProducerT.h:80
cms::cuda::assert
assert(be >=bs)
edm::Handle
Definition: AssociativeIterator.h:50
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
MinMETProducerT::src_token_
vInputToken src_token_
Definition: MinMETProducerT.h:85
JetEnergyShift_cfi.inputMETs
inputMETs
Definition: JetEnergyShift_cfi.py:5
MinMETProducerT::vInputTag
std::vector< edm::InputTag > vInputTag
Definition: MinMETProducerT.h:82
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
cms::Exception
Definition: Exception.h:70