CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes
METCorrectionAlgorithm Class Reference

#include <METCorrectionAlgorithm.h>

Classes

struct  type2BinningEntryType
 

Public Member Functions

CorrMETData compMETCorrection (edm::Event &, const edm::EventSetup &)
 
 METCorrectionAlgorithm (const edm::ParameterSet &)
 
 ~METCorrectionAlgorithm ()
 

Private Types

typedef std::vector
< edm::InputTag
vInputTag
 
typedef std::vector< std::string > vstring
 

Private Attributes

bool applyType0Corrections_
 
bool applyType1Corrections_
 
bool applyType2Corrections_
 
vInputTag srcCHSSums_
 
vInputTag srcType1Corrections_
 
double type0Cuncl_
 
double type0Rsoft_
 
std::vector
< type2BinningEntryType * > 
type2Binning_
 

Detailed Description

Algorithm for o propagating jet energy corrections to MET (Type 1 MET corrections) o calibrating momentum of particles not within jets ("unclustered energy") and propagating those corrections to MET (Type 2 MET corrections)

Authors
Michael Schmitt, Richard Cavanaugh, The University of Florida Florent Lacroix, University of Illinois at Chicago Christian Veelken, LLR Tai Sakuma, Texas A&M
Version
Revision:
1.3
Id:
METCorrectionAlgorithm.h,v 1.3 2011/12/09 00:02:05 sakuma Exp

Definition at line 33 of file METCorrectionAlgorithm.h.

Member Typedef Documentation

typedef std::vector<edm::InputTag> METCorrectionAlgorithm::vInputTag
private

Definition at line 44 of file METCorrectionAlgorithm.h.

typedef std::vector<std::string> METCorrectionAlgorithm::vstring
private

Definition at line 55 of file METCorrectionAlgorithm.h.

Constructor & Destructor Documentation

METCorrectionAlgorithm::METCorrectionAlgorithm ( const edm::ParameterSet cfg)
explicit

Definition at line 9 of file METCorrectionAlgorithm.cc.

References applyType0Corrections_, applyType1Corrections_, applyType2Corrections_, data, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), srcCHSSums_, srcType1Corrections_, type0Cuncl_, type0Rsoft_, and type2Binning_.

10 {
11  applyType1Corrections_ = cfg.getParameter<bool>("applyType1Corrections");
12  if ( applyType1Corrections_ ) {
13  srcType1Corrections_ = cfg.getParameter<vInputTag>("srcType1Corrections");
14  }
15 
16  applyType2Corrections_ = cfg.getParameter<bool>("applyType2Corrections");
17  if ( applyType2Corrections_ ) {
18  vInputTag srcUnclEnergySums = cfg.getParameter<vInputTag>("srcUnclEnergySums");
19 
20  if ( cfg.exists("type2Binning") ) {
21  typedef std::vector<edm::ParameterSet> vParameterSet;
22  vParameterSet cfgType2Binning = cfg.getParameter<vParameterSet>("type2Binning");
23  for ( vParameterSet::const_iterator cfgType2BinningEntry = cfgType2Binning.begin();
24  cfgType2BinningEntry != cfgType2Binning.end(); ++cfgType2BinningEntry ) {
25  type2Binning_.push_back(new type2BinningEntryType(*cfgType2BinningEntry, srcUnclEnergySums));
26  }
27  } else {
28  std::string type2CorrFormula = cfg.getParameter<std::string>("type2CorrFormula").data();
29  edm::ParameterSet type2CorrParameter = cfg.getParameter<edm::ParameterSet>("type2CorrParameter");
30  type2Binning_.push_back(new type2BinningEntryType(type2CorrFormula, type2CorrParameter, srcUnclEnergySums));
31  }
32  }
33 
34  applyType0Corrections_ = cfg.exists("applyType0Corrections") ? cfg.getParameter<bool>("applyType0Corrections") : false;
35  if ( applyType0Corrections_ ) {
36  srcCHSSums_ = cfg.getParameter<vInputTag>("srcCHSSums");
37  type0Rsoft_ = cfg.getParameter<double>("type0Rsoft");
38  type0Cuncl_ = 1.0;
40  if (cfg.exists("type2Binning")) throw cms::Exception("Invalid Arg") << "Currently, applyType0Corrections and type2Binning cannot be used together!";
41  std::string type2CorrFormula = cfg.getParameter<std::string>("type2CorrFormula").data();
42  if (!(type2CorrFormula == "A")) throw cms::Exception("Invalid Arg") << "type2CorrFormula must be \"A\" if applyType0Corrections!";
43  edm::ParameterSet type2CorrParameter = cfg.getParameter<edm::ParameterSet>("type2CorrParameter");
44  type0Cuncl_ = type2CorrParameter.getParameter<double>("A");
45  }
46  }
47 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< edm::InputTag > vInputTag
std::vector< type2BinningEntryType * > type2Binning_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
METCorrectionAlgorithm::~METCorrectionAlgorithm ( )

Definition at line 49 of file METCorrectionAlgorithm.cc.

References type2Binning_.

50 {
51  for ( std::vector<type2BinningEntryType*>::const_iterator it = type2Binning_.begin();
52  it != type2Binning_.end(); ++it ) {
53  delete (*it);
54  }
55 }
std::vector< type2BinningEntryType * > type2Binning_

Member Function Documentation

CorrMETData METCorrectionAlgorithm::compMETCorrection ( edm::Event evt,
const edm::EventSetup es 
)

Definition at line 57 of file METCorrectionAlgorithm.cc.

References applyType0Corrections_, applyType1Corrections_, applyType2Corrections_, edm::Event::getByLabel(), CorrMETData::mex, CorrMETData::mey, mathSSE::sqrt(), srcCHSSums_, srcType1Corrections_, CorrMETData::sumet, type0Cuncl_, type0Rsoft_, and type2Binning_.

Referenced by CorrectedMETProducerT< T >::produce().

58 {
59  CorrMETData metCorr;
60  metCorr.mex = 0.;
61  metCorr.mey = 0.;
62  metCorr.sumet = 0.;
63 
64  if ( applyType0Corrections_ ) {
65 //--- sum all Type 0 MET correction terms
66  for ( vInputTag::const_iterator srcCHSSum = srcCHSSums_.begin();
67  srcCHSSum != srcCHSSums_.end(); ++srcCHSSum ) {
69  evt.getByLabel(*srcCHSSum, chsSum);
70 
71  metCorr.mex += type0Cuncl_*(1 - type0Rsoft_)*chsSum->mex;
72  metCorr.mey += type0Cuncl_*(1 - type0Rsoft_)*chsSum->mey;
73  metCorr.sumet += type0Cuncl_*(1 - type0Rsoft_)*chsSum->sumet;
74  }
75  }
76 
77  if ( applyType1Corrections_ ) {
78 //--- sum all Type 1 MET correction terms
79  for ( vInputTag::const_iterator srcType1Correction = srcType1Corrections_.begin();
80  srcType1Correction != srcType1Corrections_.end(); ++srcType1Correction ) {
81  edm::Handle<CorrMETData> type1Correction;
82  evt.getByLabel(*srcType1Correction, type1Correction);
83 
84  metCorr.mex += type1Correction->mex;
85  metCorr.mey += type1Correction->mey;
86  metCorr.sumet += type1Correction->sumet;
87  }
88  }
89 
90  if ( applyType2Corrections_ ) {
91 //--- compute momentum sum of all "unclustered energy" in the event
92 //
93 // NOTE: calibration factors/formulas for Type 2 MET correction may depend on eta
94 // (like the jet energy correction factors do)
95 //
96  for ( std::vector<type2BinningEntryType*>::const_iterator type2BinningEntry = type2Binning_.begin();
97  type2BinningEntry != type2Binning_.end(); ++type2BinningEntry ) {
98  CorrMETData unclEnergySum;
99  for ( vInputTag::const_iterator srcUnclEnergySum = (*type2BinningEntry)->srcUnclEnergySums_.begin();
100  srcUnclEnergySum != (*type2BinningEntry)->srcUnclEnergySums_.end(); ++srcUnclEnergySum ) {
101  edm::Handle<CorrMETData> unclEnergySummand;
102  evt.getByLabel(*srcUnclEnergySum, unclEnergySummand);
103 
104  unclEnergySum.mex += unclEnergySummand->mex;
105  unclEnergySum.mey += unclEnergySummand->mey;
106  unclEnergySum.sumet += unclEnergySummand->sumet;
107  }
108 
109 //--- calibrate "unclustered energy"
110  double unclEnergySumPt = sqrt(unclEnergySum.mex*unclEnergySum.mex + unclEnergySum.mey*unclEnergySum.mey);
111  double unclEnergyScaleFactor = (*type2BinningEntry)->binCorrFormula_->Eval(unclEnergySumPt);
112 
113 //--- MET balances momentum of reconstructed particles,
114 // hence correction to "unclustered energy" and corresponding Type 2 MET correction are of opposite sign
115  metCorr.mex -= (unclEnergyScaleFactor - 1.)*unclEnergySum.mex;
116  metCorr.mey -= (unclEnergyScaleFactor - 1.)*unclEnergySum.mey;
117  metCorr.sumet += (unclEnergyScaleFactor - 1.)*unclEnergySum.sumet;
118  }
119  }
120 
121  return metCorr;
122 }
T sqrt(T t)
Definition: SSEVec.h:46
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double sumet
Definition: CorrMETData.h:26
std::vector< type2BinningEntryType * > type2Binning_
Structure containing data common to all types of MET.
Definition: CorrMETData.h:20
double mey
Definition: CorrMETData.h:25
double mex
Definition: CorrMETData.h:24

Member Data Documentation

bool METCorrectionAlgorithm::applyType0Corrections_
private

Definition at line 48 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

bool METCorrectionAlgorithm::applyType1Corrections_
private

Definition at line 49 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

bool METCorrectionAlgorithm::applyType2Corrections_
private

Definition at line 50 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

vInputTag METCorrectionAlgorithm::srcCHSSums_
private

Definition at line 45 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

vInputTag METCorrectionAlgorithm::srcType1Corrections_
private

Definition at line 46 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

double METCorrectionAlgorithm::type0Cuncl_
private

Definition at line 53 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

double METCorrectionAlgorithm::type0Rsoft_
private

Definition at line 52 of file METCorrectionAlgorithm.h.

Referenced by compMETCorrection(), and METCorrectionAlgorithm().

std::vector<type2BinningEntryType*> METCorrectionAlgorithm::type2Binning_
private