CMS 3D CMS Logo

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, AlgebraicVectorderivative (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const std::vector< RefCountedKinematicParticle > &par) const override
 
AlgebraicVector deviations (int nStates) const override
 
bool isEmpty () const
 
 MultipleKinematicConstraint ()
 
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

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 16 of file MultipleKinematicConstraint.h.

Constructor & Destructor Documentation

MultipleKinematicConstraint::MultipleKinematicConstraint ( )
inline

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.

Referenced by MultipleKinematicConstraint().

4 {
5  if(newConst == nullptr)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 54 of file MultipleKinematicConstraint.h.

References MultipleKinematicConstraint().

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

Implements KinematicConstraint.

Definition at line 39 of file MultipleKinematicConstraint.cc.

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

Referenced by MultipleKinematicConstraint().

40 {
41  if(cts.empty()) throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint");
42  if(exPoint.num_row() ==0 ) throw VertexException("MultipleKinematicConstraint::value requested for zero Linearization point");
43 
44 //security check for extended cartesian parametrization
45  int inSize = exPoint.num_row();
46  if((inSize%7) !=0) throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension");
47 
48 
49  AlgebraicVector par = exPoint;
50  int total = 0;
51  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
52  {total += (*i)->numberOfEquations();}
53 
54 //Full derivative matrix: (numberOfConstraints x 7*numberOfStates)
55  AlgebraicMatrix dr(total,inSize);
56 
57  int cr_size = 0;
58  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
59  {
60 //matrix should be (nx7*NumberOfStates)
61  AlgebraicMatrix lConst = (*i)->derivative(par).first;
62  dr.sub(cr_size+1,1,lConst);
63  cr_size += (*i)->numberOfEquations();
64  }
65  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,par);
66 }
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 107 of file MultipleKinematicConstraint.cc.

References KineDebug3::count(), cts, runTauDisplay::dr, mps_fire::i, and pileupDistInMC::total.

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

References cts, and mps_fire::i.

Referenced by MultipleKinematicConstraint().

140 {
141  AlgebraicVector dev(nStates*7,0);
142  if(cts.empty()) throw VertexException("MultipleKinematicConstraint::deviations requested for empty constraint");
143  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
144  {
145  AlgebraicVector dev_loc =(*i)->deviations(nStates);
146  for(int j = 1; j < nStates*7+1; j++){dev(j) = dev(j) + dev_loc(j);}
147  }
148  return dev;
149 }
Common base class.
std::vector< KinematicConstraint * > cts
CLHEP::HepVector AlgebraicVector
bool MultipleKinematicConstraint::isEmpty ( void  ) const
inline

Definition at line 51 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 68 of file MultipleKinematicConstraint.cc.

References cts, mps_fire::i, and Vispa.Plugins.EdmBrowser.EdmDataAccessor::ne().

Referenced by MultipleKinematicConstraint().

69 {
70  int ne = 0;
71  if(cts.empty()) throw VertexException("MultipleKinematicConstraint::number of equations requested for empty constraint");
72  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
73  {ne += (*i)->numberOfEquations();}
74  return ne;
75 }
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, and pileupDistInMC::total.

Referenced by MultipleKinematicConstraint().

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

References KineDebug3::count(), cts, mps_fire::i, and pileupDistInMC::total.

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

Member Data Documentation

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