17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
23 const std::vector<TrajectoryMeasurement> &measurements = traj.
measurements();
26 if (measurements.size()==0) {
37 std::vector<TrajectoryMeasurement>::const_iterator closest = measurements.begin();
38 double distance = 1e6;
40 for (std::vector<TrajectoryMeasurement>::const_iterator fwdit = measurements.begin(), revit = measurements.end()-1;
41 fwdit != measurements.end(); ++fwdit,--revit) {
43 std::vector<TrajectoryMeasurement>::const_iterator it;
52 if (it->recHit() && it->recHit()->isValid()) {
54 distance = (vtxPos - it->updatedState().globalPosition()).
mag();
58 if ( (measurements.end()-fwdit)==1) {
63 std::vector<TrajectoryMeasurement>::const_iterator nextit;
72 if ( nextit->recHit() && nextit->recHit()->isValid() ) {
73 double nextDistance = (vtxPos - nextit->updatedState().globalPosition()).
mag();
74 if (nextDistance > distance) {
85 double decayLengthHitToVtx = (vtxPos - closest->updatedState().globalPosition()).
dot(momDir);
101 double trackError2 = ROOT::Math::Similarity(jj,closest->updatedState().cartesianError().matrix());
102 double vertexError2 = ROOT::Math::Similarity(j,vtx.
covariance());
103 double decayLenError =
sqrt(trackError2+vertexError2);
112 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.
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.