Belle II Software development
trggdlWriteLocalDB.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/database/DBImportObjPtr.h>
10#include <framework/database/DBObjPtr.h>
11#include <framework/database/DBStore.h>
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/datastore/DataStore.h>
14#include <framework/dataobjects/EventMetaData.h>
15#include <framework/logging/LogSystem.h>
16#include <mdst/dbobjects/TRGGDLDBPrescales.h>
17#include <mdst/dbobjects/TRGGDLDBFTDLBits.h>
18#include <mdst/dbobjects/TRGGDLDBInputBits.h>
19#include <mdst/dbobjects/TRGGDLDBBadrun.h>
20#include <trg/gdl/dbobjects/TRGGDLDBUnpacker.h>
21#include <trg/gdl/dbobjects/TRGGDLDBDelay.h>
22#include <trg/gdl/dbobjects/TRGGDLDBAlgs.h>
23#include <iostream>
24#include <fstream>
25#include <sstream>
26//#include <TFile.h>
27//#include <TH1F.h>
28
29using namespace Belle2;
30
31#define ONLINE 0
32//#define ONLINE 1
33//#define ONLINE 2 //end of exp12 for MC14
34
35
36/* common for setalg, setinputbits, setftdlbits */
37const int N_FTD_VERS = 22;
38const int ftd_run[N_FTD_VERS][4] = { //itnitial exp, initial run, end exp, end run
39 {0, 0, 6, -1}, // 0
40 {7, 0, 7, 2102}, // 1 11
41 {7, 2103, 7, 2367}, // 2 12 +{tsf0b2b,sl0b2b}
42 {7, 2368, 7, 4023}, // 3 13 +{eklm_hit,eklm(4),eklmb2b(3),mu_epair,mu_eb2b,eklmhit}
43 {7, 4024, 8, 1185}, // 4 14 +{fffc,fffc2,ffoc2}
44 {8, 1186, 8, 1285}, // 5 15 +{fffo,fffov}
45 {8, 1286, 8, 1505}, // 6 14 gdl0070p2
46 {8, 1506, 8, 2043}, // 7 15 gdl0070r
47 {8, 2044, 8, 2782}, // 8 16 +{tsf[12]b2b,sl[12]b2b,sl12b2b}
48 {8, 2783, 10, 134}, // 9 17 +{t_a(4),ecl_bst,a,aa,aao,aab,aaao,aaa,eclbst}
49 {10, 135, 10, 2539}, // 10 22 +{ecl_lml_13,ecl_lml_12,injv,hade,vetout}, -ecl_lml_11
50 {10, 2540, 10, 4600}, // 11 23 {t_a,ecl_bst,ecl_3dbha,injv,tsf[12]b2b,ecl_lml_13} moved,
51 {10, 4601, 12, 1659}, // 12 24 o and b for short trk chged to s2[sf][o5]
52 {12, 1660, 12, 1858}, // 13 25 +{bff,bhie}
53 {12, 1859, 13, -1}, // 14 26 trk req removed from mu_pair
54 {14, 0, 14, 637}, // 15 29
55 {14, 638, 14, 1952}, // 16 30
56 {14, 1953, 14, 2040}, // 17 32
57 {14, 2041, 16, 20}, // 18 33
58 {16, 21, 16, 578}, // 19 34
59 {16, 579, 16, 1132}, // 20 35
60 {16, 1133, -1, -1} // 21 36
61};
62const int ftd_version[] = {
63 24, 11, 12, 13, 14, 15, 14, 15, 16, 17, 22, 23, 24, 25, 26, 29, 30, 32, 33, 34, 35, 36
64};
65
66
67//prescale setting
68void setprescale()
69{
70
71 const int N_BITS_RESERVED = 320;
72 const int N_PSNM_ARRAY = 51 + 1; //start from -1
73
74 const int run[N_PSNM_ARRAY][4] = { //itnitial exp, initial run, end exp, end run
75 {0, 0, 2, -1},
76 {3, 0, 3, 107},
77 {3, 108, 3, 295},
78 {3, 296, 3, 1511},
79 {3, 1512, 3, 1810},
80 {3, 1811, 3, 1994},
81 {3, 1995, 3, 2000},
82 {3, 2001, 3, 2313},
83 {3, 2314, 3, 3503},
84 {3, 3504, 3, 5340},
85 {3, 5341, 7, 919},
86 {7, 920, 7, 1371},
87 {7, 1372, 7, 1478},
88 {7, 1479, 7, 3215},
89 {7, 3216, 8, 1201},
90 {8, 1202, 10, 3128}, // fffo:0->1, ftd unchanged.
91 {10, 3129, 10, 3130},
92 {10, 3131, 10, 3436},
93 {10, 3437, 10, 3442},
94 {10, 3443, 10, 3548},
95 {10, 3549, 10, 4608},
96 {10, 4609, 10, 5387},
97 {10, 5388, 10, 5728},
98 {10, 5729, 12, 796},
99 {12, 797, 12, 1742},
100 {12, 1743, 12, 1907},
101 {12, 1908, 12, 2133},
102 {12, 2134, 12, 2334},
103 {12, 2335, 12, 2719},
104 {12, 2720, 12, 6372},
105 {12, 6373, 13, -1},
106 {14, 0, 14, 639},
107 {14, 640, 14, 648},
108 {14, 649, 14, 784},
109 {14, 785, 14, 1751},
110 {14, 1752, 14, 1752},
111 {14, 1753, 14, 1771},
112 {14, 1772, 14, 1772},
113 {14, 1773, 14, 1971},
114 {14, 1972, 14, 1972},
115 {14, 1973, 14, 1992},
116 {14, 1993, 14, 2040},
117 {14, 2041, 14, 2055},
118 {14, 2056, 16, 20},
119 {16, 21, 16, 665},
120 {16, 666, 16, 893},
121 {16, 894, 16, 1060},
122 {16, 1061, 16, 1061},
123 {16, 1062, 18, 65},
124 {18, 66, 18, 282},
125 {18, 283, 18, 780},
126 {18, 781, -1, -1}
127 };
128
129 const int nbit[N_PSNM_ARRAY] = { 0, 18, 44, 63, 63,
130 63, 72, 75, 75, 75,
131 75, 133, 133, 133, 133,
132 142, 160, 160, 160, 160,
133 160, 160, 160, 160, 160,
134 160, 160, 160, 160, 160,
135 160, 192, 192, 192, 192,
136 192, 192, 192, 192, 192,
137 192, 192, 192, 192, 192,
138 192, 192, 192, 192, 192,
139 192, 192
140 };
141
142 const unsigned
143 psnmValues[N_PSNM_ARRAY][N_BITS_RESERVED] = {
144 // -1
145 {
146 0
147 },
148
149 // 0
150 // psn_0055 r59-
151 {
152 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
153 0, 0, 0, 0, 0, 0, 0, 1
154 },
155
156 // 1
157 // psn_0056 r108-
158 {
159 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
160 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
162 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
163 0, 1, 0, 1
164 },
165
166 // 2
167 // psn_0057 r296-
168 {
169 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
170 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
171 1500, 150, 0, 0, 1, 1, 0, 0, 0, 0,
172 0, 0, 0, 30, 0, 0, 20000, 0, 0, 0,
173 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
174 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
175 1, 0, 20
176 },
177
178 // 3
179 // psn_0058 r1512-r1615 ecltiming=1
180 // Not used for good data
181 {
182 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
183 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
184 1500, 150, 0, 0, 1, 1, 0, 1, 0, 0,
185 0, 0, 0, 30, 0, 0, 20000, 0, 0, 0,
186 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
187 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
188 1, 0, 20
189 },
190
191 // 4
192 // psn_0057 r1811- ecltiming=0
193 {
194 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
195 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
196 1500, 150, 0, 0, 1, 1, 0, 0, 0, 0,
197 0, 0, 0, 30, 0, 0, 20000, 0, 0, 0,
198 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
199 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
200 1, 0, 20
201 },
202
203 // 5
204 // psn_0059 r1995- 5 Dark bits
205 {
206 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
207 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
208 1500, 150, 0, 0, 1, 1, 0, 0, 0, 0,
209 0, 0, 0, 30, 0, 0, 20000, 0, 0, 0,
210 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
211 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
212 1, 0, 20, 0, 0, 0, 0, 1, 1, 1,
213 1, 1
214 },
215
216 // 6
217 // psn_0059 r2001- 3 Dark bits
218 {
219 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
220 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
221 1500, 150, 0, 0, 1, 1, 0, 0, 0, 0,
222 0, 0, 0, 30, 0, 0, 20000, 0, 0, 0,
223 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
224 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
225 1, 0, 20, 0, 0, 0, 0, 1, 1, 1,
226 1, 1, 1, 1, 1
227 },
228
229 // 7
230 // psn_0060 r2314- eclnimo03 30->300
231 {
232 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
233 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
234 1500, 150, 0, 0, 1, 1, 0, 0, 0, 0,
235 0, 0, 0, 300, 0, 0, 20000, 0, 0, 0,
236 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
237 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
238 1, 0, 20, 0, 0, 0, 0, 1, 1, 1,
239 1, 1, 1, 1, 1
240 },
241
242 // 8
243 // psn_0063 e3504- bg(26)->1
244 {
245 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
246 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
247 1500, 150, 0, 0, 1, 1, 1, 0, 0, 0,
248 0, 0, 0, 300, 0, 0, 20000, 0, 0, 0,
249 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
250 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
251 1, 0, 20, 0, 0, 0, 0, 1, 1, 1,
252 1, 1, 1, 1, 1
253 },
254
255 // 9
256 // psn_0064=65. e5341- eed,fed,fp,bha3d
257 // Can be earlier than 5341 but
258 // runsum files lost.
259 {
260 0, 0, 1, 1, 0, 0, 1, 1, 1, 0,
261 1, 150, 0, 1, 0, 1, 1, 1, 1, 20,
262 1500, 150, 0, 0, 1, 1, 1, 0, 0, 0,
263 0, 0, 0, 300, 0, 0, 20000, 0, 0, 0,
264 0, 0, 400000, 1, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
266 1, 0, 20, 1, 1, 1, 1, 1, 1, 1,
267 1, 1, 1, 1, 1
268 },
269
270 //10
271 //e7r920
272 {
273 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
274 20, 0, 0, 0, 0, 0, 0, 1, 0, 0,
275 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
276 150, 50, 1, 0, 1, 1, 1, 1, 1, 1,
277 1, 1, 1, 20, 1500, 150, 1, 1, 1, 0,
278 0, 0, 60, 40, 40, 160000, 0, 0, 1, 400,
279 0, 2000, 1, 1, 1, 0, 0, 2000, 0, 0,
280 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
281 1, 1, 1, 1, 1, 1, 1, 1, 1, 700,
282 40, 1, 1, 1, 1, 1, 0, 200, 1, 1,
283 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
284 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
286 0, 0, 0, 0
287 },
288
289 //11
290 //e7r1372
291 {
292 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
293 20, 0, 0, 0, 0, 0, 0, 1, 0, 0,
294 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
295 150, 50, 1, 0, 1, 1, 1, 1, 1, 1,
296 1, 1, 1, 20, 1500, 150, 1, 1, 1, 0,
297 0, 0, 60, 40, 40, 160000, 0, 0, 1, 400,
298 0, 2000, 1, 1, 1, 0, 0, 2000, 0, 0,
299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
301 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
302 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
303 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
305 0, 0, 0, 0
306 },
307
308 //12
309 //e7r1479
310 {
311 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
312 20, 0, 0, 0, 0, 0, 0, 1, 0, 0,
313 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
314 150, 50, 1, 0, 1, 1, 1, 1, 1, 1,
315 1, 1, 1, 20, 1500, 150, 1, 1, 1, 0,
316 0, 0, 60, 40, 40, 160000, 0, 0, 1, 400,
317 0, 2000, 1, 1, 0, 0, 0, 2000, 0, 0,
318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
321 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
324 0, 0, 0, 0
325 },
326
327 //13
328 //e7r3216
329 {
330 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
331 20, 0, 0, 0, 0, 0, 0, 1, 0, 0,
332 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
333 150, 50, 1, 0, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 20, 1500, 150, 1, 1, 1, 0,
335 0, 0, 0, 40, 40, 0, 0, 0, 1, 0,
336 0, 0, 1, 1, 0, 0, 0, 2000, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 0, 0, 1, 1, 0, 0, 3000,
339 150, 1, 1, 0, 0, 0, 0, 0, 0, 0,
340 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
343 0, 0, 0, 0
344 },
345
346 //14
347 //e8r1202
348 {
349 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
350 20, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
421 // e14r1753
422 {1, 100, 0, 100, 0, 0, 0, 1, 0, 0, 200, 0, 400, 0, 0, 0, 0, 1, 1, 100, 0, 1, 1, 1, 10, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 100, 0, 150, 50, 1, 0, 10, 100, 10, 0, 0, 0, 0, 1, 0, 0, 20, 1500, 150, 10, 10, 10, 0, 0, 0, 0, 40, 40, 0, 0, 0, 1, 0, 1, 0, 0, 1, 100, 1, 1, 40, 0, 0, 0, 2000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 3000, 150, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 10, 1, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 5000, 0, 0, 0, 0, 0, 50, 50, 0, 0, 1, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
423 // e14r1772
424 {10, 100, 0, 100, 0, 0, 0, 1, 0, 0, 200, 0, 400, 0, 0, 0, 0, 10, 10, 100, 0, 1, 10, 10, 10, 0, 1, 1, 1, 10, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 100, 0, 150, 50, 1, 0, 10, 100, 10, 0, 0, 0, 0, 10, 0, 0, 20, 1500, 150, 10, 10, 10, 0, 0, 0, 0, 40, 40, 0, 0, 0, 1, 0, 1, 0, 0, 1, 100, 1, 1, 40, 0, 0, 0, 2000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 3000, 150, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
443 // e16r1061
444 {100, 100, 100, 0, 100, 0, 0, 0, 1, 0, 0, 200, 0, 400, 0, 0, 0, 0, 100, 0, 1, 100, 0, 1, 1, 1, 10, 0, 1, 1, 1, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 150, 50, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 20, 1500, 150, 0, 1, 0, 0, 1, 100, 0, 1, 1, 0, 0, 0, 1, 1, 40, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 100, 1, 10, 10, 10, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 20000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
445 // e16r1062
446 {100, 100, 100, 0, 100, 0, 0, 0, 1, 0, 0, 200, 0, 400, 0, 0, 0, 0, 100, 0, 100, 100, 0, 1, 100, 100, 10, 0, 1, 1, 1, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 150, 50, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 20, 1500, 150, 0, 1, 0, 0, 1, 100, 0, 1, 1, 0, 0, 0, 1, 1, 40, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 100, 1, 10, 10, 10, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 20000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
447 // e18r66
448 {100, 100, 100, 0, 100, 0, 0, 0, 1, 0, 0, 2000, 0, 400, 0, 0, 0, 0, 100, 0, 100, 1000, 0, 1, 100, 100, 10, 0, 1, 1, 1, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 100, 0, 150, 50, 1, 0, 100, 100, 10, 0, 0, 0, 0, 1, 0, 0, 0, 1, 20, 1500, 150, 0, 1, 0, 0, 1, 100, 0, 1, 1, 0, 0, 0, 1, 1, 40, 0, 0, 1, 0, 1, 2, 1, 100, 10, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 100, 0, 100, 1, 10, 10, 10, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 20000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
449 // e18r283
450 {100, 100, 100, 0, 100, 1, 0, 0, 1, 0, 0, 2000, 0, 400, 0, 0, 0, 0, 100, 0, 100, 1000, 1, 1, 100, 100, 10, 0, 1, 1, 1, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 100, 0, 150, 50, 1, 0, 100, 100, 10, 0, 0, 0, 0, 1, 0, 0, 0, 1, 20, 1500, 150, 0, 1, 0, 0, 1, 100, 0, 1, 1, 0, 0, 0, 1, 1, 40, 0, 0, 1, 0, 1, 2, 1, 100, 10, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 100, 0, 100, 1, 10, 10, 10, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 20000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
451 // e18r781
452 {100, 100, 100, 0, 100, 1, 0, 0, 1, 0, 0, 2000, 0, 400, 0, 0, 0, 0, 100, 0, 100, 1000, 1, 1, 100, 100, 10, 0, 1, 1, 1, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 100, 0, 150, 50, 1, 0, 100, 100, 10, 0, 0, 0, 0, 1, 0, 0, 0, 1, 20, 1500, 150, 0, 1, 0, 0, 1, 100, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 2, 1, 100, 10, 100, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 100, 0, 100, 1, 10, 10, 10, 0, 0, 0, 0, 40, 40, 3000, 150, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 20000, 4000, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 0, 8000, 0, 0, 0, 0, 8000, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}
453
454 };
455
456
458 prescales.construct();
459 if (ONLINE == 0) {
460 for (int i = 0; i < N_PSNM_ARRAY; i++) {
461 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
462 //initialize
463 for (int j = 0; j < N_BITS_RESERVED; j++) {
464 prescales->setprescales(j, 0);
465 }
466 //set
467 for (int j = 0; j < nbit[i]; j++) {
468 prescales->setprescales(j, psnmValues[i][j]);
469 }
470 prescales->setnoutbit(nbit[i]);
471 prescales.import(iov);
472 }
473 } else if (ONLINE == 1 || ONLINE == 2) {
474 for (int i = N_PSNM_ARRAY - 1; i < N_PSNM_ARRAY; i++) {
475 //for (int i = 0; i < 1; i++) {
476 IntervalOfValidity iov(0, 0, -1, -1);
477 //initialize
478 for (int j = 0; j < N_BITS_RESERVED; j++) {
479 prescales->setprescales(j, 0);
480 }
481 //set
482 for (int j = 0; j < nbit[i]; j++) {
483 prescales->setprescales(j, psnmValues[i][j]);
484 }
485 prescales->setnoutbit(nbit[i]);
486 prescales.import(iov);
487 }
488 }
489
490
491}
492
493
494//input and output bits
495void setftdlbits()
496{
497
498 const int N_BITS_RESERVED = 320;
499//const int nbit[N_OUTPUT_ARRAY] = {
500// 160, 134/*11*/, 135/*12*/, 138/*13*/, 142/*14*/,
501// 144/*15*/, 142/*14*/, 144/*15*/, 147/*16*/, 154/*17*/,
502// 157/*22*/, 160/*23*/, 160/*24*/, 160/*25*/, 160/*26*/
503//};
504
505
507 ftdlbits.construct();
508 if (ONLINE == 0) {
509 for (int i = 0; i < N_FTD_VERS; i++) {
510 IntervalOfValidity iov(ftd_run[i][0], ftd_run[i][1], ftd_run[i][2], ftd_run[i][3]);
511 //initialize
512 for (int j = 0; j < N_BITS_RESERVED; j++) {
513 ftdlbits->setoutbitname(j, "");
514 }
515 //set
516 char logname[2000];
517 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.oup", ftd_version[i]);
518 std::ifstream isinp(logname, std::ios::in);
519 std::string str;
520 int j = 0;
521 if (i == N_FTD_VERS - 1) {
522 printf("i(%d), logname(%s)\n", i, logname);
523 }
524 while (std::getline(isinp, str)) {
525 int bitnum;
526 std::string bitname;
527 std::istringstream strS(str);
528 strS >> bitnum >> bitname;
529 ftdlbits->setoutbitname(j, bitname.data());
530 ++j;
531 if (i == N_FTD_VERS - 1) {
532 printf("i(%d), j(%d), bitname(%s), str(%s)\n",
533 i, j, bitname.c_str(), str.c_str());
534 }
535 }
536 isinp.close();
537 ftdlbits->setnoutbit(j);
538 ftdlbits.import(iov);
539 }
540 } else if (ONLINE == 1 || ONLINE == 2) {
541 for (int i = N_FTD_VERS - 1; i < N_FTD_VERS; i++) {
542 IntervalOfValidity iov(0, 0, -1, -1);
543 //initialize
544 for (int j = 0; j < N_BITS_RESERVED; j++) {
545 ftdlbits->setoutbitname(j, "");
546 }
547 //set
548 char logname[2000];
549 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.oup", ftd_version[i]);
550 std::ifstream isinp(logname, std::ios::in);
551 std::string str;
552 int j = 0;
553 while (std::getline(isinp, str)) {
554 int bitnum;
555 std::string bitname;
556 std::istringstream strS(str);
557 strS >> bitnum >> bitname;
558 ftdlbits->setoutbitname(j, bitname.data());
559 ++j;
560 }
561 isinp.close();
562 ftdlbits->setnoutbit(j);
563 ftdlbits.import(iov);
564 }
565 }
566
567}
568
569void setinputbits()
570{
571
572 const int N_BITS_RESERVED = 320;
573
575 inputbits.construct();
576 if (ONLINE == 0) {
577 for (int i = 0; i < N_FTD_VERS; i++) {
578 IntervalOfValidity iov(ftd_run[i][0], ftd_run[i][1], ftd_run[i][2], ftd_run[i][3]);
579 //initialize
580 for (int j = 0; j < N_BITS_RESERVED; j++) {
581 inputbits->setinbitname(j, "");
582 }
583 //set
584 char logname[2000];
585 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.inp", ftd_version[i]);
586 std::ifstream isinp(logname, std::ios::in);
587 std::string str;
588 int j = 0;
589 while (std::getline(isinp, str)) {
590 int bitnum;
591 std::string bitname;
592 std::istringstream strS(str);
593 strS >> bitnum >> bitname;
594 inputbits->setinbitname(j, bitname.data());
595 ++j;
596 }
597 isinp.close();
598 inputbits->setninbit(j);
599 inputbits.import(iov);
600 }
601 } else if (ONLINE == 1 || ONLINE == 2) {
602 for (int i = N_FTD_VERS - 1; i < N_FTD_VERS; i++) {
603 IntervalOfValidity iov(0, 0, -1, -1);
604 //initialize
605 for (int j = 0; j < N_BITS_RESERVED; j++) {
606 inputbits->setinbitname(j, "");
607 }
608 //set
609 char logname[2000];
610 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.inp", ftd_version[i]);
611 std::ifstream isinp(logname, std::ios::in);
612 std::string str;
613 int j = 0;
614 while (std::getline(isinp, str)) {
615 int bitnum;
616 std::string bitname;
617 std::istringstream strS(str);
618 strS >> bitnum >> bitname;
619 inputbits->setinbitname(j, bitname.data());
620 ++j;
621 }
622 isinp.close();
623 inputbits->setninbit(j);
624 inputbits.import(iov);
625 }
626 }
627
628}
629
630void setunpacker()
631{
632
633 const int N_LEAF = 320;
634 const int N_UNPACKER_ARRAY = 16;
635
636 const int run[N_UNPACKER_ARRAY][4] = { //itnitial exp, initial run, end exp, end run
637 {0, 0, 2, -1}, //-1,[0]
638 {3, 0, 3, 528},
639 {3, 529, 3, 676},
640 {3, 677, 3, 1314},
641 {3, 1315, 3, 1865},
642 {3, 1866, 3, 4790},
643 {3, 4791, 3, 5313},
644 {3, 5314, 4, 6379},
645 {4, 6380, 4, 7433},
646 {4, 7434, 5, 0},
647 {5, 1, 6, -1},
648 {7, 0, 7, 1560},
649 {7, 1561, 7, 2102},
650 {7, 2103, 11, -1},
651 {12, 0, 13, 500},
652 {13, 501, -1, -1} //14,[15]
653 };
654
656 const int nLeafs[N_UNPACKER_ARRAY] = {
657 37, 37, 27, 26, 26,
658 26, 31, 32, 31, 32,
659 31, 31, 30, 27, 27,
660 32
661 };
663 const int nLeafsExtra[N_UNPACKER_ARRAY] = {
664 8, 8, 9, 11, 11,
665 11, 11, 11, 11, 11,
666 11, 11, 13, 14, 16,
667 16
668 };
670 const int nClks[N_UNPACKER_ARRAY] = {
671 48, 48, 48, 48, 48,
672 32, 32, 32, 32, 32,
673 32, 32, 32, 32, 32,
674 32
675 };
677 const int nBits[N_UNPACKER_ARRAY] = {
678 640, 640, 640, 640, 640,
679 640, 640, 640, 640, 640,
680 640, 640, 640, 640, 640,
681 640
682 };
683
685 const int nrows[N_UNPACKER_ARRAY] = {
686 45, 45, 51, 52, 52,
687 52, 57, 61, 61, 61,
688 61, 61, 63, 66, 69,
689 78
690 };
691
692
694 const char LeafNames[N_LEAF][100] = {
695 "etffmv", "l1rvc", "timtype", "etyp", "final",
696 "gdll1rvc", "etfout", "etfvd", "toprvc", "topvd",
697 "toptiming", "ecltiming", "cdctiming", "rvcout", "rvcout0",
698 "comrvc", "etnrvc", "nim0rvc", "eclrvc", "rvc",
699 "drvc", "ftd2", "psn2", "psn1", "etfth2",
700 "etfhdt", "etfth", "psn0", "ftd1", "cdcrvc",
701 "ftd0", "itd2", "itd1", "itd0", "inp2",
702 "inp1", "inp0", "evt", "clk", "firmid",
703 "firmver", "coml1rvc", "b2ldly", "maxrvc", "conf",
704 "dtoprvc", "declrvc", "dcdcrvc", "topslot1", "topslot0",
705 "ntopslot", "finalrvc", "tttmdl", "tdsrcp", "tdtopp",
706 "tdeclp", "tdcdcp", "psn3", "ftd3", "itd4",
707 "itd3", "cnttrg", "cnttrg8", "ftd4", "psn4",
708 "etmdata", "sepagdll1", "sepacoml1", "gdll1rev", // 69
709 // +9 for [15]
710 "ftd5", "psn5", "ttfinal", "sigfinal",
711 "topqua", "eclqua", "cdcqua",
712 "klmcc", "klecc" // 78
713 };
714
715
716
717 const int
718 inputleafMap[N_UNPACKER_ARRAY][N_LEAF] = {
719 {
720 //-1
721 0, 1, 2, 3, 4,
722 5, 6, 7, 8, 9,
723 10, 11, 12, 13, 14,
724 15, 16, 17, 18, 19,
725 20, 21, 22, 23, 24,
726 25, 26, 27, 28, 29,
727 30, 31, 32, 33, 34,
728 35, 36, 37, 38, 39,
729 40, 41, 42, 43, 44
730 },
731
732 {
733 //0
734 0, 1, 2, 3, 4,
735 5, 6, 7, 8, 9,
736 10, 11, 12, 13, 14,
737 15, 16, 17, 18, 19,
738 20, 21, 22, 23, 24,
739 25, 26, 27, 28, 29,
740 30, 31, 32, 33, 34,
741 35, 36, 37, 38, 39,
742 40, 41, 42, 43, 44
743 },
744
745 {
746 //1
747 -1, -1, 1, 2, -1,
748 31, -1, -1, 5, -1,
749 8, 9, 10, 3, -1,
750 -1, -1, 11, 6, 0,
751 4, 21, 15, 16, -1,
752 -1, -1, 17, 22, 7,
753 23, 24, 25, 26, -1,
754 -1, -1, 27, 28, 29,
755 30, 32, 33, 34, 35,
756 12, 13, 14, 18, 19,
757 20
758 },
759
760 {
761 //2
762 -1, -1, 1, 2, -1,
763 32, -1, -1, 4, -1,
764 7, 8, 9, 3, -1,
765 -1, -1, 10, 5, 0,
766 30, 20, 14, 15, -1,
767 -1, -1, 16, 21, 6,
768 22, 23, 24, 25, -1,
769 -1, -1, 26, 27, 28,
770 29, 33, 34, 35, 36,
771 11, 12, 13, 17, 18,
772 19, 31
773 },
774
775 {
776 //3
777 -1, -1, 1, 2, -1,
778 32, -1, -1, 4, -1,
779 7, 8, 9, 3, -1,
780 -1, -1, 10, 5, 0,
781 30, 20, 14, 15, -1,
782 -1, -1, 16, 21, 6,
783 22, 23, 24, 25, -1,
784 -1, -1, 26, 27, 28,
785 29, 33, 34, 35, 36,
786 11, 12, 13, 17, 18,
787 19, 31
788 },
789
790 {
791 //4
792 -1, -1, 1, 2, -1,
793 32, -1, -1, 4, -1,
794 7, 8, 9, 3, -1,
795 -1, -1, 10, 5, 0,
796 30, 20, 14, 15, -1,
797 -1, -1, 16, 21, 6,
798 22, 23, 24, 25, -1,
799 -1, -1, 26, 27, 28,
800 29, 33, 34, 35, 36,
801 11, 12, 13, 17, 18,
802 19, 31
803 },
804
805 {
806 //5
807 -1, -1, 1, 2, -1,
808 37, -1, -1, 9, -1,
809 12, 13, 14, 8, -1,
810 -1, -1, 15, 10, 0,
811 36, 25, 19, 20, -1,
812 -1, -1, 21, 26, 11,
813 27, 28, 29, 30, -1,
814 -1, -1, 31, 32, 33,
815 34, 38, 39, 40, 41,
816 16, 17, 18, 22, 23,
817 24, 35, 3, 4, 5,
818 6, 7
819 },
820
821 {
822 //6
823 -1, -1, 1, 2, -1,
824 38, -1, -1, 9, -1,
825 12, 13, 14, 8, -1,
826 -1, -1, 15, 10, 0,
827 37, 24, 17, 18, -1,
828 -1, -1, 19, 25, 11,
829 26, 29, 30, 31, -1,
830 -1, -1, 32, 33, 34,
831 35, 39, 40, 41, 42,
832 -1, -1, -1, 20, 21,
833 22, 36, 3, 4, 5,
834 6, 7, 16, 23, 27,
835 28
836 },
837
838 {
839 //7
840 -1, -1, 1, 2, -1,
841 37, -1, -1, 9, -1,
842 12, 13, 14, 8, -1,
843 -1, -1, 15, 10, 0,
844 36, 25, 19, 20, -1,
845 -1, -1, 21, 26, 11,
846 27, 28, 29, 30, -1,
847 -1, -1, 31, 32, 33,
848 34, 38, 39, 40, 41,
849 -1, -1, -1, 22, 23,
850 -1, 35, 3, 4, 5,
851 6, 7, 18, 24, 16,
852 17
853 },
854
855 {
856 //8
857 -1, -1, 1, 2, -1,
858 38, -1, -1, 9, -1,
859 12, 13, 14, 8, -1,
860 -1, -1, 15, 10, 0,
861 37, 24, 17, 18, -1,
862 -1, -1, 19, 25, 11,
863 26, 29, 30, 31, -1,
864 -1, -1, 32, 33, 34,
865 35, 39, 40, 41, 42,
866 -1, -1, -1, 20, 21,
867 22, 36, 3, 4, 5,
868 6, 7, 16, 23, 27,
869 28
870 },
871
872 {
873 //9
874 -1, -1, 1, 2, -1,
875 37, -1, -1, 9, -1,
876 12, 13, 14, 8, -1,
877 -1, -1, 15, 10, 0,
878 36, 25, 19, 20, -1,
879 -1, -1, 21, 26, 11,
880 27, 28, 29, 30, -1,
881 -1, -1, 31, 32, 33,
882 34, 38, 39, 40, 41,
883 -1, -1, -1, 22, 23,
884 -1, 35, 3, 4, 5,
885 6, 7, 18, 24, 16,
886 17
887 },
888
889 {
890 //10
891 -1, -1, 1, 2, -1,
892 37, -1, -1, 9, -1,
893 12, 13, 14, 8, -1,
894 -1, -1, 15, 10, 0,
895 36, 25, 19, 20, -1,
896 -1, -1, 21, 26, 11,
897 27, 28, 29, 30, -1,
898 -1, -1, 31, 32, 33,
899 34, 38, 39, 40, 41,
900 -1, -1, -1, 22, 23,
901 -1, 35, 3, 4, 5,
902 6, 7, 18, 24, 16,
903 17
904 },
905
906 {
907 //11
908 -1, -1, 41, -1, -1,
909 36, -1, -1, 8, -1,
910 11, 12, 13, 7, -1,
911 -1, -1, 14, 9, 0,
912 34, 24, 18, 19, -1,
913 -1, -1, 20, 25, 10,
914 26, 27, 28, 29, -1,
915 -1, -1, 30, 31, 32,
916 33, 37, 38, 39, 40,
917 -1, -1, -1, 21, 22,
918 -1, 35, 2, 3, 4,
919 5, 6, 17, 23, 15,
920 16, 42, 1
921 },
922
923 {
924 //12
925 -1, -1, 38, -1, -1,
926 33, -1, -1, -1, -1,
927 7, 8, 9, -1, -1,
928 -1, -1, -1, -1, 0,
929 31, 18, 24, 25, -1,
930 -1, -1, 26, 19, -1,
931 20, 12, 13, 14, -1,
932 -1, -1, 27, 28, 29,
933 30, 34, 35, 36, 37,
934 -1, -1, -1, 15, 21,
935 -1, 32, 2, 3, 4,
936 5, 6, 23, 17, 10,
937 11, 39, 1, 16, 22,
938 40
939 },
940
941 {
942 //13
943 -1, -1, 36, -1, -1,
944 33, -1, -1, -1, -1,
945 7, 8, 9, 42, -1,
946 -1, -1, -1, -1, 0,
947 31, 18, 24, 25, -1,
948 -1, -1, 26, 19, -1,
949 20, 12, 13, 14, -1,
950 -1, -1, 27, 28, 29,
951 30, 34, -1, -1, 35,
952 -1, -1, -1, 15, 21,
953 -1, 32, 2, 3, 4,
954 5, 6, 23, 17, 10,
955 11, 37, 1, 16, 22,
956 38, 39, 40, 41
957 },
958
959 {
960 //14,[15] 32+16
961 -1, -1, 41, -1, -1,
962 38, -1, -1, -1, -1,
963 7, 8, 9, 47, -1,
964 -1, -1, -1, -1, 0,
965 36, 18, 24, 25, -1,
966 -1, -1, 26, 19, -1,
967 20, 12, 13, 14, -1,
968 -1, -1, 32, 33, 34,
969 35, 39, -1, -1, 40,
970 -1, -1, -1, -1, -1,
971 -1, -1, 2, 3, 4,
972 5, 6, 23, 17, 10,
973 11, 42, 1, 16, 22,
974 -1, 44, 45, 46, 15,
975 21, 27, 28, 29, 30,
976 31, 43, 37
977 }
978
979 };
980
982 const int BitMap[N_UNPACKER_ARRAY][N_LEAF][2] = {
983
984 {
985 //-1
986 {639, 31}, // etffmv
987 {575, 10}, // l1rvc
988 {564, 2}, // timtype
989 {561, 2}, // etyp
990 {558, 0}, // final
991 {557, 0}, // gdll1rvc
992 {538, 12}, // etfout
993 {525, 0}, // etfvd
994 {524, 14}, // toprvc
995 {480, 0}, // topvd
996 {498, 17}, // toptiming
997 {479, 13}, // ecltiming (lsb1ns)
998 {465, 12}, // cdctiming (lsb2ns)
999 {447, 14}, // rvcout
1000 {432, 0}, // rvcout0
1001 {431, 11}, // comrvc
1002 {419, 11}, // etnrvc
1003 {407, 11}, // nim0rvc
1004 {395, 11}, // eclrvc
1005 {383, 11}, // rvc
1006 {371, 11}, // drvc
1007 {355, 15}, // ftd2
1008 {339, 15}, // psn2. Empty for 65c.
1009 {323, 15}, // psn1.
1010 {307, 7}, // etfth2
1011 {299, 7}, // etfhdt
1012 {291, 3}, // etfth
1013 {287, 31}, // psn0
1014 {255, 15}, // ftd1
1015 {234, 10}, // cdcrvc
1016 {223, 31}, // ftd0
1017 {191, 31}, // itd2
1018 {159, 31}, // itd1
1019 {127, 31}, // itd0
1020 {95, 31}, // inp2
1021 {63, 31}, // inp1
1022 {31, 31}, // inp0
1023 },
1024
1025
1026 {
1027 //0
1028 {639, 31}, // etffmv
1029 {575, 10}, // l1rvc
1030 {564, 2}, // timtype
1031 {561, 2}, // etyp
1032 {558, 0}, // final
1033 {557, 0}, // gdll1rvc
1034 {538, 12}, // etfout
1035 {525, 0}, // etfvd
1036 {524, 14}, // toprvc
1037 {480, 0}, // topvd
1038 {498, 17}, // toptiming
1039 {479, 13}, // ecltiming (lsb1ns)
1040 {465, 12}, // cdctiming (lsb2ns)
1041 {447, 14}, // rvcout
1042 {432, 0}, // rvcout0
1043 {431, 11}, // comrvc
1044 {419, 11}, // etnrvc
1045 {407, 11}, // nim0rvc
1046 {395, 11}, // eclrvc
1047 {383, 11}, // rvc
1048 {371, 11}, // drvc
1049 {355, 15}, // ftd2
1050 {339, 15}, // psn2. Empty for 65c.
1051 {323, 15}, // psn1.
1052 {307, 7}, // etfth2
1053 {299, 7}, // etfhdt
1054 {291, 3}, // etfth
1055 {287, 31}, // psn0
1056 {255, 15}, // ftd1
1057 {234, 10}, // cdcrvc
1058 {223, 31}, // ftd0
1059 {191, 31}, // itd2
1060 {159, 31}, // itd1
1061 {127, 31}, // itd0
1062 {95, 31}, // inp2
1063 {63, 31}, // inp1
1064 {31, 31}, // inp0
1065 },
1066
1067 {
1068 //1
1069 {623, 11}, // rvc
1070 {611, 2}, // timtype
1071 {608, 2}, // etyp
1072 {583, 14}, // rvcout
1073 {568, 10}, // drvc
1074 {557, 10}, // toprvc
1075 {546, 10}, // eclrvc
1076 {535, 10}, // cdcrvc
1077 {524, 13}, // toptiming
1078 {509, 13}, // ecltiming
1079 {494, 13}, // cdctiming
1080 {479, 10}, // nim0rvc
1081 {468, 11}, // dtoprvc
1082 {457, 11}, // declrvc
1083 {446, 11}, // dcdcrvc
1084 {383, 31}, // psn2
1085 {351, 31}, // psn1
1086 {319, 31}, // psn0
1087 {287, 31}, // topslot1
1088 {255, 31}, // topslot0
1089 {223, 4}, // ntopslot
1090 {191, 31}, // ftd2
1091 {159, 31}, // ftd1
1092 {127, 31}, // ftd0
1093 {95, 31}, // itd2
1094 {63, 31}, // itd1
1095 {31, 31}, // itd0
1096 },
1097
1098 {
1099 //2
1100 {623, 11}, // rvc
1101 {611, 2}, // timtype
1102 {608, 2}, // etyp
1103 {583, 14}, // rvcout
1104 {557, 10}, // toprvc
1105 {546, 10}, // eclrvc
1106 {535, 10}, // cdcrvc
1107 {524, 13}, // toptiming
1108 {509, 13}, // ecltiming
1109 {494, 13}, // cdctiming
1110 {479, 10}, // nim0rvc
1111 {468, 11}, // dtoprvc
1112 {457, 11}, // declrvc
1113 {446, 11}, // dcdcrvc
1114 {383, 31}, // psn2
1115 {351, 31}, // psn1
1116 {319, 31}, // psn0
1117 {287, 31}, // topslot1
1118 {255, 31}, // topslot0
1119 {223, 4}, // ntopslot
1120 {191, 31}, // ftd2
1121 {159, 31}, // ftd1
1122 {127, 31}, // ftd0
1123 {95, 31}, // itd2
1124 {63, 31}, // itd1
1125 {31, 31}, // itd0
1126 },
1127
1128 {
1129 //3
1130 {623, 11}, // rvc
1131 {611, 2}, // timtype
1132 {608, 2}, // etyp
1133 {583, 14}, // rvcout
1134 {557, 10}, // toprvc
1135 {546, 10}, // eclrvc
1136 {535, 10}, // cdcrvc
1137 {524, 13}, // toptiming
1138 {509, 13}, // ecltiming
1139 {494, 13}, // cdctiming
1140 {479, 10}, // nim0rvc
1141 {468, 11}, // dtoprvc
1142 {457, 11}, // declrvc
1143 {446, 11}, // dcdcrvc
1144 {383, 31}, // psn2
1145 {351, 31}, // psn1
1146 {319, 31}, // psn0
1147 {287, 31}, // topslot1
1148 {255, 31}, // topslot0
1149 {223, 4}, // ntopslot
1150 {191, 31}, // ftd2
1151 {159, 31}, // ftd1
1152 {127, 31}, // ftd0
1153 {95, 31}, // itd2
1154 {63, 31}, // itd1
1155 {31, 31}, // itd0
1156 },
1157
1158 {
1159 //4
1160 {623, 11}, // rvc
1161 {611, 2}, // timtype
1162 {608, 2}, // etyp
1163 {583, 14}, // rvcout
1164 {557, 10}, // toprvc
1165 {546, 10}, // eclrvc
1166 {535, 10}, // cdcrvc
1167 {524, 13}, // toptiming
1168 {509, 13}, // ecltiming
1169 {494, 13}, // cdctiming
1170 {479, 10}, // nim0rvc
1171 {468, 11}, // dtoprvc
1172 {457, 11}, // declrvc
1173 {446, 11}, // dcdcrvc
1174 {383, 31}, // psn2
1175 {351, 31}, // psn1
1176 {319, 31}, // psn0
1177 {287, 31}, // topslot1
1178 {255, 31}, // topslot0
1179 {223, 4}, // ntopslot
1180 {191, 31}, // ftd2
1181 {159, 31}, // ftd1
1182 {127, 31}, // ftd0
1183 {95, 31}, // itd2
1184 {63, 31}, // itd1
1185 {31, 31}, // itd0
1186 },
1187
1188 {
1189 //5
1190 {623, 11}, // rvc
1191 {611, 2}, // timtype
1192 {608, 2}, // etyp
1193 {603, 2}, // tttmdl
1194 {600, 3}, // tdsrcp
1195 {596, 2}, // tdtopp
1196 {593, 2}, // tdeclp
1197 {590, 2}, // tdcdcp
1198 {583, 14}, // rvcout
1199 {557, 10}, // toprvc
1200 {546, 10}, // eclrvc
1201 {535, 10}, // cdcrvc
1202 {524, 13}, // toptiming
1203 {509, 13}, // ecltiming
1204 {494, 13}, // cdctiming
1205 {479, 10}, // nim0rvc
1206 {468, 11}, // dtoprvc
1207 {457, 11}, // declrvc
1208 {446, 11}, // dcdcrvc
1209 {383, 31}, // psn2
1210 {351, 31}, // psn1
1211 {319, 31}, // psn0
1212 {287, 31}, // topslot1
1213 {255, 31}, // topslot0
1214 {223, 4}, // ntopslot
1215 {191, 31}, // ftd2
1216 {159, 31}, // ftd1
1217 {127, 31}, // ftd0
1218 {95, 31}, // itd2
1219 {63, 31}, // itd1
1220 {31, 31}, // itd0
1221 },
1222
1223 {
1224 //6
1225 {623, 11}, // rvc
1226 {611, 2}, // timtype
1227 {608, 2}, // etyp
1228 {603, 2}, // tttmdl
1229 {600, 3}, // tdsrcp
1230 {596, 2}, // tdtopp
1231 {593, 2}, // tdeclp
1232 {590, 2}, // tdcdcp
1233 {583, 14}, // rvcout
1234 {557, 10}, // toprvc
1235 {546, 10}, // eclrvc
1236 {535, 10}, // cdcrvc
1237 {524, 13}, // toptiming
1238 {509, 13}, // ecltiming
1239 {494, 13}, // cdctiming
1240 {479, 10}, // nim0rvc
1241 {415, 31}, // psn3
1242 {383, 31}, // psn2
1243 {351, 31}, // psn1
1244 {319, 31}, // psn0
1245 {287, 31}, // topslot1
1246 {255, 31}, // topslot0
1247 {223, 4}, // ntopslot
1248 {218, 26}, // ftd3
1249 {191, 31}, // ftd2
1250 {159, 31}, // ftd1
1251 {127, 31}, // ftd0
1252 {468, 15}, // itd4
1253 {452, 31}, // itd3
1254 {95, 31}, // itd2
1255 {63, 31}, // itd1
1256 {31, 31}, // itd0
1257 },
1258
1259 {
1260 //7
1261 {623, 11}, // rvc
1262 {611, 2}, // timtype
1263 {608, 2}, // etyp
1264 {603, 2}, // tttmdl
1265 {600, 0}, // tdsrcp
1266 {599, 0}, // tdtopp
1267 {598, 0}, // tdeclp
1268 {597, 0}, // tdcdcp
1269 {583, 14}, // rvcout
1270
1271 {557, 10}, // toprvc
1272 {546, 10}, // eclrvc
1273 {535, 10}, // cdcrvc
1274 {524, 13}, // toptiming
1275 {509, 13}, // ecltiming
1276 {494, 13}, // cdctiming
1277 {479, 10}, // nim0rvc
1278 {468, 15}, // itd4
1279 {452, 31}, // itd3
1280 {415, 31}, // psn3
1281 {383, 31}, // psn2
1282 {351, 31}, // psn1
1283 {319, 31}, // psn0
1284
1285 {287, 31}, // topslot1
1286 {255, 31}, // topslot0
1287 {223, 31}, // ftd3
1288 {191, 31}, // ftd2
1289 {159, 31}, // ftd1
1290 {127, 31}, // ftd0
1291 {95, 31}, // itd2
1292 {63, 31}, // itd1
1293 {31, 31}, // itd0
1294 },
1295
1296 {
1297 //8
1298 {623, 11}, // rvc
1299 {611, 2}, // timtype
1300 {608, 2}, // etyp
1301 {603, 2}, // tttmdl
1302 {600, 3}, // tdsrcp
1303 {596, 2}, // tdtopp
1304 {593, 2}, // tdeclp
1305 {590, 2}, // tdcdcp
1306 {583, 14}, // rvcout
1307 {557, 10}, // toprvc
1308 {546, 10}, // eclrvc
1309 {535, 10}, // cdcrvc
1310 {524, 13}, // toptiming
1311 {509, 13}, // ecltiming
1312 {494, 13}, // cdctiming
1313 {479, 10}, // nim0rvc
1314 {415, 31}, // psn3
1315 {383, 31}, // psn2
1316 {351, 31}, // psn1
1317 {319, 31}, // psn0
1318 {287, 31}, // topslot1
1319 {255, 31}, // topslot0
1320 {223, 4}, // ntopslot
1321 {218, 26}, // ftd3
1322 {191, 31}, // ftd2
1323 {159, 31}, // ftd1
1324 {127, 31}, // ftd0
1325 {468, 15}, // itd4
1326 {452, 31}, // itd3
1327 {95, 31}, // itd2
1328 {63, 31}, // itd1
1329 {31, 31}, // itd0
1330 },
1331
1332 {
1333 //9
1334 {623, 11}, // rvc
1335 {611, 2}, // timtype
1336 {608, 2}, // etyp
1337 {603, 2}, // tttmdl
1338 {600, 0}, // tdsrcp
1339 {599, 0}, // tdtopp
1340 {598, 0}, // tdeclp
1341 {597, 0}, // tdcdcp
1342 {583, 14}, // rvcout
1343
1344 {557, 10}, // toprvc
1345 {546, 10}, // eclrvc
1346 {535, 10}, // cdcrvc
1347 {524, 13}, // toptiming
1348 {509, 13}, // ecltiming
1349 {494, 13}, // cdctiming
1350 {479, 10}, // nim0rvc
1351 {468, 15}, // itd4
1352 {452, 31}, // itd3
1353 {415, 31}, // psn3
1354 {383, 31}, // psn2
1355 {351, 31}, // psn1
1356 {319, 31}, // psn0
1357
1358 {287, 31}, // topslot1
1359 {255, 31}, // topslot0
1360 {223, 31}, // ftd3
1361 {191, 31}, // ftd2
1362 {159, 31}, // ftd1
1363 {127, 31}, // ftd0
1364 {95, 31}, // itd2
1365 {63, 31}, // itd1
1366 {31, 31}, // itd0
1367 },
1368
1369 {
1370 //10
1371 {623, 11}, // rvc
1372 {611, 2}, // timtype
1373 {608, 2}, // etyp
1374 {603, 2}, // tttmdl
1375 {600, 0}, // tdsrcp
1376 {599, 0}, // tdtopp
1377 {598, 0}, // tdeclp
1378 {597, 0}, // tdcdcp
1379 {583, 14}, // rvcout
1380
1381 {557, 10}, // toprvc
1382 {546, 10}, // eclrvc
1383 {535, 10}, // cdcrvc
1384 {524, 13}, // toptiming
1385 {509, 13}, // ecltiming
1386 {494, 13}, // cdctiming
1387 {479, 10}, // nim0rvc
1388 {468, 15}, // itd4
1389 {452, 31}, // itd3
1390 {415, 31}, // psn3
1391 {383, 31}, // psn2
1392 {351, 31}, // psn1
1393 {319, 31}, // psn0
1394
1395 {287, 31}, // topslot1
1396 {255, 31}, // topslot0
1397 {223, 31}, // ftd3
1398 {191, 31}, // ftd2
1399 {159, 31}, // ftd1
1400 {127, 31}, // ftd0
1401 {95, 31}, // itd2
1402 {63, 31}, // itd1
1403 {31, 31}, // itd0
1404 },
1405
1406 {
1407 //11
1408 {623, 11}, // rvc
1409 {611, 7}, // cnttrg8
1410 {603, 2}, // tttmdl
1411 {600, 0}, // tdsrcp
1412 {599, 0}, // tdtopp
1413 {598, 0}, // tdeclp
1414 {597, 0}, // tdcdcp
1415 {583, 14}, // rvcout
1416 {557, 10}, // toprvc
1417 {546, 10}, // eclrvc
1418
1419 {535, 10}, // cdcrvc
1420 {524, 13}, // toptiming
1421 {509, 13}, // ecltiming
1422 {494, 13}, // cdctiming
1423 {479, 10}, // nim0rvc
1424 {468, 15}, // itd4
1425 {452, 31}, // itd3
1426 {415, 31}, // psn3
1427 {383, 31}, // psn2
1428 {351, 31}, // psn1
1429
1430 {319, 31}, // psn0
1431 {287, 31}, // topslot1
1432 {255, 31}, // topslot0
1433 {223, 31}, // ftd3
1434 {191, 31}, // ftd2
1435 {159, 31}, // ftd1
1436 {127, 31}, // ftd0
1437 {95, 31}, // itd2
1438 {63, 31}, // itd1
1439 {31, 31}, // itd0
1440 },
1441
1442 {
1443 //12
1444 {623, 11}, // rvc
1445 {611, 15}, // cnttrg8
1446 {595, 2}, // tttmdl
1447 {592, 0}, // tdsrcp
1448 {591, 0}, // tdtopp
1449 {590, 0}, // tdeclp
1450 {589, 0}, // tdcdcp
1451 {588, 13}, // toptiming
1452 {573, 13}, // ecltiming
1453 {558, 13}, // cdctiming
1454
1455 {527, 15}, // itd4
1456 {511, 31}, // itd3
1457 {479, 31}, // itd2
1458 {447, 31}, // itd1
1459 {415, 31}, // itd0
1460 {383, 31}, // topslot1
1461 {351, 31}, // ftd4
1462 {319, 31}, // ftd3
1463 {287, 31}, // ftd2
1464 {255, 31}, // ftd1
1465
1466 {223, 31}, // ftd0
1467 {191, 31}, // topslot0
1468 {159, 31}, // psn4
1469 {127, 31}, // psn3
1470 {95, 31}, // psn2
1471 {63, 31}, // psn1
1472 {31, 31}, // psn0
1473 },
1474
1475 {
1476 //13. same with 12.
1477 {623, 11}, // rvc
1478 {611, 15}, // cnttrg8
1479 {595, 2}, // tttmdl
1480 {592, 0}, // tdsrcp
1481 {591, 0}, // tdtopp
1482 {590, 0}, // tdeclp
1483 {589, 0}, // tdcdcp
1484 {588, 13}, // toptiming
1485 {573, 13}, // ecltiming
1486 {558, 13}, // cdctiming
1487
1488 {543, 31}, // itd4
1489 {511, 31}, // itd3
1490 {479, 31}, // itd2
1491 {447, 31}, // itd1
1492 {415, 31}, // itd0
1493 {383, 31}, // topslot1
1494 {351, 31}, // ftd4
1495 {319, 31}, // ftd3
1496 {287, 31}, // ftd2
1497 {255, 31}, // ftd1
1498
1499 {223, 31}, // ftd0
1500 {191, 31}, // topslot0
1501 {159, 31}, // psn4
1502 {127, 31}, // psn3
1503 {95, 31}, // psn2
1504 {63, 31}, // psn1
1505 {31, 31}, // psn0
1506 },
1507
1508 {
1509 //14. [15].
1510 {622, 10}, // 0 [19] rvc
1511 {611, 15}, // 1 cnttrg8
1512 {379, 3}, // 2 [52] tttmdl
1513 {592, 0}, // 3 tdsrcp
1514 {591, 0}, // 4 tdtopp
1515 {590, 0}, // 5 tdeclp
1516 {589, 0}, // 6 tdcdcp
1517 {588, 13}, // 7 toptiming
1518 {573, 13}, // 8 ecltiming
1519 {558, 13}, // 9 cdctiming
1520 {543, 31}, // 10 itd4
1521 {511, 31}, // 11 itd3
1522 {479, 31}, // 12 itd2
1523 {447, 31}, // 13 itd1
1524 {415, 31}, // 14 itd0
1525 {367, 31}, // 15 [69] ftd5
1526 {351, 31}, // 16 ftd4
1527 {319, 31}, // 17 ftd3
1528 {287, 31}, // 18 ftd2
1529 {255, 31}, // 19 ftd1
1530 {223, 31}, // 20 ftd0
1531 {175, 15}, // 21 [70] psn5
1532 {159, 31}, // 22 psn4
1533 {127, 31}, // 23 psn3
1534 {95, 31}, // 24 psn2
1535 {63, 31}, // 25 psn1
1536 {31, 31}, // 26 psn0
1537 {383, 3}, // 27 [71] ttfinal
1538 {623, 0}, // 28 [72] sigfinal
1539 {375, 1}, // 29 [73] topqua
1540 {373, 1}, // 30 [74] eclqua
1541 {371, 1} // 31 [75] cdcqua
1542 }
1543
1544
1545 };
1546
1547 int m_nword_header[N_UNPACKER_ARRAY] {
1548 3, 3, 4, 6, 6,
1549 6, 6, 6, 6, 6,
1550 6, 6, 6, 6, 6,
1551 6
1552 };
1553 int m_conf[N_UNPACKER_ARRAY] {
1554 0, 0, 1, 2, 3,
1555 4, 5, 6, 7, 6,
1556 7, 7, 8, 9, 10,
1557 11
1558 };
1559 int m_nword_input[N_UNPACKER_ARRAY] {
1560 3, 3, 3, 3, 3,
1561 3, 3, 5, 5, 5,
1562 5, 5, 5, 5, 5,
1563 5
1564 };
1565 int m_nword_output[N_UNPACKER_ARRAY] {
1566 3, 3, 3, 3, 3,
1567 3, 3, 3, 3, 3,
1568 3, 4, 4, 5, 5,
1569 6
1570 };
1571
1572 const int BitMap_extra[N_UNPACKER_ARRAY][N_LEAF][3] = {
1573 {
1574 //-1
1575 {-1, -1, -1}, //evt
1576 {-1, -1, -1}, //clk
1577 { 0, -1, -1}, //firmid
1578 { 1, -1, -1}, //firmver
1579 { 2, 0, 12}, //coml1rvc
1580 { 2, 12, 9}, //b2ldly
1581 { 2, 21, 11}, //maxrvc
1582 {-1, -1, -1} //conf
1583 },
1584
1585
1586 {
1587 //0
1588 {-1, -1, -1}, //evt
1589 {-1, -1, -1}, //clk
1590 { 0, -1, -1}, //firmid
1591 { 1, -1, -1}, //firmver
1592 { 2, 0, 12}, //coml1rvc
1593 { 2, 12, 9}, //b2ldly
1594 { 2, 21, 11}, //maxrvc
1595 {-1, -1, -1} //conf
1596 },
1597
1598 {
1599 //1
1600 {-1, -1, -1}, //evt
1601 {-1, -1, -1}, //clk
1602 { 0, -1, -1}, //firmid
1603 { 1, -1, -1}, //firmver
1604 { 3, 0, 9}, //gdll1rvc
1605 { 3, 1, 12}, //coml1rvc
1606 { 3, 12, 9}, //b2ldly
1607 { 3, 21, 11}, //maxrvc
1608 {-1, -1, -1} //conf
1609 },
1610
1611 {
1612 //2
1613 {-1, -1, -1}, //evt
1614 {-1, -1, -1}, //clk
1615 { 0, -1, -1}, //firmid
1616 { 1, -1, -1}, //firmver
1617 { 3, 11, 11}, //drvc
1618 { 2, 0, 11}, //finalrvc
1619 { 3, 0, 11}, //gdll1rvc
1620 { 5, 0, 12}, //coml1rvc
1621 { 5, 12, 9}, //b2ldly
1622 { 5, 21, 11}, //maxrvc
1623 {-1, -1, -1} //conf
1624 },
1625
1626 {
1627 //3
1628 {-1, -1, -1}, //evt
1629 {-1, -1, -1}, //clk
1630 { 0, -1, -1}, //firmid
1631 { 1, -1, -1}, //firmver
1632 { 3, 11, 11}, //drvc
1633 { 2, 0, 11}, //finalrvc
1634 { 3, 0, 11}, //gdll1rvc
1635 { 5, 0, 12}, //coml1rvc
1636 { 5, 12, 9}, //b2ldly
1637 { 5, 21, 11}, //maxrvc
1638 {-1, -1, -1} //conf
1639 },
1640
1641 {
1642 //4
1643 {-1, -1, -1}, //evt
1644 {-1, -1, -1}, //clk
1645 { 0, -1, -1}, //firmid
1646 { 1, -1, -1}, //firmver
1647 { 3, 11, 11}, //drvc
1648 { 2, 0, 11}, //finalrvc
1649 { 3, 0, 11}, //gdll1rvc
1650 { 5, 0, 12}, //coml1rvc
1651 { 5, 12, 9}, //b2ldly
1652 { 5, 21, 11}, //maxrvc
1653 {-1, -1, -1} //conf
1654 },
1655
1656 {
1657 //5
1658 {-1, -1, -1}, //evt
1659 {-1, -1, -1}, //clk
1660 { 0, -1, -1}, //firmid
1661 { 1, -1, -1}, //firmver
1662 { 3, 11, 11}, //drvc
1663 { 2, 0, 11}, //finalrvc
1664 { 3, 0, 11}, //gdll1rvc
1665 { 5, 0, 12}, //coml1rvc
1666 { 5, 12, 9}, //b2ldly
1667 { 5, 21, 11}, //maxrvc
1668 {-1, -1, -1} //conf
1669 },
1670
1671 {
1672 //6
1673 {-1, -1, -1}, //evt
1674 {-1, -1, -1}, //clk
1675 { 0, -1, -1}, //firmid
1676 { 1, -1, -1}, //firmver
1677 { 3, 11, 11}, //drvc
1678 { 2, 0, 11}, //finalrvc
1679 { 3, 0, 11}, //gdll1rvc
1680 { 5, 0, 12}, //coml1rvc
1681 { 5, 12, 9}, //b2ldly
1682 { 5, 21, 11}, //maxrvc
1683 {-1, -1, -1} //conf
1684 },
1685
1686 {
1687 //7
1688 {-1, -1, -1}, //evt
1689 {-1, -1, -1}, //clk
1690 { 0, -1, -1}, //firmid
1691 { 1, -1, -1}, //firmver
1692 { 3, 11, 11}, //drvc
1693 { 2, 0, 11}, //finalrvc
1694 { 3, 0, 11}, //gdll1rvc
1695 { 5, 0, 12}, //coml1rvc
1696 { 5, 12, 9}, //b2ldly
1697 { 5, 21, 11}, //maxrvc
1698 {-1, -1, -1} //conf
1699 },
1700
1701 {
1702 //8
1703 {-1, -1, -1}, //evt
1704 {-1, -1, -1}, //clk
1705 { 0, -1, -1}, //firmid
1706 { 1, -1, -1}, //firmver
1707 { 3, 11, 11}, //drvc
1708 { 2, 0, 11}, //finalrvc
1709 { 3, 0, 11}, //gdll1rvc
1710 { 5, 0, 12}, //coml1rvc
1711 { 5, 12, 9}, //b2ldly
1712 { 5, 21, 11}, //maxrvc
1713 {-1, -1, -1} //conf
1714 },
1715
1716 {
1717 //9
1718 {-1, -1, -1}, //evt
1719 {-1, -1, -1}, //clk
1720 { 0, -1, -1}, //firmid
1721 { 1, -1, -1}, //firmver
1722 { 3, 11, 11}, //drvc
1723 { 2, 0, 11}, //finalrvc
1724 { 3, 0, 11}, //gdll1rvc
1725 { 5, 0, 12}, //coml1rvc
1726 { 5, 12, 9}, //b2ldly
1727 { 5, 21, 11}, //maxrvc
1728 {-1, -1, -1} //conf
1729 },
1730
1731 {
1732 //10
1733 {-1, -1, -1}, //evt
1734 {-1, -1, -1}, //clk
1735 { 0, -1, -1}, //firmid
1736 { 1, -1, -1}, //firmver
1737 { 3, 11, 11}, //drvc
1738 { 2, 0, 11}, //finalrvc
1739 { 3, 0, 11}, //gdll1rvc
1740 { 5, 0, 12}, //coml1rvc
1741 { 5, 12, 9}, //b2ldly
1742 { 5, 21, 11}, //maxrvc
1743 {-1, -1, -1} //conf
1744 },
1745
1746 {
1747 //11
1748 {-1, -1, -1}, //evt
1749 {-1, -1, -1}, //clk
1750 { 0, -1, -1}, //firmid
1751 { 1, -1, -1}, //firmver
1752 { 3, 11, 11}, //drvc
1753 { 2, 0, 11}, //finalrvc
1754 { 3, 0, 11}, //gdll1rvc
1755 { 5, 0, 12}, //coml1rvc
1756 {-1, -1, -1}, //b2ldly
1757 {-1, -1, -1}, //maxrvc
1758 {-1, -1, -1}, //conf
1759 { 2, 29, 3}, //timtype
1760 { 5, 12, 20} //cnttrg
1761 },
1762
1763 {
1764 //12
1765 {-1, -1, -1}, //evt
1766 {-1, -1, -1}, //clk
1767 { 0, -1, -1}, //firmid
1768 { 1, -1, -1}, //firmver
1769 { 3, 11, 11}, //drvc
1770 { 2, 0, 11}, //finalrvc
1771 { 3, 0, 11}, //gdll1rvc
1772 { 5, 0, 12}, //coml1rvc
1773 {-1, -1, -1}, //b2ldly
1774 {-1, -1, -1}, //maxrvc
1775 {-1, -1, -1}, //conf
1776 { 2, 29, 3}, //timtype
1777 {-1, -1, -1}, //cnttrg
1778 { 4, 11, 11} //etmdata
1779 },
1780
1781 {
1782 //13
1783 {-1, -1, -1}, //evt,27
1784 {-1, -1, -1}, //clk,28
1785 { 0, -1, -1}, //firmid,29
1786 { 1, -1, -1}, //firmver,30
1787 { 3, 11, 11}, //drvc,31
1788 { 2, 0, 11}, //finalrvc,32
1789 { 3, 0, 11}, //gdll1rvc,33
1790 { 5, 0, 12}, //coml1rvc,34
1791 {-1, -1, -1}, //conf,35
1792 { 2, 29, 3}, //timtype,36
1793 { 5, 12, 20}, //cnttrg,37
1794 { 4, 0, 11}, //etmdata,38
1795 { 3, 22, 10}, //sepagdll1,39
1796 { 4, 11, 16}, //sepacoml1,40
1797 { 4, 27, 5}, //gdll1_rev,41
1798 { 2, 14, 15} //rvcout,42
1799 },
1800
1801 {
1802 //14=[15]
1803 //i_wd, downto, width
1804 {-1, -1, -1}, //32, evt
1805 {-1, -1, -1}, //33, clk
1806 { 0, -1, -1}, //34, firmid
1807 { 1, -1, -1}, //35, firmver
1808 { 3, 11, 11}, //36, drvc
1809 { 2, 0, 11}, //37, klecc
1810 { 3, 0, 11}, //38, gdll1rvc
1811 { 5, 0, 12}, //39, coml1rvc
1812 {-1, -1, -1}, //40, conf
1813 { 2, 29, 3}, //41, timtype
1814 { 5, 12, 20}, //42, cnttrg
1815 { 4, 0, 11}, //43, klmcc
1816 { 3, 22, 10}, //44, sepagdll1
1817 { 4, 11, 16}, //45, sepacoml1
1818 { 4, 27, 5}, //46, gdll1_rev
1819 { 2, 12, 17} //47, rvcout
1820 }
1821
1822 };
1823
1824
1826 unpacker.construct();
1827 if (ONLINE == 0) {
1828 for (int i = 0; i < N_UNPACKER_ARRAY; i++) {
1829 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
1830
1831 unpacker->setnLeafs(nLeafs[i]);
1832 unpacker->setnLeafsExtra(nLeafsExtra[i]);
1833 unpacker->setnClks(nClks[i]);
1834 unpacker->setnBits(nBits[i]);
1835 unpacker->set_nword_header(m_nword_header[i]);
1836 unpacker->set_nword_input(m_nword_input[i]);
1837 unpacker->set_nword_output(m_nword_output[i]);
1838 unpacker->setconf(m_conf[i]);
1839
1840 //initialize
1841 for (int j = 0; j < N_LEAF; j++) {
1842 unpacker->setLeafName(j, "");
1843 unpacker->setLeafMap(j, -1);
1844 }
1845 //set
1846 for (int j = 0; j < nrows[i]; j++) {
1847 if ((inputleafMap[i][j] >= 0) && (inputleafMap[i][j] < nLeafs[i] + nLeafsExtra[i])) {
1848 unpacker->setLeafName(j, LeafNames[j]);
1849 unpacker->setLeafMap(j, inputleafMap[i][j]);
1850 }
1851 }
1852
1853 for (int j = 0; j < N_LEAF; j++) {
1854 unpacker->setBitMap(j, 0, BitMap[i][j][0]);
1855 unpacker->setBitMap(j, 1, BitMap[i][j][1]);
1856 }
1857 for (int j = 0; j < N_LEAF; j++) {
1858 unpacker->setBitMap_extra(j, 0, BitMap_extra[i][j][0]);
1859 unpacker->setBitMap_extra(j, 1, BitMap_extra[i][j][1]);
1860 unpacker->setBitMap_extra(j, 2, BitMap_extra[i][j][2]);
1861 }
1862 unpacker.import(iov);
1863 }
1864 } else if (ONLINE == 1) {
1865 for (int i = N_UNPACKER_ARRAY - 1; i < N_UNPACKER_ARRAY; i++) {
1866 IntervalOfValidity iov(0, 0, -1, -1);
1867
1868 unpacker->setnLeafs(nLeafs[i]);
1869 unpacker->setnLeafsExtra(nLeafsExtra[i]);
1870 unpacker->setnClks(nClks[i]);
1871 unpacker->setnBits(nBits[i]);
1872 unpacker->set_nword_header(m_nword_header[i]);
1873 unpacker->set_nword_input(m_nword_input[i]);
1874 unpacker->set_nword_output(m_nword_output[i]);
1875 unpacker->setconf(m_conf[i]);
1876
1877 //initialize
1878 for (int j = 0; j < N_LEAF; j++) {
1879 unpacker->setLeafName(j, "");
1880 unpacker->setLeafMap(j, -1);
1881 }
1882 //set
1883 for (int j = 0; j < nrows[i]; j++) {
1884 if ((inputleafMap[i][j] >= 0) && (inputleafMap[i][j] < nLeafs[i] + nLeafsExtra[i])) {
1885 unpacker->setLeafName(j, LeafNames[j]);
1886 unpacker->setLeafMap(j, inputleafMap[i][j]);
1887 }
1888 }
1889
1890 for (int j = 0; j < N_LEAF; j++) {
1891 unpacker->setBitMap(j, 0, BitMap[i][j][0]);
1892 unpacker->setBitMap(j, 1, BitMap[i][j][1]);
1893 }
1894 for (int j = 0; j < N_LEAF; j++) {
1895 unpacker->setBitMap_extra(j, 0, BitMap_extra[i][j][0]);
1896 unpacker->setBitMap_extra(j, 1, BitMap_extra[i][j][1]);
1897 unpacker->setBitMap_extra(j, 2, BitMap_extra[i][j][2]);
1898 }
1899 unpacker.import(iov);
1900 }
1901 } else if (ONLINE == 2) {
1902 for (int i = 15 - 1; i < 16 - 1; i++) {
1903 IntervalOfValidity iov(0, 0, -1, -1);
1904
1905 unpacker->setnLeafs(nLeafs[i]);
1906 unpacker->setnLeafsExtra(nLeafsExtra[i]);
1907 unpacker->setnClks(nClks[i]);
1908 unpacker->setnBits(nBits[i]);
1909 unpacker->set_nword_header(m_nword_header[i]);
1910 unpacker->set_nword_input(m_nword_input[i]);
1911 unpacker->set_nword_output(m_nword_output[i]);
1912 unpacker->setconf(m_conf[i]);
1913
1914 //initialize
1915 for (int j = 0; j < N_LEAF; j++) {
1916 unpacker->setLeafName(j, "");
1917 unpacker->setLeafMap(j, -1);
1918 }
1919 //set
1920 for (int j = 0; j < nrows[i]; j++) {
1921 if ((inputleafMap[i][j] >= 0) && (inputleafMap[i][j] < nLeafs[i] + nLeafsExtra[i])) {
1922 unpacker->setLeafName(j, LeafNames[j]);
1923 unpacker->setLeafMap(j, inputleafMap[i][j]);
1924 }
1925 }
1926
1927 for (int j = 0; j < N_LEAF; j++) {
1928 unpacker->setBitMap(j, 0, BitMap[i][j][0]);
1929 unpacker->setBitMap(j, 1, BitMap[i][j][1]);
1930 }
1931 for (int j = 0; j < N_LEAF; j++) {
1932 unpacker->setBitMap_extra(j, 0, BitMap_extra[i][j][0]);
1933 unpacker->setBitMap_extra(j, 1, BitMap_extra[i][j][1]);
1934 unpacker->setBitMap_extra(j, 2, BitMap_extra[i][j][2]);
1935 }
1936 unpacker.import(iov);
1937 }
1938 }
1939
1940}
1941
1942void setdelay()
1943{
1944
1945 const int N_DELAY_ARRAY = 32;
1946
1947 const int run[N_DELAY_ARRAY][4] = { //itnitial exp, initial run, end exp, end run
1948 {0, 0, 2, -1},
1949 //0, 0, 3, 63,
1950 //0, 108, 3, 480,
1951 {3, 0, 3, 480},
1952 {3, 529, 3, 816},
1953 {3, 932, 3, 1162},
1954 {3, 1176, 3, 1562},
1955 {3, 1596, 3, 2118},
1956 {3, 2119, 3, 2119},
1957 {3, 2120, 3, 2288},
1958 {3, 2292, 3, 2392},
1959 {3, 2401, 3, 2586},
1960 {3, 2587, 3, 2587},
1961 {3, 2588, 3, 3127},
1962 {3, 3128, 3, 3128},
1963 {3, 3129, 3, 3414},
1964 {3, 3415, 3, 3421},
1965 {3, 3422, 3, 3526},
1966 {3, 3527, 3, 3530},
1967 {3, 3531, 3, 3790},
1968 {3, 3822, 3, 4068},
1969 {3, 4069, 3, 4072},
1970 {3, 4073, 3, 4790},
1971 {3, 4791, 3, 4897},
1972 {3, 4898, 3, 5187},
1973 {3, 5188, 3, 5188},
1974 {3, 5189, 3, 5226},
1975 {3, 5227, 3, 5255},
1976 {3, 5314, 3, 5326},
1977 {3, 5341, 3, 5556},
1978 {3, 5557, 3, 5592},
1979 {3, 5594, 3, 5869},
1980 {3, 5870, 3, 5959},
1981 {3, 5975, -1, -1}
1982 };
1983
1984 const int data_num[N_DELAY_ARRAY] = {
1985 -1,
1986 //29,
1987 //30,
1988 30,
1989 31,
1990 32,
1991 33,
1992 34,
1993 -1,
1994 34,
1995 35,
1996 36,
1997 -1,
1998 36,
1999 -1,
2000 36,
2001 -1,
2002 36,
2003 -1,
2004 36,
2005 37,
2006 -1,
2007 37,
2008 -1,
2009 37,
2010 -1,
2011 37,
2012 38,
2013 -1,
2014 39,
2015 40,
2016 41,
2017 42,
2018 41
2019 };
2020
2021
2023 delay.construct();
2024 char logname[2000];
2025 if (ONLINE == 0) {
2026 for (int i = 0; i < N_DELAY_ARRAY; i++) {
2027 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
2028 for (int j = 0; j < 320; j++) {
2029 delay->setdelay(j, 0);
2030 }
2031 sprintf(logname, "trg/gdl/dbobjects/log/itd_%04d.dat", data_num[i]);
2032 std::ifstream ifs(logname);
2033 if (!ifs) {
2034 std::cout << "No logfile to read delay values" << " " << logname << std::endl;
2035 }
2036 int k = 0;
2037 int delay_temp = 0;
2038 while (ifs >> k >> delay_temp) {
2039 delay->setdelay(k, delay_temp);
2040 }
2041 delay.import(iov);
2042 ifs.close();
2043 }
2044 } else if (ONLINE == 1 || ONLINE == 2) {
2045 //for (int i = N_DELAY_ARRAY-1; i < N_DELAY_ARRAY; i++) {
2046 for (int i = 0; i < 1; i++) {
2047 IntervalOfValidity iov(0, 0, -1, -1);
2048 for (int j = 0; j < 320; j++) {
2049 delay->setdelay(j, 0);
2050 }
2051 sprintf(logname, "trg/gdl/dbobjects/log/itd_%04d.dat", data_num[i]);
2052 std::ifstream ifs(logname);
2053 if (!ifs) {
2054 std::cout << "No logfile to read delay values" << " " << logname << std::endl;
2055 }
2056 int k = 0;
2057 int delay_temp = 0;
2058 while (ifs >> k >> delay_temp) {
2059 delay->setdelay(k, delay_temp);
2060 }
2061 delay.import(iov);
2062 ifs.close();
2063 }
2064 }
2065
2066}
2067
2068void setbadrun()
2069{
2070
2071 const int N_BADRUN_ARRAY = 13;
2072
2073 const int run[N_BADRUN_ARRAY][4] = { //itnitial exp, initial run, end exp, end run
2074 {0, 0, 2, -1}, // 0
2075 {3, 0, 3, 3526}, // 1
2076 {3, 3527, 3, 3623}, //-1
2077 {3, 3624, 3, 3769}, // 1
2078 {3, 3770, 3, 3790}, //-1
2079 {3, 3791, 3, 4877}, // 1
2080 {3, 4878, 3, 5012}, //-1
2081 {3, 5013, 3, 5019}, // 1
2082 {3, 5020, 3, 5246}, //-1
2083 {3, 5247, 3, 5313}, // 1
2084 {3, 5314, 3, 5326}, //-1
2085 {3, 5327, 3, 6000}, // 1
2086 {3, 6001, -1, -1} // 0
2087 };
2088
2089 int flag[N_BADRUN_ARRAY] = {
2090 0, 1, -1, 1, -1,
2091 1, -1, 1, -1, 1,
2092 -1, 1, 0
2093 };
2094
2096 badrun.construct();
2097 if (ONLINE == 0) {
2098 for (int i = 0; i < N_BADRUN_ARRAY; i++) {
2099 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
2100 badrun->setflag(flag[i]);
2101 badrun.import(iov);
2102 }
2103 } else if (ONLINE == 1 || ONLINE == 2) {
2104 for (int i = N_BADRUN_ARRAY - 1; i < N_BADRUN_ARRAY; i++) {
2105 IntervalOfValidity iov(0, 0, -1, -1);
2106 badrun->setflag(flag[i]);
2107 badrun.import(iov);
2108 }
2109 }
2110}
2111
2112
2113void setalg()
2114{
2115
2116 char logname[2000];
2118 db_algs.construct();
2119 if (ONLINE == 0) {
2120 for (int i = 0; i < N_FTD_VERS; i++) {
2121 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.alg", ftd_version[i]);
2122 db_algs->clear();
2123 IntervalOfValidity iov(ftd_run[i][0], ftd_run[i][1], ftd_run[i][2], ftd_run[i][3]);
2124 std::string str;
2125 std::ifstream isload(logname, std::ios::in);
2126 while (std::getline(isload, str)) {
2127 db_algs->setalg(str);
2128 printf("i(%d), run[i][0](%d), run[i][1](%d), run[i][2](%d), run[i][3](%d), getnalgs(%d), str=%s\n",
2129 i, ftd_run[i][0], ftd_run[i][1], ftd_run[i][2], ftd_run[i][3],
2130 db_algs->getnalgs(), str.c_str());
2131 }
2132 isload.close();
2133 db_algs.import(iov);
2134 }
2135 } else if (ONLINE == 1 || ONLINE == 2) {
2136 for (int i = N_FTD_VERS - 1; i < N_FTD_VERS; i++) {
2137 sprintf(logname, "trg/gdl/dbobjects/log/ftd_%04d.alg", ftd_version[i]);
2138 db_algs->clear();
2139 IntervalOfValidity iov(0, 0, -1, -1);
2140 std::string str;
2141 std::ifstream isload(logname, std::ios::in);
2142 while (std::getline(isload, str)) {
2143 db_algs->setalg(str);
2144 printf("i(%d), run[i][0](%d), run[i][1](%d), run[i][2](%d), run[i][3](%d), getnalgs(%d), str=%s\n",
2145 i, ftd_run[i][0], ftd_run[i][1], ftd_run[i][2], ftd_run[i][3],
2146 db_algs->getnalgs(), str.c_str());
2147 }
2148 isload.close();
2149 db_algs.import(iov);
2150 }
2151 }
2152}
2153
2154
2155int main()
2156{
2157
2158 setprescale();
2159 setftdlbits();
2160 setinputbits();
2161 setunpacker();
2162 //setdelay();
2163 setbadrun();
2164 setalg();
2165
2166
2167}
2168
2169
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
virtual void clear()
Clear the content, e.g.
Definition: DBImportBase.cc:58
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
A class that describes the interval of experiments/runs for which an object in the database is valid.
Abstract base class for different kinds of events.