ATLAS Offline Software
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>
9 namespace 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
beamspotman.r
def r
Definition: beamspotman.py:676
RtScaleFunction.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MuonCalib::IRtRelation::HasTmaxDiff
bool HasTmaxDiff() const
Definition: IRtRelation.h:30
MuonCalib::IRtRelation::GetTmaxDiff
float GetTmaxDiff() const
return the difference in total dirft time between the two multilayers (ML1 - ML2)
Definition: IRtRelation.h:28
MuonCalib::RtScalePolynomial
float RtScalePolynomial(const float r)
Definition: RtScaleFunction.cxx:13
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::IRtRelation::tUpper
virtual double tUpper() const =0
MuonCalib::IRtRelation::radius
virtual double radius(double t) const =0
returns drift radius for a given time
MuonCalib::IRtRelation::tLower
virtual double tLower() const =0
IRtRelation.h
MuonCalib::RtScaleFunction
float RtScaleFunction(const float t, const bool ml2, const IRtRelation &rtrelation)
Definition: RtScaleFunction.cxx:20
MuonCalib::IRtRelation
generic interface for a rt-relation
Definition: IRtRelation.h:14