59 if(part.size()<2)
throw VertexException(
"KinematicConstrainedVertexFitter::input states are less than 2");
63 std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >
input = iSort.
sort(part);
64 const std::vector<RefCountedKinematicParticle> &
particles = input.first;
65 const std::vector<FreeTrajectoryState> & fStates = input.second;
78 int vSize = particles.size();
89 std::vector<KinematicState> inStates;
90 for(std::vector<RefCountedKinematicParticle>::const_iterator
i = particles.begin();
i!=particles.end();
i++)
94 LogDebug(
"KinematicConstrainedVertexFitter")
95 <<
"State is invalid at point: "<<linPoint<<std::endl;
99 for(
int j = 1; j<8; j++){inPar(3 + 7*nSt + j) = prPar(j);}
101 inCov.sub(4 + 7*nSt,4 + 7*nSt ,l_cov);
102 inStates.push_back(state);
113 inPar(1) = linPoint.
x();
114 inPar(2) = linPoint.
y();
115 inPar(3) = linPoint.
z();
123 std::vector<KinematicState> lStates = inStates;
129 bool convergence =
false;
137 const std::vector<KinematicState> &newStates = lRes.first.first;
139 if (particles.size() != newStates.size()) {
140 LogDebug(
"KinematicConstrainedVertexFitter")
141 <<
"updator failure\n";
148 double newchisq = rVtx->chiSquared();
150 LogDebug(
"KinematicConstrainedVertexFitter")
151 <<
"bad chisq and insufficient improvement, bailing\n";
162 deltapos[0] = newPoint.
x() - lPoint.
x();
163 deltapos[1] = newPoint.
y() - lPoint.
y();
164 deltapos[2] = newPoint.
z() - lPoint.
z();
165 for (
int i=0;
i<3; ++
i) {
166 double delta = deltapos[
i]*deltapos[
i]/rVtx->error().matrix()(
i,
i);
167 if (delta>maxDelta) maxDelta =
delta;
170 for (std::vector<KinematicState>::const_iterator itold = lStates.begin(), itnew = newStates.begin();
171 itnew!=newStates.end(); ++itold,++itnew) {
172 for (
int i=0;
i<7; ++
i) {
173 double deltapar = itnew->kinematicParameters()(
i) - itold->kinematicParameters()(
i);
174 double delta = deltapar*deltapar/itnew->kinematicParametersError().matrix()(
i,
i);
175 if (delta>maxDelta) maxDelta =
delta;
182 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
T getParameter(std::string const &) const
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)
AlgebraicVector7 const & vector() const
The full vector (7 elements)
auto_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
virtual LinearizationPointFinder * clone() const =0
KinematicParametersError const & kinematicParametersError() const
KinematicConstrainedVertexUpdator * updator
void setParameters(const edm::ParameterSet &pSet)
~KinematicConstrainedVertexFitter()
CLHEP::HepVector AlgebraicVector
KinematicParameters const & kinematicParameters() const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
KinematicConstrainedVertexFitter()
VertexKinematicConstraint * vCons