CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Attributes | Private Attributes
GEMVFAT Class Reference

#include <GEMVFAT.h>

Classes

union  VFATfirst
 VFAT data structure - 3 words of 64 bits each. More...
 
union  VFATsecond
 
union  VFATthird
 

Public Member Functions

uint8_t b1010 () const
 v2 More...
 
uint8_t b1100 () const
 
uint8_t b1110 () const
 
uint16_t bc () const
 
uint16_t checkCRC ()
 
uint16_t chipID () const
 
uint16_t crc () const
 
uint16_t crc_cal (uint16_t crc_in, uint16_t dato)
 
uint8_t crcCheck () const
 
uint8_t ec () const
 
uint8_t flag () const
 
 GEMVFAT ()
 
 GEMVFAT (const int vfatVer, const uint16_t BC, const uint32_t EC, const uint16_t chipID, const uint64_t lsDatas, const uint64_t msDatas)
 
uint64_t get_fw () const
 
uint64_t get_sw () const
 
uint64_t get_tw () const
 
uint8_t header () const
 v3 More...
 
uint64_t lsData () const
 
uint64_t msData () const
 
int phi () const
 
uint8_t position () const
 
uint8_t quality ()
 quality flag - bit: 0 good, 1 crc fail, 2 b1010 fail, 3 b1100 fail, 4 b1110 More...
 
void read_fw (uint64_t word)
 Read first word from the block. More...
 
void read_sw (uint64_t word)
 Read second word from the block. More...
 
void read_tw (uint64_t word)
 Read third word from the block. More...
 
void setPhi (int i)
 
void setVersion (int i)
 
bool vc () const
 
int version () const
 
uint16_t vfatId () const
 
 ~GEMVFAT ()
 

Static Public Attributes

static const int nChannels = 128
 
static const int sizeChipID = 12
 

Private Attributes

uint64_t fw_
 phi position of vfat in chamber More...
 
int phiPos_
 vfat version More...
 
uint64_t sw_
 
uint64_t tw_
 
int ver_
 

Detailed Description

Definition at line 5 of file GEMVFAT.h.

Constructor & Destructor Documentation

◆ GEMVFAT() [1/2]

GEMVFAT::GEMVFAT ( )

Definition at line 4 of file GEMVFAT.cc.

4 : ver_(0), phiPos_(0), fw_(0), sw_(0), tw_(0) {}
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
uint64_t sw_
Definition: GEMVFAT.h:124
int ver_
Definition: GEMVFAT.h:120
int phiPos_
vfat version
Definition: GEMVFAT.h:121
uint64_t tw_
Definition: GEMVFAT.h:125

◆ GEMVFAT() [2/2]

GEMVFAT::GEMVFAT ( const int  vfatVer,
const uint16_t  BC,
const uint32_t  EC,
const uint16_t  chipID,
const uint64_t  lsDatas,
const uint64_t  msDatas 
)

Definition at line 6 of file GEMVFAT.cc.

References checkCRC(), chipID(), fw_, sw_, tw_, and ver_.

11  {
12  // this constructor only used for packing sim digis
13  VFATfirst fw{0};
14  VFATsecond sw{0};
15  VFATthird tw{0};
16 
17  fw.header = 0x1E;
18 
19  if (vfatVer == 3) {
20  fw.bc = BC;
21  fw.ec = EC;
22  fw.pos = chipID;
23  } else {
24  fw.chipID = chipID;
25  fw.b1110 = 14;
26  fw.b1100 = 12;
27  fw.b1010 = 10;
28  fw.ecV2 = EC;
29  fw.bcV2 = BC;
30  }
31 
32  sw.lsData1 = lsDatas >> 48;
33  tw.lsData2 = lsDatas & 0x0000ffffffffffff;
34 
35  fw.msData1 = msDatas >> 48;
36  sw.msData2 = msDatas & 0x0000ffffffffffff;
37  ver_ = vfatVer;
38 
39  fw_ = fw.word;
40  sw_ = sw.word;
41  tw_ = tw.word;
42  // checkCRC only works after words are set
43  // checkCRC not yet implemented for v3
44  tw.crc = checkCRC();
45  // once crc is found, save new third word
46  tw_ = tw.word;
47 }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
uint64_t sw_
Definition: GEMVFAT.h:124
int ver_
Definition: GEMVFAT.h:120
uint16_t chipID() const
Definition: GEMVFAT.h:110
uint16_t checkCRC()
Definition: GEMVFAT.cc:85
uint64_t tw_
Definition: GEMVFAT.h:125

◆ ~GEMVFAT()

GEMVFAT::~GEMVFAT ( )
inline

Definition at line 56 of file GEMVFAT.h.

56 {}

Member Function Documentation

◆ b1010()

uint8_t GEMVFAT::b1010 ( ) const
inline

v2

Definition at line 106 of file GEMVFAT.h.

References fw_.

106 { return VFATfirst{fw_}.b1010; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ b1100()

uint8_t GEMVFAT::b1100 ( ) const
inline

Definition at line 107 of file GEMVFAT.h.

References fw_.

107 { return VFATfirst{fw_}.b1100; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ b1110()

uint8_t GEMVFAT::b1110 ( ) const
inline

Definition at line 108 of file GEMVFAT.h.

References fw_.

108 { return VFATfirst{fw_}.b1110; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ bc()

uint16_t GEMVFAT::bc ( ) const
inline

Definition at line 77 of file GEMVFAT.h.

References fw_, and ver_.

Referenced by geometryXMLparser.Alignable::covariance(), and GEMVFATStatus::GEMVFATStatus().

77  {
78  if (ver_ == 2)
79  return VFATfirst{fw_}.bcV2;
80  return VFATfirst{fw_}.bc;
81  }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
int ver_
Definition: GEMVFAT.h:120

◆ checkCRC()

uint16_t GEMVFAT::checkCRC ( )

Definition at line 85 of file GEMVFAT.cc.

References crc_cal(), fw_, mps_fire::i, lsData(), and msData().

Referenced by GEMVFAT(), and quality().

85  {
86  uint16_t vfatBlockWords[12];
87  vfatBlockWords[11] = ((0x000f & VFATfirst{fw_}.b1010) << 12) | VFATfirst{fw_}.bcV2;
88  vfatBlockWords[10] =
89  ((0x000f & VFATfirst{fw_}.b1100) << 12) | ((0x00ff & VFATfirst{fw_}.ecV2) << 4) | (0x000f & VFATfirst{fw_}.flag);
90  vfatBlockWords[9] = ((0x000f & VFATfirst{fw_}.b1110) << 12) | VFATfirst{fw_}.chipID;
91  vfatBlockWords[8] = (0xffff000000000000 & msData()) >> 48;
92  vfatBlockWords[7] = (0x0000ffff00000000 & msData()) >> 32;
93  vfatBlockWords[6] = (0x00000000ffff0000 & msData()) >> 16;
94  vfatBlockWords[5] = (0x000000000000ffff & msData());
95  vfatBlockWords[4] = (0xffff000000000000 & lsData()) >> 48;
96  vfatBlockWords[3] = (0x0000ffff00000000 & lsData()) >> 32;
97  vfatBlockWords[2] = (0x00000000ffff0000 & lsData()) >> 16;
98  vfatBlockWords[1] = (0x000000000000ffff & lsData());
99 
100  uint16_t crc_fin = 0xffff;
101  for (int i = 11; i >= 1; i--) {
102  crc_fin = crc_cal(crc_fin, vfatBlockWords[i]);
103  }
104  return crc_fin;
105 }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
uint16_t crc_cal(uint16_t crc_in, uint16_t dato)
Definition: GEMVFAT.cc:65
uint64_t lsData() const
Definition: GEMVFAT.h:74
uint64_t msData() const
Definition: GEMVFAT.h:75

◆ chipID()

uint16_t GEMVFAT::chipID ( ) const
inline

Definition at line 110 of file GEMVFAT.h.

References fw_.

Referenced by GEMVFAT().

110 { return VFATfirst{fw_}.chipID; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ crc()

uint16_t GEMVFAT::crc ( ) const
inline

Definition at line 111 of file GEMVFAT.h.

References tw_.

111 { return VFATthird{tw_}.crc; }
uint64_t tw_
Definition: GEMVFAT.h:125

◆ crc_cal()

uint16_t GEMVFAT::crc_cal ( uint16_t  crc_in,
uint16_t  dato 
)

Definition at line 65 of file GEMVFAT.cc.

References ztail::d, mps_fire::i, gpuClustering::pixelStatus::mask, and findQualityFiles::v.

Referenced by checkCRC().

65  {
66  uint16_t v = 0x0001;
67  uint16_t mask = 0x0001;
68  uint16_t d = 0x0000;
69  uint16_t crc_temp = crc_in;
70  unsigned char datalen = 16;
71  for (int i = 0; i < datalen; i++) {
72  if (dato & v)
73  d = 0x0001;
74  else
75  d = 0x0000;
76  if ((crc_temp & mask) ^ d)
77  crc_temp = crc_temp >> 1 ^ 0x8408;
78  else
79  crc_temp = crc_temp >> 1;
80  v <<= 1;
81  }
82  return crc_temp;
83 }
constexpr uint32_t mask
Definition: gpuClustering.h:24
d
Definition: ztail.py:151

◆ crcCheck()

uint8_t GEMVFAT::crcCheck ( ) const
inline

Definition at line 103 of file GEMVFAT.h.

References fw_.

103 { return VFATfirst{fw_}.vc; } // to be removed
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ ec()

uint8_t GEMVFAT::ec ( ) const
inline

Definition at line 82 of file GEMVFAT.h.

References fw_, and ver_.

Referenced by GEMVFATStatus::GEMVFATStatus().

82  {
83  if (ver_ == 2)
84  return VFATfirst{fw_}.ecV2;
85  return VFATfirst{fw_}.ec;
86  }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
int ver_
Definition: GEMVFAT.h:120

◆ flag()

uint8_t GEMVFAT::flag ( ) const
inline

Definition at line 109 of file GEMVFAT.h.

References fw_.

109 { return VFATfirst{fw_}.flag; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ get_fw()

uint64_t GEMVFAT::get_fw ( ) const
inline

Definition at line 60 of file GEMVFAT.h.

References fw_.

60 { return fw_; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ get_sw()

uint64_t GEMVFAT::get_sw ( ) const
inline

Definition at line 64 of file GEMVFAT.h.

References sw_.

64 { return sw_; }
uint64_t sw_
Definition: GEMVFAT.h:124

◆ get_tw()

uint64_t GEMVFAT::get_tw ( ) const
inline

Definition at line 68 of file GEMVFAT.h.

References tw_.

68 { return tw_; }
uint64_t tw_
Definition: GEMVFAT.h:125

◆ header()

uint8_t GEMVFAT::header ( ) const
inline

v3

Definition at line 100 of file GEMVFAT.h.

References fw_.

Referenced by GEMVFATStatus::GEMVFATStatus().

100 { return VFATfirst{fw_}.header; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ lsData()

uint64_t GEMVFAT::lsData ( ) const
inline

Definition at line 74 of file GEMVFAT.h.

References sw_, and tw_.

Referenced by checkCRC().

74 { return uint64_t(VFATsecond{sw_}.lsData1) << 48 | VFATthird{tw_}.lsData2; }
uint64_t sw_
Definition: GEMVFAT.h:124
unsigned long long uint64_t
Definition: Time.h:13
uint64_t tw_
Definition: GEMVFAT.h:125

◆ msData()

uint64_t GEMVFAT::msData ( ) const
inline

Definition at line 75 of file GEMVFAT.h.

References fw_, and sw_.

Referenced by checkCRC().

75 { return uint64_t(VFATfirst{fw_}.msData1) << 48 | VFATsecond{sw_}.msData2; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
uint64_t sw_
Definition: GEMVFAT.h:124
unsigned long long uint64_t
Definition: Time.h:13

◆ phi()

int GEMVFAT::phi ( ) const
inline

Definition at line 72 of file GEMVFAT.h.

References phiPos_.

Referenced by Particle.Particle::__str__(), and ntupleDataFormat.Track::phiPull().

72 { return phiPos_; }
int phiPos_
vfat version
Definition: GEMVFAT.h:121

◆ position()

uint8_t GEMVFAT::position ( ) const
inline

Definition at line 102 of file GEMVFAT.h.

References fw_.

102 { return VFATfirst{fw_}.pos; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ quality()

uint8_t GEMVFAT::quality ( )

quality flag - bit: 0 good, 1 crc fail, 2 b1010 fail, 3 b1100 fail, 4 b1110

Definition at line 49 of file GEMVFAT.cc.

References checkCRC(), fw_, submitPVResolutionJobs::q, tw_, and ver_.

49  {
50  uint8_t q = 0;
51  if (ver_ == 2) {
52  if (VFATthird{tw_}.crc != checkCRC())
53  q = 1;
54  if (VFATfirst{fw_}.b1010 != 10)
55  q |= 1UL << 1;
56  if (VFATfirst{fw_}.b1100 != 12)
57  q |= 1UL << 2;
58  if (VFATfirst{fw_}.b1110 != 14)
59  q |= 1UL << 3;
60  }
61  // quality test not yet implemented in v3
62  return q;
63 }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
int ver_
Definition: GEMVFAT.h:120
uint16_t checkCRC()
Definition: GEMVFAT.cc:85
uint64_t tw_
Definition: GEMVFAT.h:125

◆ read_fw()

void GEMVFAT::read_fw ( uint64_t  word)
inline

Read first word from the block.

Definition at line 59 of file GEMVFAT.h.

References fw_.

59 { fw_ = word; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
uint64_t word

◆ read_sw()

void GEMVFAT::read_sw ( uint64_t  word)
inline

Read second word from the block.

Definition at line 63 of file GEMVFAT.h.

References sw_.

63 { sw_ = word; }
uint64_t word
uint64_t sw_
Definition: GEMVFAT.h:124

◆ read_tw()

void GEMVFAT::read_tw ( uint64_t  word)
inline

Read third word from the block.

Definition at line 67 of file GEMVFAT.h.

References tw_.

67 { tw_ = word; }
uint64_t word
uint64_t tw_
Definition: GEMVFAT.h:125

◆ setPhi()

void GEMVFAT::setPhi ( int  i)
inline

Definition at line 71 of file GEMVFAT.h.

References mps_fire::i, and phiPos_.

71 { phiPos_ = i; }
int phiPos_
vfat version
Definition: GEMVFAT.h:121

◆ setVersion()

void GEMVFAT::setVersion ( int  i)
inline

Definition at line 93 of file GEMVFAT.h.

References mps_fire::i, and ver_.

93 { ver_ = i; }
int ver_
Definition: GEMVFAT.h:120

◆ vc()

bool GEMVFAT::vc ( ) const
inline

Definition at line 101 of file GEMVFAT.h.

References fw_.

Referenced by GEMVFATStatus::GEMVFATStatus().

101 { return VFATfirst{fw_}.vc; }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123

◆ version()

int GEMVFAT::version ( ) const
inline

Definition at line 94 of file GEMVFAT.h.

References ver_.

Referenced by validation.Sample::datasetpattern(), validation.Sample::filename(), and GEMVFATStatus::GEMVFATStatus().

94 { return ver_; }
int ver_
Definition: GEMVFAT.h:120

◆ vfatId()

uint16_t GEMVFAT::vfatId ( ) const
inline

Definition at line 87 of file GEMVFAT.h.

References fw_, and ver_.

Referenced by GEMVFATStatus::GEMVFATStatus().

87  {
88  if (ver_ == 2)
89  return VFATfirst{fw_}.chipID;
90  return VFATfirst{fw_}.pos;
91  }
uint64_t fw_
phi position of vfat in chamber
Definition: GEMVFAT.h:123
int ver_
Definition: GEMVFAT.h:120

Member Data Documentation

◆ fw_

uint64_t GEMVFAT::fw_
private

phi position of vfat in chamber

Definition at line 123 of file GEMVFAT.h.

Referenced by b1010(), b1100(), b1110(), bc(), checkCRC(), chipID(), crcCheck(), ec(), flag(), GEMVFAT(), get_fw(), header(), msData(), position(), quality(), read_fw(), vc(), and vfatId().

◆ nChannels

const int GEMVFAT::nChannels = 128
static

Definition at line 116 of file GEMVFAT.h.

Referenced by GEMRawToDigiModule::produce().

◆ phiPos_

int GEMVFAT::phiPos_
private

vfat version

Definition at line 121 of file GEMVFAT.h.

Referenced by phi(), and setPhi().

◆ sizeChipID

const int GEMVFAT::sizeChipID = 12
static

Definition at line 117 of file GEMVFAT.h.

◆ sw_

uint64_t GEMVFAT::sw_
private

Definition at line 124 of file GEMVFAT.h.

Referenced by GEMVFAT(), get_sw(), lsData(), msData(), and read_sw().

◆ tw_

uint64_t GEMVFAT::tw_
private

Definition at line 125 of file GEMVFAT.h.

Referenced by crc(), GEMVFAT(), get_tw(), lsData(), quality(), and read_tw().

◆ ver_

int GEMVFAT::ver_
private

Definition at line 120 of file GEMVFAT.h.

Referenced by bc(), ec(), GEMVFAT(), quality(), setVersion(), version(), and vfatId().