CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
MultipleKinematicConstraint Class Reference

#include <MultipleKinematicConstraint.h>

Inheritance diagram for MultipleKinematicConstraint:
KinematicConstraint

Public Member Functions

void addConstraint (KinematicConstraint *newConst) const
 
MultipleKinematicConstraintclone () const override
 
std::pair< AlgebraicMatrix,
AlgebraicVector
derivative (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicMatrix,
AlgebraicVector
derivative (const std::vector< RefCountedKinematicParticle > &par) const override
 
AlgebraicVector deviations (int nStates) const override
 
bool isEmpty () const
 
 MultipleKinematicConstraint ()
 
int numberOfEquations () const override
 
std::pair< AlgebraicVector,
AlgebraicVector
value (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicVector,
AlgebraicVector
value (const std::vector< RefCountedKinematicParticle > &par) const override
 
- Public Member Functions inherited from KinematicConstraint
 KinematicConstraint ()
 
virtual ~KinematicConstraint ()
 

Private Attributes

std::vector
< KinematicConstraint * > 
cts
 
bool em
 

Detailed Description

Class implementing constraint multiplication for single or multiple track refit. Multiple track refit does not include vertexing constraint: only refit of tarjectory parameters is usually done.

Definition at line 15 of file MultipleKinematicConstraint.h.

Constructor & Destructor Documentation

MultipleKinematicConstraint::MultipleKinematicConstraint ( )
inline

Definition at line 17 of file MultipleKinematicConstraint.h.

References em.

Referenced by clone().

Member Function Documentation

void MultipleKinematicConstraint::addConstraint ( KinematicConstraint newConst) const

Method adding new constraint to the list of existing ones.

Definition at line 3 of file MultipleKinematicConstraint.cc.

References cts, and em.

3  {
4  if (newConst == nullptr)
5  throw VertexException("MultipleKinematicConstraint::zero constraint pointer passed");
6  cts.push_back(newConst);
7  em = false;
8 }
Common base class.
std::vector< KinematicConstraint * > cts
MultipleKinematicConstraint* MultipleKinematicConstraint::clone ( ) const
inlineoverridevirtual

Clone method

Implements KinematicConstraint.

Definition at line 49 of file MultipleKinematicConstraint.h.

References MultipleKinematicConstraint().

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

Implements KinematicConstraint.

Definition at line 42 of file MultipleKinematicConstraint.cc.

References cts, runTauDisplay::dr, mps_fire::i, and dqmMemoryStats::total.

43  {
44  if (cts.empty())
45  throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint");
46  if (exPoint.num_row() == 0)
47  throw VertexException("MultipleKinematicConstraint::value requested for zero Linearization point");
48 
49  //security check for extended cartesian parametrization
50  int inSize = exPoint.num_row();
51  if ((inSize % 7) != 0)
52  throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension");
53 
54  AlgebraicVector par = exPoint;
55  int total = 0;
56  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
57  total += (*i)->numberOfEquations();
58  }
59 
60  //Full derivative matrix: (numberOfConstraints x 7*numberOfStates)
61  AlgebraicMatrix dr(total, inSize);
62 
63  int cr_size = 0;
64  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
65  //matrix should be (nx7*NumberOfStates)
66  AlgebraicMatrix lConst = (*i)->derivative(par).first;
67  dr.sub(cr_size + 1, 1, lConst);
68  cr_size += (*i)->numberOfEquations();
69  }
70  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, par);
71 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
std::pair< AlgebraicMatrix, AlgebraicVector > MultipleKinematicConstraint::derivative ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Implements KinematicConstraint.

Definition at line 116 of file MultipleKinematicConstraint.cc.

References submitPVResolutionJobs::count, cts, runTauDisplay::dr, mps_fire::i, dqmiolumiharvest::j, and dqmMemoryStats::total.

117  {
118  if (cts.empty())
119  throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint");
120  int nStates = par.size();
121  AlgebraicVector param(7 * nStates, 0);
122 
123  int count = 1;
124  for (std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i != par.end(); i++) {
125  for (int j = 1; j < 8; j++) {
126  param((count - 1) * 7 + j) = (*i)->currentState().kinematicParameters().vector()(j - 1);
127  }
128  count++;
129  }
130  int total = 0;
131  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
132  total += (*i)->numberOfEquations();
133  }
134  AlgebraicMatrix dr(total, 7 * nStates);
135 
136  int cr_size = 0;
137  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
138  //matrix should be (TotalNumberOfEquations x 7* TotalNumberOfStates)
139  //Derivative matrix for given constraint
140  AlgebraicMatrix lConst = (*i)->derivative(param).first;
141 
142  //putting it into the appropriate line
143  dr.sub(cr_size + 1, 1, lConst);
144  cr_size += (*i)->numberOfEquations();
145  }
146  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, param);
147 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
AlgebraicVector MultipleKinematicConstraint::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 149 of file MultipleKinematicConstraint.cc.

References cts, mps_fire::i, and dqmiolumiharvest::j.

149  {
150  AlgebraicVector dev(nStates * 7, 0);
151  if (cts.empty())
152  throw VertexException("MultipleKinematicConstraint::deviations requested for empty constraint");
153  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
154  AlgebraicVector dev_loc = (*i)->deviations(nStates);
155  for (int j = 1; j < nStates * 7 + 1; j++) {
156  dev(j) = dev(j) + dev_loc(j);
157  }
158  }
159  return dev;
160 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepVector AlgebraicVector
bool MultipleKinematicConstraint::isEmpty ( void  ) const
inline

Definition at line 47 of file MultipleKinematicConstraint.h.

References em.

Referenced by plotting.Plot::clone().

int MultipleKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Returns an actual number of equations in particular constraint (corresponds to the number of strings in constraint derivative matrix, for example)

Implements KinematicConstraint.

Definition at line 73 of file MultipleKinematicConstraint.cc.

References cts, and mps_fire::i.

73  {
74  int ne = 0;
75  if (cts.empty())
76  throw VertexException("MultipleKinematicConstraint::number of equations requested for empty constraint");
77  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
78  ne += (*i)->numberOfEquations();
79  }
80  return ne;
81 }
Common base class.
std::vector< KinematicConstraint * > cts
std::pair< AlgebraicVector, AlgebraicVector > MultipleKinematicConstraint::value ( const AlgebraicVector exPoint) const
overridevirtual

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

Implements KinematicConstraint.

Definition at line 10 of file MultipleKinematicConstraint.cc.

References cts, mps_fire::i, dqmiolumiharvest::j, and dqmMemoryStats::total.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), Types.string::configValue(), Types.FileInPath::configValue(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), and Types.vstring::insertInto().

10  {
11  if (cts.empty())
12  throw VertexException("MultipleKinematicConstraint::value requested for empty constraint");
13  if (exPoint.num_row() == 0)
14  throw VertexException("MultipleKinematicConstraint::value requested for zero Linearization point");
15 
16  //looking for total number of states, represented by this point.
17  //Since this version only works with extended cartesian parametrization,
18  //we check whether the dimensionof he point is n*7
19  AlgebraicVector expansion = exPoint;
20  int inSize = exPoint.num_row();
21  if ((inSize % 7) != 0)
22  throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension");
23 
24  int total = 0;
25  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
26  total += (*i)->numberOfEquations();
27  }
28  AlgebraicVector vl(total, 0);
29 
30  int cr_size = 0;
31  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
32  AlgebraicVector vlc = (*i)->value(expansion).first;
33  int sz = vlc.num_row();
34  for (int j = 1; j < sz + 1; j++) {
35  vl(cr_size + j) = vlc(j);
36  }
37  cr_size += sz;
38  }
39  return std::pair<AlgebraicVector, AlgebraicVector>(vl, expansion);
40 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepVector AlgebraicVector
std::pair< AlgebraicVector, AlgebraicVector > MultipleKinematicConstraint::value ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Vector of values and matrix of derivatives, calu=culated at linearization point of current particle states

Implements KinematicConstraint.

Definition at line 83 of file MultipleKinematicConstraint.cc.

References submitPVResolutionJobs::count, cts, mps_fire::i, dqmiolumiharvest::j, and dqmMemoryStats::total.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), Types.string::configValue(), Types.FileInPath::configValue(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), and Types.vstring::insertInto().

84  {
85  if (cts.empty())
86  throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint");
87  int nStates = par.size();
88  AlgebraicVector param(7 * nStates, 0);
89  int count = 1;
90  for (std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i != par.end(); i++) {
91  for (int j = 1; j < 8; j++) {
92  param((count - 1) * 7 + j) = (*i)->currentState().kinematicParameters().vector()(j - 1);
93  }
94  count++;
95  }
96 
97  //looking for total number of equations
98  int total = 0;
99  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
100  total += (*i)->numberOfEquations();
101  }
102  AlgebraicVector vl(total, 0);
103 
104  int cr_size = 0;
105  for (std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {
106  AlgebraicVector vlc = (*i)->value(par).first;
107  int sz = vlc.num_row();
108  for (int j = 1; j <= sz; j++) {
109  vl(cr_size + j) = vlc(j);
110  }
111  cr_size += sz;
112  }
113  return std::pair<AlgebraicVector, AlgebraicVector>(vl, param);
114 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepVector AlgebraicVector

Member Data Documentation

std::vector<KinematicConstraint *> MultipleKinematicConstraint::cts
mutableprivate
bool MultipleKinematicConstraint::em
mutableprivate