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::EDConsumerBase 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 &)
 
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::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
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 CorrectedCaloMETProducer2.cc.

Member Typedef Documentation

Definition at line 37 of file CorrectedCaloMETProducer2.cc.

Constructor & Destructor Documentation

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

Definition at line 26 of file CorrectedCaloMETProducer2.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_
CorrectedCaloMETProducer2::~CorrectedCaloMETProducer2 ( )
inline

Definition at line 33 of file CorrectedCaloMETProducer2.cc.

33 { }

Member Function Documentation

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

Definition at line 71 of file CorrectedCaloMETProducer2.cc.

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

Referenced by produce().

72  {
73  std::vector<CorrMETData> corrections = srcMET.mEtCorr();
74  corrections.push_back(correction);
75  return reco::CaloMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, corrections, constructP4From(srcMET, correction), srcMET.vertex());
76  }
virtual const Point & vertex() const
vertex position (overwritten by PF...)
SpecificCaloMETData getSpecific() const
Definition: CaloMET.h:79
double sumEt() const
Definition: MET.h:48
double sumet
Definition: CorrMETData.h:21
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 78 of file CorrectedCaloMETProducer2.cc.

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

Referenced by applyCorrection().

79  {
80  double px = met.px() + correction.mex;
81  double py = met.py() + correction.mey;
82  double pt = sqrt(px*px + py*py);
83  return reco::Candidate::LorentzVector(px, py, 0., pt);
84  }
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 CorrectedCaloMETProducer2::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivatevirtual

Implements edm::EDProducer.

Definition at line 42 of file CorrectedCaloMETProducer2.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::CaloMET& srcMET = (*srcMETCollection)[0];
48 
49  CorrMETData correction = readAndSumCorrections(evt, es);
50 
51  reco::CaloMET outMET = applyCorrection(srcMET, correction);
52 
53  std::auto_ptr<METCollection> product(new METCollection);
54  product->push_back(outMET);
55  evt.put(product);
56  }
CorrMETData readAndSumCorrections(edm::Event &evt, const edm::EventSetup &es)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
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:361
a MET correction term
Definition: CorrMETData.h:15
CorrMETData CorrectedCaloMETProducer2::readAndSumCorrections ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivate

Definition at line 58 of file CorrectedCaloMETProducer2.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  }
std::vector< edm::InputTag > srcCorrections_
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

Member Data Documentation

edm::InputTag CorrectedCaloMETProducer2::src_
private

Definition at line 39 of file CorrectedCaloMETProducer2.cc.

Referenced by produce().

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

Definition at line 40 of file CorrectedCaloMETProducer2.cc.

Referenced by readAndSumCorrections().