14 const std::vector<TrajectoryMeasurement> &measurements = traj.
measurements();
17 if (measurements.size()==0) {
28 std::vector<TrajectoryMeasurement>::const_iterator closest = measurements.begin();
29 double distance = 1e6;
31 for (std::vector<TrajectoryMeasurement>::const_iterator fwdit = measurements.begin(), revit = measurements.end()-1;
32 fwdit != measurements.end(); ++fwdit,--revit) {
34 std::vector<TrajectoryMeasurement>::const_iterator it;
43 if (it->recHit() && it->recHit()->isValid()) {
45 distance = (vtxPos - it->updatedState().globalPosition()).
mag();
49 if ( (measurements.end()-fwdit)==1) {
54 std::vector<TrajectoryMeasurement>::const_iterator nextit;
63 if ( nextit->recHit() && nextit->recHit()->isValid() ) {
64 double nextDistance = (vtxPos - nextit->updatedState().globalPosition()).
mag();
65 if (nextDistance > distance) {
76 double decayLengthHitToVtx = (vtxPos - closest->updatedState().globalPosition()).
dot(momDir);
92 double trackError2 = ROOT::Math::Similarity(jj,closest->updatedState().cartesianError().matrix());
93 double vertexError2 = ROOT::Math::Similarity(j,vtx.
covariance());
94 double decayLenError =
sqrt(trackError2+vertexError2);
103 return std::pair<unsigned int,Measurement1DFloat>(nhits,
decayLength);
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::pair< uint8_t, Measurement1DFloat > nHitsBeforeVtx(const Trajectory &traj, const reco::Vertex &vtx, double sigmaTolerance=3.0) const
double y() const
y coordinate
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
ROOT::Math::SVector< double, 6 > AlgebraicVector6
PropagationDirection const & direction() const
DataContainer const & measurements() const
float significance() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double z() const
y coordinate
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
uint8_t nSharedHits(const reco::Track &trk1, const reco::Track &trk2) const
Vector3DBase unit() const
double x() const
x coordinate
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.