1 #ifndef KinematicConstrainedVertexUpdatorT_H
2 #define KinematicConstrainedVertexUpdatorT_H
15 namespace KineDebug3 {
33 template <
int nTrk,
int nConstra
int>
52 const ROOT::Math::SVector<double, 3 + 7 * nTrk>& inState,
53 ROOT::Math::SMatrix<
double, 3 + 7 * nTrk, 3 + 7 * nTrk, ROOT::Math::MatRepSym<double, 3 + 7 * nTrk> >& inCov,
54 std::vector<KinematicState>& lStates,
63 ROOT::Math::SMatrix<double, nConstraint + 4, 3 + 7 * nTrk>
g;
64 ROOT::Math::SVector<double, nConstraint + 4>
val;
65 ROOT::Math::SVector<double, 3 + 7 * nTrk>
finPar;
66 ROOT::Math::SVector<double, nConstraint + 4>
lambda;
67 ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3> >
pCov = ROOT::Math::SMatrixNoInit();
68 ROOT::Math::SMatrix<double, 7, 7, ROOT::Math::MatRepSym<double, 7> >
nCovariance = ROOT::Math::SMatrixNoInit();
69 ROOT::Math::SMatrix<double, nConstraint + 4, nConstraint + 4, ROOT::Math::MatRepSym<double, nConstraint + 4> >
75 template <
int nTrk,
int nConstra
int>
78 template <
int nTrk,
int nConstra
int>
81 template <
int nTrk,
int nConstra
int>
83 const ROOT::Math::SVector<double, 3 + 7 * nTrk>& inPar,
84 ROOT::Math::SMatrix<
double, 3 + 7 * nTrk, 3 + 7 * nTrk, ROOT::Math::MatRepSym<double, 3 + 7 * nTrk> >& inCov,
85 std::vector<KinematicState>& lStates,
91 int vSize = lStates.size();
93 assert(nConstraint == 0 || cs !=
nullptr);
94 assert(vSize == nConstraint);
99 delta_alpha(0) -= lPoint.
x();
100 delta_alpha(1) -= lPoint.
y();
101 delta_alpha(2) -= lPoint.
z();
103 for (std::vector<KinematicState>::const_iterator
i = lStates.begin();
i != lStates.end();
i++)
104 for (
int j = 0;
j < 7;
j++) {
105 delta_alpha(cst) -=
i->kinematicParameters()(
j);
114 if (nConstraint != 0) {
115 cs->
init(lStates, lPoint, fieldValue);
121 vConstraint.init(lStates, lPoint, fieldValue);
122 val.Place_at(vConstraint.value(), nConstraint);
123 g.Place_at(vConstraint.positionDerivative(), nConstraint, 0);
124 g.Place_at(vConstraint.parametersDerivative(), nConstraint, 3);
127 v_g_sym = ROOT::Math::Similarity(
g, inCov);
132 edm::LogWarning(
"KinematicConstrainedVertexUpdatorFailed") <<
"invert failed\n" << v_g_sym;
133 LogDebug(
"KinematicConstrainedVertexFitter3") <<
"Fit failed: unable to invert SYM gain matrix\n";
139 val +=
g * delta_alpha;
140 lambda = v_g_sym *
val;
143 finPar = inPar - inCov * (ROOT::Math::Transpose(
g) * lambda);
146 ROOT::Math::SMatrix<double, 3 + 7 * nTrk, 3 + 7 * nTrk, ROOT::Math::MatRepSym<double, 3 + 7 * nTrk> > prod =
147 ROOT::Math::SimilarityT(
g, v_g_sym);
148 ROOT::Math::SMatrix<double, 3 + 7 * nTrk, 3 + 7 * nTrk, ROOT::Math::MatRepSym<double, 3 + 7 * nTrk> >
prod1;
149 ROOT::Math::AssignSym::Evaluate(prod1, inCov * prod * inCov);
153 pCov = inCov.template Sub<ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3> > >(0, 0);
156 double chi = ROOT::Math::Dot(lambda, val);
160 float ndf = 2 * vSize - 3;
171 for (std::vector<KinematicState>::iterator i_st = lStates.begin(); i_st != lStates.end(); i_st++) {
172 for (
int i = 0;
i < 7;
i++) {
173 newPar(
i) = finPar(3 + i_int * 7 +
i);
176 nCovariance = inCov.template Sub<ROOT::Math::SMatrix<double, 7, 7, ROOT::Math::MatRepSym<double, 7> > >(
177 3 + i_int * 7, 3 + i_int * 7);
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > pCov
const edm::EventSetup & c
RefCountedKinematicVertex update(const ROOT::Math::SVector< double, 3+7 *nTrk > &inState, ROOT::Math::SMatrix< double, 3+7 *nTrk, 3+7 *nTrk, ROOT::Math::MatRepSym< double, 3+7 *nTrk > > &inCov, std::vector< KinematicState > &lStates, const GlobalPoint &lPoint, GlobalVector const &fieldValue, MultiTrackKinematicConstraintT< nTrk, nConstraint > *cs)
ROOT::Math::SMatrix< double, nConstraint+4, nConstraint+4, ROOT::Math::MatRepSym< double, nConstraint+4 > > v_g_sym
unique_ptr< ClusterSequence > cs
ROOT::Math::SVector< double, 7 > AlgebraicVector7
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
ROOT::Math::SVector< double, nConstraint+4 > val
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
VertexKinematicConstraintT vConstraint
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
~KinematicConstrainedVertexUpdatorT()
ROOT::Math::SVector< double, 3+7 *nTrk > finPar
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > nCovariance
parametersDerivativeType const & parametersDerivative() const
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
positionDerivativeType const & positionDerivative() const
ROOT::Math::SVector< double, nConstraint+4 > lambda
KinematicConstrainedVertexUpdatorT()
virtual void init(const std::vector< KinematicState > &states, const GlobalPoint &point, const GlobalVector &mf)=0
Log< level::Warning, false > LogWarning
KinematicVertexFactory vFactory
valueType const & value() const
ROOT::Math::SMatrix< double, nConstraint+4, 3+7 *nTrk > g
ROOT::Math::SVector< double, 3+7 *nTrk > delta_alpha