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
CorrectedPFMETProducer2 Class Reference
Inheritance diagram for CorrectedPFMETProducer2:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CorrectedPFMETProducer2 (const edm::ParameterSet &cfg)
 
 ~CorrectedPFMETProducer2 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector< reco::PFMETMETCollection
 

Private Member Functions

reco::PFMET applyCorrection (const reco::PFMET &srcMET, const CorrMETData &correction)
 
reco::Candidate::LorentzVector constructP4From (const reco::PFMET &met, const CorrMETData &correction)
 
void produce (edm::Event &evt, const edm::EventSetup &es)
 
CorrMETData readAndSumCorrections (edm::Event &evt, const edm::EventSetup &es)
 

Private Attributes

edm::InputTag src_
 
std::vector< edm::InputTagsrcCorrections_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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

Definition at line 21 of file CorrectedPFMETProducer2.cc.

Member Typedef Documentation

Definition at line 37 of file CorrectedPFMETProducer2.cc.

Constructor & Destructor Documentation

CorrectedPFMETProducer2::CorrectedPFMETProducer2 ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 26 of file CorrectedPFMETProducer2.cc.

27  : src_(cfg.getParameter<edm::InputTag>("src")),
28  srcCorrections_(cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections"))
29  {
30  produces<METCollection>("");
31  }
T getParameter(std::string const &) const
std::vector< edm::InputTag > srcCorrections_
CorrectedPFMETProducer2::~CorrectedPFMETProducer2 ( )
inline

Definition at line 33 of file CorrectedPFMETProducer2.cc.

33 { }

Member Function Documentation

reco::PFMET CorrectedPFMETProducer2::applyCorrection ( const reco::PFMET srcMET,
const CorrMETData correction 
)
inlineprivate

Definition at line 71 of file CorrectedPFMETProducer2.cc.

References constructP4From(), reco::PFMET::getSpecific(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

Referenced by produce().

72  {
73  return reco::PFMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, constructP4From(srcMET, correction), srcMET.vertex());
74  }
SpecificPFMETData getSpecific() const
Definition: PFMET.h:72
virtual const Point & vertex() const
vertex position (overwritten by PF...)
double sumEt() const
Definition: MET.h:48
double sumet
Definition: CorrMETData.h:21
reco::Candidate::LorentzVector constructP4From(const reco::PFMET &met, const CorrMETData &correction)
reco::Candidate::LorentzVector CorrectedPFMETProducer2::constructP4From ( const reco::PFMET met,
const CorrMETData correction 
)
inlineprivate

Definition at line 76 of file CorrectedPFMETProducer2.cc.

References CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and mathSSE::sqrt().

Referenced by applyCorrection().

77  {
78  double px = met.px() + correction.mex;
79  double py = met.py() + correction.mey;
80  double pt = sqrt(px*px + py*py);
81  return reco::Candidate::LorentzVector(px, py, 0., pt);
82  }
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
T sqrt(T t)
Definition: SSEVec.h:48
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
double mey
Definition: CorrMETData.h:19
double mex
Definition: CorrMETData.h:18
void CorrectedPFMETProducer2::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivatevirtual

Implements edm::EDProducer.

Definition at line 42 of file CorrectedPFMETProducer2.cc.

References applyCorrection(), edm::Event::getByLabel(), edm::Event::put(), readAndSumCorrections(), and src_.

43  {
44  edm::Handle<METCollection> srcMETCollection;
45  evt.getByLabel(src_, srcMETCollection);
46 
47  const reco::PFMET& srcMET = (*srcMETCollection)[0];
48 
49  CorrMETData correction = readAndSumCorrections(evt, es);
50 
51  reco::PFMET outMET = applyCorrection(srcMET, correction);
52 
53  std::auto_ptr<METCollection> product(new METCollection);
54  product->push_back(outMET);
55  evt.put(product);
56  }
reco::PFMET applyCorrection(const reco::PFMET &srcMET, const CorrMETData &correction)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
Collection of MET.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
a MET correction term
Definition: CorrMETData.h:15
CorrMETData readAndSumCorrections(edm::Event &evt, const edm::EventSetup &es)
CorrMETData CorrectedPFMETProducer2::readAndSumCorrections ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivate

Definition at line 58 of file CorrectedPFMETProducer2.cc.

References corr, edm::Event::getByLabel(), run_regression::ret, and srcCorrections_.

Referenced by produce().

59  {
61 
63  for (std::vector<edm::InputTag>::const_iterator inputTag = srcCorrections_.begin(); inputTag != srcCorrections_.end(); ++inputTag)
64  {
65  evt.getByLabel(*inputTag, corr);
66  ret += (*corr);
67  }
68  return ret;
69  }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
JetCorrectorParameters corr
Definition: classes.h:11
a MET correction term
Definition: CorrMETData.h:15
std::vector< edm::InputTag > srcCorrections_

Member Data Documentation

edm::InputTag CorrectedPFMETProducer2::src_
private

Definition at line 39 of file CorrectedPFMETProducer2.cc.

Referenced by produce().

std::vector<edm::InputTag> CorrectedPFMETProducer2::srcCorrections_
private

Definition at line 40 of file CorrectedPFMETProducer2.cc.

Referenced by readAndSumCorrections().