CMS 3D CMS Logo

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

wrapper for a data word More...

#include <HGCSample.h>

Public Types

enum  HGCSampleMasks {
  kThreshMask = 0x1, kModeMask = 0x1, kToAValidMask = 0x1, kGainMask = 0xf,
  kToAMask = 0x3ff, kDataMask = 0xfff
}
 
enum  HGCSampleShifts {
  kThreshShift = 31, kModeShift = 30, kToAValidShift = 29, kToGainShift = 22,
  kToAShift = 12, kDataShift = 0
}
 

Public Member Functions

uint16_t data () const
 
uint16_t gain () const
 
bool getToAValid () const
 
 HGCSample ()
 CTOR. More...
 
 HGCSample (uint32_t value)
 
 HGCSample (const HGCSample &o)
 
bool mode () const
 
uint32_t operator() ()
 
HGCSampleoperator= (const HGCSample &)=default
 
void print (std::ostream &out=std::cout)
 
uint32_t raw () const
 getters More...
 
void set (bool thr, bool mode, uint16_t gain, uint16_t toa, uint16_t data)
 
void setData (uint16_t data)
 
void setGain (uint16_t gain)
 
void setMode (bool mode)
 
void setThreshold (bool thr)
 setters More...
 
void setToA (uint16_t toa)
 
void setToAValid (bool toaFired)
 
bool threshold () const
 
uint16_t toa () const
 

Static Public Member Functions

static uint32_t convertV9ToV10 (uint32_t valueOldForm, bool toaFiredOldForm)
 Data Model Evolution. More...
 

Private Member Functions

uint32_t getWord (HGCSampleMasks mask, HGCSampleShifts shift) const
 
void setWord (uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
 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 HGCSample.h.

Member Enumeration Documentation

◆ HGCSampleMasks

Enumerator
kThreshMask 
kModeMask 
kToAValidMask 
kGainMask 
kToAMask 
kDataMask 

Definition at line 15 of file HGCSample.h.

◆ HGCSampleShifts

Enumerator
kThreshShift 
kModeShift 
kToAValidShift 
kToGainShift 
kToAShift 
kDataShift 

Definition at line 23 of file HGCSample.h.

Constructor & Destructor Documentation

◆ HGCSample() [1/3]

HGCSample::HGCSample ( )
inline

CTOR.

Definition at line 35 of file HGCSample.h.

35 : value_(0) {}
uint32_t value_
Definition: HGCSample.h:124

◆ HGCSample() [2/3]

HGCSample::HGCSample ( uint32_t  value)
inline

Definition at line 36 of file HGCSample.h.

36 : value_(value) {}
uint32_t value_
Definition: HGCSample.h:124
Definition: value.py:1

◆ HGCSample() [3/3]

HGCSample::HGCSample ( const HGCSample o)
inline

Definition at line 37 of file HGCSample.h.

37 : value_(o.value_) {}
uint32_t value_
Definition: HGCSample.h:124

Member Function Documentation

◆ convertV9ToV10()

static uint32_t HGCSample::convertV9ToV10 ( uint32_t  valueOldForm,
bool  toaFiredOldForm 
)
inlinestatic

Data Model Evolution.

Definition at line 78 of file HGCSample.h.

References kToAMask, kToAShift, kToAValidMask, and kToAValidShift.

78  {
79  // combine value&toaFired from the dataformat V9-or-earlier
80  // from persisted objects
81  // to produce a value_ compatible w/ the V10 format
82  // i.e.
83  // 1) shift the 10 toa bits by 1 bit
84  // 2) insert the toaFired into _value
85  // NOTE: nothing can be done for the gain bits:
86  // info about gain was not preswent in V9-or-earlier, and will be left to 0 in V10
87  // root doc: https://root.cern.ch/root/html/io/DataModelEvolution.html
88  // see PR 28349 for more info
89 
90  // V9 Format: tm--------tttttttttt-dddddddddddd
91  uint32_t valueNewForm(valueOldForm);
92 
93  // set to 0 the 17 bits bits (between 13 and 29 - both included)
94  valueNewForm &= ~(0x3FFFF << kToAShift);
95 
96  // copy toa to start from bit 13
97  valueNewForm |= ((valueOldForm >> 13) & kToAMask) << kToAShift;
98 
99  // set 1 bit toaFiredOldForm in position 30
100  valueNewForm |= (toaFiredOldForm & kToAValidMask) << kToAValidShift;
101 
102  return valueNewForm;
103  }

◆ data()

uint16_t HGCSample::data ( ) const
inline

Definition at line 71 of file HGCSample.h.

References getWord(), kDataMask, and kDataShift.

Referenced by HGCalDigiValidation::analyze(), HGCalTBAnalyzer::analyze(), print(), set(), and setData().

71 { return getWord(kDataMask, kDataShift); }
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

◆ gain()

uint16_t HGCSample::gain ( ) const
inline

Definition at line 69 of file HGCSample.h.

References getWord(), kGainMask, and kToGainShift.

Referenced by set(), and setGain().

69 { return getWord(kGainMask, kToGainShift); }
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

◆ getToAValid()

bool HGCSample::getToAValid ( ) const
inline

Definition at line 72 of file HGCSample.h.

References getWord(), kToAValidMask, and kToAValidShift.

uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

◆ getWord()

uint32_t HGCSample::getWord ( HGCSampleMasks  mask,
HGCSampleShifts  shift 
) const
inlineprivate

Definition at line 120 of file HGCSample.h.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, edm::shift, and value_.

Referenced by data(), gain(), getToAValid(), mode(), threshold(), and toa().

120 { return ((value_ >> shift) & mask); }
uint32_t value_
Definition: HGCSample.h:124
static unsigned int const shift

◆ mode()

bool HGCSample::mode ( ) const
inline

Definition at line 68 of file HGCSample.h.

References getWord(), kModeMask, and kModeShift.

Referenced by HGCalDigiValidation::analyze(), print(), set(), and setMode().

68 { return getWord(kModeMask, kModeShift); }
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

◆ operator()()

uint32_t HGCSample::operator() ( )
inline

Definition at line 73 of file HGCSample.h.

References value_.

73 { return value_; }
uint32_t value_
Definition: HGCSample.h:124

◆ operator=()

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

◆ print()

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

Definition at line 58 of file HGCSample.h.

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

58  {
59  out << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " Data: " << data() << " Raw=0x"
60  << std::hex << raw() << std::dec << std::endl;
61  }
bool mode() const
Definition: HGCSample.h:68
uint16_t data() const
Definition: HGCSample.h:71
uint16_t toa() const
Definition: HGCSample.h:70
bool threshold() const
Definition: HGCSample.h:67
uint32_t raw() const
getters
Definition: HGCSample.h:66

◆ raw()

uint32_t HGCSample::raw ( ) const
inline

getters

Definition at line 66 of file HGCSample.h.

References value_.

Referenced by print().

66 { return value_; }
uint32_t value_
Definition: HGCSample.h:124

◆ set()

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

Definition at line 50 of file HGCSample.h.

References data(), gain(), mode(), setData(), setGain(), setMode(), setThreshold(), setToA(), and toa().

Referenced by HGCFEElectronics< DFr >::runShaperWithToT(), HGCFEElectronics< DFr >::runSimpleShaper(), and HGCFEElectronics< DFr >::runTrivialShaper().

50  {
51  setThreshold(thr);
52  setMode(mode);
53  setGain(gain);
54  setToA(toa);
55  setData(data);
56  }
uint16_t gain() const
Definition: HGCSample.h:69
void setMode(bool mode)
Definition: HGCSample.h:44
bool mode() const
Definition: HGCSample.h:68
uint16_t data() const
Definition: HGCSample.h:71
void setThreshold(bool thr)
setters
Definition: HGCSample.h:43
void setToA(uint16_t toa)
Definition: HGCSample.h:46
void setGain(uint16_t gain)
Definition: HGCSample.h:45
uint16_t toa() const
Definition: HGCSample.h:70
void setData(uint16_t data)
Definition: HGCSample.h:47

◆ setData()

void HGCSample::setData ( uint16_t  data)
inline

Definition at line 47 of file HGCSample.h.

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

Referenced by set().

uint16_t data() const
Definition: HGCSample.h:71
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setGain()

void HGCSample::setGain ( uint16_t  gain)
inline

Definition at line 45 of file HGCSample.h.

References gain(), kGainMask, kToGainShift, and setWord().

Referenced by set().

uint16_t gain() const
Definition: HGCSample.h:69
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setMode()

void HGCSample::setMode ( bool  mode)
inline

Definition at line 44 of file HGCSample.h.

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

Referenced by set().

bool mode() const
Definition: HGCSample.h:68
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setThreshold()

void HGCSample::setThreshold ( bool  thr)
inline

setters

Definition at line 43 of file HGCSample.h.

References kThreshMask, kThreshShift, and setWord().

Referenced by set().

void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setToA()

void HGCSample::setToA ( uint16_t  toa)
inline

Definition at line 46 of file HGCSample.h.

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

Referenced by set().

uint16_t toa() const
Definition: HGCSample.h:70
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setToAValid()

void HGCSample::setToAValid ( bool  toaFired)
inline

Definition at line 48 of file HGCSample.h.

References kToAValidMask, kToAValidShift, and setWord().

Referenced by HGCFEElectronics< DFr >::runShaperWithToT().

48 { setWord(toaFired, kToAValidMask, kToAValidShift); }
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:109

◆ setWord()

void HGCSample::setWord ( uint16_t  word,
HGCSampleMasks  mask,
HGCSampleShifts  shift 
)
inlineprivate

wrapper to reset words at a given position

Definition at line 109 of file HGCSample.h.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, edm::shift, and value_.

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

109  {
110  // mask and shift bits
111  const uint32_t masked_word = (word & mask) << shift;
112 
113  //clear to 0 bits which will be set by word
114  value_ &= ~(mask << shift);
115 
116  //now set bits
117  value_ |= (masked_word);
118  }
uint32_t value_
Definition: HGCSample.h:124
uint64_t word
static unsigned int const shift

◆ threshold()

bool HGCSample::threshold ( ) const
inline

Definition at line 67 of file HGCSample.h.

References getWord(), kThreshMask, and kThreshShift.

Referenced by HGCalDigiValidation::analyze(), and print().

67 { return getWord(kThreshMask, kThreshShift); }
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

◆ toa()

uint16_t HGCSample::toa ( ) const
inline

Definition at line 70 of file HGCSample.h.

References getWord(), kToAMask, and kToAShift.

Referenced by HGCalDigiValidation::analyze(), print(), set(), and setToA().

70 { return getWord(kToAMask, kToAShift); }
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:120

Member Data Documentation

◆ value_

uint32_t HGCSample::value_
private

Definition at line 124 of file HGCSample.h.

Referenced by getWord(), operator()(), raw(), and setWord().