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 ) {
28 std::string type2CorrFormula = cfg.
getParameter<std::string>(
"type2CorrFormula").
data();
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!";
44 type0Cuncl_ = type2CorrParameter.
getParameter<
double>(
"A");
51 for ( std::vector<type2BinningEntryType*>::const_iterator it =
type2Binning_.begin();
66 for ( vInputTag::const_iterator srcCHSSum =
srcCHSSums_.begin();
82 evt.
getByLabel(*srcType1Correction, type1Correction);
84 metCorr.
mex += type1Correction->mex;
85 metCorr.
mey += type1Correction->mey;
86 metCorr.
sumet += type1Correction->sumet;
96 for ( std::vector<type2BinningEntryType*>::const_iterator type2BinningEntry =
type2Binning_.begin();
97 type2BinningEntry !=
type2Binning_.end(); ++type2BinningEntry ) {
99 for ( vInputTag::const_iterator srcUnclEnergySum = (*type2BinningEntry)->srcUnclEnergySums_.begin();
100 srcUnclEnergySum != (*type2BinningEntry)->srcUnclEnergySums_.end(); ++srcUnclEnergySum ) {
102 evt.
getByLabel(*srcUnclEnergySum, unclEnergySummand);
104 unclEnergySum.
mex += unclEnergySummand->mex;
105 unclEnergySum.
mey += unclEnergySummand->mey;
106 unclEnergySum.
sumet += unclEnergySummand->sumet;
110 double unclEnergySumPt =
sqrt(unclEnergySum.
mex*unclEnergySum.
mex + unclEnergySum.
mey*unclEnergySum.
mey);
111 double unclEnergyScaleFactor = (*type2BinningEntry)->binCorrFormula_->Eval(unclEnergySumPt);
115 metCorr.
mex -= (unclEnergyScaleFactor - 1.)*unclEnergySum.
mex;
116 metCorr.
mey -= (unclEnergyScaleFactor - 1.)*unclEnergySum.
mey;
117 metCorr.
sumet += (unclEnergyScaleFactor - 1.)*unclEnergySum.
sumet;
T getParameter(std::string const &) const
METCorrectionAlgorithm(const edm::ParameterSet &)
CorrMETData compMETCorrection(edm::Event &, const edm::EventSetup &)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< edm::InputTag > vInputTag
~METCorrectionAlgorithm()
bool applyType0Corrections_
bool applyType2Corrections_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool applyType1Corrections_
std::vector< type2BinningEntryType * > type2Binning_
vInputTag srcType1Corrections_
char data[epos_bytes_allocation]