CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MomentumKinematicConstraint Class Reference

#include <MomentumKinematicConstraint.h>

Inheritance diagram for MomentumKinematicConstraint:
KinematicConstraint

Public Member Functions

MomentumKinematicConstraintclone () const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const std::vector< RefCountedKinematicParticle > &par) const override
 
AlgebraicVector deviations (int nStates) const override
 
 MomentumKinematicConstraint (const AlgebraicVector &momentum, const AlgebraicVector &dev)
 
int numberOfEquations () const override
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const std::vector< RefCountedKinematicParticle > &par) const override
 
- Public Member Functions inherited from KinematicConstraint
 KinematicConstraint ()
 
virtual ~KinematicConstraint ()
 

Private Attributes

AlgebraicVector dd
 
AlgebraicVector mm
 

Detailed Description

Class constraining total 3-momentum of the particle (p_x,p_y,p_z) This constraint can not be implemented on multiple particles, without fitting the vertex. Current version supports one state refit only.

Kirill Prokofiev, October 2003 MultiState version: July 2004

Definition at line 15 of file MomentumKinematicConstraint.h.

Constructor & Destructor Documentation

◆ MomentumKinematicConstraint()

MomentumKinematicConstraint::MomentumKinematicConstraint ( const AlgebraicVector momentum,
const AlgebraicVector dev 
)

Constructor with the 4-momentum vector as an argument

Definition at line 4 of file MomentumKinematicConstraint.cc.

References dd, and mm.

Referenced by clone().

4  {
5  if ((momentum.num_row() != 3) || (dev.num_row() != 3))
6  throw VertexException("MomentumKinemticConstraint::Momentum or Deviation vector passed is not 3-dimensional");
7  mm = momentum;
8  AlgebraicVector dev_l(7, 0);
9  dev_l(4) = dev(1) * dev(1);
10  dev_l(5) = dev(2) * dev(2);
11  dev_l(6) = dev(3) * dev(3);
12  dd = dev_l;
13 }
Common base class.
CLHEP::HepVector AlgebraicVector

Member Function Documentation

◆ clone()

MomentumKinematicConstraint* MomentumKinematicConstraint::clone ( ) const
inlineoverridevirtual

Clone method

Implements KinematicConstraint.

Definition at line 48 of file MomentumKinematicConstraint.h.

References MomentumKinematicConstraint().

48 { return new MomentumKinematicConstraint(*this); }
MomentumKinematicConstraint(const AlgebraicVector &momentum, const AlgebraicVector &dev)

◆ derivative() [1/2]

std::pair< AlgebraicMatrix, AlgebraicVector > MomentumKinematicConstraint::derivative ( const AlgebraicVector exPoint) const
overridevirtual

Implements KinematicConstraint.

Definition at line 34 of file MomentumKinematicConstraint.cc.

References flavorHistoryFilter_cfi::dr.

35  {
36  if (exPoint.num_row() == 0)
37  throw VertexException("MomentumKinematicConstraint::derivative requested for zero Linearization point");
38 
39  //security check for extended cartesian parametrization
40  int inSize = exPoint.num_row();
41  if ((inSize % 7) != 0)
42  throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
43  int nStates = inSize / 7;
44  if (nStates != 1)
45  throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
46 
47  AlgebraicVector pr = exPoint;
48  AlgebraicMatrix dr(3, 7, 0);
49  dr(1, 4) = 1.;
50  dr(2, 5) = 1.;
51  dr(3, 6) = 1.;
52  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, pr);
53 }
Common base class.
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector

◆ derivative() [2/2]

std::pair< AlgebraicMatrix, AlgebraicVector > MomentumKinematicConstraint::derivative ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Vector of values and matrix of derivatives calculated using current state parameters as expansion point

Implements KinematicConstraint.

Definition at line 70 of file MomentumKinematicConstraint.cc.

References flavorHistoryFilter_cfi::dr, and point.

71  {
72  int nStates = par.size();
73  if (nStates == 0)
74  throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
75  if (nStates != 1)
76  throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
77  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
78  AlgebraicMatrix dr(3, 7, 0);
79  dr(1, 4) = 1.;
80  dr(2, 5) = 1.;
81  dr(3, 6) = 1.;
82  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, point);
83 }
Common base class.
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ deviations()

AlgebraicVector MomentumKinematicConstraint::deviations ( int  nStates) const
overridevirtual

Returns vector of sigma squared associated to the KinematicParameters of refitted particles Initial deviations are given by user for the constraining parameters (mass, momentum components etc). In case of multiple states exactly the same values are added to every particle parameters

Implements KinematicConstraint.

Definition at line 85 of file MomentumKinematicConstraint.cc.

References dd.

85  {
86  if (nStates == 0)
87  throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
88  if (nStates != 1)
89  throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
91  return res;
92 }
Common base class.
Definition: Electron.h:6
CLHEP::HepVector AlgebraicVector

◆ numberOfEquations()

int MomentumKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Returns number of constraint equations used for fitting. Method is relevant for proper NDF calculations.

Implements KinematicConstraint.

Definition at line 94 of file MomentumKinematicConstraint.cc.

94 { return 3; }

◆ value() [1/2]

std::pair< AlgebraicVector, AlgebraicVector > MomentumKinematicConstraint::value ( const AlgebraicVector exPoint) const
overridevirtual

Vector of values and matrix of derivatives calculated at given expansion 7xNumberOfStates point

Implements KinematicConstraint.

Definition at line 15 of file MomentumKinematicConstraint.cc.

References mm.

15  {
16  if (exPoint.num_row() == 0)
17  throw VertexException("MomentumKinematicConstraint::value requested for zero Linearization point");
18 
19  //security check for extended cartesian parametrization
20  int inSize = exPoint.num_row();
21  if ((inSize % 7) != 0)
22  throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
23  int nStates = inSize / 7;
24  if (nStates != 1)
25  throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
26  AlgebraicVector pr = exPoint;
27  AlgebraicVector vl(3, 0);
28  vl(1) = pr(4) - mm(1);
29  vl(2) = pr(5) - mm(2);
30  vl(3) = pr(6) - mm(3);
31  return std::pair<AlgebraicVector, AlgebraicVector>(vl, pr);
32 }
Common base class.
CLHEP::HepVector AlgebraicVector

◆ value() [2/2]

std::pair< AlgebraicVector, AlgebraicVector > MomentumKinematicConstraint::value ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Methods making value and derivative matrix using current state parameters as expansion 7-point. Constraint can be made equaly for single and multiple states

Implements KinematicConstraint.

Definition at line 55 of file MomentumKinematicConstraint.cc.

References mm, and point.

56  {
57  int nStates = par.size();
58  if (nStates == 0)
59  throw VertexException("MomentumKinematicConstraint::Empty vector of particles passed");
60  if (nStates != 1)
61  throw VertexException("MomentumKinematicConstraint::Multistate refit is not foreseen for this constraint");
62  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
63  AlgebraicVector vl(3, 0);
64  vl(1) = point(4) - mm(1);
65  vl(2) = point(5) - mm(2);
66  vl(3) = point(6) - mm(3);
67  return std::pair<AlgebraicVector, AlgebraicVector>(vl, point);
68 }
Common base class.
CLHEP::HepVector AlgebraicVector
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

◆ dd

AlgebraicVector MomentumKinematicConstraint::dd
private

Definition at line 52 of file MomentumKinematicConstraint.h.

Referenced by deviations(), and MomentumKinematicConstraint().

◆ mm

AlgebraicVector MomentumKinematicConstraint::mm
private

Definition at line 51 of file MomentumKinematicConstraint.h.

Referenced by MomentumKinematicConstraint(), and value().