#include <MultipleKinematicConstraint.h>
Public Member Functions | |
void | addConstraint (KinematicConstraint *newConst) const |
MultipleKinematicConstraint * | clone () const |
std::pair< AlgebraicMatrix, AlgebraicVector > | derivative (const std::vector< RefCountedKinematicParticle > par) const |
std::pair< AlgebraicMatrix, AlgebraicVector > | derivative (const AlgebraicVector &exPoint) const |
AlgebraicVector | deviations (int nStates) const |
bool | isEmpty () const |
MultipleKinematicConstraint () | |
int | numberOfEquations () const |
std::pair< AlgebraicVector, AlgebraicVector > | value (const AlgebraicVector &exPoint) const |
std::pair< AlgebraicVector, AlgebraicVector > | value (const std::vector< RefCountedKinematicParticle > par) const |
Private Attributes | |
std::vector < KinematicConstraint * > | cts |
bool | em |
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.
MultipleKinematicConstraint::MultipleKinematicConstraint | ( | ) | [inline] |
Definition at line 20 of file MultipleKinematicConstraint.h.
References em.
Referenced by clone().
{em = true;}
void MultipleKinematicConstraint::addConstraint | ( | KinematicConstraint * | newConst | ) | const |
Method adding new constraint to the list of existing ones.
Definition at line 3 of file MultipleKinematicConstraint.cc.
{ if(newConst == 0)throw VertexException("MultipleKinematicConstraint::zero constraint pointer passed"); cts.push_back(newConst); em = false; }
MultipleKinematicConstraint* MultipleKinematicConstraint::clone | ( | ) | const [inline, virtual] |
Clone method
Implements KinematicConstraint.
Definition at line 54 of file MultipleKinematicConstraint.h.
References MultipleKinematicConstraint().
{return new MultipleKinematicConstraint(*this);}
std::pair< AlgebraicMatrix, AlgebraicVector > MultipleKinematicConstraint::derivative | ( | const std::vector< RefCountedKinematicParticle > | par | ) | const [virtual] |
Implements KinematicConstraint.
Definition at line 108 of file MultipleKinematicConstraint.cc.
References prof2calltree::count, cts, i, j, and pileupDistInMC::total.
{ if(cts.size() == 0) throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint"); int nStates = par.size(); AlgebraicVector param(7*nStates,0); int count = 1; for(std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i!=par.end(); i++) { for(int j = 1; j<8; j++){param((count -1)*7+j) = (*i)->currentState().kinematicParameters().vector()(j-1);} count++; } int total = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {total += (*i)->numberOfEquations();} AlgebraicMatrix dr(total,7*nStates); int cr_size = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) { //matrix should be (TotalNumberOfEquations x 7* TotalNumberOfStates) //Derivative matrix for given constraint AlgebraicMatrix lConst = (*i)->derivative(param).first; //putting it into the appropriate line dr.sub(cr_size+1,1,lConst); cr_size += (*i)->numberOfEquations(); } return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,param); }
std::pair< AlgebraicMatrix, AlgebraicVector > MultipleKinematicConstraint::derivative | ( | const AlgebraicVector & | exPoint | ) | const [virtual] |
Implements KinematicConstraint.
Definition at line 39 of file MultipleKinematicConstraint.cc.
References cts, i, and pileupDistInMC::total.
{ if(cts.size() == 0) throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint"); if(exPoint.num_row() ==0 ) throw VertexException("MultipleKinematicConstraint::value requested for zero Linearization point"); //security check for extended cartesian parametrization AlgebraicVector expansion = exPoint; int inSize = exPoint.num_row(); if((inSize%7) !=0) throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension"); AlgebraicVector par = exPoint; int total = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {total += (*i)->numberOfEquations();} //Full derivative matrix: (numberOfConstraints x 7*numberOfStates) AlgebraicMatrix dr(total,inSize); int cr_size = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) { //matrix should be (nx7*NumberOfStates) AlgebraicMatrix lConst = (*i)->derivative(par).first; dr.sub(cr_size+1,1,lConst); cr_size += (*i)->numberOfEquations(); } return std::pair<AlgebraicMatrix, AlgebraicVector>(dr,par); }
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.
{ AlgebraicVector dev(nStates*7,0); if(cts.size() == 0) throw VertexException("MultipleKinematicConstraint::deviations requested for empty constraint"); for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) { AlgebraicVector dev_loc =(*i)->deviations(nStates); for(int j = 1; j < nStates*7+1; j++){dev(j) = dev(j) + dev_loc(j);} } return dev; }
bool MultipleKinematicConstraint::isEmpty | ( | void | ) | const [inline] |
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, i, and Vispa::Plugins::EdmBrowser::EdmDataAccessor::ne().
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 prof2calltree::count, cts, i, j, and pileupDistInMC::total.
{ if(cts.size() == 0) throw VertexException("MultipleKinematicConstraint::derivative requested for empty constraint"); int nStates = par.size(); AlgebraicVector param(7*nStates,0); int count = 1; for(std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i!=par.end(); i++) { for(int j = 1; j<8; j++){param((count -1)*7+j) = (*i)->currentState().kinematicParameters().vector()(j-1);} count++; } //looking for total number of equations int total = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {total += (*i)->numberOfEquations();} AlgebraicVector vl(total,0); int cr_size = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) { AlgebraicVector vlc = (*i)->value(par).first; int sz = vlc.num_row(); for(int j = 1; j <= sz; j++) {vl(cr_size+j) = vlc(j);} cr_size += sz; } return std::pair<AlgebraicVector, AlgebraicVector>(vl,param); }
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, i, j, and pileupDistInMC::total.
{ if(cts.size() == 0)throw VertexException("MultipleKinematicConstraint::value requested for empty constraint"); if(exPoint.num_row() ==0 ) throw VertexException("MultipleKinematicConstraint::value requested for zero Linearization point"); //looking for total number of states, represented by this point. //Since this version only works with extended cartesian parametrization, //we check whether the dimensionof he point is n*7 AlgebraicVector expansion = exPoint; int inSize = exPoint.num_row(); if((inSize%7) !=0) throw VertexException("MultipleKinematicConstraint::linearization point has a wrong dimension"); int total = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) {total += (*i)->numberOfEquations();} AlgebraicVector vl(total,0); int cr_size = 0; for(std::vector<KinematicConstraint *>::const_iterator i = cts.begin(); i != cts.end(); i++) { AlgebraicVector vlc = (*i)->value(expansion).first; int sz = vlc.num_row(); for(int j = 1; j < sz+1; j++) {vl(cr_size+j) = vlc(j);} cr_size += sz; } return std::pair<AlgebraicVector, AlgebraicVector>(vl,expansion); }
std::vector<KinematicConstraint *> MultipleKinematicConstraint::cts [mutable, private] |
Definition at line 59 of file MultipleKinematicConstraint.h.
Referenced by addConstraint(), derivative(), deviations(), numberOfEquations(), and value().
bool MultipleKinematicConstraint::em [mutable, private] |
Definition at line 61 of file MultipleKinematicConstraint.h.
Referenced by addConstraint(), isEmpty(), and MultipleKinematicConstraint().