52 throw VertexException(
"KinematicConstrainedVertexFitter::input states are less than 2");
56 std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >
input = iSort.
sort(part);
57 const std::vector<RefCountedKinematicParticle> &
particles = input.first;
58 const std::vector<FreeTrajectoryState> &fStates = input.second;
70 int vSize = particles.size();
81 std::vector<KinematicState> inStates;
82 for (std::vector<RefCountedKinematicParticle>::const_iterator
i = particles.begin();
i != particles.end();
i++) {
85 LogDebug(
"KinematicConstrainedVertexFitter") <<
"State is invalid at point: " << linPoint << std::endl;
89 for (
int j = 1;
j < 8;
j++) {
90 inPar(3 + 7 * nSt +
j) = prPar(
j);
93 inCov.sub(4 + 7 * nSt, 4 + 7 * nSt, l_cov);
94 inStates.push_back(state);
105 inPar(1) = linPoint.
x();
106 inPar(2) = linPoint.
y();
107 inPar(3) = linPoint.
z();
115 std::vector<KinematicState> lStates = inStates;
121 bool convergence =
false;
129 const std::vector<KinematicState> &newStates = lRes.first.first;
131 if (particles.size() != newStates.size()) {
132 LogDebug(
"KinematicConstrainedVertexFitter") <<
"updator failure\n";
138 double newchisq = rVtx->chiSquared();
141 LogDebug(
"KinematicConstrainedVertexFitter") <<
"bad chisq and insufficient improvement, bailing\n";
148 double maxDelta = 0.0;
151 deltapos[0] = newPoint.
x() - lPoint.
x();
152 deltapos[1] = newPoint.
y() - lPoint.
y();
153 deltapos[2] = newPoint.
z() - lPoint.
z();
154 for (
int i = 0;
i < 3; ++
i) {
155 double delta = deltapos[
i] * deltapos[
i] / rVtx->error().matrix()(
i,
i);
156 if (delta > maxDelta)
160 for (std::vector<KinematicState>::const_iterator itold = lStates.begin(), itnew = newStates.begin();
161 itnew != newStates.end();
163 for (
int i = 0;
i < 7; ++
i) {
164 double deltapar = itnew->kinematicParameters()(
i) - itold->kinematicParameters()(
i);
165 double delta = deltapar * deltapar / itnew->kinematicParametersError().matrix()(
i,
i);
166 if (delta > maxDelta)
174 refCCov = lRes.first.second;
std::pair< std::pair< std::vector< KinematicState >, AlgebraicMatrix >, RefCountedKinematicVertex > update(const AlgebraicVector &inState, const AlgebraicMatrix &inCov, const std::vector< KinematicState > &lStates, const GlobalPoint &lPoint, MultiTrackKinematicConstraint *cs) const
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)
AlgebraicVector7 const & vector() const
The full vector (7 elements)
unique_ptr< ClusterSequence > cs
AlgebraicSymMatrix77 const & matrix() const
float theMinChiSqImprovement
static std::string const input
RefCountedKinematicTree buildTree(const std::vector< RefCountedKinematicParticle > &initialParticles, const std::vector< KinematicState > &finalStates, const RefCountedKinematicVertex vtx, const AlgebraicMatrix &fCov) const
ConstrainedTreeBuilder * tBuilder
CLHEP::HepMatrix AlgebraicMatrix
LinearizationPointFinder * finder
KinematicParametersError const & kinematicParametersError() const
KinematicConstrainedVertexUpdator * updator
void setParameters(const edm::ParameterSet &pSet)
~KinematicConstrainedVertexFitter()
CLHEP::HepVector AlgebraicVector
KinematicParameters const & kinematicParameters() const
T getParameter(std::string const &) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
virtual LinearizationPointFinder * clone() const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
KinematicConstrainedVertexFitter()
VertexKinematicConstraint * vCons