34 : functionmap_(), ptResol_(nullptr), phiResol_(nullptr) {
42 const double &
eta)
const {
54 const double &
p)
const {
65 double eta = candidate->
eta();
66 double phi = candidate->
phi();
74 name =
"PFChargedHadron";
90 name =
"PFNeutralHadron";
106 double d_et = 0, d_phi = 0;
109 d_phi =
et * trackRef->phiError();
110 d_et = (
type == 2) ? ElectronPtResolution(candidate) : trackRef->ptError();
113 d_et = eval(thetype,
ET,
et, phi,
eta);
114 d_phi = eval(thetype,
PHI,
et, phi,
eta);
123 double jphi =
jet->phi();
125 double jdeltapt = 999.;
126 double jdeltapphi = 999.;
128 if (
jpt < ptResolThreshold_ &&
jpt < 20.) {
131 int ipt =
jpt > 3. ?
int(
jpt - 3. / 2) : 0;
132 jdeltapt = jdpt[
ieta][ipt];
133 jdeltapphi =
jpt * jdphi[
ieta][ipt];
140 double jptForEval =
jpt > ptResolThreshold_ ?
jpt : ptResolThreshold_;
141 jdeltapt =
jpt * ptResol_->parameterEtaEval(
"sigma",
jeta, jptForEval);
142 jdeltapphi =
jpt * phiResol_->parameterEtaEval(
"sigma",
jeta, jptForEval);
157 ptResolThreshold_ = iConfig.
getParameter<
double>(
"ptresolthreshold");
170 std::vector<double> ebet = iConfig.
getParameter<std::vector<double> >(
"EB_EtResPar");
171 std::vector<double> ebphi = iConfig.
getParameter<std::vector<double> >(
"EB_PhiResPar");
173 etparameters[0] = ebet[0];
174 etparameters[1] = ebet[1];
175 etparameters[2] = ebet[2];
176 phiparameters[0] = ebphi[0];
177 addfunction(
caloEB,
ET, etparameters);
180 std::vector<double> eeet = iConfig.
getParameter<std::vector<double> >(
"EE_EtResPar");
181 std::vector<double> eephi = iConfig.
getParameter<std::vector<double> >(
"EE_PhiResPar");
183 etparameters[0] = eeet[0];
184 etparameters[1] = eeet[1];
185 etparameters[2] = eeet[2];
186 phiparameters[0] = eephi[0];
187 addfunction(
caloEE,
ET, etparameters);
190 std::vector<double> hbet = iConfig.
getParameter<std::vector<double> >(
"HB_EtResPar");
191 std::vector<double> hbphi = iConfig.
getParameter<std::vector<double> >(
"HB_PhiResPar");
193 etparameters[0] = hbet[0];
194 etparameters[1] = hbet[1];
195 etparameters[2] = hbet[2];
196 phiparameters[0] = hbphi[0];
197 addfunction(
caloHB,
ET, etparameters);
200 std::vector<double> heet = iConfig.
getParameter<std::vector<double> >(
"HE_EtResPar");
201 std::vector<double> hephi = iConfig.
getParameter<std::vector<double> >(
"HE_PhiResPar");
203 etparameters[0] = heet[0];
204 etparameters[1] = heet[1];
205 etparameters[2] = heet[2];
206 phiparameters[0] = hephi[0];
207 addfunction(
caloHE,
ET, etparameters);
210 std::vector<double> hoet = iConfig.
getParameter<std::vector<double> >(
"HO_EtResPar");
211 std::vector<double> hophi = iConfig.
getParameter<std::vector<double> >(
"HO_PhiResPar");
213 etparameters[0] = hoet[0];
214 etparameters[1] = hoet[1];
215 etparameters[2] = hoet[2];
216 phiparameters[0] = hophi[0];
217 addfunction(
caloHO,
ET, etparameters);
220 std::vector<double> hfet = iConfig.
getParameter<std::vector<double> >(
"HF_EtResPar");
221 std::vector<double> hfphi = iConfig.
getParameter<std::vector<double> >(
"HF_PhiResPar");
223 etparameters[0] = hfet[0];
224 etparameters[1] = hfet[1];
225 etparameters[2] = hfet[2];
226 phiparameters[0] = hfphi[0];
227 addfunction(
caloHF,
ET, etparameters);
232 std::vector<double> pf1et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType1");
233 std::vector<double> pf1phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType1");
234 etparameters[0] = pf1et[0];
235 etparameters[1] = pf1et[1];
236 etparameters[2] = pf1et[2];
237 phiparameters[0] = pf1phi[0];
243 std::vector<double> pf2et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType2");
244 std::vector<double> pf2phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType2");
245 etparameters[0] = pf2et[0];
246 etparameters[1] = pf2et[1];
247 etparameters[2] = pf2et[2];
248 phiparameters[0] = pf2phi[0];
254 std::vector<double> pf3et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType3");
255 std::vector<double> pf3phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType3");
256 etparameters[0] = pf3et[0];
257 etparameters[1] = pf3et[1];
258 etparameters[2] = pf3et[2];
259 phiparameters[0] = pf3phi[0];
265 std::vector<double> pf4et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType4");
266 std::vector<double> pf4phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType4");
267 etparameters[0] = pf4et[0];
268 etparameters[1] = pf4et[1];
269 etparameters[2] = pf4et[2];
276 std::vector<double> pf5et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType5");
277 std::vector<double> pf5phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType5");
278 etparameters[0] = pf5et[0];
279 etparameters[1] = pf5et[1];
280 etparameters[2] = pf5et[2];
281 phiparameters[0] = pf5phi[0];
287 std::vector<double> pf6et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType6");
288 std::vector<double> pf6phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType6");
289 etparameters[0] = pf6et[0];
290 etparameters[1] = pf6et[1];
291 etparameters[2] = pf6et[2];
292 phiparameters[0] = pf6phi[0];
298 std::vector<double> pf7et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType7");
299 std::vector<double> pf7phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType7");
300 etparameters[0] = pf7et[0];
301 etparameters[1] = pf7et[1];
302 etparameters[2] = pf7et[2];
303 phiparameters[0] = pf7phi[0];
323 if (functionmap_.count(mypair) == 0) {
330 return EtFunction(x,
values);
332 return PhiFunction(x,
values);
334 return PFunction(x,
values);
336 return PhiConstFunction(x,
values);
352 double result =
et *
sqrt((par[2] * par[2]) + (par[1] * par[1] /
et) + (par[0] * par[0] / (
et *
et)));
363 if (par.size() != 1 && par.size() != 3) {
365 }
else if (par.size() == 1) {
368 return et *
sqrt((par[2] * par[2]) + (par[1] * par[1] /
et) + (par[0] * par[0] / (
et *
et)));
384 if (ptResol_ ==
nullptr) {
389 string cmssw_release_base(std::getenv(
"CMSSW_RELEASE_BASE"));
393 path = cmssw_release_base +
"/src/CondFormats/JetMETObjects/data";
396 cerr <<
"ERROR: tried to set path but failed, abort." << endl;
400 string ptFileName =
path +
"/" + era +
"_PtResolution_" + alg +
".txt";
401 string phiFileName =
path +
"/" + era +
"_PhiResolution_" + alg +
".txt";
409 double eta =
c->eta();
411 double dEnergy = pfresol_->getEnergyResolutionEm(
energy,
eta);
413 return dEnergy / cosh(
eta);