CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
HLTCaloTowerHtMhtProducer Class Reference

This produces a reco::MET object that stores HT and MHT. More...

#include <HLTCaloTowerHtMhtProducer.h>

Inheritance diagram for HLTCaloTowerHtMhtProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTCaloTowerHtMhtProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~HLTCaloTowerHtMhtProducer ()
 
- 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
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< CaloTowerCollectionm_theTowersToken
 
double maxEtaTowerHt_
 Maximum (abs) eta requirement for jets. More...
 
double maxEtaTowerMht_
 
double minPtTowerHt_
 Minimum pt requirement for jets. More...
 
double minPtTowerMht_
 
edm::InputTag towersLabel_
 Input CaloTower collection. More...
 
bool usePt_
 Use pt; otherwise, use et. More...
 

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

This produces a reco::MET object that stores HT and MHT.

Author
Steven Lowette
Michele de Gruttola, Jia Fu Low (Nov 2013)
Thiago Tomei (added the "HT from CaloTower code")

HT & MHT are calculated using input CaloTower collection. HT is stored as sumet_, MHT is stored as p4_ in the output.

See header file for documentation

Author
Steven Lowette
Thiago Tomei

Definition at line 31 of file HLTCaloTowerHtMhtProducer.h.

Constructor & Destructor Documentation

HLTCaloTowerHtMhtProducer::HLTCaloTowerHtMhtProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 19 of file HLTCaloTowerHtMhtProducer.cc.

References m_theTowersToken, towersLabel_, and ~HLTCaloTowerHtMhtProducer().

19  :
20  usePt_ ( iConfig.getParameter<bool>("usePt") ),
21  minPtTowerHt_ ( iConfig.getParameter<double>("minPtTowerHt") ),
22  minPtTowerMht_ ( iConfig.getParameter<double>("minPtTowerMht") ),
23  maxEtaTowerHt_ ( iConfig.getParameter<double>("maxEtaTowerHt") ),
24  maxEtaTowerMht_ ( iConfig.getParameter<double>("maxEtaTowerMht") ),
25  towersLabel_ ( iConfig.getParameter<edm::InputTag>("towersLabel") ) {
26  m_theTowersToken = consumes<CaloTowerCollection>(towersLabel_);
27 
28  // Register the products
29  produces<reco::METCollection>();
30 }
T getParameter(std::string const &) const
double minPtTowerHt_
Minimum pt requirement for jets.
edm::InputTag towersLabel_
Input CaloTower collection.
edm::EDGetTokenT< CaloTowerCollection > m_theTowersToken
double maxEtaTowerHt_
Maximum (abs) eta requirement for jets.
bool usePt_
Use pt; otherwise, use et.
HLTCaloTowerHtMhtProducer::~HLTCaloTowerHtMhtProducer ( )
default

Member Function Documentation

void HLTCaloTowerHtMhtProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 36 of file HLTCaloTowerHtMhtProducer.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

36  {
37  // Current default is for hltHtMht
39  desc.add<bool>("usePt", false);
40  desc.add<double>("minPtTowerHt", 1.);
41  desc.add<double>("minPtTowerMht", 1.);
42  desc.add<double>("maxEtaTowerHt", 5.);
43  desc.add<double>("maxEtaTowerMht", 5.);
44  desc.add<edm::InputTag>("towersLabel", edm::InputTag("hltTowerMakerForAll"));
45  descriptions.add("hltCaloTowerHtMhtProducer", desc);
46 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTCaloTowerHtMhtProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Definition at line 49 of file HLTCaloTowerHtMhtProducer.cc.

References funct::abs(), funct::cos(), stringResolutionProvider_cfi::eta, edm::Event::getByToken(), m_theTowersToken, maxEtaTowerHt_, maxEtaTowerMht_, minPtTowerHt_, minPtTowerMht_, eostools::move(), p4, phi, EnergyCorrector::pt, edm::Event::put(), mps_fire::result, funct::sin(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), usePt_, and badGlobalMuonTaggersAOD_cff::vtx.

49  {
50 
51  // Create a pointer to the products
52  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
53 
55  iEvent.getByToken(m_theTowersToken, towers);
56 
57  double ht = 0., mhx = 0., mhy = 0.;
58 
59  if (towers->size() > 0) {
60  for(auto const & j : *towers) {
61  double pt = usePt_ ? j.pt() : j.et();
62  double eta = j.eta();
63  double phi = j.phi();
64  double px = usePt_ ? j.px() : j.et() * cos(phi);
65  double py = usePt_ ? j.py() : j.et() * sin(phi);
66 
67  if (pt > minPtTowerHt_ && std::abs(eta) < maxEtaTowerHt_) {
68  ht += pt;
69  }
70 
71  if (pt > minPtTowerMht_ && std::abs(eta) < maxEtaTowerMht_) {
72  mhx -= px;
73  mhy -= py;
74  }
75  }
76  }
77 
78  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx*mhx + mhy*mhy));
79  reco::MET::Point vtx(0, 0, 0);
80  reco::MET htmht(ht, p4, vtx);
81  result->push_back(htmht);
82 
83  // Put the products into the Event
84  iEvent.put(std::move(result));
85 }
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:460
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
Definition: MET.h:42
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double minPtTowerHt_
Minimum pt requirement for jets.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
size_type size() const
edm::EDGetTokenT< CaloTowerCollection > m_theTowersToken
double maxEtaTowerHt_
Maximum (abs) eta requirement for jets.
bool usePt_
Use pt; otherwise, use et.
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<CaloTowerCollection> HLTCaloTowerHtMhtProducer::m_theTowersToken
private

Definition at line 52 of file HLTCaloTowerHtMhtProducer.h.

Referenced by HLTCaloTowerHtMhtProducer(), and produce().

double HLTCaloTowerHtMhtProducer::maxEtaTowerHt_
private

Maximum (abs) eta requirement for jets.

Definition at line 47 of file HLTCaloTowerHtMhtProducer.h.

Referenced by produce().

double HLTCaloTowerHtMhtProducer::maxEtaTowerMht_
private

Definition at line 48 of file HLTCaloTowerHtMhtProducer.h.

Referenced by produce().

double HLTCaloTowerHtMhtProducer::minPtTowerHt_
private

Minimum pt requirement for jets.

Definition at line 43 of file HLTCaloTowerHtMhtProducer.h.

Referenced by produce().

double HLTCaloTowerHtMhtProducer::minPtTowerMht_
private

Definition at line 44 of file HLTCaloTowerHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTCaloTowerHtMhtProducer::towersLabel_
private

Input CaloTower collection.

Definition at line 51 of file HLTCaloTowerHtMhtProducer.h.

Referenced by HLTCaloTowerHtMhtProducer().

bool HLTCaloTowerHtMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 40 of file HLTCaloTowerHtMhtProducer.h.

Referenced by produce().