48 double p = et /
sin(theta);
49 return eval(type,func,et,phi,eta,p);
61 return getfunc(type,func,x);
66 double eta = candidate->
eta();
67 double phi = candidate->
phi();
75 thetype=
PFtype1;name=
"PFChargedHadron";
break;
77 thetype=
PFtype2;name=
"PFChargedEM";
break;
79 thetype=
PFtype3;name=
"PFMuon";
break;
81 thetype=
PFtype4;name=
"PFNeutralEM";
break;
83 thetype=
PFtype5;name=
"PFNeutralHadron";
break;
85 thetype=
PFtype6;name=
"PFtype6";
break;
87 thetype=
PFtype7;name=
"PFtype7";
break;
89 thetype=
PFtype7;name=
"PFunknown";
break;
92 double d_et=0, d_phi=0;
95 d_phi = et*trackRef->phiError();
96 d_et = (type==2) ? ElectronPtResolution(candidate) : trackRef->ptError();
100 d_et = eval(thetype,
ET,et,phi,eta);
101 d_phi = eval(thetype,
PHI,et,phi,eta);
112 double jpt = jet->
pt();
113 double jphi = jet->
phi();
114 double jeta = jet->
eta();
115 double jdeltapt = 999.;
116 double jdeltapphi = 999.;
118 if(jpt<ptResolThreshold_ && jpt<20.){
119 double feta = TMath::Abs(jeta);
120 int ieta = feta<5.? int(feta/0.5) : 9;
121 int ipt = jpt>3. ? int(jpt-3./2) : 0;
122 jdeltapt = jdpt[ieta][ipt];
123 jdeltapphi = jpt*jdphi[ieta][ipt];
129 TF1* fPtEta = ptResol_->parameterEta(
"sigma",jeta);
130 TF1* fPhiEta = phiResol_->parameterEta(
"sigma",jeta);
131 jdeltapt = jpt>ptResolThreshold_ ? jpt*fPtEta->Eval(jpt) : jpt*fPtEta->Eval(ptResolThreshold_);
132 jdeltapphi = jpt>ptResolThreshold_ ? jpt*fPhiEta->Eval(jpt) : jpt*fPhiEta->Eval(ptResolThreshold_);
137 std::string inputtype =
"jet";
150 ptResolThreshold_ = iConfig.
getParameter<
double>(
"ptresolthreshold");
154 for (
int ieta=0; ieta<10; ieta++){
155 jdpt[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdpt%d", ieta));
156 jdphi[ieta] = iConfig.
getParameter<std::vector<double> >(Form(
"jdphi%d", ieta));
165 std::vector<double> ebet = iConfig.
getParameter<std::vector<double> >(
"EB_EtResPar");
166 std::vector<double> ebphi = iConfig.
getParameter<std::vector<double> >(
"EB_PhiResPar");
168 etparameters[0]=ebet[0];
169 etparameters[1]=ebet[1];
170 etparameters[2]=ebet[2];
171 phiparameters[0]=ebphi[0];
172 addfunction(
caloEB,
ET,etparameters);
175 std::vector<double> eeet = iConfig.
getParameter<std::vector<double> >(
"EE_EtResPar");
176 std::vector<double> eephi = iConfig.
getParameter<std::vector<double> >(
"EE_PhiResPar");
178 etparameters[0]=eeet[0];
179 etparameters[1]=eeet[1];
180 etparameters[2]=eeet[2];
181 phiparameters[0]=eephi[0];
182 addfunction(
caloEE,
ET,etparameters);
185 std::vector<double> hbet = iConfig.
getParameter<std::vector<double> >(
"HB_EtResPar");
186 std::vector<double> hbphi = iConfig.
getParameter<std::vector<double> >(
"HB_PhiResPar");
188 etparameters[0]=hbet[0];
189 etparameters[1]=hbet[1];
190 etparameters[2]=hbet[2];
191 phiparameters[0]=hbphi[0];
192 addfunction(
caloHB,
ET,etparameters);
195 std::vector<double> heet = iConfig.
getParameter<std::vector<double> >(
"HE_EtResPar");
196 std::vector<double> hephi = iConfig.
getParameter<std::vector<double> >(
"HE_PhiResPar");
198 etparameters[0]=heet[0];
199 etparameters[1]=heet[1];
200 etparameters[2]=heet[2];
201 phiparameters[0]=hephi[0];
202 addfunction(
caloHE,
ET,etparameters);
205 std::vector<double> hoet = iConfig.
getParameter<std::vector<double> >(
"HO_EtResPar");
206 std::vector<double> hophi = iConfig.
getParameter<std::vector<double> >(
"HO_PhiResPar");
209 etparameters[0]=hoet[0];
210 etparameters[1]=hoet[1];
211 etparameters[2]=hoet[2];
212 phiparameters[0]=hophi[0];
213 addfunction(
caloHO,
ET,etparameters);
216 std::vector<double> hfet = iConfig.
getParameter<std::vector<double> >(
"HF_EtResPar");
217 std::vector<double> hfphi = iConfig.
getParameter<std::vector<double> >(
"HF_PhiResPar");
219 etparameters[0]=hfet[0];
220 etparameters[1]=hfet[1];
221 etparameters[2]=hfet[2];
222 phiparameters[0]=hfphi[0];
223 addfunction(
caloHF,
ET,etparameters);
229 std::vector<double> pf1et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType1");
230 std::vector<double> pf1phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType1");
231 etparameters[0]=pf1et[0];
232 etparameters[1]=pf1et[1];
233 etparameters[2]=pf1et[2];
234 phiparameters[0]=pf1phi[0];
240 std::vector<double> pf2et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType2");
241 std::vector<double> pf2phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType2");
242 etparameters[0]=pf2et[0];
243 etparameters[1]=pf2et[1];
244 etparameters[2]=pf2et[2];
245 phiparameters[0]=pf2phi[0];
251 std::vector<double> pf3et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType3");
252 std::vector<double> pf3phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType3");
253 etparameters[0]=pf3et[0];
254 etparameters[1]=pf3et[1];
255 etparameters[2]=pf3et[2];
256 phiparameters[0]=pf3phi[0];
262 std::vector<double> pf4et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType4");
263 std::vector<double> pf4phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType4");
264 etparameters[0]=pf4et[0];
265 etparameters[1]=pf4et[1];
266 etparameters[2]=pf4et[2];
273 std::vector<double> pf5et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType5");
274 std::vector<double> pf5phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType5");
275 etparameters[0]=pf5et[0];
276 etparameters[1]=pf5et[1];
277 etparameters[2]=pf5et[2];
278 phiparameters[0]=pf5phi[0];
284 std::vector<double> pf6et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType6");
285 std::vector<double> pf6phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType6");
286 etparameters[0]=pf6et[0];
287 etparameters[1]=pf6et[1];
288 etparameters[2]=pf6et[2];
289 phiparameters[0]=pf6phi[0];
296 std::vector<double> pf7et = iConfig.
getParameter<std::vector<double> >(
"PF_EtResType7");
297 std::vector<double> pf7phi = iConfig.
getParameter<std::vector<double> >(
"PF_PhiResType7");
298 etparameters[0]=pf7et[0];
299 etparameters[1]=pf7et[1];
300 etparameters[2]=pf7et[2];
301 phiparameters[0]=pf7phi[0];
320 if(functionmap_.count(mypair)==0){
327 return EtFunction(x,values);
329 return PhiFunction(x,values);
331 return PFunction(x,values);
333 return PhiConstFunction(x,values);
350 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){
366 else if(par.size()==1){
370 return et*
sqrt((par[2]*par[2])+(par[1]*par[1]/et)+(par[0]*par[0]/(et*et)));
391 if ( ptResol_ == 0 ) {
392 string resolutionsAlgo = iConfig.
getParameter<std::string>(
"resolutionsAlgo");
393 string resolutionsEra = iConfig.
getParameter<std::string>(
"resolutionsEra");
397 string path = cmssw_base +
"/src/CondFormats/JetMETObjects/data";
399 if (stat(path.c_str(),&st)!=0) {
400 path = cmssw_release_base +
"/src/CondFormats/JetMETObjects/data";
402 if (stat(path.c_str(),&st)!=0) {
403 cerr<<
"ERROR: tried to set path but failed, abort."<<endl;
405 string era(resolutionsEra);
406 string alg(resolutionsAlgo);
407 string ptFileName = path +
"/" + era +
"_PtResolution_" +alg+
".txt";
408 string phiFileName = path +
"/" + era +
"_PhiResolution_"+alg+
".txt";
420 double dEnergy = pfresol_->getEnergyResolutionEm(energy, eta);
422 return dEnergy/cosh(eta);
T getParameter(std::string const &) const
double PhiFunction(const functionPars &x, const functionPars &par) const
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
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.
virtual double eta() const
momentum pseudorapidity
reco::TrackRef trackRef() const
U second(std::pair< T, U > const &p)
double ElectronPtResolution(const reco::PFCandidate *c) const
virtual double energy() const
energy
bool isNull() const
Checks for null.
virtual double theta() const
momentum polar angle
double EtFunction(const functionPars &x, const functionPars &par) const
std::vector< double > functionPars
virtual double pt() const
transverse momentum
metsig::SigInputObj evalPFJet(const reco::PFJet *jet) 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
void addfunction(const resolutionType type, const resolutionFunc func, std::vector< double > parameters)
virtual double phi() const
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)