ATLAS Offline Software
Loading...
Searching...
No Matches
RtSimplePolynomial.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
6#include "GeoModelKernel/throwExcept.h"
7using namespace MuonCalib;
8
11 // check for consistency //
12 if (nPar() < 3) {
13 THROW_EXCEPTION("RtSimplePolynomial::_init() - Not enough parameters!");
14 }
15 if (tLower() >= tUpper()) {
16 THROW_EXCEPTION("Lower time boundary ("<<tLower()<<")>= upper time ("<<tUpper()<<") boundary!");
17 }
18} // end RtSimplePolynomial::_init
19
20std::string RtSimplePolynomial::name() const { return "RtSimplePolynomial"; }
22
23double RtSimplePolynomial::radius(double t) const {
25 // INITIAL TIME CHECK //
27 if (t < tLower()) return 0.0;
28 if (t > tUpper()) return 14.6;
29
30 double rad{0.0}; // auxiliary radius
31 const double x = getReducedTime(t);
33 // CALCULATE r(t) //
35 for (unsigned int k = 0; k < nDoF(); k++) {
36 rad += par(k+2) * std::pow(x,k);
37 }
38 return std::max(rad, 0.);
39}
40
41//*****************************************************************************
42double RtSimplePolynomial::driftVelocity(double t) const {
43 // Set derivative to 0 outside of the bounds
44 if (t < tLower() || t > tUpper()) return 0.0;
45
46 // Chain rule
47 double drdt{0.};
48 const double x = getReducedTime(t);
49 // Chain rule
50 const double dx_dt = dReducedTimeDt();
51 for (unsigned int k = 1; k < nDoF(); ++k) {
52 drdt += par(k+2) * k * std::pow(x,k-1)*dx_dt;
53 }
54 return drdt;
55}
57 double acc{0.};
58 const double x = getReducedTime(t);
59 // Chain rule
60 const double dx_dt = dReducedTimeDt();
61 for (unsigned int k = 2; k < nDoF(); ++k) {
62 acc += par(k+2) *k * (k-1) * std::pow(x,k-2)*std::pow(dx_dt,2);
63 }
64 return acc * t;
65}
66double RtSimplePolynomial::tLower() const { return par(0); }
67double RtSimplePolynomial::tUpper() const { return par(1); }
68unsigned RtSimplePolynomial::nDoF() const { return nPar() -2; }
69
70std::vector<double> RtSimplePolynomial::rtParameters() const {
71 return std::vector<double>{parameters().begin() +2, parameters().end()};
72}
std::vector< size_t > vec
#define x
const ParVec & parameters() const
Definition CalibFunc.h:40
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
generic interface for a rt-relation
Definition IRtRelation.h:19
static constexpr double s_tBinWidth
Definition IRtRelation.h:60
double dReducedTimeDt() const
Definition IRtRelation.h:53
double getReducedTime(const double t) const
map the in the interval [tLower;tUpper] onto the interval [-1.;1.
Definition IRtRelation.h:49
virtual double driftAcceleration(double t) const override final
Returns the acceleration of the r-t relation.
virtual unsigned nDoF() const override final
get the coefficients of the r(t) polynomial
std::vector< double > rtParameters() const
virtual std::string name() const override final
get the class name
virtual double tBinWidth() const override final
Returns the step-size for the sampling.
virtual double tUpper() const override final
Returns the upper time covered by the r-t.
virtual double tLower() const override final
< get the lower drift-time bound
virtual double driftVelocity(double t) const override final
get the drift acceleration
virtual double radius(double t) const override final
get the drift velocity
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10