1 |
nikolas |
1.1 |
#include "PamVMCDigRunHeader.h" |
2 |
|
|
|
3 |
|
|
ClassImp(PamVMCDigRunHeader) |
4 |
|
|
#include "CRC.h" |
5 |
|
|
void PamVMCDigRunHeader:: DigitizeRunHeader(){ |
6 |
|
|
|
7 |
|
|
UChar_t buffRH[37]; |
8 |
|
|
|
9 |
|
|
// header: 16 bytes |
10 |
|
|
DigitizePSCU(37,0x20); |
11 |
|
|
|
12 |
|
|
// time stamp (uint32): 0x82569c97 |
13 |
|
|
buffRH[0] = 0x82; //17 |
14 |
|
|
buffRH[1] = 0x56; |
15 |
|
|
buffRH[2] = 0x9C; |
16 |
|
|
buffRH[3] = 0x97; //20 |
17 |
|
|
|
18 |
|
|
// acq_setting_mode (uint8) |
19 |
|
|
buffRH[4] = 0x02; |
20 |
|
|
|
21 |
|
|
// obt (uint32) |
22 |
|
|
ULong64_t obt = fraw->GetOBT() + 30LL; |
23 |
|
|
while ( obt > 4294967295LL ) |
24 |
|
|
obt -= 4294967295LL; |
25 |
|
|
UInt_t Uobt = UInt_t(obt); |
26 |
|
|
fraw->SetOBT(Uobt); |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
buffRH[5] = (UChar_t)(Uobt >> 24); //22 |
30 |
|
|
buffRH[6] = (UChar_t)(Uobt >> 16); |
31 |
|
|
buffRH[7] = (UChar_t)(Uobt >> 8); |
32 |
|
|
buffRH[8] = (UChar_t)Uobt; //25 |
33 |
|
|
|
34 |
|
|
// last time_sync_info (uint32) (from file 000_001_00110) |
35 |
|
|
buffRH[9] = 0x00; //26 |
36 |
|
|
buffRH[10] = 0x08; |
37 |
|
|
buffRH[11] = 0x68; |
38 |
|
|
buffRH[12] = 0xEF; //29 |
39 |
|
|
|
40 |
|
|
// fav. working schedule (uint8) |
41 |
|
|
buffRH[13] = 0x00; |
42 |
|
|
|
43 |
|
|
// eff. working schedule (uint8) |
44 |
|
|
buffRH[14] = 0x00;//0; |
45 |
|
|
|
46 |
|
|
// trigger_mode_A (uint32) |
47 |
|
|
buffRH[15] = 0x00; //32 |
48 |
|
|
buffRH[16] = 0x00; |
49 |
|
|
buffRH[17] = 0x00; |
50 |
|
|
buffRH[18] = 0x01; //35 |
51 |
|
|
|
52 |
|
|
// trigger_mode_B (uint32) |
53 |
|
|
buffRH[19] = 0x00; //36 |
54 |
|
|
buffRH[20] = 0x00; |
55 |
|
|
buffRH[21] = 0x00; |
56 |
|
|
buffRH[22] = 0x03; //39 |
57 |
|
|
|
58 |
|
|
// acq_after_calib (0,1) (uint8) |
59 |
|
|
buffRH[23] = 0x00; |
60 |
|
|
|
61 |
|
|
// trk_calib_used (uint32) |
62 |
|
|
buffRH[24] = 0x00; //41 |
63 |
|
|
buffRH[25] = 0x00; |
64 |
|
|
buffRH[26] = 0x00; |
65 |
|
|
buffRH[27] = 0x68; //44 |
66 |
|
|
|
67 |
|
|
// acq_build_info (4 zero bits + 28 1's) (uint32) |
68 |
|
|
buffRH[28] = 0x3F; //45 |
69 |
|
|
buffRH[29] = 0xFF; |
70 |
|
|
buffRH[30] = 0xFF; |
71 |
|
|
buffRH[31] = 0xFF; //48 |
72 |
|
|
|
73 |
|
|
// acq_var_info (11 bits) (uint16) |
74 |
|
|
buffRH[32] = 0x23; |
75 |
|
|
buffRH[33] = 0x7F; |
76 |
|
|
|
77 |
|
|
// cal_dsp_mask (uint8) |
78 |
|
|
buffRH[34] = 0x00; //51 [50] |
79 |
|
|
// |
80 |
|
|
|
81 |
|
|
|
82 |
|
|
UShort_t crcRH = (UShort_t)CM_Compute_CRC16((UINT16)0, (BYTE*)&buffRH, (UINT32)(35)); |
83 |
|
|
|
84 |
|
|
buffRH[35] = ((UChar_t)(crcRH >> 8)); //52 |
85 |
|
|
buffRH[36] = ((UChar_t)crcRH); //53 [52] |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
for(Int_t i=0; i<37; i++) fDataPSCU.push_back(buffRH[i]); |
89 |
|
|
|
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
void PamVMCDigRunHeader::WriteRunHeader(){ |
94 |
|
|
|
95 |
|
|
fraw->WritePSCU(&fDataPSCU); |
96 |
|
|
} |
97 |
|
|
|