CMS 3D CMS Logo

pat::CandKinResolution Class Reference

#include <DataFormats/PatCandidates/interface/CandKinResolution.h>

List of all members.

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

Private Member Functions

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

Private Attributes

std::vector< Scalarconstraints_
 Constraints.
std::vector< Scalarcovariances_
 Matrix, streamed as a vector.
AlgebraicSymMatrix44 covmatrix_
 Transient copy of the full 4x4 covariance matrix.
edm::BoolCache hasMatrix_
 Did we make the Matrix from the vector?
Parametrization parametrization_
 Parametrization code.


Detailed Description

Definition at line 11 of file CandKinResolution.h.


Member Typedef Documentation

typedef math::XYZTLorentzVector pat::CandKinResolution::LorentzVector

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 33 of file CandKinResolution.h.

typedef float pat::CandKinResolution::Scalar

Definition at line 34 of file CandKinResolution.h.


Member Enumeration Documentation

enum pat::CandKinResolution::Parametrization

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

Definition at line 36 of file CandKinResolution.h.

00036                              { Invalid=0, 
00037                 // 4D = 0xN4
00038                 Cart          = 0x04, 
00039                 ECart         = 0x14, 
00040                 Spher         = 0x24, 
00041                 ESpher        = 0x34, 
00042                 MomDev        = 0x44, 
00043                 EMomDev       = 0x54, 
00044                 // 3D =0xN3
00045                 MCCart        = 0x03, 
00046                 MCSpher       = 0x13, 
00047                 MCPInvSpher   = 0x23, 
00048                 EtEtaPhi      = 0x33, 
00049                 EtThetaPhi    = 0x43,
00050                 MCMomDev      = 0x53, 
00051                 EScaledMomDev = 0x63
00052                 };


Constructor & Destructor Documentation

pat::CandKinResolution::CandKinResolution (  ) 

Definition at line 6 of file CandKinResolution.cc.

00006                                         : 
00007     parametrization_(Invalid), 
00008     covariances_(),
00009     constraints_(),
00010     hasMatrix_(false), covmatrix_() 
00011 { 
00012 }

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().

00014                                                                                                                                                    :
00015     parametrization_(parametrization),
00016     covariances_(covariances), 
00017     constraints_(constraints),
00018     hasMatrix_(true),
00019     covmatrix_()
00020 {
00021     fillMatrix();
00022 }

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 24 of file CandKinResolution.cc.

References fillMatrix(), and fillVector().

00024                                                                                                                                                      :
00025     parametrization_(parametrization),
00026     covariances_(), 
00027     constraints_(constraints),
00028     hasMatrix_(true),
00029     covmatrix_(covariance)
00030 {
00031     fillVector();
00032     if (sizeof(double) != sizeof(Scalar)) { // should become boost::mpl::if_c
00033         fillMatrix(); // forcing double => float => double conversion 
00034     }
00035 }

pat::CandKinResolution::~CandKinResolution (  ) 

Definition at line 37 of file CandKinResolution.cc.

00037                                          {
00038 }


Member Function Documentation

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

The constraints associated with this parametrization.

Definition at line 86 of file CandKinResolution.h.

References constraints_.

00086 { return constraints_; }

const AlgebraicSymMatrix44& pat::CandKinResolution::covariance ( void   )  const [inline]

Returns the full covariance matrix.

Definition at line 80 of file CandKinResolution.h.

References covmatrix_, fillMatrix(), and hasMatrix_.

00080                                                          { 
00081             if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00082             return covmatrix_; 
00083         }

uint32_t pat::CandKinResolution::dimension (  )  const [inline]

Returns the number of free parameters in this parametrization.

Definition at line 75 of file CandKinResolution.h.

References parametrization_.

Referenced by fillMatrix(), and fillVector().

00075                                    { 
00076             return (static_cast<uint32_t>(parametrization_) & 0x0F);
00077         }

void pat::CandKinResolution::fillMatrix (  )  const [private]

Fill matrix from vector.

Definition at line 109 of file CandKinResolution.cc.

References covariances_, covmatrix_, dimension(), and i.

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

00109                                             { 
00110     if (dimension() == 3) {
00111         if (covariances_.size() == 3) {
00112             for (int i = 0; i < 3; ++i) covmatrix_(i,i) = covariances_[i];
00113         } else {
00114             covmatrix_.Place_at(AlgebraicSymMatrix33(covariances_.begin(), covariances_.end()), 0, 0);
00115         }
00116     } else if (dimension() == 4) {
00117         if (covariances_.size() == 4) {
00118             for (int i = 0; i < 4; ++i) covmatrix_(i,i) = covariances_[i];
00119         } else {
00120             covmatrix_ = AlgebraicSymMatrix44(covariances_.begin(), covariances_.end());
00121         }
00122     }
00123 }

void pat::CandKinResolution::fillVector (  )  [private]

Fill vectoor from matrix.

Definition at line 101 of file CandKinResolution.cc.

References covariances_, covmatrix_, and dimension().

Referenced by CandKinResolution().

00101                                       { 
00102     if (dimension() == 3) {
00103         AlgebraicSymMatrix33 sub = covmatrix_.Sub<AlgebraicSymMatrix33>(0,0);
00104         covariances_.insert(covariances_.end(), sub.begin(), sub.end());
00105     } else {
00106         covariances_.insert(covariances_.end(), covmatrix_.begin(), covmatrix_.end());
00107     }
00108 }

Parametrization pat::CandKinResolution::parametrization (  )  const [inline]

Return the code of the parametrization used in this object.

Definition at line 72 of file CandKinResolution.h.

References parametrization_.

00072 { return parametrization_; }

double pat::CandKinResolution::resolE ( const LorentzVector p4  )  const

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

Definition at line 55 of file CandKinResolution.cc.

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

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

00056 {
00057     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00058     return pat::helper::ResolutionHelper::getResolE(parametrization_, covmatrix_, p4);
00059 }

double pat::CandKinResolution::resolEt ( const LorentzVector p4  )  const

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

Definition at line 60 of file CandKinResolution.cc.

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

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

00061 {
00062     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00063     return pat::helper::ResolutionHelper::getResolEt(parametrization_, covmatrix_, p4);
00064 }

double pat::CandKinResolution::resolEta ( const LorentzVector p4  )  const

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

Definition at line 40 of file CandKinResolution.cc.

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

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

00041 {
00042     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00043     return pat::helper::ResolutionHelper::getResolEta(parametrization_, covmatrix_, p4);
00044 }

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 65 of file CandKinResolution.cc.

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

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

00066 {
00067     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00068     return pat::helper::ResolutionHelper::getResolM(parametrization_, covmatrix_, p4);
00069 }

double pat::CandKinResolution::resolP ( const LorentzVector p4  )  const

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

Definition at line 70 of file CandKinResolution.cc.

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

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

00071 {
00072     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00073     return pat::helper::ResolutionHelper::getResolP(parametrization_, covmatrix_, p4);
00074 }

double pat::CandKinResolution::resolPhi ( const LorentzVector p4  )  const

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

Definition at line 50 of file CandKinResolution.cc.

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

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

00051 {
00052     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00053     return pat::helper::ResolutionHelper::getResolPhi(parametrization_, covmatrix_, p4);
00054 }

double pat::CandKinResolution::resolPInv ( const LorentzVector p4  )  const

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

Definition at line 80 of file CandKinResolution.cc.

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

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

double pat::CandKinResolution::resolPt ( const LorentzVector p4  )  const

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

Definition at line 75 of file CandKinResolution.cc.

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

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

00076 {
00077     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00078     return pat::helper::ResolutionHelper::getResolPt(parametrization_, covmatrix_, p4);
00079 }

double pat::CandKinResolution::resolPx ( const LorentzVector p4  )  const

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

Definition at line 85 of file CandKinResolution.cc.

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

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

00086 {
00087     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00088     return pat::helper::ResolutionHelper::getResolPx(parametrization_, covmatrix_, p4);
00089 }

double pat::CandKinResolution::resolPy ( const LorentzVector p4  )  const

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

Definition at line 90 of file CandKinResolution.cc.

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

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

00091 {
00092     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00093     return pat::helper::ResolutionHelper::getResolPy(parametrization_, covmatrix_, p4);
00094 }

double pat::CandKinResolution::resolPz ( const LorentzVector p4  )  const

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

Definition at line 95 of file CandKinResolution.cc.

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

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

00096 {
00097     if (!hasMatrix_) { fillMatrix(); hasMatrix_ = true; }
00098     return pat::helper::ResolutionHelper::getResolPz(parametrization_, covmatrix_, p4);
00099 }

double pat::CandKinResolution::resolTheta ( const LorentzVector p4  )  const

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

Definition at line 45 of file CandKinResolution.cc.

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

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


Member Data Documentation

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

Constraints.

Definition at line 132 of file CandKinResolution.h.

Referenced by constraints().

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

Matrix, streamed as a vector.

Definition at line 130 of file CandKinResolution.h.

Referenced by fillMatrix(), and fillVector().

AlgebraicSymMatrix44 pat::CandKinResolution::covmatrix_ [mutable, private]

Transient copy of the full 4x4 covariance matrix.

Definition at line 140 of file CandKinResolution.h.

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

edm::BoolCache pat::CandKinResolution::hasMatrix_ [mutable, private]

Did we make the Matrix from the vector?

Definition at line 137 of file CandKinResolution.h.

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

Parametrization pat::CandKinResolution::parametrization_ [private]

Parametrization code.

Definition at line 128 of file CandKinResolution.h.

Referenced by dimension(), parametrization(), resolE(), resolEt(), resolEta(), resolM(), resolP(), resolPhi(), resolPInv(), resolPt(), resolPx(), resolPy(), resolPz(), and resolTheta().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:49:31 2009 for CMSSW by  doxygen 1.5.4