Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CombinedKinematicConstraint_H
0002 #define CombinedKinematicConstraint_H
0003 
0004 #include "RecoVertex/KinematicFitPrimitives/interface/MultiTrackKinematicConstraint.h"
0005 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicState.h"
0006 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0007 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
0008 
0009 /**
0010  * This class combines several user defined constraints (by expanding the vector d and the matrices D and E).
0011  * Usage:
0012  * Add each constraint to a std::vector<MultiTrackKinematicConstraint* >.
0013  * This vector has to be used in the constructor:
0014  * MultiTrackKinematicConstraint *combiC = new CombinedKinematicConstraint(std::vector<MultiTrackKinematicConstraint* >)
0015  * The produced object can be used by KinematicConstrainedVertexFitter.fit()
0016  *
0017  * Lars Perchalla, Philip Sauerland, Dec 2009
0018  */
0019 
0020 class CombinedKinematicConstraint : public MultiTrackKinematicConstraint {
0021 public:
0022   CombinedKinematicConstraint(const std::vector<MultiTrackKinematicConstraint*>& constraintVector)
0023       : constraints(constraintVector) {
0024     if (constraints.empty())
0025       throw VertexException("CombinedKinematicConstraint::<1 constraints passed.");
0026   }
0027 
0028   /**
0029      * Returns a vector of values of the combined constraint
0030      * equations at the point where the input
0031      * particles are defined.
0032      */
0033   AlgebraicVector value(const std::vector<KinematicState>& states, const GlobalPoint& point) const override;
0034 
0035   /**
0036      * Returns a matrix of derivatives of the combined
0037      * constraint equations w.r.t. 
0038      * particle parameters
0039      */
0040   AlgebraicMatrix parametersDerivative(const std::vector<KinematicState>& states,
0041                                        const GlobalPoint& point) const override;
0042 
0043   /**
0044      * Returns a matrix of derivatives of
0045      * constraint equations w.r.t. 
0046      * vertex position
0047      */
0048   AlgebraicMatrix positionDerivative(const std::vector<KinematicState>& states,
0049                                      const GlobalPoint& point) const override;
0050 
0051   /**
0052      * Number of equations per track used for the combined fit
0053      */
0054   int numberOfEquations() const override;
0055 
0056   CombinedKinematicConstraint* clone() const override { return new CombinedKinematicConstraint(*this); }
0057 
0058 private:
0059   std::vector<MultiTrackKinematicConstraint*> constraints;
0060 };
0061 #endif