1 #ifndef KinematicConstrainedVertexFitterT_H 2 #define KinematicConstrainedVertexFitterT_H 52 return fit(part, 0, 0);
60 return fit(part, cs,
nullptr);
103 template <
int nTrk,
int nConstra
int>
116 template <
int nTrk,
int nConstra
int>
129 template <
int nTrk,
int nConstra
int>
138 template <
int nTrk,
int nConstra
int>
147 template <
int nTrk,
int nConstra
int>
157 template <
int nTrk,
int nConstra
int>
163 assert( nConstraint==0 || cs!=
nullptr);
164 if(part.size()!=nTrk)
throw VertexException(
"KinematicConstrainedVertexFitterT::input states are not nTrk");
168 std::pair<std::vector<RefCountedKinematicParticle>, std::vector<FreeTrajectoryState> >
input = iSort.
sort(part);
169 const std::vector<RefCountedKinematicParticle> &
particles = input.first;
170 const std::vector<FreeTrajectoryState> & fStates = input.second;
176 ROOT::Math::SVector<double,3+7*nTrk> inPar;
177 ROOT::Math::SVector<double,3+7*nTrk> finPar;
179 ROOT::Math::SMatrix<double, 3+7*nTrk,3+7*nTrk ,ROOT::Math::MatRepSym<double,3+7*nTrk> > inCov;
183 std::vector<KinematicState> lStates(nTrk);
184 for(std::vector<RefCountedKinematicParticle>::const_iterator
i = particles.begin();
i!=particles.end();
i++)
186 lStates[nSt] = (*i)->stateAtPoint(linPoint);
189 LogDebug(
"KinematicConstrainedVertexFitter")
190 <<
"State is invalid at point: "<<linPoint<<std::endl;
205 inPar(0) = linPoint.
x();
206 inPar(1) = linPoint.
y();
207 inPar(2) = linPoint.
z();
217 ROOT::Math::SMatrix<double, 3+7*nTrk,3+7*nTrk ,ROOT::Math::MatRepSym<double,3+7*nTrk> > refCCov = ROOT::Math::SMatrixNoInit();
220 bool convergence =
false;
227 std::vector<KinematicState> oldStates = lStates;
229 rVtx =
updator->update(inPar,refCCov,lStates,lPoint,mf,cs);
230 if (particles.size() != lStates.size() || rVtx ==
nullptr) {
231 LogDebug(
"KinematicConstrainedVertexFitter")
232 <<
"updator failure\n";
236 double newchisq = rVtx->chiSquared();
238 LogDebug(
"KinematicConstrainedVertexFitter")
239 <<
"bad chisq and insufficient improvement, bailing\n";
251 deltapos[0] = newPoint.
x() - lPoint.
x();
252 deltapos[1] = newPoint.
y() - lPoint.
y();
253 deltapos[2] = newPoint.
z() - lPoint.
z();
254 for (
int i=0;
i<3; ++
i) {
255 double delta = deltapos[
i]*deltapos[
i]/rVtx->error().matrix()(
i,
i);
256 if (delta>maxDelta) maxDelta =
delta;
259 for (std::vector<KinematicState>::const_iterator itold = oldStates.begin(), itnew = lStates.begin();
260 itnew!=lStates.end(); ++itold,++itnew) {
261 for (
int i=0;
i<7; ++
i) {
262 double deltapar = itnew->kinematicParameters()(
i) - itold->kinematicParameters()(
i);
263 double delta = deltapar*deltapar/itnew->kinematicParametersError().matrix()(
i,
i);
264 if (delta>maxDelta) maxDelta =
delta;
289 template <
int nTrk,
int nConstra
int>
294 template <
int nTrk,
int nConstra
int>
T getParameter(std::string const &) const
AlgebraicVector7 const & vector() const
The full vector (7 elements)
~KinematicConstrainedVertexFitterT()
unique_ptr< ClusterSequence > cs
VertexKinematicConstraintT * vCons
RefCountedKinematicTree buildTree(const std::vector< RefCountedKinematicParticle > &initialParticles, const std::vector< KinematicState > &finalStates, const RefCountedKinematicVertex vtx, const ROOT::Math::SMatrix< double, 3+7 *nTrk, 3+7 *nTrk, ROOT::Math::MatRepSym< double, 3+7 *nTrk > > &fCov) const
AlgebraicSymMatrix77 const & matrix() const
const MagneticField * field
float theMinChiSqImprovement
static std::string const input
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
LinearizationPointFinder * finder
void setParameters(const edm::ParameterSet &pSet)
virtual LinearizationPointFinder * clone() const =0
KinematicConstrainedVertexFitterT(const MagneticField *ifield)
KinematicParametersError const & kinematicParametersError() const
KinematicParameters const & kinematicParameters() const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part, MultiTrackKinematicConstraintT< nTrk, nConstraint > *cs)
KinematicConstrainedVertexUpdatorT< nTrk, nConstraint > * updator
ConstrainedTreeBuilderT * tBuilder
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)