CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
gem::VFATdata Class Reference

#include <VFATdata.h>

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
 
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)
 
int version () const
 
 VFATdata ()
 
 VFATdata (const int vfatVer, const uint16_t BC, const uint8_t EC, const uint16_t chipID, const uint64_t lsDatas, const uint64_t msDatas)
 
uint16_t vfatId () const
 
 ~VFATdata ()
 

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 48 of file VFATdata.h.

Constructor & Destructor Documentation

VFATdata::VFATdata ( )

Definition at line 5 of file VFATdata.cc.

5 : ver_(0), phiPos_(0), fw_(0), sw_(0), tw_(0) {}
uint64_t tw_
Definition: VFATdata.h:126
uint64_t sw_
Definition: VFATdata.h:125
int phiPos_
vfat version
Definition: VFATdata.h:122
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
VFATdata::VFATdata ( const int  vfatVer,
const uint16_t  BC,
const uint8_t  EC,
const uint16_t  chipID,
const uint64_t  lsDatas,
const uint64_t  msDatas 
)

Definition at line 7 of file VFATdata.cc.

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

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

Definition at line 58 of file VFATdata.h.

58 {}

Member Function Documentation

uint8_t gem::VFATdata::b1010 ( ) const
inline

v2

Definition at line 107 of file VFATdata.h.

References gem::VFATfirst::b1010.

107 { return VFATfirst{fw_}.b1010; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint8_t gem::VFATdata::b1100 ( ) const
inline

Definition at line 108 of file VFATdata.h.

References gem::VFATfirst::b1100.

108 { return VFATfirst{fw_}.b1100; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint8_t gem::VFATdata::b1110 ( ) const
inline

Definition at line 109 of file VFATdata.h.

References gem::VFATfirst::b1110.

109 { return VFATfirst{fw_}.b1110; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint16_t gem::VFATdata::bc ( ) const
inline

Definition at line 79 of file VFATdata.h.

References gem::VFATfirst::bc, and gem::VFATfirst::bcV2.

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

79  {
80  if (ver_ == 2)
81  return VFATfirst{fw_}.bcV2;
82  return VFATfirst{fw_}.bc;
83  }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint16_t VFATdata::checkCRC ( )

Definition at line 86 of file VFATdata.cc.

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

Referenced by quality(), and VFATdata().

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

Definition at line 111 of file VFATdata.h.

References gem::VFATfirst::chipID.

Referenced by VFATdata().

111 { return VFATfirst{fw_}.chipID; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint16_t gem::VFATdata::crc ( void  ) const
inline

Definition at line 112 of file VFATdata.h.

References gem::VFATthird::crc.

112 { return VFATthird{tw_}.crc; }
uint64_t tw_
Definition: VFATdata.h:126
uint16_t VFATdata::crc_cal ( uint16_t  crc_in,
uint16_t  dato 
)

Definition at line 66 of file VFATdata.cc.

References ztail::d, mps_fire::i, and findQualityFiles::v.

Referenced by checkCRC().

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

Definition at line 103 of file VFATdata.h.

References gem::VFATfirst::vc.

103 { return VFATfirst{fw_}.vc; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint8_t gem::VFATdata::ec ( ) const
inline

Definition at line 84 of file VFATdata.h.

References gem::VFATfirst::ec, and gem::VFATfirst::ecV2.

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

84  {
85  if (ver_ == 2)
86  return VFATfirst{fw_}.ecV2;
87  return VFATfirst{fw_}.ec;
88  }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint8_t gem::VFATdata::flag ( void  ) const
inline

Definition at line 110 of file VFATdata.h.

References gem::VFATfirst::flag.

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

110 { return VFATfirst{fw_}.flag; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint64_t gem::VFATdata::get_fw ( ) const
inline

Definition at line 62 of file VFATdata.h.

62 { return fw_; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint64_t gem::VFATdata::get_sw ( ) const
inline

Definition at line 66 of file VFATdata.h.

66 { return sw_; }
uint64_t sw_
Definition: VFATdata.h:125
uint64_t gem::VFATdata::get_tw ( ) const
inline

Definition at line 70 of file VFATdata.h.

70 { return tw_; }
uint64_t tw_
Definition: VFATdata.h:126
uint8_t gem::VFATdata::header ( void  ) const
inline

v3

Definition at line 102 of file VFATdata.h.

References gem::VFATfirst::header.

102 { return VFATfirst{fw_}.header; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint64_t gem::VFATdata::lsData ( ) const
inline

Definition at line 76 of file VFATdata.h.

References gem::VFATsecond::lsData1, and gem::VFATthird::lsData2.

Referenced by checkCRC().

76 { return uint64_t(VFATsecond{sw_}.lsData1) << 48 | VFATthird{tw_}.lsData2; }
uint64_t tw_
Definition: VFATdata.h:126
uint64_t sw_
Definition: VFATdata.h:125
unsigned long long uint64_t
Definition: Time.h:13
uint64_t gem::VFATdata::msData ( ) const
inline

Definition at line 77 of file VFATdata.h.

References gem::VFATfirst::msData1, and gem::VFATsecond::msData2.

Referenced by checkCRC().

77 { return uint64_t(VFATfirst{fw_}.msData1) << 48 | VFATsecond{sw_}.msData2; }
uint64_t sw_
Definition: VFATdata.h:125
unsigned long long uint64_t
Definition: Time.h:13
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
int gem::VFATdata::phi ( void  ) const
inline

Definition at line 74 of file VFATdata.h.

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

74 { return phiPos_; }
int phiPos_
vfat version
Definition: VFATdata.h:122
uint8_t gem::VFATdata::position ( ) const
inline

Definition at line 104 of file VFATdata.h.

References gem::VFATfirst::pos.

104 { return VFATfirst{fw_}.pos; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
uint8_t VFATdata::quality ( void  )

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

Definition at line 50 of file VFATdata.cc.

References checkCRC(), fw_, data-class-funcs::q, tw_, and ver_.

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

50  {
51  uint8_t q = 0;
52  if (ver_ == 2) {
53  if (VFATthird{tw_}.crc != checkCRC())
54  q = 1;
55  if (VFATfirst{fw_}.b1010 != 10)
56  q |= 1UL << 1;
57  if (VFATfirst{fw_}.b1100 != 12)
58  q |= 1UL << 2;
59  if (VFATfirst{fw_}.b1110 != 14)
60  q |= 1UL << 3;
61  }
62  // quality test not yet implemented in v3
63  return q;
64 }
uint64_t tw_
Definition: VFATdata.h:126
uint16_t checkCRC()
Definition: VFATdata.cc:86
VFAT data structure - 3 words of 64 bits each.
Definition: VFATdata.h:8
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
void gem::VFATdata::read_fw ( uint64_t  word)
inline

Read first word from the block.

Definition at line 61 of file VFATdata.h.

References gem::VFATfirst::word.

61 { fw_ = word; }
uint64_t word
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124
void gem::VFATdata::read_sw ( uint64_t  word)
inline

Read second word from the block.

Definition at line 65 of file VFATdata.h.

References gem::VFATfirst::word.

65 { sw_ = word; }
uint64_t word
uint64_t sw_
Definition: VFATdata.h:125
void gem::VFATdata::read_tw ( uint64_t  word)
inline

Read third word from the block.

Definition at line 69 of file VFATdata.h.

References gem::VFATfirst::word.

69 { tw_ = word; }
uint64_t tw_
Definition: VFATdata.h:126
uint64_t word
void gem::VFATdata::setPhi ( int  i)
inline

Definition at line 73 of file VFATdata.h.

References mps_fire::i.

73 { phiPos_ = i; }
int phiPos_
vfat version
Definition: VFATdata.h:122
void gem::VFATdata::setVersion ( int  i)
inline

Definition at line 95 of file VFATdata.h.

References mps_fire::i.

95 { ver_ = i; }
int gem::VFATdata::version ( ) const
inline

Definition at line 96 of file VFATdata.h.

References qcdUeDQM_cfi::quality.

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

96 { return ver_; }
uint16_t gem::VFATdata::vfatId ( ) const
inline

Definition at line 89 of file VFATdata.h.

References gem::VFATfirst::chipID, and gem::VFATfirst::pos.

89  {
90  if (ver_ == 2)
91  return VFATfirst{fw_}.chipID;
92  return VFATfirst{fw_}.pos;
93  }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:124

Member Data Documentation

uint64_t gem::VFATdata::fw_
private

phi position of vfat in chamber

Definition at line 124 of file VFATdata.h.

Referenced by checkCRC(), quality(), and VFATdata().

const int gem::VFATdata::nChannels = 128
static

Definition at line 117 of file VFATdata.h.

int gem::VFATdata::phiPos_
private

vfat version

Definition at line 122 of file VFATdata.h.

const int gem::VFATdata::sizeChipID = 12
static

Definition at line 118 of file VFATdata.h.

uint64_t gem::VFATdata::sw_
private

Definition at line 125 of file VFATdata.h.

Referenced by VFATdata().

uint64_t gem::VFATdata::tw_
private

Definition at line 126 of file VFATdata.h.

Referenced by quality(), and VFATdata().

int gem::VFATdata::ver_
private

Definition at line 121 of file VFATdata.h.

Referenced by quality(), and VFATdata().