27 if ( linTracks.size() != 2 )
29 edm::LogInfo(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
30 <<
"Need 2 linearized tracks, got " << linTracks.size() <<
".\n";
47 bool stopIteration =
false;
50 int checkInversion = 0;
55 while( !stopIteration )
60 if ( nIterations > 0 )
62 for (
int i = 0;
i < 10;
i++ )
64 double sigma = 1./
sqrt( matG[
i][
i] );
66 double absRes = fabs( res[i] );
67 if ( absRes > sigmaTimesR ) matGPrime[
i][
i] *= sigmaTimesR/absRes;
72 invAtGPrimeA = ( matGPrime.similarityT(matA) ).inverse( checkInversion );
73 if ( checkInversion != 0 )
75 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
76 <<
"Matrix At*G'*A not invertible (in iteration " << nIterations
77 <<
", ifail = " << checkInversion <<
").\n";
81 vecEstimate = invAtGPrimeA*matA.T()*matGPrime*vecM;
82 res = matA*vecEstimate - vecM;
83 chi2 =
dot( res, matGPrime*res );
85 if ( ( nIterations > 0 ) && ( fabs( chi2 - oldChi2 ) <
theMaxIterDiff ) ) stopIteration =
true;
94 AlgebraicSymMatrix pullsCov = matGPrime.inverse( checkInversion ) - invAtGPrimeA.similarity( matA );
99 theNdf = matA.num_row() - matA.num_col();
114 if (!linTrack1 || !linTrack2)
return false;
126 int checkInversion = 0;
129 std::pair< AlgebraicMatrix, AlgebraicMatrix > derivatives = tpeDerivatives.
derivatives( linearizationPoint );
132 std::pair< AlgebraicVector, AlgebraicVector > linCartMomenta = decayModel.
cartesianSecondaryMomenta( linearizationPoint );
140 AlgebraicMatrix curv2cart1 = decayModel.curvilinearToCartesianJacobian( curvMomentum1, zMagField );
142 AlgebraicVector cartMomentum1 = decayModel.convertCurvilinearToCartesian( curvMomentum1, zMagField );
143 vecC1 += matB1*( curvMomentum1 - curv2cart1*cartMomentum1 );
144 matB1 = matB1*curv2cart1;
153 if ( checkInversion != 0 )
155 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
156 <<
"Matrix covM1 not invertible.";
169 AlgebraicMatrix curv2cart2 = decayModel.curvilinearToCartesianJacobian( curvMomentum2, zMagField );
171 AlgebraicVector cartMomentum2 = decayModel.convertCurvilinearToCartesian( curvMomentum2, zMagField );
172 vecC2 += matB2*( curvMomentum2 - curv2cart2*cartMomentum2 );
173 matB2 = matB2*curv2cart2;
181 if ( checkInversion != 0 )
183 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
184 <<
"Matrix covM2 not invertible.";
193 vecM.sub( 1, matU1*vecM1 );
194 vecM.sub( 6, matU2*vecM2 );
202 matG.sub( 1, matG1 );
203 matG.sub( 6, matG2 );
207 matG.sub( 12, vm.
beamSpotError().inverse( checkInversion ) );
211 matA.sub( 1, 1, matU1*matA1 );
212 matA.sub( 6, 1, matU2*matA2 );
213 matA.sub( 1, 4, matU1*matB1*matF1 );
214 matA.sub( 6, 4, matU2*matB2*matF2 );
228 for (
int i = 0;
i < vec.num_col(); ++
i )
virtual AlgebraicVector3 predictedStateMomentumParameters() const
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)
const AlgebraicMatrix53 & momentumJacobian() const
const AlgebraicVector & parameters(void) const
Get decay parameters.
virtual reco::TransientTrack track() const
virtual TwoBodyDecay estimate(const std::vector< RefCountedLinearizedTrackState > &linTracks, const TwoBodyDecayParameters &linearizationPoint, const TwoBodyDecayVirtualMeasurement &vm) const
const MagneticField * field() const
double theRobustificationConstant
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
bool check(const std::string &)
const double & primaryWidth(void) const
const AlgebraicMatrix53 & positionJacobian() const
AlgebraicSymMatrix55 predictedStateError() const
const GlobalPoint & linearizationPoint() const
const AlgebraicSymMatrix beamSpotError(void) const
CLHEP::HepVector AlgebraicVector
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
AlgebraicVector5 predictedStateParameters() const
CLHEP::HepVector asHepVector(const ROOT::Math::SVector< double, N > &v)
const std::pair< AlgebraicVector, AlgebraicVector > cartesianSecondaryMomenta(const AlgebraicVector ¶m)
const AlgebraicVector5 & constantTerm() const
const double & primaryMass(void) const