7 const std::vector<double> jetEnergyResolutionScaleFactors,
const std::vector<double> jetEnergyResolutionEtaBinning):
8 jetEnergyResolutionScaleFactors_(jetEnergyResolutionScaleFactors), jetEnergyResolutionEtaBinning_(jetEnergyResolutionEtaBinning)
10 for(std::vector<edm::ParameterSet>::const_iterator iSet = udscResolutions.begin(); iSet != udscResolutions.end(); ++iSet){
11 if(iSet->exists(
"bin"))
binsUdsc_.push_back(iSet->getParameter<std::string>(
"bin"));
12 else if(udscResolutions.size()==1)
binsUdsc_.push_back(
"");
13 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
15 funcEtUdsc_.push_back(iSet->getParameter<std::string>(
"et"));
16 funcEtaUdsc_.push_back(iSet->getParameter<std::string>(
"eta"));
17 funcPhiUdsc_.push_back(iSet->getParameter<std::string>(
"phi"));
19 for(std::vector<edm::ParameterSet>::const_iterator iSet = bResolutions.begin(); iSet != bResolutions.end(); ++iSet){
20 if(iSet->exists(
"bin"))
binsB_.push_back(iSet->getParameter<std::string>(
"bin"));
21 else if(bResolutions.size()==1)
binsB_.push_back(
"");
22 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
24 funcEtB_.push_back(iSet->getParameter<std::string>(
"et"));
25 funcEtaB_.push_back(iSet->getParameter<std::string>(
"eta"));
26 funcPhiB_.push_back(iSet->getParameter<std::string>(
"phi"));
31 const std::vector<edm::ParameterSet> lepResolutions,
const std::vector<edm::ParameterSet> metResolutions,
32 const std::vector<double> jetEnergyResolutionScaleFactors,
const std::vector<double> jetEnergyResolutionEtaBinning):
33 jetEnergyResolutionScaleFactors_(jetEnergyResolutionScaleFactors), jetEnergyResolutionEtaBinning_(jetEnergyResolutionEtaBinning)
36 throw cms::Exception(
"Configuration") <<
"The number of scale factors does not fit to the number of eta bins!\n";
39 throw cms::Exception(
"Configuration") <<
"eta binning in absolut values required!\n";
41 for(std::vector<edm::ParameterSet>::const_iterator iSet = udscResolutions.begin(); iSet != udscResolutions.end(); ++iSet){
42 if(iSet->exists(
"bin"))
binsUdsc_.push_back(iSet->getParameter<std::string>(
"bin"));
43 else if(udscResolutions.size()==1)
binsUdsc_.push_back(
"");
44 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
46 funcEtUdsc_.push_back(iSet->getParameter<std::string>(
"et"));
47 funcEtaUdsc_.push_back(iSet->getParameter<std::string>(
"eta"));
48 funcPhiUdsc_.push_back(iSet->getParameter<std::string>(
"phi"));
50 for(std::vector<edm::ParameterSet>::const_iterator iSet = bResolutions.begin(); iSet != bResolutions.end(); ++iSet){
51 if(iSet->exists(
"bin"))
binsB_.push_back(iSet->getParameter<std::string>(
"bin"));
52 else if(bResolutions.size()==1)
binsB_.push_back(
"");
53 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
55 funcEtB_.push_back(iSet->getParameter<std::string>(
"et"));
56 funcEtaB_.push_back(iSet->getParameter<std::string>(
"eta"));
57 funcPhiB_.push_back(iSet->getParameter<std::string>(
"phi"));
59 for(std::vector<edm::ParameterSet>::const_iterator iSet = lepResolutions.begin(); iSet != lepResolutions.end(); ++iSet){
60 if(iSet->exists(
"bin"))
binsLep_.push_back(iSet->getParameter<std::string>(
"bin"));
61 else if(lepResolutions.size()==1)
binsLep_.push_back(
"");
62 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
64 funcEtLep_.push_back(iSet->getParameter<std::string>(
"et"));
65 funcEtaLep_.push_back(iSet->getParameter<std::string>(
"eta"));
66 funcPhiLep_.push_back(iSet->getParameter<std::string>(
"phi"));
68 for(std::vector<edm::ParameterSet>::const_iterator iSet = metResolutions.begin(); iSet != metResolutions.end(); ++iSet){
69 if(iSet->exists(
"bin"))
binsMet_.push_back(iSet->getParameter<std::string>(
"bin"));
70 else if(metResolutions.size()==1)
binsMet_.push_back(
"");
71 else throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
73 funcEtMet_.push_back(iSet->getParameter<std::string>(
"et"));
74 funcEtaMet_.push_back(iSet->getParameter<std::string>(
"eta"));
75 funcPhiMet_.push_back(iSet->getParameter<std::string>(
"phi"));
81 std::vector<std::string> * bins_, * funcEt_, * funcEta_, * funcPhi_;
115 throw cms::Exception(
"UnsupportedObject") <<
"The object given is not supported!\n";
120 for(
unsigned int i=0;
i<bins_->size(); ++
i){
123 if(select_(candidate)){
133 else throw cms::Exception(
"ProgrammingError") <<
"Only 'et', 'eta' and 'phi' resolutions supported!\n";
140 TMatrixD CovM3 (3,3); CovM3.Zero();
141 TMatrixD CovM4 (4,4); CovM4.Zero();
142 const double pt =
object.Pt();
143 const double eta =
object.Eta();
219 CovM3(0,0) =
pow(muonRes.
a (pt, eta), 2);
220 CovM3(1,1) =
pow(muonRes.
b (pt, eta), 2);
221 CovM3(2,2) =
pow(muonRes.
c (pt, eta), 2);
225 CovM3(0,0) =
pow(muonRes.
et (pt, eta), 2);
226 CovM3(1,1) =
pow(muonRes.
eta(pt, eta), 2);
227 CovM3(2,2) =
pow(muonRes.
phi(pt, eta), 2);
236 CovM3(0,0) =
pow(muonRes.
et (pt, eta), 2);
237 CovM3(1,1) =
pow(muonRes.
theta(pt, eta), 2);
238 CovM3(2,2) =
pow(muonRes.
phi (pt, eta), 2);
249 CovM3(0,0) =
pow(elecRes.
a (pt, eta), 2);
250 CovM3(1,1) =
pow(elecRes.
b (pt, eta), 2);
251 CovM3(2,2) =
pow(elecRes.
c (pt, eta), 2);
255 CovM3(0,0) =
pow(elecRes.
et (pt, eta), 2);
256 CovM3(1,1) =
pow(elecRes.
eta(pt, eta), 2);
257 CovM3(2,2) =
pow(elecRes.
phi(pt, eta), 2);
266 CovM3(0,0) =
pow(elecRes.
et (pt, eta), 2);
267 CovM3(1,1) =
pow(elecRes.
theta(pt, eta), 2);
268 CovM3(2,2) =
pow(elecRes.
phi (pt, eta), 2);
279 CovM3(0,0) =
pow(metRes.
a(pt), 2);
280 CovM3(1,1) =
pow(metRes.
b(pt), 2);
281 CovM3(2,2) =
pow(metRes.
c(pt), 2);
285 CovM3(0,0) =
pow(metRes.
et(pt) , 2);
286 CovM3(1,1) =
pow( 9999. , 2);
287 CovM3(2,2) =
pow(metRes.
phi(pt), 2);
296 CovM3(0,0) =
pow(metRes.
et(pt) , 2);
297 CovM3(1,1) =
pow( 9999. , 2);
298 CovM3(2,2) =
pow(metRes.
phi(pt), 2);
304 cms::Exception(
"Logic") <<
"Something went wrong while trying to setup a covariance matrix!\n";
310 double etaDependentScaleFactor = 1.;
313 if(
i==jetEnergyResolutionEtaBinning_.size()-1) {
314 edm::LogWarning(
"CovarianceMatrix") <<
"object eta ("<<
std::abs(
object.
Eta())<<
") beyond last eta bin ("<<jetEnergyResolutionEtaBinning_[
i]<<
") using scale factor 1.0!";
315 etaDependentScaleFactor=1.;
323 return etaDependentScaleFactor;
Param
supported parameterizations
double c(double pt, double eta)
std::vector< std::string > binsB_
const std::vector< double > jetEnergyResolutionEtaBinning_
double et(double pt, double eta)
double phi(double pt, double eta, Flavor flav)
double phi(double pt, double eta)
std::vector< std::string > funcEtUdsc_
vectors for the resolution functions
double b(double pt, double eta)
std::vector< std::string > binsMet_
double theta(double pt, double eta, Flavor flav)
double c(double pt, double eta)
double eta(double pt, double eta)
TMatrixD setupMatrix(const pat::PATObject< T > &object, const TopKinFitter::Param param, const std::string &resolutionProvider="")
return covariance matrix for a PAT object
double et(double pt, double eta, Flavor flav)
std::vector< std::string > funcEtB_
std::vector< std::string > binsUdsc_
vector of strings for the binning of the resolutions
std::vector< std::string > funcPhiB_
const std::vector< double > jetEnergyResolutionScaleFactors_
scale factors for the jet energy resolution
double b(double pt, double eta, Flavor flav)
double d(double pt, double eta, Flavor flav)
std::vector< std::string > funcEtaB_
double a(double pt, double eta)
double theta(double pt, double eta)
double et(double pt, double eta)
CovarianceMatrix()
default constructor
std::vector< std::string > funcPhiUdsc_
std::vector< std::string > funcPhiLep_
double eta(double pt, double eta, Flavor flav)
std::vector< std::string > funcEtaUdsc_
std::vector< std::string > funcEtLep_
double theta(double pt, double eta)
std::vector< std::string > funcEtMet_
double eta(double pt, double eta)
double a(double pt, double eta)
std::vector< std::string > funcEtaLep_
std::vector< std::string > binsLep_
double c(double pt, double eta, Flavor flav)
std::vector< std::string > funcEtaMet_
double phi(double pt, double eta)
std::vector< std::string > funcPhiMet_
double a(double pt, double eta, Flavor flav)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Power< A, B >::type pow(const A &a, const B &b)
double b(double pt, double eta)
double getResolution(const TLorentzVector &object, const ObjectType objType, const std::string &whichResolution="")
get resolution for a given component of an object
double getEtaDependentScaleFactor(const pat::PATObject< T > &object)
get eta dependent smear factor for a PAT object