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
 
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:84
uint16_t flag_
Definition: BTLSample.h:83
uint8_t col_
Definition: BTLSample.h:84
uint32_t value_
Definition: BTLSample.h:82

◆ 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:84
uint16_t flag_
Definition: BTLSample.h:83
uint8_t col_
Definition: BTLSample.h:84
uint32_t value_
Definition: BTLSample.h:82
uint8_t row() const
Definition: BTLSample.h:61
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:84
uint16_t flag_
Definition: BTLSample.h:83
uint8_t col_
Definition: BTLSample.h:84
uint32_t value_
Definition: BTLSample.h:82

Member Function Documentation

◆ column()

uint8_t BTLSample::column ( ) const
inline

Definition at line 62 of file BTLSample.h.

References col_.

Referenced by print().

62 { return col_; }
uint8_t col_
Definition: BTLSample.h:84

◆ data()

uint32_t BTLSample::data ( ) const
inline

Definition at line 60 of file BTLSample.h.

References kDataMask, kDataShift, and value_.

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

◆ mode()

bool BTLSample::mode ( ) const
inline

Definition at line 57 of file BTLSample.h.

References flag_, kModeMask, and kModeShift.

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

◆ print()

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

Definition at line 45 of file BTLSample.h.

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

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

◆ raw_data()

uint32_t BTLSample::raw_data ( ) const
inline

getters

Definition at line 54 of file BTLSample.h.

References value_.

Referenced by print().

54 { return value_; }
uint32_t value_
Definition: BTLSample.h:82

◆ raw_flag()

uint16_t BTLSample::raw_flag ( ) const
inline

Definition at line 55 of file BTLSample.h.

References flag_.

Referenced by print().

55 { return flag_; }
uint16_t flag_
Definition: BTLSample.h:83

◆ row()

uint8_t BTLSample::row ( ) const
inline

Definition at line 61 of file BTLSample.h.

References row_.

Referenced by print(), and set().

61 { return row_; }
uint8_t row_
Definition: BTLSample.h:84

◆ 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 37 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().

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

◆ setData()

void BTLSample::setData ( uint16_t  data)
inline

Definition at line 36 of file BTLSample.h.

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

uint32_t data() 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:68

◆ 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 68 of file BTLSample.h.

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

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

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

◆ setFlagWord()

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

Definition at line 74 of file BTLSample.h.

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

Referenced by setMode(), and setThreshold().

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

◆ setMode()

void BTLSample::setMode ( bool  mode)
inline

Definition at line 33 of file BTLSample.h.

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

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

◆ setThreshold()

void BTLSample::setThreshold ( bool  thr)
inline

setters

Definition at line 32 of file BTLSample.h.

References kThreshMask, kThreshShift, and setFlagWord().

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

◆ setToA()

void BTLSample::setToA ( uint16_t  toa)
inline

Definition at line 34 of file BTLSample.h.

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

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

◆ setToA2()

void BTLSample::setToA2 ( uint16_t  toa2)
inline

Definition at line 35 of file BTLSample.h.

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

uint32_t toa2() 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:68

◆ threshold()

bool BTLSample::threshold ( ) const
inline

Definition at line 56 of file BTLSample.h.

References flag_, kThreshMask, and kThreshShift.

Referenced by print().

◆ toa()

uint32_t BTLSample::toa ( ) const
inline

Definition at line 58 of file BTLSample.h.

References kToAMask, kToAShift, and value_.

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

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

◆ toa2()

uint32_t BTLSample::toa2 ( ) const
inline

Definition at line 59 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 84 of file BTLSample.h.

Referenced by column(), and set().

◆ flag_

uint16_t BTLSample::flag_
private

Definition at line 83 of file BTLSample.h.

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

◆ row_

uint8_t BTLSample::row_
private

Definition at line 84 of file BTLSample.h.

Referenced by row(), and set().

◆ value_

uint32_t BTLSample::value_
private

Definition at line 82 of file BTLSample.h.

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