CMS 3D CMS Logo

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

wrapper for a data word More...

#include <FTLSample.h>

Public Types

enum  FTLSampleMasks { kThreshMask = 0x1, kModeMask = 0x1, kToAMask = 0xfff, kDataMask = 0xfff }
 
enum  FTLSampleShifts { kThreshShift = 31, kModeShift = 30, kToAShift = 13, kDataShift = 0 }
 

Public Member Functions

uint32_t data () const
 
 FTLSample ()
 CTOR. More...
 
 FTLSample (const FTLSample &o)
 
 FTLSample (uint32_t value)
 
bool mode () const
 
uint32_t operator() ()
 
void print (std::ostream &out=std::cout)
 
uint32_t raw () const
 getters More...
 
void set (bool thr, bool mode, 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)
 
bool threshold () const
 
uint32_t toa () const
 

Private Member Functions

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

Private Attributes

uint32_t value_
 

Detailed Description

wrapper for a data word

Definition at line 13 of file FTLSample.h.

Member Enumeration Documentation

◆ FTLSampleMasks

Enumerator
kThreshMask 
kModeMask 
kToAMask 
kDataMask 

Definition at line 15 of file FTLSample.h.

15 { kThreshMask = 0x1, kModeMask = 0x1, kToAMask = 0xfff, kDataMask = 0xfff };

◆ FTLSampleShifts

Enumerator
kThreshShift 
kModeShift 
kToAShift 
kDataShift 

Definition at line 16 of file FTLSample.h.

16 { kThreshShift = 31, kModeShift = 30, kToAShift = 13, kDataShift = 0 };

Constructor & Destructor Documentation

◆ FTLSample() [1/3]

FTLSample::FTLSample ( )
inline

CTOR.

Definition at line 21 of file FTLSample.h.

21 : value_(0) {}

◆ FTLSample() [2/3]

FTLSample::FTLSample ( uint32_t  value)
inline

Definition at line 22 of file FTLSample.h.

22 : value_(value) {}

◆ FTLSample() [3/3]

FTLSample::FTLSample ( const FTLSample o)
inline

Definition at line 23 of file FTLSample.h.

23 : value_(o.value_) {}

Member Function Documentation

◆ data()

uint32_t FTLSample::data ( ) const
inline

Definition at line 48 of file FTLSample.h.

48 { return ((value_ >> kDataShift) & kDataMask); }

References kDataMask, kDataShift, and value_.

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

◆ mode()

bool FTLSample::mode ( ) const
inline

Definition at line 46 of file FTLSample.h.

46 { return ((value_ >> kModeShift) & kModeMask); }

References kModeMask, kModeShift, and value_.

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

◆ operator()()

uint32_t FTLSample::operator() ( )
inline

Definition at line 49 of file FTLSample.h.

49 { return value_; }

References value_.

◆ print()

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

Definition at line 36 of file FTLSample.h.

36  {
37  out << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " Data: " << data() << " Raw=0x"
38  << std::hex << raw() << std::dec << std::endl;
39  }

References data(), TauDecayModes::dec, mode(), MillePedeFileConverter_cfg::out, raw(), threshold(), and toa().

◆ raw()

uint32_t FTLSample::raw ( ) const
inline

getters

Definition at line 44 of file FTLSample.h.

44 { return value_; }

References value_.

Referenced by print().

◆ set()

void FTLSample::set ( bool  thr,
bool  mode,
uint16_t  toa,
uint16_t  data 
)
inline

Definition at line 32 of file FTLSample.h.

32  {
33  value_ = (((uint32_t)thr & kThreshMask) << kThreshShift | ((uint32_t)mode & kModeMask) << kModeShift |
34  ((uint32_t)toa & kToAMask) << kToAShift | ((uint32_t)data & kDataMask) << kDataShift);
35  }

References data(), kDataMask, kDataShift, kModeMask, kModeShift, kThreshMask, kThreshShift, kToAMask, kToAShift, mode(), toa(), and value_.

◆ setData()

void FTLSample::setData ( uint16_t  data)
inline

Definition at line 31 of file FTLSample.h.

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

◆ setMode()

void FTLSample::setMode ( bool  mode)
inline

Definition at line 29 of file FTLSample.h.

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

◆ setThreshold()

void FTLSample::setThreshold ( bool  thr)
inline

setters

Definition at line 28 of file FTLSample.h.

References kThreshMask, kThreshShift, and setWord().

◆ setToA()

void FTLSample::setToA ( uint16_t  toa)
inline

Definition at line 30 of file FTLSample.h.

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

◆ setWord()

void FTLSample::setWord ( uint32_t  word,
uint32_t  mask,
uint32_t  pos 
)
inlineprivate

wrapper to reset words at a given position

Definition at line 55 of file FTLSample.h.

55  {
56  //clear required bits
57  const uint32_t masked_word = (word & mask) << pos;
58  value_ &= ~(masked_word);
59  //now set the new value
60  value_ |= (masked_word);
61  }

References value_.

Referenced by setData(), setMode(), setThreshold(), and setToA().

◆ threshold()

bool FTLSample::threshold ( ) const
inline

Definition at line 45 of file FTLSample.h.

45 { return ((value_ >> kThreshShift) & kThreshMask); }

References kThreshMask, kThreshShift, and value_.

Referenced by print().

◆ toa()

uint32_t FTLSample::toa ( ) const
inline

Definition at line 47 of file FTLSample.h.

47 { return ((value_ >> kToAShift) & kToAMask); }

References kToAMask, kToAShift, and value_.

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

Member Data Documentation

◆ value_

uint32_t FTLSample::value_
private

Definition at line 64 of file FTLSample.h.

Referenced by data(), mode(), operator()(), raw(), set(), setWord(), threshold(), and toa().

FTLSample::threshold
bool threshold() const
Definition: FTLSample.h:45
FTLSample::mode
bool mode() const
Definition: FTLSample.h:46
FTLSample::kToAMask
Definition: FTLSample.h:15
FTLSample::value_
uint32_t value_
Definition: FTLSample.h:64
pos
Definition: PixelAliasList.h:18
FTLSample::kThreshMask
Definition: FTLSample.h:15
FTLSample::kModeShift
Definition: FTLSample.h:16
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
FTLSample::kModeMask
Definition: FTLSample.h:15
FTLSample::kDataMask
Definition: FTLSample.h:15
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
FTLSample::toa
uint32_t toa() const
Definition: FTLSample.h:47
FTLSample::raw
uint32_t raw() const
getters
Definition: FTLSample.h:44
FTLSample::setWord
void setWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition: FTLSample.h:55
FTLSample::kToAShift
Definition: FTLSample.h:16
value
Definition: value.py:1
FTLSample::kDataShift
Definition: FTLSample.h:16
FTLSample::kThreshShift
Definition: FTLSample.h:16
FTLSample::data
uint32_t data() const
Definition: FTLSample.h:48
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142