CMS 3D CMS Logo

CandKinResolution.cc
Go to the documentation of this file.
4 
5 pat::CandKinResolution::CandKinResolution() : parametrization_(Invalid), covariances_(), constraints_(), covmatrix_() {}
6 
8  const std::vector<Scalar> &covariances,
9  const std::vector<Scalar> &constraints)
10  : parametrization_(parametrization), covariances_(covariances), constraints_(constraints), covmatrix_() {
11  fillMatrix();
12 }
13 
15  const AlgebraicSymMatrix44 &covariance,
16  const std::vector<Scalar> &constraints)
17  : parametrization_(parametrization), covariances_(), constraints_(constraints), covmatrix_(covariance) {
18  fillVector();
19  if (sizeof(double) != sizeof(Scalar)) { // should become boost::mpl::if_c
20  fillMatrix(); // forcing double => float => double conversion
21  }
22 }
23 
25 
27  return pat::helper::ResolutionHelper::getResolEta(parametrization_, covmatrix_, p4);
28 }
30  return pat::helper::ResolutionHelper::getResolTheta(parametrization_, covmatrix_, p4);
31 }
33  return pat::helper::ResolutionHelper::getResolPhi(parametrization_, covmatrix_, p4);
34 }
36  return pat::helper::ResolutionHelper::getResolE(parametrization_, covmatrix_, p4);
37 }
39  return pat::helper::ResolutionHelper::getResolEt(parametrization_, covmatrix_, p4);
40 }
42  return pat::helper::ResolutionHelper::getResolM(parametrization_, covmatrix_, p4);
43 }
45  return pat::helper::ResolutionHelper::getResolP(parametrization_, covmatrix_, p4);
46 }
48  return pat::helper::ResolutionHelper::getResolPt(parametrization_, covmatrix_, p4);
49 }
51  return pat::helper::ResolutionHelper::getResolPInv(parametrization_, covmatrix_, p4);
52 }
54  return pat::helper::ResolutionHelper::getResolPx(parametrization_, covmatrix_, p4);
55 }
57  return pat::helper::ResolutionHelper::getResolPy(parametrization_, covmatrix_, p4);
58 }
60  return pat::helper::ResolutionHelper::getResolPz(parametrization_, covmatrix_, p4);
61 }
62 
64  if (dimension() == 3) {
65  AlgebraicSymMatrix33 sub = covmatrix_.Sub<AlgebraicSymMatrix33>(0, 0);
66  covariances_.insert(covariances_.end(), sub.begin(), sub.end());
67  } else {
68  covariances_.insert(covariances_.end(), covmatrix_.begin(), covmatrix_.end());
69  }
70 }
71 
73  const std::vector<Scalar> &covariances,
74  AlgebraicSymMatrix44 &covmatrix) {
75  int dimension = dimensionFrom(parametrization);
76  if (dimension == 3) {
77  if (covariances.size() == 3) {
78  for (int i = 0; i < 3; ++i)
79  covmatrix(i, i) = covariances[i];
80  } else {
81  covmatrix.Place_at(AlgebraicSymMatrix33(covariances.begin(), covariances.end()), 0, 0);
82  }
83  } else if (dimension == 4) {
84  if (covariances.size() == 4) {
85  for (int i = 0; i < 4; ++i)
86  covmatrix(i, i) = covariances[i];
87  } else {
88  covmatrix = AlgebraicSymMatrix44(covariances.begin(), covariances.end());
89  }
90  }
91 }
92 
93 void pat::CandKinResolution::fillMatrix() { fillMatrixFrom(parametrization_, covariances_, covmatrix_); }
pat::CandKinResolution::resolP
double resolP(const LorentzVector &p4) const
Resolution on p, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:44
pat::helper::ParametrizationHelper::dimension
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
Definition: ParametrizationHelper.h:12
AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: AlgebraicROOTObjects.h:21
mps_fire.i
i
Definition: mps_fire.py:355
pat::CandKinResolution::resolPx
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:53
pat::helper::ResolutionHelper::getResolEta
double getResolEta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:455
pat::CandKinResolution::resolPhi
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:32
pat::CandKinResolution::resolPInv
double resolPInv(const LorentzVector &p4) const
Resolution on 1/p, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:50
CandKinResolution.h
pat::helper::ResolutionHelper::getResolEt
double getResolEt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:326
ParametrizationHelper.h
pat::CandKinResolution::Scalar
float Scalar
Definition: CandKinResolution.h:33
pat::helper::ResolutionHelper::getResolTheta
double getResolTheta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:479
pat::CandKinResolution::fillMatrix
void fillMatrix()
Fill matrix from vector.
Definition: CandKinResolution.cc:93
pat::CandKinResolution::resolPy
double resolPy(const LorentzVector &p4) const
Resolution on py, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:56
pat::helper::ResolutionHelper::getResolPy
double getResolPy(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:178
pat::helper::ResolutionHelper::getResolP
double getResolP(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:34
pat::CandKinResolution::Parametrization
Parametrization
Definition: CandKinResolution.h:35
stringResolutionProvider_cfi.parametrization
parametrization
specify parametrization (see SWGuidePATKinematicResolutions for more details)
Definition: stringResolutionProvider_cfi.py:6
pat::CandKinResolution::resolM
double resolM(const LorentzVector &p4) const
Definition: CandKinResolution.cc:41
pat::helper::ResolutionHelper::getResolPt
double getResolPt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:68
pat::CandKinResolution::~CandKinResolution
~CandKinResolution()
Definition: CandKinResolution.cc:24
pat::CandKinResolution::CandKinResolution
CandKinResolution()
Definition: CandKinResolution.cc:5
pat::helper::ResolutionHelper::getResolPhi
double getResolPhi(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:511
pat::helper::ResolutionHelper::getResolPInv
double getResolPInv(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:110
pat::CandKinResolution::resolPt
double resolPt(const LorentzVector &p4) const
Resolution on pt, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:47
p4
double p4[4]
Definition: TauolaWrapper.h:92
pat::helper::ResolutionHelper::getResolPx
double getResolPx(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:137
pat::CandKinResolution::resolE
double resolE(const LorentzVector &p4) const
Resolution on energy, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:35
Invalid
Definition: hltDiff.cc:248
createBeamHaloJobs.constraints
string constraints
Definition: createBeamHaloJobs.py:229
ResolutionHelper.h
AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
Definition: AlgebraicROOTObjects.h:22
pat::CandKinResolution::fillMatrixFrom
static void fillMatrixFrom(Parametrization parametrization, const std::vector< Scalar > &covariances, AlgebraicSymMatrix44 &covmatrix)
Definition: CandKinResolution.cc:72
pat::helper::ResolutionHelper::getResolM
double getResolM(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:408
pat::CandKinResolution::resolTheta
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:29
pat::CandKinResolution::resolPz
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:59
pat::helper::ResolutionHelper::getResolPz
double getResolPz(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:219
pat::helper::ResolutionHelper::getResolE
double getResolE(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Definition: ResolutionHelper.cc:267
pat::CandKinResolution::fillVector
void fillVector()
Fill vectoor from matrix.
Definition: CandKinResolution.cc:63
pat::CandKinResolution::resolEta
double resolEta(const LorentzVector &p4) const
Resolution on eta, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:26
pat::CandKinResolution::LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: CandKinResolution.h:32
pat::CandKinResolution::resolEt
double resolEt(const LorentzVector &p4) const
Resolution on et, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:38