ATLAS Offline Software
Loading...
Searching...
No Matches
TRTCond::BinnedRtRelation Class Reference

#include <BinnedRtRelation.h>

Inheritance diagram for TRTCond::BinnedRtRelation:
Collaboration diagram for TRTCond::BinnedRtRelation:

Public Types

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

Public Member Functions

 BinnedRtRelation ()
 default constructor
 BinnedRtRelation (float tmin, float tmax, const std::vector< float > &values, Status stat=Calibrated)
 normal constructor
 BinnedRtRelation (const BinnedRtRelation &rhs)=default
 copy constructor
BinnedRtRelationoperator= (const BinnedRtRelation &rhs)=default
 assignment
virtual ~BinnedRtRelation ()
 desctructor
virtual RtRelationclone () const
 clone function
virtual int status () const
 status flag of (calibrated) rtrelation
virtual float radius (float driftime) const
 radius for given drifttime
virtual float drifttime (float radius) const
 drifttime for given radius
virtual float drdt (float driftime) const
 driftvelocity for given drifttime
virtual size_t footprint () const
 memory allocated by this rt-relation
virtual bool isequal (const RtRelation &rhs) const
 equality operator
virtual std::ostream & write (std::ostream &) const
 write to ascii ostream
virtual std::istream & read (std::istream &)
 read from to ascii ostream
float tmin () const
 get access to minimum drifttime
float tmax () const
 get access to maximum drifttime
const std::vector< float > & values () const
 get access to vector of radii for each drifttime bin
bool operator== (const RtRelation &rhs) const

Private Member Functions

float binsize () const
 get access to bin size

Private Attributes

unsigned char m_status
 status byte
float m_tmin
 minimum drifttime
float m_tmax
 maximum drifttime
std::vector< float > m_values
 number of elements

Detailed Description

Definition at line 26 of file BinnedRtRelation.h.

Member Enumeration Documentation

◆ Status

enumerates status

Enumerator
Undefined 
Calibrated 

Definition at line 30 of file RtRelation.h.

Constructor & Destructor Documentation

◆ BinnedRtRelation() [1/3]

TRTCond::BinnedRtRelation::BinnedRtRelation ( )
inline

default constructor

Definition at line 30 of file BinnedRtRelation.h.

float m_tmin
minimum drifttime
float m_tmax
maximum drifttime
unsigned char m_status
status byte

◆ BinnedRtRelation() [2/3]

TRTCond::BinnedRtRelation::BinnedRtRelation ( float tmin,
float tmax,
const std::vector< float > & values,
Status stat = Calibrated )
inline

normal constructor

Definition at line 33 of file BinnedRtRelation.h.

const std::vector< float > & values() const
get access to vector of radii for each drifttime bin
std::vector< float > m_values
number of elements
float tmax() const
get access to maximum drifttime
float tmin() const
get access to minimum drifttime

◆ BinnedRtRelation() [3/3]

TRTCond::BinnedRtRelation::BinnedRtRelation ( const BinnedRtRelation & rhs)
default

copy constructor

◆ ~BinnedRtRelation()

virtual TRTCond::BinnedRtRelation::~BinnedRtRelation ( )
inlinevirtual

desctructor

Definition at line 43 of file BinnedRtRelation.h.

43{}

Member Function Documentation

◆ binsize()

float TRTCond::BinnedRtRelation::binsize ( ) const
inlineprivate

get access to bin size

Definition at line 81 of file BinnedRtRelation.h.

81{ return (m_tmax - m_tmin)/(m_values.size()-1) ; }

◆ clone()

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

clone function

Implements TRTCond::RtRelation.

Definition at line 46 of file BinnedRtRelation.h.

46{ return new BinnedRtRelation(*this) ; }
BinnedRtRelation()
default constructor

◆ drdt()

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

driftvelocity for given drifttime

Implements TRTCond::RtRelation.

Definition at line 35 of file BinnedRtRelation.cxx.

36 {
37 float dt = binsize() ;
38 int timebin = int((time - m_tmin) / dt) ;
39 if( time <= m_tmin ) return 0 ;
40 else if(time >= m_tmax ) return 0 ;
41 else return (m_values[timebin+1]-m_values[timebin])/dt ;
42 }
float binsize() const
get access to bin size

◆ drifttime()

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

drifttime for given radius

Implements TRTCond::RtRelation.

Definition at line 44 of file BinnedRtRelation.cxx.

45 {
46 double t ;
47 if(r <= m_values.front()) t = m_tmin ;
48 else if(r >= m_values.back()) t = m_tmax ;
49 else {
50 // first find the bin with a binary search
51 std::vector<float>::const_iterator it = std::lower_bound(m_values.begin(),m_values.end(),r) ;
52 size_t timebin = it - m_values.begin() - 1 ;
53 // fraction in this bin
54 float fracbin = (r - m_values[timebin])/(m_values[timebin+1]-m_values[timebin]) ;
55 // now get the time
56 t = m_tmin + binsize() * (timebin + fracbin) ;
57 }
58 return t ;
59 }
int r
Definition globals.cxx:22

◆ footprint()

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

memory allocated by this rt-relation

Reimplemented from TRTCond::RtRelation.

Definition at line 61 of file BinnedRtRelation.h.

61{ return sizeof(*this) + m_values.size()*sizeof(float) ; }

◆ isequal()

bool TRTCond::BinnedRtRelation::isequal ( const RtRelation & rhs) const
virtual

equality operator

Implements TRTCond::RtRelation.

Definition at line 13 of file BinnedRtRelation.cxx.

14 {
15 const BinnedRtRelation* rhscast=dynamic_cast<const BinnedRtRelation*>(&rhs) ;
16 return rhscast!=nullptr && *this==*rhscast ;
17 }

◆ operator=()

BinnedRtRelation & TRTCond::BinnedRtRelation::operator= ( const BinnedRtRelation & rhs)
default

assignment

◆ operator==()

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

Definition at line 54 of file RtRelation.h.

54{ return isequal(rhs) ; }
virtual bool isequal(const RtRelation &rhs) const =0
equality operator

◆ radius()

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

radius for given drifttime

Implements TRTCond::RtRelation.

Definition at line 20 of file BinnedRtRelation.cxx.

21 {
22 float r(0) ;
23 if( time <= m_tmin ) r = m_values.front() ;
24 else if(time >= m_tmax ) r = m_values.back() ;
25 else {
26 // interpolate
27 float rtimebin = (time - m_tmin) / binsize() ;
28 size_t timebin = int(rtimebin) ;
29 float fracbin = rtimebin - timebin ;
30 r = (1-fracbin)*m_values[timebin] + fracbin*m_values[timebin+1] ;
31 }
32 return r ;
33 }
time(flags, cells_name, *args, **kw)

◆ read()

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

read from to ascii ostream

Implements TRTCond::RtRelation.

Definition at line 68 of file BinnedRtRelation.cxx.

69 {
70 size_t n(0) ;
71 is >> m_tmin >> m_tmax >> n ;
72 if(n<UINT_MAX){
73 m_values.resize(n) ;
74 for(size_t i=0; i<n; ++i) is >> m_values[i] ;
75 }
76 return is ;
77 }

◆ status()

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

status flag of (calibrated) rtrelation

Implements TRTCond::RtRelation.

Definition at line 49 of file BinnedRtRelation.h.

49{ return m_status ; }

◆ tmax()

float TRTCond::BinnedRtRelation::tmax ( ) const
inline

get access to maximum drifttime

Definition at line 75 of file BinnedRtRelation.h.

75{ return m_tmax ; }

◆ tmin()

float TRTCond::BinnedRtRelation::tmin ( ) const
inline

get access to minimum drifttime

Definition at line 73 of file BinnedRtRelation.h.

73{ return m_tmin ; }

◆ values()

const std::vector< float > & TRTCond::BinnedRtRelation::values ( ) const
inline

get access to vector of radii for each drifttime bin

Definition at line 77 of file BinnedRtRelation.h.

77{ return m_values ; }

◆ write()

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

write to ascii ostream

Implements TRTCond::RtRelation.

Definition at line 61 of file BinnedRtRelation.cxx.

62 {
63 os << m_tmin << " " << m_tmax << " " << m_values.size() << " " ;
64 for(float value : m_values) os << value << " " ;
65 return os ;
66 }

Member Data Documentation

◆ m_status

unsigned char TRTCond::BinnedRtRelation::m_status
private

status byte

Definition at line 84 of file BinnedRtRelation.h.

◆ m_tmax

float TRTCond::BinnedRtRelation::m_tmax
private

maximum drifttime

Definition at line 86 of file BinnedRtRelation.h.

◆ m_tmin

float TRTCond::BinnedRtRelation::m_tmin
private

minimum drifttime

Definition at line 85 of file BinnedRtRelation.h.

◆ m_values

std::vector<float> TRTCond::BinnedRtRelation::m_values
private

number of elements

Definition at line 87 of file BinnedRtRelation.h.


The documentation for this class was generated from the following files: