#include <SimpleJetCorrector.h>
Definition at line 14 of file SimpleJetCorrector.h.
SimpleJetCorrector::SimpleJetCorrector |
( |
| ) |
|
SimpleJetCorrector::SimpleJetCorrector |
( |
const std::string & |
fDataFile, |
|
|
const std::string & |
fOption = "" |
|
) |
| |
SimpleJetCorrector::~SimpleJetCorrector |
( |
| ) |
|
float SimpleJetCorrector::correction |
( |
const std::vector< float > & |
fX, |
|
|
const std::vector< float > & |
fY |
|
) |
| const |
Definition at line 50 of file SimpleJetCorrector.cc.
References newFWLiteAna::bin, JetCorrectorParameters::binIndex(), correctionBin(), JetCorrectorParameters::definitions(), i, mDoInterpolation, mParameters, JetCorrectorParameters::Definitions::nBinVar(), JetCorrectorParameters::neighbourBin(), JetCorrectorParameters::record(), query::result, tmp, and JetCorrectorParameters::Record::xMiddle().
68 if (prevBin>=0 && nextBin>=0)
76 cor = quadraticInterpolation(fX[
i],xMiddle,xValue);
float correctionBin(unsigned fBin, const std::vector< float > &fY) const
const Definitions & definitions() const
const Record & record(unsigned fBin) const
int binIndex(const std::vector< float > &fX) const
float xMiddle(unsigned fVar) const
std::vector< std::vector< double > > tmp
int neighbourBin(unsigned fIndex, unsigned fVar, bool fNext) const
JetCorrectorParameters mParameters
float SimpleJetCorrector::correctionBin |
( |
unsigned |
fBin, |
|
|
const std::vector< float > & |
fY |
|
) |
| const |
|
private |
Definition at line 92 of file SimpleJetCorrector.cc.
References JetCorrectorParameters::definitions(), i, invert(), JetCorrectorParameters::Definitions::isResponse(), mFunc, mParameters, N, JetCorrectorParameters::Record::parameters(), JetCorrectorParameters::record(), query::result, JetCorrectorParameters::size(), tmp, and x.
Referenced by correction().
96 std::stringstream sserr;
97 sserr<<
"wrong bin: "<<fBin<<
": only "<<
mParameters.
size()<<
" available!";
98 handleError(
"SimpleJetCorrector",sserr.str());
100 unsigned N = fY.size();
103 std::stringstream sserr;
104 sserr<<
"two many variables: "<<N<<
" maximum is 4";
105 handleError(
"SimpleJetCorrector",sserr.str());
110 TFormula tFunc(
mFunc);
113 for(
unsigned int i=2*N;
i<par.size();
i++)
114 tFunc.SetParameter(
i-2*N,par[
i]);
116 std::vector<float>
tmp;
117 for(
unsigned i=0;i<
N;i++)
119 x[
i] = (fY[
i] < par[2*
i]) ? par[2*i] : (fY[i] > par[2*i+1]) ? par[2*i+1] : fY[
i];
123 result =
invert(tmp,tFunc);
125 result = tFunc.Eval(x[0],x[1],x[2],x[3]);
std::vector< float > parameters() const
const Definitions & definitions() const
float invert(const std::vector< float > &fX, TFormula &) const
const Record & record(unsigned fBin) const
std::vector< std::vector< double > > tmp
JetCorrectorParameters mParameters
unsigned SimpleJetCorrector::findInvertVar |
( |
| ) |
|
|
private |
float SimpleJetCorrector::invert |
( |
const std::vector< float > & |
fX, |
|
|
TFormula & |
tFunc |
|
) |
| const |
|
private |
Definition at line 148 of file SimpleJetCorrector.cc.
References alignCSCRings::e, i, mInvertVar, N, tmp, and x.
Referenced by correctionBin().
151 unsigned N = fX.size();
152 float precision = 0.0001;
155 float x[4] = {0.0,0.0,0.0,0.0};
156 for(
unsigned i=0;
i<
N;
i++)
159 while(e > precision && nLoop < nMax)
161 rsp = tFunc.Eval(x[0],x[1],x[2],x[3]);
std::vector< std::vector< double > > tmp
void SimpleJetCorrector::setFuncParameters |
( |
| ) |
|
|
private |
void SimpleJetCorrector::setInterpolation |
( |
bool |
fInterpolation | ) |
|
|
inline |
bool SimpleJetCorrector::mDoInterpolation |
|
private |
TFormula SimpleJetCorrector::mFunc |
|
private |
unsigned SimpleJetCorrector::mInvertVar |
|
private |