1 #ifndef CovarianceMatrix_h
2 #define CovarianceMatrix_h
36 CovarianceMatrix(
const std::vector<edm::ParameterSet> udscResolutions,
const std::vector<edm::ParameterSet> bResolutions,
37 const std::vector<double> jetEnergyResolutionScaleFactors,
const std::vector<double> jetEnergyResolutionEtaBinning);
39 CovarianceMatrix(
const std::vector<edm::ParameterSet> udscResolutions,
const std::vector<edm::ParameterSet> bResolutions,
40 const std::vector<edm::ParameterSet> lepResolutions,
const std::vector<edm::ParameterSet> metResolutions,
41 const std::vector<double> jetEnergyResolutionScaleFactors,
const std::vector<double> jetEnergyResolutionEtaBinning);
51 double getResolution(
const TLorentzVector&
object,
const ObjectType objType,
const std::string& whichResolution =
"");
84 if(
object.hasKinResolution()) {
85 TMatrixD CovM3 (3,3); CovM3.Zero();
86 TMatrixD CovM4 (4,4); CovM4.Zero();
87 TMatrixD* CovM = &CovM3;
90 CovM3(0,0) =
pow(
object.resolEt(resolutionProvider) , 2);
91 if( dynamic_cast<const reco::Jet*>(&
object) )
93 if( dynamic_cast<const reco::MET*>(&
object) )
94 CovM3(1,1) =
pow(9999., 2);
96 CovM3(1,1) =
pow(
object.resolEta(resolutionProvider), 2);
97 CovM3(2,2) =
pow(
object.resolPhi(resolutionProvider), 2);
101 CovM3(0,0) =
pow(
object.resolEt(resolutionProvider) , 2);
102 if( dynamic_cast<const reco::Jet*>(&
object) )
104 CovM3(1,1) =
pow(
object.resolTheta(resolutionProvider), 2);
105 CovM3(2,2) =
pow(
object.resolPhi(resolutionProvider) , 2);
109 CovM4(0,0) =
pow(1, 2);
110 CovM4(1,1) =
pow(1, 2);
111 CovM4(2,2) =
pow(1, 2);
112 CovM4(3,3) =
pow(1, 2);
121 const TLorentzVector
p4(
object.px(),
object.py(),
object.pz(),
object.
energy());
131 if( dynamic_cast<const reco::Jet*>(&
object) ) {
138 else if( dynamic_cast<const reco::Muon*>(&
object) )
141 else if( dynamic_cast<const reco::GsfElectron*>(&
object) )
144 else if( dynamic_cast<const reco::MET*>(&
object) )
148 throw cms::Exception(
"UnsupportedObject") <<
"The object given is not supported!\n";
155 double etaDependentScaleFactor = 1.;
158 if(
i==jetEnergyResolutionEtaBinning_.size()-1) {
159 edm::LogWarning(
"CovarianceMatrix") <<
"object eta ("<<
std::abs(
object.
eta())<<
") beyond last eta bin ("<<jetEnergyResolutionEtaBinning_[
i]<<
") using scale factor 1.0!";
160 etaDependentScaleFactor=1.;
168 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_
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.
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