CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGCROCChannelDataFrame< D > Class Template Reference

wrapper for a 32b data word from a single channel and its detid The format is always the same: |1b|1b|10b|10b|10b| The filling depends on the operation mode (normal or characterization) and on the value of the Tc (TOT-complete) and Tp (TOT-in-progress) flags See EDMS CMS-CE-ES-0004 for details More...

#include <HGCROCChannelDataFrame.h>

Public Types

enum  HGCROCChannelDataFrameMask { kFlagMask = 0x1, kPacketMask = 0x3ff }
 
enum  HGCROCChannelDataFrameShift {
  kFlag2Shift = 31, kFlag1Shift = 30, kPacket3Shift = 20, kPacket2Shift = 10,
  kPacket1Shift = 0
}
 
typedef D key_type
 

Public Member Functions

uint16_t adc (bool charMode=false)
 
uint16_t adcm1 (bool charMode=false)
 
uint16_t compressToT (uint16_t totraw)
 the 12-bit TOT is compressed to a 10bit word truncating the first two bits when the value is above 0x1ff=2^8-1. The MSB is set to 1 in case truncation occurs. More...
 
uint16_t decompressToT (uint16_t totraw)
 the 10-bit TOT word is decompressed back to 12 bit word In case truncation occurred the word is shifted by 2 bit More...
 
void fill (bool charMode, bool tc, bool tp, uint16_t adcm1, uint16_t adc, uint16_t tot, uint16_t toa)
 fills the 32b word characterization mode : tc|tp|adc|tot|toa normal mode: tc|tp|adcm1|*|toa with *=tot if tc==True else adc More...
 
void fillFlag1 (bool flag)
 
void fillFlag2 (bool flag)
 setters More...
 
void fillPacket1 (int word)
 
void fillPacket2 (int word)
 
void fillPacket3 (int word)
 
void fillRaw (bool flag2, bool flag1, uint16_t word3, uint16_t word2, uint16_t word1)
 
bool flag1 () const
 
bool flag2 () const
 
 HGCROCChannelDataFrame ()
 CTOR. More...
 
 HGCROCChannelDataFrame (const D &id)
 
 HGCROCChannelDataFrame (uint32_t value)
 
 HGCROCChannelDataFrame (const D &id, uint32_t value)
 
 HGCROCChannelDataFrame (const HGCROCChannelDataFrame &o)
 
const D & id () const
 det id More...
 
uint32_t operator() ()
 getters More...
 
uint16_t packet1 () const
 
uint16_t packet2 () const
 
uint16_t packet3 () const
 
void print (std::ostream &out=std::cout)
 
uint32_t raw ()
 
bool tc ()
 
uint16_t toa ()
 
uint16_t tot (bool charMode=false)
 
bool tp ()
 

Private Member Functions

void fillPacket (uint16_t word, HGCROCChannelDataFrameMask mask, HGCROCChannelDataFrameShift shift)
 wrapper to reset words at a given position More...
 
uint32_t readPacket (HGCROCChannelDataFrameMask mask, HGCROCChannelDataFrameShift shift) const
 wrapper to get packet at a given position More...
 

Private Attributes

id_
 
uint32_t value_
 

Detailed Description

template<class D>
class HGCROCChannelDataFrame< D >

wrapper for a 32b data word from a single channel and its detid The format is always the same: |1b|1b|10b|10b|10b| The filling depends on the operation mode (normal or characterization) and on the value of the Tc (TOT-complete) and Tp (TOT-in-progress) flags See EDMS CMS-CE-ES-0004 for details

Definition at line 18 of file HGCROCChannelDataFrame.h.

Member Typedef Documentation

◆ key_type

template<class D >
typedef D HGCROCChannelDataFrame< D >::key_type

Definition at line 21 of file HGCROCChannelDataFrame.h.

Member Enumeration Documentation

◆ HGCROCChannelDataFrameMask

Enumerator
kFlagMask 
kPacketMask 

Definition at line 23 of file HGCROCChannelDataFrame.h.

◆ HGCROCChannelDataFrameShift

Constructor & Destructor Documentation

◆ HGCROCChannelDataFrame() [1/5]

template<class D >
HGCROCChannelDataFrame< D >::HGCROCChannelDataFrame ( )
inline

CTOR.

Definition at line 36 of file HGCROCChannelDataFrame.h.

◆ HGCROCChannelDataFrame() [2/5]

template<class D >
HGCROCChannelDataFrame< D >::HGCROCChannelDataFrame ( const D &  id)
inline

◆ HGCROCChannelDataFrame() [3/5]

template<class D >
HGCROCChannelDataFrame< D >::HGCROCChannelDataFrame ( uint32_t  value)
inline

◆ HGCROCChannelDataFrame() [4/5]

template<class D >
HGCROCChannelDataFrame< D >::HGCROCChannelDataFrame ( const D &  id,
uint32_t  value 
)
inline

◆ HGCROCChannelDataFrame() [5/5]

template<class D >
HGCROCChannelDataFrame< D >::HGCROCChannelDataFrame ( const HGCROCChannelDataFrame< D > &  o)
inline

Member Function Documentation

◆ adc()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::adc ( bool  charMode = false)
inline

◆ adcm1()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::adcm1 ( bool  charMode = false)
inline

Definition at line 105 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::packet3().

Referenced by HGCROCChannelDataFrame< D >::fill(), and HGCROCChannelDataFrame< D >::print().

105 { return charMode ? 0 : packet3(); }

◆ compressToT()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::compressToT ( uint16_t  totraw)
inline

the 12-bit TOT is compressed to a 10bit word truncating the first two bits when the value is above 0x1ff=2^8-1. The MSB is set to 1 in case truncation occurs.

Definition at line 78 of file HGCROCChannelDataFrame.h.

Referenced by HGCROCChannelDataFrame< D >::fill().

78  {
79  if (totraw > 0x1ff)
80  return (0x200 | (totraw >> 3));
81  return (totraw & 0x1ff);
82  }

◆ decompressToT()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::decompressToT ( uint16_t  totraw)
inline

the 10-bit TOT word is decompressed back to 12 bit word In case truncation occurred the word is shifted by 2 bit

Definition at line 88 of file HGCROCChannelDataFrame.h.

Referenced by HGCROCChannelDataFrame< D >::tot().

88  {
89  uint16_t totout(totraw & 0x1ff);
90  if (totraw & 0x200) {
91  totout = ((totraw & 0x1ff) << 3);
92  totout += (1 << 2);
93  }
94  return totout;
95  }

◆ fill()

template<class D >
void HGCROCChannelDataFrame< D >::fill ( bool  charMode,
bool  tc,
bool  tp,
uint16_t  adcm1,
uint16_t  adc,
uint16_t  tot,
uint16_t  toa 
)
inline

fills the 32b word characterization mode : tc|tp|adc|tot|toa normal mode: tc|tp|adcm1|*|toa with *=tot if tc==True else adc

Definition at line 52 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::adc(), HGCROCChannelDataFrame< D >::adcm1(), HGCROCChannelDataFrame< D >::compressToT(), HGCROCChannelDataFrame< D >::fillRaw(), HGCROCChannelDataFrame< D >::tc(), HGCROCChannelDataFrame< D >::toa(), HGCROCChannelDataFrame< D >::tot(), and HGCROCChannelDataFrame< D >::tp().

52  {
53  uint16_t word3(charMode ? adc : adcm1);
54  uint16_t word2((charMode || tc) ? compressToT(tot) : adc);
55  fillRaw(tc, tp, word3, word2, toa);
56  }
uint16_t adc(bool charMode=false)
uint16_t tot(bool charMode=false)
uint16_t compressToT(uint16_t totraw)
the 12-bit TOT is compressed to a 10bit word truncating the first two bits when the value is above 0x...
uint16_t adcm1(bool charMode=false)
void fillRaw(bool flag2, bool flag1, uint16_t word3, uint16_t word2, uint16_t word1)

◆ fillFlag1()

template<class D >
void HGCROCChannelDataFrame< D >::fillFlag1 ( bool  flag)
inline

◆ fillFlag2()

template<class D >
void HGCROCChannelDataFrame< D >::fillFlag2 ( bool  flag)
inline

◆ fillPacket()

template<class D >
void HGCROCChannelDataFrame< D >::fillPacket ( uint16_t  word,
HGCROCChannelDataFrameMask  mask,
HGCROCChannelDataFrameShift  shift 
)
inlineprivate

wrapper to reset words at a given position

Definition at line 131 of file HGCROCChannelDataFrame.h.

References gpuClustering::pixelStatus::mask, edm::shift, and HGCROCChannelDataFrame< D >::value_.

Referenced by HGCROCChannelDataFrame< D >::fillFlag1(), HGCROCChannelDataFrame< D >::fillFlag2(), HGCROCChannelDataFrame< D >::fillPacket1(), HGCROCChannelDataFrame< D >::fillPacket2(), and HGCROCChannelDataFrame< D >::fillPacket3().

131  {
132  // mask and shift bits
133  const uint32_t masked_word = (word & mask) << shift;
134 
135  //clear to 0 bits which will be set by word
136  value_ &= ~(mask << shift);
137 
138  //now set bits
139  value_ |= (masked_word);
140  }
constexpr uint32_t mask
Definition: gpuClustering.h:26
uint64_t word
static unsigned int const shift

◆ fillPacket1()

template<class D >
void HGCROCChannelDataFrame< D >::fillPacket1 ( int  word)
inline

◆ fillPacket2()

template<class D >
void HGCROCChannelDataFrame< D >::fillPacket2 ( int  word)
inline

◆ fillPacket3()

template<class D >
void HGCROCChannelDataFrame< D >::fillPacket3 ( int  word)
inline

◆ fillRaw()

template<class D >
void HGCROCChannelDataFrame< D >::fillRaw ( bool  flag2,
bool  flag1,
uint16_t  word3,
uint16_t  word2,
uint16_t  word1 
)
inline

◆ flag1()

template<class D >
bool HGCROCChannelDataFrame< D >::flag1 ( ) const
inline

◆ flag2()

template<class D >
bool HGCROCChannelDataFrame< D >::flag2 ( ) const
inline

◆ id()

template<class D >
const D& HGCROCChannelDataFrame< D >::id ( ) const
inline

det id

Definition at line 45 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::id_.

◆ operator()()

template<class D >
uint32_t HGCROCChannelDataFrame< D >::operator() ( )
inline

getters

Definition at line 100 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::value_.

100 { return value_; }

◆ packet1()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::packet1 ( ) const
inline

◆ packet2()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::packet2 ( ) const
inline

◆ packet3()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::packet3 ( ) const
inline

◆ print()

template<class D >
void HGCROCChannelDataFrame< D >::print ( std::ostream &  out = std::cout)
inline

Definition at line 117 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::adc(), HGCROCChannelDataFrame< D >::adcm1(), TauDecayModes::dec, HGCROCChannelDataFrame< D >::flag1(), HGCROCChannelDataFrame< D >::flag2(), MillePedeFileConverter_cfg::out, HGCROCChannelDataFrame< D >::packet1(), HGCROCChannelDataFrame< D >::packet2(), HGCROCChannelDataFrame< D >::packet3(), HGCROCChannelDataFrame< D >::raw(), HGCROCChannelDataFrame< D >::tc(), HGCROCChannelDataFrame< D >::toa(), HGCROCChannelDataFrame< D >::tot(), and HGCROCChannelDataFrame< D >::tp().

117  {
118  out << "Raw=0x" << std::hex << raw() << std::dec << std::endl
119  << "\tf2: " << flag2() << " f1: " << flag1() << " p3: " << packet3() << " p2: " << packet2()
120  << " p1: " << packet1() << std::endl
121  << "\ttc: " << tc() << " tp: " << tp() << " adcm1: " << adcm1() << " (" << adcm1(false) << ") "
122  << " adc: " << adc() << " (" << adc(false) << ") "
123  << " tot: " << tot() << " (" << tot(false) << ") "
124  << " toa: " << toa() << std::endl;
125  }
uint16_t adc(bool charMode=false)
uint16_t tot(bool charMode=false)
uint16_t adcm1(bool charMode=false)

◆ raw()

template<class D >
uint32_t HGCROCChannelDataFrame< D >::raw ( )
inline

◆ readPacket()

template<class D >
uint32_t HGCROCChannelDataFrame< D >::readPacket ( HGCROCChannelDataFrameMask  mask,
HGCROCChannelDataFrameShift  shift 
) const
inlineprivate

◆ tc()

template<class D >
bool HGCROCChannelDataFrame< D >::tc ( )
inline

◆ toa()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::toa ( )
inline

◆ tot()

template<class D >
uint16_t HGCROCChannelDataFrame< D >::tot ( bool  charMode = false)
inline

Definition at line 106 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::decompressToT(), HGCROCChannelDataFrame< D >::packet2(), and HGCROCChannelDataFrame< D >::tc().

Referenced by HGCROCChannelDataFrame< D >::fill(), and HGCROCChannelDataFrame< D >::print().

106  {
107  uint16_t tot12b(decompressToT(packet2()));
108  return charMode || tc() ? tot12b : 0;
109  }
uint16_t decompressToT(uint16_t totraw)
the 10-bit TOT word is decompressed back to 12 bit word In case truncation occurred the word is shift...

◆ tp()

template<class D >
bool HGCROCChannelDataFrame< D >::tp ( )
inline

Member Data Documentation

◆ id_

template<class D >
D HGCROCChannelDataFrame< D >::id_
private

Definition at line 150 of file HGCROCChannelDataFrame.h.

Referenced by HGCROCChannelDataFrame< D >::id().

◆ value_

template<class D >
uint32_t HGCROCChannelDataFrame< D >::value_
private