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

Public Member Functions

 AddCorrectionsToCaloMET (const edm::ParameterSet &cfg)
 
 ~AddCorrectionsToCaloMET ()
 
- 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
 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
 
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::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) 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 AddCorrectionsToCaloMET.cc.

Member Typedef Documentation

Definition at line 42 of file AddCorrectionsToCaloMET.cc.

Constructor & Destructor Documentation

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

Definition at line 25 of file AddCorrectionsToCaloMET.cc.

References corrTokens_, and edm::ParameterSet::getParameter().

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

Definition at line 38 of file AddCorrectionsToCaloMET.cc.

38 { }

Member Function Documentation

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

Definition at line 78 of file AddCorrectionsToCaloMET.cc.

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

Referenced by produce().

79  {
80  std::vector<CorrMETData> corrections = srcMET.mEtCorr();
81  corrections.push_back(correction);
82  return reco::CaloMET(srcMET.getSpecific(), srcMET.sumEt() + correction.sumet, corrections, constructP4From(srcMET, correction), srcMET.vertex());
83  }
reco::Candidate::LorentzVector constructP4From(const reco::CaloMET &met, const CorrMETData &correction)
virtual const Point & vertex() const
vertex position (overwritten by PF...)
SpecificCaloMETData getSpecific() const
Definition: CaloMET.h:79
double sumEt() const
Definition: MET.h:53
double sumet
Definition: CorrMETData.h:20
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:67
reco::Candidate::LorentzVector AddCorrectionsToCaloMET::constructP4From ( const reco::CaloMET met,
const CorrMETData correction 
)
inlineprivate

Definition at line 85 of file AddCorrectionsToCaloMET.cc.

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

Referenced by applyCorrection().

86  {
87  double px = met.px() + correction.mex;
88  double py = met.py() + correction.mey;
89  double pt = sqrt(px*px + py*py);
90  return reco::Candidate::LorentzVector(px, py, 0., pt);
91  }
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:41
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
virtual double py() const
y coordinate of momentum vector
void AddCorrectionsToCaloMET::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivatevirtual

Implements edm::EDProducer.

Definition at line 47 of file AddCorrectionsToCaloMET.cc.

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

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

Definition at line 63 of file AddCorrectionsToCaloMET.cc.

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

Referenced by produce().

64  {
66 
68  for (std::vector<edm::EDGetTokenT<CorrMETData> >::const_iterator corrToken = corrTokens_.begin(); corrToken != corrTokens_.end(); ++corrToken)
69  {
70  evt.getByToken(*corrToken, corr);
71  ret += (*corr);
72  }
73 
74 
75  return ret;
76  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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> > AddCorrectionsToCaloMET::corrTokens_
private

Definition at line 45 of file AddCorrectionsToCaloMET.cc.

Referenced by AddCorrectionsToCaloMET(), and readAndSumCorrections().

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

Definition at line 44 of file AddCorrectionsToCaloMET.cc.

Referenced by produce().