Commit 4e337eb0 authored by Lennart Huth's avatar Lennart Huth
Browse files

moved track::state() and track::direction() to track::state(std::string...

moved track::state() and track::direction() to track::state(std::string detector) track::direction(std::string detector)
parent 61dbaf69
......@@ -261,16 +261,17 @@ Configuration Detector::getConfiguration() const {
PositionVector3D<Cartesian3D<double>> Detector::getIntercept(const Track* track) const {
// Get the distance from the plane to the track initial state
double distance = (m_origin.X() - track->state().X()) * m_normal.X();
distance += (m_origin.Y() - track->state().Y()) * m_normal.Y();
distance += (m_origin.Z() - track->state().Z()) * m_normal.Z();
distance /= (track->direction().X() * m_normal.X() + track->direction().Y() * m_normal.Y() +
track->direction().Z() * m_normal.Z());
double distance = (m_origin.X() - track->state(m_detectorName).X()) * m_normal.X();
distance += (m_origin.Y() - track->state(m_detectorName).Y()) * m_normal.Y();
distance += (m_origin.Z() - track->state(m_detectorName).Z()) * m_normal.Z();
distance /= (track->direction(m_detectorName).X() * m_normal.X() + track->direction(m_detectorName).Y() * m_normal.Y() +
track->direction(m_detectorName).Z() * m_normal.Z());
// Propagate the track
PositionVector3D<Cartesian3D<double>> globalIntercept(track->state().X() + distance * track->direction().X(),
track->state().Y() + distance * track->direction().Y(),
track->state().Z() + distance * track->direction().Z());
PositionVector3D<Cartesian3D<double>> globalIntercept(
track->state(m_detectorName).X() + distance * track->direction(m_detectorName).X(),
track->state(m_detectorName).Y() + distance * track->direction(m_detectorName).Y(),
track->state(m_detectorName).Z() + distance * track->direction(m_detectorName).Z());
return globalIntercept;
}
......
......@@ -146,8 +146,8 @@ void AlignmentDUTResidual::MinimiseResiduals(Int_t&, Double_t*, Double_t& result
// Loop over all tracks
for(auto& track : globalTracks) {
LOG(TRACE) << "track has chi2 " << track->chi2();
LOG(TRACE) << "- track has gradient x " << track->direction().X();
LOG(TRACE) << "- track has gradient y " << track->direction().Y();
LOG(TRACE) << "- track has gradient x " << track->direction(track->clusters().at(0)->detectorID()).X();
LOG(TRACE) << "- track has gradient y " << track->direction(track->clusters().at(0)->detectorID()).Y();
// Find the cluster that needs to have its position recalculated
for(auto& associatedCluster : track->associatedClusters()) {
......
......@@ -269,8 +269,8 @@ bool AlignmentMillepede::putTrack(Track* track, const size_t nPlanes) {
/// Refit the track for the reference states.
track->fit();
const double tx = track->state().X();
const double ty = track->state().Y();
const double tx = track->state(track->clusters().at(0)->detectorID()).X();
const double ty = track->state(track->clusters().at(0)->detectorID()).Y();
// Iterate over each cluster on the track.
for(auto& cluster : track->clusters()) {
......
......@@ -225,8 +225,8 @@ StatusCode Tracking4D::run(std::shared_ptr<Clipboard> clipboard) {
trackChi2->Fill(track->chi2());
clustersPerTrack->Fill(static_cast<double>(track->nClusters()));
trackChi2ndof->Fill(track->chi2ndof());
trackAngleX->Fill(atan(track->direction().X()));
trackAngleY->Fill(atan(track->direction().Y()));
trackAngleX->Fill(atan(track->direction(track->clusters().at(0)->detectorID()).X()));
trackAngleY->Fill(atan(track->direction(track->clusters().at(0)->detectorID()).Y()));
// Make residuals
auto trackClusters = track->clusters();
......
......@@ -179,8 +179,8 @@ StatusCode TrackingSpatial::run(std::shared_ptr<Clipboard> clipboard) {
trackChi2->Fill(track->chi2());
clustersPerTrack->Fill(static_cast<double>(track->nClusters()));
trackChi2ndof->Fill(track->chi2ndof());
trackAngleX->Fill(atan(track->direction().X()));
trackAngleY->Fill(atan(track->direction().Y()));
trackAngleX->Fill(atan(track->direction(track->clusters().at(0)->detectorID()).X()));
trackAngleY->Fill(atan(track->direction(track->clusters().at(0)->detectorID()).Y()));
// Make residuals
for(auto& trackCluster : track->clusters()) {
......
......@@ -85,8 +85,8 @@ namespace corryvreckan {
size_t nClusters() const { return m_trackClusters.size(); }
ROOT::Math::XYZPoint intercept(double z) const;
ROOT::Math::XYZPoint state() const { return m_state; }
ROOT::Math::XYZVector direction() const { return m_direction; }
ROOT::Math::XYZPoint state(std::string) const { return m_state; }
ROOT::Math::XYZVector direction(std::string) const { return m_direction; }
protected:
// Calculate the chi2 of the track
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment