Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend TrackBase and Track to include time and velocity #24465

Merged
merged 2 commits into from Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion DataFormats/GsfTrackReco/src/classes_def.xml
Expand Up @@ -24,7 +24,8 @@
<class name="edm::Ref<std::vector<reco::GsfTrackExtra>,reco::GsfTrackExtra,edm::refhelper::FindUsingAdvance<std::vector<reco::GsfTrackExtra>,reco::GsfTrackExtra> >"/>
<class name="edm::RefVector<std::vector<reco::GsfTrackExtra>,reco::GsfTrackExtra,edm::refhelper::FindUsingAdvance<std::vector<reco::GsfTrackExtra>,reco::GsfTrackExtra> >"/>

<class name="reco::GsfTrack" ClassVersion="19">
<class name="reco::GsfTrack" ClassVersion="20">
<version ClassVersion="20" checksum="3090385640"/>
<version ClassVersion="19" checksum="2111870580"/>
<version ClassVersion="18" checksum="1193413886"/>
<version ClassVersion="17" checksum="2463004588"/>
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/TrackReco/interface/Track.h
Expand Up @@ -39,7 +39,9 @@ class Track : public TrackBase
/// constructor from fit parameters and error matrix
Track(double chi2, double ndof, const Point & referencePoint,
const Vector & momentum, int charge, const CovarianceMatrix &,
TrackAlgorithm = undefAlgorithm, TrackQuality quality = undefQuality);
TrackAlgorithm = undefAlgorithm, TrackQuality quality = undefQuality,
double t0 = 0, double beta = 0,
double covt0t0 = -1., double covbetabeta = -1.);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please match the indentation
  • it looks like the new arguments should be floats (with correspondingly float defaults)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm the indentation was matched in my text editor....

Changed to double... Ditto for the other similar comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the "usual" mixture of tabs and spaces, works with one tab width but not others.


/// return true if the outermost hit is valid
bool outerOk() const {
Expand All @@ -50,7 +52,7 @@ class Track : public TrackBase
bool innerOk() const {
return extra_->innerOk();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the empty space change is not necessary

/// position of the innermost hit
const math::XYZPoint & innerPosition() const {
return extra_->innerPosition();
Expand Down
53 changes: 52 additions & 1 deletion DataFormats/TrackReco/interface/TrackBase.h
Expand Up @@ -170,11 +170,16 @@ class TrackBase
TrackBase(double chi2, double ndof, const Point &vertex,
const Vector &momentum, int charge, const CovarianceMatrix &cov,
TrackAlgorithm = undefAlgorithm, TrackQuality quality = undefQuality,
signed char nloops = 0, uint8_t stopReason = 0);
signed char nloops = 0, uint8_t stopReason = 0,
double t0 = 0, double beta = 0,
double covt0t0 = -1., double covbetabeta = -1.);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please match the indentation
  • it looks like the new arguments should be floats (with correspondingly float defaults)


/// virtual destructor
virtual ~TrackBase();

/// return true if timing measurement is usable
bool isTimeOk() const { return covt0t0_ > 0.f; }

/// chi-squared of the fit
double chi2() const;

Expand Down Expand Up @@ -244,6 +249,12 @@ class TrackBase
/// Reference point on the track
const Point &referencePoint() const;

/// time at the reference point
double t0() const;

/// velocity at the reference point
double beta() const;

/// reference point on the track. This method is DEPRECATED, please use referencePoint() instead
const Point &vertex() const ;
//__attribute__((deprecated("This method is DEPRECATED, please use referencePoint() instead.")));
Expand Down Expand Up @@ -305,6 +316,12 @@ class TrackBase
/// error on dz
double dzError() const;

/// error on t0
double t0Error() const;

/// error on beta
double betaError() const;

/// fill SMatrix
CovarianceMatrix &fill(CovarianceMatrix &v) const;

Expand Down Expand Up @@ -407,14 +424,24 @@ class TrackBase
/// perigee 5x5 covariance matrix
float covariance_[covarianceSize];

/// errors for time and velocity (separate from cov for now)
float covt0t0_, covbetabeta_;

/// chi-squared
float chi2_;

/// innermost (reference) point on track
Point vertex_;

/// time at the reference point on track
float t0_;

/// momentum vector at innermost point
Vector momentum_;

/// norm of the particle velocity at innermost point on track
/// can multiply by momentum_.Unit() to get velocity vector
float beta_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please define default values here or in the default constructor.
I can't recall now if they also should be specified in the ioread rules (it's easy to check by reading an old file and checking what's in covt0t0_ )


/// algo mask, bit set for the algo where it was reconstructed + each algo a track was found overlapping by the listmerger
std::bitset<algoSize> algoMask_;
Expand Down Expand Up @@ -683,6 +710,18 @@ inline const TrackBase::Point & TrackBase::referencePoint() const
return vertex_;
}

// Time at the reference point on the track
inline double TrackBase::t0() const
{
return t0_;
}

// Velocity at the reference point on the track
inline double TrackBase::beta() const
{
return beta_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an absolute velocity, or is it normalized to c? Please clarify in the comments.

}

// reference point on the track. This method is DEPRECATED, please use referencePoint() instead
inline const TrackBase::Point & TrackBase::vertex() const
{
Expand Down Expand Up @@ -816,6 +855,18 @@ inline double TrackBase::dzError() const
return error(i_dsz) * p() / pt();
}

// error on t0
inline double TrackBase::t0Error() const
{
return std::sqrt(covt0t0_);
}

// error on beta
inline double TrackBase::betaError() const
{
return std::sqrt(covbetabeta_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should also be a way to get these without sqrt.
Perhaps covarianceT0T0 and covarianceBetaBeta.
BTW, are the two strictly related by a track-dependent constant or is there a T0Beta term?

}

// number of valid hits found
inline unsigned short TrackBase::numberOfValidHits() const
{
Expand Down
7 changes: 5 additions & 2 deletions DataFormats/TrackReco/src/Track.cc
Expand Up @@ -4,8 +4,11 @@ using namespace reco;

Track::Track(double chi2, double ndof, const Point &vertex, const Vector &momentum,
int charge, const CovarianceMatrix &cov, TrackAlgorithm algo,
TrackQuality quality) :
TrackBase(chi2, ndof, vertex, momentum, charge, cov, algo, quality)
TrackQuality quality, double t0, double beta,
double covt0t0, double covbetabeta) :
TrackBase(chi2, ndof, vertex, momentum, charge, cov, algo, quality,
0,0, // nloops and stop reason
t0,beta,covt0t0,covbetabeta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

{
;
}
Expand Down
7 changes: 6 additions & 1 deletion DataFormats/TrackReco/src/TrackBase.cc
Expand Up @@ -89,10 +89,15 @@ TrackBase::TrackBase() :

TrackBase::TrackBase(double chi2, double ndof, const Point &vertex, const Vector &momentum,
int charge, const CovarianceMatrix &cov, TrackAlgorithm algorithm,
TrackQuality quality, signed char nloops, uint8_t stopReason):
TrackQuality quality, signed char nloops, uint8_t stopReason,
double t0, double beta, double covt0t0, double covbetabeta):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

covt0t0_(covt0t0),
covbetabeta_(covbetabeta),
chi2_(chi2),
vertex_(vertex),
t0_(t0),
momentum_(momentum),
beta_(beta),
ndof_(ndof),
charge_(charge),
algorithm_(algorithm),
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/TrackReco/src/classes_def.xml
Expand Up @@ -9,7 +9,8 @@
<version ClassVersion="11" checksum="639174599"/>
<version ClassVersion="10" checksum="2022291691"/>
</class>
<class name="reco::TrackBase" ClassVersion="19">
<class name="reco::TrackBase" ClassVersion="20">
<version ClassVersion="20" checksum="1589774059"/>
<version ClassVersion="19" checksum="4090229239"/>
<version ClassVersion="18" checksum="1935215297"/>
<version ClassVersion="17" checksum="1774167599"/>
Expand Down Expand Up @@ -318,7 +319,8 @@
<class name="edm::Ref<std::vector<reco::TrackExtra>,reco::TrackExtra,edm::refhelper::FindUsingAdvance<std::vector<reco::TrackExtra>,reco::TrackExtra> >"/>
<class name="edm::RefVector<std::vector<reco::TrackExtra>,reco::TrackExtra,edm::refhelper::FindUsingAdvance<std::vector<reco::TrackExtra>,reco::TrackExtra> >"/>

<class name="reco::Track" ClassVersion="19">
<class name="reco::Track" ClassVersion="20">
<version ClassVersion="20" checksum="2864582648"/>
<version ClassVersion="19" checksum="362503460"/>
<version ClassVersion="18" checksum="3235158110"/>
<version ClassVersion="17" checksum="3387867292"/>
Expand Down