ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TRTCond::BasicRtRelation Class Reference

#include <BasicRtRelation.h>

Inheritance diagram for TRTCond::BasicRtRelation:
Collaboration diagram for TRTCond::BasicRtRelation:

Public Types

enum  Status { Undefined, Calibrated }
 enumerates status More...
 

Public Member Functions

 BasicRtRelation ()
 constructor More...
 
 BasicRtRelation (const float *cal, Status stat=Calibrated)
 constructor More...
 
 BasicRtRelation (const std::vector< float > &cal, Status stat=Calibrated)
 constructor More...
 
 BasicRtRelation (const BasicRtRelation &rhs)
 constructor More...
 
virtual ~BasicRtRelation ()
 destructor More...
 
virtual RtRelationclone () const
 cloner More...
 
BasicRtRelationoperator= (const BasicRtRelation &rhs)
 assignment operator More...
 
bool operator== (const BasicRtRelation &rhs) const
 equality operator More...
 
virtual int status () const
 status flag of (calibrated) rtrelation More...
 
virtual float radius (float driftime) const
 radius for given drifttime More...
 
virtual float drifttime (float radius) const
 drifttime for given radius More...
 
virtual float drdt (float driftime) const
 driftvelocity for given drifttime More...
 
virtual size_t footprint () const
 memory allocated by this rt-relation More...
 
virtual bool isequal (const RtRelation &rhs) const
 equality operator More...
 
virtual std::ostream & write (std::ostream &) const
 write to ascii ostream More...
 
virtual std::istream & read (std::istream &)
 read from to ascii ostream More...
 
const float * cal () const
 return to calibration constants More...
 
bool operator== (const RtRelation &rhs) const
 

Private Member Functions

void setstatus (int status)
 set the status More...
 
void set (const float *cal)
 set the calibration constants More...
 

Private Attributes

unsigned char m_status
 status byte More...
 
float m_cal [4]
 calibration constants More...
 

Detailed Description

Default rt-relation class in the TRT: a 3rd degree polynomial

Definition at line 25 of file BasicRtRelation.h.

Member Enumeration Documentation

◆ Status

enumerates status

Enumerator
Undefined 
Calibrated 

Definition at line 30 of file RtRelation.h.

30 { Undefined, Calibrated } ;

Constructor & Destructor Documentation

◆ BasicRtRelation() [1/4]

TRTCond::BasicRtRelation::BasicRtRelation ( )
inline

constructor

Definition at line 29 of file BasicRtRelation.h.

29 : m_status(Undefined) { m_cal[0] = m_cal[1] = m_cal[2] = m_cal[3] = 0 ; }

◆ BasicRtRelation() [2/4]

TRTCond::BasicRtRelation::BasicRtRelation ( const float *  cal,
Status  stat = Calibrated 
)
inline

constructor

Definition at line 31 of file BasicRtRelation.h.

32  : m_status(stat) { set(cal) ; }

◆ BasicRtRelation() [3/4]

TRTCond::BasicRtRelation::BasicRtRelation ( const std::vector< float > &  cal,
Status  stat = Calibrated 
)
inline

constructor

Definition at line 34 of file BasicRtRelation.h.

35  : m_status(stat) { set(&(cal.front())) ; }

◆ BasicRtRelation() [4/4]

TRTCond::BasicRtRelation::BasicRtRelation ( const BasicRtRelation rhs)
inline

constructor

Definition at line 37 of file BasicRtRelation.h.

37 : RtRelation(rhs) { *this = rhs ; }

◆ ~BasicRtRelation()

virtual TRTCond::BasicRtRelation::~BasicRtRelation ( )
inlinevirtual

destructor

Definition at line 39 of file BasicRtRelation.h.

39 {}

Member Function Documentation

◆ cal()

const float* TRTCond::BasicRtRelation::cal ( ) const
inline

return to calibration constants

Definition at line 76 of file BasicRtRelation.h.

76 { return m_cal ; }

◆ clone()

virtual RtRelation* TRTCond::BasicRtRelation::clone ( ) const
inlinevirtual

cloner

Implements TRTCond::RtRelation.

Definition at line 41 of file BasicRtRelation.h.

41 { return new BasicRtRelation(*this) ; }

◆ drdt()

float TRTCond::BasicRtRelation::drdt ( float  driftime) const
virtual

driftvelocity for given drifttime

Implements TRTCond::RtRelation.

Definition at line 28 of file BasicRtRelation.cxx.

29  {
30  return m_cal[1]+time*(2*m_cal[2]+time*3*m_cal[3]);
31  }

◆ drifttime()

float TRTCond::BasicRtRelation::drifttime ( float  radius) const
virtual

drifttime for given radius

Implements TRTCond::RtRelation.

Definition at line 34 of file BasicRtRelation.cxx.

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  }

◆ footprint()

virtual size_t TRTCond::BasicRtRelation::footprint ( ) const
inlinevirtual

memory allocated by this rt-relation

Reimplemented from TRTCond::RtRelation.

Definition at line 64 of file BasicRtRelation.h.

64 { return sizeof(*this) ; }

◆ isequal()

bool TRTCond::BasicRtRelation::isequal ( const RtRelation rhs) const
virtual

equality operator

Implements TRTCond::RtRelation.

Definition at line 54 of file BasicRtRelation.cxx.

55  {
56  const BasicRtRelation* rhsp = dynamic_cast<const BasicRtRelation*>(&rhs) ;
57  return rhsp && (*rhsp)==*this ;
58  }

◆ operator=()

BasicRtRelation & TRTCond::BasicRtRelation::operator= ( const BasicRtRelation rhs)

assignment operator

Definition at line 10 of file BasicRtRelation.cxx.

11  {
12 
13  if ( this != &rhs){
14  m_status = rhs.m_status ;
15  set(rhs.m_cal) ;
16  }
17  return *this ;
18  }

◆ operator==() [1/2]

bool TRTCond::BasicRtRelation::operator== ( const BasicRtRelation rhs) const
inline

equality operator

Definition at line 47 of file BasicRtRelation.h.

47  {
48  return (&rhs == this) || memcmp( m_cal, rhs.m_cal, 4*sizeof(float) )==0 ;
49  }

◆ operator==() [2/2]

bool TRTCond::RtRelation::operator== ( const RtRelation rhs) const
inlineinherited

Definition at line 54 of file RtRelation.h.

54 { return isequal(rhs) ; }

◆ radius()

float TRTCond::BasicRtRelation::radius ( float  driftime) const
virtual

radius for given drifttime

Implements TRTCond::RtRelation.

Definition at line 21 of file BasicRtRelation.cxx.

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  }

◆ read()

std::istream & TRTCond::BasicRtRelation::read ( std::istream &  is)
virtual

read from to ascii ostream

Implements TRTCond::RtRelation.

Definition at line 67 of file BasicRtRelation.cxx.

68  {
69  return is >> m_cal[0] >> m_cal[1] >> m_cal[2] >> m_cal[3] ;
70  }

◆ set()

void TRTCond::BasicRtRelation::set ( const float *  cal)
inlineprivate

set the calibration constants

Definition at line 83 of file BasicRtRelation.h.

83 { memcpy(m_cal,cal,4*sizeof(float)) ; }

◆ setstatus()

void TRTCond::BasicRtRelation::setstatus ( int  status)
inlineprivate

set the status

Definition at line 80 of file BasicRtRelation.h.

80 { m_status = status ; }

◆ status()

virtual int TRTCond::BasicRtRelation::status ( ) const
inlinevirtual

status flag of (calibrated) rtrelation

Implements TRTCond::RtRelation.

Definition at line 52 of file BasicRtRelation.h.

52 { return m_status ; }

◆ write()

std::ostream & TRTCond::BasicRtRelation::write ( std::ostream &  os) const
virtual

write to ascii ostream

Implements TRTCond::RtRelation.

Definition at line 61 of file BasicRtRelation.cxx.

62  {
63  return os << m_cal[0] << " " << m_cal[1] << " "
64  << m_cal[2] << " " << m_cal[3] << " " ;
65  }

Member Data Documentation

◆ m_cal

float TRTCond::BasicRtRelation::m_cal[4]
private

calibration constants

Definition at line 87 of file BasicRtRelation.h.

◆ m_status

unsigned char TRTCond::BasicRtRelation::m_status
private

status byte

Definition at line 86 of file BasicRtRelation.h.


The documentation for this class was generated from the following files:
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
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
TRTCond::RtRelation::isequal
virtual bool isequal(const RtRelation &rhs) const =0
equality operator
TRTCond::RtRelation::Calibrated
@ Calibrated
Definition: RtRelation.h:30
TRTCond::BasicRtRelation::m_status
unsigned char m_status
status byte
Definition: BasicRtRelation.h:86
beamspotman.stat
stat
Definition: beamspotman.py:266
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TRTCond::BasicRtRelation::m_cal
float m_cal[4]
calibration constants
Definition: BasicRtRelation.h:87
TRTCond::RtRelation::RtRelation
RtRelation()=default
constructors, desctructors, cloners
TRTCond::BasicRtRelation::BasicRtRelation
BasicRtRelation()
constructor
Definition: BasicRtRelation.h:29
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TRTCond::BasicRtRelation::cal
const float * cal() const
return to calibration constants
Definition: BasicRtRelation.h:76
TRTCond::BasicRtRelation::set
void set(const float *cal)
set the calibration constants
Definition: BasicRtRelation.h:83
TRTCond::RtRelation::Undefined
@ Undefined
Definition: RtRelation.h:30
TRTCond::BasicRtRelation::status
virtual int status() const
status flag of (calibrated) rtrelation
Definition: BasicRtRelation.h:52