ATLAS Offline Software
BasicRtRelation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 // $Id: BasicRtRelation.h,v 1.5 2008-12-16 14:35:47 dquarrie Exp $
12 
13 #ifndef TRTCONDITDIONSDATA_BASICRTRELATION_H
14 #define TRTCONDITDIONSDATA_BASICRTRELATION_H
15 
16 #include <cstring>
17 #include <math.h>
19 
20 namespace TRTCond
21 {
22 
25  class BasicRtRelation : public RtRelation
26  {
27  public:
29  BasicRtRelation() : m_status(Undefined) { m_cal[0] = m_cal[1] = m_cal[2] = m_cal[3] = 0 ; }
32  : m_status(stat) { set(cal) ; }
34  BasicRtRelation(const std::vector<float>& cal, Status stat = Calibrated )
35  : m_status(stat) { set(&(cal.front())) ; }
37  BasicRtRelation(const BasicRtRelation& rhs) : RtRelation(rhs) { *this = rhs ; }
39  virtual ~BasicRtRelation() {}
41  virtual RtRelation* clone() const { return new BasicRtRelation(*this) ; }
42 
45 
47  bool operator==(const BasicRtRelation& rhs) const {
48  return (&rhs == this) || memcmp( m_cal, rhs.m_cal, 4*sizeof(float) )==0 ;
49  }
50 
52  virtual int status() const { return m_status ; }
53 
55  virtual float radius( float driftime ) const ;
56 
58  virtual float drifttime( float radius ) const ;
59 
61  virtual float drdt( float driftime ) const ;
62 
64  virtual size_t footprint() const { return sizeof(*this) ; }
65 
67  virtual bool isequal( const RtRelation& rhs) const ;
68 
70  virtual std::ostream& write(std::ostream&) const ;
71 
73  virtual std::istream& read(std::istream&) ;
74 
76  const float* cal() const { return m_cal ; }
77 
78  private:
80  void setstatus( int status ) { m_status = status ; }
81 
83  void set( const float * cal ) { memcpy(m_cal,cal,4*sizeof(float)) ; }
84 
85  private:
86  unsigned char m_status ;
87  float m_cal[4] ;
88  } ;
89 
90 }
91 
92 inline std::ostream& operator<<(std::ostream& os, const TRTCond::BasicRtRelation& rtr) {
93  return rtr.write(os) ; }
94 
95 
96 
97 #endif
TRTCond::BasicRtRelation::operator==
bool operator==(const BasicRtRelation &rhs) const
equality operator
Definition: BasicRtRelation.h:47
TRTCond::BasicRtRelation::radius
virtual float radius(float driftime) const
radius for given drifttime
Definition: BasicRtRelation.cxx:21
RtRelation.h
abstract base class for rt-relations
TRTCond::BasicRtRelation::~BasicRtRelation
virtual ~BasicRtRelation()
destructor
Definition: BasicRtRelation.h:39
TRTCond::BasicRtRelation::write
virtual std::ostream & write(std::ostream &) const
write to ascii ostream
Definition: BasicRtRelation.cxx:61
TRTCond::BasicRtRelation::footprint
virtual size_t footprint() const
memory allocated by this rt-relation
Definition: BasicRtRelation.h:64
TRTCond::BasicRtRelation::BasicRtRelation
BasicRtRelation(const float *cal, Status stat=Calibrated)
constructor
Definition: BasicRtRelation.h:31
TRTCond::BasicRtRelation::drdt
virtual float drdt(float driftime) const
driftvelocity for given drifttime
Definition: BasicRtRelation.cxx:28
operator<<
std::ostream & operator<<(std::ostream &os, const TRTCond::BasicRtRelation &rtr)
Definition: BasicRtRelation.h:92
TRTCond::BasicRtRelation::setstatus
void setstatus(int status)
set the status
Definition: BasicRtRelation.h:80
TRTCond::RtRelation
Definition: RtRelation.h:27
TRTCond::RtRelation::Calibrated
@ Calibrated
Definition: RtRelation.h:30
TRTCond::BasicRtRelation::BasicRtRelation
BasicRtRelation(const std::vector< float > &cal, Status stat=Calibrated)
constructor
Definition: BasicRtRelation.h:34
TRTCond::BasicRtRelation::m_status
unsigned char m_status
status byte
Definition: BasicRtRelation.h:86
TRTCond::BasicRtRelation
Definition: BasicRtRelation.h:26
TRTCond::RtRelation::Status
Status
enumerates status
Definition: RtRelation.h:30
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::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::BasicRtRelation::BasicRtRelation
BasicRtRelation()
constructor
Definition: BasicRtRelation.h:29
TRTCond::BasicRtRelation::BasicRtRelation
BasicRtRelation(const BasicRtRelation &rhs)
constructor
Definition: BasicRtRelation.h:37
TRTCond::BasicRtRelation::clone
virtual RtRelation * clone() const
cloner
Definition: BasicRtRelation.h:41
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::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::BasicRtRelation::operator=
BasicRtRelation & operator=(const BasicRtRelation &rhs)
assignment operator
Definition: BasicRtRelation.cxx:10
TRTCond::RtRelation::Undefined
@ Undefined
Definition: RtRelation.h:30
TRTCond::BasicRtRelation::status
virtual int status() const
status flag of (calibrated) rtrelation
Definition: BasicRtRelation.h:52