1 #ifndef CovarianceMatrix_h
2 #define CovarianceMatrix_h
36 const std::vector<edm::ParameterSet>& bResolutions,
37 const std::vector<double>& jetEnergyResolutionScaleFactors,
38 const std::vector<double>& jetEnergyResolutionEtaBinning);
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);
61 return getResolution(TLorentzVector(
object.px(),
object.py(),
object.pz(),
object.
energy()),
92 if (
object.hasKinResolution()) {
97 TMatrixD* CovM = &CovM3;
100 CovM3(0, 0) =
pow(
object.resolEt(resolutionProvider), 2);
101 if (dynamic_cast<const reco::Jet*>(&
object))
103 if (dynamic_cast<const reco::MET*>(&
object))
104 CovM3(1, 1) =
pow(9999., 2);
106 CovM3(1, 1) =
pow(
object.resolEta(resolutionProvider), 2);
107 CovM3(2, 2) =
pow(
object.resolPhi(resolutionProvider), 2);
111 CovM3(0, 0) =
pow(
object.resolEt(resolutionProvider), 2);
112 if (dynamic_cast<const reco::Jet*>(&
object))
114 CovM3(1, 1) =
pow(
object.resolTheta(resolutionProvider), 2);
115 CovM3(2, 2) =
pow(
object.resolPhi(resolutionProvider), 2);
119 CovM4(0, 0) =
pow(1, 2);
120 CovM4(1, 1) =
pow(1, 2);
121 CovM4(2, 2) =
pow(1, 2);
122 CovM4(3, 3) =
pow(1, 2);
131 const TLorentzVector p4(
object.px(),
object.py(),
object.pz(),
object.
energy());
140 if (dynamic_cast<const reco::Jet*>(&
object)) {
147 else if (dynamic_cast<const reco::Muon*>(&
object))
150 else if (dynamic_cast<const reco::GsfElectron*>(&
object))
153 else if (dynamic_cast<const reco::MET*>(&
object))
157 throw cms::Exception(
"UnsupportedObject") <<
"The object given is not supported!\n";
163 double etaDependentScaleFactor = 1.;
166 if (
i == jetEnergyResolutionEtaBinning_.size() - 1) {
168 << jetEnergyResolutionEtaBinning_[
i] <<
") using scale factor 1.0!";
169 etaDependentScaleFactor = 1.;
176 return etaDependentScaleFactor;
Param
supported parameterizations
std::vector< std::string > binsB_
const std::vector< double > jetEnergyResolutionEtaBinning_
std::vector< std::string > funcEtUdsc_
vectors for the resolution functions
std::vector< std::string > binsMet_
TMatrixD setupMatrix(const pat::PATObject< T > &object, const TopKinFitter::Param param, const std::string &resolutionProvider="")
return covariance matrix for a PAT object
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
ObjectType getObjectType(const pat::PATObject< T > &object, const bool isBJet=false)
determine type for a given PAT object
std::vector< std::string > funcEtaB_
Abs< T >::type abs(const T &t)
CovarianceMatrix()
default constructor
std::vector< std::string > funcPhiUdsc_
std::vector< std::string > funcPhiLep_
std::vector< std::string > funcEtaUdsc_
double getResolution(const pat::PATObject< T > &object, const std::string &whichResolution, const bool isBJet=false)
get resolution for a given PAT object
std::vector< std::string > funcEtLep_
std::vector< std::string > funcEtMet_
std::vector< std::string > funcEtaLep_
std::vector< std::string > binsLep_
Templated PAT object container.
Log< level::Warning, false > LogWarning
std::vector< std::string > funcEtaMet_
std::vector< std::string > funcPhiMet_
Power< A, B >::type pow(const A &a, const B &b)
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