CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
BTLSample Class Reference

wrapper for a data word More...

#include <BTLSample.h>

Public Types

enum  BTLSampleDataMasks { kToA2Mask = 0x3ff, kToAMask = 0x3ff, kDataMask = 0x3ff }
 
enum  BTLSampleDataShifts { kToA2Shift = 20, kToAShift = 10, kDataShift = 0 }
 
enum  BTLSampleFlagMasks { kThreshMask = 0x1, kModeMask = 0x1 }
 
enum  BTLSampleFlagShifts { kThreshShift = 1, kModeShift = 0 }
 

Public Member Functions

 BTLSample ()
 CTOR. More...
 
 BTLSample (uint32_t value, uint16_t flag, uint8_t row, uint8_t col)
 
 BTLSample (const BTLSample &o)
 
uint8_t column () const
 
uint32_t data () const
 
bool mode () const
 
BTLSampleoperator= (const BTLSample &)=default
 
void print (std::ostream &out=std::cout)
 
uint32_t raw_data () const
 getters More...
 
uint16_t raw_flag () const
 
uint8_t row () const
 
void set (bool thr, bool mode, uint16_t toa2, uint16_t toa, uint16_t data, uint8_t row, uint8_t col)
 
void setData (uint16_t data)
 
void setMode (bool mode)
 
void setThreshold (bool thr)
 setters More...
 
void setToA (uint16_t toa)
 
void setToA2 (uint16_t toa2)
 
bool threshold () const
 
uint32_t toa () const
 
uint32_t toa2 () const
 

Private Member Functions

void setDataWord (uint32_t word, uint32_t mask, uint32_t pos)
 wrapper to reset words at a given position More...
 
void setFlagWord (uint16_t word, uint16_t mask, uint16_t pos)
 

Private Attributes

uint8_t col_
 
uint16_t flag_
 
uint8_t row_
 
uint32_t value_
 

Detailed Description

wrapper for a data word

Definition at line 13 of file BTLSample.h.

Member Enumeration Documentation

◆ BTLSampleDataMasks

Enumerator
kToA2Mask 
kToAMask 
kDataMask 

Definition at line 15 of file BTLSample.h.

◆ BTLSampleDataShifts

Enumerator
kToA2Shift 
kToAShift 
kDataShift 

Definition at line 16 of file BTLSample.h.

◆ BTLSampleFlagMasks

Enumerator
kThreshMask 
kModeMask 

Definition at line 18 of file BTLSample.h.

◆ BTLSampleFlagShifts

Enumerator
kThreshShift 
kModeShift 

Definition at line 19 of file BTLSample.h.

Constructor & Destructor Documentation

◆ BTLSample() [1/3]

BTLSample::BTLSample ( )
inline

CTOR.

Definition at line 24 of file BTLSample.h.

24 : value_(0), flag_(0), row_(0), col_(0) {}
uint8_t row_
Definition: BTLSample.h:85
uint16_t flag_
Definition: BTLSample.h:84
uint8_t col_
Definition: BTLSample.h:85
uint32_t value_
Definition: BTLSample.h:83

◆ BTLSample() [2/3]

BTLSample::BTLSample ( uint32_t  value,
uint16_t  flag,
uint8_t  row,
uint8_t  col 
)
inline

Definition at line 25 of file BTLSample.h.

26  : value_(value), flag_(flag), row_(row), col_(col) {}
uint8_t row_
Definition: BTLSample.h:85
uint16_t flag_
Definition: BTLSample.h:84
uint8_t col_
Definition: BTLSample.h:85
uint32_t value_
Definition: BTLSample.h:83
uint8_t row() const
Definition: BTLSample.h:62
Definition: value.py:1
col
Definition: cuy.py:1009

◆ BTLSample() [3/3]

BTLSample::BTLSample ( const BTLSample o)
inline

Definition at line 27 of file BTLSample.h.

27 : value_(o.value_), flag_(o.flag_), row_(o.row_), col_(o.col_) {}
uint8_t row_
Definition: BTLSample.h:85
uint16_t flag_
Definition: BTLSample.h:84
uint8_t col_
Definition: BTLSample.h:85
uint32_t value_
Definition: BTLSample.h:83

Member Function Documentation

◆ column()

uint8_t BTLSample::column ( ) const
inline

Definition at line 63 of file BTLSample.h.

References col_.

Referenced by print().

63 { return col_; }
uint8_t col_
Definition: BTLSample.h:85

◆ data()

uint32_t BTLSample::data ( ) const
inline

Definition at line 61 of file BTLSample.h.

References kDataMask, kDataShift, and value_.

Referenced by print(), set(), and setData().

◆ mode()

bool BTLSample::mode ( ) const
inline

Definition at line 58 of file BTLSample.h.

References flag_, kModeMask, and kModeShift.

Referenced by print(), set(), and setMode().

◆ operator=()

BTLSample& BTLSample::operator= ( const BTLSample )
default

◆ print()

void BTLSample::print ( std::ostream &  out = std::cout)
inline

Definition at line 46 of file BTLSample.h.

References column(), data(), TauDecayModes::dec, mode(), MillePedeFileConverter_cfg::out, raw_data(), raw_flag(), row(), threshold(), toa(), and toa2().

46  {
47  out << "THR: " << threshold() << " Mode: " << mode() << " ToA2: " << toa2() << " ToA: " << toa()
48  << " Data: " << data() << " Row: " << (uint32_t)row() << " Column: " << (uint32_t)column() << " Raw Flag=0x"
49  << std::hex << raw_flag() << std::dec << " Raw Data=0x" << std::hex << raw_data() << std::dec << std::endl;
50  }
uint32_t data() const
Definition: BTLSample.h:61
uint8_t column() const
Definition: BTLSample.h:63
uint32_t raw_data() const
getters
Definition: BTLSample.h:55
uint8_t row() const
Definition: BTLSample.h:62
bool mode() const
Definition: BTLSample.h:58
uint32_t toa() const
Definition: BTLSample.h:59
uint32_t toa2() const
Definition: BTLSample.h:60
bool threshold() const
Definition: BTLSample.h:57
uint16_t raw_flag() const
Definition: BTLSample.h:56

◆ raw_data()

uint32_t BTLSample::raw_data ( ) const
inline

getters

Definition at line 55 of file BTLSample.h.

References value_.

Referenced by print().

55 { return value_; }
uint32_t value_
Definition: BTLSample.h:83

◆ raw_flag()

uint16_t BTLSample::raw_flag ( ) const
inline

Definition at line 56 of file BTLSample.h.

References flag_.

Referenced by print().

56 { return flag_; }
uint16_t flag_
Definition: BTLSample.h:84

◆ row()

uint8_t BTLSample::row ( ) const
inline

Definition at line 62 of file BTLSample.h.

References row_.

Referenced by print(), and set().

62 { return row_; }
uint8_t row_
Definition: BTLSample.h:85

◆ set()

void BTLSample::set ( bool  thr,
bool  mode,
uint16_t  toa2,
uint16_t  toa,
uint16_t  data,
uint8_t  row,
uint8_t  col 
)
inline

Definition at line 38 of file BTLSample.h.

References cuy::col, col_, data(), flag_, kDataMask, kDataShift, kModeMask, kModeShift, kThreshMask, kThreshShift, kToA2Mask, kToA2Shift, kToAMask, kToAShift, mode(), row(), row_, toa(), toa2(), and value_.

Referenced by BTLElectronicsSim::runTrivialShaper().

38  {
39  flag_ = (((uint16_t)thr & kThreshMask) << kThreshShift | ((uint16_t)mode & kModeMask) << kModeShift);
40 
41  value_ = (((uint32_t)toa2 & kToA2Mask) << kToA2Shift | ((uint32_t)toa & kToAMask) << kToAShift |
42  ((uint32_t)data & kDataMask) << kDataShift);
43  row_ = row;
44  col_ = col;
45  }
uint32_t data() const
Definition: BTLSample.h:61
uint8_t row_
Definition: BTLSample.h:85
uint16_t flag_
Definition: BTLSample.h:84
uint8_t col_
Definition: BTLSample.h:85
uint32_t value_
Definition: BTLSample.h:83
uint8_t row() const
Definition: BTLSample.h:62
bool mode() const
Definition: BTLSample.h:58
uint32_t toa() const
Definition: BTLSample.h:59
uint32_t toa2() const
Definition: BTLSample.h:60
col
Definition: cuy.py:1009

◆ setData()

void BTLSample::setData ( uint16_t  data)
inline

Definition at line 37 of file BTLSample.h.

References data(), kDataMask, kDataShift, and setDataWord().

uint32_t data() const
Definition: BTLSample.h:61
void setDataWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: BTLSample.h:69

◆ setDataWord()

void BTLSample::setDataWord ( uint32_t  word,
uint32_t  mask,
uint32_t  pos 
)
inlineprivate

wrapper to reset words at a given position

Definition at line 69 of file BTLSample.h.

References gpuClustering::pixelStatus::mask, and value_.

Referenced by setData(), setToA(), and setToA2().

69  {
70  //clear required bits
71  value_ &= ~(mask << pos);
72  //now set the new value
73  value_ |= ((word & mask) << pos);
74  }
uint32_t value_
Definition: BTLSample.h:83
constexpr uint32_t mask
Definition: gpuClustering.h:26
uint64_t word

◆ setFlagWord()

void BTLSample::setFlagWord ( uint16_t  word,
uint16_t  mask,
uint16_t  pos 
)
inlineprivate

Definition at line 75 of file BTLSample.h.

References flag_, and gpuClustering::pixelStatus::mask.

Referenced by setMode(), and setThreshold().

75  {
76  //clear required bits
77  flag_ &= ~(mask << pos);
78  //now set the new value
79  flag_ |= ((word & mask) << pos);
80  }
uint16_t flag_
Definition: BTLSample.h:84
constexpr uint32_t mask
Definition: gpuClustering.h:26
uint64_t word

◆ setMode()

void BTLSample::setMode ( bool  mode)
inline

Definition at line 34 of file BTLSample.h.

References kModeMask, kModeShift, mode(), and setFlagWord().

bool mode() const
Definition: BTLSample.h:58
void setFlagWord(uint16_t word, uint16_t mask, uint16_t pos)
Definition: BTLSample.h:75

◆ setThreshold()

void BTLSample::setThreshold ( bool  thr)
inline

setters

Definition at line 33 of file BTLSample.h.

References kThreshMask, kThreshShift, and setFlagWord().

void setFlagWord(uint16_t word, uint16_t mask, uint16_t pos)
Definition: BTLSample.h:75

◆ setToA()

void BTLSample::setToA ( uint16_t  toa)
inline

Definition at line 35 of file BTLSample.h.

References kToAMask, kToAShift, setDataWord(), and toa().

uint32_t toa() const
Definition: BTLSample.h:59
void setDataWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: BTLSample.h:69

◆ setToA2()

void BTLSample::setToA2 ( uint16_t  toa2)
inline

Definition at line 36 of file BTLSample.h.

References kToA2Mask, kToA2Shift, setDataWord(), and toa2().

uint32_t toa2() const
Definition: BTLSample.h:60
void setDataWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: BTLSample.h:69

◆ threshold()

bool BTLSample::threshold ( ) const
inline

Definition at line 57 of file BTLSample.h.

References flag_, kThreshMask, and kThreshShift.

Referenced by print().

◆ toa()

uint32_t BTLSample::toa ( ) const
inline

Definition at line 59 of file BTLSample.h.

References kToAMask, kToAShift, and value_.

Referenced by print(), set(), and setToA().

59 { return ((value_ >> kToAShift) & kToAMask); }
uint32_t value_
Definition: BTLSample.h:83

◆ toa2()

uint32_t BTLSample::toa2 ( ) const
inline

Definition at line 60 of file BTLSample.h.

References kToA2Mask, kToA2Shift, and value_.

Referenced by print(), set(), and setToA2().

Member Data Documentation

◆ col_

uint8_t BTLSample::col_
private

Definition at line 85 of file BTLSample.h.

Referenced by column(), and set().

◆ flag_

uint16_t BTLSample::flag_
private

Definition at line 84 of file BTLSample.h.

Referenced by mode(), raw_flag(), set(), setFlagWord(), and threshold().

◆ row_

uint8_t BTLSample::row_
private

Definition at line 85 of file BTLSample.h.

Referenced by row(), and set().

◆ value_

uint32_t BTLSample::value_
private

Definition at line 83 of file BTLSample.h.

Referenced by data(), raw_data(), set(), setDataWord(), toa(), and toa2().