26 if ( linTracks.size() != 2 )
28 edm::LogInfo(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
29 <<
"Need 2 linearized tracks, got " << linTracks.size() <<
".\n";
46 bool stopIteration =
false;
49 int checkInversion = 0;
54 while( !stopIteration )
59 if ( nIterations > 0 )
61 for (
int i = 0;
i < 10;
i++ )
63 double sigma = 1./
sqrt( matG[
i][
i] );
65 double absRes = fabs( res[i] );
66 if ( absRes > sigmaTimesR ) matGPrime[
i][
i] *= sigmaTimesR/absRes;
71 invAtGPrimeA = ( matGPrime.similarityT(matA) ).inverse( checkInversion );
72 if ( checkInversion != 0 )
74 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
75 <<
"Matrix At*G'*A not invertible (in iteration " << nIterations
76 <<
", ifail = " << checkInversion <<
").\n";
80 vecEstimate = invAtGPrimeA*matA.T()*matGPrime*vecM;
81 res = matA*vecEstimate - vecM;
82 chi2 =
dot( res, matGPrime*res );
84 if ( ( nIterations > 0 ) && ( fabs( chi2 - oldChi2 ) <
theMaxIterDiff ) ) stopIteration =
true;
93 AlgebraicSymMatrix pullsCov = matGPrime.inverse( checkInversion ) - invAtGPrimeA.similarity( matA );
98 theNdf = matA.num_row() - matA.num_col();
113 if (!linTrack1 || !linTrack2)
return false;
125 int checkInversion = 0;
128 std::pair< AlgebraicMatrix, AlgebraicMatrix > derivatives = tpeDerivatives.
derivatives( linearizationPoint );
131 std::pair< AlgebraicVector, AlgebraicVector > linCartMomenta = decayModel.
cartesianSecondaryMomenta( linearizationPoint );
139 AlgebraicMatrix curv2cart1 = decayModel.curvilinearToCartesianJacobian( curvMomentum1, zMagField );
141 AlgebraicVector cartMomentum1 = decayModel.convertCurvilinearToCartesian( curvMomentum1, zMagField );
142 vecC1 += matB1*( curvMomentum1 - curv2cart1*cartMomentum1 );
143 matB1 = matB1*curv2cart1;
152 if ( checkInversion != 0 )
154 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
155 <<
"Matrix covM1 not invertible.";
168 AlgebraicMatrix curv2cart2 = decayModel.curvilinearToCartesianJacobian( curvMomentum2, zMagField );
170 AlgebraicVector cartMomentum2 = decayModel.convertCurvilinearToCartesian( curvMomentum2, zMagField );
171 vecC2 += matB2*( curvMomentum2 - curv2cart2*cartMomentum2 );
172 matB2 = matB2*curv2cart2;
180 if ( checkInversion != 0 )
182 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
183 <<
"Matrix covM2 not invertible.";
192 vecM.sub( 1, matU1*vecM1 );
193 vecM.sub( 6, matU2*vecM2 );
201 matG.sub( 1, matG1 );
202 matG.sub( 6, matG2 );
206 matG.sub( 12, vm.
beamSpotError().inverse( checkInversion ) );
210 matA.sub( 1, 1, matU1*matA1 );
211 matA.sub( 6, 1, matU2*matA2 );
212 matA.sub( 1, 4, matU1*matB1*matF1 );
213 matA.sub( 6, 4, matU2*matB2*matF2 );
228 for (
int i = 0;
i < vec.num_col(); ++
i )
231 isInf = isInf || std::isinf( vec[i] );
234 return ( isNan || isInf );
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
const double & primaryWidth(void) const
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
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