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

Public Member Functions

 CorrectedCaloMETProducer2 (const edm::ParameterSet &cfg)
 
 ~CorrectedCaloMETProducer2 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef std::vector
< reco::CaloMET
METCollection
 

Private Member Functions

reco::CaloMET applyCorrection (const reco::CaloMET &srcMET, const CorrMETData &correction)
 
reco::Candidate::LorentzVector constructP4From (const reco::CaloMET &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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 20 of file CorrectedCaloMETProducer2.cc.

Member Typedef Documentation

Definition at line 36 of file CorrectedCaloMETProducer2.cc.

Constructor & Destructor Documentation

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

Definition at line 25 of file CorrectedCaloMETProducer2.cc.

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

Definition at line 32 of file CorrectedCaloMETProducer2.cc.

32 { }

Member Function Documentation

reco::CaloMET CorrectedCaloMETProducer2::applyCorrection ( const reco::CaloMET srcMET,
const CorrMETData correction 
)
inlineprivate

Definition at line 70 of file CorrectedCaloMETProducer2.cc.

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

Referenced by produce().

71  {
72  std::vector<CorrMETData> corrections = srcMET.mEtCorr();
73  corrections.push_back(correction);
74  return reco::CaloMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, corrections, constructP4From(srcMET, correction), srcMET.vertex());
75  }
virtual const Point & vertex() const
vertex position
SpecificCaloMETData getSpecific() const
Definition: CaloMET.h:79
double sumEt() const
Definition: MET.h:48
double sumet
Definition: CorrMETData.h:20
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:63
reco::Candidate::LorentzVector constructP4From(const reco::CaloMET &met, const CorrMETData &correction)
reco::Candidate::LorentzVector CorrectedCaloMETProducer2::constructP4From ( const reco::CaloMET met,
const CorrMETData correction 
)
inlineprivate

Definition at line 77 of file CorrectedCaloMETProducer2.cc.

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

Referenced by applyCorrection().

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

Implements edm::EDProducer.

Definition at line 41 of file CorrectedCaloMETProducer2.cc.

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

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

Definition at line 57 of file CorrectedCaloMETProducer2.cc.

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

Referenced by produce().

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

Member Data Documentation

edm::InputTag CorrectedCaloMETProducer2::src_
private

Definition at line 38 of file CorrectedCaloMETProducer2.cc.

Referenced by produce().

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

Definition at line 39 of file CorrectedCaloMETProducer2.cc.

Referenced by readAndSumCorrections().