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)
 
 BTLSample (const BTLSample &o)
 
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
 
void set (bool thr, bool mode, uint16_t toa2, uint16_t toa, uint16_t data)
 
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

uint16_t flag_
 
uint32_t value_
 

Detailed Description

wrapper for a data word

Definition at line 13 of file BTLSample.h.

Member Enumeration Documentation

Enumerator
kToA2Mask 
kToAMask 
kDataMask 

Definition at line 17 of file BTLSample.h.

Enumerator
kToA2Shift 
kToAShift 
kDataShift 

Definition at line 18 of file BTLSample.h.

Enumerator
kThreshMask 
kModeMask 

Definition at line 20 of file BTLSample.h.

Enumerator
kThreshShift 
kModeShift 

Definition at line 21 of file BTLSample.h.

Constructor & Destructor Documentation

BTLSample::BTLSample ( )
inline

CTOR.

Definition at line 26 of file BTLSample.h.

26 : value_(0), flag_(0) { }
uint16_t flag_
Definition: BTLSample.h:91
uint32_t value_
Definition: BTLSample.h:90
BTLSample::BTLSample ( uint32_t  value,
uint16_t  flag 
)
inline

Definition at line 27 of file BTLSample.h.

27 : value_(value), flag_(flag) { }
uint16_t flag_
Definition: BTLSample.h:91
uint32_t value_
Definition: BTLSample.h:90
Definition: value.py:1
BTLSample::BTLSample ( const BTLSample o)
inline

Definition at line 28 of file BTLSample.h.

28 : value_(o.value_), flag_(o.flag_) { }
uint16_t flag_
Definition: BTLSample.h:91
uint32_t value_
Definition: BTLSample.h:90

Member Function Documentation

uint32_t BTLSample::data ( ) const
inline

Definition at line 67 of file BTLSample.h.

References kDataMask, kDataShift, and value_.

Referenced by print(), and set().

67 { return ( (value_ >> kDataShift) & kDataMask ); }
uint32_t value_
Definition: BTLSample.h:90
bool BTLSample::mode ( ) const
inline

Definition at line 64 of file BTLSample.h.

References flag_, kModeMask, and kModeShift.

Referenced by print().

64 { return ( (flag_ >> kModeShift) & kModeMask ); }
uint16_t flag_
Definition: BTLSample.h:91
void BTLSample::print ( std::ostream &  out = std::cout)
inline

Definition at line 47 of file BTLSample.h.

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

48  {
49  out << "THR: " << threshold()
50  << " Mode: " << mode()
51  << " ToA2: " << toa2()
52  << " ToA: " << toa()
53  << " Data: " << data()
54  << " Raw Flag=0x" << std::hex << raw_flag() << std::dec
55  << " Raw Data=0x" << std::hex << raw_data() << std::dec << std::endl;
56  }
uint16_t raw_flag() const
Definition: BTLSample.h:62
bool threshold() const
Definition: BTLSample.h:63
uint32_t data() const
Definition: BTLSample.h:67
uint32_t toa2() const
Definition: BTLSample.h:66
bool mode() const
Definition: BTLSample.h:64
uint32_t toa() const
Definition: BTLSample.h:65
uint32_t raw_data() const
getters
Definition: BTLSample.h:61
uint32_t BTLSample::raw_data ( ) const
inline

getters

Definition at line 61 of file BTLSample.h.

References value_.

Referenced by print().

61 { return value_; }
uint32_t value_
Definition: BTLSample.h:90
uint16_t BTLSample::raw_flag ( ) const
inline

Definition at line 62 of file BTLSample.h.

References flag_.

Referenced by print().

62 { return flag_; }
uint16_t flag_
Definition: BTLSample.h:91
void BTLSample::set ( bool  thr,
bool  mode,
uint16_t  toa2,
uint16_t  toa,
uint16_t  data 
)
inline

Definition at line 38 of file BTLSample.h.

References data(), flag_, kDataMask, kDataShift, kModeMask, kModeShift, kThreshMask, kThreshShift, kToA2Mask, kToA2Shift, kToAMask, kToAShift, and value_.

Referenced by BTLElectronicsSim::runTrivialShaper().

39  {
40  flag_ = ( ( (uint16_t)thr & kThreshMask ) << kThreshShift |
41  ( (uint16_t)mode & kModeMask ) << kModeShift );
42 
43  value_ = ( ( (uint32_t)toa2 & kToA2Mask ) << kToA2Shift |
44  ( (uint32_t)toa & kToAMask ) << kToAShift |
45  ( (uint32_t)data & kDataMask ) << kDataShift );
46  }
uint32_t data() const
Definition: BTLSample.h:67
uint32_t toa2() const
Definition: BTLSample.h:66
uint16_t flag_
Definition: BTLSample.h:91
bool mode() const
Definition: BTLSample.h:64
uint32_t toa() const
Definition: BTLSample.h:65
uint32_t value_
Definition: BTLSample.h:90
void BTLSample::setData ( uint16_t  data)
inline

Definition at line 37 of file BTLSample.h.

References kDataMask, kDataShift, and setDataWord().

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

wrapper to reset words at a given position

Definition at line 74 of file BTLSample.h.

References RecoTauDiscriminantConfiguration::mask, and value_.

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

75  {
76  //clear required bits
77  value_ &= ~(mask << pos);
78  //now set the new value
79  value_ |= ( (word & mask) << pos );
80  }
uint32_t value_
Definition: BTLSample.h:90
void BTLSample::setFlagWord ( uint16_t  word,
uint16_t  mask,
uint16_t  pos 
)
inlineprivate

Definition at line 81 of file BTLSample.h.

References flag_, and RecoTauDiscriminantConfiguration::mask.

Referenced by setMode(), and setThreshold().

82  {
83  //clear required bits
84  flag_ &= ~(mask << pos);
85  //now set the new value
86  flag_ |= ( (word & mask) << pos );
87  }
uint16_t flag_
Definition: BTLSample.h:91
void BTLSample::setMode ( bool  mode)
inline

Definition at line 34 of file BTLSample.h.

References kModeMask, kModeShift, and setFlagWord().

bool mode() const
Definition: BTLSample.h:64
void setFlagWord(uint16_t word, uint16_t mask, uint16_t pos)
Definition: BTLSample.h:81
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:81
void BTLSample::setToA ( uint16_t  toa)
inline

Definition at line 35 of file BTLSample.h.

References kToAMask, kToAShift, and setDataWord().

uint32_t toa() const
Definition: BTLSample.h:65
void setDataWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: BTLSample.h:74
void BTLSample::setToA2 ( uint16_t  toa2)
inline

Definition at line 36 of file BTLSample.h.

References kToA2Mask, kToA2Shift, and setDataWord().

uint32_t toa2() const
Definition: BTLSample.h:66
void setDataWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: BTLSample.h:74
bool BTLSample::threshold ( ) const
inline

Definition at line 63 of file BTLSample.h.

References flag_, kThreshMask, and kThreshShift.

Referenced by print().

uint32_t BTLSample::toa ( ) const
inline

Definition at line 65 of file BTLSample.h.

References kToAMask, kToAShift, and value_.

Referenced by print().

65 { return ( (value_ >> kToAShift) & kToAMask ); }
uint32_t value_
Definition: BTLSample.h:90
uint32_t BTLSample::toa2 ( ) const
inline

Definition at line 66 of file BTLSample.h.

References kToA2Mask, kToA2Shift, and value_.

Referenced by print().

66 { return ( (value_ >> kToA2Shift) & kToA2Mask ); }
uint32_t value_
Definition: BTLSample.h:90

Member Data Documentation

uint16_t BTLSample::flag_
private

Definition at line 91 of file BTLSample.h.

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

uint32_t BTLSample::value_
private

Definition at line 90 of file BTLSample.h.

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