forked from psi46/psi46test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixelmap.h
114 lines (90 loc) · 3.36 KB
/
pixelmap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// pixelmap.h
#ifndef PIXELMAP_H
#define PIXELMAP_H
// #include "grlog.h"
#include "scanner.h"
#include "protocol.h"
struct CParser;
/*
bits
0..3 unmasked pixel readout count
4..7 masked pixel readout count
8 trimbit 0 defect (LSB)
9 trimbit 1 defect
10 trimbit 2 defect
11 trimbit 3 defect (MSB)
12 wrong column address code
13 wrong pixel address code
*/
#define ROCNUMROWS 80
#define ROCNUMCOLS 52
class CPixelMap
{
public:
bool mapExist;
bool pulseHeightExist;
bool pulseHeight1Exist;
bool pulseHeight2Exist;
bool levelExist;
private:
unsigned int map[ROCNUMCOLS][ROCNUMROWS];
short pulseHeight[ROCNUMCOLS][ROCNUMROWS];
short pulseHeight1[ROCNUMCOLS][ROCNUMROWS];
short pulseHeight2[ROCNUMCOLS][ROCNUMROWS];
unsigned char refLevel[ROCNUMCOLS][ROCNUMROWS];
unsigned char level[ROCNUMCOLS][ROCNUMROWS][4];
bool IsInRange(unsigned int x, unsigned int y)
{ return x<ROCNUMCOLS && y<ROCNUMROWS; }
bool Hex(char **s, unsigned int &value);
bool Dec(char **s, unsigned char &value);
public:
CPixelMap() { Init(); }
void Init();
// data set methods
void SetMaskedCount(unsigned int x, unsigned int y, unsigned int count);
void SetUnmaskedCount(unsigned int x, unsigned int y, unsigned int count);
void SetDefectTrimBit(unsigned int x, unsigned int y,
unsigned int bit, bool defect);
void SetDefectColCode(unsigned int x, unsigned int y, bool defect);
void SetDefectRowCode(unsigned int x, unsigned int y, bool defect);
void SetPulseHeight(unsigned int x, unsigned int y, short value);
void SetPulseHeight1(unsigned int x, unsigned int y, short value);
void SetPulseHeight2(unsigned int x, unsigned int y, short value);
void SetRefLevel(unsigned int x, unsigned int y, unsigned char value);
void SetLevel(unsigned int x, unsigned int y,
unsigned char bit, unsigned char value);
// data get methods
unsigned int GetMaskedCount(unsigned int x, unsigned int y);
unsigned int GetUnmaskedCount(unsigned int x, unsigned int y);
bool GetDefectReadoutCnts(unsigned int x, unsigned int y);
bool GetDefectTrimBit(unsigned int x, unsigned int y, unsigned int bit);
bool GetDefectTrimBit(unsigned int x, unsigned int y);
bool GetDefectColCode(unsigned int x, unsigned int y);
bool GetDefectRowCode(unsigned int x, unsigned int y);
bool GetDefectAddrCode(unsigned int x, unsigned int y);
short GetPulseHeight(unsigned int x, unsigned int y);
short GetPulseHeight1(unsigned int x, unsigned int y);
short GetPulseHeight2(unsigned int x, unsigned int y);
unsigned char GetRefLevel(unsigned int x, unsigned int y)
{ return refLevel[x][y]; }
unsigned char GetLevel(unsigned int x, unsigned int y, unsigned int bit)
{ return level[x][y][bit]; }
void UpdateTrimDefects();
bool IsDefect(unsigned int x, unsigned int y);
unsigned int DefectPixelCount();
bool ReadPixMap(CScanner &Log);
bool ReadPulseHeight(CScanner &Log);
bool ReadPulseHeight1(CScanner &Log);
bool ReadPulseHeight2(CScanner &Log);
bool ReadRefLevel(CScanner &Log);
bool ReadLevel(CScanner &Log, unsigned int trimbit);
// void Histo(CHistogram &h);
// void HistoDiff(unsigned int trimbit, CHistogram &h);
void Print(CProtocol &prot);
void PrintPulseHeight(CProtocol &prot);
void PrintPulseHeight1(CProtocol &prot);
void PrintPulseHeight2(CProtocol &prot);
void PrintRefLevel(CProtocol &prot);
void PrintLevel(unsigned int trimbit, CProtocol &prot);
};
#endif