ATLAS Offline Software
Loading...
Searching...
No Matches
RtScaleFunction.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include <array>
9namespace MuonCalib {
10
11 static constexpr std::array<double, 6> RtScaleFunction_p{-0.00102327, 0.00582117, -0.00676815, 0.00167504, -8.67371e-05, 1.66509e-06};
12
13 float RtScalePolynomial(const float r) {
14 // calculate polynomial
15 float p = 0;
16 for (int i = 5; i >= 0; i--) { p = RtScaleFunction_p[i] + r * p; }
17 return p;
18 }
19
20 float RtScaleFunction(const float t, const bool ml2, const IRtRelation &rt) {
21 if (t < rt.tLower() || !rt.hasTmaxDiff()) return 0.0;
22 // apply linear scale and calculate r as input to the polinomial
23 float rt_length = rt.tUpper() - rt.tLower();
24 float corr_val = (t / rt_length) * rt.GetTmaxDiff() * (ml2 ? -0.5 : +0.5);
25 float newt = t - corr_val;
26 // keep linear scale for t>t_max
27 if (newt > rt.tUpper()) return corr_val;
28
29 // calculate polynomial
30 float p = 0;
31 float r = rt.radius(newt);
32 for (int i = 5; i >= 0; i--) { p = RtScaleFunction_p[i] + r * p; }
33 return p * rt.GetTmaxDiff() * (ml2 ? -0.5 : +0.5);
34 }
35
36} // namespace MuonCalib
generic interface for a rt-relation
Definition IRtRelation.h:19
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
double GetTmaxDiff() const
return the difference in total dirft time between the two multilayers (ML1 - ML2)
Definition IRtRelation.h:40
bool hasTmaxDiff() const
Definition IRtRelation.h:42
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
int r
Definition globals.cxx:22
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
static constexpr std::array< double, 6 > RtScaleFunction_p
float RtScalePolynomial(const float r)
float RtScaleFunction(const float t, const bool ml2, const IRtRelation &rtrelation)