11 #include "qt32b_fms_2009_a.hh"
14 void qt32b_fms_2009_a(
Board& qt,
int t){
20 for (
int dcard = 0; dcard < 4; ++dcard) {
22 for (
int dch = 7; dch >= 0; --dch) {
24 int adc = qt.channels[t][id];
26 if(adc > 0xfff) {printf(
"ADC above 4k %d\n",adc); adc = 0x4f;}
27 else {adc = getbits(adc,5,7);}
36 sum = getbits(sum,5,5);
38 qt.output[t] |= sum << (dcard*5);
41 qt.output[t] |= htadc << 20;
42 qt.output[t] |= htid << 27;
45 printf(
"%s %08x sum=%3d %3d %3d %3d ht=%3d htid=%3d\n",
47 getbits(qt.output[t],0 ,5),
48 getbits(qt.output[t],5 ,5),
49 getbits(qt.output[t],10,5),
50 getbits(qt.output[t],15,5),
54 void getQtDaughterSum(
int qtout,
int* sum)
56 sum[0] = getbits(qtout,0 ,5);
57 sum[1] = getbits(qtout,5 ,5);
58 sum[2] = getbits(qtout,10,5);
59 sum[3] = getbits(qtout,15,5);
62 int getQtHighTowerAdc(
int qtout){
63 return getbits(qtout,20,7);
66 int getQtHighTowerId(
int qtout){
67 return getbits(qtout,27,5);
70 void getQtSumAndHighTower(
int* channels,
int* A,
int* B,
int* C,
int* D,
int& htadc,
int& htid){
71 getQtDaughterSum(channels[3],A);
72 getQtDaughterSum(channels[2],B);
73 getQtDaughterSum(channels[1],C);
74 getQtDaughterSum(channels[0],D);
78 transform(channels,channels+4,adc,getQtHighTowerAdc);
79 transform(channels,channels+4,
id ,getQtHighTowerId );
81 int idx = max_element(adc,adc+4) - adc;
87 void getQtSumAndHighTower(
int* channels,
int* I,
int* J,
int& htadc,
int& htid)
89 getQtDaughterSum(channels[1],I);
90 getQtDaughterSum(channels[0],J);
94 transform(channels,channels+2,adc,getQtHighTowerAdc);
95 transform(channels,channels+2,
id ,getQtHighTowerId );
97 int idx = max_element(adc,adc+2) - adc;