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() ()
 
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:123

◆ 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:123
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:123

Member Function Documentation

◆ convertV9ToV10()

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

Data Model Evolution.

Definition at line 77 of file HGCSample.h.

References kToAMask, kToAShift, kToAValidMask, and kToAValidShift.

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

◆ data()

uint16_t HGCSample::data ( ) const
inline

Definition at line 70 of file HGCSample.h.

References getWord(), kDataMask, and kDataShift.

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

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

◆ gain()

uint16_t HGCSample::gain ( ) const
inline

Definition at line 68 of file HGCSample.h.

References getWord(), kGainMask, and kToGainShift.

Referenced by set(), and setGain().

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

◆ getToAValid()

bool HGCSample::getToAValid ( ) const
inline

Definition at line 71 of file HGCSample.h.

References getWord(), kToAValidMask, and kToAValidShift.

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

◆ getWord()

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

Definition at line 119 of file HGCSample.h.

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

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

119 { return ((value_ >> shift) & mask); }
uint32_t value_
Definition: HGCSample.h:123
constexpr uint32_t mask
Definition: gpuClustering.h:24
static unsigned int const shift

◆ mode()

bool HGCSample::mode ( ) const
inline

Definition at line 67 of file HGCSample.h.

References getWord(), kModeMask, and kModeShift.

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

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

◆ operator()()

uint32_t HGCSample::operator() ( )
inline

Definition at line 72 of file HGCSample.h.

References value_.

72 { return value_; }
uint32_t value_
Definition: HGCSample.h:123

◆ print()

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

Definition at line 57 of file HGCSample.h.

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

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

◆ raw()

uint32_t HGCSample::raw ( ) const
inline

getters

Definition at line 65 of file HGCSample.h.

References value_.

Referenced by print().

65 { return value_; }
uint32_t value_
Definition: HGCSample.h:123

◆ set()

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

Definition at line 49 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().

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

◆ setData()

void HGCSample::setData ( uint16_t  data)
inline

Definition at line 46 of file HGCSample.h.

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

Referenced by set().

uint16_t data() 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:108

◆ setGain()

void HGCSample::setGain ( uint16_t  gain)
inline

Definition at line 44 of file HGCSample.h.

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

Referenced by set().

uint16_t gain() 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:108

◆ setMode()

void HGCSample::setMode ( bool  mode)
inline

Definition at line 43 of file HGCSample.h.

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

Referenced by set().

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

◆ setThreshold()

void HGCSample::setThreshold ( bool  thr)
inline

setters

Definition at line 42 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:108

◆ setToA()

void HGCSample::setToA ( uint16_t  toa)
inline

Definition at line 45 of file HGCSample.h.

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

Referenced by set().

uint16_t toa() 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:108

◆ setToAValid()

void HGCSample::setToAValid ( bool  toaFired)
inline

Definition at line 47 of file HGCSample.h.

References kToAValidMask, kToAValidShift, and setWord().

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

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

◆ setWord()

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

wrapper to reset words at a given position

Definition at line 108 of file HGCSample.h.

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

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

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

◆ threshold()

bool HGCSample::threshold ( ) const
inline

Definition at line 66 of file HGCSample.h.

References getWord(), kThreshMask, and kThreshShift.

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

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

◆ toa()

uint16_t HGCSample::toa ( ) const
inline

Definition at line 69 of file HGCSample.h.

References getWord(), kToAMask, and kToAShift.

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

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

Member Data Documentation

◆ value_

uint32_t HGCSample::value_
private

Definition at line 123 of file HGCSample.h.

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