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 (const HGCSample &o)
 
 HGCSample (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 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.

15  {
16  kThreshMask = 0x1,
17  kModeMask = 0x1,
18  kToAValidMask = 0x1,
19  kGainMask = 0xf,
20  kToAMask = 0x3ff,
21  kDataMask = 0xfff
22  };

◆ HGCSampleShifts

Enumerator
kThreshShift 
kModeShift 
kToAValidShift 
kToGainShift 
kToAShift 
kDataShift 

Definition at line 23 of file HGCSample.h.

23  {
24  kThreshShift = 31,
25  kModeShift = 30,
26  kToAValidShift = 29,
27  kToGainShift = 22,
28  kToAShift = 12,
29  kDataShift = 0
30  };

Constructor & Destructor Documentation

◆ HGCSample() [1/3]

HGCSample::HGCSample ( )
inline

CTOR.

Definition at line 35 of file HGCSample.h.

35 : value_(0) {}

◆ HGCSample() [2/3]

HGCSample::HGCSample ( uint32_t  value)
inline

Definition at line 36 of file HGCSample.h.

36 : value_(value) {}

◆ HGCSample() [3/3]

HGCSample::HGCSample ( const HGCSample o)
inline

Definition at line 37 of file HGCSample.h.

37 : value_(o.value_) {}

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.

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  }

References kToAMask, kToAShift, kToAValidMask, and kToAValidShift.

◆ data()

uint16_t HGCSample::data ( ) const
inline

Definition at line 70 of file HGCSample.h.

70 { return getWord(kDataMask, kDataShift); }

References getWord(), kDataMask, and kDataShift.

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

◆ gain()

uint16_t HGCSample::gain ( ) const
inline

Definition at line 68 of file HGCSample.h.

68 { return getWord(kGainMask, kToGainShift); }

References getWord(), kGainMask, and kToGainShift.

Referenced by set(), and setGain().

◆ getToAValid()

bool HGCSample::getToAValid ( ) const
inline

Definition at line 71 of file HGCSample.h.

References getWord(), kToAValidMask, and kToAValidShift.

◆ getWord()

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

Definition at line 119 of file HGCSample.h.

119 { return ((value_ >> shift) & mask); }

References edm::shift, and value_.

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

◆ mode()

bool HGCSample::mode ( ) const
inline

Definition at line 67 of file HGCSample.h.

67 { return getWord(kModeMask, kModeShift); }

References getWord(), kModeMask, and kModeShift.

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

◆ operator()()

uint32_t HGCSample::operator() ( )
inline

Definition at line 72 of file HGCSample.h.

72 { return value_; }

References value_.

◆ print()

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

Definition at line 57 of file HGCSample.h.

57  {
58  out << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " Data: " << data() << " Raw=0x"
59  << std::hex << raw() << std::dec << std::endl;
60  }

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

◆ raw()

uint32_t HGCSample::raw ( ) const
inline

getters

Definition at line 65 of file HGCSample.h.

65 { return value_; }

References value_.

Referenced by print().

◆ set()

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

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

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

◆ setMode()

void HGCSample::setMode ( bool  mode)
inline

Definition at line 43 of file HGCSample.h.

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

Referenced by set().

◆ setThreshold()

void HGCSample::setThreshold ( bool  thr)
inline

setters

Definition at line 42 of file HGCSample.h.

References kThreshMask, kThreshShift, and setWord().

Referenced by set().

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

◆ setToAValid()

void HGCSample::setToAValid ( bool  toaFired)
inline

Definition at line 47 of file HGCSample.h.

47 { setWord(toaFired, kToAValidMask, kToAValidShift); }

References kToAValidMask, kToAValidShift, and setWord().

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

◆ 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.

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  }

References edm::shift, and value_.

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

◆ threshold()

bool HGCSample::threshold ( ) const
inline

Definition at line 66 of file HGCSample.h.

66 { return getWord(kThreshMask, kThreshShift); }

References getWord(), kThreshMask, and kThreshShift.

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

◆ toa()

uint16_t HGCSample::toa ( ) const
inline

Definition at line 69 of file HGCSample.h.

69 { return getWord(kToAMask, kToAShift); }

References getWord(), kToAMask, and kToAShift.

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

Member Data Documentation

◆ value_

uint32_t HGCSample::value_
private

Definition at line 123 of file HGCSample.h.

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

HGCSample::kModeShift
Definition: HGCSample.h:25
HGCSample::setThreshold
void setThreshold(bool thr)
setters
Definition: HGCSample.h:42
HGCSample::kGainMask
Definition: HGCSample.h:19
HGCSample::raw
uint32_t raw() const
getters
Definition: HGCSample.h:65
HGCSample::setGain
void setGain(uint16_t gain)
Definition: HGCSample.h:44
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
HGCSample::kDataMask
Definition: HGCSample.h:21
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
HGCSample::gain
uint16_t gain() const
Definition: HGCSample.h:68
HGCSample::setToA
void setToA(uint16_t toa)
Definition: HGCSample.h:45
HGCSample::setData
void setData(uint16_t data)
Definition: HGCSample.h:46
HGCSample::kToAValidMask
Definition: HGCSample.h:18
HGCSample::kToGainShift
Definition: HGCSample.h:27
HGCSample::kToAShift
Definition: HGCSample.h:28
HGCSample::kThreshMask
Definition: HGCSample.h:16
HGCSample::kThreshShift
Definition: HGCSample.h:24
value
Definition: value.py:1
HGCSample::toa
uint16_t toa() const
Definition: HGCSample.h:69
HGCSample::kToAMask
Definition: HGCSample.h:20
HGCSample::mode
bool mode() const
Definition: HGCSample.h:67
HGCSample::kDataShift
Definition: HGCSample.h:29
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
HGCSample::value_
uint32_t value_
Definition: HGCSample.h:123
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HGCSample::threshold
bool threshold() const
Definition: HGCSample.h:66
HGCSample::data
uint16_t data() const
Definition: HGCSample.h:70
HGCSample::getWord
uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const
Definition: HGCSample.h:119
HGCSample::setMode
void setMode(bool mode)
Definition: HGCSample.h:43
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCSample::kToAValidShift
Definition: HGCSample.h:26
HGCSample::setWord
void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift)
wrapper to reset words at a given position
Definition: HGCSample.h:108
HGCSample::kModeMask
Definition: HGCSample.h:17