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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
|
/*! \page page0 Configuration Data Management
(Author of this document is Anders Ryd
and the original can found in the DocDB as
document number <a href="https://docdb.fnal.gov/CMS-private/DocDB/ShowDocument?docid=1672">1672</a>).
This document describes a C++ interface
for configuration data management and the
different classes that are used to store this
information.
The idea behind this organization should be
explained here. For now I just add a pointer
to a presentation I gave at a pixel software
meeting that contains the ideas:
<pre>
http://indico.cern.ch/conferenceDisplay.py?confId=8768
</pre>
The following arguments are treated in this document:
<ul>
<li> \ref page1
<li> \ref page2
<li> \ref page3
<li> \ref page4
</ul>
__________________________________________________________________________________
\page page1 1- Configuration Database Interface
Since early summer 2006 we have used an interface for accessing
configuration data in the online software framework.
The access is currently file based. The
interface used is rather generic and the purpose of this document
is to write down the interface so that we can have a
clear separation between the database code and the applications
that use data from the configuration database.
First in Sect.~\\ref{sect:cppinterface} we describe the C++ API.
The interface is defined in the class PixelConfigInterface.
This interface is fully implemented in the PixelConfigFile
implementation based on files.
In Sect. xx a simple command line tool is described.
This tool is implemented through the C++ interface and should work
both for the file based and the final data base implementation.
Examples below use a few of the configuration data classes
that are used. In Sect. yy the full
set of classes that are used to configure and control the pixel
online software are discussed.
\section page1Sect1 C++ Configuration Data Access API
The class PixelConfigInterface in the package
PixelConfigDBInterface defines the interface for
access of configuration data. This interface is intended
to provide type safe access methods for retrieving and
storing configuration data.
\subsection page1Sect1Sub1 Retrieving data from the database
The primary method for retrieving the data is
<pre>
template <class T>
static void get(T* &pixelObject,
std::string path,
pos::PixelConfigKey key)
</pre>
The PixelConfigKey is just an integer that holds the top
level configuration key to be used.
This interface returns a pointer to the data. The caller is assumed
to take ownership of the data and delete it.
The path is a 'secondary key'. It would allow us to store more than
one object of the same type in a given configuration. (In the file
based implementation this label is used to build the path to were the
file is stored.)
Below are a few example of using this interface.
<pre>
PixelConfigKey theGlobalKey(5);
PixelNameTranslation *theNameTranslation=0;
PixelConfigInterface::get(theNameTranslation, "nametranslation/",
theGlobalKey);
PixelDetectorConfig *theDetectorConfiguration=0;
PixelConfigInterface::get(theDetectorConfiguration, "detconfig/",
theGlobalKey);
PixelFECConfig *theFECConfiguration=0;
PixelConfigInterface::get(theFECConfiguration, "fecconfig/",
theGlobalKey);
</pre>
These examples show how you extract objects for which there is only one
instance of for the
whole detector configuration. You pass in as the first argument a pointer. The
pointer will return 0 if the object was not successfully retrieved. The
second argument is the label for the object. This is essentially a key that
is used to look up the data. The interface is type safe, i.e., if you specify
a path to an object of the wrong type you will get back a null pointer. The
third argument is the global configuration key. This basically specifies
the versions of all objects used in a given configuration. This key is
implemented as an integer.
Besides objects like the name translation and detector configuration listed
above, there are objects such as trim bits, mask bits, and dac values
that we need
to access on a finer granularity than for the whole detector. To do this
we use slightly modified arguments
<pre>
PixelDACSettings *tempDACs=0;
PixelConfigInterface::get(tempDACs,''pixel/dac/FPix_BpI_D1_BLD1_PNL1'',
theGlobalKey);
</pre>
where we have added to the path the module name for which we want to
extract the
dac settings.
As a given application, for example the PixelFECSupervisor, will need to access
dac settings for many modules, and it is more efficient to extract
the data 'in bulk' from the database, we have also added an interface
that allows extraction of multiple objects at the time
<pre>
std::map<std::string, PixelDACSettings*> dacs;
dacs["pixel/dac/FPix_BpI_D1_BLD1_PNL1"]=0;
dacs["pixel/dac/FPix_BpI_D1_BLD1_PNL2"]=0;
PixelConfigInterface::get(dacs, theGlobalKey);
</pre>
The method will add pointers to the modules; if a module is not
in the configuration a null pointer is returned.
In addition to the access method that uses the configuration key,
you can also retrieve data based on the specific version of the
object
<pre>
template <class T>
static void get(T* &pixelObject,
std::string path,
unsigned int version)
</pre>
There is also a version that retrieves all the objects
<pre>
template <class T>
static void get(std::map<std::string, T*> &pixelObjects,
unsigned int version)
</pre>
In general the access based on the configuration key should be used
in the xdaq applications.
\subsection page1Sect1Sub2 Storing data in the database
To store data in the configuration database use the following
method
<pre>
template <class T>
int PixelConfigInterface::put(const T* ,std::string path);
</pre>
This method will install the data in T* using the specified path.
The new version number is returned by the method.
If you instead have a set of configuration data that needs to be
installed you use the interface
<pre>
template <class T>
int PixelConfigInterface::put(std::vector<T*>,
std::string path);
</pre>
Where a vector of pairs is passed, the second argument in the
pair is the sub path used for the object.
\subsection page1Sect1Sub3 Configuration keys
A configuration key consists of a set of objects and their versions.
The simplest form is just to specify a list of the paths and the
versions to use in the key
<pre>
static unsigned int makeKey(std::vector<
std::pair<std::string, unsigned int> > versions)
</pre>
The method returns the new configuration key.
\subsection page1Sect1Sub4 Alias manipulation
For configurations aliases you can retrieve the list of defined
aliases using
<pre>
static std::vector<std::pair<std::string, unsigned int> > getAliases()
</pre>
The string is the name of the alias and the unsigned int is the
corresponding key. <i>I think it should actually be a PixelConfigKey.</i>
A very similar method is
<pre>
static std::map<std::string, unsigned int> getAliases_map()
</pre>
That returns a map between the alias name and the corresponding key.
The method
<pre>
static void addAlias(std::string alias, unsigned int key)
</pre>
inserts a new alias. Note that if the alias already exists it will
just be updated to point to the new key.
The method below is a lower level method. This method
allows you to define an alias to a version that has key
already created and link it to version aliases. This method
should eventually be removed as it is probably to error prone...
<pre>
static void addAlias(std::string alias,
unsigned int key,
std::vector<std::pair<std::string, std::string> > versionaliases)
</pre>
To create an alias for a configuration object use the method.
<pre>
static void addVersionAlias(std::string path,
unsigned int version,
std::string alias)
</pre>
To add an alias for a configuration object, as supposed to a
configuration key, use
<pre>
static void addVersionAlias(std::string path,
unsigned int version,
std::string alias)
</pre>
To get the actual version that an alias points to use the method
<pre>
static unsigned int getVersion(std::string path,
std::string alias)
</pre>
\subsection page1Sect1Sub5 Support of polymorphism
The interface should support polymorphism in the sense described
below. For example, for trim bits it may be convenient to have ways of
storing the trim bits in different ways. We will need to be able
to store trim bits so that we can set them independently for
each pixel. But there are other cases where we might want to set
all trim bits the same on a whole ROC, or the same in each
double column.
Consider that we have a base class, PixelTrimBase and that there
are the concrete implementations PixelTrimAll, PixelTrimROC,
and PixelTrimDCol which implements the per pixel, per roc, and
per double column respectively. The interface should support
operations like
<pre>
PixelTrimBase *tempTrims=0;
PixelConfigInterface::get(tempTrims,"pixel/trim/FPix_BpI_D1_BLD1_PNL1",
theGlobalKey);
</pre>
where after tempTrims points to the data type stored in the
database for the configuration.
Similarly you should be able to store data
<pre>
PixelTrimBase *tempTrims=new PixelTrimROC; //probably would not compile as
//we don't have this constructor.
unsigned int ver=PixelConfigInterface::put(tempTrims,"pixel/trim/FPix_BpI_D1_BLD1_PNL1");
</pre>
\section page1Sect2 Command line interface to configuration data
Based on the interface described above in the C++ interface a simple
command line tool has been written to allow manipulation of configuration
data. The functionality of this interface is described below.
\subsection page1Sect2Sub1 Inserting new data
Here we will start be discussing how you insert a
PixelDetectorConfig object. There is
only one such object in the configuration. Assuming that we
have this in a file named <tt><b>detconfig.dat</b></tt>. We now want to
insert this into the configuration database. This is done with
<pre>
PixelConfigDBCmd.exe --insertData detconfig detectconfig.dat
</pre>
This would install the content of the file <tt><b>detconfig.dat</b></tt>
under the path <tt><b>detconfig</b></tt> by creating a new version.
This new version is returned by the command so that it is known
where it was installed. The implementation of this tool
reads the file to create a PixelDetectorConfig object and
then uses the C++ interface to store the data.
As a variation of this you might want to install, e.g., a new set of
DAC settings for the ROCs. As we insist that no data can be
changed in the configuration database after it has been loaded
this implies that the DAC settings for all ROCs needs to be
loaded at once. To insert that prepare the files that contains the
ROC dac settings. Then create the file daclist.txt that list all
the file that you want to install. To install them into the
database us
<pre>
PixelConfigDBCmd.exe --insertDataSet dac daclist.txt
</pre>
Again a new version has been created under the path <tt><b>dac</b></tt> and
all the dac settings have been uploaded. The new version is then
printed out.
Note that these interfaces are designed to not allow
you to change any existing data. (We might want to consider allowing
adding comments to existing versions of configuration data.)
\subsection page1Sect2Sub2 Retrieving data
From the command line you can retrieve data using
<pre>
PixelConfigDBCmd.exe --getVersion nametranslation/ 0
</pre>
This will retrieve the data from version 0 of the nametranslation
and write it out as a file.
\subsection page1Sect2Sub3 Creating new configurations
So far we have discussed how to add new data to the configuration
database. The next step is to combine versions of several
data types into a configuration. This is done with a command
like
<pre>
PixelConfigDBCmd.exe --insertConfigAlias Physics dac 1 detconfig 0 nametranslation 0
</pre>
where the versions of the different objects on the paths are
listed. This will create a new configuration key. This key will
be returned by the command.
Very often we have an existing configuration, <tt><b>oldKey</b></tt>, that
we want to 'update'. Note that update actually means that we will create
a new configuration. For example you can do
<pre>
PixelConfigDBCommand --updateConfigAlias 5 tbm 6
</pre>
<i>not yet implemented.</i> So in the example above a copy of
configuration key number 5 would
be made in which the TBM settings version 6 was added.
If one wants to remove an existing object from a configuration
we could imagine doing something like
<pre>
PixelConfigDBCommand --updateConfigAlias 5 calib -1
</pre>
In both these cases the new configuration key that was created is
returned. Again this interface guarantees that no existing
data has been changed. Only new data has been added.
\subsection page1Sect2Sub4 Alias manipulation
The simplest use case is that we can create an alias that points
to a specific key. This could e.g. be to point the 'Physics'
alias to configuration key 5
<pre>
PixelConfigDBCommand --insertConfigAlias Physics 5
</pre>
But we need to expand on this to make it more manageable
to handle the configurations.
In addition to have aliases for the toplevel configurations
we can define aliases for the configuration data versions.
For example you can define the 'Physics' alias for the TBM settings
version 4 using
<pre>
PixelConfigDBCommand --insertVersionAlias tbm 4 Default
</pre>
Very similar to the --createconfig from above you
can also do
<pre>
PixelConfigDBCommand --insertConfigAlias Physics dac 5 detconfig 3 tbm Physics
</pre>
This will create a new toplevel configuration key and the
alias 'Physics' will point to this key. Say that you then also do
<pre>
PixelConfigDBCommand --insertConfigAlias PhysicsLowLumi dac 4 detconfig 3 tbm Physics
</pre>
We have now created two aliases to two toplevel keys. Now, if you
do
<pre>
PixelConfigDBCommand --insertVersionAlias tbm 5 Physics
</pre>
this should automatically create two new toplevel configurations
for 'Physics' and 'PhysicsLowLumi'.
\subsection page1Sect2Sub5 Use cases
Below I will give some examples for how we could be using the
capabilities discussed in the previous two sections. To simplify
this a little bit I will work with a configuration that only
has 4 different types of objects (detconfig, tbm, dac, and masks).
The first thing we need to do is to load the configuration data.
Assume that we do this on a completely empty database.
<pre>
PixelConfigDBCmd.exe --insertData fecconfig fecconfig.dat
PixelConfigDBCmd.exe --insertData fedconfig fedconfig.dat
PixelConfigDBCmd.exe --insertData tkfecconfig tkfecconfig.dat
PixelConfigDBCmd.exe --insertData portcardmap portcardmap.dat
PixelConfigDBCmd.exe --insertDataSet fedcard fedcardlist.txt
PixelConfigDBCmd.exe --insertDataSet portcard portcardlist.txt
PixelConfigDBCmd.exe --insertDataSet tbm tbmlist.txt
PixelConfigDBCmd.exe --insertDataSet dac daclist.txt
</pre>
So now we have version 0 for each of these objects. Now I can
create aliases for the different objects.
<pre>
PixelConfigDBCommand --insertVersionAlias detconfig 0 Physics
PixelConfigDBCommand --insertVersionAlias tbm 0 Default
PixelConfigDBCommand --insertVersionAlias dac 0 Default
PixelConfigDBCommand --insertVersionAlias mask 0 Default
</pre>
<pre>
PixelConfigDBCommand --insertConfigAlias Physics dac Default detconfig Physics
tbm Default mask Default
</pre>
This command will create the first configuration key, number 0. Now
say that a new set of dac settings is created and loaded:
<pre>
PixelConfigDBCommand --insertData dac daclist.txt
</pre>
This will be version 1 of the dac settings. Next if you make this
alias the 'Default':
<pre>
PixelConfigDBCommand --insertVersionAlias dac 1 Default
</pre>
The code will automatically update all toplevel aliases that are
using this the 'Default' dac settings. In this example it
means that the top level 'Physics' alias will point to key 1.
__________________________________________________________________________________
\page page2 2- Managing Configurations
We need higher level tools to manage configurations. The way we
currently have the configurations implemented there are about
15 different objects that are needed to build a configuration.
Two examples of such configurations are:
<pre>
key 0
detconfig 2
nametranslation 0
fedconfig 0
fecconfig 0
fedcard 0
dac 2
mask 2
trim 2
calib 0
tbm 0
portcard 0
portcardmap 0
ttcciconfig 0
tkfecconfig 0
key 1
detconfig 2
nametranslation 0
fedconfig 0
fecconfig 0
fedcard 0
dac 2
mask 2
trim 2
calib 8
tbm 0
portcard 0
portcardmap 0
ttcciconfig 0
tkfecconfig 0
</pre>
For a moment I will not discuss the 'aliases', I will focus just
on the data organization and the tools needed to manipulate the
data. The different data types used in the configurations are
discussed in Sect.~\\ref{sect:configobjects}
\section page2Sect1 Configuration DB Implementation
To be added. Stay tuned.
__________________________________________________________________________________
\page page3 3- Configuration Objects
This section describes the implementation
of the configuration objects for the
pixel online system. The interface for accessing this data
was discussed in the previous section.
\section page3Sect1 Introduction
Key goals for the design of the configuration
data object include:
<ul>
<li> The configuration has to be fast and reliable.
The fewer components, read pieces of software,
involved in the configuration step the more
likely the system is to work reliably.
<li> The data volume should be small. I.e. the data
has to be packed in an efficient way.
<li> Want to optimize the database access by accessing
relatively few, but large, objects.
<li> Computers are good at manipulating data that is in
memory, so the actual commands that are sent to
the hardware can be built on the fly -- assuming that
all information to do this is accessible in memory.
<li> The data volume for the whole pixel system is O(100MB)
so holding this in memory in a single computer should
not be an issue. In fact this will be spread over
more than one computer as the FECs are in more than
one crate.
</ul>
The following classes are used to configure the online pixel
applications:
PixelTrimAllPixels: This class stores the trim bits for the
ROCs on one module. The trims are stored
for each pixel.
PixelMaskAllPixels: This class stores the mask bits for the
ROCS on one module. The masks are stored
for each pixel.
PixelDACSettings: This class stores the DAC settings for all
ROCs on one module.
PixelTBMSettings: This class stores the TBM settings for one
TBM.
PixelNameTranslation: This class translates from the pixel
naming scheme documents names of ROCs to
the hardware addresses used by both the
FEC and the FED to identify a ROC.
PixelDetectorConfig: This class lists the modules used in a
configuration. The utility of this class
is that it allows one to only use a small
subset of the detector without having to
create a new name translation.
PixelROCStatus: This class keeps track of the status of
ROCs. The default assumption is that a ROC
is working and this object allows us to
list ROCs that are not working, or that we
want to turn off.
PixelFECConfig: This class lists the pixel FECs that are used.
PixelTKFECConfig: This class lists the tracker FECs that are used.
PixelFEDConfig: This class lists the pixel FEDs that are used in
the configuration.
PixelFEDCard: This class stores the settings for one FED board.
PixelPortCard: This class stores the settings on a portcard, e.g.
the delay25 settings and AOH settings.
PixelPortcardMap: This class maps the AOH channels on portcards
to the FED channels.
PixelLTCConfiguration: This class holds the configuration for the
pixel LTC module.
PixelTTCciConfiguration: This class holds the configuration for the
pixel TTCci module.
PixelCalibConfiguration: This class specifies how the calibrations
are executed.
PixelDelay25Configuration: This class specifies how the delay25
calibration is executed.
With the exception of PixelCalibConfiguration and
PixelDelay25Configuration the classes above are used to build the
configuration of the hardware. The last two classes are used to
configure the software applications to perform a given
calibration.
The following sections describe what is implemented, starting with
a common base class for all configuration objects and then a
brief discussion of all classes currently implemented.
All configuration objects derive from a common base class called
PixelConfigBase.
<pre>
class PixelConfigBase {
public:
//A few things that you should provide
//description : purpose of this object
//creator : who created this configuration object
//date : time/date of creation (should probably not be
// a string, but I have no idea what CMS uses.
PixelConfigBase(std::string description,
std::string creator,
std::string date);
virtual ~PixelConfigBase(){}
std::string description();
std::string creator();
std::string date();
//Interface to write out data to ascii file
virtual void writeASCII(std::string dir="") const = 0;
private:
std::string description_;
std::string creator_;
std::string date_;
};
</pre>
This class is intended to provide a common interface. Currently it simply
holds information about when the objects were created.
\section page3Sect2 Trim and mask bits
The trim and mask bits need to be set for each pixel. This
makes these the largest configuration objects. In terms
of configuration of the ROC, the mask and trim bits are loaded
together. However, as the mask bits are used offline we will
store the trim and mask bits in different objects
as this will reduce the data that needs to be downloaded
to access the mask bits offline. Also, this saves space
as compared to storing the trim and mask bit for each
channel as one byte. It is also likely that we would
like to update the mask bits without changing the trim bits.
This would happen for example when we discover a hot pixel
and want to mask it off. Being able to change only the
mask bits would then be useful.
For both the mask and trim bits we allow for different implementations.
For example, we can have one implementation that allows us
to use different settings for each pixel, or we can have a different
configuration that uses the same settings for all pixels. The code
handle this transparently by using inheritance.
For the mask bits the base class looks like:
<pre>
class PixelMaskBase: public PixelConfigBase {
public:
PixelMaskBase(std::string description,
std::string creator,
std::string date);
virtual ~PixelMaskBase();
void setOverride(PixelMaskOverrideBase*);
virtual const PixelROCMaskBits& getMaskBits(int ROCId) const =0;
virtual void writeBinary(std::string filename) const =0;
virtual void writeASCII(std::string filename) const =0;
friend std::ostream& operator<<(std::ostream& s, const PixelMaskBase& mask);
private:
//Hold pointer to the mask override information.
PixelMaskOverrideBase* maskOverride_;
};
</pre>
The concrete implementation that implements mask bits for each
channel looks like:
<pre>
class PixelMaskAllPixels: public PixelMaskBase {
public:
PixelMaskAllPixels(std::string filename);
void writeBinary(std::string filename) const;
void writeASCII(std::string filename) const;
const PixelROCMaskBits& getMaskBits(int ROCId) const;
private:
std::vector<PixelROCMaskBits> maskbits_;
};
</pre>
The file format that we use looks like:
<pre>
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
col00: 11110000000000000000000000000000000000000000000000000000000000000000000000000000
col01: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
col02: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
---
---
---
col49: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
col50: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
col51: 00000000000000000000000000000000000000000000000000000000000000000000000000000000
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2
col00: 10000000000000000000000000000000000000000000000000000000000000000000000000000000
col01: 20000000000000000000000000000000000000000000000000000000000000000000000000000000
col02: 30000000000000000000000000000000000000000000000000000000000000000000000000000000
---
---
---
</pre>
Where the file contains the data for each of the ROCs in a module.
Within each ROC the trim bits are listed for each column by the
value if the trim bit as one hexadecimal character from 0 to F.
Similarly for the trim bits we have the base class:
<pre>
class PixelTrimBase: public PixelConfigBase {
public:
PixelTrimBase(std::string description,
std::string creator,
std::string date);
virtual ~PixelTrimBase();
void setOverride(PixelTrimOverrideBase* trimOverride);
//Build the commands needed to configure ROCs
//on control link
virtual void generateConfiguration(PixelFECConfigInterface* pixelFEC,
PixelNameTranslation* trans,
const PixelMaskBase& pixelMask) const =0;
virtual void writeBinary(std::string filename) const =0;
virtual void writeASCII(std::string filename) const =0;
virtual PixelROCTrimBits getTrimBits(int ROCId) const =0;
friend std::ostream& operator<<(std::ostream& s, const PixelTrimBase& mask);
private:
PixelTrimOverrideBase* trimOverride_;
};
</pre>
And the concrete implementation looks like:
<pre>
class PixelTrimAllPixels: public PixelTrimBase {
public:
PixelTrimAllPixels(std::string filename);
//Build the commands needed to configure ROCs
//on control link
void generateConfiguration(PixelFECConfigInterface* pixelFEC,
PixelNameTranslation* trans,
const PixelMaskBase& pixelMask) const;
void writeBinary(std::string filename) const;
void writeASCII(std::string filename) const;
PixelROCTrimBits getTrimBits(int ROCId) const;
private:
std::vector<std::string> rocname_;
std::vector<PixelROCTrimBits> trimbits_;
};
</pre>
We use basically the same format for the mask bits as we used for the
trim bits:
<pre>
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
col00: 11111111111111111111111111111111111111111111111111111111111111111111111110000000
col01: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
col02: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
---
---
---
col49: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
col50: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
col51: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2
col00: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
col01: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
col02: 11111111111111111111111111111111111111111111111111111111111111111111111111111111
---
---
.
</pre>
Here the mask bits are either 0 or 1 for each pixel.
\section page3Sect3 ROC DACs
The DAC settings for each readout chip are stored in the class
<pre>
class PixelDACSettings: public PixelConfigBase {
public:
PixelDACSettings(std::string filename);
PixelROCDACSettings getDACSettings(int ROCId) const;
//Generate the DAC settings
void generateConfiguration(PixelFECConfigInterface* pixelFEC,
PixelNameTranslation* trans) const;
void writeBinary(std::string filename) const;
void writeASCII(std::string filename) const;
friend std::ostream& operator<<(std::ostream& s, const PixelDACSettings& mask);
private:
std::vector<PixelROCDACSettings> dacsettings_;
};
</pre>
The format for the DAC settings in the ASCII format is given by
<pre>
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
Vdd: 6
Vana: 140
Vsf: 128
Vcomp: 15
Vleak_comp: 0
VrgPr: 0
VallPr: 35
VrgSh: 0
VwllSh: 35
VHldDel: 90
Vtrim: 29
VthrComp: 70
VIbias_Bus: 30
Vbias_sf: 6
VoffsetOp: 30
VIbiasOp: 115
VoffsetRO: 100
VIon: 115
VIbias_PH: 90
VIbias_DAC: 100
VIbias_ROC: 160
VIColOr: 99
Vnpix: 0
VsumCol: 0
VCal: 80
CalDel: 90
WBC: 120
ChipContReg: 0
ROC: FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2
Vdd: 6
Vana: 140
Vsf: 128
---
---
---
</pre>
Where the file contains the DAC settings for all the ROCs in a given module.
\section page3Sect4 PixelDetectorConfig
Specifies which components of the detector are used in the configuration.
The level of configurability is the module (or in FPIX language
the panel). I.e. the
components that are controlled by one TBM. <i>Currently this
controls which modules are configured. This should be enhanced to
also control which FED channels are configured and what portcard
devices are initialized.</i>
The file format that we use to specify this format looks like:
<pre>
FPix_BmI_D1_BLD1_PNL1
FPix_BmI_D1_BLD1_PNL2
---
---
---
</pre>
The format above is the 'old' format. After discussions with the
database GUI developers we have decided to make this object
specify the ROC and their status. All ROCs on a module has
to be listed. Otherwise there is an internal inconsistency in
the configuration. In addition to listing the ROC one can
specify a status of the ROC. An example of the file is
given below
<pre>
Rocs:
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2 off
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC3
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC4 noHits
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC5
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC6 off noHits
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC7
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC8
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC9
</pre>
Currently the status words 'off' and 'noHits' are used.
Off means that the chip is turned of for readout, i.e.
that bit on of the chip controll register is set.
noHits is a status of the ROC that means that this
ROC is not generating hits. This for example means that
you can not do an address level calibration and that
this information can be used to make sure that no
errors are reported as it is known that this ROC is
not working.
\section page3Sect5 PixelROCStatus
The <tt><b>PixelROCStatus</b></tt> class is used to store the status
of ROCs. The default assumption is that a ROC is working and
is on. However, we are likely to have problems with some ROCs
given the number of components we have. This structure should
allow us to add new failure modes as we discover new
problems. An example of the data would look like
<pre>
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2 NoHits
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC7 Off
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC8 Off NoHits
</pre>
The different status flags that we can set are:
<ul>
<li> <tt><b>NoHits</b></tt> indicates that we can not generate hits on the ROC.
for example this means that the ROC can not be calibrated e.g. for
address levels. However, it is not preventing us from doing the
UB equalization.
<li> <tt><b>Off</b></tt> The is not used in any calibration and the roc is
turned off such that it will not generate hits.
However, even it a ROC is <tt><b>Off</b></tt> it will be
configured.
</ul>
Note that we can set more than one of these flags at once. (Likely
one would implement this as a bitmap.
\section page3Sect6 PixelNameTranslation
This class generates the translation between the names used in the
naming document and the hardware addresses. This includes both the
FEC and the FED.
The data format used for the name translation is given by:
<pre>
# name TBMchannel FEC mfec mfecchannel hubaddress portadd rocid FED channel roc#
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0 A 1 8 1 31 0 0 1 12 0
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1 A 1 8 1 31 0 1 1 12 1
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC2 A 1 8 1 31 0 2 1 12 2
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC3 A 1 8 1 31 0 3 1 12 3
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC4 A 1 8 1 31 0 4 1 12 4
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC5 A 1 8 1 31 0 5 1 12 5
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC6 A 1 8 1 31 0 6 1 12 6
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC7 A 1 8 1 31 0 7 1 12 7
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC8 A 1 8 1 31 0 8 1 12 8
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC9 A 1 8 1 31 0 9 1 12 9
</pre>
The name translation allows us to map the ROC name to the hardware addresses
used in the configuration.
\section page3Sect7 PixelFECConfig
This class specifies the location of the pixel FECs. This
basically gives the VME base address to use. An arbitrary FEC
number is used here. <i>is this specified in the naming
convention document?</i> Also we refer to the crate number here.
There will be one PixelFECSupervisor per crate. How is this
number identified? The PixelFECSupervisor is initialized
with a crate number and will control the FEC cards that are
in the crate.
The file format that we have to store this information looks like
<pre>
#FEC number crate vme base address
1 1 0x80000000
</pre>
Each FEC is identified by a number. The FEC is identified by the
crate and base address.
\section page3Sect8 PixelTKFECConfig
This class specifies the location of the tracker FECs in
the system. This
specifies the VME slot and crate used for each TKFEC board. An arbitrary TKFEC
ID string is used here. <i>is this specified in the naming
convention document?</i>
There will be one PixelTKFECSupervisor per crate.
The PixelTKFECSupervisor is initialized
with a crate number and will control the TKFEC cards that are
in the crate.
The file format that we have to store this information looks like
<pre>
#TKFEC ID crate VME/PCI slot/address
tkfec1 1 0x1c
</pre>
Each TKFEC is identified by an ID string. (Currently this string
is arbitrary but we should use an agreed upon convention.)
Optionally, to use a PCI TKFEC, the string ``PCI" may be added between
the crate number and slot number. ``VME" may also be specified. If this
parameter is not specified, it defaults to VME.
\section page3Sect9 PixelFEDConfig
This specifies how the FEDs are configured. This includes the FED
number and the VME base address. The FED number is the same as
the FED id in the Slink data. Each PixelFEDSupervisor is initialized
with a crate number corresponding to the crate it controls.
The file format that we have to store this information looks like
<pre>
#FED number crate vme base address
1 1 0x1c000000
</pre>
Each FED is identified by a number, this is the same number as
the FED id in the raw data. The FED is identified by the
crate and base address. For now the crate is identified by an
arbitrary number. <i>Should this be changed to the
actual name of the crate?</i>
\section page3Sect10 PixelCalibConfiguration
This class was formerly known as PixelCalib, but was renamed after
it was moved to the CMSSW repository in order to make it more
consistent with offline conventions.
This class incorporates information about how a calibration
is executed. In particular it handles calibrations where
groups of pixels have charge injects. It specifies how we loop over pixels
and pulse the detector in a calibration. The class is also
used in the offline in order to analyze the calibration data,
so that we know what event had what charge injected and what
pixel were expected to be hit.
Below is an example of this file:
<pre>
Mode: ThresholdCalDelay
Rows:
10 | 20
Cols:
10 | 20
VcalHigh
Scan: VcThr 0 255 8
Scan: CalDel 0 255 8
Set: Vcal 50
Repeat: 10
Rocs:
FPix_BmI_D1_BLD1_PNL1_PLQ1_ROC0
FPix_BmI_D1_BLD1_PNL1_PLQ1_ROC1
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC1
---
---
---
</pre>
Arbitrary parameters may be specified just before the ``Rows:" line.
For example,
<pre>
Mode: AOHBias
Parameters:
TargetBMin 412
TargetBMax 612
printFEDRawData no
printFEDOffsetAdjustments no
printAOHBiasAdjustments no
Rows:
---
---
---
</pre>
These parameters are accessible in the calibration code. Each calibration
may look for particular parameters to control its operation. Parameters
not defined for a particular calibration are ignored.
In particular the parameter ``ScanMode'' can be defined. It can take
the three values of ``maskAllPixels'', ``useAllPixels'', and ``default''.
In the default mode the trim and mask bits specified in the configuration
is used during the scan. Charge is injected according to the pattern
and the pixels that are enabled in the configuration is used during
the calibration. In the maskAllPixels mode all pixels are
disabled before the first event. Then the pixels are enabled
corresponding to the pixel mask and the pattern that has charged
injected. I.e., only pixels that have charge injection and that
are not disabled in the configuration will be enabled. The pixels
use the trim bits from the configuration. In the useAllPixels mode
all the pixels on the current pattern is enabled independently of
what the mask bit is in the configuration if ScanMode is not
defined the mode useallPixels will be used.
DACs to scan are selected with lines of the form.
<pre>
Scan: [DAC name] [min scan value] [max scan value] [scan step size] [mix]
</pre>
The last parameter is optional. If nothing is given here, then all ROCs will be
set to the same DAC value at the same time. If the word <b><tt>mix</tt></b> is placed here
(at the end of the line), then the ROCs on a particular channel will have not have
the same DAC value at the same time. Instead, the DAC values on different ROCs
will be spread out to cover the entire range. This is useful when scanning
<b><tt>Vsf</tt></b> or any other setting that affects the power drawn by the chip,
as it prevents the ROCs from all drawing high power at the same time.
The list of ROCs may be specified completely, or it may be auto-generated.
Auto-generation requires knowing which modules are in the configuration, and
which ROCs are on those modules. Currently, this information is not
available in offline (i.e. CMSSW) code, so offline code must have the
ROC list specified completely. To do this, the format is:
<pre>
Rocs:
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
---
---
---
</pre>
In online running, where this information is available, it is preferable
to use auto-generation. To auto-generate the list, the first line should
be ``<b><tt>ToCalibrate:</tt></b> instead of ``<b><tt>Rocs:</tt></b>". (The user may
specify a complete ROC list with ``<b><tt>ToCalibrate:</tt></b>". Compared to
using ``<b><tt>Rocs:</tt></b>", this has the advantage of not adding ROCs which
are not found in the configuration. So it is always recommended to
use ``<b><tt>ToCalibrate:</tt></b>" if possible.)
Probably the most common thing is to just add all ROCs and modules in
the configuration. This simply requires the word <b><tt>all</tt></b>:
<pre>
ToCalibrate:
all
</pre>
To specify, say, just 2 ROCs, use:
<pre>
ToCalibrate:
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
</pre>
To specify, say, all the ROCs on just two modules, use:
<pre>
FPix_BpI_D1_BLD1_PNL1
FPix_BpI_D1_BLD1_PNL2
</pre>
(The ROCs on each module are obtained from the name translation.)
You can mix and match ROCs and modules:
<pre>
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BpI_D1_BLD1_PNL2
</pre>
You can also exclude particular ROCs and modules by adding them with a
minus sign in front (separated by whitespace):
<pre>
ToCalibrate:
all
- FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
- FPix_BpI_D1_BLD1_PNL2
</pre>
This fills the ROC list with all ROCs in the configuration, except
for <b><tt>FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0</tt></b> and for all the ROCs
in <b><tt>FPix_BpI_D1_BLD1_PNL2</tt></b>.
For another example:
<pre>
ToCalibrate:
FPix_BpI_D1_BLD1_PNL1
- FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
</pre>
This adds all ROCs on <b><tt>FPix_BpI_D1_BLD1_PNL1</tt></b> except
for <b><tt>FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0</tt></b>.
You may optionally add a ``<b><tt>+</tt></b>" in front of things that
you're adding. (If no ``<b><tt>+</tt></b>" or ``<b><tt>-</tt></b>" is seen, ``<b><tt>+</tt></b>" is
assumed.)
<pre>
ToCalibrate:
+ all
- FPix_BpI_D1_BLD1_PNL1
+ FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
</pre>
This adds all ROCs on all modules, except
for <b><tt>FPix_BpI_D1_BLD1_PNL1</tt></b>, on which
only <b><tt>FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0</tt></b> is added.
Note that the order matters. The following:
<pre>
ToCalibrate:
+ all
+ FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0
- FPix_BpI_D1_BLD1_PNL1
</pre>
would not include <b><tt>FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC0</tt></b> in the
ROC list, because it is later removed by the
removal of <b><tt>FPix_BpI_D1_BLD1_PNL1</tt></b>.
(For completeness, even though it's completely useless, you
can use ``<b><tt>- all</tt></b>" to clear the ROC list.)
The auto-generated ROC list only adds ROCs on modules
given in the <b><tt>PixelDetectorConfig</tt></b>.
\section page3Sect11 PixelFedCard
The <tt><b>PixelFEDCard</b></tt> class contains the settings for a FED board.
The file is fairly long and I do not include an example here.
You can find a sample file in PixelFEDInterface/test/params_fed.dat
<i> There is some information on the PixelFEDCard that is
redundant with the PixelFEDConfig like the VME base address. We
should only specify this in one location.</i>
\section page3Sect12 PixelTBMSettings
This class holds the settings used by the TBM. The file contains the
module name and gain settings as well as if the TBM should be
configured in 'SingleMode' or 'DualMode'.
The format used for this information is given by
<pre>
FPix_BpI_D1_BLD1_PNL1_PLQ2_ROC1
AnalogInputBias: 160
AnalogOutputBias: 110
AnalogOutputGain: 207
Mode: SingleMode
</pre>
<i>Note that the name here should be a module name and not contain
the plaquette and ROC number. We now have a 'PixelModuleName' class
that we should use here.</i>
\section page3Sect13 PixelPortcardMap
This class lists the portcards used in the configuration
and which fed channels are on which AOH.
The format of this information is illustrated by the file:
<pre>
# PortcardName Module AOH channel
FPix_BpI_D1_PRT2 FPix_BpI_D1_PNL4 A 1
FPix_BpI_D1_PRT2 FPix_BpI_D1_PNL5 A 2
</pre>
For each portcard the modules are listed and the corresponding
AOH channel is listed. The TBM channel, ``<b><tt>A</tt></b>" or ``<b><tt>B</tt></b>", is
specified after the module name. (If no TBM channel is specified, it
defaults to ``<b><tt>A</tt></b>".)
The AOH channel numbering begins from 1. On each forward pixel port card, there is one AOH with 6 channels, so the numbering goes from 1 to 6. On barrel supply boards, there are 4 AOHs, each with 6 channels. The numbering goes from 1 to 24. The first AOH contains channels 1-6, the second contains channels 7-12, etc.
\section page3Sect14 PixelPortCardConfig
This class holds the settings that are used on
each portcard.
The format of the portcard configuration file is
<pre>
Name: FPix_BpI_D1_PRT1
TKFECID: tkfec1
ringAddress: 0x8
ccuAddress: 0x7d
channelAddress: 0x10
i2cSpeed: 0x64
Delay25_GCR: 0x0
Delay25_SCL: 0x60
Delay25_TRG: 0x68
Delay25_SDA: 0x5c
Delay25_RCL: 0x60
Delay25_RDA: 0x60
AOH_Bias1: 0x19
AOH_Bias2: 0x1f
AOH_Bias3: 0x1f
AOH_Bias4: 0x1f
AOH_Bias5: 0x1f
AOH_Bias6: 0x1f
AOH_Gain1: 0x2
AOH_Gain2: 0x0
AOH_Gain3: 0x0
AOH_Gain4: 0x0
AOH_Gain5: 0x0
AOH_Gain6: 0x0
</pre>
In the barrel, there are 4 AOH devices, denoted <b><tt>AOH1</tt></b>, <b><tt>AOH2</tt></b>, <b><tt>AOH3</tt></b>, and <b><tt>AOH4</tt></b>.
Each of these 4 devices has 6 channels, each with its own bias and gain.
For example, <b><tt>AOH1_Bias1</tt></b>, <b><tt>AOH1_Gain5</tt></b>, <b><tt>AOH2_Bias3</tt></b>, <b><tt>AOH4_Gain6</tt></b>.
In addition, values may be specified for the settings <b><tt>PLL_CTR1</tt></b>, <b><tt>PLL_CTR2</tt></b>, <b><tt>PLL_CTR3</tt></b>,
<b><tt>PLL_CTR4</tt></b>,
<b><tt>DOH_Ch0Bias_CLK</tt></b>, <b><tt>DOH_Ch1Bias_Data</tt></b>, and <b><tt>DOH_Gain_SEU</tt></b>.
Prior to loading the settings in the file, an initialization sequence is sent to the port card:
<pre>
PLL_CTR1: 0x8
PLL_CTR1: 0x0
PLL_CTR2: 0x20
PLL_CTR4: 0x15
PLL_CTR1: 0x1
</pre>
Then the device settings in the file (all lines after <b><tt>i2cSpeed: 0x64</tt></b>) are loaded in the order given.
\section page3Sect15 PixelDelay25Calibration
This class specifies the parameters used in the delay 25 scan
for the delay settings of return data and send data. An
example of the configuration files used for this calibration
is given below
<pre>
Mode:
Delay25
Portcards:
FPix_BmI_D1_PRT2
AllModules:
0
OrigSDa:
64
OrigRDa:
64
Range:
64
GridSize:
8
Tests:
10
StableRange:
6
StableShape:
2
</pre>
__________________________________________________________________________________
\page page4 4- Usage of configuration data in xdaq applications
This section contains a brief description of how the configuration data
objects are used.
First we look at the PixelSupervisor. RCMS, via the PixelFunctionManager,
will pass a string for a configuration alias to the PixelSupervisor
during the configure transition. The PixelSupervisor gets the configuration
alias and looks up the corresponding configuration key:
<pre>
std::string alias=parametersReceived[0].value_;
unsigned int globalKey=PixelConfigDB::getAliases_map().find(alias)->second;
theGlobalKey_=new PixelConfigKey(globalKey);
</pre>
<i>This code should be fixed so that it catches if the alias does
not exist. This can be an assert, as the choices for the alias are
listed from the same map and not being able to find it is an internal
error.</i>
Having obtained the configuration key this is what is used to extract
configuration data. For example the PixelSupervisor extracts some
objects:
<pre>
PixelConfigDB::get(theCalibObject_, "pixel/calib/", *theGlobalKey_);
PixelConfigDB::get(theDetectorConfiguration_, "pixel/detconfig/", *theGlobalKey_);
</pre>
The get method returns a pointer that the PixelSupervisor is responsible
for deleting.
When the PixelSupervisor asks the other supervisors to configure it does
this by passing the configuration key, not the alias, to them. This
guarantees that the configuration used by the different supervisors
is consistent. We only need to retain the configuration key as a record
of how the detector was configured.
Inside the PixelFECSupervisor in the configuration method we have code
like
<pre>
PixelConfigDB::get(theNameTranslation_, "pixel/nametranslation/", *theGlobalKey_);
assert(theNameTranslation_!=0);
PixelConfigDB::get(theDetectorConfiguration_, "pixel/detconfig/", *theGlobalKey_);
assert(theDetectorConfiguration_!=0);
PixelConfigDB::get(theFECConfiguration_, "pixel/fecconfig/", *theGlobalKey_);
assert(theFECConfiguration_!=0);
assert(theFECConfiguration_->getNFECBoards()==1); //FIXME
PixelConfigDB::get(theCalibObject_, "pixel/calib/", *theGlobalKey_);
calibStateCounter_=0;
// Loop over all modules in the Detector Configuration and instantiate FECInterfaces required in this crate.
// Download TBM, DAC, Masks and Trim settings into hardware.
std::vector <PixelModuleName>::iterator module_name = theDetectorConfiguration_->getModuleList().begin();
for (;module_name!=theDetectorConfiguration_->getModuleList().end();++module_name)
{
diagService_->reportError("Congiguring module=" + module_name->modulename(),DIAGDEBUG);
const PixelHdwAddress* module_hdwaddress=theNameTranslation_->getHdwAddress(*module_name);
unsigned int fecnumber=module_hdwaddress->fecnumber();
unsigned int feccrate=theFECConfiguration_->crateFromFECNumber(fecnumber);
unsigned int fecVMEBaseAddress=theFECConfiguration_->VMEBaseAddressFromFECNumber(fecnumber);
if (feccrate==crate_){
PixelMaskBase *tempMask=0;
PixelTrimBase *tempTrims=0;
PixelDACSettings *tempDACs=0;
PixelTBMSettings *tempTBMs=0;
std::string modulePath=(module_name->modulename());
PixelFECInterface* tempFECInterface=new PixelFECInterface(fecVMEBaseAddress, aBHandle);
assert(tempFECInterface!=0);
tempFECInterface->setssid(4);
PixelConfigDB::get(tempMask, "pixel/mask/"+modulePath, *theGlobalKey_);
assert(tempMask!=0);
theMasks_.insert(make_pair(*module_name, tempMask));
PixelConfigDB::get(tempTrims, "pixel/trim/"+modulePath, *theGlobalKey_);
assert(tempTrims!=0);
theTrims_.insert(make_pair(*module_name, tempTrims));
PixelConfigDB::get(tempDACs, "pixel/dac/"+modulePath, *theGlobalKey_);
assert(tempDACs!=0);
theDACs_.insert(make_pair(*module_name, tempDACs));
PixelConfigDB::get(tempTBMs, "pixel/tbm/"+modulePath, *theGlobalKey_);
assert(tempTBMs!=0);
theTBMs_.insert(make_pair(*module_name, tempTBMs));
tempDACs->generateConfiguration(tempFECInterface, theNameTranslation_);
tempTBMs->generateConfiguration(tempFECInterface, theNameTranslation_);
tempTrims->generateConfiguration(tempFECInterface, theNameTranslation_, *tempMask);
FECInterface[fecVMEBaseAddress]=tempFECInterface;
}
}
</pre>
Similar extractions of the configuration data is used by other
supervisors. The supervisors cache the data received. The data
is cleared in the halt transition.
\section page4Sect1 Event builder configurations
We do not want to build complete events on one node;
rather we want to make sure that the event fractions
from each FED is always shipped to the same filter unit.
To accomplish this the network fabric of the event
builder will need to be reconfigured for each pixel
calibration run. Note that this is likely to be done
between each LHC fill. (This does not mean that we
will determine all constants at this rate, but that
we will want to monitor quantities such as address
levels frequently.)
Freya Blekman has developed the algorithms that analyze
the pixel raw data for the purpose of doing gain calibrations,
pixel alive, and S-curves. Initially this work is
done using data recorded in plain files. To progress
towards the final goal we should first try to run this
with a filter unit that is fed data from a source
that reads files. This will allow us to test and develop
the application in the form it will run in the HLT. The
second step is to actually run this with data produced
from a FED. This can be either real data of playback
generated in a DAQ test stand. We have discussed this
with Franz Meier. Freya will follow up on this in
August and September.
One important question to settle here is if we can generate
the triggers we need for this using our LTC.
We should also test and deploy code so that we can take
data using local DAQ (VME) and send it out to an event builder.
Jim Hunt wrote some of this code. This has not been used
recently, but we need to deploy this.
\section page4Sect2 Calibrations
The two main purposes of the online software are the
configuration for data taking and the online calibrations
that are performed between runs for the calibration of
the detector. There is a large number of different calibration
tasks that needs to be performed. This section describes
the algorithms implemented to carry out these calibrations.
The order of the calibrations described below is the order
that we nominally run the calibrations in when testing out
the detector. Some modifications to the order is possible.
\subsection page4Sect2Sub1 AOH and FED channel mapping test
The AOH and FED channel mapping test is not really a calibration, but rather a test to
see whether the connections between AOH channels and FED channels in the configuration are correct.
The idea is to change the AOH bias for a single channel, and look to see whether the black level
on the corresponding FED channel changes. (FED automatic baseline correction must be turned off.)
This process is repeated for each channel. Those for which the black level changes are correctly
connected; those for which there is no change are not connected correctly or have a mistake in the
configuration files.
\subsubsection page4Sect2Sub1Sub1 Mapping test steps
The steps of this calibration are listed in order below.
<ol>
<li> Set the FED channels to the 2V peak-to-peak range in order to provide
maximum dynamic range for the AOH bias scan.
<li> Turn off the FED automatic baseline correction.
<li> Set all FED optical receiver input offsets to 8, and channel offsets to 255.
These settings tend to put the signal in a range where the black level will not be stuck at the
top or bottom of the range as AOH bias is varied. (Maybe this step should be removed, and the
default values should be used instead.)
<li> Issue <b><tt>ClrCal</tt></b> to all ROCs, and disable hits with the control
register on all ROCs, to ensure that no hits are output.
<li> Issue <b><tt>LRES</tt></b> and <b><tt>CLRES</tt></b> commands to all FEDs to clear the
transparent data. This ensures that no stale data is sitting in the buffer.
<li> On the first channel, loop over AOH bias values. On each trigger, inspect the transparent buffer
and look for the start of the signal. Record the black levels in the time slots preceeding the
start of the signal. Keep track of the mean black level and the standard deviation for each AOH bias value.
A plot of this scan is written to a ROOT file.
<li> Inspect the scan of black level vs.~AOH bias. If the black level varies as AOH bias changes,
this channel is properly connected. If the black level is constant, this channel is flagged as improperly connected.
(Quantitatively, the \\chi^2 of the scan data is evaluated for the hypothesis of a flat line.
If \\chi^2d.o.f. > 100, the scan data is considered to vary; otherwise it is considered constant.)
One exception is if the scan is constant at the top or bottom of the range (1023 or 0).
In this case the signal is out of range, and so the connectivity test is inconclusive.
<li> Set AOH bias back to the default value (from the configuration). This ensures that channels are not
falsely flagged as being stuck at the top of the range. If, say, two FED channels were swapped in the configuration,
the first one scanned would show up as incorrectly connected. With the AOH left at the highest scan point,
when the FED channel that is actually connected to that AOH is checked later, the black level will appear
to be stuck at the top of the range. Setting that AOH back to its default value should put the black level
on that channel back into the middle of the range.
<li> Repeat the AOH bias scan for each channel in the configuration.
<li> Print a summary to the screen. Thus summary gives the number of
channels which are properly connected, improperly connected, or for which the test was inconclusive.
Improperly connected and inconclusive channels are then listed.
</ol>
\subsubsection page4Sect2Sub1Sub2 Parameters
A number of parameters in <b><tt>calib.dat</tt></b> may be used to control the
test.
Only two ``standard" parameters are used. The ``<b><tt>Repeat:</tt></b>" parameter
determines the number of triggers at each AOH bias scan point. The
channel list is used to determine which channels are calibrated. Note that
the rows, columns, and DAC scan settings in <b><tt>calib.dat</tt></b> are completely
ignored.
Some optional parameters may also be set. All have default values which
will be used if the parameter is not set. These parameters, their defaults,
and their functionality are given in Table~AOHAndFEDChannelMappingTestParameters.
\\caption{Optional parameters for AOH and FED channel mapping test.}
\\label{tab:AOHAndFEDChannelMappingTestParameters}
<center>
<table>
<tr>
<td> Parameter </td><td> Default </td><td> Description </td>
</tr>
<tr>
<td> ScanMin </td><td> 0 </td><td> Low end of AOH bias scan range </td>
</tr>
<tr>
<td> ScanMax </td><td> 50 </td><td> High end of AOH bias scan range </td>
</tr>
<tr>
<td> ScanStepSize </td><td> 5 </td><td> Step size for AOH bias scan </td>
</tr>
<tr>
<td> printFEDRawData </td><td> no </td><td> Whether to print decoded transparent buffer </td>
</tr>
<tr>
<td> printScan </td><td> no </td><td> Whether to print the AOH bias scan to the screen </td>
</tr>
</table>
</center>
\subsubsection page4Sect2Sub1Sub3 FED phase and delay scan
The FED has a delay (0 to 15) that goes in steps of 25/16 ns.
In addition to the delay there is a phase that controls when
the data is latched. Certain combinations of the delay and
phase are invalid and result in garbage ADC values.
In this calibration the 32 values of the phase and delay
are scanned. For each setting of the phase and delay a
fixed number of events (typically around 10)
is read out in transparent mode.
A detailed description of this algorithm, is presented in
Appendix~phaseanddelay.
\subsubsection page4Sect2Sub1Sub4 Output
The FED phase and delay calibration produces new
fed_params.dat files that are updated with the new
FED settings for the phase and delay. The files
should otherwise be identical to the input files
specified in the configuration. In addition to the
fed_params.dat files the are a number of pdf file
files generated. For each channel you get four
output files:
<pre>
PhaseAndDelayRaw_37_1.pdf
PhaseAndDelayPurged_37_1.pdf
PhaseAndDelayOrdered_37_1.pdf
PhaseAndDelayFinal_37_1.pdf
</pre>
Where the numbers in the file name represent the fed id and
the fed channel. Appendix~phaseanddelay gives
examples of these plots.
\subsubsection page4Sect2Sub1Sub5 Example configuration
An example of a configuration file to run the
phase and delay scan is given below.
<pre>
Mode: ClockPhaseCalibration
Rows:
Cols:
Vcal:
100 100 5
Repeat:
10
ToCalibrate:
all
</pre>
As described in Appendix~phaseanddelay one can
change the algorithm used to find the best phase and delay
using
<pre>
Parameters:
oldMode Yes
</pre>
\subsection page4Sect2Sub2 Delay25 settings for send data and return data
This calibration scans the delay for the send data and
return data. For each set of values commands are sent to
the TBM and the return status in the (pixel) FEC is checked.
This calibration uses the PixelFECInterface::testDelay25 method
that sends 4 different types of commands. This algorithm
focuses combines the results from the 4 different types
of commands and only if all 4 succeeded will you get 100%
efficiency.
Note that this algorithm does not check that the TBM or
ROC actually received the
command, it just checks the return status.
\subsection page4Sect2Sub2Sub1 Output
The main output from this calibration is new delay settings
that stored in the portcard files. The only changes made
to the port card settings are for the send data and
return data delays.
In addition to generating the new portcard files with
delay settings the scans are saved in the files:
<pre>
graph_FPix_BmO_D1_PRT3_FPix_BmO_D1_BLD8_PNL1.dat
good_FPix_BmO_D1_PRT3_FPix_BmO_D1_BLD8_PNL1.dat
</pre>
The 'graph_*.dat' files contains the efficiency
at each of the scan points. The 'good_*.dat' files
contains the list of points that had 100% efficiency.
To view the output you can run the root macro <tt><b>delay25.c</b></tt>
to generate plots. An example plot is shown in
Fig. Delay25Scan.
\\\includegraphics[width=0.8\\textwidth]{graph_FPix_BmO_D2_PRT3_FPix_BmO_D2_BLD8_PNL1.pdf}
This plot shows efficiency as a function of RDa and SDa. The blue
dots indicates areas with 100\\% transmission efficiency. The black
dots indicated partial efficiency, larger dots have higher efficiency.
The red square indicates the point chosen by the algorithm.
\subsection page4Sect2Sub2Sub2 Delay25 trigger setting
<i>Not implemented.</i> Should also scan the trigger delay to
make sure that the triggers are received correctly. Can we
just scan the delay setting and look at the corresponding FED
channel to make sure that the trigger arrived? I.e. that we
saw data in the FED? You would need to do this before you run
the phase and delay scan of the FED?
\subsection page4Sect2Sub3 AOH bias settings
\subsection page4Sect2Sub3Sub1 Introduction and discussion
The AOH bias is a setting on the port card which controls the
amount of light sent to the FED. There is one AOH bias setting
per FED channel. As AOH bias increases, more light is sent,
and the ADC values on the FED increase. At low values of AOH
bias, both black and ultrablack do not change with AOH bias,
and there is no separation between black and ultrablack levels.
At some threshold, the black level begins to increase
approximately linearly. At a higher threshold, the ultrablack
level also starts to increase linearly with approximately the
same slope. This behavior is illustrated in
Fig.~AOHBiasScan.
\\includegraphics[angle=90,width=0.99\\textwidth]{AOHBiasScan.pdf}
\\caption{Black and ultrablack levels as a function of AOH bias.}
\\label{fig:AOHBiasScan}
Note that the maximum black-ultrablack separation depends on how
the TBM DACs are set. At low DAC settings, the TBM outputs a
signal with relatively low separation; as these settings increase,
the separation also increases. In the AOH bias scan, the black
level is independent of the TBM settings. However, the linear
rise of the ultrablack level begins at a later point for higher
TBM settings, and hence the black-ultrablack difference saturates
at a higher AOH bias value when the TBM DAC settings are higher.
The goal of the AOH bias calibration is to determine an AOH bias
setting for each channel that is just high enough to saturate the
black-ultrablack difference. The calibration measures this
difference, using black and ultrablack levels from the TBM header
and trailer, as a function of AOH bias. It is important, though,
that during the scan the TBM DACs are set at least as high as they
will be set in later calibrations and physics runs. Otherwise, the
AOH bias value determined from the saturation point will be too low.
TBM settings above those used in this scan will not increase the
B-UB separation because the AOH cannot provide more separation.
It is also important that the AOH bias not be too high; otherwise
the FED offsets could not bring the signal into the dynamic range
of the FED.
The last part of the AOH bias calibration is to do a coarse baseline
adjustment. The FED channel offsets are set to the center of the
range (127), and then the FED optical receiver offsets and AOH bias settings
are adjusted to bring all FED baselines into a wide target range. AOH bias
is not decreased below the saturation value unless it is absolutely necessary.
The end result is a configuration of AOH bias and FED offset values that puts
all FED baselines near the center of the dynamic range, with AOH bias values
that allow for a large B-UB separation. After the AOH bias calibration, the
FED baseline calibration should be run to perform fine adjustments of the
baseline (using the freedom to move each channel offset).
\subsection page4Sect2Sub3Sub2 AOH bias calibration steps
This calibration involves many distinct steps. They are listed in order
below. Each step is performed on each channel being calibrated.
<ol>
<li> Set the FED channels to the 2V peak-to-peak range in order to provide
maximum dynamic range for the AOH bias scan.
<li> Turn off the FED automatic baseline correction.
<li> Issue <b><tt>ClrCal</tt></b> to all ROCs, and disable hits with the control
register on all ROCs, to ensure that no hits are output.
<li> Set all TBM DACs to high values. These values may be specified as
parameters in <b><tt>calib.dat</tt></b>.
<li> Set all FED optical receiver input offsets to the highest useful value
(the setting that minimizes the FED ADC values, without impairing the B-UB
separation). This value is configurable, and it defaults to 8 (on a scale
from 0 to 15). Also, all channel offsets are set their maximum value, 255.
<li> Issue <b><tt>LRES</tt></b> and <b><tt>CLRES</tt></b> commands to all FEDs to clear the
transparent data. This ensures that no stale data is sitting in the buffer.
<li> Loop over AOH bias values. Attempt to decode the transparent
buffer on each trigger, assuming the correct number of ROCs and no hits.
That is, find the TBM header, and verify that the TBM trailer is in the
right place. When decoding is successful, record the start slot of
the TBM header and trailer. On each channel, this slot should be the same for
all triggers. The reason for this step is to find the time slots for later
use in reading out TBM B and UB levels, even at low AOH bias settings where
full decoding would fail. If no reliable time slots are found on a channel,
this channel is considered failed, and it is ignored in the rest of the
routine.
<li> Now scan over AOH bias again, this time to record the TBM B and UB
levels at each setting, using the time slots recorded in the previous step.
This scan will be done 12 times -- once for each channel on a FED optical
receiver. (All FED channels 1, 13, and 25 will be scanned at once; then all
channels 2, 14, and 26; etc. If no FED channel in the configuration has one
of the three numbers, the scan for those numbers is skipped.) During the
scan, if the signal goes out of range high or low, the FED optical receiver
input offset and/or the FED channel offset is adjusted to bring it back into
range, if possible. (This is the reason for scanning only one channel per
receiver at a time.) Since only the B-UB difference is of interest, coherent
shifts in B and UB do not matter. The receiver input offset may not exceed
the maximum value described in step \\\ref{item:FEDReceiverOffset} (defaults
to 8). Prior to each scan, step \\\ref{item:FEDReceiverOffset} is repeated.
<li> Output plots of the TBM black and ultrablack, and the difference, as a
function of AOH bias, to a ROOT file. Figure~\\\ref{fig:AOHBiasScan} is an example of the
plots produced. Find the AOH bias value at which the B-UB difference
saturates (defined as a reduction in the slope to less than 20% of its
maximum value). Set each AOH to its saturation value.
<li> Set FED channels back to the 1V peak-to-peak range, for those channels
which were originally set at 1V in the FED configuration file. This is done
so that the coarse baseline adjustment will be done with the range that will
be used for future data-taking.
<li> Set FED optical receiver input offsets to 0 (lowest value,
corresponding to highest FED ADC values), and all channel offsets to 127
(middle of the range). The channel offset will be left at 127 for the rest
of the routine.
<li> Measure black levels on all channels. On each FED optical receiver,
if any channel has a black level above the target range, increase that
receiver's offset by one. If not, do nothing. Repeat this until all
channels have black levels in or below the target range, or have a receiver
offset equal to the maximum value described in
step \\ref{item:FEDReceiverOffset} (defaults to 8). The idea here is to
ensure that no AOH bias value will have to be decreased to place the black
level in the target range (unless this is absolutely necessary because the
receiver offset cannot be increased further).
<li> Again measure the black levels on all channels. If a channel's black
level is within the target range, that channel is done. If it is above or
below the target range, decrease or increase AOH bias. Repeat this until all
channels are within range. (Or, if two adjacent AOH bias values produce
black levels that straddle the target range, chose the one that is closer to
the target.) AOH bias should not have to decrease unless the FED receiver
input offset was at maximum. If it does decrease, a warning is generated in
the summary at the end of the calibration.
<li> Turn FED automatic baseline correction back on.
<li> Write new config files for all port cards and FEDs with at least one
successfully calibrated channel.
<li> Print a summary to the screen. Thus summary gives the number of
successful and failed channels, statistics on the new settings for successful
channels, descriptions of the errors on unsuccessful channels, and warnings
for channels on which the final AOH bias setting is below the saturation
point.
</ol>
\subsection page4Sect2Sub3Sub3 Parameters
A number of parameters in <b><tt>calib.dat</tt></b> may be used to control the
calibration.
Only two ``standard" parameters are used. The ``<b><tt>Repeat:</tt></b>" parameter
determines the number of triggers in each step (at each AOH bias scan point
and when measuring black levels in the coarse baseline adjustment). The
channel list is used to determine which channels are calibrated. Note that
the rows, columns, and DAC scan settings in <b><tt>calib.dat</tt></b> are completely
ignored.
Many other optional parameters may be set. All have default values which
will be used if the parameter is not set. These parameters, their defaults,
and their functionality are given in Table~\\ref{tab:AOHBiasParameters}.
\\caption{Optional parameters for AOH bias calibration.}
\\label{tab:AOHBiasParameters}
<center>
<table>
<tr>
<td> Parameter <td></td> Default <td></td> Description </td>
</tr>
<tr>
<td> ScanMin <td></td> 0 <td></td> Low end of AOH bias scan range </td>
</tr>
<tr>
<td> ScanMax <td></td> 50 <td></td> High end of AOH bias scan range </td>
</tr>
<tr>
<td> ScanStepSize <td></td> 1 <td></td> Step size for AOH bias scan </td>
</tr>
<tr>
<td> TargetBMin <td></td> 412 <td></td> Allowed range for the coarse baseline </td>
</tr>
<tr>
<td> TargetBMax <td></td> 612 <td></td> adjustment at the end of this calibration </td>
</tr>
<tr>
<td> MaxFEDReceiverInputOffset <td></td> 8 <td></td> Largest allowed value of the FED receiver </td>
</tr>
<tr>
<td> <td></td> <td></td> input offset, which can range from 0 to 15 </td>
</tr>
<tr>
<td> SetAnalogInputBias <td></td> 200 <td></td> TBM settings to use </td>
</tr>
<tr>
<td> SetAnalogOutputBias <td></td> 120 <td></td> for all channels -- </td>
</tr>
<tr>
<td> SetAnalogOutputGain <td></td> 200 <td></td> all 3 should be set high </td>
</tr>
<tr>
<td> printFEDRawData <td></td> no <td></td> Whether to print decoded transparent buffer </td>
</tr>
<tr>
<td> printFEDOffsetAdjustments <td></td> no <td></td> Whether to print when the FED offsets change </td>
</tr>
<tr>
<td> printAOHBiasAdjustments <td></td> no <td></td> Whether to print a message when the AOHBias </td>
</tr>
<tr>
<td> <td></td> <td></td> is changed during the baseline adjustment </td>
</tr>
</table>
</center>
\\subsection{FED baseline calibration}
This calibration adjusts the input offset and channel
offsets of the optical receivers in the FED such that the
black level is adjusted to be near a given target value,
normally 512, which is the midpoint of the
dynamic range of the ADC. During this calibration the
baseline correction in the FED is turned off.
Besides determining the input offset and the channel
offsets the algorithm determines address levels for the
black and ultra-black levels.
<i>Souvik: add more details, example plots, configuration
examples.</i>
\\subsection{TBM UB calibration}
\\subsubsection{Introduction and discussion}
With the black level set at 512 by the baseline calibration and automatic
baseline correction, the next step is to set the ultrablack levels
appropriately. We first adjust DACs on the TBM to set the TBM header and
trailer ultrablack to an appropriate value. (Experience
from forward testing suggests that a value of 120 to 150 is good.)
There are three DAC settings on the TBM, all of which affect the ultrablack
level. Higher values of these DACs correspond to lower ultrablack (and
greater B-UB separation). Figure~\\ref{fig:tbm-anal-dacs} shows how these
DACs affect the output of the TBM. The <b><tt>AnalogOutputGain</tt></b> setting
alters the levels of the TBM header and trailer, but not the signals from
the ROCs. The <b><tt>AnalogInputBias</tt></b> setting affects both ROC and TBM
signals, but it changes ROC signals more than TBM signals. The
<b><tt>AnalogOutputBias</tt></b> setting affects ROC and TBM signals equally.
\\includegraphics[width=0.99\\textwidth]{tbm-anal-dacs.png}
\\caption{Diagram illustrating how the TBM DACs affect the output of the TBM.
AnalogInputBias is referred to as Input AMP Bias (blue arrows),
AnalogOutputBias is referred to as Output AMP Bias (red arrows),
and AnalogOutputGain is referred to as TBM Gain (green arrows).}
\\label{fig:tbm-anal-dacs}
The TBM UB level may be adjusted by any of these three DAC settings. In
practice, the TBM UB calibration routine fixes two of them and scans the
third, searching for a value that puts the TBM UB at the target level.
(This level defaults to 135, and may be changed by the user.) By default
the <b><tt>AnalogOutputGain</tt></b> setting, which affects only the TBM header and
trailer, is scanned while the other two DACs are fixed. The user may
choose, however, to scan one of the other DACs instead.
Dual TBMs are a special case. The two channels on a dual TBM share the
same DAC settings, so they cannot be adjusted independently. Therefore the
TBM settings cannot be adjusted to simultaneously put both channels' UB at
the target level. For dual TBMs, we set the DACs so that one channel is at
the target UB level, and the other is below.
\\subsubsection{TBM UB calibration steps}
The calibration consists of the following steps:
<ol>
<li> Issue <b><tt>ClrCal</tt></b> to all ROCs, and disable hits with the control
register on all ROCs, to ensure that no hits are output.
<li> Issue <b><tt>LRES</tt></b> and <b><tt>CLRES</tt></b> commands to all FEDs to clear the
transparent data. This ensures that no stale data is sitting in the buffer.
<li> If the user has specified particular values for the two DACs which will
not be scanned, set all TBMs with those values.
<li> Scan over values of the desired DAC. Attempt to decode the transparent
buffer on each trigger, assuming the correct number of ROCs and no hits.
That is, find the TBM header, and verify that the TBM trailer is in the
right place. If decoding is successful, record the
UB values in the TBM header and trailer (5 values per trigger, 3 from the
header and 2 from the trailer). If decoding is unsuccessful, ignore that
trigger, and don't record anything. For each TBM, a plot of this scan is
output to a ROOT file.
<li> Analyze the recorded scan data on each FED channel, looking for the
point where the measured UB crosses the target level. When the crossing is
found, interpolate between the nearest scan points for the best DAC setting.
If no crossing is detected, or multiple crossings are detected, the channel
is considered failed, and no new DAC setting will be written out. (If either
channel on a dual TBM fails, no new DAC setting will be written out for that
module.)
<li> On single TBMs, the new DAC value is the value at this crossing point.
On dual TBMs, the new DAC value is the higher of the two values found on the
two FED channels for that TBM; this ensures that both UB levels will be at or
below the target.
<li> Write out new TBM configuration files for the successfully-calibrated
modules with the new DAC settings. If one or both of the other two DAC
settings were modified by the user, the output files will contain these new
values, too.
<li> Print out a summary.
</ol>
\\subsubsection{Parameters}
A number of parameters in <b><tt>calib.dat</tt></b> may be used to control the
calibration.
Only two ``standard" parameters are used. The ``<b><tt>Repeat:</tt></b>" parameter
determines the number of triggers in each step of the scan. The module list
is used to determine which channels are calibrated. Note that the rows,
columns, and DAC scan settings in <b><tt>calib.dat</tt></b> are completely ignored.
Many other optional parameters may be set. All have default values which
will be used if the parameter is not set. These parameters, their defaults,
and their functionality are given in Table~\\ref{tab:TBMUBParameters}.
\\caption{Optional parameters for TBM UB calibration.}
\\label{tab:TBMUBParameters}
<center>
<table>
<tr>
<td> Parameter </td><td> Default </td><td> Description </td>
</tr>
<tr>
<td> DACToScan </td><td> AnalogOutputGain </td><td> Which of the three TBM DACs to scan </td>
</tr>
<tr>
<td> ScanMin </td><td> [depends on DAC] </td><td> Low end of DAC scan range </td>
</tr>
<tr>
<td> ScanMax </td><td> [depends on DAC] </td><td> High end of DAC scan range </td>
</tr>
<tr>
<td> ScanStepSize </td><td> 5 </td><td> Step size for DAC scan </td>
</tr>
<tr>
<td> SetAnalogInputBias </td><td> [empty] </td><td> If not set, leave AnalogInputBias unchanged. </td>
</tr>
<tr>
<td> </td><td> </td><td> Otherwise, set it to the specified value and </td>
</tr>
<tr>
<td> </td><td> </td><td> change in the output configuration file. </td>
</tr>
<tr>
<td> SetAnalogOutputBias </td><td> [empty] </td><td> If not set, leave AnalogOutputBias unchanged. </td>
</tr>
<tr>
<td> </td><td> </td><td> Otherwise, set it to the specified value and </td>
</tr>
<tr>
<td> </td><td> </td><td> change in the output configuration file. </td>
</tr>
<tr>
<td> SetAnalogOutputGain </td><td> [empty] </td><td> If not set, leave AnalogOutputGain unchanged. </td>
</tr>
<tr>
<td> </td><td> </td><td> Otherwise, set it to the specified value and </td>
</tr>
<tr>
<td> </td><td> </td><td> change in the output configuration file. </td>
</tr>
<tr>
<td> TargetUB </td><td> 135 </td><td> Desired TBM UB level </td>
</tr>
<tr>
<td> DualTBMMaxSettingDiff </td><td> 30 </td><td> Maximum allowed difference between the </td>
</tr>
<tr>
<td> </td><td> </td><td> final DAC settings on the two channels </td>
</tr>
<tr>
<td> </td><td> </td><td> of a dual TBM </td>
</tr>
<tr>
<td> printFEDRawData </td><td> no </td><td> Whether to print decoded transparent buffer </td>
</tr>
<tr>
<td> printScan </td><td> no </td><td> Whether to print TBM UB levels </td>
</tr>
<tr>
<td> </td><td> </td><td> for each DAC setting </td>
</tr>
</table>
</center>
\\subsection{ROC UB equalization calibration}
\\subsubsection{Introduction and discussion}
This calibration sets the ultrablack level for each ROC equal to the
corresponding TBM's ultrablack level.
There are two DAC settings on the ROC which affect the ultrablack level.
Higher values of these DACs correspond to lower ultrablack (and greater
B-UB separation). <b><tt>VIbias_roc</tt></b> affects UB, address levels, and pulse
height. <b><tt>VIbias_DAC</tt></b> affects UB and address levels, but not pulse
height. In this routine, <b><tt>VIbias_DAC</tt></b> is scanned while
<b><tt>VIbias_roc</tt></b> is fixed.
\\subsubsection{ROC UB equalization calibration steps}
This calibration is very similar to the TBM UB calibration, except that each
individual ROC is analyzed. It consists of the following steps:
<ol>
<li> Issue <b><tt>LRES</tt></b> and <b><tt>CLRES</tt></b> commands to all FEDs to clear the
transparent data. This ensures that no stale data is sitting in the buffer.
<li> Scan over values of <b><tt>VIbias_DAC</tt></b>. (If the calib.dat file
specified a fixed value of <b><tt>VIbias_roc</tt></b>, this is also set.) Each time
after <b><tt>VIbias_DAC</tt></b> is changed, issue <b><tt>ClrCal</tt></b> to all ROCs, and
disable hits with the control
register on all ROCs, to ensure that no hits are output (so any hits
specified in the configuration file are ignored). Attempt
to decode the transparent buffer on each trigger, assuming the correct
number of ROCs and no hits. That is, find the TBM header, and verify that
the TBM trailer is in the right place. If decoding is successful, record
the UB values in the TBM header and trailer, and for each ROC. If decoding
is unsuccessful, ignore that trigger, and don't record anything. For each
ROC, a plot of this scan is written to a ROOT file.
<li> Analyze the recorded scan data on each ROC, looking for the point
where the measured ROC UB equals the UB level on the corresponding TBM.
When the ROC UB crosses the TBM UB, interpolate between the nearest scan
points for the best <b><tt>VIbias_DAC</tt></b> setting. If no crossing is detected,
or multiple crossings are detected, the ROC is considered failed, and no new
<b><tt>VIbias_DAC</tt></b> setting will be written out.
<li> Write out new ROC configuration files for the successfully-calibrated
ROCs with the new <b><tt>VIbias_DAC</tt></b> settings. If <b><tt>VIbias_roc</tt></b> was
modified by the user, the output files will contain this new value, too.
<li> Print out a summary.
</ol>
\\subsubsection{Parameters}
A number of parameters in <b><tt>calib.dat</tt></b> may be used to control the
calibration.
The various ``standard" parameters are used in this calibration. The
``<b><tt>Repeat:</tt></b>" parameter determines the number of triggers in each step
of the scan. The ROC list is used to determine which ROCs are calibrated.
A line like
<pre>
Scan: VIbias_DAC 80 200 5
</pre>
must be included to specify the scan range (first two numbers) and step
size (last number).
Optionally, <b><tt>VIbias_roc</tt></b> may be set with a line like
<pre>
Set: VIbias_roc 150
</pre>
Any hits specified in <b><tt>Rows:</tt></b> and <b><tt>Columns:</tt></b> will be
ignored. (This is done by explicitly clearing them.) The <b><tt>Rows:</tt></b> and
<b><tt>Columns:</tt></b> parameters should be empty; otherwise the calibration will work
but will print a warning message.
Some optional parameters may also be set. All have default values which will
be used if the parameter is not set. These parameters, their defaults, and
their functionality are given in Table~\\ref{tab:ROCUBParameters}.
\\caption{Optional parameters for ROC UB equalization calibration.}
\\label{tab:ROCUBParameters}
<center>
<table>
<tr>
<td> Parameter </td><td> Default </td><td> Description </td>
</tr>
<tr>
<td> printFEDRawData </td><td> no </td><td> Whether to print decoded transparent buffer </td>
</tr>
<tr>
</tr>
<tr>
<td> printScan </td><td> no </td><td> Whether to print TBM UB levels </td>
<td> </td><td> </td><td> for each DAC setting </td>
</tr>
</table>
</center>
\\subsection{Settings of CalDelay and VcThreshold}
These settings are ROC wide and a few pixels are selected and
a scan over the CalDelay and VcTreshold setting is performed.
For each setting, triggers are taken and data is looked at
using FIFO3 to see how many hits we had on each ROC.
In order for this algorithm to work the address levels for
black and ultra-black has to be set. (There is also an
implementation that uses the FIFO1, it does not need
address levels.)
An example of a scan plot is shown in Fig.~\\ref{fig:caldelvsvcthres}.
The optimal value is chosen as being 25 DAC settings below
the 'top of the tornado' for VcThreshold and in the middle
of the range of CalDelay settings.
\\subsection{Address level determination}
The address level determination determines the values used
by the FED to encode the transparent data. This include
address levels for the pixel addresses, TBM header and trailer
levels, and the black and ultrablack levels.
Pixels are scanned to make sure that we probe combinations
of address levels that could potentially cause problems,
such as transitions from high to low levels and vice versa.
Due to limitations in the size of the FIFO1 transparent
data size of 512 clocks, we can not even take one hit
per ROC unless the timing is adjusted such that the
start of the pulse train comes relatively early, i.e. in
the first 20 or so clock cycles. Recall, each ROC, with
one hit takes 9 clock cycles to read out. Then with 24 ROCs
in a module we need 216 clock cycles just to read out the
hits. Plus about 16 clock cycles to read out the TBM
headers
\\subsubsection{Data volume and time estimate}
The worst case scenario for an address level
calibration is one BPIX crate. We have 16 FED
cards in one crate, and we can assume that all
of them are fully populated. This means that we
have 16x36=576 links. As we read out this
data in transparent mode we will read 1024 words
per event (even though the transparent data
is only 512 bytes long). This means a total of
235926 bytes. If we want to go thought all
pixel we have to read out 4160 times this data
volume for a total of 9,4 GB. At a speed of
10 MB/s this will take 940 s.
Assuming that we change the transparent data
FIFO to be 1024 bytes. Then we can easily
fit 4 hits into each ROC. This then cuts the
readout time by a factor of 4 as we will need
exactly 1/4 the number of triggers. This then
becomes 235 seconds.
We can also use different patters that used
fewer pixel hits. But one has to take care to have all
relevant transitions.
<i>Souvik: Add more details, example plots, and configurations</i>
\\subsection{Pixel alive, S-curve, and Gain calibration}
The pixel alive calibration loops over pixel, inject
charge, for a fixed VCal setting. The data is analyzed
to produce an efficiency map that displays the efficiency
for each pixel on a plaquette.
The S-curve and gain calibrations are variations of the
pixel alive test were we in addition loop over the VCal
setting for each pixel. For the S-curve the data is
analyzed to produce an efficiency as a function of the
VCal setting while for the gain calibration we
look at the charge (ADC value) as function of the VCal.
All of these calibration as configured using a <tt><b>PixelCalib</b></tt>
configuration like
<pre>
Mode: PixelAlive
Rows:
0 | 16 | 32 | 48 | 64 |
1 | 17 | 33 | 49 | 65 |
2 | 18 | 34 | 50 | 66 |
3 | 19 | 35 | 51 | 67 |
4 | 20 | 36 | 52 | 68 |
5 | 21 | 37 | 53 | 69 |
6 | 22 | 38 | 54 | 70 |
7 | 23 | 39 | 55 | 71 |
8 | 24 | 40 | 56 | 72 |
9 | 25 | 41 | 57 | 73 |
10 | 26 | 42 | 58 | 74 |
11 | 27 | 43 | 59 | 75 |
12 | 28 | 44 | 60 | 76 |
13 | 29 | 45 | 61 | 77 |
14 | 30 | 46 | 62 | 78 |
15 | 31 | 47 | 63 | 79
Cols:
0 | 13 | 26 | 39 |
1 | 14 | 27 | 40 |
2 | 15 | 28 | 41 |
3 | 16 | 29 | 42 |
4 | 17 | 30 | 43 |
5 | 18 | 31 | 44 |
6 | 19 | 32 | 45 |
7 | 20 | 33 | 46 |
8 | 21 | 34 | 47 |
9 | 22 | 35 | 48 |
10 | 23 | 36 | 49 |
11 | 24 | 37 | 50 |
12 | 25 | 38 | 51
Vcal:
100 100 1
Repeat:
10
Rocs:
FPix_BmI_D1_BLD1_PNL1_PLQ1_ROC0
FPix_BmI_D1_BLD1_PNL1_PLQ1_ROC1
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC0
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC1
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC2
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC3
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC4
FPix_BmI_D1_BLD1_PNL1_PLQ2_ROC5
.
.
.
FPix_BmI_D1_BLD3_PNL2_PLQ3_ROC9
</pre>
<i>The above configuration is in the old format; should update.</i>
\\subsubsection{Practical issues}
If you get a lot of ``Time Out Error'' messages it could
be because you don't have the right channels enabled on the
FED. Or more specifically that you have enables channels that
are not connected.
\\subsection{Pixel trimbit determination}
Nothing implemented here. But the algorithm certainly
needs to be iterative. As the data volume needed to do
trimbit determination most certainly is very large, one
need to do an S-curve to determine the threshold,
it seems obvious that the data has to be acquired using
global DAQ. This means that it is unlikely that we
can implement a tight feedback loop.
<i>Anders: Discussed a plan with Urs L., can explain
this.</i>
\\subsection{Iana vs. Vana Calibration}
A calibration called ``Iana'' is implemented to
scan Vana and measure the analog current, Iana.
As the power distribution for the low voltage is
done per portcard for the forward pixels (<i>need
to add how this works for BPix.</i>) this calibration
works in parallel on a ROC at the time on each
of the portcards. The current changes we are
measuring is of the order 50 mA as you go from
Vana=0 to Vana=255. The A4603 power modules has
a resolution of about 7 mA. We perform this
measurement when all other ROCs are configured
to their default values. Hence, we measure the
current changes on top of a current of several amperes.
(I performed trials were I lowered Vana on all
other ROCs to reduce the current, but it does
not really improve the measurements.)
Hence, we have to take the data and fit it in order to
interpolate between the points. (It takes a
long time to do these measurments as one has to
wait up to 6 seconds before the current measurement
is stable. This should also be brought up with CAEN.)
\\includegraphics[width=0.85\\linewidth]{IanavsVana}
\\caption{This figure shows the measured analog current, Iana,
vs the Vana setting for a few ROCs. The top left plot shows
the Iana measured for one ROC with the A1715 power supply that
has a better resolution. The black lines indicate the default setting
(Vana=140) used in the configuration when this data was taken.
The red line indicate the setting that gives a analog current of
25 mA.}
\\label{fig:IanavsVana}
To analyze the data we fit it to a functional form.
After some experimentation I came up with the following.
I divide the range of Vana values into 3 ranges,
compare Fig.~\\ref{fig:IanavsVana}. In the high range Iana
is taken to be a constant. In the low range Iana
is taken to be a constant plus an exponential.
In the middle range Iana depends linearly on Vana,
and the function is required to be continuous. In
addition the function is required to have a continuous
derivative as it goes between the low and middle region.
This function has 5 free parameters that are determined
in the fit.
First the raw data is fit to this form. After doing this
fit the offset at Vana=0 is subtracted and the data is
refit and plotted. These are the fits shown in Fig.~\\ref{fig:iana}.
A black line is used to indicate where the current used for
the default Vana setting (Vana=140). In red is shown where you should
set Vana to get an analog current of 25 mA.
\\subsection{CalDel vs VcThr}
\\label{sect:caldelvsvcthr}
First we point out that CalDel is <i>only</i> relevant
for calibration data taken with charge injection.
The CalDel setting controlls the time in which the
charge is injected into the pixels. For real data
we will have to adjust the timing, e.g. using the
delay 25 settings fro the trigger. However, for data
taken with charge injection this delay is important.
This calibration performs a 2-D scan of CalDel vs VcThr.
for large VcThr, which corresponds to low thresholds,
we get lots of noise and the ROC digital readout basically
shuts down and we don't see any hits. For lower
values of VcThr we get in the range of CalDel values
that corresponds to the WBC used. For larger thresholds
this curve 'bends' to lower values of CalDel. As this
curresponds to a higher threshold the signal reaches the
threshold later and hence we need to use a smaller
CalDel, i.e. inject the signal earlier.
\\subsubsection{Output}
The primary output of this calibration are new
ROC DAC settings. The only settings that should be
changedin this calibration are for CalDel and VcThr.
In addition to the DAC settings the calibration produces
the output file <tt><b>VcThrCalDelaySummary.txt</b></tt> which
lists all the ROCs that were used in the calibrations.
For each of the ROCs there is a corresponding file,
named like
<tt><b>ThrCalDelScan_FPix_BmO_D1_BLD8_PNL2_PLQ1_ROC0.dat</b></tt>.
You can generate plots of VcThr vs. CalDel using
the root script <tt><b>thresholdCalDelay.c</b></tt>. An example
of a plot is shown in Fig.~\\ref{fig:thresholdCalDel}
\\includegraphics[width=\\linewidth]{thresholdCalDel}
\\caption{The efficiency for detecting a hit is shown
as a function of VcThr vs. CalDel. To large values
of VcThr, corresponding to a low threshold, generates
much noise that saturates the digital circuit and no
hits are seen. The optimal point is indicated in black
and the blue point indicates the old point from the
configuration.
\\label{fig:thresholdCalDel}
\\subsubsection{Example}
An example configuration file is shown below.
<pre>
Mode: ThresholdCalDelay
Rows:
10 | 20
Cols:
10 | 20
VcalHigh
Scan: VcThr 0 255 8
Scan: CalDel 0 255 8
Set: Vcal 50
Repeat: 10
ToCalibrate:
all
</pre>
\\subsection{CalDel calibration}
Again the note from Sect.~\\ref{sect:caldelvsvcthr} apply
in that CalDel is not relevant for physics data.
In this calibration we scan CalDel for a series
of different WBC settings. The creates a pattern
as indicated in Fig.~\\ref{fig:caldelvsWBC}. As
a change of one unit of WBC corresponds to
24.95ns (40.079 MHz) we can use the change in
CalDel for different WBC settings to calibrate
absolutely what a change of CalDel corresponds
to in absolute time.
We run this calibration with an injection of a large
signal (255 on the high Vcal range). We then pick
a Vcal setting that is near the <i>early</i> start
of the efficient range for the WBC setting. We pick
an early time so that we retain efficiency for signals
that are not as strong and takes time to get over
threshold. How close to the edge the Vcal setting
is taken can be specified by the parameter
``EdgeFraction''. Setting this to 0 means that
you pick the point right at the early edge, setting
the parameter to 1 means that you select the late
edge. (This parameter is not yet implemented. By
default now it the algorithm uses a setting corresponding
to 0.25.)
\\subsubsection{Output}
The CalDel calibration produces new ROC DAC settings
that update the CalDel settings, all other settings
should be left unchanged. The calibration also
generates output to display the region of good
efficiency in the WBC vs CalDel. The output can
be processed to generate plots using the root script
<tt><b>caldel.c</b></tt>. An example plot is shown in
Fig.~\\ref{fig:caldel}
\\includegraphics[width=\\linewidth]{CalDelCalibration}
\\caption{
The efficiency as a function of WBC vs CalDel.
\\label{fig:caldel}
\\subsubsection{Example}
An example of a configuration file for the CalDel
calibration is shown below:
<pre>
Mode: CalDelCalibration
Rows:
10 | 20
Cols:
10 | 20
VcalHigh
Scan: WBC 117 123 1
Scan: CalDel 0 255 1
Set: Vcal 250
Repeat: 2
ToCalibrate:
+ all
</pre>
\\subsection{Idigi vs. Vsf}
In this 'calibration' we scan Vsf and measure the
digital current. This is not really a calibration
as we don't determine any settings from this. Rather
what we do is to find a maximum Vsf setting that we
will use. If Vsf is too large the digital current
increases. In the configuration for this calibration
you can set the maximum increase in Idigi that
you allow using the parameter IdigiMax (units are
in mA). <i>Not yet implemented, there is a hardcoded
number of 7 mA now.</i>
\\subsubsection{Output}
This calibration produces the object
PixelMaxVsf which is used in the calibration that
determines Vsf to optimize the linearity.
In addition this calibration produces output
in a file called idigi.dat. Using the root
script idigi.c you can generate plots as
shown in Fig.~\\ref{fig:IdigivsVsf}.
\\includegraphics[width=\\linewidth]{idigi1}
\\caption{The digital current is shown as a function
of Vsf. }
\\label{fig:IdigivsVsf}
\\subsubsection{Example}
The configuration used for the digital scan
looks like
<pre>
Mode: Idigi
Rows:
Cols:
Vcal:
200 200 5
Repeat:
1
ToCalibrate:
+ all
</pre>
\\subsection{Linearity vs.~Vsf}
The ROC DAC setting <b><tt>Vsf</tt></b> affects the linearity of the pixel response vs.~received charge; larger values improve linearity.
<b><tt>Vsf</tt></b> also affects the digital current, with higher values increasing the current.
We have implemented two algorithms to set <b><tt>Vsf</tt></b> at a value that gives good linearity without drawing excessive power.
The first, described in this section, is the algorithm developed at PSI.
\\subsubsection{Introduction and discussion}
This algorithm measures linearity from scans of pulse height vs.~<b><tt>Vcal</tt></b> at different values of <b><tt>Vsf</tt></b>.
Examples of these scans are shown in Fig.~\\ref{fig:PH_vs_Vcal_scans}.
\\includegraphics[angle=90,width=0.49\\textwidth]{PH_vs_Vcal_poorLinearity.pdf}
\\includegraphics[angle=90,width=0.49\\textwidth]{PH_vs_Vcal_goodLinearity.pdf}
\\caption{Scans of pulse height vs.~Vcal at different values of Vsf. The scan on the left has poor linearity, and the scan on the right
has good linearity. (Note that these scans come from a detector which has no voltage bias, so the received charge and the slope
of the linear section are lower than in a biased detector.)}
\\label{fig:PH_vs_Vcal_scans}
To quantify the degree of nonlinearity, the scan data are fit with a function
\\begin{equation} \\label{eq:tanh}
PH = f(Vcal) = y_{\\rm mid} + y_{\\rm size} \\times \\tanh \\left( \\frac{Vcal - x_{\\rm mid}}{x_{\\rm size}} \\right)
\\end{equation}
where $PH$ is the recorded pulse height, $Vcal$ is the input, $(x_{\\rm mid},y_{\\rm mid})$ is the point at the center of the quasi-linear
rise region of the hyperbolic tangent, $x_{\\rm size}$ is the horizontal scale of the quasi-linear region, and $y_{\\rm size}$ is the
vertical scale of that region.
From this fit, the degree of nonlinearity can be quantified in different ways.
The simpler nonlinearity parameter, used by PSI and used by default in this calibration, is $x_{\\rm mid}/x_{\\rm size}$.
When this parameter is small, it means that <b><tt>Vcal</tt></b> = 0 lies within the quasi-linear rise region, and hence the response is
linear for small amounts of injected charge.
PSI has used $x_{\\rm mid}/x_{\\rm size} = 1.4$ as the cutoff -- values below 1.4 indicate good linearity.
An alternate nonlinearity parameter is
\\begin{equation} \\label{eq:nonlinearityIntegral}
\\frac{1}{2} \\int_{Vcal_{\\rm min}}^{Vcal_{\\rm max}} dVcal \\left| \\frac{f''(Vcal)}{f'(Vcal)} \\right|
\\end{equation}
where $f(Vcal)$ is the hyperbolic tangent function in Eq.~(\\ref{eq:tanh}).
This integral is a measure of the vertical change due to curvature divided by the vertical change due to slope over the range of the integral.
The limits of the integral should be chosen to include the range for which we want good linearity.
By default the limits go from <b><tt>Vcal</tt></b> = 50 to <b><tt>Vcal</tt></b> = 400 in low-scale <b><tt>Vcal</tt></b> units,
or from 50/7 to 400/7 in high-scale units.
This integral can be evaluated analytically.
Figure~\\ref{fig:nonlinearityPlots} shows scans of both measures of nonlinearity vs.~<b><tt>Vsf</tt></b>.
As seen in the plots, they give similar shapes.
This calibration allows the user to use either measure; the default is $x_{\\rm mid}/x_{\\rm size}$.
\\includegraphics[angle=90,width=0.49\\textwidth]{nonlinearityPlot_xmidOverXsize.pdf}
\\includegraphics[angle=90,width=0.49\\textwidth]{nonlinearityPlot_integral.pdf}
\\caption{Plots of nonlinearity vs.~Vsf. On the left, nonlinearity is measured by $x_{\\rm mid}/x_{\\rm size}$, and on the right,
it is measured by the integral in Eq.~(\\ref{eq:nonlinearityIntegral}).}
\\label{fig:nonlinearityPlots}
\\subsubsection{Linearity vs.~Vsf calibration steps}
This calibration consists of the following steps:
<ol>
<li> Scan <b><tt>Vcal</tt></b> and <b><tt>Vsf</tt></b> according to the calibration's configuration.
On each trigger, read out data from each FED's FIFO3.
Record the pulse height, keeping separate scans for different pixels.
<li> For each scan of pulse height vs.~<b><tt>Vcal</tt></b> (for a given ROC, pixel, and <b><tt>Vsf</tt></b> value),
fit with the function in Eq.~(\\ref{eq:tanh}).
A plot of each scan and fit is written to a ROOT file (see Fig.~\\ref{fig:PH_vs_Vcal_scans}).
If the fit is successful, compute the nonlinearity parameter (either $x_{\\rm mid}/x_{\\rm size}$ or the integral in
Eq.~(\\ref{eq:nonlinearityIntegral})) and add it to a scan of nonlinearity vs.~<b><tt>Vsf</tt></b> for that ROC and pixel.
This scan is also written to a ROOT file (see Fig.~\\ref{fig:nonlinearityPlots}).
<li> For each scan of nonlinearity vs.~<b><tt>Vsf</tt></b>, determine an optimal <b><tt>Vsf</tt></b>.
This is done by finding the highest<b><tt>Vsf</tt></b> where the scan intersects a nonlinearity threshold.
This threshold may be either absolute or relative, according to the parameter ``<b><tt>absoluteNonlinearityThreshold</tt></b>".
If absolute, the threshold is set by the parameter ``<b><tt>nonlinearityThreshold</tt></b>".
If relative, the threshold is the value of the nonlinearity at the highest <b><tt>Vsf</tt></b> in the scan,
multiplied by the parameter ``<b><tt>nonlinearityThreshold</tt></b>".
<li> For each ROC, examine the optimal <b><tt>Vsf</tt></b>s on the various pixels.
If there are at least 4 pixels, discard any <b><tt>Vsf</tt></b> outliers.
After any discarding, average the <b><tt>Vsf</tt></b> values to determine the <b><tt>Vsf</tt></b> setting for that ROC.
<li> Compare the <b><tt>Vsf</tt></b> setting on each ROC to the maxVsf setting in the configuration.
If the setting from this calibration exceeds the maximum, reduce <b><tt>Vsf</tt></b> to the maximum allowed.
<li> Write out new ROC configuration files for the successfully-calibrated
ROCs with the new <b><tt>Vsf</tt></b> settings.
<li> Print out a summary.
</ol>
\\subsubsection{Parameters}
A number of parameters in <b><tt>calib.dat</tt></b> may be used to control the
calibration.
The various ``standard" parameters are used in this calibration. The
``<b><tt>Repeat:</tt></b>" parameter determines the number of triggers in each step
of the scan. The ROC list is used to determine which ROCs are calibrated.
The scan ranges are specified by lines like
<pre>
Scan: Vcal 0 255 5
Scan: Vsf 0 255 5 mix
</pre>
which specify the scan range and step size. The ``<b><tt>mix</tt></b>'' flag must be enabled for <b><tt>Vsf</tt></b>
(or alternatively SingleROC mode must be used); otherwise the calibration will abort.
The hits specified in <b><tt>Rows:</tt></b> and <b><tt>Columns:</tt></b> will be
used. One scan is taken for each pixel with hits.
At most two hits per pixel pattern may be specified (or alternatively SingleROC mode must be used);
otherwise the calibration will abort.
The reason for this restriction is that the FED's spy FIFO3 will overflow if each ROC connected to it has more than two hits.
Some optional parameters may also be set. All have default values which will
be used if the parameter is not set. These parameters, their defaults, and
their functionality are given in Table~\\ref{tab:LinearityVsVsfParameters}.
\\caption{Optional parameters for linearity vs. Vsf calibration.}
\\label{tab:LinearityVsVsfParameters}
<center>
<table>
<tr>
<td> Parameter </td><td> Default </td><td> Description </td>
</tr>
<tr>
<td> absoluteNonlinearityThreshold </td><td> yes </td><td> Whether the nonlinearity threshold is an </td>
<td> </td><td> </td><td> absolute number, or a multiple of the </td>
<td> </td><td> </td><td> nonlinearity parameter at maximum <b><tt>Vsf</tt></b> </td>
<td> nonlinearityThreshold </td><td> 1.4 </td><td> Value of the nonlinearity threshold </td>
<td> useIntegrated2ndOver1stDerivative </td><td> no </td><td> Whether to use the integral in Eq.~(\\ref{eq:nonlinearityIntegral}) for the </td>
<td> </td><td> </td><td> nonlinearity parameter, instead of $x_{\\rm mid}/x_{\\rm size}$ </td>
<td> integralMinVcal </td><td> 50/7 </td><td> Lower <b><tt>Vcal</tt></b> bound of the integral (if used) </td>
<td> integralMaxVcal </td><td> 400/7 </td><td> Upper <b><tt>Vcal</tt></b> bound of the integral (if used) </td>
</table>
</center>
\\subsection{Vana and time walk}
<i>This calibration is not yet fully implemented.
The description below represents what we intend
to do.</i>
The idea is to run a scan of Vana vs CalDel. For a large
charge we will assume that the response of different
sensors is similar. As for a large charge (the maximum
that can be injected) the raise time is small it is
probably a reasonable assumption that we can assume that
we have a small variation between ROCs. However, for a
smaller charge, like 250 on the low Vcal range, this
is not obviously true. This calibration finds the
time (absolute) that the Vcal=250 signal is over threshold
and also finds the slope $dt/d{\\rm Iana}$, or $dt/d{\\rm Vana}$.
Using this information the ROCs can be unified to one
time at which a pulse of this strength passes
over threshold.
\\subsection{Emulated physics}
<i>Souvik: add text</i>
\\subsection{Baseline with emulated data}
<i>Souvik: add text</i>
\\subsection{Address levels with emulated data}
<i>Souvik: add text</i>
\\section{Detector Startup Procedure}
Close interaction between the DAQ and DCS (Detector Control System)
software systems are foreseen for the detector's startup procedure.
From the DAQ side, the startup procedure is envisioned to be embedded
within the "Initializing" and "Configuring" FSM transitions prescribed by
Run Control. In working through these states, the DAQ system must
frequently query
the DCS system for information on the voltages being applied across various
detector and front-end elements.
The XDAQ Supervisor applications mainly involved with this are:
<ul>
<li> PixelFECSupervisor: Controls a crate of Pixel FEC boards
<li> PixelTKFECSupervisor: Controls a crate of Tracker FEC boards
<li> PixelDCSFSMInterface: Reports the low voltages applied by the DCS
system (simplified to LV_OFF/ LV_ON_REDUCED/ LV_ON)
</ul>
PixelFECSupervisor is expected to deal with three voltage states of
its underlying elements (the ROCs): LV_OFF/ LV_ON_REDUCED/ LV_ON. Appropriate
tristate member data will be added to PixelFECSupervisor to keep
track of them.
PixelTKFECSupervisor is expected to deal with two voltage states of
its underlying elements: LV_OFF/ LV_ON. Appropriate bistate member data will
be added to PixelTKFECSupervisor to keep track of them.
The progress through the DAQ's FSM states and transitions for startup
and configuration is envisioned as follows:
<ul>
<li> PixelFECSupervisor(s) and PixelTKFECSupervisor are initially
in their "Initial" state and await the "Initialize" command.
<li> On receiving the "Initialize" command, PixelFECSupervisor(s) and
PixelTKFECSupervisor independently query PixelDCSFSMInterface with
the SOAP messages:
<pre>
<fsmStateRequest name="PixelFECSupervisor" type="PxlFEC" instance="1">
</fsmStateRequest>
<fsmStateRequest name="PixelTKFECSupervisor" type="TrkFEC" instance="1">
</fsmStateRequest>
</pre>
respectively.
<li> The PixelDCSFSMInterface responds with information regarding
the voltage states with a SOAP message of the form:
<pre>
<fsmStateResponse>
<state partition="FPix_BmI">LV_ON</state>
<state partition="BPix_BpO">LV_OFF</state>
...
</fsmStateResponse>
</pre>
<li> The PixelFECSupervisor(s) and PixelTKFECSupervisor update
their tri- and bi-state member data
according to the response from PixelDCSFSMInterface. This
concludes the "Initializing" transition
and both the PixelFECSupervisor(s) and PixelTKFECSupervisors
land in their "Halted" states.
<li> On receiving the "Configure" command, PixelFECSupervisor(s)
and PixelTKFECSupervisor
check the status of their member data. If the appropriate
voltages are set then they go ahead
with step 6 else transition to the "Error" state.
<li> PixelFECSupervisor queries for the currents and then
loads the ROCs' DAC settings.
The currents are queried again to make sure that a change in
the current consumption is as expected.
If this is seen then we proceed to step 7 or else we
transition PixelFECSupervisor to the "Error" state.
<li> PixelFECSupervisor sends a SOAP message to PixelDCSFSMInterface to raise the
Digital Voltages.
The PixelDCSFSMInterface responds back with the raised values of the Digital Voltages.
PixelFECSupervisor resets its
tristate member data if this went fine or else
transitions to its "Error" state.
<pre>
<fsmStateNotification>
<state partition="FPix_BmI">ReadoutCHIPS_INITIALIZED</state>
<state partition="BPix_BpO">ReadoutCHIPS_INITIALIZED</state>
</fsmStateNotification>
</pre>
<li> PixelFECSupervisors load their ROCs' DAC, mask and trim settings.
PixelFECSupervisor loads the slow I2C settings for CCU
boards, Port Cards etc.
<li> PixelFECSupervisor(s) and PixelTKFECSupervisor land in
their "Configured" state.
</ul>
A SOAP message callback is created in PixelFECSupervisor and
PixelTKFECSupervisor
that receive independent FSM state notifications from
PixelDCSFSMInterface and update
their tri/bi-state member data. This may be useful in case a
voltage state is achieved
by the DCS system after the DAQ system has initialized but
hasn't begun configuring.
For the PixelFECSupervisor to read out the current I suggest that
this is done by calling the PixelSupervisor. The PixelSupervisor
will have all the configuration information needed to read the
currents.
__________________________________________________________________________________
\page page5 5- Appendix
\section page5Sect1 FED phase and delay calibration
\\label{sect:phaseanddelay}
This section will describe some aspects of determining the
so called 'phase' and 'delay' of the FED. The sample
plots shown in this section are taken from runs on the
FPIX pilot run detector. this was done using a version 4 FED
with the Aug. 22, 2007 firmware version.
In order to get the transparent data to 'look' OK I had
to send an LRES before each trigger. Will Johns and I had
long email exchanges trying to understand this. I think
that the final conclusion was that the FED state machine
gets confused when the input data is non standard. In the
scans over phases and delays there are certain settings that
are invalid, i.e., that you try to read out the ADC before the
data is available. At the end of this section I will discuss
two issues that I noticed in looking at the transparent data.
For the above reason we also turn off the automatic baseline
correction to avoid it getting confused if you seend non valid
data or if you don't have correct address levels.
In these tests we take 10 triggers for each delay and phase
setting. I'll show plots, as in Fig.~\\ref{fig:phasedelayraw},
where for each of the two possible phases the profile
histogram shows the adc value as a function of clock+delay/16.
The third plots just shows the two plots on top of each other.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlotRaw_channe_1_1}
\\caption{This figure shows on top the adc value as a function of
clock+delay/16 for phase=0 and the same plot for phase=1 in the
middle. The two plots are overlaid at the bottom.}
\\label{fig:phasedelayraw}
We see that
there are certain values of the delays that produce garbage
as you try to read out the ADC before the data is available.
To identify the invalid combinations of phase and delay I
calculate the rms for the different phase and delay settings
in the first 20 clock cycles, i.e. before the TBM header arrives.
Based on the rms distribution it is seen that for phase=0 that
we got invalid data with delays of 1, 2, and 3, while for
phase=1 the delays of 10, 11, and 12 generate invalid data.
From now on I will reject these combinations. (In the plots I set the
adc value to 0.)
After rejecting the invalid phase and delay combinations we now
have a signal that looks as what is shown in Fig.~\\ref{fig:phasedelayvalid}.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlotPurged_channe_1_1}
\\caption{This figure shows on top the adc value as a function of
clock+delay/16 for phase=0 and the same plot for phase=1 in the
middle. The two plots are overlaid at the bottom. Here I have set the
adc value to 0 for the combinations of clock and phase that are not
valid.}
\\label{fig:phasedelayvalid}
The remaining signal still has artifacts due to when the
adc latches on to the signal such that it looks like the signal
is not read out in order. This is corrected by 'reordering' the data
within a clock. I shifted the phase=0 events backward by 3 delay steps
and the phase 1 events forward by 3 delay steps. This makes the
signal continuous as shown in Fig.~\\ref{fig:phasedelayshifted}.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlotShifted_channe_1_1}
\\caption{This figure shows on top the adc value as a function of
clock+delay/16 for phase=0 and the same plot for phase=1 in the
middle. The two plots are overlaid at the bottom. Here the
data within a clock has been ordered to give a continuous data
signal.}
\\label{fig:phasedelayshifted}
The last step is to align the data so that the phase=0 and phase=1
data overlaps. I do this by shifting the data for the events with phase=1
by 10 delay steps. The final result is shown in
Fig.~\\ref{fig:phasedelayfinal}. For the bins in the plot where there
is data from both phase=0 and phase=1 we see that there is excellent
agreement. We also not that the signal undershoots in a transition
from black to ultrablack and that it overshoots on the reverse transition.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlot_channe_1_1}
\\caption{This figure shows on top the adc value as a function of
clock+delay/16 for phase=0 and the same plot for phase=1 in the
middle. The two plots are overlaid at the bottom. Here the phase=1
data has been shifted so that it overlaps with the phase=0 data.}
\\label{fig:phasedelayfinal}
To determine a best delay I look at the combined data - where I average
the bins that has both phase=0 and phase=1 contributions - and calculate
a difference for bin $i$ by taking the difference between bin $i-1$
and $i+1$.
I calculate this difference for the 25 MHz clock cycles from clock 27 to 100.
I add the magnitude of these differences for all bins that corresponds
to the same delay. I pick the smallest such sum of differences for the
different delay as the optimal choice. If more than one phase is allowed
I pick the choice that is farthest from the invalid delay for that phase.
A new alogorithm has been implmented that determines the phase
to be right at the edge of the transition from black to ultrablack
in the TBM trailer. You can still run the old algorithm by setting
the parameter 'oldMode' to 'Yes'.
Looking at the 8 channels that were connected to the pilot run detector
I find that the results are very consistent. The phase is either 0 or
15 in the (aligned delay) for the raw delay setting this corresponds
to 2 or 3 for phase=1.
Open questions: Is the same set of phases and delays illegal on all
FEDs and channels? Also, are the shifts that are needed to time-order
the data the same on all FEDs and channels? Looking at more data will
resolve this. It is easy to test that the data in the two phases are
compatible by forming a $\\chi^2$.
The code was written as a root macro. I will 'transplant' this code
into xdaq so we can run it automatically to produce the phase and delay
settings needed.
However, looking at this I observed an odd feature.
This is illustrated in Fig.~\\ref{fig:phasedelaylatedata}.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlot_channe_10_1_latedata}
\\caption{Here you see that for clocks in and after the TBM trailer that
there is a feature in that some delays are oscillating. This 'excitation'
seems to decay of after $O(20)$ clocks. }
\\label{fig:phasedelaylatedata}
In Fig.~\\ref{fig:phasedelaylatedatazoom} is a close up of the
region with the noise.
\\includegraphics[width=\\linewidth]{phaseAndDelayPlot_channe_10_1_latedatazoom}
\\caption{Zooming in you can see that data in the two phases
both agree on the shape of this feature. }
\\label{fig:phasedelaylatedatazoom}
Here you can see that there is 'wiggle' in the data that is large compared
to the rms, as indicated by the error. This wiggle seems to persist
for many clock cycles after the TBM trailer. However, it was not present
in the black data before the data train. It seems to first start
in the TBM trailer when the UB signal is generated. With the
pilot run detector we are using 8 channels
(1, 2, 3, 4, 7, 8, 9, and 10). I see the same feature on
almost all channels, though they are not as strong on channel 1, 7,
and 9.
\\includegraphics[width=0.48\\linewidth]{graph_FPix_BpI_D1_PRT1_FPix_BpI_D1_BLD1_PNL1_0}
\\includegraphics[width=0.48\\linewidth]{graph_FPix_BpI_D1_PRT1_FPix_BpI_D1_BLD1_PNL1_1}
\\includegraphics[width=0.48\\linewidth]{graph_FPix_BpI_D1_PRT1_FPix_BpI_D1_BLD1_PNL1_2}
\\includegraphics[width=0.48\\linewidth]{graph_FPix_BpI_D1_PRT1_FPix_BpI_D1_BLD1_PNL1_3}
\\caption{This figure shows the results of scans for delay25 settings on
the Cornell test stand. The upper left plots shows (large black dots) the
region for which the return data was valid when sending a ROC command (CalPix).
The upper right plot shows the valid region when sending a TBM command
(tbm speed). The lower left shows the region of success when sending a
roc init and the lower right shows the region of success with a roc trim
load command. As is seen, the working region is smaller for the long
commands. The red and blue points indicates the algorithm used to select
the operating point. Need to check with Jennifer what this is doing.}
\\label{fig:scanDelay25}
\section page5Sect2 Calibration Organization
The calibrations all share a similar format.
<ul>
<li> The PixelSupervisor controls a loop over 'events' and coordinates
the activity of the FED, FEC, TKFEC, and TTC supervisors.
<li> Each calibration needs to do some initialization before processing
the event data.
<li> During event processing data is acquired and processed.
<li> After all event data is taken it is analyzed and the results are
saved.
</ul>
This section will describe a <i>proposal</i> for how to formalize this process.
A first step in this this direction was taken when the calibration classes
were broken out from the the PixelSupervisor and the PixelFEDSupervisor.
This first step was almost trivial as it just copied the code out to
separate classes. There are a few more changes we should make that will
allow us to run these jobs in workloops. Among other things, this will
allow us to look
at the progress of the calibrations from the web browser.
\subsection page5Sect2Sub1 PixelSupervisor calibration code
We change the <tt><b>PixelCalibrationBase</b></tt> class to have
the interface below.
<pre>
class PixelCalibrationBase : public PixelSupervisorConfiguration,
public SOAPCommander {
public:
PixelCalibrationBase( const PixelSupervisorConfiguration &,
const SOAPCommander& soapCommander );
virtual ~PixelCalibrationBase(){};
virtual void beginCalibration();
virtual bool calibrationEvent();
virtual void endCalibration();
protected:
private:
// PixelCalibrationBase Constructor
PixelCalibrationBase(const SOAPCommander& soapCommander);
};
</pre>
The method <tt><b>begin()</b></tt> should do any initialization that
is needed before processing any triggers. The method <tt><b>event()</b></tt>
is called repeatedly until it returns true, this indicates that
the calibration has come to an end.
<i>Souvik, is this sufficient to allow implement this running in
a workloop?</i>
Then the <tt><b>end()</b></tt>
method is invoked to perform any analysis of the acquired data.
More details on what these methods needs to do will be
discussed below.
\subsection page5Sect2Sub2 PixelFEDSupervisor calibration code
Similarly, I suggest a more general structure for the calibration
code that runs in the PixelFEDSupervisor.
<pre>
class PixelFEDCalibrationBase : public PixelFEDSupervisorConfiguration,
public SOAPCommander {
public:
PixelFEDCalibrationBase( const PixelFEDSupervisorConfiguration &,
const SOAPCommander& soapCommander );
virtual ~PixelFEDCalibrationBase(){};
virtual xoap::MessageReference beginCalibration(xoap::MessageReference msg);
virtual xoap::MessageReference calibrationEvent(xoap::MessageReference msg);
virtual xoap::MessageReference endCalibration(xoap::MessageReference msg);
//Should really not be here....
unsigned int TransparentDataStart (unsigned long *buffer);
protected:
//SOAPCommander* theSOAPCommander_;
private:
// PixelCalibrationBase Constructor should neve be called
PixelFEDCalibrationBase(const SOAPCommander& soapCommander);
};
</pre>
Again the three methods <tt><b>beginCalibration()</b></tt>,
<tt><b>calibrationEvent()</b></tt>, and <tt><b>endCalibration()</b></tt>
corresponds to the pre calibration data taking, processing of trigger
and the post data taking analysis respectively. I suggest that
these methods are bound to soap messages that invokes
the implemented methods.
In particular we should move the code that sets the mode
and control registers to the <tt><b>beginCalibration()</b></tt> method.
This will allow us to move out code from the PixelFEDSupervisor
that is specific to different calibrations. <i>Or we split
out the mode and control register settings to a new configuration
object.</i>
\subsection page5Sect2Sub3 Implementation of algorithms
During the configuration step the <tt><b>PixelSupervisor</b></tt> and
<tt><b>PixelFEDSupervisor</b></tt>
instantiates the Calibration class for the calibration objects.
When we go to Run the PixelSupervisor invokes the <tt><b>beginCalibration()</b></tt>
method. This method is responsible for sending the <tt><b>beginCalibration()</b></tt>
message to the PixelFEDSupervisors.
After this the PixelSupervisor should execute the <tt><b>calibrationEvent()</b></tt>
in a workloop until it has completed. Again, the code executed in the
PixelFEDSupervisor is responsible for calling the appropriate
supervisors. This gives the maximal flexibility in the calibration
algorithm.
Last, the <tt><b>endCalibration</b></tt> method in the <tt><b>PixelSupervisor</b></tt> is
invoked to complete the analysis of the collected data and report
the results.
In addition it would be nice to take out the code from the PixelSupervisor
and the PixelFEDSupervisor that select the calibration type. One
way of doing this is to create a 'factory' for calibrations in the
PixelCalibrations package. This factory would accept a string from
the calibration mode and create the calibration object and return
it to the PixelSupervisor and the PixelFEDSupervisor. Besides
simplifying the code in these supervisors (they will not need to \\#include
all the calibrations header files) it will also separate out dependencies.
\subsection page5Sect2Sub4 Outstanding tasks and improvements
I will divide these task into three different categories.
The first is algorithm/calibration development. The second
is 'operations', the third is code improvements.
\subsubsection page5Sect2Sub4Sub1 Calibration development
<ul>
<li> Implement algorithm for time walk. Some of the tools are
available. Need to understand how to analyze the data
and set parameters.
<li> Adjust AOH gain setting. Need to discuss a strategy for this.
<li> Need to fix the delay25 calibration; it wraps around.
<li> Linearity adjustment. Steve started to look at Vsf and Vhlddel.
<li> Adjust the ROC analog signal offset and gain. Want to keep the
lowest level well above UB, and the maximum near 255 (or 1024).
<li> In the address level determination if the highest level hit 1023 it
will not be detected. Should allow this.
</ul>
\subsubsection page5Sect2Sub4Sub2 Operation improvements
<ul>
<li> Migrate calibration algorithms to use root objects, like
histograms. This will allow us to write out root files
with the calibration results as well as monitoring
the progress of calibrations.
<li> Tools to view the calibration results should be
migrated to look at root files.
<li> Deploy database.
<li> Use filebased interface and aliases to nor write over
old files. This is basically done. But should modify the
writing of files so that all files in the configuration
is written out again. Otherwise it will be to hard to used.
This is not very complicated, but not sure what is the
best strategy.
<li> Deploy the error logger to make sure that we send relevant
and not to verbose messages.
<li> Have to run with the FEDSpySupervisor.
<li> Run with the power-on sequence. This is work in progress
now and a first try will take place during the week of
Jan. 28, 2008.
<li> We should properly initialize the CCU.
<li> We should try out the schemes for reconfiguring a CCU ring
to drop a CCU.
<li> Is it possible that we can program ROCs on one panel, or blade,
such that we can burn the fuse on the adapter board?
<li> We have to try out the 'popcon' feature for calibrations.
<li> Embed the 'private' words in the FED data. Have code example
now from Will. Need to modify the rawToDigi code to unpack
this information.
</ul>
\subsubsection page5Sect2Sub4Sub3 Code improvements
<ul>
<li> Move DCU readout workloop to configure transition.
<li> Calibration algorithms should run on separate threads.
This is mostly implemented now. Some calibrations
still need to migrate to executing the calibration
in 'steps', and not just as on call.
<li> should use dynamic cast instead of static cast.
<li> Further cleanup in calibrations. A number of the
calibrations contains a large amount of duplication.
<li> Some code like the FEDInterface and FEDCard is too verbose.
Need to review printouts.
<li> There are some exceptions we need to catch. For example
if we try to talk to a non-existing FED base address we
should catch the exception and not just crash.
<li> Should the supervisor applications be self updating like
the trigger supervisor applications? This would then allow
to automatically update progress status during a calibration
and handle when a calibration is complete.
<li> The ROC status should be respected. This would, e.g., allow
us to not generate a failed calibraton when one of the
ROCs can't generate hits.
<li> More consistency checking needed; in particular for the AOH
initialization. Should only initialize portcards that are
used.
</ul>
__________________________________________________________________________________
\page page6 6- Conclusions
This page is just a placeholder for the time being
*/
|