123 std::vector<RefCountedKinematicParticle> prt = iSort.
sort(
trees);
124 int nStates = prt.size();
133 for (std::vector<RefCountedKinematicParticle>::const_iterator
i = prt.begin();
i != prt.end();
i++) {
135 for (
int j = 1;
j != 8;
j++) {
136 part(7 * l_c +
j) = lp(
j - 1);
138 AlgebraicSymMatrix lc = asHepMatrix<7>((*i)->currentState().kinematicParametersError().matrix());
139 cov.sub(7 * l_c + 1, lc);
140 chi_in(l_c + 1) = (*i)->chiSquared();
141 ndf_in(l_c + 1) = (*i)->degreesOfFreedom();
169 vl =
cs->value(exPoint).first;
170 dr =
cs->derivative(exPoint).first;
171 dev =
cs->deviations(nStates);
189 LogDebug(
"KinematicConstrainedVertexFitter") <<
"Fit failed: unable to invert covariance matrix\n";
190 return std::vector<RefCountedKinematicTree>();
198 refPar =
part - (cov * drt * lambda);
207 for (
int i = 1;
i < nStates * 7 + 1; ++
i) {
208 for (
int j = 1;
j < nStates * 7 + 1;
j++) {
210 sCovF(
i,
j) = covF(
i,
j);
217 for (
int i = 1;
i < nStates + 1;
i++) {
218 for (
int j = 1;
j < 8;
j++) {
219 refCovS((
i - 1) +
j, (
i - 1) +
j) += dev(
j);
224 for (
int k = 1;
k < nStates + 1;
k++) {
225 chi(
k) += (lambda.T() * (
dr * delta_alpha + vl))(1);
226 ndf(
k) +=
cs->numberOfEquations();
231 for (
int i = 1;
i < vl.num_row();
i++) {
240 std::vector<RefCountedKinematicParticle> refPart;
241 std::vector<RefCountedKinematicTree> refTrees =
trees;
244 std::vector<RefCountedKinematicTree>::const_iterator tr = refTrees.begin();
245 for (std::vector<RefCountedKinematicParticle>::const_iterator
i = prt.begin();
i != prt.end();
i++) {
247 for (
int k = 1;
k < 8;
k++) {
248 lRefPar(
k - 1) = refPar((
j - 1) * 7 +
k);
255 KinematicState kState(param, er, (*i)->initialState().particleCharge(), (**i).magneticField());
259 (*tr)->findParticle(*
i);
261 (*tr)->replaceCurrentParticle(refParticle);
270 (*tr)->replaceCurrentVertex(
nVertex);
T getParameter(std::string const &) const
ROOT::Math::SVector< double, 7 > AlgebraicVector7
void setParameters(const edm::ParameterSet &pSet)
std::vector< RefCountedKinematicTree > fit(const std::vector< RefCountedKinematicTree > &trees, KinematicConstraint *cs) const override
CLHEP::HepMatrix AlgebraicMatrix
Abs< T >::type abs(const T &t)
CLHEP::HepVector AlgebraicVector
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
LagrangeParentParticleFitter()
CLHEP::HepSymMatrix AlgebraicSymMatrix
static RefCountedKinematicVertex vertex(const VertexState &state, float totalChiSq, float degreesOfFr)
AlgebraicSymMatrix77 const & matrix() const