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

Clone method

Implements KinematicConstraint.

Definition at line 54 of file MultipleKinematicConstraint.h.

References MultipleKinematicConstraint().

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

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.size() == 0) 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  AlgebraicVector expansion = exPoint;
46  int inSize = exPoint.num_row();
47  if((inSize%7) !=0) throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension");
48 
49 
50  AlgebraicVector par = exPoint;
51  int total = 0;
52  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
53  {total += (*i)->numberOfEquations();}
54 
55 //Full derivative matrix: (numberOfConstraints x 7*numberOfStates)
56  AlgebraicMatrix dr(total,inSize);
57 
58  int cr_size = 0;
59  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
60  {
61 //matrix should be (nx7*NumberOfStates)
62  AlgebraicMatrix lConst = (*i)->derivative(par).first;
63  dr.sub(cr_size+1,1,lConst);
64  cr_size += (*i)->numberOfEquations();
65  }
66  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,par);
67 }
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
virtual

Implements KinematicConstraint.

Definition at line 108 of file MultipleKinematicConstraint.cc.

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

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

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 140 of file MultipleKinematicConstraint.cc.

References cts, and mps_fire::i.

Referenced by MultipleKinematicConstraint().

141 {
142  AlgebraicVector dev(nStates*7,0);
143  if(cts.size() == 0) throw VertexException("MultipleKinematicConstraint::deviations requested for empty constraint");
144  for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++)
145  {
146  AlgebraicVector dev_loc =(*i)->deviations(nStates);
147  for(int j = 1; j < nStates*7+1; j++){dev(j) = dev(j) + dev_loc(j);}
148  }
149  return dev;
150 }
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
virtual

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 69 of file MultipleKinematicConstraint.cc.

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

Referenced by MultipleKinematicConstraint().

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

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.size() == 0)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
virtual

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

Implements KinematicConstraint.

Definition at line 78 of file MultipleKinematicConstraint.cc.

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

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

Member Data Documentation

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