ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 
 BinnedRtRelation (float tmin, float tmax, const std::vector< float > &values, Status stat=Calibrated)
 normal constructor More...
 
 BinnedRtRelation (const BinnedRtRelation &rhs)=default
 copy constructor More...
 
BinnedRtRelationoperator= (const BinnedRtRelation &rhs)=default
 assignment More...
 
virtual ~BinnedRtRelation ()
 desctructor More...
 
virtual RtRelationclone () const
 clone function 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...
 
float tmin () const
 get access to minimum drifttime More...
 
float tmax () const
 get access to maximum drifttime More...
 
const std::vector< float > & values () const
 get access to vector of radii for each drifttime bin More...
 
bool operator== (const RtRelation &rhs) const
 

Private Member Functions

float binsize () const
 get access to bin size More...
 

Private Attributes

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

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.

30 { Undefined, Calibrated } ;

Constructor & Destructor Documentation

◆ BinnedRtRelation() [1/3]

TRTCond::BinnedRtRelation::BinnedRtRelation ( )
inline

default constructor

Definition at line 30 of file BinnedRtRelation.h.

◆ 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.

◆ 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) ; }

◆ 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  }

◆ 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  }

◆ 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) ; }

◆ 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  }

◆ 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:
beamspotman.r
def r
Definition: beamspotman.py:676
TRTCond::BinnedRtRelation::BinnedRtRelation
BinnedRtRelation()
default constructor
Definition: BinnedRtRelation.h:30
TRTCond::BinnedRtRelation::m_tmax
float m_tmax
maximum drifttime
Definition: BinnedRtRelation.h:86
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
skel.it
it
Definition: skel.GENtoEVGEN.py:396
athena.value
value
Definition: athena.py:124
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TRTCond::BinnedRtRelation::m_status
unsigned char m_status
status byte
Definition: BinnedRtRelation.h:84
TRTCond::RtRelation::isequal
virtual bool isequal(const RtRelation &rhs) const =0
equality operator
TRTCond::BinnedRtRelation::m_values
std::vector< float > m_values
number of elements
Definition: BinnedRtRelation.h:87
TRTCond::RtRelation::Calibrated
@ Calibrated
Definition: RtRelation.h:30
TRTCond::BinnedRtRelation::tmin
float tmin() const
get access to minimum drifttime
Definition: BinnedRtRelation.h:73
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
TRTCond::BinnedRtRelation::tmax
float tmax() const
get access to maximum drifttime
Definition: BinnedRtRelation.h:75
beamspotman.stat
stat
Definition: beamspotman.py:266
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TRTCond::BinnedRtRelation::binsize
float binsize() const
get access to bin size
Definition: BinnedRtRelation.h:81
TRTCond::BinnedRtRelation::values
const std::vector< float > & values() const
get access to vector of radii for each drifttime bin
Definition: BinnedRtRelation.h:77
TRTCond::RtRelation::Undefined
@ Undefined
Definition: RtRelation.h:30
TRTCond::BinnedRtRelation::m_tmin
float m_tmin
minimum drifttime
Definition: BinnedRtRelation.h:85
readCCLHist.float
float
Definition: readCCLHist.py:83