2024-01-27 00:57:57 -05:00
|
|
|
#ifndef ClassDet_h
|
|
|
|
#define ClassDet_h
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
#define MAXMULTI 1000
|
|
|
|
|
|
|
|
class Det{
|
|
|
|
public:
|
|
|
|
Det(): multi(0) {Clear(); }
|
|
|
|
|
|
|
|
unsigned short multi; // max 65535
|
|
|
|
unsigned short id[MAXMULTI];
|
|
|
|
unsigned short ch[MAXMULTI];
|
|
|
|
unsigned short e[MAXMULTI];
|
|
|
|
unsigned long long t[MAXMULTI];
|
2024-10-25 15:02:59 -04:00
|
|
|
unsigned long long tf[MAXMULTI];
|
2024-03-22 18:45:13 -04:00
|
|
|
unsigned short sn[MAXMULTI];
|
|
|
|
unsigned short digiCh[MAXMULTI];
|
|
|
|
|
2024-01-31 15:24:03 -05:00
|
|
|
unsigned short index[MAXMULTI]; // id * nCh + ch;
|
2024-01-29 19:10:12 -05:00
|
|
|
bool used[MAXMULTI];
|
2024-01-27 01:22:37 -05:00
|
|
|
|
2024-01-27 00:57:57 -05:00
|
|
|
void Clear(){
|
|
|
|
multi = 0;
|
|
|
|
for( int i = 0; i < MAXMULTI; i++){
|
|
|
|
id[i] = 0;
|
|
|
|
ch[i] = 0;
|
|
|
|
e[i] = 0;
|
|
|
|
t[i] = 0;
|
2024-10-25 15:02:59 -04:00
|
|
|
tf[i] = 0;
|
2024-01-27 01:22:37 -05:00
|
|
|
index[i] = 0;
|
2024-03-22 18:45:13 -04:00
|
|
|
sn[i] = 0;
|
|
|
|
digiCh[i] = 0;
|
2024-01-29 19:10:12 -05:00
|
|
|
used[i] = false;
|
2024-01-27 00:57:57 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Print(){
|
|
|
|
printf("=============================== multi : %u\n", multi);
|
|
|
|
for( int i = 0; i < multi; i++) {
|
2024-01-27 01:22:37 -05:00
|
|
|
printf(" %3d | %2d-%-2d(%5d) %5u %15llu \n", i, id[i], ch[i], index[i], e[i], t[i]);
|
2024-01-27 00:57:57 -05:00
|
|
|
}
|
|
|
|
}
|
2024-01-27 01:22:37 -05:00
|
|
|
|
|
|
|
void SetDetDimension(unsigned short maxID, unsigned maxCh){
|
|
|
|
nID = maxID;
|
|
|
|
nCh = maxCh;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CalIndex(){
|
|
|
|
for( int i = 0; i < multi; i++){
|
|
|
|
index[i] = id[i] * nCh + ch[i] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
unsigned short nID;
|
|
|
|
unsigned short nCh;
|
|
|
|
|
2024-01-27 00:57:57 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-01-31 15:24:03 -05:00
|
|
|
#endif
|