47 double p = et /
sin(theta);
48 return eval(type,func,et,phi,eta,p);
65 double eta = candidate->
eta();
66 double phi = candidate->
phi();
74 thetype=
PFtype1;name=
"PFChargedHadron";
break;
76 thetype=
PFtype2;name=
"PFChargedEM";
break;
78 thetype=
PFtype3;name=
"PFMuon";
break;
80 thetype=
PFtype4;name=
"PFNeutralEM";
break;
82 thetype=
PFtype5;name=
"PFNeutralHadron";
break;
84 thetype=
PFtype6;name=
"PFtype6";
break;
86 thetype=
PFtype7;name=
"PFtype7";
break;
88 thetype=
PFtype7;name=
"PFunknown";
break;
91 double d_et=0, d_phi=0;
94 d_phi = et*trackRef->phiError();
95 d_et = (type==2) ? ElectronPtResolution(candidate) : trackRef->ptError();
99 d_et = eval(thetype,
ET,et,phi,eta);
100 d_phi = eval(thetype,
PHI,et,phi,eta);
111 double jpt = jet->
pt();
112 double jphi = jet->
phi();
113 double jeta = jet->
eta();
114 double jdeltapt = 999.;
115 double jdeltapphi = 999.;
117 if(jpt<ptResolThreshold_ && jpt<20.){
119 int ieta = feta<5.? int(feta/0.5) : 9;
120 int ipt = jpt>3. ? int(jpt-3./2) : 0;
121 jdeltapt = jdpt[ieta][ipt];
122 jdeltapphi = jpt*jdphi[ieta][ipt];
128 double jptForEval = jpt>ptResolThreshold_ ? jpt : ptResolThreshold_;
129 jdeltapt = jpt*ptResol_->parameterEtaEval(
"sigma",jeta,jptForEval);
130 jdeltapphi = jpt*phiResol_->parameterEtaEval(
"sigma",jeta,jptForEval);
146 ptResolThreshold_ = iConfig.
getParameter<
double>(
"ptresolthreshold");
150 for (
int ieta=0; ieta<10; ieta++){
151 jdpt[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdpt%d", ieta));
152 jdphi[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdphi%d", ieta));
161 std::vector<double> ebet = iConfig.
getParameter<std::vector<double> >(
"EB_EtResPar");
162 std::vector<double> ebphi = iConfig.
getParameter<std::vector<double> >(
"EB_PhiResPar");
164 etparameters[0]=ebet[0];
165 etparameters[1]=ebet[1];
166 etparameters[2]=ebet[2];
167 phiparameters[0]=ebphi[0];
168 addfunction(
caloEB,
ET,etparameters);
171 std::vector<double> eeet = iConfig.
getParameter<std::vector<double> >(
"EE_EtResPar");
172 std::vector<double> eephi = iConfig.
getParameter<std::vector<double> >(
"EE_PhiResPar");
174 etparameters[0]=eeet[0];
175 etparameters[1]=eeet[1];
176 etparameters[2]=eeet[2];
177 phiparameters[0]=eephi[0];
178 addfunction(
caloEE,
ET,etparameters);
181 std::vector<double> hbet = iConfig.
getParameter<std::vector<double> >(
"HB_EtResPar");
182 std::vector<double> hbphi = iConfig.
getParameter<std::vector<double> >(
"HB_PhiResPar");
184 etparameters[0]=hbet[0];
185 etparameters[1]=hbet[1];
186 etparameters[2]=hbet[2];
187 phiparameters[0]=hbphi[0];
188 addfunction(
caloHB,
ET,etparameters);
191 std::vector<double> heet = iConfig.
getParameter<std::vector<double> >(
"HE_EtResPar");
192 std::vector<double> hephi = iConfig.
getParameter<std::vector<double> >(
"HE_PhiResPar");
194 etparameters[0]=heet[0];
195 etparameters[1]=heet[1];
196 etparameters[2]=heet[2];
197 phiparameters[0]=hephi[0];
198 addfunction(
caloHE,
ET,etparameters);
201 std::vector<double> hoet = iConfig.
getParameter<std::vector<double> >(
"HO_EtResPar");
202 std::vector<double> hophi = iConfig.
getParameter<std::vector<double> >(
"HO_PhiResPar");
205 etparameters[0]=hoet[0];
206 etparameters[1]=hoet[1];
207 etparameters[2]=hoet[2];
208 phiparameters[0]=hophi[0];
209 addfunction(
caloHO,
ET,etparameters);
212 std::vector<double> hfet = iConfig.
getParameter<std::vector<double> >(
"HF_EtResPar");
213 std::vector<double> hfphi = iConfig.
getParameter<std::vector<double> >(
"HF_PhiResPar");
215 etparameters[0]=hfet[0];
216 etparameters[1]=hfet[1];
217 etparameters[2]=hfet[2];
218 phiparameters[0]=hfphi[0];
219 addfunction(
caloHF,
ET,etparameters);
225 std::vector<double> pf1et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType1");
226 std::vector<double> pf1phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType1");
227 etparameters[0]=pf1et[0];
228 etparameters[1]=pf1et[1];
229 etparameters[2]=pf1et[2];
230 phiparameters[0]=pf1phi[0];
236 std::vector<double> pf2et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType2");
237 std::vector<double> pf2phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType2");
238 etparameters[0]=pf2et[0];
239 etparameters[1]=pf2et[1];
240 etparameters[2]=pf2et[2];
241 phiparameters[0]=pf2phi[0];
247 std::vector<double> pf3et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType3");
248 std::vector<double> pf3phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType3");
249 etparameters[0]=pf3et[0];
250 etparameters[1]=pf3et[1];
251 etparameters[2]=pf3et[2];
252 phiparameters[0]=pf3phi[0];
258 std::vector<double> pf4et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType4");
259 std::vector<double> pf4phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType4");
260 etparameters[0]=pf4et[0];
261 etparameters[1]=pf4et[1];
262 etparameters[2]=pf4et[2];
269 std::vector<double> pf5et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType5");
270 std::vector<double> pf5phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType5");
271 etparameters[0]=pf5et[0];
272 etparameters[1]=pf5et[1];
273 etparameters[2]=pf5et[2];
274 phiparameters[0]=pf5phi[0];
280 std::vector<double> pf6et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType6");
281 std::vector<double> pf6phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType6");
282 etparameters[0]=pf6et[0];
283 etparameters[1]=pf6et[1];
284 etparameters[2]=pf6et[2];
285 phiparameters[0]=pf6phi[0];
292 std::vector<double> pf7et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType7");
293 std::vector<double> pf7phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType7");
294 etparameters[0]=pf7et[0];
295 etparameters[1]=pf7et[1];
296 etparameters[2]=pf7et[2];
297 phiparameters[0]=pf7phi[0];
316 if(functionmap_.count(mypair)==0){
323 return EtFunction(x,values);
325 return PhiFunction(x,values);
327 return PFunction(x,values);
329 return PhiConstFunction(x,values);
346 double result = et*
sqrt((par[2]*par[2])+(par[1]*par[1]/et)+(par[0]*par[0]/(et*et)));
359 if(par.size()!=1 && par.size()!=3){
362 else if(par.size()==1){
366 return et*
sqrt((par[2]*par[2])+(par[1]*par[1]/et)+(par[0]*par[0]/(et*et)));
387 if ( ptResol_ == 0 ) {
393 string path = cmssw_base +
"/src/CondFormats/JetMETObjects/data";
395 if (stat(path.c_str(),&st)!=0) {
396 path = cmssw_release_base +
"/src/CondFormats/JetMETObjects/data";
398 if (stat(path.c_str(),&st)!=0) {
399 cerr<<
"ERROR: tried to set path but failed, abort."<<endl;
401 string era(resolutionsEra);
402 string alg(resolutionsAlgo);
403 string ptFileName = path +
"/" + era +
"_PtResolution_" +alg+
".txt";
404 string phiFileName = path +
"/" + era +
"_PhiResolution_"+alg+
".txt";
416 double dEnergy = pfresol_->getEnergyResolutionEm(energy, eta);
418 return dEnergy/cosh(eta);
T getParameter(std::string const &) const
double PhiFunction(const functionPars &x, const functionPars &par) const
virtual double energy() const final
energy
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
Sin< T >::type sin(const T &t)
metsig::SigInputObj evalPF(const reco::PFCandidate *candidate) const
Geom::Theta< T > theta() const
virtual double phi() const final
momentum azimuthal angle
double eval(const resolutionType &type, const resolutionFunc &func, const double &et, const double &phi, const double &eta, const double &p) const
Jets made from PFObjects.
reco::TrackRef trackRef() const
U second(std::pair< T, U > const &p)
double ElectronPtResolution(const reco::PFCandidate *c) const
bool isNull() const
Checks for null.
double EtFunction(const functionPars &x, const functionPars &par) const
std::vector< double > functionPars
metsig::SigInputObj evalPFJet(const reco::PFJet *jet) const
Particle reconstructed by the particle flow algorithm.
virtual double theta() const final
momentum polar angle
void initializeJetResolutions(const edm::ParameterSet &iConfig)
double PhiConstFunction(const functionPars &x, const functionPars &par) const
virtual double eta() const final
momentum pseudorapidity
virtual ParticleType particleId() const
std::pair< metsig::resolutionType, metsig::resolutionFunc > functionCombo
double PFunction(const functionPars &x, const functionPars &par) const
virtual double pt() const final
transverse momentum
void addResolutions(const edm::ParameterSet &iConfig)