Commit 83549e4a authored by Lennart Huth's avatar Lennart Huth
Browse files

introduced direction at any z position for all tracks

parent dd593c65
......@@ -409,6 +409,15 @@ ROOT::Math::XYZVector GblTrack::getDirection(const std::string& detectorID) cons
return ((pointAfter - point) / (pointAfter.z() - point.z()));
}
XYZVector GblTrack::getDirection(const double& z) const {
auto planeUpstream = std::find_if(planes_.begin(), planes_.end(), [&z](const Plane& p) { return p.getPosition() > z; });
if(planeUpstream != planes_.end()) {
return getDirection(planeUpstream->getName());
} else {
return getDirection(planes_.end()->getName());
}
}
void GblTrack::print(std::ostream& out) const {
out << "GblTrack with nhits = " << track_clusters_.size() << " and nscatterers = " << planes_.size()
<< ", chi2 = " << chi2_ << ", ndf = " << ndof_;
......
......@@ -52,6 +52,13 @@ namespace corryvreckan {
*/
ROOT::Math::XYZVector getDirection(const std::string& detectorID) const override;
/**
* @brief Get the track direction at any given z position
* @param global z position
* @return ROOT::Math::XYZPoint direction at z
*/
ROOT::Math::XYZVector getDirection(const double& z) const override;
/**
* @brief Return kink of track at given detector
* @param detectorID Detector ID at which the kink should be evaluated
......
......@@ -85,6 +85,10 @@ ROOT::Math::XYZVector Multiplet::getDirection(const std::string& detectorID) con
: m_downstream->getDirection(detectorID);
}
XYZVector Multiplet::getDirection(const double& z) const {
return (z <= m_scattererPosition ? m_upstream->getDirection(z) : m_downstream->getDirection(z));
}
void Multiplet::print(std::ostream& out) const {
out << "Multiplet " << this->m_scattererPosition << ", " << this->m_positionAtScatterer << ", "
<< this->m_offsetAtScatterer << ", " << this->m_kinkAtScatterer << ", " << this->chi2_ << ", " << this->ndof_ << ", "
......
......@@ -56,6 +56,13 @@ namespace corryvreckan {
*/
ROOT::Math::XYZVector getDirection(const std::string& detectorID) const override;
/**
* @brief Get the track direction at any given z position
* @param global z position
* @return ROOT::Math::XYZPoint direction at z
*/
ROOT::Math::XYZVector getDirection(const double& z) const override;
/**
* @brief Get the offset between up- & downstream tracklet at the position of the scatterer
* @return ROOT::Math::XYVector offset at scatterer
......
......@@ -56,6 +56,13 @@ namespace corryvreckan {
*/
ROOT::Math::XYZVector getDirection(const std::string&) const override { return m_direction; }
/**
* @brief Get the track direction at any given z position
* @param global z position
* @return ROOT::Math::XYZPoint direction at z
*/
ROOT::Math::XYZVector getDirection(const double&) const override { return m_direction; }
ROOT::Math::XYPoint distance(const Cluster* cluster) const;
/**
......
......@@ -190,6 +190,13 @@ namespace corryvreckan {
*/
virtual ROOT::Math::XYZVector getDirection(const std::string&) const;
/**
* @brief Get the track direction at any given z position
* @param global z position
* @return ROOT::Math::XYZPoint direction at z
*/
virtual ROOT::Math::XYZVector getDirection(const double&) const;
/**
* @brief check if the fitting routine already has been called. Chi2 etc are not set before
* @return true if fit has already been performed, false otherwise
......
Supports Markdown
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