16 constexpr std::size_t numPoints(100);
17 double stepSize{rtRelation.
radius(rtRelation.
tUpper()) / (numPoints - 1)};
21 for(std::size_t i = 0; i < numPoints; ++i){
37 std::size_t idx = std::distance(
m_radii.begin(), it) - 1;
39 double radius2 =
m_radii[idx + 1];
40 if (radius1 == radius2)
return m_times[idx];
42 double time2 =
m_times[idx + 1];
43 return time1 + (time2 - time1) * (
r - radius1) / (radius2 - radius1);
50 std::size_t idx = std::distance(
m_radii.begin(), it) - 1;
52 double radius2 =
m_radii[idx + 1];
53 if (radius1 == radius2)
return std::nullopt;
55 double time2 =
m_times[idx + 1];
56 return (time2 - time1) / (radius2 - radius1);
68 double precision{0.001};
69 double tMax{rtRelation.
tUpper()};
70 double tMin{rtRelation.
tLower()};
73 while (tMax - tMin > 0.1 and std::abs(rtRelation.
radius(0.5 * (tMin + tMax)) - radius) > precision) {
74 double midPoint = 0.5 * (tMin + tMax);
75 if (rtRelation.
radius(midPoint) > radius) {
81 return 0.5 * (tMin + tMax);
std::vector< double > ParVec
generic interface for a rt-relation
virtual double tLower() const =0
Returns the lower time covered by the r-t.
virtual double radius(double t) const =0
returns drift radius for a given time
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
ITrRelation(const ParVec ¶meters)
Constructor taking the input r-t relation & the vector of parameters.
std::vector< double > m_radii
virtual std::optional< double > driftTime(const double r) const override final
Interface method for fetching the drift-time from the radius Returns a nullopt if the time is out of ...
virtual std::optional< double > driftTimePrime(const double r) const override final
virtual std::string name() const override final
double getTFromR(const double radius, const IRtRelation &rtRelation) const
virtual std::optional< double > driftTime2Prime(const double r) const override final
std::vector< double > m_times
virtual double minRadius() const override final
Returns the minimum drift-radius.
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the tr relation.
virtual double maxRadius() const override final
Returns the maximum drift-radius.
TrRelationLookUp(const IRtRelation &rtRelation)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.