File indexing completed on 2024-04-06 12:29:13
0001 #ifndef MultiTrackKinematicConstraintT_H
0002 #define MultiTrackKinematicConstraintT_H
0003
0004 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicParticle.h"
0005 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicVertex.h"
0006 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class MultiTrackKinematicConstraintBaseT {
0027 public:
0028 virtual ~MultiTrackKinematicConstraintBaseT() {}
0029
0030
0031 virtual void init(const std::vector<KinematicState>& states, const GlobalPoint& point, const GlobalVector& mf) = 0;
0032
0033 virtual int numberOfEquations() const = 0;
0034
0035 virtual MultiTrackKinematicConstraintBaseT* clone() const = 0;
0036 };
0037
0038 template <int NTRK, int DIM>
0039 class MultiTrackKinematicConstraintT : public MultiTrackKinematicConstraintBaseT {
0040 public:
0041 enum { nTrk = NTRK, nDim = DIM };
0042
0043 typedef MultiTrackKinematicConstraintT<NTRK, DIM> self;
0044
0045 typedef ROOT::Math::SVector<double, DIM> valueType;
0046
0047 typedef ROOT::Math::SMatrix<double, DIM, 7 * NTRK> parametersDerivativeType;
0048
0049 typedef ROOT::Math::SMatrix<double, DIM, 3> positionDerivativeType;
0050
0051 ~MultiTrackKinematicConstraintT() override {}
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 valueType const& value() const {
0062 fillValue();
0063 return m_vl;
0064 }
0065
0066 parametersDerivativeType const& parametersDerivative() const {
0067 fillParametersDerivative();
0068 return m_jac_d;
0069 };
0070
0071 positionDerivativeType const& positionDerivative() const {
0072 fillPositionDerivative();
0073 return m_jac_e;
0074 }
0075
0076 private:
0077
0078
0079
0080
0081
0082
0083
0084
0085 virtual void fillValue() const = 0;
0086
0087 virtual void fillParametersDerivative() const = 0;
0088
0089 virtual void fillPositionDerivative() const = 0;
0090
0091 protected:
0092 valueType& vl() const { return m_vl; }
0093 parametersDerivativeType& jac_d() const { return m_jac_d; }
0094 positionDerivativeType& jac_e() const { return m_jac_e; }
0095
0096
0097
0098 double& vl(size_t i) const { return m_vl(i); }
0099 double& jac_d(size_t i, size_t j) const { return m_jac_d(i, j); }
0100 double& jac_e(size_t i, size_t j) const { return m_jac_e(i, j); }
0101
0102 private:
0103 mutable valueType m_vl;
0104 mutable parametersDerivativeType m_jac_d;
0105 mutable positionDerivativeType m_jac_e;
0106 };
0107
0108 #endif