CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoVertex/KinematicFit/src/CombinedKinematicConstraint.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFit/interface/CombinedKinematicConstraint.h"
00002 
00003 AlgebraicVector  CombinedKinematicConstraint::value(const std::vector<KinematicState> states, const GlobalPoint& point) const
00004 {
00005         AlgebraicVector tmpValue;
00006         int size = 0;
00007         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00008                 tmpValue = (*it)->value(states, point);
00009                 size += tmpValue.num_row();
00010         }
00011         AlgebraicVector values(size);
00012         int position = 1;
00013         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00014                 tmpValue =  (*it)->value(states, point);
00015                 values.sub(position, tmpValue);
00016                 position += tmpValue.num_row();
00017         }
00018         
00019         return values;
00020 }
00021 
00022 AlgebraicMatrix CombinedKinematicConstraint::parametersDerivative(const std::vector<KinematicState> states, const GlobalPoint& point) const
00023 {
00024         AlgebraicMatrix tmpMatrix;
00025         int row = 0;
00026         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00027                 tmpMatrix = (*it)->parametersDerivative(states, point);
00028                 row += tmpMatrix.num_row();
00029         }
00030         AlgebraicMatrix matrix(row,7*states.size(),0);
00031         int posRow = 1;
00032         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00033                 tmpMatrix =  (*it)->parametersDerivative(states, point);
00034                 matrix.sub(posRow, 1, tmpMatrix);
00035                 posRow += tmpMatrix.num_row();
00036         }
00037         
00038         return matrix;
00039 }
00040 
00041 AlgebraicMatrix CombinedKinematicConstraint::positionDerivative(const std::vector<KinematicState> states, const GlobalPoint& point) const
00042 {
00043         AlgebraicMatrix tmpMatrix;
00044         int row = 0;
00045         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00046                 tmpMatrix = (*it)->positionDerivative(states, point);
00047                 row += tmpMatrix.num_row();
00048         }
00049         AlgebraicMatrix matrix(row,3,0);
00050         int posRow = 1;
00051         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it){
00052                 tmpMatrix =  (*it)->positionDerivative(states, point);
00053                 matrix.sub(posRow, 1, tmpMatrix);
00054                 posRow += tmpMatrix.num_row();
00055         }
00056         
00057         return matrix;
00058 }
00059 
00060 int CombinedKinematicConstraint::numberOfEquations() const
00061 {
00062         int noEq = 0;
00063         for (std::vector<MultiTrackKinematicConstraint* >::const_iterator it=constraints.begin(); it!=constraints.end(); ++it) noEq += (*it)->numberOfEquations();
00064         
00065         return noEq;
00066 }