34 : functionmap_(), ptResol_(nullptr), phiResol_(nullptr) {
42 const double &
eta)
const {
45 double p = et /
sin(theta);
46 return eval(type, func, et, phi, eta, p);
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);
122 double jpt = jet->
pt();
123 double jphi = jet->
phi();
124 double jeta = jet->
eta();
125 double jdeltapt = 999.;
126 double jdeltapphi = 999.;
128 if (jpt < ptResolThreshold_ && jpt < 20.) {
129 double feta = TMath::Abs(jeta);
130 int ieta = feta < 5. ? int(feta / 0.5) : 9;
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");
160 for (
int ieta = 0; ieta < 10; ieta++) {
161 jdpt[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdpt%d", ieta));
162 jdphi[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdphi%d", ieta));
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"));
390 string path = cmssw_base +
"/src/CondFormats/JetMETObjects/data";
392 if (
stat(path.c_str(), &st) != 0) {
393 path = cmssw_release_base +
"/src/CondFormats/JetMETObjects/data";
395 if (
stat(path.c_str(), &st) != 0) {
396 cerr <<
"ERROR: tried to set path but failed, abort." << endl;
398 const string &era(resolutionsEra);
399 const string &alg(resolutionsAlgo);
400 string ptFileName = path +
"/" + era +
"_PtResolution_" + alg +
".txt";
401 string phiFileName = path +
"/" + era +
"_PhiResolution_" + alg +
".txt";
411 double dEnergy = pfresol_->getEnergyResolutionEm(energy, eta);
413 return dEnergy / cosh(eta);
const edm::EventSetup & c
double pt() const final
transverse momentum
double PhiFunction(const functionPars &x, const functionPars &par) const
void addfunction(const resolutionType type, const resolutionFunc func, const std::vector< double > ¶meters)
double getfunc(const resolutionType &type, const resolutionFunc &func, std::vector< double > &x) const
Base class for all types of Jets.
Sin< T >::type sin(const T &t)
metsig::SigInputObj evalPF(const reco::PFCandidate *candidate) const
Geom::Theta< T > theta() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
Exp< T >::type exp(const T &t)
double eval(const resolutionType &type, const resolutionFunc &func, const double &et, const double &phi, const double &eta, const double &p) const
metsig::SigInputObj evalPFJet(const reco::Jet *jet) const
reco::TrackRef trackRef() const
U second(std::pair< T, U > const &p)
double ElectronPtResolution(const reco::PFCandidate *c) const
double theta() const final
momentum polar angle
bool isNull() const
Checks for null.
double EtFunction(const functionPars &x, const functionPars &par) const
std::vector< double > functionPars
T getParameter(std::string const &) const
Particle reconstructed by the particle flow algorithm.
void initializeJetResolutions(const edm::ParameterSet &iConfig)
double PhiConstFunction(const functionPars &x, const functionPars &par) const
virtual ParticleType particleId() const
double phi() const final
momentum azimuthal angle
std::pair< metsig::resolutionType, metsig::resolutionFunc > functionCombo
double PFunction(const functionPars &x, const functionPars &par) const
void addResolutions(const edm::ParameterSet &iConfig)
double energy() const final
energy
double eta() const final
momentum pseudorapidity