CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CandKinResolution.cc
Go to the documentation of this file.
4 
5 
7  parametrization_(Invalid),
8  covariances_(),
9  constraints_(),
10  hasMatrix_(false), 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  hasMatrix_(true),
19  covmatrix_()
20 {
21  fillMatrix();
22 }
23 
24 pat::CandKinResolution::CandKinResolution(Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const std::vector<Scalar> &constraints) :
25  parametrization_(parametrization),
26  covariances_(),
27  constraints_(constraints),
28  hasMatrix_(true),
29  covmatrix_(covariance)
30 {
31  fillVector();
32  if (sizeof(double) != sizeof(Scalar)) { // should become boost::mpl::if_c
33  fillMatrix(); // forcing double => float => double conversion
34  }
35 }
36 
38 }
39 
41 {
42  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
43  return pat::helper::ResolutionHelper::getResolEta(parametrization_, covmatrix_, p4);
44 }
46 {
47  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
48  return pat::helper::ResolutionHelper::getResolTheta(parametrization_, covmatrix_, p4);
49 }
51 {
52  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
53  return pat::helper::ResolutionHelper::getResolPhi(parametrization_, covmatrix_, p4);
54 }
56 {
57  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
58  return pat::helper::ResolutionHelper::getResolE(parametrization_, covmatrix_, p4);
59 }
61 {
62  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
63  return pat::helper::ResolutionHelper::getResolEt(parametrization_, covmatrix_, p4);
64 }
66 {
67  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
68  return pat::helper::ResolutionHelper::getResolM(parametrization_, covmatrix_, p4);
69 }
71 {
72  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
73  return pat::helper::ResolutionHelper::getResolP(parametrization_, covmatrix_, p4);
74 }
76 {
77  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
78  return pat::helper::ResolutionHelper::getResolPt(parametrization_, covmatrix_, p4);
79 }
81 {
82  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
83  return pat::helper::ResolutionHelper::getResolPInv(parametrization_, covmatrix_, p4);
84 }
86 {
87  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
88  return pat::helper::ResolutionHelper::getResolPx(parametrization_, covmatrix_, p4);
89 }
91 {
92  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
93  return pat::helper::ResolutionHelper::getResolPy(parametrization_, covmatrix_, p4);
94 }
96 {
97  if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
98  return pat::helper::ResolutionHelper::getResolPz(parametrization_, covmatrix_, p4);
99 }
100 
102  if (dimension() == 3) {
103  AlgebraicSymMatrix33 sub = covmatrix_.Sub<AlgebraicSymMatrix33>(0,0);
104  covariances_.insert(covariances_.end(), sub.begin(), sub.end());
105  } else {
106  covariances_.insert(covariances_.end(), covmatrix_.begin(), covmatrix_.end());
107  }
108 }
110  if (dimension() == 3) {
111  if (covariances_.size() == 3) {
112  for (int i = 0; i < 3; ++i) covmatrix_(i,i) = covariances_[i];
113  } else {
114  covmatrix_.Place_at(AlgebraicSymMatrix33(covariances_.begin(), covariances_.end()), 0, 0);
115  }
116  } else if (dimension() == 4) {
117  if (covariances_.size() == 4) {
118  for (int i = 0; i < 4; ++i) covmatrix_(i,i) = covariances_[i];
119  } else {
120  covmatrix_ = AlgebraicSymMatrix44(covariances_.begin(), covariances_.end());
121  }
122  }
123 }
double getResolEt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
int i
Definition: DBlmapReader.cc:9
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)
double getResolPx(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
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)
double getResolE(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
void fillMatrix() const
Fill matrix from vector.
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
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.
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.
math::XYZTLorentzVector LorentzVector
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.
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.