ATLAS Offline Software
Loading...
Searching...
No Matches
TrSimplePolynomial.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GeoModelKernel/throwExcept.h"
7#include <cmath>
8namespace MuonCalib{
10 if (minRadius() >= maxRadius()) {
11 THROW_EXCEPTION("Minimum radius greater than maximum radius!");
12 }
13 }
14 std::string TrSimplePolynomial::name() const { return "TrSimplePolynomial"; }
15
16 std::optional<double> TrSimplePolynomial::driftTime(const double r) const {
17 if (r < minRadius() || r > maxRadius()) return std::nullopt;
18 double time{0.};
19 const double x = getReducedR(r);
20 for (unsigned int k = 0; k < nDoF(); ++k) {
21 time += par(k+2) * std::pow(x,k);
22 }
23 return std::make_optional(time);
24
25
26 }
27 std::optional<double> TrSimplePolynomial::driftTimePrime(const double r) const {
28 if (r < minRadius() || r > maxRadius()) return std::nullopt;
29 double dtdr{0.};
30 const double dXprime = getReducedRPrime();
31 for (unsigned int k = 1; k < nDoF(); ++k) {
32 dtdr += par(k+2) * k * std::pow(r,k-1) * dXprime;
33 }
34 return std::make_optional(dtdr);
35
36 }
37 std::optional<double> TrSimplePolynomial::driftTime2Prime(const double r) const {
38 if (r < minRadius() || r > maxRadius()) return std::nullopt;
39 double d2tdr2{0.};
40 const double dt_dr = std::pow(getReducedRPrime(), 2);
41 for (unsigned int k = 2; k < nDoF(); ++k) {
42 d2tdr2 += par(k+2) *k * (k-1)* std::pow(r,k-2) * dt_dr;
43 }
44 return std::make_optional(d2tdr2);
45 }
46 double TrSimplePolynomial::minRadius() const { return par(0); }
47 double TrSimplePolynomial::maxRadius() const { return par(1); }
48 unsigned TrSimplePolynomial::nDoF() const { return nPar() -2; }
49
50}
51
52
53
54
std::vector< size_t > vec
#define x
double par(unsigned int index) const
Definition CalibFunc.h:41
unsigned int nPar() const
Definition CalibFunc.h:39
std::vector< double > ParVec
Definition CalibFunc.h:35
double getReducedR(const double r) const
Maps the radius interval [minRadius;maxRadius] to [-1;1] where the minimal radius is on the lower end...
Definition ITrRelation.h:42
ITrRelation(const ParVec &parameters)
Constructor taking the input r-t relation & the vector of parameters.
Definition ITrRelation.h:20
double getReducedRPrime() const
Returns the derivative of the reduced radisu w.r.t r.
Definition ITrRelation.h:46
virtual double minRadius() const override final
Returns the minimum drift-radius.
virtual std::string name() const override final
virtual std::optional< double > driftTimePrime(const double r) const override final
virtual double maxRadius() const override final
Returns the maximum drift-radius.
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the tr relation.
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 > driftTime2Prime(const double r) const override final
int r
Definition globals.cxx:22
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10