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) const
 
uint16_t adcm1 (bool charMode=false) const
 
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) const
 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() () const
 getters More...
 
HGCROCChannelDataFrameoperator= (const HGCROCChannelDataFrame &)=default
 
uint16_t packet1 () const
 
uint16_t packet2 () const
 
uint16_t packet3 () const
 
void print (std::ostream &out=std::cout) const
 
uint32_t raw () const
 
uint16_t rawtot (bool charMode=false) const
 
bool tc () const
 
uint16_t tctp () const
 
uint16_t toa () const
 
uint16_t tot (bool charMode=false) const
 
bool tp () const
 

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) const
inline

◆ adcm1()

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

Definition at line 107 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::packet3().

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

107 { 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 79 of file HGCROCChannelDataFrame.h.

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

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

◆ decompressToT()

template<class D>
uint16_t HGCROCChannelDataFrame< D >::decompressToT ( uint16_t  totraw) const
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 89 of file HGCROCChannelDataFrame.h.

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

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

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

53  {
54  uint16_t word3(charMode ? adc : adcm1);
55  uint16_t word2((charMode || tc) ? compressToT(tot) : adc);
56  fillRaw(tc, tp, word3, word2, toa);
57  }
uint16_t adcm1(bool charMode=false) const
uint16_t adc(bool charMode=false) const
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...
void fillRaw(bool flag2, bool flag1, uint16_t word3, uint16_t word2, uint16_t word1)
uint16_t tot(bool charMode=false) const

◆ 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 134 of file HGCROCChannelDataFrame.h.

References ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::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().

134  {
135  // mask and shift bits
136  const uint32_t masked_word = (word & mask) << shift;
137 
138  //clear to 0 bits which will be set by word
139  value_ &= ~(mask << shift);
140 
141  //now set bits
142  value_ |= (masked_word);
143  }
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 46 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::id_.

◆ operator()()

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

getters

Definition at line 101 of file HGCROCChannelDataFrame.h.

References HGCROCChannelDataFrame< D >::value_.

101 { return value_; }

◆ operator=()

template<class D>
HGCROCChannelDataFrame& HGCROCChannelDataFrame< D >::operator= ( const HGCROCChannelDataFrame< D > &  )
default

◆ 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) const
inline

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

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

◆ raw()

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

◆ rawtot()

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

Definition at line 112 of file HGCROCChannelDataFrame.h.

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

112 { return charMode || tc() ? packet2() : 0; }

◆ readPacket()

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

◆ tc()

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

◆ tctp()

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

Definition at line 105 of file HGCROCChannelDataFrame.h.

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

105 { return (tc() << 1) | tp(); }

◆ toa()

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

◆ tot()

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

Definition at line 108 of file HGCROCChannelDataFrame.h.

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

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

108  {
109  uint16_t tot12b(decompressToT(packet2()));
110  return charMode || tc() ? tot12b : 0;
111  }
uint16_t decompressToT(uint16_t totraw) const
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 ( ) const
inline

Member Data Documentation

◆ id_

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

Definition at line 153 of file HGCROCChannelDataFrame.h.

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

◆ value_

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