Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:14

0001 #include "RecoVertex/KinematicFit/interface/CombinedKinematicConstraint.h"
0002 
0003 AlgebraicVector CombinedKinematicConstraint::value(const std::vector<KinematicState>& states,
0004                                                    const GlobalPoint& point) const {
0005   AlgebraicVector tmpValue;
0006   int size = 0;
0007   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0008        ++it) {
0009     tmpValue = (*it)->value(states, point);
0010     size += tmpValue.num_row();
0011   }
0012   AlgebraicVector values(size);
0013   int position = 1;
0014   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0015        ++it) {
0016     tmpValue = (*it)->value(states, point);
0017     values.sub(position, tmpValue);
0018     position += tmpValue.num_row();
0019   }
0020 
0021   return values;
0022 }
0023 
0024 AlgebraicMatrix CombinedKinematicConstraint::parametersDerivative(const std::vector<KinematicState>& states,
0025                                                                   const GlobalPoint& point) const {
0026   AlgebraicMatrix tmpMatrix;
0027   int row = 0;
0028   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0029        ++it) {
0030     tmpMatrix = (*it)->parametersDerivative(states, point);
0031     row += tmpMatrix.num_row();
0032   }
0033   AlgebraicMatrix matrix(row, 7 * states.size(), 0);
0034   int posRow = 1;
0035   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0036        ++it) {
0037     tmpMatrix = (*it)->parametersDerivative(states, point);
0038     matrix.sub(posRow, 1, tmpMatrix);
0039     posRow += tmpMatrix.num_row();
0040   }
0041 
0042   return matrix;
0043 }
0044 
0045 AlgebraicMatrix CombinedKinematicConstraint::positionDerivative(const std::vector<KinematicState>& states,
0046                                                                 const GlobalPoint& point) const {
0047   AlgebraicMatrix tmpMatrix;
0048   int row = 0;
0049   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0050        ++it) {
0051     tmpMatrix = (*it)->positionDerivative(states, point);
0052     row += tmpMatrix.num_row();
0053   }
0054   AlgebraicMatrix matrix(row, 3, 0);
0055   int posRow = 1;
0056   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0057        ++it) {
0058     tmpMatrix = (*it)->positionDerivative(states, point);
0059     matrix.sub(posRow, 1, tmpMatrix);
0060     posRow += tmpMatrix.num_row();
0061   }
0062 
0063   return matrix;
0064 }
0065 
0066 int CombinedKinematicConstraint::numberOfEquations() const {
0067   int noEq = 0;
0068   for (std::vector<MultiTrackKinematicConstraint*>::const_iterator it = constraints.begin(); it != constraints.end();
0069        ++it)
0070     noEq += (*it)->numberOfEquations();
0071 
0072   return noEq;
0073 }