CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
pat::CandKinResolution Class Reference

#include <CandKinResolution.h>

Public Types

typedef math::XYZTLorentzVector LorentzVector
 
enum  Parametrization {
  Invalid =0, Cart = 0x04, ECart = 0x14, Spher = 0x24,
  ESpher = 0x34, MomDev = 0x44, EMomDev = 0x54, MCCart = 0x03,
  MCSpher = 0x13, MCPInvSpher = 0x23, EtEtaPhi = 0x33, EtThetaPhi = 0x43,
  MCMomDev = 0x53, EScaledMomDev = 0x63
}
 
typedef float Scalar
 

Public Member Functions

 CandKinResolution ()
 
 CandKinResolution (Parametrization parametrization, const std::vector< Scalar > &covariances, const std::vector< Scalar > &constraints=std::vector< Scalar >())
 
 CandKinResolution (Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const std::vector< Scalar > &constraints=std::vector< Scalar >())
 Fill in a cresolution object given a parametrization code, a covariance matrix and a vector of constraints. More...
 
const std::vector< Scalar > & constraints () const
 The constraints associated with this parametrization. More...
 
const AlgebraicSymMatrix44covariance () const
 Returns the full covariance matrix. More...
 
uint32_t dimension () const
 Returns the number of free parameters in this parametrization. More...
 
Parametrization parametrization () const
 Return the code of the parametrization used in this object. More...
 
double resolE (const LorentzVector &p4) const
 Resolution on energy, given the 4-momentum of the associated Candidate. More...
 
double resolEt (const LorentzVector &p4) const
 Resolution on et, given the 4-momentum of the associated Candidate. More...
 
double resolEta (const LorentzVector &p4) const
 Resolution on eta, given the 4-momentum of the associated Candidate. More...
 
double resolM (const LorentzVector &p4) const
 
double resolP (const LorentzVector &p4) const
 Resolution on p, given the 4-momentum of the associated Candidate. More...
 
double resolPhi (const LorentzVector &p4) const
 Resolution on phi, given the 4-momentum of the associated Candidate. More...
 
double resolPInv (const LorentzVector &p4) const
 Resolution on 1/p, given the 4-momentum of the associated Candidate. More...
 
double resolPt (const LorentzVector &p4) const
 Resolution on pt, given the 4-momentum of the associated Candidate. More...
 
double resolPx (const LorentzVector &p4) const
 Resolution on px, given the 4-momentum of the associated Candidate. More...
 
double resolPy (const LorentzVector &p4) const
 Resolution on py, given the 4-momentum of the associated Candidate. More...
 
double resolPz (const LorentzVector &p4) const
 Resolution on pz, given the 4-momentum of the associated Candidate. More...
 
double resolTheta (const LorentzVector &p4) const
 Resolution on theta, given the 4-momentum of the associated Candidate. More...
 
 ~CandKinResolution ()
 

Static Public Member Functions

static int dimensionFrom (Parametrization parametrization)
 
static void fillMatrixFrom (Parametrization parametrization, const std::vector< Scalar > &covariances, AlgebraicSymMatrix44 &covmatrix)
 

Private Member Functions

void fillMatrix ()
 Fill matrix from vector. More...
 
void fillVector ()
 Fill vectoor from matrix. More...
 

Private Attributes

std::vector< Scalarconstraints_
 Constraints. More...
 
std::vector< Scalarcovariances_
 Matrix, streamed as a vector. More...
 
AlgebraicSymMatrix44 covmatrix_
 Transient copy of the full 4x4 covariance matrix. More...
 
Parametrization parametrization_
 Parametrization code. More...
 

Detailed Description

Definition at line 10 of file CandKinResolution.h.

Member Typedef Documentation

Parametrizations

(lowercase means values, uppercase means fixed parameters)
Cart = (px, py, pz, m) KinFitter uses (px, py, pz, m/M0) with M0 = mass of the starting p4
ECart = (px, py, pz, e) as in KinFitter
MCCart = (px, py, pz, M) as in KinFitter
Spher = (p, theta, phi, m) KinFitter uses (p, theta, phi, m/M0) with M0 = mass of the starting p4
ESpher = (p, theta, phi, e) KinFitter uses (p, theta, phi, e/E0) with E0 = energy of the starting
MCSpher = (p, eta, phi, M) as in KinFitter
MCPInvSpher = (1/p, theta, phi, M) as in KinFitter
EtEtaPhi = (et, eta, phi, M == 0) as in KinFitter
EtThetaPhi = (et, theta, phi, M == 0) as in KinFitter
MomDev = (p/P0, dp_theta, dp_phi, m/M0), so that P = [0]*|P0|*u_r + [1]*u_theta + [2]*u_phi
the "u_<xyz>" are polar unit vectors around the initial momentum P0, their directions are:
u_r ~ P0, u_phi ~ u_z x u_r, u_theta ~ u_r x u_phi M0 is the mass of the initial 4-momentum.
EMomDev = (p/P0, dp_theta, dp_phi, E/E0) with the P defined as for MomDev
MCMomDev = (p/P0, dp_theta, dp_phi, M) with the P defined as for MomDev
EScaledMomDev = (p/P0, dp_theta, dp_phi,E/P=E0/P0) with the P defined as for MomDev, fixed E/p to E0/P0

Definition at line 32 of file CandKinResolution.h.

Definition at line 33 of file CandKinResolution.h.

Member Enumeration Documentation

Enumerator
Invalid 
Cart 
ECart 
Spher 
ESpher 
MomDev 
EMomDev 
MCCart 
MCSpher 
MCPInvSpher 
EtEtaPhi 
EtThetaPhi 
MCMomDev 
EScaledMomDev 

Definition at line 35 of file CandKinResolution.h.

Constructor & Destructor Documentation

pat::CandKinResolution::CandKinResolution ( )

Definition at line 6 of file CandKinResolution.cc.

6  :
8  covariances_(),
9  constraints_(),
10  covmatrix_()
11 {
12 }
std::vector< Scalar > constraints_
Constraints.
Parametrization parametrization_
Parametrization code.
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
pat::CandKinResolution::CandKinResolution ( Parametrization  parametrization,
const std::vector< Scalar > &  covariances,
const std::vector< Scalar > &  constraints = std::vector<Scalar>() 
)

Create a resolution object given a parametrization code, a covariance matrix (streamed as a vector) and a vector of constraints.

In the vector you can put either the full triangular block or just the diagonal terms

The triangular block should be written in a way that the constructor AlgebraicSymMatrixNN(covariance.begin(), covariance.end()) works (N = 3 or 4)

Definition at line 14 of file CandKinResolution.cc.

References fillMatrix().

14  :
16  covariances_(covariances),
18  covmatrix_()
19 {
20  fillMatrix();
21 }
std::vector< Scalar > constraints_
Constraints.
Parametrization parametrization_
Parametrization code.
Parametrization parametrization() const
Return the code of the parametrization used in this object.
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
const std::vector< Scalar > & constraints() const
The constraints associated with this parametrization.
void fillMatrix()
Fill matrix from vector.
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
pat::CandKinResolution::CandKinResolution ( Parametrization  parametrization,
const AlgebraicSymMatrix44 covariance,
const std::vector< Scalar > &  constraints = std::vector<Scalar>() 
)

Fill in a cresolution object given a parametrization code, a covariance matrix and a vector of constraints.

Definition at line 23 of file CandKinResolution.cc.

References fillMatrix(), and fillVector().

23  :
25  covariances_(),
28 {
29  fillVector();
30  if (sizeof(double) != sizeof(Scalar)) { // should become boost::mpl::if_c
31  fillMatrix(); // forcing double => float => double conversion
32  }
33 }
std::vector< Scalar > constraints_
Constraints.
const AlgebraicSymMatrix44 & covariance() const
Returns the full covariance matrix.
Parametrization parametrization_
Parametrization code.
Parametrization parametrization() const
Return the code of the parametrization used in this object.
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
void fillVector()
Fill vectoor from matrix.
const std::vector< Scalar > & constraints() const
The constraints associated with this parametrization.
void fillMatrix()
Fill matrix from vector.
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
pat::CandKinResolution::~CandKinResolution ( )

Definition at line 35 of file CandKinResolution.cc.

35  {
36 }

Member Function Documentation

const std::vector<Scalar>& pat::CandKinResolution::constraints ( ) const
inline

The constraints associated with this parametrization.

Definition at line 84 of file CandKinResolution.h.

References constraints_, p4, resolE(), resolEt(), resolEta(), resolM(), resolP(), resolPhi(), resolPInv(), resolPt(), resolPx(), resolPy(), resolPz(), and resolTheta().

84 { return constraints_; }
std::vector< Scalar > constraints_
Constraints.
const AlgebraicSymMatrix44& pat::CandKinResolution::covariance ( void  ) const
inline

Returns the full covariance matrix.

Definition at line 79 of file CandKinResolution.h.

References covmatrix_.

79  {
80  return covmatrix_;
81  }
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
uint32_t pat::CandKinResolution::dimension ( ) const
inline

Returns the number of free parameters in this parametrization.

Definition at line 74 of file CandKinResolution.h.

References dimensionFrom(), and parametrization_.

Referenced by fillMatrixFrom(), and fillVector().

74  {
76  }
Parametrization parametrization_
Parametrization code.
static int dimensionFrom(Parametrization parametrization)
static int pat::CandKinResolution::dimensionFrom ( Parametrization  parametrization)
inlinestatic

Definition at line 123 of file CandKinResolution.h.

References fillMatrixFrom().

Referenced by dimension(), and fillMatrixFrom().

123  {
124  return (static_cast<uint32_t>(parametrization) & 0x0F);
125  }
Parametrization parametrization() const
Return the code of the parametrization used in this object.
void pat::CandKinResolution::fillMatrix ( )
private

Fill matrix from vector.

Definition at line 116 of file CandKinResolution.cc.

References covariances_, covmatrix_, fillMatrixFrom(), and parametrization_.

Referenced by CandKinResolution().

116  {
118 }
Parametrization parametrization_
Parametrization code.
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
static void fillMatrixFrom(Parametrization parametrization, const std::vector< Scalar > &covariances, AlgebraicSymMatrix44 &covmatrix)
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
void pat::CandKinResolution::fillMatrixFrom ( Parametrization  parametrization,
const std::vector< Scalar > &  covariances,
AlgebraicSymMatrix44 covmatrix 
)
static

Definition at line 96 of file CandKinResolution.cc.

References dimension(), dimensionFrom(), and i.

Referenced by dimensionFrom(), and fillMatrix().

98  {
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 }
int i
Definition: DBlmapReader.cc:9
uint32_t dimension() const
Returns the number of free parameters in this parametrization.
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.
void pat::CandKinResolution::fillVector ( )
private

Fill vectoor from matrix.

Definition at line 87 of file CandKinResolution.cc.

References covariances_, covmatrix_, and dimension().

Referenced by CandKinResolution().

87  {
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 }
uint32_t dimension() const
Returns the number of free parameters in this parametrization.
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
std::vector< Scalar > covariances_
Matrix, streamed as a vector.
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
Parametrization pat::CandKinResolution::parametrization ( ) const
inline

Return the code of the parametrization used in this object.

Definition at line 71 of file CandKinResolution.h.

References parametrization_.

71 { return parametrization_; }
Parametrization parametrization_
Parametrization code.
double pat::CandKinResolution::resolE ( const LorentzVector p4) const

Resolution on energy, given the 4-momentum of the associated Candidate.

Definition at line 50 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolE(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolE().

51 {
53 }
double getResolE(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolEt ( const LorentzVector p4) const

Resolution on et, given the 4-momentum of the associated Candidate.

Definition at line 54 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolEt(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolEt().

55 {
57 }
double getResolEt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolEta ( const LorentzVector p4) const

Resolution on eta, given the 4-momentum of the associated Candidate.

Definition at line 38 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolEta(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolEta().

39 {
41 }
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
double getResolEta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolM ( const LorentzVector p4) const

Resolution on the invariant mass, given the 4-momentum of the associated Candidate Warning: returns 0 for mass-constrained parametrizations.

Definition at line 58 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolM(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolM().

59 {
61 }
double getResolM(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolP ( const LorentzVector p4) const

Resolution on p, given the 4-momentum of the associated Candidate.

Definition at line 62 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolP(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolP().

63 {
65 }
double getResolP(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPhi ( const LorentzVector p4) const

Resolution on phi, given the 4-momentum of the associated Candidate.

Definition at line 46 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPhi(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPhi().

47 {
49 }
double getResolPhi(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPInv ( const LorentzVector p4) const

Resolution on 1/p, given the 4-momentum of the associated Candidate.

Definition at line 70 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPInv(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPInv().

71 {
73 }
double getResolPInv(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPt ( const LorentzVector p4) const

Resolution on pt, given the 4-momentum of the associated Candidate.

Definition at line 66 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPt(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPt().

67 {
69 }
double getResolPt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPx ( const LorentzVector p4) const

Resolution on px, given the 4-momentum of the associated Candidate.

Definition at line 74 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPx(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPx().

75 {
77 }
double getResolPx(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPy ( const LorentzVector p4) const

Resolution on py, given the 4-momentum of the associated Candidate.

Definition at line 78 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPy(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPy().

79 {
81 }
double getResolPy(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolPz ( const LorentzVector p4) const

Resolution on pz, given the 4-momentum of the associated Candidate.

Definition at line 82 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolPz(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolPz().

83 {
85 }
double getResolPz(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.
double pat::CandKinResolution::resolTheta ( const LorentzVector p4) const

Resolution on theta, given the 4-momentum of the associated Candidate.

Definition at line 42 of file CandKinResolution.cc.

References covmatrix_, pat::helper::ResolutionHelper::getResolTheta(), and parametrization_.

Referenced by constraints(), and pat::PATObject< reco::Muon >::resolTheta().

43 {
45 }
Parametrization parametrization_
Parametrization code.
double p4[4]
Definition: TauolaWrapper.h:92
double getResolTheta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
AlgebraicSymMatrix44 covmatrix_
Transient copy of the full 4x4 covariance matrix.

Member Data Documentation

std::vector<Scalar> pat::CandKinResolution::constraints_
private

Constraints.

Definition at line 137 of file CandKinResolution.h.

Referenced by constraints().

std::vector<Scalar> pat::CandKinResolution::covariances_
private

Matrix, streamed as a vector.

Definition at line 135 of file CandKinResolution.h.

Referenced by fillMatrix(), and fillVector().

AlgebraicSymMatrix44 pat::CandKinResolution::covmatrix_
private

Transient copy of the full 4x4 covariance matrix.

Definition at line 142 of file CandKinResolution.h.

Referenced by covariance(), fillMatrix(), fillVector(), resolE(), resolEt(), resolEta(), resolM(), resolP(), resolPhi(), resolPInv(), resolPt(), resolPx(), resolPy(), resolPz(), and resolTheta().

Parametrization pat::CandKinResolution::parametrization_
private