8 const std::vector<edm::ParameterSet>& bResolutions,
9 const std::vector<double>& jetEnergyResolutionScaleFactors,
10 const std::vector<double>& jetEnergyResolutionEtaBinning)
11 : jetEnergyResolutionScaleFactors_(jetEnergyResolutionScaleFactors),
12 jetEnergyResolutionEtaBinning_(jetEnergyResolutionEtaBinning) {
13 for (std::vector<edm::ParameterSet>::const_iterator iSet = udscResolutions.begin(); iSet != udscResolutions.end();
15 if (iSet->exists(
"bin"))
17 else if (udscResolutions.size() == 1)
20 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
26 for (std::vector<edm::ParameterSet>::const_iterator iSet = bResolutions.begin(); iSet != bResolutions.end(); ++iSet) {
27 if (iSet->exists(
"bin"))
29 else if (bResolutions.size() == 1)
32 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
41 const std::vector<edm::ParameterSet>& bResolutions,
42 const std::vector<edm::ParameterSet>& lepResolutions,
43 const std::vector<edm::ParameterSet>& metResolutions,
44 const std::vector<double>& jetEnergyResolutionScaleFactors,
45 const std::vector<double>& jetEnergyResolutionEtaBinning)
46 : jetEnergyResolutionScaleFactors_(jetEnergyResolutionScaleFactors),
47 jetEnergyResolutionEtaBinning_(jetEnergyResolutionEtaBinning) {
49 throw cms::Exception(
"Configuration") <<
"The number of scale factors does not fit to the number of eta bins!\n";
52 throw cms::Exception(
"Configuration") <<
"eta binning in absolut values required!\n";
54 for (std::vector<edm::ParameterSet>::const_iterator iSet = udscResolutions.begin(); iSet != udscResolutions.end();
56 if (iSet->exists(
"bin"))
58 else if (udscResolutions.size() == 1)
61 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
67 for (std::vector<edm::ParameterSet>::const_iterator iSet = bResolutions.begin(); iSet != bResolutions.end(); ++iSet) {
68 if (iSet->exists(
"bin"))
70 else if (bResolutions.size() == 1)
73 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
79 for (std::vector<edm::ParameterSet>::const_iterator iSet = lepResolutions.begin(); iSet != lepResolutions.end();
81 if (iSet->exists(
"bin"))
83 else if (lepResolutions.size() == 1)
86 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
92 for (std::vector<edm::ParameterSet>::const_iterator iSet = metResolutions.begin(); iSet != metResolutions.end();
94 if (iSet->exists(
"bin"))
96 else if (metResolutions.size() == 1)
99 throw cms::Exception(
"Configuration") <<
"Parameter 'bin' is needed if more than one PSet is specified!\n";
110 std::vector<std::string>*bins_, *funcEt_, *funcEta_, *funcPhi_;
144 throw cms::Exception(
"UnsupportedObject") <<
"The object given is not supported!\n";
147 int selectedBin = -1;
149 for (
unsigned int i = 0;
i < bins_->size(); ++
i) {
153 if (select_(candidate)) {
159 if (selectedBin >= 0) {
160 if (whichResolution ==
"et")
162 else if (whichResolution ==
"eta")
164 else if (whichResolution ==
"phi")
167 throw cms::Exception(
"ProgrammingError") <<
"Only 'et', 'eta' and 'phi' resolutions supported!\n";
175 TMatrixD CovM3(3, 3);
177 TMatrixD CovM4(4, 4);
179 const double pt =
object.Pt();
180 const double eta =
object.Eta();
254 CovM3(0, 0) =
pow(muonRes.
a(pt, eta), 2);
255 CovM3(1, 1) =
pow(muonRes.
b(pt, eta), 2);
256 CovM3(2, 2) =
pow(muonRes.
c(pt, eta), 2);
260 CovM3(0, 0) =
pow(muonRes.
et(pt, eta), 2);
261 CovM3(1, 1) =
pow(muonRes.
eta(pt, eta), 2);
262 CovM3(2, 2) =
pow(muonRes.
phi(pt, eta), 2);
270 CovM3(0, 0) =
pow(muonRes.
et(pt, eta), 2);
271 CovM3(1, 1) =
pow(muonRes.
theta(pt, eta), 2);
272 CovM3(2, 2) =
pow(muonRes.
phi(pt, eta), 2);
282 CovM3(0, 0) =
pow(elecRes.
a(pt, eta), 2);
283 CovM3(1, 1) =
pow(elecRes.
b(pt, eta), 2);
284 CovM3(2, 2) =
pow(elecRes.
c(pt, eta), 2);
288 CovM3(0, 0) =
pow(elecRes.
et(pt, eta), 2);
289 CovM3(1, 1) =
pow(elecRes.
eta(pt, eta), 2);
290 CovM3(2, 2) =
pow(elecRes.
phi(pt, eta), 2);
298 CovM3(0, 0) =
pow(elecRes.
et(pt, eta), 2);
299 CovM3(1, 1) =
pow(elecRes.
theta(pt, eta), 2);
300 CovM3(2, 2) =
pow(elecRes.
phi(pt, eta), 2);
310 CovM3(0, 0) =
pow(metRes.
a(pt), 2);
311 CovM3(1, 1) =
pow(metRes.
b(pt), 2);
312 CovM3(2, 2) =
pow(metRes.
c(pt), 2);
316 CovM3(0, 0) =
pow(metRes.
et(pt), 2);
317 CovM3(1, 1) =
pow(9999., 2);
318 CovM3(2, 2) =
pow(metRes.
phi(pt), 2);
326 CovM3(0, 0) =
pow(metRes.
et(pt), 2);
327 CovM3(1, 1) =
pow(9999., 2);
328 CovM3(2, 2) =
pow(metRes.
phi(pt), 2);
334 cms::Exception(
"Logic") <<
"Something went wrong while trying to setup a covariance matrix!\n";
339 double etaDependentScaleFactor = 1.;
342 if (
i == jetEnergyResolutionEtaBinning_.size() - 1) {
344 << jetEnergyResolutionEtaBinning_[
i] <<
") using scale factor 1.0!";
345 etaDependentScaleFactor = 1.;
352 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)
Abs< T >::type abs(const T &t)
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)
Log< level::Warning, false > LogWarning
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