ATLAS Offline Software
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 
7 namespace 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 = fabs(r) - radius(t) ;
39  const unsigned char maxtries = 10 ;
40  unsigned char ntries = 0 ;
41  while ( 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 }
beamspotman.r
def r
Definition: beamspotman.py:676
TRTCond::BasicRtRelation::radius
virtual float radius(float driftime) const
radius for given drifttime
Definition: BasicRtRelation.cxx:21
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
TRTCond::BasicRtRelation::write
virtual std::ostream & write(std::ostream &) const
write to ascii ostream
Definition: BasicRtRelation.cxx:61
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TRTCond::BasicRtRelation::drdt
virtual float drdt(float driftime) const
driftvelocity for given drifttime
Definition: BasicRtRelation.cxx:28
BasicRtRelation.h
TRTCond::RtRelation
Definition: RtRelation.h:27
TRTCond::BasicRtRelation::m_status
unsigned char m_status
status byte
Definition: BasicRtRelation.h:86
TRTCond::BasicRtRelation
Definition: BasicRtRelation.h:26
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TRTCond::BasicRtRelation::m_cal
float m_cal[4]
calibration constants
Definition: BasicRtRelation.h:87
TRTCond::BasicRtRelation::isequal
virtual bool isequal(const RtRelation &rhs) const
equality operator
Definition: BasicRtRelation.cxx:54
TRTCond::BasicRtRelation::drifttime
virtual float drifttime(float radius) const
drifttime for given radius
Definition: BasicRtRelation.cxx:34
TRTCond
Definition: BasicRtRelation.cxx:8
TRTCond::BasicRtRelation::read
virtual std::istream & read(std::istream &)
read from to ascii ostream
Definition: BasicRtRelation.cxx:67
TRTCond::BasicRtRelation::set
void set(const float *cal)
set the calibration constants
Definition: BasicRtRelation.h:83
TRTCond::BasicRtRelation::operator=
BasicRtRelation & operator=(const BasicRtRelation &rhs)
assignment operator
Definition: BasicRtRelation.cxx:10