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

Public Member Functions

 AddCorrectionsToPFMET (const edm::ParameterSet &cfg)
 
 ~AddCorrectionsToPFMET ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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) override
 
CorrMETData readAndSumCorrections (edm::Event &evt, const edm::EventSetup &es)
 

Private Attributes

std::vector< edm::EDGetTokenT
< CorrMETData > > 
corrTokens_
 
edm::EDGetTokenT< METCollectiontoken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 20 of file AddCorrectionsToPFMET.cc.

Member Typedef Documentation

typedef std::vector<reco::PFMET> AddCorrectionsToPFMET::METCollection
private

Definition at line 41 of file AddCorrectionsToPFMET.cc.

Constructor & Destructor Documentation

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

Definition at line 25 of file AddCorrectionsToPFMET.cc.

References corrTokens_, edm::ParameterSet::getParameter(), and beam_dqm_sourceclient-live_cfg::inputTag.

26  : token_(consumes<METCollection>(cfg.getParameter<edm::InputTag>("src")))
27  {
28  std::vector<edm::InputTag> corrInputTags = cfg.getParameter<std::vector<edm::InputTag> >("srcCorrections");
29  for (std::vector<edm::InputTag>::const_iterator inputTag = corrInputTags.begin(); inputTag != corrInputTags.end(); ++inputTag)
30  {
31  corrTokens_.push_back(consumes<CorrMETData>(*inputTag));
32  }
33 
34  produces<METCollection>("");
35  }
T getParameter(std::string const &) const
edm::EDGetTokenT< METCollection > token_
std::vector< edm::EDGetTokenT< CorrMETData > > corrTokens_
AddCorrectionsToPFMET::~AddCorrectionsToPFMET ( )
inline

Definition at line 37 of file AddCorrectionsToPFMET.cc.

37 { }

Member Function Documentation

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

Definition at line 76 of file AddCorrectionsToPFMET.cc.

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

Referenced by produce().

77  {
78  return reco::PFMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, constructP4From(srcMET, correction), srcMET.vertex());
79  }
SpecificPFMETData getSpecific() const
Definition: PFMET.h:72
virtual const Point & vertex() const
vertex position (overwritten by PF...)
reco::Candidate::LorentzVector constructP4From(const reco::PFMET &met, const CorrMETData &correction)
double sumEt() const
Definition: MET.h:56
double sumet
Definition: CorrMETData.h:20
reco::Candidate::LorentzVector AddCorrectionsToPFMET::constructP4From ( const reco::PFMET met,
const CorrMETData correction 
)
inlineprivate

Definition at line 81 of file AddCorrectionsToPFMET.cc.

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

Referenced by applyCorrection().

82  {
83  double px = met.px() + correction.mex;
84  double py = met.py() + correction.mey;
85  double pt = sqrt(px*px + py*py);
86  return reco::Candidate::LorentzVector(px, py, 0., pt);
87  }
T sqrt(T t)
Definition: SSEVec.h:48
virtual double px() const
x coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
virtual double py() const
y coordinate of momentum vector
void AddCorrectionsToPFMET::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivatevirtual

Implements edm::EDProducer.

Definition at line 46 of file AddCorrectionsToPFMET.cc.

References applyCorrection(), edm::Event::getByToken(), edm::Event::put(), readAndSumCorrections(), and token_.

47  {
48  edm::Handle<METCollection> srcMETCollection;
49  evt.getByToken(token_, srcMETCollection);
50 
51  const reco::PFMET& srcMET = (*srcMETCollection)[0];
52 
53  CorrMETData correction = readAndSumCorrections(evt, es);
54 
55  reco::PFMET outMET = applyCorrection(srcMET, correction);
56 
57  std::auto_ptr<METCollection> product(new METCollection);
58  product->push_back(outMET);
59  evt.put(product);
60  }
edm::EDGetTokenT< METCollection > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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:113
Collection of MET.
CorrMETData readAndSumCorrections(edm::Event &evt, const edm::EventSetup &es)
a MET correction term
Definition: CorrMETData.h:14
CorrMETData AddCorrectionsToPFMET::readAndSumCorrections ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivate

Definition at line 62 of file AddCorrectionsToPFMET.cc.

References corr, corrTokens_, edm::Event::getByToken(), and run_regression::ret.

Referenced by produce().

63  {
65 
67  for (std::vector<edm::EDGetTokenT<CorrMETData> >::const_iterator corrToken = corrTokens_.begin(); corrToken != corrTokens_.end(); ++corrToken)
68  {
69  evt.getByToken(*corrToken, corr);
70  ret += (*corr);
71  }
72 
73  return ret;
74  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
JetCorrectorParameters corr
Definition: classes.h:5
std::vector< edm::EDGetTokenT< CorrMETData > > corrTokens_
a MET correction term
Definition: CorrMETData.h:14

Member Data Documentation

std::vector<edm::EDGetTokenT<CorrMETData> > AddCorrectionsToPFMET::corrTokens_
private

Definition at line 44 of file AddCorrectionsToPFMET.cc.

Referenced by AddCorrectionsToPFMET(), and readAndSumCorrections().

edm::EDGetTokenT<METCollection> AddCorrectionsToPFMET::token_
private

Definition at line 43 of file AddCorrectionsToPFMET.cc.

Referenced by produce().