CMS 3D CMS Logo

CandKinResolution.cc
Go to the documentation of this file.
4 
5 
7  parametrization_(Invalid),
8  covariances_(),
9  constraints_(),
10  covmatrix_()
11 {
12 }
13 
14 pat::CandKinResolution::CandKinResolution(Parametrization parametrization, const std::vector<Scalar> &covariances, const std::vector<Scalar> &constraints) :
15  parametrization_(parametrization),
16  covariances_(covariances),
17  constraints_(constraints),
18  covmatrix_()
19 {
20  fillMatrix();
21 }
22 
24  parametrization_(parametrization),
25  covariances_(),
26  constraints_(constraints),
27  covmatrix_(covariance)
28 {
29  fillVector();
30  if (sizeof(double) != sizeof(Scalar)) { // should become boost::mpl::if_c
31  fillMatrix(); // forcing double => float => double conversion
32  }
33 }
34 
36 }
37 
39 {
41 }
43 {
45 }
47 {
49 }
51 {
53 }
55 {
57 }
59 {
61 }
63 {
65 }
67 {
69 }
71 {
73 }
75 {
77 }
79 {
81 }
83 {
85 }
86 
88  if (dimension() == 3) {
90  covariances_.insert(covariances_.end(), sub.begin(), sub.end());
91  } else {
92  covariances_.insert(covariances_.end(), covmatrix_.begin(), covmatrix_.end());
93  }
94 }
95 
97  const std::vector<Scalar>& covariances,
98  AlgebraicSymMatrix44& covmatrix) {
99  int dimension = dimensionFrom(parametrization);
100  if (dimension == 3) {
101  if (covariances.size() == 3) {
102  for (int i = 0; i < 3; ++i) covmatrix(i,i) = covariances[i];
103  } else {
104  covmatrix.Place_at(AlgebraicSymMatrix33(covariances.begin(), covariances.end()), 0, 0);
105  }
106  } else if (dimension == 4) {
107  if (covariances.size() == 4) {
108  for (int i = 0; i < 4; ++i) covmatrix(i,i) = covariances[i];
109  } else {
110  covmatrix = AlgebraicSymMatrix44(covariances.begin(), covariances.end());
111  }
112  }
113 }
114 
115 
118 }
double getResolEt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPz(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
double getResolPy(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolP(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
std::vector< Scalar > constraints_
Constraints.
double getResolPx(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
uint32_t dimension() const
Returns the number of free parameters in this parametrization.
double getResolPt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPhi(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolM(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPInv(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
const AlgebraicSymMatrix44 & covariance() const
Returns the full covariance matrix.
double getResolE(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
static int dimensionFrom(Parametrization parametrization)
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Parametrization parametrization() const
Return the code of the parametrization used in this object.
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
double resolP(const LorentzVector &p4) const
Resolution on p, given the 4-momentum of the associated Candidate.
void fillVector()
Fill vectoor from matrix.
double resolPy(const LorentzVector &p4) const
Resolution on py, given the 4-momentum of the associated Candidate.
double p4[4]
Definition: TauolaWrapper.h:92
double resolEta(const LorentzVector &p4) const
Resolution on eta, given the 4-momentum of the associated Candidate.
const std::vector< Scalar > & constraints() const
The constraints associated with this parametrization.
double resolM(const LorentzVector &p4) const
double resolPInv(const LorentzVector &p4) const
Resolution on 1/p, given the 4-momentum of the associated Candidate.
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
static void fillMatrixFrom(Parametrization parametrization, const std::vector< Scalar > &covariances, AlgebraicSymMatrix44 &covmatrix)
math::XYZTLorentzVector LorentzVector
void fillMatrix()
Fill matrix from vector.
double resolE(const LorentzVector &p4) const
Resolution on energy, given the 4-momentum of the associated Candidate.
double getResolEta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolTheta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double resolEt(const LorentzVector &p4) const
Resolution on et, given the 4-momentum of the associated Candidate.
double resolPt(const LorentzVector &p4) const
Resolution on pt, given the 4-momentum of the associated Candidate.
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.