CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::RecoMETExtractor Class Reference

Retrieves the recoMET from a pat::MET. More...

#include "PhysicsTools/PatAlgos/interface/RecoMETExtractor.h"

Inheritance diagram for pat::RecoMETExtractor:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 RecoMETExtractor (const edm::ParameterSet &iConfig)
 
 ~RecoMETExtractor () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

pat::MET::METCorrectionLevel corLevel_
 
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Retrieves the recoMET from a pat::MET.

The RecoMETExtractor produces the analysis-level pat::MET starting from a collection of objects of METType.

Author
Matthieu Marionneau
Version
Id
RecoMETExtractor.h,v 1.0 2015/07/22 mmarionn Exp

Definition at line 26 of file RecoMETExtractor.h.

Constructor & Destructor Documentation

◆ RecoMETExtractor()

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

Definition at line 10 of file RecoMETExtractor.cc.

10  {
11  edm::InputTag metIT = iConfig.getParameter<edm::InputTag>("metSource");
12  metSrcToken_ = consumes<pat::METCollection>(metIT);
13 
14  std::string corLevel = iConfig.getParameter<std::string>("correctionLevel");
15 
16  //all possible met flavors
17  if (corLevel == "raw") {
19  } else if (corLevel == "type1") {
21  } else if (corLevel == "type01") {
23  } else if (corLevel == "typeXY") {
25  } else if (corLevel == "type1XY") {
27  } else if (corLevel == "type01XY") {
29  } else if (corLevel == "type1Smear") {
31  } else if (corLevel == "type01Smear") {
33  } else if (corLevel == "type1SmearXY") {
35  } else if (corLevel == "type01SmearXY") {
37  } else if (corLevel == "rawCalo") {
39  } else if (corLevel == "rawDeepResponseTune") {
41  } else if (corLevel == "rawDeepResolutionTune") {
43  } else {
44  //throw exception
45  }
46 
47  // produces vector of recoMet
48  produces<std::vector<reco::MET> >();
49 }

References corLevel_, edm::ParameterSet::getParameter(), metSrcToken_, pat::MET::Raw, pat::MET::RawCalo, pat::MET::RawDeepResolutionTune, pat::MET::RawDeepResponseTune, AlCaHLTBitMon_QueryRunRegistry::string, pat::MET::Type01, pat::MET::Type01Smear, pat::MET::Type01SmearXY, pat::MET::Type01XY, pat::MET::Type1, pat::MET::Type1Smear, pat::MET::Type1SmearXY, pat::MET::Type1XY, and pat::MET::TypeXY.

◆ ~RecoMETExtractor()

RecoMETExtractor::~RecoMETExtractor ( )
override

Definition at line 51 of file RecoMETExtractor.cc.

51 {}

Member Function Documentation

◆ produce()

void RecoMETExtractor::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 53 of file RecoMETExtractor.cc.

53  {
55  iEvent.getByToken(metSrcToken_, src);
56  if (src->empty())
57  edm::LogError("RecoMETExtractor::produce") << "input reco MET collection is empty";
58 
59  std::vector<reco::MET>* metCol = new std::vector<reco::MET>();
60 
61  reco::MET met(src->front().corSumEt(corLevel_), src->front().corP4(corLevel_), src->front().vertex());
62 
63  metCol->push_back(met);
64 
65  std::unique_ptr<std::vector<reco::MET> > recoMETs(metCol);
66  iEvent.put(std::move(recoMETs));
67 }

References corLevel_, iEvent, BTaggingMonitor_cfi::met, metSrcToken_, eostools::move(), and TrackRefitter_38T_cff::src.

Member Data Documentation

◆ corLevel_

pat::MET::METCorrectionLevel pat::RecoMETExtractor::corLevel_
private

Definition at line 36 of file RecoMETExtractor.h.

Referenced by produce(), and RecoMETExtractor().

◆ metSrcToken_

edm::EDGetTokenT<std::vector<pat::MET> > pat::RecoMETExtractor::metSrcToken_
private

Definition at line 34 of file RecoMETExtractor.h.

Referenced by produce(), and RecoMETExtractor().

pat::RecoMETExtractor::corLevel_
pat::MET::METCorrectionLevel corLevel_
Definition: RecoMETExtractor.h:36
pat::MET::Type01XY
Definition: MET.h:179
pat::MET::Type1Smear
Definition: MET.h:180
pat::MET::Type01SmearXY
Definition: MET.h:183
edm::Handle
Definition: AssociativeIterator.h:50
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
reco::MET
Definition: MET.h:41
pat::MET::Type01Smear
Definition: MET.h:181
pat::MET::RawDeepResponseTune
Definition: MET.h:187
pat::MET::Raw
Definition: MET.h:174
pat::MET::RawCalo
Definition: MET.h:184
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
pat::MET::Type01
Definition: MET.h:176
pat::MET::Type1SmearXY
Definition: MET.h:182
pat::MET::Type1
Definition: MET.h:175
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::RecoMETExtractor::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition: RecoMETExtractor.h:34
pat::MET::TypeXY
Definition: MET.h:177
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
pat::MET::Type1XY
Definition: MET.h:178
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
pat::MET::RawDeepResolutionTune
Definition: MET.h:188