ATLAS Offline Software
Loading...
Searching...
No Matches
BasicRtRelation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace TRTCond
8{
9
11 {
12
13 if ( this != &rhs){
14 m_status = rhs.m_status ;
15 set(rhs.m_cal) ;
16 }
17 return *this ;
18 }
19
20
21 float BasicRtRelation::radius( float time ) const
22 {
23 return m_cal[0]+time*(m_cal[1]+time*(m_cal[2]+time*m_cal[3]));
24 //return r<0 ? 0 : (r>2 ? 2 : r ) ;
25 }
26
27
28 float BasicRtRelation::drdt( float time ) const
29 {
30 return m_cal[1]+time*(2*m_cal[2]+time*3*m_cal[3]);
31 }
32
33
34 float BasicRtRelation::drifttime(float r) const
35 {
36 const double precision = 0.0001 ;
37 double t = 20 ;
38 double residual = std::fabs(r) - radius(t) ;
39 const unsigned char maxtries = 10 ;
40 unsigned char ntries = 0 ;
41 while ( std::fabs(residual) > precision) {
42 if ( drdt(t) == 0. ) t += 0.;
43 else t += residual / drdt(t) ;
44 residual = r - radius(t) ;
45 if(++ntries>maxtries) {
46 t=-1 ;
47 break ;
48 }
49 }
50 return t ;
51 }
52
53
54 bool BasicRtRelation::isequal(const RtRelation& rhs) const
55 {
56 const BasicRtRelation* rhsp = dynamic_cast<const BasicRtRelation*>(&rhs) ;
57 return rhsp && (*rhsp)==*this ;
58 }
59
60
61 std::ostream& BasicRtRelation::write( std::ostream& os ) const
62 {
63 return os << m_cal[0] << " " << m_cal[1] << " "
64 << m_cal[2] << " " << m_cal[3] << " " ;
65 }
66
67 std::istream& BasicRtRelation::read( std::istream& is )
68 {
69 return is >> m_cal[0] >> m_cal[1] >> m_cal[2] >> m_cal[3] ;
70 }
71}
virtual std::istream & read(std::istream &)
read from to ascii ostream
virtual float drdt(float driftime) const
driftvelocity for given drifttime
virtual float drifttime(float radius) const
drifttime for given radius
BasicRtRelation & operator=(const BasicRtRelation &rhs)
assignment operator
float m_cal[4]
calibration constants
virtual float radius(float driftime) const
radius for given drifttime
void set(const float *cal)
set the calibration constants
unsigned char m_status
status byte
virtual std::ostream & write(std::ostream &) const
write to ascii ostream
virtual bool isequal(const RtRelation &rhs) const
equality operator
RtRelation()=default
constructors, desctructors, cloners
int r
Definition globals.cxx:22