25 if ( linTracks.size() != 2 )
27 edm::LogInfo(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
28 <<
"Need 2 linearized tracks, got " << linTracks.size() <<
".\n";
45 bool stopIteration =
false;
48 int checkInversion = 0;
53 while( !stopIteration )
58 if ( nIterations > 0 )
60 for (
int i = 0;
i < 10;
i++ )
62 double sigma = 1./
sqrt( matG[
i][
i] );
64 double absRes = fabs( res[i] );
65 if ( absRes > sigmaTimesR ) matGPrime[
i][
i] *= sigmaTimesR/absRes;
70 invAtGPrimeA = ( matGPrime.similarityT(matA) ).inverse( checkInversion );
71 if ( checkInversion != 0 )
73 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::estimate"
74 <<
"Matrix At*G'*A not invertible (in iteration " << nIterations
75 <<
", ifail = " << checkInversion <<
").\n";
79 vecEstimate = invAtGPrimeA*matA.T()*matGPrime*vecM;
80 res = matA*vecEstimate - vecM;
81 chi2 =
dot( res, matGPrime*res );
83 if ( ( nIterations > 0 ) && ( fabs( chi2 - oldChi2 ) <
theMaxIterDiff ) ) stopIteration =
true;
92 AlgebraicSymMatrix pullsCov = matGPrime.inverse( checkInversion ) - invAtGPrimeA.similarity( matA );
97 theNdf = matA.num_row() - matA.num_col();
122 int checkInversion = 0;
125 std::pair< AlgebraicMatrix, AlgebraicMatrix > derivatives = tpeDerivatives.
derivatives( linearizationPoint );
128 std::pair< AlgebraicVector, AlgebraicVector > linCartMomenta = decayModel.
cartesianSecondaryMomenta( linearizationPoint );
136 AlgebraicMatrix curv2cart1 = decayModel.curvilinearToCartesianJacobian( curvMomentum1, zMagField );
138 AlgebraicVector cartMomentum1 = decayModel.convertCurvilinearToCartesian( curvMomentum1, zMagField );
139 vecC1 += matB1*( curvMomentum1 - curv2cart1*cartMomentum1 );
140 matB1 = matB1*curv2cart1;
149 if ( checkInversion != 0 )
151 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
152 <<
"Matrix covM1 not invertible.";
165 AlgebraicMatrix curv2cart2 = decayModel.curvilinearToCartesianJacobian( curvMomentum2, zMagField );
167 AlgebraicVector cartMomentum2 = decayModel.convertCurvilinearToCartesian( curvMomentum2, zMagField );
168 vecC2 += matB2*( curvMomentum2 - curv2cart2*cartMomentum2 );
169 matB2 = matB2*curv2cart2;
177 if ( checkInversion != 0 )
179 LogDebug(
"Alignment" ) <<
"@SUB=TwoBodyDecayEstimator::constructMatrices"
180 <<
"Matrix covM2 not invertible.";
189 vecM.sub( 1, matU1*vecM1 );
190 vecM.sub( 6, matU2*vecM2 );
198 matG.sub( 1, matG1 );
199 matG.sub( 6, matG2 );
203 matG.sub( 12, vm.
beamSpotError().inverse( checkInversion ) );
207 matA.sub( 1, 1, matU1*matA1 );
208 matA.sub( 6, 1, matU2*matA2 );
209 matA.sub( 1, 4, matU1*matB1*matF1 );
210 matA.sub( 6, 4, matU2*matB2*matF2 );
225 for (
int i = 0;
i < vec.num_col(); ++
i )
228 isInf = isInf || std::isinf( vec[i] );
231 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)
virtual GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
CLHEP::HepMatrix AlgebraicMatrix
const double primaryMass(void) const
const AlgebraicSymMatrix & beamSpotError(void) const
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
const AlgebraicMatrix53 & positionJacobian() const
AlgebraicSymMatrix55 predictedStateError() const
const GlobalPoint & linearizationPoint() const
const double secondaryMass(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.
CLHEP::HepSymMatrix AlgebraicSymMatrix
const AlgebraicVector & beamSpot(void) const
const double primaryWidth(void) const
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