22 (config.materialEffects >= breakPoints) ? 2*(recHits.
first.
size() + recHits.
second.
size())-4 : 0,
23 (config.materialEffects >= breakPoints) ? 2*(recHits.
first.
size() + recHits.
second.
size())-3 : 1 ),
24 materialEffects_(config.materialEffects),
25 propDir_(config.propDir),
26 useRefittedState_(config.useRefittedState),
27 constructTsosWithErrors_(config.constructTsosWithErrors)
32 TransientTrackingRecHit::ConstRecHitContainer::const_reverse_iterator itRecHits;
35 fwdRecHits.first.reserve( recHits.first.size() );
36 for ( itRecHits = recHits.first.rbegin(); itRecHits != recHits.first.rend(); ++itRecHits )
38 fwdRecHits.first.push_back( *itRecHits );
41 fwdRecHits.second.reserve( recHits.second.size() );
42 for ( itRecHits = recHits.second.rbegin(); itRecHits != recHits.second.rend(); ++itRecHits )
44 fwdRecHits.second.push_back( *itRecHits );
86 if ( !trajectory1.
isValid() )
return false;
94 if ( !trajectory2.
isValid() )
return false;
99 unsigned int nLocal = deriv.first.num_row();
100 unsigned int nTbd = deriv.first.num_col();
105 Eigen::MatrixXd tbdToLocal1{nLocal, nTbd};
106 for (
unsigned int row = 0; row < nLocal; ++row) {
107 for (
unsigned int col = 0;
col < nTbd; ++
col) {
108 tbdToLocal1(row,
col) = deriv.first[row][
col];
113 trajectory1.
gblInput().front().second*tbdToLocal1));
115 Eigen::MatrixXd tbdToLocal2{nLocal, nTbd};
116 for (
unsigned int row = 0; row < nLocal; ++row) {
117 for (
unsigned int col = 0;
col < nTbd; ++
col) {
118 tbdToLocal2(row,
col) = deriv.second[row][
col];
123 trajectory2.
gblInput().front().second*tbdToLocal2));
160 theDerivatives.sub( rowOffset, colOffset, fullDeriv1.sub( 1, nHitMeas1, 1, nTbd ) );
162 theDerivatives.sub( rowOffset, colOffset, trajectory1.
derivatives().sub( 1, nHitMeas1, nLocal + 1, nPar1 + nVirtualPar1 ) );
164 rowOffset += nHitMeas1;
166 theDerivatives.sub( rowOffset, colOffset, fullDeriv2.sub( 1, nHitMeas2, 1, nTbd ) );
167 colOffset += (nPar1 + nVirtualPar1 + nTbd - nLocal);
168 theDerivatives.sub( rowOffset, colOffset, trajectory2.
derivatives().sub( 1, nHitMeas2, nLocal + 1, nPar2 + nVirtualPar2 ) );
170 rowOffset += nHitMeas2;
172 theDerivatives.sub( rowOffset, colOffset, fullDeriv1.sub(nHitMeas1 + 1, nHitMeas1 + nVirtualMeas1, 1, nTbd ) );
174 theDerivatives.sub( rowOffset, colOffset, trajectory1.
derivatives().sub(nHitMeas1 + 1, nHitMeas1 + nVirtualMeas1, nLocal + 1, nPar1 + nVirtualPar1 ) );
176 rowOffset += nVirtualMeas1;
178 theDerivatives.sub( rowOffset, colOffset, fullDeriv2.sub(nHitMeas2 + 1, nHitMeas2 + nVirtualMeas2, 1, nTbd ) );
179 colOffset += (nPar1 + nVirtualPar1 + nTbd - nLocal);
180 theDerivatives.sub( rowOffset, colOffset, trajectory2.
derivatives().sub(nHitMeas2 + 1, nHitMeas2 + nVirtualMeas2, nLocal + 1, nPar2 + nVirtualPar2 ) );
185 theMeasurements.sub( nHitMeas1 + nHitMeas2 + nVirtualMeas1 + 1, trajectory2.
measurements().sub(nHitMeas2 + 1, nHitMeas2 + nVirtualMeas2 ) );
200 rowOffset += nVirtualMeas2;
201 int indMass = rowOffset-1;
235 std::vector< TrajectoryStateOnSurface >::const_iterator itTsos;
256 const double coeff = 1
e-2;
263 float dpinv = coeff*( fabs(p.
x()) + fabs(p.
y()) + fabs(p.
z()) )*invP*invP;
264 float dxdir = coeff*( fabs(p.
x()) + fabs(p.
z()) )/p.
z()/p.
z();
265 float dydir = coeff*( fabs(p.
y()) + fabs(p.
z()) )/p.
z()/p.
z();
266 localErrors[0][0] = dpinv*dpinv;
267 localErrors[1][1] = dxdir*dxdir;
268 localErrors[2][2] = dydir*dydir;
unsigned int numberOfHits() const
const LocalTrajectoryParameters & localParameters() const
bool construct(const TwoBodyDecayTrajectoryState &state, const ConstRecHitCollection &recHits, const MagneticField *field, const reco::BeamSpot &beamSpot)
AlgebraicMatrix theDerivatives
const AlgebraicVector & parameters(void) const
Get decay parameters.
unsigned int theNumberOfVirtualPars
void constructSingleTsosWithErrors(const TrajectoryStateOnSurface &tsos, int iTsos, const MagneticField *field)
unsigned int numberOfHitMeas() const
const TransientTrackingRecHit::ConstRecHitContainer & recHits() const
double primaryWidth(void) const
unsigned int theNumberOfVirtualMeas
TwoBodyDecayTrajectory(void)
unsigned int numberOfVirtualPar() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const PropagationDirection propDir_
std::pair< ConstRecHitContainer, ConstRecHitContainer > ConstRecHitCollection
AlgebraicVector theParameters
const TsosContainer & trajectoryStates(bool useRefittedState=true) const
AlgebraicVector theMeasurements
Eigen::VectorXd theGblExtPrecisions
const AlgebraicSymMatrix & measurementErrors() const
float signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
U second(std::pair< T, U > const &p)
AlgebraicSymMatrix theTrajectoryPositionCov
std::vector< std::pair< std::vector< gbl::GblPoint >, Eigen::MatrixXd > > theGblInput
const AlgebraicMatrix & derivatives() const
const SurfaceType & surface() const
const Derivatives & derivatives(void) const
CLHEP::HepMatrix AlgebraicMatrix
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
std::pair< TrajectoryStateOnSurface, TrajectoryStateOnSurface > TsosContainer
double particleMass(void) const
const MaterialEffects materialEffects_
unsigned int theNumberOfHits
AlgebraicVector theTrajectoryPositions
LocalVector momentum() const
Momentum vector in the local frame.
std::pair< int, int > theNumberOfRecHits
TransientTrackingRecHit::ConstRecHitContainer theRecHits
const AlgebraicMatrix & localToTrajectory() const
AlgebraicSymMatrix theMeasurementsCov
const TwoBodyDecayParameters & decayParameters(void) const
std::pair< AlgebraicMatrix, AlgebraicMatrix > Derivatives
unsigned int numberOfPar() const
static unsigned int nMeasPerHit
Eigen::MatrixXd theGblExtDerivatives
std::vector< std::pair< std::vector< gbl::GblPoint >, Eigen::MatrixXd > > & gblInput()
void constructTsosVecWithErrors(const ReferenceTrajectory &traj1, const ReferenceTrajectory &traj2, const MagneticField *field)
const AlgebraicSymMatrix & covariance(void) const
Get error matrix.
double primaryMass(void) const
Eigen::VectorXd theGblExtMeasurements
const bool useRefittedState_
unsigned int numberOfVirtualMeas() const
const AlgebraicVector & measurements() const
std::vector< TrajectoryStateOnSurface > theTsosVec
const bool constructTsosWithErrors_
const AlgebraicVector & trajectoryPositions() const
unsigned int theNumberOfPars
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
const std::vector< TrajectoryStateOnSurface > & trajectoryStates() const