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

Constructor & Destructor Documentation

VFATdata::VFATdata ( )

Definition at line 5 of file VFATdata.cc.

References ver_.

5  {
6  ver_ = 1;
7 }
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 9 of file VFATdata.cc.

References gem::VFATfirst::b1010, gem::VFATfirst::b1100, gem::VFATfirst::b1110, gem::VFATfirst::bc, gem::VFATfirst::bcV2, checkCRC(), gem::VFATfirst::chipID, chipID(), gem::VFATthird::crc, gem::VFATfirst::ec, gem::VFATfirst::ecV2, fw_, gem::VFATfirst::header, gem::VFATsecond::lsData1, gem::VFATthird::lsData2, gem::VFATfirst::msData1, gem::VFATsecond::msData2, gem::VFATfirst::pos, sw_, tw_, ver_, gem::VFATfirst::word, gem::VFATsecond::word, and gem::VFATthird::word.

15 {
16  // this constructor only used for packing sim digis
17  VFATfirst fw;
18  VFATsecond sw;
19  VFATthird tw;
20 
21  fw.word = 0;
22  sw.word = 0;
23  tw.word = 0;
24  fw.header = 0x1E;
25 
26  if (vfatVer == 3) {
27  fw.bc = BC;
28  fw.ec = EC;
29  fw.pos = chipID;
30  }
31  else {
32  fw.chipID = chipID;
33  fw.b1110 = 14;
34  fw.b1100 = 12;
35  fw.b1010 = 10;
36  fw.ecV2 = EC;
37  fw.bcV2 = BC;
38  }
39 
40  sw.lsData1 = lsDatas >> 48;
41  tw.lsData2 = lsDatas & 0x0000ffffffffffff;
42 
43  fw.msData1 = msDatas >> 48;
44  sw.msData2 = msDatas & 0x0000ffffffffffff;
45  ver_ = vfatVer;
46 
47  fw_ = fw.word;
48  sw_ = sw.word;
49  tw_ = tw.word;
50  // checkCRC only works after words are set
51  // checkCRC not yet implemented for v3
52  tw.crc = checkCRC();
53  // once crc is found, save new third word
54  tw_ = tw.word;
55 }
uint64_t ec
Event Counter, 8 bits.
Definition: VFATdata.h:14
uint64_t bcV2
Bunch Crossing number, 12 bits.
Definition: VFATdata.h:27
uint64_t ecV2
Event Counter, 8 bits.
Definition: VFATdata.h:25
uint64_t tw_
Definition: VFATdata.h:127
uint64_t msData2
channels from 65to128
Definition: VFATdata.h:35
uint64_t crc
Check Sum value, 16 bits.
Definition: VFATdata.h:41
uint64_t word
Definition: VFATdata.h:9
uint64_t word
Definition: VFATdata.h:39
uint64_t lsData2
channels from 1to64
Definition: VFATdata.h:42
uint64_t sw_
Definition: VFATdata.h:126
uint64_t msData1
channels from 65to128
Definition: VFATdata.h:12
uint64_t word
Definition: VFATdata.h:32
uint64_t b1110
1110:4 Control bits, shoud be 1110
Definition: VFATdata.h:23
uint16_t chipID() const
Definition: VFATdata.h:112
uint64_t lsData1
channels from 1to64
Definition: VFATdata.h:34
uint64_t bc
Bunch Crossing number, 16 bits.
Definition: VFATdata.h:13
uint64_t pos
an 8bit value indicating the VFAT position on this GEB (it can be 0 to 23)
Definition: VFATdata.h:17
uint16_t checkCRC()
Definition: VFATdata.cc:86
uint64_t b1010
1010:4 Control bits, shoud be 1010
Definition: VFATdata.h:28
uint64_t chipID
Chip ID, 12 bits.
Definition: VFATdata.h:22
uint64_t header
normally 0x1E. 0x5E indicates that the VFAT3 internal buffer is half-full, so it&#39;s like a warning ...
Definition: VFATdata.h:15
VFAT data structure - 3 words of 64 bits each.
Definition: VFATdata.h:8
uint64_t b1100
1100:4, Control bits, shoud be 1100
Definition: VFATdata.h:26
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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 108 of file VFATdata.h.

References gem::VFATfirst::b1010.

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

Definition at line 109 of file VFATdata.h.

References gem::VFATfirst::b1100.

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

Definition at line 110 of file VFATdata.h.

References gem::VFATfirst::b1110.

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

Definition at line 83 of file VFATdata.h.

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

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

83  {
84  if (ver_==2) return VFATfirst{fw_}.bcV2;
85  return VFATfirst{fw_}.bc;
86  }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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().

87 {
88  uint16_t vfatBlockWords[12];
89  vfatBlockWords[11] = ((0x000f & VFATfirst{fw_}.b1010)<<12) | VFATfirst{fw_}.bcV2;
90  vfatBlockWords[10] = ((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:79
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:69
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
uint16_t gem::VFATdata::chipID ( ) const
inline

Definition at line 112 of file VFATdata.h.

References gem::VFATfirst::chipID.

Referenced by VFATdata().

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

Definition at line 113 of file VFATdata.h.

References gem::VFATthird::crc.

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

Definition at line 69 of file VFATdata.cc.

References edmIntegrityCheck::d, mps_fire::i, RecoTauDiscriminantConfiguration::mask, and findQualityFiles::v.

Referenced by checkCRC().

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

Definition at line 104 of file VFATdata.h.

References gem::VFATfirst::crcCheck.

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

Definition at line 87 of file VFATdata.h.

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

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

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

Definition at line 111 of file VFATdata.h.

References gem::VFATfirst::flag.

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

111 { return VFATfirst{fw_}.flag; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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:125
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:126
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:127
uint8_t gem::VFATdata::header ( void  ) const
inline

v3

Definition at line 103 of file VFATdata.h.

References gem::VFATfirst::header.

103 {return VFATfirst{fw_}.header; }
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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  {
77  return uint64_t(VFATsecond{sw_}.lsData1) << 48 | VFATthird{tw_}.lsData2;
78  }
uint64_t tw_
Definition: VFATdata.h:127
uint64_t sw_
Definition: VFATdata.h:126
unsigned long long uint64_t
Definition: Time.h:15
uint64_t gem::VFATdata::msData ( ) const
inline

Definition at line 79 of file VFATdata.h.

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

Referenced by checkCRC().

79  {
80  return uint64_t(VFATfirst{fw_}.msData1) << 48 | VFATsecond{sw_}.msData2;
81  }
uint64_t sw_
Definition: VFATdata.h:126
unsigned long long uint64_t
Definition: Time.h:15
uint64_t fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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:123
uint8_t gem::VFATdata::position ( ) const
inline

Definition at line 105 of file VFATdata.h.

References gem::VFATfirst::pos.

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

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

Definition at line 57 of file VFATdata.cc.

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

Referenced by GEMVfatStatusDigi::GEMVfatStatusDigi().

57  {
58  uint8_t q = 0;
59  if (ver_ == 2) {
60  if (VFATthird{tw_}.crc != checkCRC()) q = 1;
61  if (VFATfirst{fw_}.b1010 != 10) q |= 1UL << 1;
62  if (VFATfirst{fw_}.b1100 != 12) q |= 1UL << 2;
63  if (VFATfirst{fw_}.b1110 != 14) q |= 1UL << 3;
64  }
65  // quality test not yet implemented in v3
66  return q;
67 }
uint64_t tw_
Definition: VFATdata.h:127
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:125
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 fw_
phi position of vfat in chamber
Definition: VFATdata.h:125
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 sw_
Definition: VFATdata.h:126
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:127
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:123
void gem::VFATdata::setVersion ( int  i)
inline

Definition at line 96 of file VFATdata.h.

References mps_fire::i.

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

Definition at line 97 of file VFATdata.h.

References jets_cff::quality.

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

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

Definition at line 91 of file VFATdata.h.

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

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

Member Data Documentation

uint64_t gem::VFATdata::fw_
private

phi position of vfat in chamber

Definition at line 125 of file VFATdata.h.

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

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

Definition at line 118 of file VFATdata.h.

int gem::VFATdata::phiPos_
private

vfat version

Definition at line 123 of file VFATdata.h.

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

Definition at line 119 of file VFATdata.h.

uint64_t gem::VFATdata::sw_
private

Definition at line 126 of file VFATdata.h.

Referenced by VFATdata().

uint64_t gem::VFATdata::tw_
private

Definition at line 127 of file VFATdata.h.

Referenced by quality(), and VFATdata().

int gem::VFATdata::ver_
private

Definition at line 122 of file VFATdata.h.

Referenced by quality(), and VFATdata().