23 if (linTracks.size() != 2) {
24 edm::LogInfo(
"Alignment") <<
"@SUB=TwoBodyDecayEstimator::estimate" 25 <<
"Need 2 linearized tracks, got " << linTracks.size() <<
".\n";
43 bool stopIteration =
false;
46 int checkInversion = 0;
51 while (!stopIteration) {
55 if (nIterations > 0) {
56 for (
int i = 0;
i < 10;
i++) {
57 double sigma = 1. /
sqrt(matG[
i][
i]);
59 double absRes = fabs(res[i]);
60 if (absRes > sigmaTimesR)
61 matGPrime[
i][
i] *= sigmaTimesR / absRes;
66 invAtGPrimeA = (matGPrime.similarityT(matA)).inverse(checkInversion);
67 if (checkInversion != 0) {
68 LogDebug(
"Alignment") <<
"@SUB=TwoBodyDecayEstimator::estimate" 69 <<
"Matrix At*G'*A not invertible (in iteration " << nIterations
70 <<
", ifail = " << checkInversion <<
").\n";
74 vecEstimate = invAtGPrimeA * matA.T() * matGPrime * vecM;
75 res = matA * vecEstimate - vecM;
76 chi2 =
dot(res, matGPrime * res);
88 AlgebraicSymMatrix pullsCov = matGPrime.inverse(checkInversion) - invAtGPrimeA.similarity(matA);
90 for (
int i = 0;
i < pullsCov.num_col();
i++)
94 theNdf = matA.num_row() - matA.num_col();
108 if (!linTrack1 || !linTrack2)
121 int checkInversion = 0;
124 std::pair<AlgebraicMatrix, AlgebraicMatrix> derivatives = tpeDerivatives.
derivatives(linearizationPoint);
135 AlgebraicMatrix curv2cart1 = decayModel.curvilinearToCartesianJacobian(curvMomentum1, zMagField);
137 AlgebraicVector cartMomentum1 = decayModel.convertCurvilinearToCartesian(curvMomentum1, zMagField);
138 vecC1 += matB1 * (curvMomentum1 - curv2cart1 * cartMomentum1);
139 matB1 = matB1 * curv2cart1;
147 if (checkInversion != 0) {
148 LogDebug(
"Alignment") <<
"@SUB=TwoBodyDecayEstimator::constructMatrices" 149 <<
"Matrix covM1 not invertible.";
162 AlgebraicMatrix curv2cart2 = decayModel.curvilinearToCartesianJacobian(curvMomentum2, zMagField);
164 AlgebraicVector cartMomentum2 = decayModel.convertCurvilinearToCartesian(curvMomentum2, zMagField);
165 vecC2 += matB2 * (curvMomentum2 - curv2cart2 * cartMomentum2);
166 matB2 = matB2 * curv2cart2;
174 if (checkInversion != 0) {
175 LogDebug(
"Alignment") <<
"@SUB=TwoBodyDecayEstimator::constructMatrices" 176 <<
"Matrix covM2 not invertible.";
185 vecM.sub(1, matU1 * vecM1);
186 vecM.sub(6, matU2 * vecM2);
203 matA.sub(1, 1, matU1 * matA1);
204 matA.sub(6, 1, matU2 * matA2);
205 matA.sub(1, 4, matU1 * matB1 * matF1);
206 matA.sub(6, 4, matU2 * matB2 * matF2);
218 for (
int i = 0;
i < vec.num_col(); ++
i)
bool checkValues(const AlgebraicVector &vec) const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
constexpr bool isNotFinite(T x)
const AlgebraicVector & parameters(void) const
Get decay parameters.
const GlobalPoint & linearizationPoint() const override
virtual TwoBodyDecay estimate(const std::vector< RefCountedLinearizedTrackState > &linTracks, const TwoBodyDecayParameters &linearizationPoint, const TwoBodyDecayVirtualMeasurement &vm) const
const MagneticField * field() const
double theRobustificationConstant
AlgebraicVector3 predictedStateMomentumParameters() const override
const std::pair< AlgebraicMatrix, AlgebraicMatrix > derivatives(const TwoBodyDecay &tbd) const
TwoBodyDecayEstimator(const edm::ParameterSet &config)
const AlgebraicVector beamSpotPosition(void) const
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
CLHEP::HepMatrix AlgebraicMatrix
const double & primaryWidth(void) const
const AlgebraicSymMatrix beamSpotError(void) const
reco::TransientTrack track() const override
CLHEP::HepVector AlgebraicVector
AlgebraicSymMatrix55 predictedStateError() const override
const AlgebraicMatrix53 & momentumJacobian() const override
const AlgebraicVector5 & constantTerm() const override
const AlgebraicMatrix53 & positionJacobian() const override
const AlgebraicVector sub(ParameterName first, ParameterName last) const
Get specified range of decay parameters.
virtual bool constructMatrices(const std::vector< RefCountedLinearizedTrackState > &linTracks, const TwoBodyDecayParameters &linearizationPoint, const TwoBodyDecayVirtualMeasurement &vm, AlgebraicVector &vecM, AlgebraicSymMatrix &matG, AlgebraicMatrix &matA) const
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
const double & secondaryMass(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
CLHEP::HepVector asHepVector(const ROOT::Math::SVector< double, N > &v)
const std::pair< AlgebraicVector, AlgebraicVector > cartesianSecondaryMomenta(const AlgebraicVector ¶m)
AlgebraicVector5 predictedStateParameters() const override
const double & primaryMass(void) const