mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 23:37:14 +02:00
Compare commits
778 Commits
filip1
...
2020.04.23
Author | SHA1 | Date | |
---|---|---|---|
337e56d9bf | |||
eb257154c6 | |||
c1ae67ac46 | |||
68f76e5356 | |||
8afa11ed33 | |||
bc389f4825 | |||
095ced153c | |||
a1a5a20845 | |||
c725a05ef8 | |||
815b6a37aa | |||
655a410d43 | |||
97ba81d923 | |||
3d00eed0f0 | |||
a7f5300455 | |||
2f33a1a479 | |||
39fa5e0185 | |||
ba4985ed4d | |||
f811c065d1 | |||
3a1d87728c | |||
0652ff6b5a | |||
373e177274 | |||
6dd6685e7d | |||
38c31fdada | |||
b3fe0e79bc | |||
215e4a56fd | |||
71a68c2022 | |||
55f8497eac | |||
738f341265 | |||
c4ae876ca7 | |||
07cd71f0c7 | |||
9f3ad4e2f4 | |||
ab9fed45fb | |||
a86ae0cb47 | |||
bdf0f9e2b9 | |||
fad10273ed | |||
83283b672a | |||
456b96446f | |||
80e55cd4da | |||
47b0e46f15 | |||
fdb6e3f3d4 | |||
eeed102bf3 | |||
7c7f7e8c70 | |||
262b4b0b16 | |||
83010de9f4 | |||
f2dd146e56 | |||
03af145ee8 | |||
043e62f9fd | |||
6289163ac8 | |||
3ba9e5ec22 | |||
719157f5c3 | |||
d58eb1dc6e | |||
6a6af528ef | |||
112d120a89 | |||
8dfb55d476 | |||
d488f4bea8 | |||
58ab3c4123 | |||
02d7381788 | |||
fb051355b8 | |||
4d8a63eee1 | |||
d0c3e006fb | |||
f22f23849d | |||
94bddb9908 | |||
ed20e17c3a | |||
8fc1578a5e | |||
9753d075f0 | |||
865b4e50ad | |||
597c359ef8 | |||
a108a4df4c | |||
0a6b04ee76 | |||
78dd96357d | |||
9230182e35 | |||
8f7adb130f | |||
16d5321885 | |||
9a6f521f6a | |||
dee0aea378 | |||
0e3cd00579 | |||
6091271f37 | |||
272a8bfaf1 | |||
75692c3539 | |||
46e9b450c0 | |||
40c5ccfe37 | |||
bf1b1a2d9e | |||
b608ec6fbd | |||
4813b5567a | |||
8ab742c2b7 | |||
cb8403f1b0 | |||
b751238fc1 | |||
5479d3a198 | |||
e1768905dd | |||
775d0842e9 | |||
e7e201bd2a | |||
ec9f8305e9 | |||
3307bfab1b | |||
ce2c62000d | |||
cf817c4ec1 | |||
bd01a5f2d2 | |||
b059ba7c90 | |||
89d70097f6 | |||
41d115a394 | |||
45c1d3a553 | |||
17227be4df | |||
7f4f8e8f09 | |||
6809bd6567 | |||
711d40a56e | |||
81911fae3c | |||
f940397e3a | |||
dc53887a48 | |||
5784ce8231 | |||
012c66bbbf | |||
3dbd6a33f7 | |||
0de0d82a1a | |||
4aeb8bf62e | |||
2acf64b09c | |||
dea8cba985 | |||
9467b4c610 | |||
2cb09a590a | |||
5900403f20 | |||
53749c3b77 | |||
1d2f4a8af0 | |||
df2512fb1c | |||
e4942a5c8d | |||
ac1c40d6f9 | |||
8ba0ef093e | |||
cb268aa43f | |||
5192dae9c5 | |||
d818e2570f | |||
ee799b540a | |||
ae3189d836 | |||
9ede0629ef | |||
bd6529a64c | |||
758afad02c | |||
013836bea5 | |||
de6808b170 | |||
4c4ee3ae25 | |||
0e171f291d | |||
bd47c969dd | |||
e4a86e544a | |||
a4fa9ff480 | |||
908afc790d | |||
d6e174ea11 | |||
f255becffe | |||
0a596c689b | |||
a2e019ff36 | |||
959d62ed66 | |||
1d2a46cdbe | |||
aeb9ddfe62 | |||
4a802bd2e4 | |||
c2639854fa | |||
dec4d00fbf | |||
e3f9ef0b25 | |||
9ca86c2edb | |||
c64b09ee79 | |||
c6ddd19c0f | |||
661adaf4ed | |||
4e2f685b76 | |||
6e4a3353a3 | |||
042e5715e6 | |||
e143204ce1 | |||
ff9c37701b | |||
5f3af794ce | |||
e7df925d6b | |||
7859cf78e9 | |||
1b996d1703 | |||
2fcb41426a | |||
032475fc14 | |||
5430288ce8 | |||
a61c5e0206 | |||
582a3c6878 | |||
134611c638 | |||
3431752649 | |||
06bd6dfd53 | |||
fca7d51cb4 | |||
85aca0ffad | |||
fac95516cf | |||
8abc32e7f1 | |||
1efacc9475 | |||
b2d88b441a | |||
75e083ae46 | |||
9699e064d3 | |||
c6c3a68520 | |||
5e92c5b67e | |||
0947cefe08 | |||
6bbcf6173d | |||
ecc3b36204 | |||
3e88beb8a5 | |||
cce659d98c | |||
95d56ad545 | |||
84cd4d8436 | |||
d7319968a7 | |||
a769f7515c | |||
11e7737a2f | |||
913df8ecae | |||
c10e04c4eb | |||
2e2e91b219 | |||
10ba16a9dc | |||
8c8032dc69 | |||
90acd51389 | |||
f38ed8706f | |||
300b0c8105 | |||
d9cfc59df6 | |||
80304c2eaf | |||
fe3a7b0faf | |||
e66d42a43d | |||
ec76590f28 | |||
2fcb2bff75 | |||
2310b5e55d | |||
dca2d098a9 | |||
462bc2e70c | |||
2da3d179ee | |||
5e6a3b7e3d | |||
6a0a931e3e | |||
2bec476b4f | |||
f902bb06ad | |||
c03bc4a6b4 | |||
6118567959 | |||
02b367ffe8 | |||
87d48fd943 | |||
21a1b872bf | |||
3a74ca8fc2 | |||
f4b922165f | |||
247d40f5a6 | |||
8953235268 | |||
3b84684415 | |||
d0da5d3fcd | |||
52a89cbcc5 | |||
d8c9748850 | |||
f42e87e37f | |||
53a3656d5e | |||
fc27cfd663 | |||
6b0bf02a85 | |||
f1bce15a57 | |||
3ea9b86bf5 | |||
4cce0aee62 | |||
dfb1b9ad69 | |||
4d6996bd55 | |||
0ac28c0208 | |||
37c3048c2a | |||
d3dc9a7690 | |||
c4559fadb3 | |||
806a2736c1 | |||
94fcf52e64 | |||
64214f22f9 | |||
36bd91daa3 | |||
40bfca588b | |||
b9446f40d1 | |||
ec66079f65 | |||
e6340456f6 | |||
f42d591845 | |||
e9029ba8f2 | |||
121747352d | |||
4cfea36b93 | |||
a829e69313 | |||
42124ca97c | |||
972f21258a | |||
6bb1188c37 | |||
a57c677105 | |||
254e8f85d8 | |||
56484daf18 | |||
6cc13f9dc1 | |||
93ab8d05d7 | |||
88c65c506f | |||
074636a7d6 | |||
e432e6f90d | |||
a3c686d271 | |||
9f79f132b7 | |||
4a7424d749 | |||
e4f2072067 | |||
8bae1059db | |||
4b39ca6e5f | |||
f0cccf9de8 | |||
89c774dbf7 | |||
5ca3a1b685 | |||
7d7302a90c | |||
ac3230c656 | |||
5761642da0 | |||
70ffdf9709 | |||
af2f2708ad | |||
c42b4b8c0e | |||
d9b88ea7d2 | |||
9f22c80081 | |||
ab6f448e1f | |||
53e5a097ab | |||
e527aad6ab | |||
a0208778c1 | |||
69897d4c78 | |||
41035808e9 | |||
2314fdabd1 | |||
abe63acc79 | |||
688e4e84d9 | |||
0210b7358c | |||
dd84337ef3 | |||
a9e375ed34 | |||
f881133795 | |||
8cbf3c62a9 | |||
ffc09ed19c | |||
3ea2520615 | |||
1dea112742 | |||
d8fccdcefa | |||
981b13494c | |||
7131f77a3a | |||
f08d430d16 | |||
9c89f6a63d | |||
e746256653 | |||
2e78484b61 | |||
1908a82627 | |||
bdf3a010c3 | |||
6bd0256172 | |||
5667353f47 | |||
c4137dc309 | |||
4b7edf2e62 | |||
0194d7ba1c | |||
23dffa47df | |||
5c35a33e02 | |||
a0c222b3c6 | |||
65d95480bd | |||
6cfd0f8962 | |||
6e47f0b7f7 | |||
3c891495db | |||
66b837eb59 | |||
6170c42618 | |||
95030bc55f | |||
69dd5f3b5e | |||
c1fac7cdb7 | |||
de57146e1b | |||
fb75986c55 | |||
e8bdf5a505 | |||
f3598c1f39 | |||
9ac08ad5c9 | |||
bcb4942793 | |||
4b69ac5cfc | |||
7a00732fa8 | |||
30a4a1740f | |||
39ec29c0e6 | |||
b6d9015ed0 | |||
de53747ddd | |||
70c54f4315 | |||
a709384fbb | |||
a1abd7587c | |||
8c8d213b56 | |||
7b31fbc002 | |||
db9aa7589a | |||
28f8a76dcc | |||
dac5ecd123 | |||
71b0ed271e | |||
c223f00511 | |||
639ed52d65 | |||
6943763e3d | |||
4b3b518401 | |||
7379b1e2ef | |||
ed2a69744b | |||
086cbacd84 | |||
af9b25fd67 | |||
504fc2d095 | |||
5cf1502287 | |||
8881542156 | |||
d9ae9a8cc6 | |||
6765eb0c94 | |||
be3d82b7b4 | |||
4e0d1fa711 | |||
619106e05f | |||
9bc60518d8 | |||
12d168a6ef | |||
1a8337540a | |||
16bec25b0c | |||
f178b0da39 | |||
2ece6b945e | |||
1d6be74ee5 | |||
07455bb11e | |||
f4cdd759b0 | |||
796890d1c8 | |||
3486137de3 | |||
d53082c615 | |||
c94f6a2bf2 | |||
2364364697 | |||
ad0fb44573 | |||
9455a5fba1 | |||
a28fa66e54 | |||
e996068328 | |||
1bbd77536c | |||
ace105a268 | |||
f299a34e59 | |||
b1c93bb3df | |||
9e8a874e39 | |||
2c7b730987 | |||
4fe1a2c6df | |||
1322cff405 | |||
7f3d5e8a7e | |||
bf199767dc | |||
eaae54ebf5 | |||
6889741480 | |||
3030c262f1 | |||
6b391a34dc | |||
a2dd35ae38 | |||
e00c5068af | |||
c951b10b0f | |||
c5012a2d5a | |||
58050f72da | |||
eae1fb6609 | |||
5b5e0f109b | |||
f2e69fb5a3 | |||
adf6a4c471 | |||
94382c1ece | |||
28f1f6c1cd | |||
a95ab1e13e | |||
5e9d70948b | |||
b0073597f7 | |||
c4675da0c3 | |||
ba008db29a | |||
950096daf9 | |||
d07873ee39 | |||
f8df11886a | |||
d976c9fcf9 | |||
c4ae32b216 | |||
c689b8b954 | |||
fea94b15d5 | |||
955bc74a91 | |||
8727a93e3e | |||
83221ee955 | |||
398f3734ec | |||
f96f716f39 | |||
781e8fc67f | |||
66e9b80995 | |||
7bde337d58 | |||
1cea6af590 | |||
1539326fda | |||
dfc886a65b | |||
c4e7086d99 | |||
5ce79ec9fa | |||
dc78e23449 | |||
f2c0ff7f98 | |||
32cf46a8a3 | |||
fa2c842745 | |||
6a27207875 | |||
a62d6a2fb8 | |||
5518531620 | |||
fd631ebb71 | |||
21d23be522 | |||
28a5aa8342 | |||
5ee3f5cf4c | |||
72ac2745ea | |||
206041989f | |||
2fff9f5bfe | |||
90c34e4942 | |||
bb26b993ea | |||
d7ad995dd1 | |||
f53d260202 | |||
35556e96d1 | |||
2123fb47a5 | |||
38ad5d7931 | |||
aaeaeab576 | |||
03ec2c53ab | |||
d7e2ab8ec4 | |||
a92d931a8f | |||
615b3b2557 | |||
1797d39216 | |||
0f9fd5cd73 | |||
73b5c3ac57 | |||
18b8720c17 | |||
7de9401bc7 | |||
705ddb7f42 | |||
8eb04c33b5 | |||
cd5d327988 | |||
c3180737ed | |||
ba37a51858 | |||
2417f9cd7b | |||
b61ca18967 | |||
567e821569 | |||
1f64d2a4e2 | |||
96d64778ee | |||
2f2e4da628 | |||
b3587bcee5 | |||
40572b6b23 | |||
031241ae28 | |||
f9fff97f8a | |||
6c5c4f00b3 | |||
ba9a0c7917 | |||
ba3bc9c408 | |||
026771f42d | |||
d05be2519a | |||
11ea071543 | |||
4aba8b6ac0 | |||
82570bc084 | |||
fe467cdf70 | |||
925a750f9a | |||
eb2040f0a7 | |||
4b2cb7ecc1 | |||
badff47663 | |||
1084e5361b | |||
828859838b | |||
9b7ef84515 | |||
aa8610fb04 | |||
798f221764 | |||
4155e301b8 | |||
8c279695de | |||
bc7ebd45df | |||
3fdae431b0 | |||
7b59b7e7d5 | |||
19b85b8e40 | |||
61d7c76d55 | |||
93bb0c9aed | |||
f9d832bf34 | |||
8e771c48bd | |||
5a49182626 | |||
f4a0780b51 | |||
f73a15e786 | |||
fa84d17a19 | |||
12c7389b8d | |||
8006043a97 | |||
45012df95b | |||
8c6da7da1b | |||
f2fc187f13 | |||
fee110c73a | |||
995f0924e5 | |||
eebc1109b0 | |||
97d1c520e6 | |||
3822258dfa | |||
df4f37efc6 | |||
107234f4c5 | |||
59a7a462ab | |||
e16212bd23 | |||
be50344b45 | |||
0a3905802f | |||
833c07707f | |||
9b4fc02b0e | |||
b109ea8d7d | |||
29a7e227a3 | |||
cfd3680176 | |||
87aa5099f2 | |||
030cfacc9b | |||
b318f8126d | |||
17295bf662 | |||
58cadefa61 | |||
e0d10d0e01 | |||
6964326c7f | |||
6cda61a612 | |||
7a66dd08a3 | |||
5f94b5c246 | |||
16f7b42533 | |||
1b06edac9b | |||
d597636c1e | |||
0f99dd141e | |||
da630a8e05 | |||
cfb017f66a | |||
b3ff825ce8 | |||
c6fd13e49c | |||
e6472da5f1 | |||
5de5884341 | |||
b4f3c0586f | |||
aaade64e0b | |||
ffa9bbe8d2 | |||
3c6d7ca4a5 | |||
7242a6901a | |||
2a40c7f48e | |||
ca054626e6 | |||
6e6fcec698 | |||
3d52a2f169 | |||
8a4a6c7004 | |||
288b59d292 | |||
296518819e | |||
2a48f70320 | |||
07f71d3886 | |||
dde24559f3 | |||
b591a42ae7 | |||
032b4117dd | |||
af9c67539f | |||
27d223d199 | |||
26bc737445 | |||
61c495f218 | |||
c3c3f78c59 | |||
400e69cef2 | |||
1cf5033c99 | |||
21ce0055b2 | |||
4b987abf41 | |||
40b62ef5a4 | |||
5bcde789ac | |||
221bb65c0e | |||
02634abbbc | |||
bd95126da2 | |||
4a112104ad | |||
9bc6c44e51 | |||
8c15b52b87 | |||
9e7a133422 | |||
cb8c7eea54 | |||
0d35b966ff | |||
49d47e633d | |||
e23b3b0471 | |||
4f0634fe62 | |||
1980a7d80c | |||
014b8cf9a6 | |||
f123a280bb | |||
7abb18e5c8 | |||
fc0b25cfa7 | |||
aafe049a9b | |||
7a4c1161ab | |||
94013a7fad | |||
aecf3bb7db | |||
3497175b15 | |||
298e1dd1fe | |||
f981825172 | |||
3b2feba3b2 | |||
386b6601a8 | |||
9a48d9b832 | |||
2c5ff0e9bf | |||
e89b65002a | |||
5866e330c1 | |||
5c06549982 | |||
975a5a4cab | |||
57ac5c0dab | |||
6a20a780fe | |||
7afe0c510e | |||
8ec0ac4eb3 | |||
322970ebed | |||
9e40c06786 | |||
caedfbebd5 | |||
3ca52176b7 | |||
867bce8b38 | |||
170db19f48 | |||
4b7ab98135 | |||
72362b0334 | |||
794b6f8090 | |||
7fd5d7c610 | |||
199ecbce80 | |||
d4a2af1693 | |||
e247605b76 | |||
0735f890a3 | |||
3d78b7b6a7 | |||
1b5e939748 | |||
2ef9aa0ea0 | |||
cadb4cff93 | |||
e04242c5fa | |||
434aa78a04 | |||
cf045d8a1d | |||
a98271f0c2 | |||
5c393e6204 | |||
5eaea5fb8d | |||
f0ba8a06ce | |||
4b0fb5029f | |||
b4c207fc4e | |||
f77b6ab068 | |||
0daada9266 | |||
422a928be4 | |||
156ce0df00 | |||
62c4bfab64 | |||
28963e313b | |||
11c1fb0e11 | |||
9ebff9c8a8 | |||
ad907a43be | |||
ea5ac6ad03 | |||
d1ea74120d | |||
0c4ae89cd9 | |||
38b7e23ac4 | |||
08ac9b4ce8 | |||
51a3f3fd4d | |||
29c788b9f7 | |||
0f37481972 | |||
0d787788ea | |||
498a8bda9f | |||
3e874a3650 | |||
3881e2cd21 | |||
ee4aa94bbe | |||
d2e8c3bebc | |||
0d2598bd77 | |||
eebd1552f2 | |||
26958e99ef | |||
7457c56533 | |||
d10d9462a3 | |||
c6dddaba97 | |||
a0bdfcdae3 | |||
d3e60eba80 | |||
10ce82fc5f | |||
b59d69325e | |||
336f8ceb50 | |||
947252c852 | |||
e635ff035c | |||
8dae9243a5 | |||
ce14435c68 | |||
ba0c6ff286 | |||
d14fdc3a3f | |||
8e2b89d488 | |||
5f0a3eaee4 | |||
a23a3f4467 | |||
7f5640dd4e | |||
d191cee548 | |||
97192c5342 | |||
f7893f7f79 | |||
d4d8cbe9bc | |||
7b1cb517c0 | |||
2fe06c7163 | |||
6f6ee19906 | |||
c2f57f5ab0 | |||
160ce17a91 | |||
9686f78300 | |||
25eccdffab | |||
f99ebc7f21 | |||
935f7bc960 | |||
b52a8d2d61 | |||
4bff894782 | |||
1008944a6a | |||
99dc9bd44d | |||
0a34192a8d | |||
09684518c5 | |||
8e2494729b | |||
d9be3250ad | |||
95751766cd | |||
c36dfc3992 | |||
f78a98797f | |||
151c3ee062 | |||
f982a59a7c | |||
100d748154 | |||
b2d39d4785 | |||
c350b53b7f | |||
6a89e3e1a5 | |||
cac353748e | |||
4a97dd0eba | |||
dea402a7e7 | |||
206740efd6 | |||
56703c4886 | |||
1bd1d0d64d | |||
6b363a16fe | |||
6691680091 | |||
2ac421365d | |||
9913194774 | |||
a084ea2d0f | |||
2f61764fd7 | |||
1a60b59a48 | |||
a3c5c16417 | |||
8c40c02fc5 | |||
bdfdd5dbda | |||
1f549d51fa | |||
fc78bb9384 | |||
a6e8be2d67 | |||
5a483eaf29 | |||
dfbf7ab39a | |||
5292075a0a | |||
0bd6563e45 | |||
b0f34f2d4b | |||
6080e90bbb | |||
e76900ca9a | |||
cc0f1d9fcd | |||
dc24cfb9c3 | |||
869eee4d98 | |||
c34190f9f2 | |||
d1d730b779 | |||
b73b98ce3f | |||
ca2c284017 | |||
ce9f76d017 | |||
40bc498e9a | |||
eaf0d8668b | |||
dddd8eb849 | |||
a77964e1dd | |||
9d5cff3b34 | |||
23ea16f4b8 | |||
ca4618d8f4 | |||
ddfb66e999 | |||
7721787748 | |||
e6349d0312 | |||
373cfad645 | |||
d79447ed3a | |||
0b006b5080 | |||
6a780de22f | |||
d9ecec9bf7 | |||
8740e4f683 | |||
79d6ea614a | |||
f0e106f94f | |||
1bdff2b681 | |||
553b7d8568 | |||
e7e4bf13c3 | |||
095a7eac05 | |||
bba6e1667b | |||
21046bcae0 | |||
eec7b22582 | |||
e246a33269 | |||
0a2a5933da | |||
dc1e01b444 | |||
6a71e61c12 | |||
615835f03d | |||
dd6a95d041 | |||
cff4d162c1 |
@ -16,7 +16,9 @@ Checks: '*,
|
||||
-hicpp-braces-around-statements,
|
||||
-google-runtime-references,
|
||||
-google-readability-todo,
|
||||
-google-readability-braces-around-statements'
|
||||
-google-readability-braces-around-statements,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-isolate-declaration'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
AnalyzeTemporaryDtors: false
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -7,11 +7,16 @@ bin/
|
||||
*.out
|
||||
*.toc
|
||||
*.o
|
||||
*.so
|
||||
.*
|
||||
build
|
||||
RELEASE.txt
|
||||
Testing/
|
||||
|
||||
ctbDict.cpp
|
||||
ctbDict.h
|
||||
|
||||
|
||||
|
||||
*.pyc
|
||||
*/__pycache__/*
|
||||
|
28
.travis.yml
28
.travis.yml
@ -4,38 +4,25 @@ language: cpp
|
||||
|
||||
os: linux
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- CONDA_PY=3.6
|
||||
- CONDA_PY=3.7
|
||||
|
||||
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
|
||||
install:
|
||||
- sudo apt-get update
|
||||
- ldd --version
|
||||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
|
||||
- bash miniconda.sh -b -p $HOME/miniconda
|
||||
- export PATH="$HOME/miniconda/bin:$PATH"
|
||||
- source "$HOME/miniconda/etc/profile.d/conda.sh"
|
||||
- rm -f miniconda.sh
|
||||
- hash -r
|
||||
- conda config --set always_yes yes --set changeps1 no
|
||||
- conda config --add channels conda-forge
|
||||
- conda config --add channels slsdetectorgroup
|
||||
- conda update conda
|
||||
- conda update --all
|
||||
- conda install conda-build=3.17
|
||||
- conda install anaconda-client
|
||||
- conda install conda-verify
|
||||
|
||||
# Useful for debugging any issues with conda
|
||||
- conda update -q conda
|
||||
- conda info -a
|
||||
|
||||
|
||||
# Replace dep1 dep2 ... with your dependencies
|
||||
- conda create -q -n test-environment python=$CONDA_PY
|
||||
- source activate test-environment
|
||||
# Useful for debugging any issues with conda
|
||||
- conda create -q -n testenv conda-build anaconda-client conda-verify
|
||||
- conda activate testenv
|
||||
- conda-build .
|
||||
|
||||
script:
|
||||
@ -44,7 +31,8 @@ script:
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: developer
|
||||
tags: true
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
|
||||
include(CheckIPOSupported)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
include(cmake/project_version.cmake)
|
||||
@ -42,6 +41,27 @@ option (SLS_USE_TESTS "TESTS" OFF)
|
||||
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
|
||||
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||
option(SLS_BUILD_DOCS "docs" OFF)
|
||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
||||
|
||||
|
||||
#Enable LTO if available
|
||||
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
||||
|
||||
|
||||
# Use ld.gold if it is available and isn't disabled explicitly
|
||||
option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
|
||||
if (SLS_USE_LD_GOLD)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
|
||||
else ()
|
||||
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
||||
endif ()
|
||||
endif ()
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -66,6 +86,7 @@ target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
|
||||
)
|
||||
|
||||
@ -103,12 +124,16 @@ endif()
|
||||
|
||||
if(SLS_USE_SANITIZER)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
#target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
if(SLS_TUNE_LOCAL)
|
||||
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||
endif()
|
||||
|
||||
|
||||
#rapidjson
|
||||
add_library(rapidjson INTERFACE)
|
||||
target_include_directories(rapidjson INTERFACE
|
||||
@ -124,7 +149,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
||||
)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
|
||||
@ -153,12 +178,11 @@ if (SLS_USE_RECEIVER)
|
||||
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
|
||||
endif (SLS_USE_HDF5)
|
||||
add_subdirectory(slsReceiverSoftware)
|
||||
add_subdirectory(manual/manual-api)
|
||||
endif (SLS_USE_RECEIVER)
|
||||
|
||||
if (SLS_USE_GUI)
|
||||
find_package(Qt4 REQUIRED)
|
||||
find_package(Qwt 6 REQUIRED)
|
||||
find_package(Qwt 6.1 REQUIRED)
|
||||
if (QT4_FOUND AND QWT_FOUND)
|
||||
add_subdirectory(slsDetectorGui)
|
||||
endif()
|
||||
@ -173,25 +197,30 @@ if (SLS_USE_INTEGRATION_TESTS)
|
||||
endif (SLS_USE_INTEGRATION_TESTS)
|
||||
|
||||
if (SLS_USE_PYTHON)
|
||||
set(PYBIND11_CPP_STANDARD -std=c++11)
|
||||
add_subdirectory(libs/pybind11)
|
||||
add_subdirectory(python)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
||||
if (SLS_USE_CTBGUI)
|
||||
add_subdirectory(ctbGui)
|
||||
endif(SLS_USE_CTBGUI)
|
||||
|
||||
configure_file( .clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
|
||||
if (SLS_BUILD_EXAMPLES)
|
||||
add_subdirectory(sample)
|
||||
endif(SLS_BUILD_EXAMPLES)
|
||||
|
||||
add_subdirectory(sample)
|
||||
|
||||
add_subdirectory(docs)
|
||||
|
||||
|
||||
|
||||
if(SLS_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif(SLS_BUILD_DOCS)
|
||||
|
||||
if(SLS_MASTER_PROJECT)
|
||||
# Set install dir CMake packages
|
||||
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/sls)
|
||||
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
|
||||
# Set the list of exported targets
|
||||
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
|
||||
# Generate and install package config file and version
|
||||
|
111
README.md
111
README.md
@ -2,90 +2,67 @@
|
||||
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
|
||||
|
||||
### Binaries
|
||||
Documentation to obtain the binaries via the conda package is available for [lib](https://github.com/slsdetectorgroup/sls_detector_lib) and [gui](https://github.com/slsdetectorgroup/sls_detector_gui)
|
||||
Binaries for the slsDetectorPackage are available through conda.
|
||||
```
|
||||
#Add conda channels
|
||||
conda config --add channels conda-forge
|
||||
conda config --add channels slsdetectorgroup
|
||||
|
||||
conda install slsdetlib #only shared lib and command line
|
||||
conda install slsdet #python bindings (includes slsdetlib)
|
||||
conda install slsdetgui #gui (includes qt4)
|
||||
|
||||
#Install specific version
|
||||
conda install slsdet=2020.03.02.dev0 #developer version from 3 March 2020
|
||||
|
||||
```
|
||||
|
||||
### Source code
|
||||
One can also obtain the source code from this repository and compile while realizing the setup dependencies as required.
|
||||
One can also obtain the source code from this repository and compile.
|
||||
```
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
|
||||
```
|
||||
#### Setup dependencies
|
||||
* Gui Client <br>
|
||||
Requirements: Qt 4.8 and Qwt 6.0
|
||||
```
|
||||
export QTDIR=/usr/local/Trolltech/
|
||||
export QWTDIR=/usr/local/qwt-6.0.1/
|
||||
```
|
||||
If either of them does not exist, the GUI client will not be built.
|
||||
#### Dependencies
|
||||
* Lib: c++11 compiler (gcc=>4.8), ZeroMQ 4
|
||||
* Gui: Qt 4.8 and Qwt 6.0
|
||||
* Calibration wizards and ctbGUI: ROOT
|
||||
* Optional: HDF5
|
||||
|
||||
* Advanced user Calibration wizards<br>
|
||||
Requirements: ROOT
|
||||
```
|
||||
export ROOTSYS=/usr/local/root-5.34
|
||||
```
|
||||
|
||||
#### Compilation
|
||||
|
||||
Compiling can be done in two ways.
|
||||
Compiling can be done in two ways. Either with the convenience script
|
||||
cmk.sh or directly with cmake for more control.
|
||||
|
||||
**1. Compile using script cmk.sh**<br>
|
||||
|
||||
After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br>
|
||||
|
||||
Usage: [-c] [-b] [-h] [-d HDF5 directory] [-j]<br>
|
||||
* -[no option]: only make<br>
|
||||
* -c: Clean<br>
|
||||
* -b: Builds/Rebuilds CMake files normal mode<br>
|
||||
* -h: Builds/Rebuilds Cmake files with HDF5 package<br>
|
||||
* -d: HDF5 Custom Directory<br>
|
||||
* -t: Build/Rebuilds only text client<br>
|
||||
* -r: Build/Rebuilds only receiver<br>
|
||||
* -g: Build/Rebuilds only gui<br>
|
||||
* -j: Number of threads to compile through<br>
|
||||
* -e: Debug mode
|
||||
|
||||
Basic Option:
|
||||
./cmk.sh -b
|
||||
|
||||
For only make:
|
||||
./cmk.sh
|
||||
|
||||
For make clean;make:
|
||||
./cmk.sh -c
|
||||
|
||||
For using hdf5 without custom dir /blabla:
|
||||
./cmk.sh -h -d /blabla
|
||||
|
||||
For rebuilding cmake without hdf5
|
||||
./cmk.sh -b
|
||||
|
||||
For using multiple cores to compile faster:
|
||||
./cmk.sh -j9<br>
|
||||
|
||||
|
||||
For rebuilding only certain sections<br>
|
||||
./cmk.sh -tg #only text client and gui<br>
|
||||
./cmk.sh -r #only receiver<br>
|
||||
Usage: [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-p: Builds/Rebuilds Python API
|
||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||
-d: HDF5 Custom Directory
|
||||
-t: Build/Rebuilds only text client
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-s: Simulator
|
||||
-u: Chip Test Gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
-i: Builds tests
|
||||
|
||||
eg. Rebuild when you switch to a new build and compile in parallel:
|
||||
./cmk.sh -bj5
|
||||
|
||||
**2. Compile without script**<br>
|
||||
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory.
|
||||
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory. This would create a debug build with address sanitizers.
|
||||
```
|
||||
$ cd ..
|
||||
$ mkdir slsDetectorPackage-build
|
||||
$ cd slsDetectorPackage-build
|
||||
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
|
||||
$ make
|
||||
```
|
||||
|
||||
Use the following as an example to compile statically and using specific hdf5 folder
|
||||
```
|
||||
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
|
||||
```
|
||||
After compiling, the libraries and executables will be found at `bin` directory
|
||||
```
|
||||
$ ls bin/
|
||||
gui_client libSlsDetector.a libSlsDetector.so libSlsReceiver.a libSlsReceiver.so
|
||||
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver slsMultiReceiver
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON
|
||||
$ make -j12 #or whatever number of threads wanted
|
||||
```
|
||||
|
@ -0,0 +1,2 @@
|
||||
Draft
|
||||
- dr 4, 8, 16 in eiger -> speed 0, 32 stays same (speed 1)
|
||||
|
@ -15,17 +15,20 @@ configure_package_config_file(
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
|
||||
COMPONENT devel
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
|
||||
install(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
FILE ${PROJECT_NAME_LOWER}-targets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}
|
||||
)
|
||||
endif ()
|
||||
|
40
cmk.sh
40
cmk.sh
@ -10,6 +10,8 @@ DEBUG=0
|
||||
PYTHON=0
|
||||
TESTS=0
|
||||
SIMULATOR=0
|
||||
CTBGUI=0
|
||||
MANUALS=0
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -18,7 +20,7 @@ CMAKE_PRE=""
|
||||
CMAKE_POST=""
|
||||
|
||||
usage() { echo -e "
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
@ -29,9 +31,11 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j]
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-s: Simulator
|
||||
-u: Chip Test Gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
-i: Builds tests
|
||||
-m: Manuals
|
||||
|
||||
Rebuild when you switch to a new build and compile in parallel:
|
||||
./cmk.sh -bj5
|
||||
@ -67,7 +71,7 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bpchd:j:trgeis" opt ; do
|
||||
while getopts ":bpchd:j:trgeisum" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
@ -122,6 +126,14 @@ while getopts ":bpchd:j:trgeis" opt ; do
|
||||
echo "Compiling Options: Simulator"
|
||||
SIMULATOR=1
|
||||
;;
|
||||
m)
|
||||
echo "Compiling Manuals"
|
||||
MANUALS=1
|
||||
;;
|
||||
u)
|
||||
echo "Compiling Options: Chip Test Gui"
|
||||
CTBGUI=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
@ -149,7 +161,7 @@ if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
||||
echo "Enabling Compile Option: TextClient, Receiver and GUI"
|
||||
else
|
||||
if [ $TEXTCLIENT -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=OFF "
|
||||
echo "Enabling Compile Option: TextClient"
|
||||
fi
|
||||
if [ $RECEIVER -eq 1 ]; then
|
||||
@ -181,21 +193,32 @@ fi
|
||||
|
||||
#Debug
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
echo "Debug Option enabled"
|
||||
fi
|
||||
|
||||
#Simulator
|
||||
if [ $SIMULATOR -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SIMULATOR=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_SIMULATOR=ON "
|
||||
echo "Simulator Option enabled"
|
||||
fi
|
||||
|
||||
#Manuals
|
||||
if [ $MANUALS -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_BUILD_DOCS=ON "
|
||||
echo "Manuals Option enabled"
|
||||
fi
|
||||
|
||||
#Chip Test Gui
|
||||
if [ $CTBGUI -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
|
||||
echo "CTB Gui Option enabled"
|
||||
fi
|
||||
|
||||
#Tests
|
||||
if [ $TESTS -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
||||
CMAKE_POST+=" -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
||||
echo "Tests Option enabled"
|
||||
fi
|
||||
|
||||
@ -240,6 +263,9 @@ else
|
||||
make
|
||||
fi
|
||||
|
||||
if [ $MANUALS -eq 1 ]; then
|
||||
make docs
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
mkdir build
|
||||
mkdir install
|
||||
cd build
|
||||
@ -6,7 +7,7 @@ cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=install \
|
||||
-DSLS_USE_TEXTCLIENT=ON \
|
||||
-DSLS_USE_RECEIVER=ON \
|
||||
-DSLS_USE_GUI=OFF \
|
||||
-DSLS_USE_GUI=ON \
|
||||
-DSLS_USE_TESTS=ON \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
|
@ -1,14 +1,4 @@
|
||||
|
||||
# mkdir $PREFIX/lib
|
||||
# mkdir $PREFIX/include
|
||||
|
||||
|
||||
# #Shared and static libraries
|
||||
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
||||
|
||||
|
||||
# #Binaries
|
||||
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
||||
|
||||
echo "|<-------- starting python build"
|
||||
cd python
|
||||
${PYTHON} setup.py install
|
7
conda-recepie/conda_build_config.yaml
Normal file
7
conda-recepie/conda_build_config.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
python:
|
||||
- 3.6
|
||||
- 3.7
|
||||
- 3.8
|
||||
|
||||
numpy:
|
||||
- 1.17
|
9
conda-recepie/copy_ctbgui.sh
Normal file
9
conda-recepie/copy_ctbgui.sh
Normal file
@ -0,0 +1,9 @@
|
||||
mkdir $PREFIX/lib
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
|
||||
|
||||
cp build/bin/ctbGui $PREFIX/bin/.
|
||||
cp build/bin/libctbRootLib.so $PREFIX/lib/.
|
||||
|
@ -1,15 +1,3 @@
|
||||
|
||||
mkdir $PREFIX/lib
|
||||
#Copy the GUI
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
#No libs for gui?
|
||||
|
||||
#Binaries
|
||||
cp build/bin/gui_client $PREFIX/bin/.
|
||||
cp build/bin/slsDetectorGui $PREFIX/bin/.
|
||||
|
||||
|
||||
#Which headers do we need for development??
|
||||
|
||||
# cp include/some_lib.h $PREFIX/include/.
|
@ -5,18 +5,20 @@ mkdir $PREFIX/include
|
||||
mkdir $PREFIX/include/slsDetectorPackage
|
||||
|
||||
#Shared and static libraries
|
||||
cp build/bin/libSlsDetector.so $PREFIX/lib/.
|
||||
cp build/bin/libSlsReceiver.so $PREFIX/lib/.
|
||||
cp build/bin/libSlsSupport.so $PREFIX/lib/.
|
||||
# cp build/bin/libSlsDetector.so $PREFIX/lib/.
|
||||
# cp build/bin/libSlsReceiver.so $PREFIX/lib/.
|
||||
# cp build/bin/libSlsSupport.so $PREFIX/lib/.
|
||||
|
||||
cp build/install/lib/* $PREFIX/lib/
|
||||
|
||||
#Binaries
|
||||
cp build/bin/sls_detector_acquire $PREFIX/bin/.
|
||||
cp build/bin/sls_detector_get $PREFIX/bin/.
|
||||
cp build/bin/sls_detector_put $PREFIX/bin/.
|
||||
cp build/bin/sls_detector_help $PREFIX/bin/.
|
||||
cp build/bin/slsReceiver $PREFIX/bin/.
|
||||
cp build/bin/slsMultiReceiver $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_acquire $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_get $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_put $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_help $PREFIX/bin/.
|
||||
cp build/install/bin/slsReceiver $PREFIX/bin/.
|
||||
cp build/install/bin/slsMultiReceiver $PREFIX/bin/.
|
||||
|
||||
#Which headers do we need for development??
|
||||
cp build/install/include/* $PREFIX/include/slsDetectorPackage/
|
||||
# cp include/some_lib.h $PREFIX/include/.
|
||||
|
||||
cp build/install/include/* $PREFIX/include/
|
||||
cp -r build/install/share/ $PREFIX/share
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "developer"
|
||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 1
|
||||
number: 0
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
@ -16,10 +17,9 @@ requirements:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- cmake
|
||||
# - qwt 6.* #require qt5 investigate befor activating gui
|
||||
# - qt=4.8.7=7
|
||||
- zeromq=4.2.5=hfc679d8_5
|
||||
- pyzmq
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
- zeromq
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
@ -37,6 +37,7 @@ requirements:
|
||||
host:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- zeromq
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
@ -46,75 +47,52 @@ requirements:
|
||||
- xorg-libxfixes
|
||||
|
||||
run:
|
||||
- zeromq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
|
||||
outputs:
|
||||
- name: sls_detector_lib
|
||||
- name: slsdetlib
|
||||
script: copy_lib.sh
|
||||
|
||||
- name: sls_detector
|
||||
requirements:
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- zeromq
|
||||
|
||||
- name: slsdet
|
||||
|
||||
script: build_pylib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- python {{ python }}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- setuptools
|
||||
- sls_detector_lib
|
||||
- pyzmq
|
||||
- pybind11 2.2
|
||||
|
||||
host:
|
||||
- python
|
||||
- pybind11 2.2
|
||||
- pyzmq
|
||||
- sls_detector_lib
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
|
||||
test:
|
||||
imports:
|
||||
- sls_detector
|
||||
- slsdet
|
||||
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
# - {{compiler('cxx')}}
|
||||
|
||||
# - name: sls_detector_gui
|
||||
# version: "refactor"
|
||||
# script: copy_gui.sh
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
# - {{compiler('cxx')}}
|
||||
# - cmake
|
||||
# - qwt 6.*
|
||||
# - qt=4.8.7=7
|
||||
# - zeromq=4.2.5=hfc679d8_5
|
||||
# - pyzmq
|
||||
# - xorg-libx11
|
||||
# - xorg-libice
|
||||
# - xorg-libxext
|
||||
# - xorg-libsm
|
||||
# - xorg-libxau
|
||||
# - xorg-libxrender
|
||||
# - xorg-libxfixes
|
||||
# - {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||
# - {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||
# - {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||
# - {{ cdt('libselinux') }} # [linux]
|
||||
# - {{ cdt('libxdamage') }} # [linux]
|
||||
# - {{ cdt('libxxf86vm') }} # [linux]
|
||||
# run:
|
||||
# - sls_detector_lib=refactor
|
||||
# - qwt 6.*
|
||||
# - qt=4.8.7=7
|
||||
- name: slsdetgui
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
|
89
ctbGui/CMakeLists.txt
Normal file
89
ctbGui/CMakeLists.txt
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
|
||||
find_package(ROOT CONFIG REQUIRED COMPONENTS Core Gui)
|
||||
find_package(TIFF REQUIRED)
|
||||
|
||||
target_include_directories(ROOT::Core INTERFACE "${ROOT_INCLUDE_DIRS}")
|
||||
add_library(ROOT::Flags_CXX IMPORTED INTERFACE)
|
||||
separate_arguments(ROOT_CXX_FLAGS)
|
||||
target_compile_options(ROOT::Flags_CXX INTERFACE ${ROOT_CXX_FLAGS})
|
||||
separate_arguments(ROOT_DEFINITIONS)
|
||||
target_compile_definitions(ROOT::Flags_CXX INTERFACE ${ROOT_DEFINITIONS})
|
||||
|
||||
# This fixes a bug in the linker flags
|
||||
string(REPLACE "-L " "-L" ROOT_EXE_LINKER_FLAGS "${ROOT_EXE_LINKER_FLAGS}")
|
||||
separate_arguments(ROOT_EXE_LINKER_FLAGS)
|
||||
|
||||
# Stuck into using old property method due to separate -L and -l arguments
|
||||
# (A full path to -l is better!)
|
||||
set_property(TARGET ROOT::Flags_CXX PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${ROOT_EXE_LINKER_FLAGS})
|
||||
set_property(TARGET ROOT::Core PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
|
||||
|
||||
|
||||
add_executable(ctbGui
|
||||
ctbGui.cpp
|
||||
ctbMain.cpp
|
||||
ctbDacs.cpp
|
||||
ctbPowers.cpp
|
||||
ctbSlowAdcs.cpp
|
||||
ctbSignals.cpp
|
||||
ctbAdcs.cpp
|
||||
ctbPattern.cpp
|
||||
ctbAcquisition.cpp
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
|
||||
)
|
||||
|
||||
|
||||
#TODO! Replace with target
|
||||
target_include_directories(ctbGui PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
|
||||
)
|
||||
|
||||
# Headders needed for ROOT dictionary generation
|
||||
set( HEADERS
|
||||
ctbDefs.h
|
||||
ctbMain.h
|
||||
ctbDacs.h
|
||||
ctbPattern.h
|
||||
ctbSignals.h
|
||||
ctbAdcs.h
|
||||
ctbAcquisition.h
|
||||
ctbPowers.h
|
||||
ctbSlowAdcs.h
|
||||
)
|
||||
|
||||
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# ROOT dictionary generation
|
||||
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
|
||||
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
||||
add_library(ctbRootLib SHARED ctbDict.cxx)
|
||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(ctbRootLib PUBLIC
|
||||
ROOT::Core
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
${ROOT_LIBRARIES}
|
||||
${ROOT_EXE_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
ctbRootLib PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
target_link_libraries(ctbGui PUBLIC
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
ctbRootLib
|
||||
${TIFF_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(ctbGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
|
||||
)
|
@ -1,17 +1,17 @@
|
||||
|
||||
|
||||
INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
|
||||
SRC= $(SRC:.h=.cpp) ctbDict.cpp
|
||||
SRC= $(INCS:.h=.cpp) ctbDict.cpp
|
||||
LINKDEF=ctbLinkDef.h
|
||||
ZMQLIB=../slsReceiverSoftware/include
|
||||
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
|
||||
|
||||
INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
|
||||
LDFLAG=-L../bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
|
||||
LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
|
||||
#
|
||||
MAIN=ctbGui.cpp
|
||||
|
||||
DESTDIR?=../bin
|
||||
DESTDIR?=../build/bin
|
||||
|
||||
|
||||
OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
|
||||
@ -30,13 +30,13 @@ ctbDict.cpp: $(INCS) $(LINKDEF)
|
||||
|
||||
%.o : %.cpp
|
||||
echo $@
|
||||
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
|
||||
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
|
||||
#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
|
||||
|
||||
|
||||
|
||||
$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
|
||||
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
|
||||
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
|
||||
mv ctbGui $(DESTDIR)
|
||||
|
||||
clean:
|
||||
|
@ -24,13 +24,15 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAcquisition.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "moench03CtbData.h"
|
||||
#include "moench03TCtbData.h"
|
||||
#include "moench03T1CtbData.h"
|
||||
//#include "moench03TCtbData.h"
|
||||
//#include "moench03T1CtbData.h"
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03T1ZmqDataNew.h"
|
||||
#include "moench02CtbData.h"
|
||||
//#include "jungfrau10ModuleData.h"
|
||||
#include "moenchCommonMode.h"
|
||||
@ -39,15 +41,19 @@
|
||||
#include "Mythen3_02_jctbData.h"
|
||||
#include "adcSar2_jctbData.h"
|
||||
#include "moench04CtbZmqData.h"
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
#include "imageZmq16bit.h"
|
||||
#include "imageZmq32bit.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), tenG(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||
|
||||
adcFit=NULL;
|
||||
bitPlot=NULL;
|
||||
@ -70,8 +76,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
||||
cFileSave->SetTextJustify(kTextRight);
|
||||
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
|
||||
|
||||
|
||||
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
|
||||
std::string temp = "run";
|
||||
try {
|
||||
temp = myDet->getFileNamePrefix().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "ctbAcquisition::ctbAcquisition")
|
||||
eFname = new TGTextEntry(hframe, temp.c_str());
|
||||
|
||||
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||
eFname->MapWindow();
|
||||
@ -112,7 +121,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
||||
|
||||
|
||||
|
||||
eOutdir = new TGTextEntry(hframe, (myDet->getFilePath()).c_str());
|
||||
temp = "/tmp/";
|
||||
try {
|
||||
temp = myDet->getFilePath().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get file path.", "ctbAcquisition::ctbAcquisition")
|
||||
eOutdir = new TGTextEntry(hframe, temp.c_str());
|
||||
|
||||
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||
eOutdir->MapWindow();
|
||||
@ -223,7 +236,10 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cbDetType->AddEntry("MOENCH02", MOENCH02);
|
||||
cbDetType->AddEntry("MOENCH04", MOENCH04);
|
||||
// cbDetType->AddEntry("JUNGFRAU1.0", 2);
|
||||
//cbDetType->AddEntry("MOENCH03 T", iiii++);
|
||||
cbDetType->AddEntry("MOENCH03",MOENCH03);
|
||||
cbDetType->AddEntry("IMAGE32BIT",IMAGE32B);
|
||||
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
|
||||
|
||||
//cbDetType->AddEntry("MOENCH03", iiii++);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
// cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
@ -262,7 +278,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
cout << "off "<< endl;
|
||||
// cout << "off "<< endl;
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -281,8 +297,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eSerOff->MapWindow();;
|
||||
eSerOff->SetNumber(5);
|
||||
eSerOff->MapWindow();
|
||||
eSerOff->SetNumber(0);
|
||||
e= eSerOff->TGNumberEntry::GetNumberEntry();
|
||||
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
|
||||
@ -328,6 +344,53 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Image Pixels");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextLeft);
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"X: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixX=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixX->MapWindow();
|
||||
ePixX->SetNumber(400);
|
||||
e= ePixX->TGNumberEntry::GetNumberEntry();
|
||||
ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Y: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixY=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixY->MapWindow();
|
||||
ePixY->SetNumber(400);
|
||||
e= ePixY->TGNumberEntry::GetNumberEntry();
|
||||
ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -596,21 +659,14 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
acqThread = new TThread("acqThread",
|
||||
ctbAcquisition::ThreadHandle,(void*)this);
|
||||
// acqThread->Run();
|
||||
cout <<"Registering progress callback" << endl;
|
||||
try {
|
||||
myDet->registerProgressCallback(&progressCallback,(void*)this);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
cout <<"Registering data callback" << endl;
|
||||
try{
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(true);
|
||||
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
cout <<"Done" << endl;
|
||||
|
||||
// mgAdcs=new TMultiGraph();
|
||||
@ -663,10 +719,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
countsHisto[i]=h1;
|
||||
}
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
photonFinder=NULL;
|
||||
@ -770,7 +822,7 @@ void ctbAcquisition::canvasClicked() {
|
||||
void ctbAcquisition::setCanvas(TCanvas* c) {
|
||||
myCanvas=c;
|
||||
myCanvas->cd();
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%x)->canvasClicked()",this));
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
||||
// myCanvas->AddExec("ex","canvasClicked()");
|
||||
}
|
||||
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||
@ -805,8 +857,6 @@ digital:
|
||||
sample0 (dbit0 + dbit1 +...)
|
||||
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
std::vector <int> dbitlist;
|
||||
|
||||
@ -838,25 +888,24 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
// cout <<"global plot is " << globalPlot << endl;
|
||||
// cout << "*******************************************" <<endl;
|
||||
// cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " npoints:" << data->npoints << " npy: " << data->npy << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
|
||||
cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " nx:" << data->nx << " ny: " << data->ny << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
|
||||
if (globalPlot || cbGetPedestal->IsOn()) {
|
||||
//#ifdef TESTADC
|
||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||
//#endif
|
||||
int ig=0;
|
||||
int i, ii, ich=0, ib, vv;
|
||||
int i, ii, ib;
|
||||
// TList *l= adcStack->GetHists();
|
||||
// TList *l1= countsStack->GetHists();
|
||||
TH1F *h;
|
||||
TH1F *h1;
|
||||
TH1F *hb;
|
||||
int nb, x,y;
|
||||
int x;
|
||||
double ped=0;
|
||||
int vv1,vv2;
|
||||
int dsize=-1;
|
||||
int *val=NULL;
|
||||
int nx=1, ny=1, jj;
|
||||
short unsigned int *va;
|
||||
int nx=1, ny=1;
|
||||
|
||||
if (dataStructure) {
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
||||
@ -866,13 +915,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
nx=eNumCount->GetIntNumber();
|
||||
dr=eDynRange->GetIntNumber();
|
||||
soff=eSerOff->GetIntNumber();
|
||||
// cout <<"deserializer: " << endl;
|
||||
// cout << "Number of chans:\t" << nx << endl;
|
||||
// cout << "Serial Offset:\t" << soff << endl;
|
||||
// cout << "Dynamic range:\t" << dr << endl;
|
||||
|
||||
}
|
||||
|
||||
i=0;
|
||||
int nadc;
|
||||
int ndbit;
|
||||
|
||||
|
||||
tenG = 0;
|
||||
|
||||
|
||||
|
||||
@ -893,8 +947,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
}
|
||||
} else
|
||||
ndbit=dbitlist.size();
|
||||
if (tenG){
|
||||
|
||||
dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
|
||||
if (nDigitalSamples && nAnalogSamples){
|
||||
if (nDigitalSamples>nAnalogSamples)
|
||||
dsize=nDigitalSamples*(32*2+8);
|
||||
else
|
||||
dsize=nAnalogSamples*(32*2+8);
|
||||
} else
|
||||
dsize=32*2*nAnalogSamples+8*nDigitalSamples;
|
||||
|
||||
} else
|
||||
dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
|
||||
|
||||
cout << "dataBytes is " << data->databytes << " expected " << dsize << endl;
|
||||
|
||||
@ -905,7 +969,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
i=0;
|
||||
|
||||
|
||||
char *d_data= data->data+2*nadc*nAnalogSamples;
|
||||
char *d_data;
|
||||
if (tenG)
|
||||
d_data= data->data;
|
||||
else
|
||||
d_data = data->data+2*nadc*nAnalogSamples;
|
||||
char dval;
|
||||
|
||||
|
||||
@ -916,7 +984,8 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
for (int y=0; y<ny; y++) {
|
||||
ped=0;
|
||||
aval=dataStructure->getValue(data->data,x,y);
|
||||
|
||||
//aval=dataStructure->getChannel(data->data,x,y);
|
||||
cout << x << " " <<y << " "<< aval << endl;
|
||||
if (cbGetPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
photonFinder->addToPedestal(aval,x,y);
|
||||
@ -967,7 +1036,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
ig=ii;
|
||||
else
|
||||
ig=adclist.at(ii);
|
||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||
|
||||
// if (tenG)
|
||||
// aval=data->getChannel(i);
|
||||
// else
|
||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||
|
||||
if (plotFlag[ig]) {
|
||||
|
||||
@ -979,10 +1052,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
// cout << data->getChannel(i) << endl;
|
||||
h->SetBinContent(ip+1,aval);
|
||||
h1->Fill(aval);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (tenG) i+=4;
|
||||
|
||||
}
|
||||
|
||||
@ -992,8 +1066,10 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
if (dbitlist.empty()) {
|
||||
for (ip=0; ip<nDigitalSamples; ip++) {
|
||||
for (ig=0; ig<8; ig++) {
|
||||
|
||||
dval=*(d_data+ip*8+ig);
|
||||
if (tenG)
|
||||
dval=*(d_data+ip*(8+32*2)+32*2+ig);
|
||||
else
|
||||
dval=*(d_data+ip*8+ig);
|
||||
|
||||
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
||||
if (bitPlotFlag[ib]) {
|
||||
@ -1010,7 +1086,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
} else {
|
||||
ii=0;
|
||||
int iii=0;
|
||||
int nb=dbitlist.size();
|
||||
for (const auto &value : dbitlist) {
|
||||
ib=value;
|
||||
hb=bitHisto[ib];
|
||||
@ -1082,7 +1157,19 @@ void ctbAcquisition::changePlot(){
|
||||
if (rbPlotOff->IsOn()) {
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
try {
|
||||
myDet->registerDataCallback(nullptr, this);
|
||||
} CATCH_DISPLAY ("Could not get unregister call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(false);
|
||||
} CATCH_DISPLAY ("Could not get unset RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
} else {
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(true);
|
||||
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
for (int ii=0; ii<NADCS; ii++)
|
||||
@ -1176,10 +1263,10 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=NULL;
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
TH2F *h2DMapOld=h2DMapAn;
|
||||
|
||||
// TH2F *h2ScanOld=h2Scan;
|
||||
TH1F *h1DMapOld=h1DMap;
|
||||
int dim=2;
|
||||
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
@ -1187,6 +1274,9 @@ void ctbAcquisition::changeDetector(){
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
ePixX->SetState(kFALSE);
|
||||
ePixY->SetState(kFALSE);
|
||||
|
||||
deserializer=0;
|
||||
if (rb2D->IsOn() ) {//|| rbScan->IsOn()
|
||||
switch (cbDetType->GetSelected()) {
|
||||
@ -1197,10 +1287,66 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
|
||||
} else {
|
||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH03:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
dataStructure=new moench03T1ZmqDataNew(nAnalogSamples);
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case IMAGE32B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq32bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 32bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
case IMAGE16B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq16bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 16bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
// case 1:
|
||||
// cout << "************** T!!!!!!!!!!" << endl;
|
||||
@ -1264,6 +1410,7 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
//photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
|
||||
}
|
||||
if (deserializer) {
|
||||
ny=1;
|
||||
@ -1411,7 +1558,7 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
float off=0;
|
||||
for (int ii=0; ii<NSIGNALS; ii++) {
|
||||
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
|
||||
off+=1.5;
|
||||
off+=static_cast<float>(1.5);
|
||||
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
|
||||
}
|
||||
}
|
||||
@ -1426,88 +1573,89 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
|
||||
void ctbAcquisition::setOutdir() {
|
||||
try {
|
||||
myDet->setFilePath(eOutdir->GetText());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
// // cout << "setting dac! "<< id << endl;
|
||||
|
||||
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
|
||||
// getValue();
|
||||
|
||||
myDet->setFilePath(eOutdir->GetText());
|
||||
} CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFname() {
|
||||
try {
|
||||
myDet->setFileName(eFname->GetText());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
// int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
// char s[100];
|
||||
|
||||
// sprintf(s,"%d",val);
|
||||
|
||||
// dacsValue->SetText(s);
|
||||
|
||||
|
||||
// return val;
|
||||
|
||||
myDet->setFileNamePrefix(eFname->GetText());
|
||||
} CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFindex() {
|
||||
|
||||
try {
|
||||
myDet->setFileIndex(eFindex->GetNumber());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setAcquisitionIndex(eFindex->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
|
||||
}
|
||||
|
||||
|
||||
void ctbAcquisition::setFsave(Bool_t b) {
|
||||
try {
|
||||
myDet->setFileWrite(b);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eFname->SetState(b);
|
||||
eOutdir->SetState(b);
|
||||
|
||||
myDet->setFileWrite(b);
|
||||
eFname->SetState(b);
|
||||
eOutdir->SetState(b);
|
||||
} CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
|
||||
}
|
||||
|
||||
void ctbAcquisition::update() {
|
||||
try {
|
||||
auto retval = myDet->getFileNamePrefix().tsquash("Different values");
|
||||
eFname->SetText(retval.c_str());
|
||||
} CATCH_DISPLAY ("Could not get file name prefix", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getAcquisitionIndex().tsquash("Different values");
|
||||
eFindex->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get acquisition index", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getFileWrite().tsquash("Different values");
|
||||
cFileSave->SetOn(retval);
|
||||
} CATCH_DISPLAY ("Could not get file write", "ctbAcquisition::update")
|
||||
|
||||
eFname->SetText((myDet->getFileName()).c_str());
|
||||
eOutdir->SetText((myDet->getFilePath()).c_str());
|
||||
eFindex->SetNumber(myDet->getFileIndex());
|
||||
cFileSave->SetOn(myDet->getFileWrite());
|
||||
eFname->SetState(cFileSave->IsOn());
|
||||
eOutdir->SetState(cFileSave->IsOn());
|
||||
eFindex->SetState(cFileSave->IsOn());
|
||||
// eMeasurements->SetNumber(myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
roMode=myDet->setReadOutFlags();
|
||||
setReadoutMode(roMode);
|
||||
//nChannels=myDet->getTotalNumberOfChannels();
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
setDigitalSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
|
||||
setReadoutMode(roMode);
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
|
||||
|
||||
updateChans();
|
||||
|
||||
if (dataStructure) {
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
}
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
// eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
// eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
// }
|
||||
|
||||
}
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
dBitOffset = 0;
|
||||
} else {
|
||||
try {
|
||||
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
|
||||
}
|
||||
try {
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
@ -1568,10 +1716,8 @@ void ctbAcquisition::loadPattern() {
|
||||
|
||||
cout << "Load: " << fname << endl;
|
||||
try {
|
||||
myDet->retrieveDetectorSetup(fname);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1582,16 +1728,30 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
|
||||
/** update all infos useful for the acquisition! */
|
||||
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
roMode=myDet->setReadOutFlags();
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
setDigitalSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
dBitOffset = 0;
|
||||
} else {
|
||||
try {
|
||||
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
|
||||
}
|
||||
|
||||
try {
|
||||
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
|
||||
setReadoutMode(roMode);
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
|
||||
|
||||
// iScanStep=0;
|
||||
|
||||
cout << "Run" << endl;
|
||||
bStatus->SetText("Stop");
|
||||
ip=0;
|
||||
@ -1641,11 +1801,9 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
|
||||
} else {
|
||||
StopFlag=1;
|
||||
try {
|
||||
myDet->stopAcquisition();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->stopDetector();
|
||||
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
|
||||
stop=1;
|
||||
bStatus->SetText("Start");
|
||||
// acqThread->Kill();
|
||||
@ -1662,27 +1820,30 @@ void ctbAcquisition::acquisitionFinished() {
|
||||
void ctbAcquisition::startAcquisition(){
|
||||
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
|
||||
stop=0;
|
||||
|
||||
try {
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
|
||||
|
||||
for (int im=0; im<eMeasurements->GetNumber(); im++) {
|
||||
try {
|
||||
myDet->acquire();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
cout << im << endl;
|
||||
if (stop) break;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
|
||||
|
||||
cout << im << endl;
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void* ctbAcquisition::ThreadHandle(void *arg)
|
||||
{
|
||||
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
|
||||
int i=0;
|
||||
|
||||
acq->startAcquisition();
|
||||
acq->acquisitionFinished();
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ctbAcquisition::progressCallback(double f,void* arg) {
|
||||
@ -1715,12 +1876,6 @@ void ctbAcquisition::setPatternCompiler(const char* t) {
|
||||
}
|
||||
void ctbAcquisition::setMeasurements() {
|
||||
|
||||
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eMeasurements->GetNumber());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ctbAcquisition::setAnalogSamples(int n) {
|
||||
@ -1775,11 +1930,11 @@ void ctbAcquisition::setDigitalSamples(int n) {
|
||||
void ctbAcquisition::setReadoutMode(int f) {
|
||||
|
||||
roMode=f;
|
||||
slsDetectorDefs::readOutFlags flags=(slsDetectorDefs::readOutFlags)f;
|
||||
if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
||||
slsDetectorDefs::readoutMode flag=(slsDetectorDefs::readoutMode)f;
|
||||
if (flag == slsDetectorDefs::DIGITAL_ONLY) {
|
||||
nAnalogSamples=0;
|
||||
adclist.clear();
|
||||
} else if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
} else if (flag ==slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
@ -1825,46 +1980,36 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
|
||||
|
||||
void ctbAcquisition::updateChans() {
|
||||
|
||||
/** dbitlist updated */
|
||||
std::vector <int> dbl;
|
||||
// dbit list
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
dbitlist.clear();
|
||||
} else {
|
||||
try {
|
||||
auto retval = myDet->getRxDbitList().tsquash("Different values");
|
||||
dbitlist.clear();
|
||||
if (!retval.empty()) {
|
||||
for (const auto &value : retval)
|
||||
dbitlist.push_back(value);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
|
||||
}
|
||||
|
||||
// adc mask
|
||||
try {
|
||||
dbl = myDet->getReceiverDbitList();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
dbitlist.clear();
|
||||
if (dbl.empty())
|
||||
;
|
||||
else {
|
||||
for (const auto &value : dbl)
|
||||
dbitlist.push_back(value);
|
||||
}
|
||||
uint32_t reg;
|
||||
try {
|
||||
reg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
/* adc updated */
|
||||
adclist.clear();
|
||||
// // updateChans();
|
||||
if (reg!=0xffffffff) {
|
||||
for (int i=0; i<NADCS; i++) {
|
||||
if (reg&(1<<i))
|
||||
adclist.push_back(i);
|
||||
// // else enableFlag[i]=1;
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
adclist.clear();
|
||||
if (retval!=0xffffffff) {
|
||||
for (int i=0; i<NADCS; i++) {
|
||||
if (retval&(1<<i)) {
|
||||
adclist.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} CATCH_DISPLAY ("Could not get adc enable mask.", "ctbAcquisition::updateChans")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbAcquisition::resetPedestal() {
|
||||
if (photonFinder) {
|
||||
photonFinder->newDataSet();
|
||||
@ -1968,20 +2113,22 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeSerialOffset(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// // cout << cbDetType->GetSelected()<< endl;
|
||||
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// // cout << "settings offsets for MYTHEN" << endl;
|
||||
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// cout << "settings offsets for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeDynamicRange(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
@ -1995,6 +2142,7 @@ void ctbAcquisition::ChangeDynamicRange(){
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
@ -2008,6 +2156,24 @@ void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changePlot();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(Long_t a){
|
||||
ChangeImagePixels();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings number of channels for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (deserializer)
|
||||
// changePlot();
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){
|
||||
|
@ -23,7 +23,10 @@ class TH1F;
|
||||
class TGLabel;
|
||||
class TGTextButton;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class detectorData;
|
||||
|
||||
template <class dataType> class slsDetectorData;
|
||||
@ -39,7 +42,7 @@ using namespace std;
|
||||
class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
|
||||
|
||||
private:
|
||||
@ -54,6 +57,9 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
TGNumberEntry *eNumCount;
|
||||
|
||||
|
||||
TGNumberEntry *ePixX;
|
||||
TGNumberEntry *ePixY;
|
||||
|
||||
TGNumberEntry *eFitADC;
|
||||
TGNumberEntry *eBitPlot;
|
||||
TGNumberEntry *eMinRaw;
|
||||
@ -112,7 +118,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
// TH1I *plotAdc[NADCS];
|
||||
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
int plotFlag[NADCS];
|
||||
int bitPlotFlag[NSIGNALS];
|
||||
@ -151,6 +157,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
int globalPlot;
|
||||
int adcPlot;
|
||||
int dbitPlot;
|
||||
int tenG;
|
||||
|
||||
int nAnalogSamples, nDigitalSamples;
|
||||
// int iScanStep;
|
||||
@ -168,7 +175,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
int deserializer;
|
||||
|
||||
public:
|
||||
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbAcquisition(TGVerticalFrame*, sls::Detector*);
|
||||
void setOutdir();
|
||||
void setFname();
|
||||
void setMeasurements();
|
||||
@ -227,7 +234,8 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
void ChangeNumberOfChannels(Long_t);
|
||||
void ChangeDynamicRange();
|
||||
void ChangeDynamicRange(Long_t);
|
||||
|
||||
void ChangeImagePixels();
|
||||
void ChangeImagePixels(Long_t);
|
||||
|
||||
void canvasClicked();
|
||||
void FitADC();
|
||||
|
@ -24,14 +24,14 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det)
|
||||
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det)
|
||||
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -155,7 +155,7 @@ void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
|
||||
string ctbAdc::getAdcAlias() {
|
||||
|
||||
char line[1000];
|
||||
sprintf(line,"ADC%d %s %d %x\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
||||
sprintf(line,"ADC%d %s %d %lx\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
||||
return string(line);
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ void ctbAdc::setPlot(Bool_t b){
|
||||
|
||||
|
||||
|
||||
ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbAdcs::ctbAdcs(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -272,7 +272,6 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
MapWindow();
|
||||
|
||||
char tit[100];
|
||||
|
||||
|
||||
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
|
||||
@ -415,108 +414,41 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
int ctbAdcs::setEnable(int reg) {
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
string retval;
|
||||
int retreg;
|
||||
|
||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
||||
|
||||
// sprintf(args[0],"adcenable");
|
||||
// sprintf(args[1],"%x",reg);
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
// if (reg>-1) {
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
||||
// }
|
||||
if (reg>-1) {
|
||||
try {
|
||||
myDet->setADCEnableMask(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// cout <<"enable: " << retval << endl;;
|
||||
// delete cmd;
|
||||
|
||||
// sscanf(retval.c_str(),"%x",&retreg);
|
||||
try {
|
||||
retreg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
if (reg > -1) {
|
||||
myDet->setADCEnableMask(reg);
|
||||
}
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
eEnableMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eEnableMask->SetHexNumber(retreg);
|
||||
|
||||
return retreg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbAdcs::setInvert(int reg) {
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
string retval;
|
||||
int retreg;
|
||||
|
||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
||||
|
||||
//sprint// f(args[0],"adcinvert");
|
||||
// sprintf(args[1],"%x",reg);
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
|
||||
if (reg>-1) {
|
||||
try {
|
||||
myDet->setADCInvert(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
//retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
||||
}
|
||||
try {
|
||||
retreg=myDet->getADCInvert();
|
||||
} catch (...) {
|
||||
if (reg > -1) {
|
||||
myDet->setADCInvert(reg);
|
||||
}
|
||||
auto retval = myDet->getADCInvert().tsquash("Different values");
|
||||
eInversionMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// cout <<"invert: " << retval << endl;;
|
||||
// delete cmd;
|
||||
|
||||
// sscanf(retval.c_str(),"%x",&retreg);
|
||||
eInversionMask->SetHexNumber(retreg);
|
||||
return retreg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbAdcs::update() {
|
||||
Int_t invreg;//=myDet->readRegister(67);//(120);
|
||||
Int_t disreg;//=myDet->readRegister(120);//(94);
|
||||
// for (int i=0; i<10; i++)
|
||||
// args[i]=aargs[i];
|
||||
|
||||
// string retval;
|
||||
// sprintf(args[0],"adcenable");
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// delete cmd;
|
||||
// // cout << retval << endl;
|
||||
|
||||
// sscanf(retval.c_str(),"adcenable %x",&disreg);
|
||||
|
||||
// eInversionMask->SetHexNumber(invreg);
|
||||
// eEnableMask->SetHexNumber(disreg);
|
||||
Int_t invreg;
|
||||
Int_t disreg;
|
||||
|
||||
disreg=setEnable();
|
||||
invreg=setInvert();
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
sAdc[is]->setAdcAlias(NULL,-1,-1);
|
||||
if (invreg & (1<<is) )
|
||||
@ -528,42 +460,29 @@ void ctbAdcs::update() {
|
||||
sAdc[is]->setEnable(kTRUE);
|
||||
else
|
||||
sAdc[is]->setEnable(kFALSE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Emit("AdcEnable(Int_t)", disreg);
|
||||
|
||||
}
|
||||
string ctbAdcs::getAdcParameters() {
|
||||
|
||||
ostringstream line;
|
||||
|
||||
ostringstream line;
|
||||
line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
|
||||
line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
|
||||
// line << "reg "<< hex << 67 << " " << myDet->readRegister(67) << "# ADC invert reg" << dec << endl;
|
||||
// line << "reg "<< hex << 120 << " " << myDet->readRegister(120) << " # ADC enable reg"<< dec << endl;
|
||||
// // line << "reg "<< hex << 94 << " " << myDet->readRegister(94) << " # ADC enable reg"<< dec << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::CheckAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
@ -571,51 +490,32 @@ void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
void ctbAdcs::CheckHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++) {
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++){
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void ctbAdcs::CheckHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TGraph* ctbAdcs::getGraph(int i) {
|
||||
|
||||
// if (i>=0 && i<NADCS)
|
||||
// return sAdc[i]->getGraph();
|
||||
// return NULL;
|
||||
// }
|
||||
|
||||
int ctbAdcs::setAdcAlias(string line) {
|
||||
|
||||
int is=-1, plot=0, color=-1;
|
||||
@ -657,33 +557,23 @@ void ctbAdcs::AdcEnable(Int_t b){
|
||||
|
||||
void ctbAdcs::ToggledAdcEnable(Int_t b){
|
||||
|
||||
|
||||
Int_t oreg=setEnable();//myDet->readRegister(67);
|
||||
Int_t oreg=setEnable();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
if (sAdc[b]->getEnable())
|
||||
oreg|=m;
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
setEnable(oreg);//)writeRegister(67, oreg);
|
||||
//oreg=setEnable();//myDet->readRegister(67);
|
||||
|
||||
setEnable(oreg);
|
||||
|
||||
Emit("AdcEnable(Int_t)", oreg);
|
||||
//cout << "enable!" << endl;
|
||||
// Emit("ToggledAdcPlot(Int_t)", b);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
|
||||
// char val[1000];
|
||||
Int_t oreg=setInvert();//myDet->readRegister(67);
|
||||
Int_t oreg=setInvert();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
@ -692,15 +582,7 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
setInvert(oreg);//)writeRegister(67, oreg);
|
||||
// oreg=setInvert();//myDet->readRegister(67);
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
//sprintf(val,"%X",oreg);
|
||||
//eInversionMask->SetHexNumber(oreg);
|
||||
setInvert(oreg);
|
||||
}
|
||||
|
||||
|
||||
@ -710,22 +592,23 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
Pixel_t ctbAdcs::getColor(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getColor();
|
||||
return static_cast<Pixel_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnabled(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnabled();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnable(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnable();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getPlot(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getPlot();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
@ -28,7 +28,10 @@ class TGTab;
|
||||
|
||||
class TGraph;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -49,10 +52,10 @@ class ctbAdc : public TGHorizontalFrame {
|
||||
// TGraph *gADC;
|
||||
|
||||
int id;
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
|
||||
ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
|
||||
|
||||
|
||||
void setAdcAlias(char *tit, int plot, int color);
|
||||
@ -89,7 +92,7 @@ class ctbAdcs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
ctbAdc *sAdc[NADCS];
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
TGTextButton *bCheckAll;
|
||||
@ -115,7 +118,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setAdcAlias(string line);
|
||||
string getAdcAlias();
|
||||
string getAdcParameters();
|
||||
|
@ -9,17 +9,14 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbDacs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
|
||||
@ -104,80 +101,76 @@ int ctbDac::setLabel(char *tit, int mv) {
|
||||
}
|
||||
|
||||
string ctbDac::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
int ctbDac::getMoenchDacId() {
|
||||
slsDetectorDefs::dacIndex moenchDacIndices[8] = {slsDetectorDefs::VBP_COLBUF, slsDetectorDefs::VIPRE, slsDetectorDefs::VIN_CM, slsDetectorDefs::VB_SDA, slsDetectorDefs::VCASC_SFP, slsDetectorDefs::VOUT_CM, slsDetectorDefs::VIPRE_CDS, slsDetectorDefs::IBIAS_SFP};
|
||||
|
||||
if (id >= 8) {
|
||||
return id;
|
||||
}
|
||||
return static_cast<int>(moenchDacIndices[id]);
|
||||
}
|
||||
|
||||
void ctbDac::setValue(Long_t a) {setValue();}
|
||||
|
||||
void ctbDac::setValue() {
|
||||
|
||||
|
||||
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn()); } catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
void ctbDac::setOn(Bool_t b) {
|
||||
|
||||
|
||||
|
||||
// cout << "setting dac! "<< id << endl;
|
||||
|
||||
if ( dacsLabel->IsOn()) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
myDet->setDAC(-100, (slsDetectorDefs::dacIndex)id, 0);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), -100, false);
|
||||
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||
}
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
int ctbDac::getValue() {
|
||||
int val;
|
||||
try {
|
||||
val=myDet->setDAC(-1,(slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
char s[100];
|
||||
cout << "dac " << id << " " << val << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>=0) {
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsUnit->IsOn()).tsquash("Different values");
|
||||
cout << "dac " << id << " " << val << endl;
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val >= 0) {
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
return val;
|
||||
} CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
@ -192,14 +185,12 @@ ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(
|
||||
}
|
||||
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
|
||||
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
|
||||
dacs[NDACS]->setLabel("ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel("High Voltage",3);
|
||||
|
||||
dacs[NDACS]->setLabel((char*)"ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
|
||||
}
|
||||
|
||||
|
||||
int ctbDacs::setDacAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
char tit[100];
|
||||
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
|
||||
@ -217,7 +208,6 @@ string ctbDacs::getDacAlias() {
|
||||
for (int i=0; i<NDACS; i++)
|
||||
line << dacs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -225,8 +215,6 @@ string ctbDacs::getDacAlias() {
|
||||
|
||||
|
||||
string ctbDacs::getDacParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NDACS; i++) {
|
||||
@ -234,18 +222,12 @@ string ctbDacs::getDacParameters() {
|
||||
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||
}
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbDacs::update() {
|
||||
|
||||
for (int idac=0; idac<NDACS+1; idac++) {
|
||||
dacs[idac]->getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ class TGNumberEntry;
|
||||
class TGCheckButton;
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -32,9 +35,9 @@ class ctbDac : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbDac(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbDac(TGGroupFrame*, int , sls::Detector*);
|
||||
void setValue();
|
||||
void setValue(Long_t);
|
||||
int getValue();
|
||||
@ -42,7 +45,7 @@ class ctbDac : public TGHorizontalFrame {
|
||||
|
||||
int setLabel(char *tit, int mv);
|
||||
string getLabel();
|
||||
|
||||
int getMoenchDacId();
|
||||
|
||||
|
||||
ClassDef(ctbDac,0)
|
||||
@ -51,14 +54,12 @@ class ctbDac : public TGHorizontalFrame {
|
||||
class ctbDacs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
|
||||
|
||||
ctbDac *dacs[NDACS+2];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbDacs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbDacs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
int setDacAlias(string line);
|
||||
// int setDacAlias(string line);
|
||||
|
84
ctbGui/ctbDefs.h
Executable file
84
ctbGui/ctbDefs.h
Executable file
@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <chrono>
|
||||
|
||||
//#include "sls_detector_exceptions.h"
|
||||
//#include "ansi.h"
|
||||
#define RED "\x1b[31m"
|
||||
#define RESET "\x1b[0m"
|
||||
#define BOLD "\x1b[1m"
|
||||
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
|
||||
|
||||
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { ctbDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { ctbDefs::HandleExceptions(__VA_ARGS__); }
|
||||
|
||||
class ctbDefs {
|
||||
public:
|
||||
/**
|
||||
* Empty Constructor
|
||||
*/
|
||||
ctbDefs(){};
|
||||
|
||||
// convert double seconds to chrono ns
|
||||
static std::chrono::nanoseconds ConvertDoubleStoChronoNS(double timeS) {
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
return duration_cast<nanoseconds>(duration<double>(timeS));
|
||||
}
|
||||
|
||||
// convert chrono ns to doubel s
|
||||
static double ConvertChronoNStoDoubleS(std::chrono::nanoseconds timeNs) {
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
return duration_cast<duration<double>>(timeNs).count();
|
||||
}
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
throw;
|
||||
} /* catch (const sls::SocketError &e) {
|
||||
throw;
|
||||
} catch (const sls::SharedMemoryError &e) {
|
||||
throw;
|
||||
} */catch (const std::exception &e) {
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
}
|
||||
};
|
||||
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
template <class S, typename RT, typename... CT>
|
||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||
RT (S::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
throw;
|
||||
} /*catch (const sls::SocketError &e) {
|
||||
throw;
|
||||
} catch (const sls::SharedMemoryError &e) {
|
||||
throw;
|
||||
} */catch (const std::exception &e) {
|
||||
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
(s->*somefunc)(Args...);
|
||||
}
|
||||
};
|
||||
|
||||
static void ExceptionMessage(std::string message,
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
// because sls_detector_exceptions cannot be included
|
||||
if (exceptionMessage.find("hared memory") != std::string::npos) {
|
||||
throw;
|
||||
}
|
||||
if (exceptionMessage.find("annot connect") != std::string::npos) {
|
||||
throw;
|
||||
}
|
||||
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
|
||||
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
};
|
||||
|
||||
};
|
@ -9,11 +9,11 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
//#include "sls_receiver_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDefs.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -45,9 +45,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
} else if (strcmp(argv[ia],"-par")==0) {
|
||||
if (ia+1<argc) {
|
||||
pfname=argv[ia+1];
|
||||
pfname=argv[ia+1];
|
||||
ia++;
|
||||
pf=1;
|
||||
pf=1;
|
||||
}
|
||||
|
||||
|
||||
@ -61,31 +61,27 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
cout << " *** " << endl;
|
||||
sls::Detector *myDet = nullptr;
|
||||
try {
|
||||
/****** Create detector ****************/
|
||||
myDet=new sls::Detector(id);
|
||||
cout << "Created multi detector id " << id << endl;
|
||||
|
||||
/****** Create detector ****************/
|
||||
multiSlsDetector *myDet=new multiSlsDetector(id);
|
||||
// myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
||||
|
||||
//cout << id << " " << myDet << " " << myDet->setOnline() << endl;
|
||||
if (cf) {
|
||||
myDet->readConfigurationFile(cfname);
|
||||
} else
|
||||
cout << "No config file specified" << endl;
|
||||
|
||||
cout << "aa" << endl;
|
||||
|
||||
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
|
||||
|
||||
|
||||
cout << "bb" << endl;
|
||||
if (pf) {
|
||||
myDet->retrieveDetectorSetup(pfname);
|
||||
} else
|
||||
cout << "No parameter file specified" << endl;
|
||||
|
||||
|
||||
|
||||
if (cf) {
|
||||
myDet->loadConfig(cfname);
|
||||
cout << "Config file loaded successfully" << endl;
|
||||
} else {
|
||||
cout << "No config file specified" << endl;
|
||||
}
|
||||
cout << "hostname " << myDet->getHostname() << endl;
|
||||
|
||||
if (pf) {
|
||||
myDet->loadParameters(pfname);
|
||||
cout << "Loaded parameter file successfully" << endl;
|
||||
} else{
|
||||
cout << "No parameter file specified" << endl;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not create detector/ load config/parameters.", "ctbGui::main")
|
||||
|
||||
/***********Create GUI stuff *******************/
|
||||
TApplication theApp("App",&argc,argv);
|
||||
@ -141,7 +137,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
gROOT->ForceStyle();
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(),myDet);
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
|
||||
|
||||
cout << " *** " << argc << endl;
|
||||
for (int ia=0; ia<argc; ia++)
|
||||
|
@ -29,15 +29,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDacs.h"
|
||||
#include "ctbSlowAdcs.h"
|
||||
@ -52,7 +50,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
||||
ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
|
||||
: TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
|
||||
|
||||
myDet=det;
|
||||
@ -147,7 +145,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
||||
tf = mtab->AddTab("Power Supplies");
|
||||
page=new TGVerticalFrame(tf, 1500,1200);
|
||||
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||
pwrs=new ctbPowers(page, myDet);
|
||||
pwrs=new ctbPowers(page, myDet);
|
||||
|
||||
i_pwrs=i_page++;
|
||||
|
||||
@ -155,7 +153,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
||||
tf = mtab->AddTab("Sense");
|
||||
page=new TGVerticalFrame(tf, 1500,1200);
|
||||
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||
senses=new ctbSlowAdcs(page, myDet);
|
||||
senses=new ctbSlowAdcs(page, myDet);
|
||||
|
||||
i_senses=i_page++;
|
||||
|
||||
@ -261,8 +259,10 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
||||
|
||||
cout << "connect mtab" << endl;
|
||||
|
||||
|
||||
try{
|
||||
setReadoutMode(pat->getReadoutMode());
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
setADCEnable(adcs->setEnable());
|
||||
setAnalogSamples(pat->getAnalogSamples());
|
||||
setDigitalSamples(pat->getDigitalSamples());
|
||||
@ -304,7 +304,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
loadAlias(fi.fFilename);
|
||||
@ -320,13 +320,12 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Save file: %s (dir: %s)\n", fi.fFilename);
|
||||
printf("Save file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveAlias(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
|
||||
cout << "Open Parameters" << endl;
|
||||
{
|
||||
@ -343,23 +342,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: //fMenuFile->AddEntry("Save Parameters", im++);
|
||||
cout << "Save Parameters" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
TGFileInfo fi;
|
||||
//fi.fFileTypes = filetypes;
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveParameters(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||
case 3: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||
cout << "Open configuration" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -375,23 +358,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // fMenuFile->AddEntry("Save Configuration", im++);
|
||||
cout << "Save configuration" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
TGFileInfo fi;
|
||||
//fi.fFileTypes = filetypes;
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveConfiguration(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||
case 4: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||
cout << "Open pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -407,7 +374,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
case 5: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
cout << "Save pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -419,11 +386,11 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveParameters(fi.fFilename);
|
||||
savePattern(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // fMenuFile->AddEntry("Exit", im++);
|
||||
case 6: // fMenuFile->AddEntry("Exit", im++);
|
||||
CloseWindow();
|
||||
|
||||
default:
|
||||
@ -439,7 +406,7 @@ int ctbMain::setADCPlot(Int_t i) {
|
||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||
// acq->setGraph(i,adcs->getGraph(i));
|
||||
acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -448,120 +415,31 @@ int ctbMain::setSignalPlot(Int_t i) {
|
||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||
// acq->setGraph(i,adcs->getGraph(i));
|
||||
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadConfiguration(string fname) {
|
||||
|
||||
myDet->readConfigurationFile(fname);
|
||||
|
||||
// string line;
|
||||
// int i;
|
||||
// ifstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
// while ( getline (myfile,line) )
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::loadConfiguration(string fname) {
|
||||
try{
|
||||
myDet->loadConfig(fname);
|
||||
} CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::saveConfiguration(string fname) {
|
||||
|
||||
|
||||
myDet->writeConfigurationFile(fname);
|
||||
// string line;
|
||||
// int i;
|
||||
// ofstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
|
||||
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::loadParameters(string fname) {
|
||||
try{
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadParameters(string fname) {
|
||||
|
||||
myDet->retrieveDetectorSetup(fname);
|
||||
|
||||
// string line;
|
||||
// int i;
|
||||
// ifstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
// while ( getline (myfile,line) )
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::savePattern(string fname) {
|
||||
try{
|
||||
myDet->savePattern(fname);
|
||||
} CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::saveParameters(string fname) {
|
||||
|
||||
|
||||
string line;
|
||||
int i;
|
||||
myDet->dumpDetectorSetup(fname);
|
||||
// ofstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
|
||||
// myfile << dacs->getDacParameters();
|
||||
// myfile << sig->getSignalParameters();
|
||||
// myfile << adcs->getAdcParameters();
|
||||
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadAlias(string fname) {
|
||||
|
||||
|
||||
@ -589,7 +467,7 @@ int ctbMain::loadAlias(string fname) {
|
||||
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
|
||||
pat->setPatternAlias(line);
|
||||
// cout << "---------" << line<< endl;
|
||||
} else if (sscanf(line.c_str(),"V%s",&i)>0) {
|
||||
} else if (sscanf(line.c_str(),"V%s",aaaa)>0) {
|
||||
if (pwrs) pwrs->setPwrAlias(line);
|
||||
// cout << "+++++++++" << line<< endl;
|
||||
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
|
||||
@ -615,7 +493,6 @@ int ctbMain::saveAlias(string fname) {
|
||||
|
||||
|
||||
string line;
|
||||
int i;
|
||||
ofstream myfile (fname.c_str());
|
||||
if (myfile.is_open())
|
||||
{
|
||||
|
@ -33,7 +33,10 @@ class ctbPowers;
|
||||
|
||||
class ctbSignals;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
class ctbPattern;
|
||||
class ctbAdcs;
|
||||
@ -47,7 +50,7 @@ class ctbMain : public TGMainFrame {
|
||||
private:
|
||||
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
|
||||
@ -96,15 +99,14 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
ctbMain(const TGWindow *p, multiSlsDetector *det);
|
||||
ctbMain(const TGWindow *p, sls::Detector *det);
|
||||
|
||||
|
||||
int loadAlias(string fname);
|
||||
int saveAlias(string fname);
|
||||
int loadParameters(string fname);
|
||||
int saveParameters(string fname);
|
||||
int loadConfiguration(string fname);
|
||||
int saveConfiguration(string fname);
|
||||
void loadParameters(string fname);
|
||||
void savePattern(string fname);
|
||||
void loadConfiguration(string fname);
|
||||
void tabSelected(Int_t);
|
||||
int setADCPlot(Int_t);
|
||||
int setSignalPlot(Int_t);
|
||||
|
@ -24,15 +24,16 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbPattern.h"
|
||||
#include "multiSlsDetector.h"
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include <chrono>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
|
||||
@ -116,47 +117,29 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
}
|
||||
|
||||
void ctbLoop::setNLoops() {
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
|
||||
start=-1;
|
||||
stop=-1;
|
||||
n=eLoopNumber->GetNumber();
|
||||
try{
|
||||
myDet->setPatternLoops(id,start, stop,n);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
myDet->setPatternLoopCycles(id, eLoopNumber->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbLoop::update() {
|
||||
try{
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
std::array<int, 3> loop;
|
||||
|
||||
try {
|
||||
loop=myDet->getPatternLoops(id);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto loop = myDet->getPatternLoopCycles(id).tsquash("Different values");
|
||||
eLoopNumber->SetNumber(loop);
|
||||
auto loopaddr = myDet->getPatternLoopAddresses(id).tsquash("Different values");
|
||||
eLoopStartAddr->SetHexNumber(loopaddr[0]);
|
||||
eLoopStopAddr->SetHexNumber(loopaddr[1]);
|
||||
|
||||
|
||||
eLoopStartAddr->SetHexNumber(loop[0]);
|
||||
eLoopStopAddr->SetHexNumber(loop[1]);
|
||||
eLoopNumber->SetNumber(loop[2]);
|
||||
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
|
||||
}
|
||||
|
||||
|
||||
|
||||
ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
ctbWait::ctbWait(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
char tit[100];
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -211,41 +194,25 @@ ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
|
||||
|
||||
void ctbWait::setWaitTime() {
|
||||
|
||||
|
||||
Long64_t t=eWaitTime->GetNumber();
|
||||
try{
|
||||
t=myDet->setPatternWaitTime(id,t);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setPatternWaitTime(id, eWaitTime->GetNumber());
|
||||
|
||||
} CATCH_DISPLAY ("Could not set pattern wait time for level " + to_string(id) + ".", "ctbWait::setWaitTime")
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbWait::update() {
|
||||
|
||||
int start, stop, n, addr;
|
||||
|
||||
Long64_t t=-1;
|
||||
try{
|
||||
|
||||
t=myDet->setPatternWaitTime(id,t);
|
||||
} catch (...) {
|
||||
auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
|
||||
auto addr = myDet->getPatternWaitAddr(id).tsquash("Different values");
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
addr=myDet->setPatternWaitAddr(id,-1);
|
||||
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eWaitAddr->SetHexNumber(addr);
|
||||
eWaitTime->SetNumber(t);
|
||||
eWaitTime->SetNumber(time);
|
||||
|
||||
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbWait::update")
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +223,7 @@ void ctbWait::update() {
|
||||
|
||||
|
||||
|
||||
ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -490,7 +457,7 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
sprintf(tit, "Number of cycles: ");
|
||||
sprintf(tit, "Number of triggers: ");
|
||||
|
||||
label= new TGLabel(hframe, tit);
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
|
||||
@ -500,14 +467,14 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
|
||||
|
||||
eCycles = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
eTriggers = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELNoLimits);
|
||||
hframe->AddFrame( eCycles,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eCycles->MapWindow();
|
||||
eCycles->Resize(150,30);
|
||||
e= eCycles->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setCycles()");
|
||||
hframe->AddFrame( eTriggers,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eTriggers->MapWindow();
|
||||
eTriggers->Resize(150,30);
|
||||
e= eTriggers->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setTriggers()");
|
||||
|
||||
|
||||
// sprintf(tit, "Number of measurements: ");
|
||||
@ -809,134 +776,64 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
}
|
||||
|
||||
void ctbPattern::update() {
|
||||
try{
|
||||
auto retval = myDet->getRUNClock().tsquash("Different values");
|
||||
eRunClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get run clock.", "ctbPattern::update")
|
||||
|
||||
int start, stop, n, addr;
|
||||
try{
|
||||
auto retval = myDet->getADCClock().tsquash("Different values");
|
||||
eAdcClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc clock.", "ctbPattern::update")
|
||||
|
||||
Long_t t;
|
||||
try{
|
||||
auto retval = myDet->getADCPhase().tsquash("Different values");
|
||||
eAdcClkPhase->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc phase shift.", "ctbPattern::update")
|
||||
|
||||
try{
|
||||
auto retval = myDet->getADCPipeline().tsquash("Different values");
|
||||
eAdcPipeline->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc pipeline.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getDBITClock().tsquash("Different values");
|
||||
eDBitClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit clock.", "ctbPattern::update")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
auto retval = myDet->getDBITPhase().tsquash("Different values");
|
||||
eDBitClkPhase->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||
|
||||
eRunClkFreq->SetNumber(n);
|
||||
try{
|
||||
auto retval = myDet->getDBITPipeline().tsquash("Different values");
|
||||
eDBitPipeline->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit pipeline.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfFrames().tsquash("Different values");
|
||||
eFrames->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "ctbPattern::update")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
auto timeNs = myDet->getPeriod().tsquash("Different values");
|
||||
ePeriod->SetNumber(ctbDefs::ConvertChronoNStoDoubleS(timeNs));
|
||||
} CATCH_DISPLAY ("Could not get period.", "ctbPattern::update")
|
||||
|
||||
eAdcClkFreq->SetNumber(n);
|
||||
try{
|
||||
auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
|
||||
eTriggers->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PHASE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eAdcClkPhase->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eAdcPipeline->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eDBitClkFreq->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eDBitClkPhase->SetNumber(n);
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,0,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eDBitPipeline->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eFrames->SetNumber(n);
|
||||
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ePeriod->SetNumber(((Double_t)n)*1E-9);
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eCycles->SetNumber(n);
|
||||
|
||||
|
||||
// try {
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
|
||||
// } catch (...) {
|
||||
|
||||
// cout << "Do nothing for this error" << endl;
|
||||
// }
|
||||
|
||||
// eMeasurements->SetNumber(n);
|
||||
|
||||
start=-1;
|
||||
stop=-1;
|
||||
n=-1;
|
||||
std::array<int, 3> loop;
|
||||
|
||||
try {
|
||||
loop=myDet->getPatternLoops(-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eStartAddr->SetHexNumber(loop[0]);
|
||||
eStopAddr->SetHexNumber(loop[1]);
|
||||
try{
|
||||
auto retval = myDet->getPatternLoopAddresses(-1).tsquash("Different values");
|
||||
eStartAddr->SetHexNumber(retval[0]);
|
||||
eStopAddr->SetHexNumber(retval[1]);
|
||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||
|
||||
for (int iloop=0; iloop<NLOOPS; iloop++) {
|
||||
eLoop[iloop]->update();
|
||||
|
||||
}
|
||||
|
||||
for (int iwait=0; iwait<NWAITS; iwait++) {
|
||||
@ -946,8 +843,9 @@ try {
|
||||
getAnalogSamples();
|
||||
getDigitalSamples();
|
||||
getReadoutMode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setFile() {
|
||||
patternFileChanged(patternFile->GetText());
|
||||
|
||||
@ -984,7 +882,8 @@ void ctbPattern::setPatternAlias(string line){
|
||||
|
||||
string ctbPattern::getPatternAlias() {
|
||||
char line[100000];
|
||||
sprintf("PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
||||
sprintf(line, "PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
@ -1032,154 +931,103 @@ string ctbPattern::getPatternFile() {
|
||||
}
|
||||
|
||||
void ctbPattern::setFrames() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setNumberOfFrames(eFrames->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
|
||||
}
|
||||
|
||||
void ctbPattern::setCycles() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
void ctbPattern::setTriggers() {
|
||||
try{
|
||||
myDet->setNumberOfTriggers(eTriggers->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setTriggers")
|
||||
}
|
||||
|
||||
// void ctbPattern::setMeasurements() {
|
||||
// try {
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eFrames->GetNumber());
|
||||
// } catch (...) {
|
||||
|
||||
// cout << "Do nothing for this error" << endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setPeriod() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,ePeriod->GetNumber()*1E9);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
try{
|
||||
auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
|
||||
myDet->setPeriod(timeNs);
|
||||
} CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setAdcFreq() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCClock(eAdcClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setRunFreq() {
|
||||
try{
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setRUNClock(eRunClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitFreq() {
|
||||
// cout <<"Not setting dbit frequency to " << eDBitClkFreq->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,eDBitClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITClock(eDBitClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setAdcPhase() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setADCPhase(eAdcClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitPhase() {
|
||||
// cout <<"Not setting dbit phase to " << eDBitClkPhase->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,eDBitClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITPhase(eDBitClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAdcPipeline() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,eAdcPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCPipeline(eAdcPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setDBitPipeline() {
|
||||
// cout <<"Not setting dbit pipeline to " << eDBitPipeline->GetNumber() << endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,eDBitPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setDBITPipeline(eDBitPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAnalogSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,eAnalogSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
analogSamplesChanged(eAnalogSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::setDigitalSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,eDigitalSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
digitalSamplesChanged(eDigitalSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::setReadoutMode(Bool_t) {
|
||||
// cout << "Set readout mode to be implemented" << endl;
|
||||
slsDetectorDefs::readOutFlags flags;
|
||||
if (cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::ANALOG_AND_DIGITAL;
|
||||
else if (~cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::DIGITAL_ONLY;
|
||||
else if (cbAnalog->IsOn() && ~cbDigital->IsOn()) flags=slsDetectorDefs::NORMAL_READOUT;
|
||||
else flags=slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
try {
|
||||
myDet->setReadOutFlags(flags);
|
||||
} catch (...) {
|
||||
slsDetectorDefs::readoutMode flag = slsDetectorDefs::ANALOG_ONLY;
|
||||
if (cbAnalog->IsOn() && cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::ANALOG_AND_DIGITAL;
|
||||
else if (~cbAnalog->IsOn() && cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::DIGITAL_ONLY;
|
||||
else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::ANALOG_ONLY;
|
||||
else {
|
||||
throw runtime_error("unkown readout flag");
|
||||
}
|
||||
myDet->setReadoutMode(flag);
|
||||
cout << "Set readout flag: " << flag << endl;
|
||||
} CATCH_DISPLAY ("Could not set readout flag", "ctbPattern::setReadoutMode")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
cout << "Set readout flags " << hex << flags << dec << endl;
|
||||
getReadoutMode();
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::readoutModeChanged(int flags) {
|
||||
@ -1188,71 +1036,69 @@ void ctbPattern::readoutModeChanged(int flags) {
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
// cout << "Get readout mode to be implemented" << endl;
|
||||
slsDetectorDefs::readOutFlags flags;
|
||||
try {
|
||||
flags=(slsDetectorDefs::readOutFlags) myDet->setReadOutFlags();
|
||||
} catch (...) {
|
||||
int retval=slsDetectorDefs::ANALOG_ONLY;
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
cout << "++++++++++++++++++++"<< hex << flags << dec << endl;
|
||||
if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
cout << "analog and digital" << hex << slsDetectorDefs::ANALOG_AND_DIGITAL << dec<< endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
} else if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
||||
cout << "digital only" << hex << slsDetectorDefs::DIGITAL_ONLY << dec << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
}// else if (flags==slsDetectorDefs::NORMAL_READOUT) {
|
||||
// cbAnalog->SetOn(kTRUE);
|
||||
// cbDigital->SetOn(kFALSE);
|
||||
// }
|
||||
else {
|
||||
cout << "analog only" << endl;
|
||||
flags=slsDetectorDefs::NORMAL_READOUT;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
}
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
break;
|
||||
default:
|
||||
throw("unknown readout flag");
|
||||
}
|
||||
} else {
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
Emit("readoutModeChanged(int)",static_cast<int>(retval));
|
||||
return retval;
|
||||
|
||||
Emit("readoutModeChanged(int)",(int)flags);
|
||||
return (int)flags;
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
}
|
||||
|
||||
int ctbPattern::getAnalogSamples() {
|
||||
int n;
|
||||
try {
|
||||
n=(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
eAnalogSamples->SetNumber((Double_t)retval);
|
||||
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
||||
return eAnalogSamples->GetNumber();
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eAnalogSamples->SetNumber((Double_t)n);
|
||||
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
||||
return eAnalogSamples->GetNumber();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
int n;
|
||||
try {
|
||||
|
||||
n=(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eDigitalSamples->SetNumber(((Double_t)n));
|
||||
int retval=0;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples.", "ctbPattern::getDigitalSamples")
|
||||
}
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::analogSamplesChanged(const int t){
|
||||
Emit("analogSamplesChanged(const int)", t);
|
||||
|
@ -27,7 +27,10 @@ class energyCalibration;
|
||||
class TGTextButton;
|
||||
class TGTab;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
|
||||
#include <string>
|
||||
@ -46,10 +49,10 @@ class ctbLoop : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setNLoops();
|
||||
void update();
|
||||
@ -67,10 +70,10 @@ class ctbWait : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setWaitTime();
|
||||
void update();
|
||||
@ -99,7 +102,7 @@ private:
|
||||
TGNumberEntry *eStopAddr;
|
||||
TGNumberEntry *eFrames;
|
||||
TGNumberEntry *ePeriod;
|
||||
TGNumberEntry *eCycles;
|
||||
TGNumberEntry *eTriggers;
|
||||
// TGNumberEntry *eMeasurements;
|
||||
TGNumberEntry *eAdcPipeline;
|
||||
TGNumberEntry *eDBitPipeline;
|
||||
@ -122,11 +125,11 @@ private:
|
||||
|
||||
char pat[PATLEN*8];
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
|
||||
ctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbPattern(TGVerticalFrame *page, sls::Detector *det);
|
||||
|
||||
void update();
|
||||
void setAdcFreq();
|
||||
@ -138,7 +141,7 @@ public:
|
||||
void setAdcPipeline();
|
||||
void setDBitPipeline();
|
||||
void setFrames();
|
||||
void setCycles();
|
||||
void setTriggers();
|
||||
// void setMeasurements();
|
||||
void setPeriod();
|
||||
|
||||
|
@ -10,61 +10,48 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbDacs.h"
|
||||
#include "ctbPowers.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d)
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
|
||||
: ctbDac(f, i, d)
|
||||
{
|
||||
cout << "****************************************************************power " << i << endl;
|
||||
dacsUnit->SetOn(kTRUE);
|
||||
dacsUnit->SetEnabled(kFALSE);
|
||||
int ii=0;
|
||||
|
||||
switch(i) {
|
||||
case slsDetectorDefs::V_POWER_IO:
|
||||
dacsLabel->SetText("VIO");
|
||||
ii=slsDetectorDefs::I_POWER_IO;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_A:
|
||||
dacsLabel->SetText("VA");
|
||||
ii=slsDetectorDefs::I_POWER_A;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_B:
|
||||
dacsLabel->SetText("VB");
|
||||
ii=slsDetectorDefs::I_POWER_B;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_C:
|
||||
dacsLabel->SetText("VC");
|
||||
ii=slsDetectorDefs::I_POWER_C;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_D:
|
||||
dacsLabel->SetText("VD");
|
||||
ii=slsDetectorDefs::I_POWER_D;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_CHIP:
|
||||
dacsLabel->SetText("VCHIP");
|
||||
dacsLabel->SetEnabled(kFALSE);
|
||||
ii=-1;
|
||||
break;
|
||||
default:
|
||||
dacsLabel->SetText("Bad index");
|
||||
ii=-1;
|
||||
break;
|
||||
};
|
||||
|
||||
// ctbSlowAdc *vm=new ctbSlowAdc(f,i,d);
|
||||
// vm->setLabel("V: ");
|
||||
// if (ii>=0) {
|
||||
// ctbSlowAdc *im=new ctbSlowAdc(f,ii,d);
|
||||
// im->setLabel("I: ");
|
||||
// }
|
||||
|
||||
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
|
||||
e->Disconnect ("ReturnPressed()");
|
||||
@ -104,44 +91,45 @@ string ctbPower::getLabel() {
|
||||
}
|
||||
line << " " << dacsLabel->GetText() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
void ctbPower::setValue(Long_t a) {ctbPower::setValue();}
|
||||
|
||||
void ctbPower::setValue(Long_t a) {cout << "ssssssssss" << endl; ctbPower::setValue();}
|
||||
void ctbPower::setValue() {
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
|
||||
|
||||
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, 1);
|
||||
try {
|
||||
myDet->setVoltage(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber());
|
||||
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ctbPower::getValue() {
|
||||
try {
|
||||
|
||||
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, 1);
|
||||
char s[100];
|
||||
cout << "****************************Getting power " << val << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>0) {
|
||||
if (id!=slsDetectorDefs::V_POWER_CHIP)
|
||||
int val = myDet->getVoltage(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
|
||||
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val > 0) {
|
||||
if (id != static_cast<int>(slsDetectorDefs::V_POWER_CHIP))
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
|
||||
} CATCH_DISPLAY ("Could not get power " + to_string(id) + ".", "ctbPower::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
||||
ctbPowers::ctbPowers(TGVerticalFrame* page, sls::Detector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
||||
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
@ -159,9 +147,8 @@ ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFr
|
||||
|
||||
int ctbPowers::setPwrAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
int is=-1;
|
||||
char tit[100];
|
||||
int narg;
|
||||
|
||||
if (sscanf(line.c_str(),"VA %s",tit)) {
|
||||
dacs[0]->setLabel(tit,1);
|
||||
@ -212,7 +199,6 @@ string ctbPowers::getPwrAlias() {
|
||||
|
||||
string ctbPowers::getPwrParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
|
||||
line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
|
||||
@ -225,19 +211,13 @@ string ctbPowers::getPwrParameters() {
|
||||
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||
// }
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbPowers::update() {
|
||||
|
||||
for (int idac=0; idac<NPOWERS; idac++) {
|
||||
|
||||
dacs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,7 @@
|
||||
|
||||
#include <TGFrame.h>
|
||||
|
||||
#ifndef CTB
|
||||
#define NPOWERS 0
|
||||
#else
|
||||
|
||||
#define NPOWERS 6
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -22,8 +15,10 @@ class TGCheckButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -36,7 +31,7 @@ class ctbPower : public ctbDac {
|
||||
|
||||
public:
|
||||
|
||||
ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d);
|
||||
ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
|
||||
|
||||
string getLabel();
|
||||
|
||||
@ -54,11 +49,11 @@ class ctbPowers : public TGGroupFrame
|
||||
|
||||
ctbPower *dacs[NPOWERS];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
//ctbPowers();
|
||||
ctbPowers(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbPowers(TGVerticalFrame*, sls::Detector*);
|
||||
|
||||
int setPwrAlias(string);
|
||||
string getPwrAlias();
|
||||
|
@ -34,7 +34,8 @@
|
||||
|
||||
|
||||
#include "ctbSignals.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -43,7 +44,7 @@ using namespace std;
|
||||
//#define DEFAULTFN "run_0.encal"
|
||||
|
||||
|
||||
ctbSignal::ctbSignal(TGFrame *page, int i, multiSlsDetector *det)
|
||||
ctbSignal::ctbSignal(TGFrame *page, int i, sls::Detector *det)
|
||||
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
|
||||
|
||||
|
||||
@ -178,10 +179,6 @@ int ctbSignal::fixOutput(int i) {
|
||||
|
||||
int ctbSignal::setDbitList(Long64_t r) {
|
||||
|
||||
Long64_t mask=((Long64_t)1<<id);
|
||||
|
||||
// cout << hex << r << dec <<endl;
|
||||
|
||||
if (r)
|
||||
sDbitList->SetOn(kTRUE,kFALSE);
|
||||
else
|
||||
@ -197,7 +194,6 @@ int ctbSignal::isPlot() { return sPlot->IsOn();}
|
||||
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
|
||||
|
||||
void ctbSignal::ToggledOutput(Bool_t b) {
|
||||
Long_t mask=b<<id;
|
||||
ToggledSignalOutput(id);
|
||||
if (b) {
|
||||
// sClock->SetEnabled(kTRUE);
|
||||
@ -249,7 +245,7 @@ void ctbSignal::ToggledSignalPlot(Int_t b){
|
||||
}
|
||||
|
||||
|
||||
ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbSignals::ctbSignals(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -259,7 +255,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
|
||||
TGHorizontalFrame *hframe;
|
||||
char tit[100];
|
||||
|
||||
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
|
||||
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
@ -290,36 +285,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
}
|
||||
|
||||
// #ifdef CTB
|
||||
// idac=62;
|
||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
// signals[idac]->MapWindow();
|
||||
// sprintf(tit,"DBIT Latch");
|
||||
|
||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
||||
|
||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
||||
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
// idac=63;
|
||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
// signals[idac]->MapWindow();
|
||||
// sprintf(tit,"ADC Latch");
|
||||
|
||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
||||
|
||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(vframe, 800,50);
|
||||
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
hframe->MapWindow();
|
||||
@ -398,121 +363,142 @@ string ctbSignals::getSignalAlias() {
|
||||
|
||||
|
||||
void ctbSignals::update() {
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
// Long64_t creg=myDet->setPatternClockControl();//setCTBWord(-2,-1);
|
||||
try {
|
||||
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
cout << hex << oreg << dec << endl;
|
||||
|
||||
char val[1000];
|
||||
cout << hex << oreg << dec << endl;
|
||||
// cout << hex << creg << dec << endl;
|
||||
for (int idac=0; idac<NIOSIGNALS; idac++) {
|
||||
signals[idac]->setOutput(oreg);
|
||||
}
|
||||
|
||||
sprintf(val,"%llX",oreg);
|
||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
|
||||
|
||||
|
||||
for (int idac=0; idac<NIOSIGNALS; idac++) {
|
||||
signals[idac]->setOutput(oreg);
|
||||
|
||||
}
|
||||
|
||||
Long64_t mask;
|
||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
||||
if (dbitlist.empty())
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
// enable all
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(1);
|
||||
}
|
||||
else {
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
||||
for (const auto &value : dbitlist) {
|
||||
signals[value]->setDbitList(1);
|
||||
}
|
||||
eDbitOffset->SetNumber(0);
|
||||
}
|
||||
|
||||
// ctb
|
||||
else {
|
||||
try {
|
||||
|
||||
eDbitOffset->SetNumber(myDet->getReceiverDbitOffset());
|
||||
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
// enable all
|
||||
if (dbitlist.empty()) {
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// disable all
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(0);
|
||||
}
|
||||
// enable selected
|
||||
for (const auto &value : dbitlist) {
|
||||
signals[value]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
|
||||
|
||||
try {
|
||||
auto val = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
eDbitOffset->SetNumber(val);
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string ctbSignals::getSignalParameters() {
|
||||
|
||||
try {
|
||||
|
||||
ostringstream line;
|
||||
line << "patioctrl " << hex << myDet->setPatternIOControl() << dec << endl;//setCTBWord(-1,-1)
|
||||
return line.str();
|
||||
auto val = myDet->getPatternIOControl().tsquash("Different values");
|
||||
ostringstream line;
|
||||
line << "patioctrl " << hex << val << dec << endl;
|
||||
return line.str();
|
||||
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
|
||||
|
||||
return ("");
|
||||
}
|
||||
|
||||
void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||
try {
|
||||
|
||||
char val[1000];
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
|
||||
|
||||
if (signals[mask]->isOutput()) {
|
||||
cout << " or " << m ;
|
||||
oreg|=m;
|
||||
} else {
|
||||
cout << " not " << ~m ;
|
||||
oreg&=~m;
|
||||
}
|
||||
cout << " after " << oreg << endl;
|
||||
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
|
||||
myDet->setPatternIOControl(static_cast<uint64_t>(oreg));
|
||||
oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
eIOCntrlRegister->SetText(to_string(oreg).c_str());
|
||||
|
||||
|
||||
if (signals[mask]->isOutput()) {
|
||||
cout << " or " << m ;
|
||||
oreg|=m;
|
||||
} else {
|
||||
cout << " not " << ~m ;
|
||||
oreg&=~m;
|
||||
}
|
||||
cout << " after " << oreg << endl;
|
||||
|
||||
myDet->setPatternIOControl(oreg);//setCTBWord(-1,oreg);
|
||||
oreg=myDet->setPatternIOControl();//myDet->setCTBWord(-1,-1);
|
||||
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
sprintf(val,"%llX",oreg);
|
||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
||||
eIOCntrlRegister->SetText(val);
|
||||
// eIOCntrlRegister->SetNumber(oreg);
|
||||
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSignals::ToggledDbitList(Int_t mask){
|
||||
try {
|
||||
|
||||
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
|
||||
// anyway all enabled
|
||||
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
|
||||
;
|
||||
}
|
||||
// set the dbitlist
|
||||
else {
|
||||
std::vector <int> new_dbitlist;
|
||||
for (int is=0; is<64; is++) {
|
||||
if (signals[is]->isDbitList()){
|
||||
new_dbitlist.push_back(is);
|
||||
cout << is << " " << new_dbitlist.size() - 1 << endl;
|
||||
}
|
||||
}
|
||||
if (new_dbitlist.size() > 64)
|
||||
new_dbitlist.clear();
|
||||
myDet->setRxDbitList(new_dbitlist);
|
||||
// get list again
|
||||
dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
}
|
||||
|
||||
cout << "************* Here" << endl;
|
||||
|
||||
|
||||
|
||||
std::vector <int> new_dbitlist;
|
||||
std::vector <int> old_dbitlist=myDet->getReceiverDbitList();
|
||||
|
||||
char val[1000];
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
|
||||
if (old_dbitlist.empty() && signals[mask]->isDbitList())
|
||||
;
|
||||
else {
|
||||
int ns=0;
|
||||
for (int is=0; is<64; is++) {
|
||||
if (signals[is]->isDbitList()){
|
||||
new_dbitlist.push_back(is);
|
||||
ns++;
|
||||
cout << is << " " << ns << endl;
|
||||
// enable all
|
||||
if (dbitlist.empty()) {
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// disable all
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(0);
|
||||
}
|
||||
// enable selected
|
||||
for (const auto &value : dbitlist) {
|
||||
signals[value]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
if (ns>63) new_dbitlist.clear();
|
||||
myDet->setReceiverDbitList(new_dbitlist);
|
||||
}
|
||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
||||
if (dbitlist.empty())
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(1);
|
||||
else
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
||||
for (const auto &value : dbitlist) signals[value]->setDbitList(1);
|
||||
|
||||
} CATCH_DISPLAY ("Could not get/set receiver dbit list.", "ctbSignals::ToggledDbitList")
|
||||
}
|
||||
|
||||
|
||||
@ -533,16 +519,23 @@ void ctbSignals::ToggledSignalPlot(Int_t b) {
|
||||
|
||||
|
||||
Pixel_t ctbSignals::getColor(int i){
|
||||
if (i>=0 && i<NSIGNALS) return signals[i]->getColor();
|
||||
if (i>=0 && i<NSIGNALS)
|
||||
return signals[i]->getColor();
|
||||
return static_cast<Pixel_t>(-1);
|
||||
}
|
||||
|
||||
int ctbSignals::getPlot(int i){
|
||||
if (i>=0 && i<NSIGNALS) return signals[i]->isPlot();
|
||||
if (i>=0 && i<NSIGNALS)
|
||||
return signals[i]->isPlot();
|
||||
return -1;
|
||||
};
|
||||
|
||||
void ctbSignals::setDbitOffset(Long_t) {
|
||||
setDbitOffset();
|
||||
}
|
||||
|
||||
void ctbSignals::setDbitOffset(){
|
||||
myDet->setReceiverDbitOffset(eDbitOffset->GetNumber());
|
||||
try {
|
||||
myDet->setRxDbitOffset(eDbitOffset->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set receiver dbit offset.", "ctbSignals::setDbitOffset")
|
||||
}
|
||||
|
@ -25,7 +25,10 @@ class TGColorSelect;
|
||||
|
||||
|
||||
class TGNumberEntry;
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class ctbSignal;
|
||||
|
||||
#include <string>
|
||||
@ -45,14 +48,14 @@ private:
|
||||
TGNumberEntry *sEntry;
|
||||
TGColorSelect *fColorSel;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
Int_t id;
|
||||
|
||||
TH1I *hsig;
|
||||
|
||||
public:
|
||||
|
||||
ctbSignal(TGFrame *page, int i, multiSlsDetector *det);
|
||||
ctbSignal(TGFrame *page, int i, sls::Detector *det);
|
||||
int setSignalAlias(char *tit, int plot, int col);
|
||||
string getSignalAlias();
|
||||
|
||||
@ -89,10 +92,10 @@ private:
|
||||
TGNumberEntry *eIOCntrlRegister;
|
||||
TGNumberEntry *eDbitOffset;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setSignalAlias(string line);
|
||||
string getSignalAlias();
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbSlowAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
@ -17,7 +18,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -55,9 +56,6 @@ ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TG
|
||||
b->SetTextJustify(kTextLeft);
|
||||
|
||||
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -66,38 +64,50 @@ int ctbSlowAdc::setLabel(char *tit) {
|
||||
if(tit)
|
||||
dacsLabel->SetText(tit);
|
||||
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
string ctbSlowAdc::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbSlowAdc::getValue() {
|
||||
try {
|
||||
std::string s;
|
||||
|
||||
int val=myDet->getADC((slsDetectorDefs::dacIndex)id);
|
||||
char s[100];
|
||||
cout << "adc " << id << " " << val << endl;
|
||||
sprintf(s,"%d mV",val);
|
||||
if (id==999)
|
||||
sprintf(s,"%d <20>C",val);
|
||||
dacsValue->SetText(s);
|
||||
// temp
|
||||
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
|
||||
|
||||
int val = myDet->getTemperature(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "slow adc temp" << " " << val << endl;
|
||||
|
||||
s = to_string(val) + " " + to_string(0x00b0) + "C";//<2F>C
|
||||
dacsValue->SetText(s.c_str());
|
||||
return val;
|
||||
}
|
||||
|
||||
return val;
|
||||
// mv
|
||||
else {
|
||||
|
||||
int val = myDet->getSlowADC(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "slow adc " << id << " " << val << endl;
|
||||
|
||||
s = to_string(val) + " mV";
|
||||
dacsValue->SetText(s.c_str());
|
||||
return val;
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get slow dac " + to_string(id) + ".", "ctbSlowAdc::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -106,8 +116,7 @@ int ctbSlowAdc::getValue() {
|
||||
|
||||
|
||||
|
||||
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
||||
|
||||
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
@ -116,14 +125,12 @@ ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGro
|
||||
// cout << "window mapped " << endl;
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS; idac++) {
|
||||
for (int idac=0; idac<NSLOWADCS + 1; idac++) {
|
||||
|
||||
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
|
||||
|
||||
}
|
||||
adcs[NSLOWADCS]=new ctbSlowAdc(this, 999, myDet);
|
||||
adcs[NSLOWADCS]->setLabel("Temperature");
|
||||
|
||||
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +140,7 @@ int ctbSlowAdcs::setSlowAdcAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
char tit[100];
|
||||
int narg=sscanf(line.c_str(),"SENSE%d %s",&is,tit,&mv);
|
||||
int narg=sscanf(line.c_str(),"SENSE%d %s %d",&is,tit,&mv);
|
||||
if (narg<2)
|
||||
return -1;
|
||||
if (is>=0 && is<NSLOWADCS)
|
||||
@ -149,7 +156,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
for (int i=0; i<NSLOWADCS; i++)
|
||||
line << adcs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +163,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
|
||||
string ctbSlowAdcs::getAdcParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NSLOWADCS; i++) {
|
||||
@ -166,20 +171,12 @@ string ctbSlowAdcs::getAdcParameters() {
|
||||
}
|
||||
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSlowAdcs::update() {
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS+1; idac++) {
|
||||
|
||||
adcs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,10 @@ class TGTextButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -35,9 +38,9 @@ class ctbSlowAdc : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbSlowAdc(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
|
||||
int getValue();
|
||||
|
||||
int setLabel(char *tit);
|
||||
@ -56,10 +59,10 @@ private:
|
||||
|
||||
ctbSlowAdc *adcs[NSLOWADCS+1];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
int setSlowAdcAlias(string line);
|
||||
// int setDacAlias(string line);
|
||||
|
@ -1,67 +1,69 @@
|
||||
find_package(Doxygen)
|
||||
find_package(Sphinx)
|
||||
|
||||
|
||||
if (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
|
||||
# #Utility to generate command line documentation
|
||||
add_executable(gendoc src/gendoc.cpp)
|
||||
target_link_libraries(gendoc PRIVATE
|
||||
slsDetectorShared
|
||||
)
|
||||
set_target_properties(gendoc PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
find_package(Doxygen REQUIRED)
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
|
||||
|
||||
|
||||
#Doxygen
|
||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
# Utility to generate command line documentation
|
||||
add_executable(gendoc src/gendoc.cpp)
|
||||
# This is a bit hacky, but better than exposing stuff?
|
||||
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src)
|
||||
target_link_libraries(gendoc PRIVATE
|
||||
slsDetectorShared
|
||||
)
|
||||
set_target_properties(gendoc PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
#Sphinx
|
||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(SPHINX_SOURCE_FILES
|
||||
src/commandline.rst
|
||||
src/container_utils.rst
|
||||
src/dependencies.rst
|
||||
src/detector.rst
|
||||
src/index.rst
|
||||
src/installation.rst
|
||||
src/pydetector.rst
|
||||
src/pyenums.rst
|
||||
src/pyexamples.rst
|
||||
src/receiver.rst
|
||||
src/result.rst
|
||||
src/type_traits.rst
|
||||
src/ToString.rst
|
||||
|
||||
)
|
||||
|
||||
foreach(filename ${SPHINX_SOURCE_FILES})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${filename}
|
||||
"${SPHINX_BUILD}/${filename}")
|
||||
endforeach(filename ${SPHINX_SOURCE_FILES})
|
||||
#Doxygen
|
||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
|
||||
"${SPHINX_BUILD}/conf.py"
|
||||
@ONLY)
|
||||
#Sphinx
|
||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(SPHINX_SOURCE_FILES
|
||||
src/commandline.rst
|
||||
src/container_utils.rst
|
||||
src/consuming.rst
|
||||
src/dependencies.rst
|
||||
src/detector.rst
|
||||
src/index.rst
|
||||
src/installation.rst
|
||||
src/pydetector.rst
|
||||
src/pyenums.rst
|
||||
src/pyexamples.rst
|
||||
src/receiver.rst
|
||||
src/result.rst
|
||||
src/type_traits.rst
|
||||
src/ToString.rst
|
||||
src/examples.rst
|
||||
|
||||
)
|
||||
|
||||
foreach(filename ${SPHINX_SOURCE_FILES})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${filename}
|
||||
"${SPHINX_BUILD}/${filename}")
|
||||
endforeach(filename ${SPHINX_SOURCE_FILES})
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
|
||||
"${SPHINX_BUILD}/conf.py"
|
||||
@ONLY)
|
||||
|
||||
add_custom_target(docs
|
||||
gendoc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
COMMAND ${SPHINX_EXECUTABLE} -a -b html
|
||||
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
|
||||
-c "${SPHINX_BUILD}"
|
||||
${SPHINX_BUILD}/src
|
||||
${SPHINX_BUILD}/html
|
||||
COMMENT "Generating documentation with Sphinx")
|
||||
|
||||
add_custom_target(docs
|
||||
gendoc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
COMMAND ${SPHINX_EXECUTABLE} -a -b html
|
||||
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
|
||||
-c "${SPHINX_BUILD}"
|
||||
${SPHINX_BUILD}/src
|
||||
${SPHINX_BUILD}/html
|
||||
COMMENT "Generating documentation with Sphinx")
|
||||
|
||||
else (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
message("Doxygen and Sphinx are needed to build documentation")
|
||||
endif (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
|
116
docs/src/consuming.rst
Normal file
116
docs/src/consuming.rst
Normal file
@ -0,0 +1,116 @@
|
||||
Consuming slsDetectorPackage
|
||||
===============================
|
||||
|
||||
Depending on how you want to build your integration with
|
||||
slsDetectorPackage there are a few different ways to
|
||||
consume our package. The recommended way is to use one of the
|
||||
CMake approaches.
|
||||
|
||||
|
||||
|
||||
CMake: slsDetectorPackage as submodule in your project
|
||||
---------------------------------------
|
||||
|
||||
If you are using CMake to build your integration and want to build everything
|
||||
in one go, we support adding slsDetectorPackage as a subfolder in your cmake project.
|
||||
|
||||
A minimal CMakeLists.txt could look like this:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
project(myDetectorIntegration)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
add_subdirectory(slsDetectorPackage)
|
||||
|
||||
#Add your executable
|
||||
add_executable(example main.cpp)
|
||||
target_compile_features(example PRIVATE cxx_std_11)
|
||||
|
||||
#Link towards slsDetectorShared
|
||||
target_link_libraries(example slsDetectorShared)
|
||||
|
||||
A fully working example can be found at:
|
||||
|
||||
https://github.com/slsdetectorgroup/cmake-subfolder-example
|
||||
|
||||
|
||||
CMake: find_package(slsDetectorPackage)
|
||||
------------------------------------------
|
||||
|
||||
If you have compiled and installed slsDetectorPackage we also support
|
||||
find_package in CMake. If installed in a system wide location no path
|
||||
should be needed, otherwise specify cmake prefix path.
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(myintegration)
|
||||
|
||||
find_package(slsDetectorPackage 5.0 REQUIRED)
|
||||
add_executable(example main.cpp)
|
||||
target_link_libraries(example slsDetectorShared)
|
||||
|
||||
|
||||
Then assuming the slsDetectorPackage is installed in /path/to/sls/install
|
||||
you should be able to configure and build your project in this way.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cmake ../path/to/your/source -DCMAKE_PREFIX_PATH=/path/to/sls/install
|
||||
make
|
||||
|
||||
|
||||
A minimal example is available at: https://github.com/slsdetectorgroup/minimal-cmake
|
||||
|
||||
|
||||
CMake: find_package and conda
|
||||
----------------------------------
|
||||
|
||||
.. note::
|
||||
|
||||
conda can also be used for installing dependencies such as zmq, Qt4 etc.
|
||||
|
||||
find_package(slsDetectorPackage) also works if you have installed slsDetectorPackage using conda.
|
||||
The only difference is that you point CMake to $CONDA_PREFIX
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#assuming myenv contains slsdetlib
|
||||
conda activate myenv
|
||||
cmake ../path/to/your/source -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
||||
make
|
||||
|
||||
Depending on your system compiler you might also have to install gxx_linux-64 to compiled.
|
||||
|
||||
No tools minimal approach
|
||||
-----------------------------
|
||||
|
||||
While not recommended it is still possible to specify the include and library paths
|
||||
manually when invoking g++. This can sometimes be handy for a quick try.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
#include <iostream>
|
||||
int main(){
|
||||
|
||||
sls::Detector det;
|
||||
|
||||
//Get all values and print them
|
||||
std::cout << "Hostname: " << det.getHostname() << "\n";
|
||||
std::cout << "Type: " << det.getDetectorType() << "\n";
|
||||
std::cout << "Udp ip: " << det.getSourceUDPIP() << "\n";
|
||||
|
||||
|
||||
//Get mac addr
|
||||
const int module = 0;
|
||||
auto mac = det.getSourceUDPMAC()[module];
|
||||
std::cout << "Mac addr of module "<< module << " is " << mac.str() << '\n';
|
||||
|
||||
}
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
g++ -I/install/path/include/ -L/install/path/lib64/ myapp.cpp -lSlsDetector -lSlsSupport -Wl,-rpath=../install/path/lib64
|
@ -13,7 +13,7 @@ To use the basic building blocks, meaning sls_detector_get/put and
|
||||
the shared libraries these are needed:
|
||||
|
||||
* Linux, preferably recent kernel (currently no cross platform support)
|
||||
* CMake > 3.9
|
||||
* CMake > 3.12
|
||||
* C++11 compatible compiler. (We test with gcc and clang)
|
||||
* ZeroMQ version 4
|
||||
|
||||
@ -24,7 +24,7 @@ GUI
|
||||
The GUI is currently using Qt4 but watch out for an upgrade to 5.
|
||||
|
||||
* Qt 4.8
|
||||
* Qwt 6
|
||||
* Qwt 6.1
|
||||
|
||||
-----------------------
|
||||
Python bindings
|
||||
|
115
docs/src/examples.rst
Normal file
115
docs/src/examples.rst
Normal file
@ -0,0 +1,115 @@
|
||||
|
||||
|
||||
|
||||
Examples
|
||||
===========
|
||||
|
||||
Setup
|
||||
------------
|
||||
|
||||
The examples here assume that you have compiled and installed slsDetectorPackage
|
||||
to ~/sls/install and that the option for SLS_USE_SIMULATOR was enabled. This also builds
|
||||
the virtual detector servers that we will be using for testing.
|
||||
|
||||
We also add ~/sls/detector/install/bin to the path for convenience.
|
||||
|
||||
Compile examples
|
||||
-------------------
|
||||
|
||||
The source code of the examples is available at:
|
||||
https://github.com/slsdetectorgroup/api-examples
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/slsdetectorgroup/api-examples.git
|
||||
mkdir build && cd build
|
||||
cmake ../api-examples -DCMAKE_PREFIX_PATH=~/sls/detector/install
|
||||
make
|
||||
|
||||
Below follows a short description of what is included in the examples.
|
||||
|
||||
|
||||
Running a config file [e1]
|
||||
-----------------------------
|
||||
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
...
|
||||
sls::Detector det;
|
||||
det.loadConfig("path/to/config/file.config");
|
||||
|
||||
|
||||
|
||||
To configure the connection between PC and detector the easiest
|
||||
is to run a config file. For this example we first launch a virtual Jungfrau server and
|
||||
then set up the detector.
|
||||
|
||||
**Launch a virtual detector server**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
jungfrauDetectorServer_virtual
|
||||
|
||||
This launches a virtual Jungfrau detector server. As default is uses port 1952 and 1953
|
||||
for communication over TCP. Most commands go on 1952 and only stop and status on 1953.
|
||||
|
||||
**Run example to configure**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./e1-config one_det_no_receiver.config
|
||||
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0_sls_0
|
||||
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0
|
||||
- 12:01:06.372 INFO: Shared memory created /slsDetectorPackage_multi_0
|
||||
- 12:01:06.376 INFO: Loading configuration file: one_det_no_receiver.config
|
||||
- 12:01:06.376 INFO: Adding detector localhost
|
||||
- 12:01:06.377 INFO: Shared memory created /slsDetectorPackage_multi_0_sls_0
|
||||
- 12:01:06.377 INFO: Checking Detector Version Compatibility
|
||||
- 12:01:06.378 INFO: Detector connecting - updating!
|
||||
hostname [localhost]
|
||||
|
||||
|
||||
Jungfrau detector with 1 modules configured
|
||||
|
||||
|
||||
Using the return type sls::Result [e2]
|
||||
-----------------------------------------
|
||||
|
||||
Since many our detectors have multiple modules we cannot return
|
||||
a single value when reading from the Detector. Hostname, Ip and also
|
||||
for example exposure time can differ between modules.
|
||||
|
||||
Therefore we return Result<T> which is a thin wrapper around
|
||||
std::vector.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
sls::Result<int> res1{1, 1, 1};
|
||||
std::cout << "res1: " << res1 << '\n';
|
||||
res1.squash();
|
||||
res1.squash(-1);
|
||||
|
||||
|
||||
|
||||
Setting exposure time [e3]
|
||||
-----------------------------------------
|
||||
|
||||
For setting times, like exposure time, period, delay etc.
|
||||
we use std::chrono::duration.
|
||||
|
||||
Example 3 shows how to set and read exposure time as well
|
||||
as converting to floating point.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
#include <chrono>
|
||||
...
|
||||
std::chrono::microseconds t0{500};
|
||||
det.setExptime(t0);
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ int main() {
|
||||
|
||||
std::cout << "Generating command line documentation!\n";
|
||||
|
||||
sls::CmdProxy<sls::Detector> proxy(nullptr);
|
||||
sls::CmdProxy proxy(nullptr);
|
||||
auto commands = proxy.GetProxyCommands();
|
||||
|
||||
std::ofstream fs("commands.rst");
|
||||
|
@ -6,12 +6,18 @@
|
||||
Welcome to slsDetectorPackage's documentation!
|
||||
==============================================
|
||||
|
||||
.. note ::
|
||||
|
||||
This is the documentation for the latest development version of slsDetectorPackage
|
||||
For documentation on current and previous releases visit the official page: https://www.psi.ch/en/detectors/documentation
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Installation:
|
||||
|
||||
installation
|
||||
dependencies
|
||||
consuming
|
||||
|
||||
.. toctree::
|
||||
:caption: C++ API
|
||||
@ -20,6 +26,7 @@ Welcome to slsDetectorPackage's documentation!
|
||||
detector
|
||||
result
|
||||
receiver
|
||||
examples
|
||||
|
||||
.. toctree::
|
||||
:caption: Python API
|
||||
|
@ -2,4 +2,68 @@
|
||||
Installation
|
||||
==============================================
|
||||
|
||||
get the source etc.
|
||||
Build from source using CMake
|
||||
---------------------------------
|
||||
|
||||
.. note ::
|
||||
|
||||
The default branch of our git repository is developer. It contains the
|
||||
latest development version. It is expected to compile and work but
|
||||
features might be added or tweaked. In some cases the API might also change
|
||||
without being communicated. If absolute stability of the API is needed please
|
||||
use one of the release versions.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
mkdir build && cd build
|
||||
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
|
||||
make -j12
|
||||
make install
|
||||
|
||||
Install binaries using conda
|
||||
--------------------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#Add channels for dependencies and our library
|
||||
conda config --add channels conda-forge
|
||||
conda config --add channels slsdetectorgroup
|
||||
conda config --set channel_priority strict
|
||||
|
||||
#cerate an environment with our library, then activate
|
||||
conda create -n myenv slsdetlib=2020.03.18.dev2
|
||||
codna activate myenv
|
||||
|
||||
#ready to use
|
||||
sls_detector_get exptime
|
||||
etc ...
|
||||
|
||||
|
||||
|
||||
Build from source on old distributions
|
||||
-----------------------------------------
|
||||
|
||||
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
|
||||
it's possible to install a newer gcc using conda and build the slsDetectorPackage
|
||||
using this compiler
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#Create an environment with the dependencies
|
||||
conda create -n myenv gxx_linux-64 cmake zmq
|
||||
conda activate myenv
|
||||
cmake ../slsDetectorPackage -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
||||
make -j12
|
||||
|
||||
|
||||
Build this documentation
|
||||
-------------------------------
|
||||
|
||||
The documentation for the slsDetectorPackage is build using a combination
|
||||
of Doxygen, Sphinx and Breathe. The easiest way to install the dependencies
|
||||
is to use conda
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
conda create -n myenv python sphinx sphinx_rtd_theme
|
@ -1,9 +1,9 @@
|
||||
Detector
|
||||
=====================================================
|
||||
|
||||
.. py:currentmodule:: sls_detector
|
||||
.. py:currentmodule:: slsdet
|
||||
|
||||
.. autoclass:: ExperimentalDetector
|
||||
.. autoclass:: Detector
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
@ -12,7 +12,7 @@ file writing etc.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from sls_detector import Eiger
|
||||
from slsdet import Eiger
|
||||
|
||||
d = Eiger()
|
||||
threshold = range(0, 2000, 200)
|
||||
|
132
examples/gotthard2_veto_photon.txt
Normal file
132
examples/gotthard2_veto_photon.txt
Normal file
@ -0,0 +1,132 @@
|
||||
#G1 Energy #G2 Energy
|
||||
300 7000
|
||||
|
||||
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
@ -8,7 +8,7 @@ period 0.000024984
|
||||
delay 0.999999968
|
||||
gates 1
|
||||
frames 300000.000000000
|
||||
cycles 1.000000000
|
||||
triggers 1.000000000
|
||||
timing auto
|
||||
fineoff 0.000000
|
||||
startscript none
|
||||
|
140
examples/moench01_T1_lab.config → examples/jctb_moench03_T1.config
Executable file → Normal file
140
examples/moench01_T1_lab.config → examples/jctb_moench03_T1.config
Executable file → Normal file
@ -1,4 +1,14 @@
|
||||
hostname bchip085+
|
||||
initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
runclk 40
|
||||
adcclk 20
|
||||
dbitclk 40
|
||||
|
||||
|
||||
|
||||
|
||||
patword 0000 0000000000000000
|
||||
patword 0001 0000000000000000
|
||||
@ -408,84 +418,84 @@ patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 40000
|
||||
patwaittime0 10000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
|
||||
|
||||
####mcp2011
|
||||
#0:rx_udpip 10.1.1.102
|
||||
#0:detectorip 10.1.1.19
|
||||
#0:rx_udpport 32410
|
||||
####gui listening to
|
||||
#zmqip 129.129.202.131
|
||||
#zmqport 30001
|
||||
####data streaming out of
|
||||
#rx_zmqip 10.1.2.103
|
||||
#rx_zmqport 30003
|
||||
#0:rx_hostname mpc2011
|
||||
#0:rx_tcpport 1977
|
||||
|
||||
####mx-test-1
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:detectorip 10.1.1.19
|
||||
0:rx_udpport 32410
|
||||
####gui listening to (on receiver pc)
|
||||
zmqip 129.129.202.92
|
||||
zmqport 30001
|
||||
####data streaming out of
|
||||
rx_zmqip 10.1.1.100
|
||||
rx_zmqport 30003
|
||||
0:rx_hostname pcmoench01
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
0:udp_dstip 10.1.1.102
|
||||
#0:udp_dstip 129.129.202.136
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
0:udp_srcip 10.1.1.19
|
||||
#0:udp_srcip 129.129.202.13
|
||||
|
||||
0:udp_dstport 33410
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
#rx_zmqip 10.1.1.102
|
||||
#rx_zmqport 30001
|
||||
#############################################
|
||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
#zmqport 50001
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
rx_hostname mpc2011
|
||||
|
||||
tengiga 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#turn on datastream from commandline
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
#0:configuremac -1
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
rx_readfreq 1
|
||||
|
||||
|
||||
dac:6 800
|
||||
dac:0 1300
|
||||
dac:4 1428
|
||||
dac:1 1000
|
||||
dac:7 900
|
||||
dac:3 680
|
||||
dac:2 1400
|
||||
dac:5 1200
|
||||
dac 6 800
|
||||
dac 0 1300
|
||||
dac 4 1428
|
||||
dac 1 1000
|
||||
dac 7 900
|
||||
dac 3 680
|
||||
dac 2 1400
|
||||
dac 5 1200
|
||||
adcinvert 4a342593
|
||||
samples 5000
|
||||
adcphase 90
|
||||
adcpipeline 15
|
||||
#0xb5cbda6c
|
||||
asamples 5000
|
||||
dsamples 0
|
||||
adcphase 30 deg
|
||||
adcpipeline 14
|
||||
adcreg 14 40
|
||||
powerchip 1
|
||||
|
||||
|
||||
frames 1000
|
||||
period 0.001
|
||||
#############################################
|
||||
### edit with directory you want to write to
|
||||
############################################
|
||||
fpath /tmp/
|
||||
fwrite 0
|
||||
|
||||
romode analog
|
||||
#rx_jsonaddheader frameMode
|
||||
rx_jsonpara frameMode newpedestal
|
||||
#rx_jsonaddheader detectorMode
|
||||
rx_jsonpara detectorMode analog
|
||||
#flags newpedestal
|
||||
#flags analog
|
||||
|
||||
reg 0x5e 0x00010000
|
||||
#powerchip 1
|
||||
vhighvoltage 90
|
||||
period 0.005
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
frames 100
|
||||
period 0.1
|
||||
outdir /scratch/
|
||||
enablefwrite 0
|
||||
|
||||
|
||||
|
63
examples/moench03_T1.config
Normal file
63
examples/moench03_T1.config
Normal file
@ -0,0 +1,63 @@
|
||||
initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
rx_hostname mpc2011
|
||||
|
||||
rx_tcpport 1954
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
udp_dstip 10.1.1.102
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
udp_srcip 10.1.1.19
|
||||
udp_dstport 32411
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
rx_zmqip 10.1.1.102
|
||||
rx_zmqport 50003
|
||||
#############################################
|
||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||
############################################
|
||||
zmqip 129.129.202.136
|
||||
zmqport 50001
|
||||
|
||||
|
||||
|
||||
|
||||
tengiga 1
|
||||
rx_datastream 1
|
||||
|
||||
|
||||
|
||||
frames 100000
|
||||
period 0.0006
|
||||
#############################################
|
||||
### edit with directory you want to write to
|
||||
############################################
|
||||
fpath /mnt/moench_data/scratch/
|
||||
fwrite 0
|
||||
rx_datastream 1
|
||||
|
||||
rx_jsonpara frameMode frame
|
||||
rx_jsonpara detectorMode counting
|
||||
rx_discardpolicy discardpartial
|
||||
|
||||
|
||||
adcpipeline 15
|
||||
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
|
||||
#adcreg 0x14 0x40
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
class MultiDetectorFixture {
|
||||
protected:
|
||||
multiSlsDetector d;
|
||||
DetectorImpl d;
|
||||
|
||||
public:
|
||||
MultiDetectorFixture() : d(0, true, true) {
|
||||
@ -22,56 +22,56 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Set and get dacs",
|
||||
auto th = 1000;
|
||||
|
||||
// set and read back each individual dac of EIGER
|
||||
d.setDAC(0, di::E_SvP, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvP, 0) == 0);
|
||||
d.setDAC(4000, di::E_SvN, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvN, 0) == 4000);
|
||||
d.setDAC(2000, di::E_Vtr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtr, 0) == 2000);
|
||||
d.setDAC(3500, di::E_Vrf, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrf, 0) == 3500);
|
||||
d.setDAC(1400, di::E_Vrs, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrs, 0) == 1400);
|
||||
d.setDAC(2556, di::E_Vtgstv, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtgstv, 0) == 2556);
|
||||
d.setDAC(1500, di::E_Vcmp_ll, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == 1500);
|
||||
d.setDAC(1400, di::E_Vcmp_lr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == 1400);
|
||||
d.setDAC(4000, di::E_cal, 0);
|
||||
CHECK(d.setDAC(-1, di::E_cal, 0) == 4000);
|
||||
d.setDAC(1300, di::E_Vcmp_rl, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == 1300);
|
||||
d.setDAC(1200, di::E_Vcmp_rr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == 1200);
|
||||
d.setDAC(1100, di::E_rxb_rb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_rb, 0) == 1100);
|
||||
d.setDAC(1100, di::E_rxb_lb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_lb, 0) == 1100);
|
||||
d.setDAC(1500, di::E_Vcp, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcp, 0) == 1500);
|
||||
d.setDAC(2000, di::E_Vcn, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcn, 0) == 2000);
|
||||
d.setDAC(1550, di::E_Vis, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vis, 0) == 1550);
|
||||
d.setDAC(0, di::SVP, 0);
|
||||
CHECK(d.setDAC(-1, di::SVP, 0) == 0);
|
||||
d.setDAC(4000, di::SVN, 0);
|
||||
CHECK(d.setDAC(-1, di::SVN, 0) == 4000);
|
||||
d.setDAC(2000, di::VTR, 0);
|
||||
CHECK(d.setDAC(-1, di::VTR, 0) == 2000);
|
||||
d.setDAC(3500, di::VRF, 0);
|
||||
CHECK(d.setDAC(-1, di::VRF, 0) == 3500);
|
||||
d.setDAC(1400, di::VRS, 0);
|
||||
CHECK(d.setDAC(-1, di::VRS, 0) == 1400);
|
||||
d.setDAC(2556, di::VTGSTV, 0);
|
||||
CHECK(d.setDAC(-1, di::VTGSTV, 0) == 2556);
|
||||
d.setDAC(1500, di::VCMP_LL, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == 1500);
|
||||
d.setDAC(1400, di::VCMP_LR, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == 1400);
|
||||
d.setDAC(4000, di::CAL, 0);
|
||||
CHECK(d.setDAC(-1, di::CAL, 0) == 4000);
|
||||
d.setDAC(1300, di::VCMP_RL, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == 1300);
|
||||
d.setDAC(1200, di::VCMP_RR, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == 1200);
|
||||
d.setDAC(1100, di::RXB_RB, 0);
|
||||
CHECK(d.setDAC(-1, di::RXB_RB, 0) == 1100);
|
||||
d.setDAC(1100, di::RXB_LB, 0);
|
||||
CHECK(d.setDAC(-1, di::RXB_LB, 0) == 1100);
|
||||
d.setDAC(1500, di::VCP, 0);
|
||||
CHECK(d.setDAC(-1, di::VCP, 0) == 1500);
|
||||
d.setDAC(2000, di::VCN, 0);
|
||||
CHECK(d.setDAC(-1, di::VCN, 0) == 2000);
|
||||
d.setDAC(1550, di::VIS, 0);
|
||||
CHECK(d.setDAC(-1, di::VIS, 0) == 1550);
|
||||
d.setDAC(660, di::IO_DELAY, 0);
|
||||
CHECK(d.setDAC(-1, di::IO_DELAY, 0) == 660);
|
||||
|
||||
// setting threshold sets all individual vcmp
|
||||
d.setDAC(th, di::THRESHOLD, 0);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == th);
|
||||
|
||||
// different values gives -1
|
||||
if (d.getNumberOfDetectors() > 1) {
|
||||
d.setDAC(1600, di::E_Vcmp_ll, 0, 0);
|
||||
d.setDAC(1700, di::E_Vcmp_ll, 0, 1);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 0) == 1600);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 1) == 1700);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == -1);
|
||||
d.setDAC(1600, di::VCMP_LL, 0, 0);
|
||||
d.setDAC(1700, di::VCMP_LL, 0, 1);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 0) == 1600);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 1) == 1700);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 1) == -1);
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Timer.h"
|
||||
@ -23,10 +23,10 @@
|
||||
// extern dt type;
|
||||
|
||||
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
||||
auto t = slsDetector::getTypeFromDetector(test::hostname);
|
||||
auto t = Module::getTypeFromDetector(test::hostname);
|
||||
CHECK(t == test::type);
|
||||
|
||||
slsDetector d(t);
|
||||
Module d(t);
|
||||
CHECK(d.getDetectorTypeAsEnum() == t);
|
||||
CHECK(d.getDetectorTypeAsString() == test::detector_type);
|
||||
|
||||
@ -51,7 +51,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
int new_cport = 1993;
|
||||
int new_sport = 2000;
|
||||
{
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.getControlPort() == old_cport);
|
||||
d.setControlPort(new_cport);
|
||||
@ -60,7 +60,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
{
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
d.setControlPort(new_cport);
|
||||
d.setStopPort(new_sport);
|
||||
@ -73,7 +73,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
|
||||
d.freeSharedMemory();
|
||||
@ -86,11 +86,11 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// Read type by connecting to the detector
|
||||
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
auto type = Module::getTypeFromDetector(c.hostname);
|
||||
CHECK(type == c.type_enum);
|
||||
|
||||
// Create slsDetector of said type and set hostname and detector online
|
||||
slsDetector d(type);
|
||||
// Create Module of said type and set hostname and detector online
|
||||
Module d(type);
|
||||
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||
CHECK(d.getDetectorTypeAsString() == c.type_string);
|
||||
|
||||
@ -102,8 +102,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
|
||||
// Setting and reading exposure time
|
||||
auto t = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// size of an eiger half module with and without gap pixels
|
||||
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||
@ -133,7 +133,7 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
|
||||
|
||||
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
|
||||
// Check that detector server is unlocked then lock
|
||||
@ -143,8 +143,8 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
|
||||
// Can we still access the detector while it's locked
|
||||
auto t = 1300000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// unlock again and free
|
||||
d.lockServer(0);
|
||||
@ -155,7 +155,7 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
}
|
||||
|
||||
TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||
}
|
||||
@ -163,12 +163,12 @@ TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
|
||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
// acquisitions is number or frames*number of cycles */ ACQUISITION_TIME,
|
||||
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
|
||||
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
|
||||
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
|
||||
// frame (in gated mode) */ CYCLES_NUMBER, /**< number of cycles: total
|
||||
// number of acquisitions is number or frames*number of cycles */
|
||||
// frame (in gated mode) */ TRIGGER_NUMBER, /**< number of triggers: total
|
||||
// number of acquisitions is number or frames*number of triggers */
|
||||
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
// */
|
||||
@ -185,71 +185,60 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
// MAX_TIMERS
|
||||
|
||||
slsDetector d(test::type);
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
|
||||
// Number of frames
|
||||
auto frames = 5;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||
d.setNumberOfFrames(frames);
|
||||
CHECK(d.getNumberOfFrames() == frames);
|
||||
|
||||
auto exptime = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == exptime);
|
||||
d.setExptime(exptime);
|
||||
CHECK(d.getExptime() == exptime);
|
||||
|
||||
auto period = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||
d.setPeriod(period);
|
||||
CHECK(d.getPeriod() == period);
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto delay = 10000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) ==
|
||||
d.setDelayAfterTrigger(delay);
|
||||
CHECK(d.getDelayAfterTrigger() ==
|
||||
delay);
|
||||
}
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto gates = 1;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
}
|
||||
|
||||
auto cycles = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||
auto triggers = 2;
|
||||
d.setNumberOfTriggers(triggers);
|
||||
CHECK(d.getNumberOfTriggers() == triggers);
|
||||
|
||||
if (test::type == dt::EIGER) {
|
||||
auto subtime = 200;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME,
|
||||
subtime);
|
||||
CHECK(d.setTimer(
|
||||
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) ==
|
||||
subtime);
|
||||
d.setSubExptime(subtime);
|
||||
CHECK(d.getSubExptime() == subtime);
|
||||
}
|
||||
// for (int i =0; i!=frames; ++i)
|
||||
d.startAndReadAll();
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
// If we add a timer we should add tests for the timer
|
||||
CHECK(slsDetectorDefs::MAX_TIMERS == 19);
|
||||
}
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
// SingleDetectorConfig c;
|
||||
// auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
// slsDetector d(type);
|
||||
// auto type = Module::getTypeFromDetector(c.hostname);
|
||||
// Module d(type);
|
||||
// d.setHostname(c.hostname);
|
||||
|
||||
// auto period = 1000000000;
|
||||
// auto exptime = 100000000;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
// d.setNumberOfFrames(5);
|
||||
// d.setExptime(exptime);
|
||||
// d.setPeriod(period);
|
||||
// d.startAndReadAll();
|
||||
|
||||
// auto rperiod =
|
||||
// d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
|
||||
// d.getMeasuredPeriod();
|
||||
// CHECK(rperiod == 0.1);
|
||||
|
||||
// d.freeSharedMemory();
|
||||
@ -263,7 +252,7 @@ TEST_CASE(
|
||||
int ratecorr = 125;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure eiger detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -313,7 +302,7 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -398,7 +387,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -468,13 +457,13 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
|
||||
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
|
||||
CHECK(m.setNumberOfFrames(1) == 1);
|
||||
|
||||
// starting fnum
|
||||
uint64_t val = 8;
|
||||
@ -506,7 +495,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure detector type, hostname
|
||||
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
@ -9,7 +9,7 @@ using namespace Catch::literals;
|
||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
auto hostnames = sls::split(test::hostname, '+');
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
DetectorImpl d(0, true, true);
|
||||
d.setHostname(test::hostname.c_str());
|
||||
|
||||
CHECK(d.getHostname() == test::hostname);
|
||||
@ -28,7 +28,7 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
|
||||
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
DetectorImpl d(0, true, true);
|
||||
d.setHostname(test::hostname.c_str());
|
||||
|
||||
// FRAME_NUMBER
|
||||
@ -50,7 +50,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
// DELAY_AFTER_TRIGGER,
|
||||
// GATES_NUMBER,
|
||||
// CYCLES_NUMBER,
|
||||
// TRIGGER_NUMBER,
|
||||
// ACTUAL_TIME
|
||||
// MEASUREMENT_TIME
|
||||
|
||||
|
Submodule libs/pybind11 updated: a23996fce3...4f72ef846f
@ -17,13 +17,13 @@
|
||||
|
||||
/*! \file document.h */
|
||||
|
||||
#include "reader.h"
|
||||
#include "encodedstream.h"
|
||||
#include "internal/meta.h"
|
||||
#include "internal/strfunc.h"
|
||||
#include "memorystream.h"
|
||||
#include "encodedstream.h"
|
||||
#include <new> // placement new
|
||||
#include "reader.h"
|
||||
#include <limits>
|
||||
#include <new> // placement new
|
||||
|
||||
RAPIDJSON_DIAG_PUSH
|
||||
#ifdef _MSC_VER
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
|
||||
#define RAPIDJSON_ENCODEDSTREAM_H_
|
||||
|
||||
#include "stream.h"
|
||||
#include "memorystream.h"
|
||||
#include "stream.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
RAPIDJSON_DIAG_PUSH
|
||||
|
@ -15,9 +15,9 @@
|
||||
#ifndef RAPIDJSON_STRTOD_
|
||||
#define RAPIDJSON_STRTOD_
|
||||
|
||||
#include "ieee754.h"
|
||||
#include "biginteger.h"
|
||||
#include "diyfp.h"
|
||||
#include "ieee754.h"
|
||||
#include "pow10.h"
|
||||
|
||||
RAPIDJSON_NAMESPACE_BEGIN
|
||||
|
@ -164,8 +164,8 @@
|
||||
#include "msinttypes/inttypes.h"
|
||||
#else
|
||||
// Other compilers should have this.
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
//!@endcond
|
||||
#ifdef RAPIDJSON_DOXYGEN_RUNNING
|
||||
|
@ -18,11 +18,11 @@
|
||||
/*! \file reader.h */
|
||||
|
||||
#include "allocators.h"
|
||||
#include "stream.h"
|
||||
#include "encodedstream.h"
|
||||
#include "internal/meta.h"
|
||||
#include "internal/stack.h"
|
||||
#include "internal/strtod.h"
|
||||
#include "stream.h"
|
||||
#include <limits>
|
||||
|
||||
#if defined(RAPIDJSON_SIMD) && defined(_MSC_VER)
|
||||
|
@ -176,6 +176,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-parameters setup.det
|
||||
\end{verbatim}
|
||||
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
|
||||
|
||||
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
|
||||
Other important settings that are configured in the {\tt{setup.det}} file are:
|
||||
@ -353,19 +354,19 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
|
||||
\begin{table}
|
||||
\begin{tabular}{|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{time to send out data ($\mu$s)}\\
|
||||
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{calculated/measered time to send out data ($\mu$s)}\\
|
||||
\hline
|
||||
1 & 16 & \textbf{256} & 3901 & \\
|
||||
\hline
|
||||
1 & 32 & \textbf{128} & 7820 & \\
|
||||
\hline
|
||||
10 & 4 & \textbf{10240} & 98 & 100\\
|
||||
10 & 4 & \textbf{10240} & 98 & 105/128\\
|
||||
\hline
|
||||
10 & 8 & \textbf{5120} & 196 & 200\\
|
||||
10 & 8 & \textbf{5120} & 196 & 210/250\\
|
||||
\hline
|
||||
10 & 16 & \textbf{2560} & 391 & 400\\
|
||||
10 & 16 & \textbf{2560} & 391 & 420/490\\
|
||||
\hline
|
||||
10 & 32 & \textbf{1280} & 782 & 800\\
|
||||
10 & 32 & \textbf{1280} & 782 & 840/977\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
|
||||
@ -621,6 +622,7 @@ Here are the implemented options so far:
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
|
||||
|
||||
@ -794,9 +796,23 @@ Transmission delays should be chosen only to accomodate the writing speed of the
|
||||
Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as:
|
||||
|
||||
\begin{equation}
|
||||
{\tt{txndelay\_frame}}=-tsending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s]}
|
||||
{\tt{txndelay\_frame}}=-t_sending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s] \cdot 8}
|
||||
\end{equation}
|
||||
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing sped of 1/400~$\mu$s (2.5~kHz) in achieved.
|
||||
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing speed of 1/400~$\mu$s (2.5~kHz) in achieved.
|
||||
|
||||
Note that:
|
||||
\begin{enumerate}
|
||||
\item The continuos frame rate goes down when transmission delays are introduced:
|
||||
\begin{equation}
|
||||
continuos\_frame\_rate= \frac{1}{\tt{txndelay\_frame}+t\_sending}
|
||||
\end{equation}
|
||||
\item If your transmission delays reduce the continuos frame rate, you will saturate the memory on board at some point and you will corrupt images. Conservatively, we say that the number of maximum images in buffered mode is the one listed in table~\ref{timgs}, call N\_images. However, one can approximately say that (and here we need to test more, so do not believe to these numbers yet),
|
||||
\begin{equation}
|
||||
N\_tot\_images= N\_images+\frac{ N\_images}{frame\_rate \cdot (t\_delay\_frame + t\_sending) }
|
||||
\end{equation}
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\section{Setting up the PC settings for 10Gb}\label{10g}
|
||||
|
||||
@ -818,12 +834,8 @@ ethtool -G xth1 rx 4096 #or wheterver is the max number for your pc
|
||||
ethtool -C xth1 rx-usecs 100
|
||||
ethtool -A xth1 rx on
|
||||
\end{verbatim}
|
||||
where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
|
||||
To try to bypass being root, we trued something like this:
|
||||
\begin{verbatim}
|
||||
/etc/security/limits.conf username – rtprio 99
|
||||
\end{verbatim}
|
||||
but somehow it did not fully worked so we kept the trick of being root.
|
||||
where {\tt{xth1}} can be replaced with the correct 10Gb device.
|
||||
NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
|
||||
|
||||
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
|
||||
\begin{verbatim}
|
||||
@ -857,10 +869,18 @@ to make the settings permanent, edit /etc/sysctl.conf:
|
||||
\begin{verbatim}
|
||||
# 100MiB
|
||||
net.core.rmem_max = 104857600
|
||||
net.core.rmem_default= 104857600
|
||||
net.core.netdev_max_backlog = 250000
|
||||
\end{verbatim}
|
||||
and run \textbf{sysctl -p}.
|
||||
|
||||
To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
|
||||
To try to bypass being root, we trued something like this:
|
||||
\begin{verbatim}
|
||||
/etc/security/limits.conf username – rtprio 99
|
||||
\end{verbatim}
|
||||
but somehow it did not fully worked so we kept the trick of being root.
|
||||
|
||||
Last, you can disable power saving in the CPU frequency (chose the appropriate command for your system):
|
||||
\begin{verbatim}
|
||||
cpupower frequency-info
|
||||
@ -895,9 +915,6 @@ mount -t tmpfs none /mnt/ramdisk -o size=10G
|
||||
\end{verbatim}
|
||||
check how many GB memory you can allocate, to avoid swapping otherwise
|
||||
|
||||
|
||||
|
||||
|
||||
\section{Offline processing and monitoring}
|
||||
|
||||
\subsection{Data out of the detector: UDP packets}\label{UDP}
|
||||
@ -935,19 +952,22 @@ If you use the option of writing raw files, you will have a raw file for each UD
|
||||
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like:
|
||||
|
||||
\begin{verbatim}
|
||||
Version : 2.0
|
||||
Version : 4.0
|
||||
Detector Type : 3
|
||||
Dynamic Range : 32
|
||||
Ten Giga : 1
|
||||
Image Size : 524288 bytes
|
||||
x : 512 pixels
|
||||
y : 256 pixels
|
||||
Max. Frames Per File : 10000
|
||||
Total Frames : 1
|
||||
Exptime (ns) : 1000000000
|
||||
nPixelsX : 512 pixels
|
||||
nPixelsY : 256 pixels
|
||||
Max Frames Per File : 10000
|
||||
Total Frames : 3
|
||||
Exptime (ns) : 10000000
|
||||
SubExptime (ns) : 2621440
|
||||
SubPeriod(ns) : 2621440
|
||||
Period (ns) : 1000000000
|
||||
Timestamp : Mon Sep 3 09:07:05 2018
|
||||
Period (ns) : 0
|
||||
Gap Pixels Enable : 0
|
||||
Quad Enable : 0
|
||||
Timestamp : Wed Aug 21 16:30:20 2019
|
||||
|
||||
|
||||
#Frame Header
|
||||
@ -957,9 +977,9 @@ Packet Number : 4 bytes
|
||||
Bunch ID : 8 bytes
|
||||
Timestamp : 8 bytes
|
||||
Module Id : 2 bytes
|
||||
X Coordinate : 2 bytes
|
||||
Y Coordinate : 2 bytes
|
||||
Z Coordinate : 2 bytes
|
||||
Row : 2 bytes
|
||||
Column : 2 bytes
|
||||
Reserved : 2 bytes
|
||||
Debug : 4 bytes
|
||||
Round Robin Number : 2 bytes
|
||||
Detector Type : 1 byte
|
||||
@ -970,17 +990,18 @@ Packets Caught Mask : 64 bytes
|
||||
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
|
||||
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release or the {\tt{v4.0.0}} branch if in 4.0.X release of the {\tt{slsDetector}} code.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\
|
||||
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\
|
||||
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested.
|
||||
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
|
||||
Note that the number of images per file is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in \\
|
||||
{\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
\begin{verbatim}
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 2000
|
||||
\end{verbatim}
|
||||
The default is 2000.
|
||||
The default is 2000 in the 3.1.X release. The default has been changed to 10000 frm realease 4.0.X and now this is picked up automatically without doing anything.
|
||||
|
||||
\subsubsection{cbf}
|
||||
The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it downloads architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\
|
||||
@ -1025,11 +1046,12 @@ cbfMaker9M [file_name_with_dir]
|
||||
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
|
||||
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
|
||||
|
||||
From the new {{v4.1.1}} all the define that you see below need only to be modified in the Makefile.
|
||||
|
||||
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
|
||||
\begin{verbatim}
|
||||
#define MYCBF
|
||||
##following line only if you need to process with
|
||||
##BUBBLE (Material Science / uXAS beamlines).
|
||||
##following line only if you need to process with BUBBLE
|
||||
#define MSHeader
|
||||
\end{verbatim}
|
||||
Compile it with:
|
||||
@ -1078,6 +1100,10 @@ To use it any geometry:\\
|
||||
eg.
|
||||
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
With new new software, the new options to run the cbfMaker/hdf5Maker executablesare:
|
||||
|
||||
./hdf5Maker -f [filename] -d [outdirname] -x [npix\_x] -y [npix\_y] -v (v flags that longedge is vertical, no argument) -n [name\_of\_hdf5\_dataset] -m (mask\_hot\_pixels, need to be in file maskpix.txt in the samedir as executable, no argument) -g [0,no filling/1,division/2,interpolation/3,interpolate,alternative]
|
||||
|
||||
\subsection{Read temperatures/HV from boards}
|
||||
|
||||
With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the boards:
|
||||
|
@ -111,7 +111,7 @@
|
||||
"delay"; // sets/gets delay after trigger in s
|
||||
"gates"; // sets/gets number of gates per frame in gated mode
|
||||
"frames"; // sets/gets number of frames
|
||||
"cycles"; // sets/gets number of cycles (use in trigger mode)
|
||||
"triggers"; // sets/gets number of triggers (use in trigger mode)
|
||||
"probes"; // sets/gets number of probes (advanced!)
|
||||
"measurements"; // sets/gets number of non-real time measurements
|
||||
/* read only timers */
|
||||
@ -120,7 +120,7 @@
|
||||
"delayl"; // gets delay left
|
||||
"gatesl"; // gets number of gates left
|
||||
"framesl"; // gets number of frames left
|
||||
"cyclesl"; // gets number of cycles left
|
||||
"triggersl"; // gets number of triggers left
|
||||
"now"; // gets time stamp from the dteector
|
||||
"timestamp"; // gets time stamp for the frames (fifo-style)
|
||||
"framescaught";// gets the entire frames caught by receiver
|
||||
|
@ -94,7 +94,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN and \E raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -115,10 +115,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automatically incremented.\\
|
||||
@ -231,7 +231,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -430,11 +430,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). Returned as a string to be interpreted as an integer ``frames integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers). Returned as atring to be interpreted as an integer ``cycles integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers). Returned as atring to be interpreted as an integer ``triggers integer''
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
@ -556,7 +556,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -372,7 +372,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -95,7 +95,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 9450 6600 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 1050 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 1050 5550 Dead time\001
|
||||
|
@ -341,7 +341,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -401,7 +401,7 @@ gs 1 -1 sc (External trigger) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
12600 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
6600 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -111,7 +111,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2760 825 2700 External trigger\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 8250 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 6600 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 4575 6225 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1140 9525 6225 Period\001
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -127,7 +127,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
|
||||
@ -241,7 +241,7 @@ Figure~\ref{eq:acqflow} shows in which sequence the various scripts and loops ar
|
||||
|
||||
|
||||
If you prefere to handle the acquisition from your acquisition enviroment, simply leave al scripts and scans disabled and call the acquition from your acquisition enviroment. \\
|
||||
Only the frames and cycles loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
Only the frames and triggers loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
|
||||
Hereafter a description of the meaning of the various loops:
|
||||
\begin{description}
|
||||
@ -259,11 +259,11 @@ Hereafter a description of the meaning of the various loops:
|
||||
The detector is moved in the angular positions specified by the positions command.\\
|
||||
The command for moving the detector should be defined as described in~\ref{sec:usersFunc}.\\
|
||||
All data acquired during a position loop will be merged together, unless the number of positions is set to 0. In this case single frames will be converted to angle without merging.\\
|
||||
Avoid using the position loop together with many frames/cycles.
|
||||
Avoid using the position loop together with many frames/triggers.
|
||||
|
||||
\item[Cycles loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times cycles.
|
||||
\item[Triggers loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times triggers.
|
||||
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times cycles.
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times triggers.
|
||||
\end{description}
|
||||
|
||||
Executing a script simply consists in a system call with the arguments specified below. The various scripts are executed only if they are enabled and different than \textit{none}. \\
|
||||
@ -332,11 +332,11 @@ In the following is a list of the main parameters involved in the acquisition ti
|
||||
\item[Period] is the period of the images acquired. If it is shorter than the exposure time plus readout time, it will be ignored.
|
||||
\item[Delay after trigger] can be set as a delay between the trigger signal and the start of the detection time.
|
||||
\item[Number of gates] is used only in \textit{gating} mode and is the number of times that the gate is toggled before the detector is read out. Useful for stroboscopic measurements with gate period shorter than the minim acquisition period of the detector, otherwise can be left to 1.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and cycles have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time cycles.
|
||||
\item[Number of cycles] is the number of times that the frames are acquired. Frames and cycles have the same meaning except in trigger mode, when cycles means the number of triggers that will be accepted. The total number of images is frames time cycles.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and triggers have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time triggers.
|
||||
\item[Number of triggers] is the number of times that the frames are acquired. Frames and triggers have the same meaning except in trigger mode, when triggers means the number of triggers that will be accepted. The total number of images is frames time triggers.
|
||||
\item[Number of probes] is used in stoboscopic measurements when the period is longer than the minimum acquisition period, but shorter than the frame rate.\\
|
||||
In this case the data can be summed in firmware. \\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of cycles to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of triggers to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
The returned images will always have 32~bit dynamic range, while the dynamic range if the detector defines the bit depth of the counters in rder to limit the readout time, if necessary.\\
|
||||
The probes counter waorks also in trigger and gating modes.
|
||||
\end{description}
|
||||
@ -349,14 +349,14 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/normal_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/gated_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of cycles (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of triggers (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/ro_trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of cycles (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of triggers (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -110,10 +110,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automotically incremented.\\
|
||||
@ -234,7 +234,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -393,11 +393,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode).
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers).
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers).
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
@ -518,7 +518,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -1,21 +1,22 @@
|
||||
|
||||
pybind11_add_module(_sls_detector
|
||||
# find_package (Python COMPONENTS Interpreter Development)
|
||||
|
||||
pybind11_add_module(_slsdet
|
||||
src/main.cpp
|
||||
src/enums.cpp
|
||||
src/experimental.cpp
|
||||
src/detector.cpp
|
||||
src/network.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
target_link_libraries(_sls_detector PUBLIC
|
||||
target_link_libraries(_slsdet PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
slsSupportLib
|
||||
zmq )
|
||||
)
|
||||
|
||||
|
||||
|
||||
set_target_properties(_sls_detector PROPERTIES
|
||||
set_target_properties(_slsdet PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
@ -29,17 +30,18 @@ set( PYTHON_FILES
|
||||
detector.py
|
||||
eiger.py
|
||||
errors.py
|
||||
experimental.py
|
||||
jungfrau_ctb.py
|
||||
ctb.py
|
||||
jungfrau.py
|
||||
mythen3.py
|
||||
registers.py
|
||||
lookup.py
|
||||
utils.py
|
||||
|
||||
)
|
||||
|
||||
foreach(FILE ${PYTHON_FILES})
|
||||
configure_file( sls_detector/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/sls_detector/${FILE} )
|
||||
configure_file( slsdet/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} )
|
||||
|
||||
endforeach(FILE ${PYTHON_FILES})
|
||||
|
||||
@ -47,3 +49,6 @@ endforeach(FILE ${PYTHON_FILES})
|
||||
configure_file( scripts/basic.py
|
||||
${CMAKE_BINARY_DIR}/basic.py
|
||||
)
|
||||
configure_file( scripts/test_virtual.py
|
||||
${CMAKE_BINARY_DIR}/test_virtual.py
|
||||
)
|
@ -2,11 +2,14 @@ import os
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
from sls_detector import Eiger, Detector
|
||||
from sls_detector import ExperimentalDetector
|
||||
|
||||
from _sls_detector.io import read_my302_file
|
||||
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from slsdet import dacIndex, readoutMode
|
||||
from slsdet.lookup import view, find
|
||||
|
||||
d = Detector()
|
||||
e = ExperimentalDetector()
|
||||
# e = Eiger()
|
||||
c = Ctb()
|
||||
# j = Jungfrau()
|
||||
# m = Mythen3()
|
||||
|
||||
|
26
python/scripts/cmd_python.py
Normal file
26
python/scripts/cmd_python.py
Normal file
@ -0,0 +1,26 @@
|
||||
import subprocess
|
||||
import locale
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from slsdet import Detector, Eiger, Ctb
|
||||
|
||||
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
||||
|
||||
#Add commands that we should not expect as direct commands in python
|
||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
||||
, 'vcmp_rl', 'vcmp_rr']
|
||||
|
||||
missing = []
|
||||
for c in cmd:
|
||||
if c not in pycmd:
|
||||
print(c)
|
||||
missing.append(c)
|
||||
|
||||
print(f'Missing: {len(missing)} commands')
|
65
python/scripts/generate_enums.py
Normal file
65
python/scripts/generate_enums.py
Normal file
@ -0,0 +1,65 @@
|
||||
"""
|
||||
Code generator for enum bindings in the Python extension.
|
||||
Reads the sls_detector_defs.h and enums_in.cpp then outputs
|
||||
enums.cpp
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from parse import remove_comments
|
||||
|
||||
def extract_enums(lines):
|
||||
line_iter = iter(lines)
|
||||
enums = {}
|
||||
for line in line_iter:
|
||||
m = re.search("(?<=enum )\w+(?= {)", line)
|
||||
if m:
|
||||
enum_name = m.group()
|
||||
# print(enum_name)
|
||||
fields = []
|
||||
while True:
|
||||
l = next(line_iter)
|
||||
if '};' in l:
|
||||
break
|
||||
m = re.search("\w+", l)
|
||||
try:
|
||||
# print('\t', m.group())
|
||||
fields.append(m.group())
|
||||
|
||||
except:
|
||||
pass
|
||||
enums[enum_name] = fields
|
||||
return enums
|
||||
|
||||
def generate_enum_string(enums):
|
||||
data = []
|
||||
for key, value in enums.items():
|
||||
data.append(f'py::enum_<slsDetectorDefs::{key}>(Defs, "{key}")\n')
|
||||
for v in value:
|
||||
data.append(f'\t.value("{v}", slsDetectorDefs::{key}::{v})\n')
|
||||
data.append('.export_values();\n\n')
|
||||
return ''.join(data)
|
||||
|
||||
with open('../../slsSupportLib/include/sls_detector_defs.h') as f:
|
||||
data = f.read()
|
||||
|
||||
data = remove_comments(data)
|
||||
data = data.splitlines()
|
||||
enums = extract_enums(data)
|
||||
s = generate_enum_string(enums)
|
||||
|
||||
with open('../src/enums_in.cpp') as f:
|
||||
data = f.read()
|
||||
|
||||
text = data.replace('[[ENUMS]]', s)
|
||||
warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
|
||||
with open('../src/enums.cpp', 'w') as f:
|
||||
f.write(warning)
|
||||
f.write(text)
|
||||
|
||||
|
||||
# run clang format on the output
|
||||
subprocess.run(['clang-format', '../src/enums.cpp', '-i'])
|
116
python/scripts/generate_functions.py
Normal file
116
python/scripts/generate_functions.py
Normal file
@ -0,0 +1,116 @@
|
||||
"""
|
||||
This file is used to auto generate Python bindings for the
|
||||
sls::Detector class. The tool needs the libclang bindings
|
||||
to be installed.
|
||||
|
||||
When the Detector API is updated this file should be run
|
||||
manually
|
||||
"""
|
||||
from clang import cindex
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
|
||||
from parse import system_include_paths
|
||||
|
||||
default_build_path = "/home/l_frojdh/sls/build/"
|
||||
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--build_path",
|
||||
help="Path to the build database",
|
||||
type=str,
|
||||
default=default_build_path,
|
||||
)
|
||||
cargs = parser.parse_args()
|
||||
|
||||
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
||||
index = cindex.Index.create()
|
||||
args = db.getCompileCommands(fpath)
|
||||
args = list(iter(args).__next__().arguments)[0:-1]
|
||||
args = args + "-x c++ --std=c++11".split()
|
||||
syspath = system_include_paths("clang++")
|
||||
incargs = ["-I" + inc for inc in syspath]
|
||||
args = args + incargs
|
||||
|
||||
|
||||
tu = index.parse(fpath, args=args)
|
||||
|
||||
|
||||
m = []
|
||||
ag = []
|
||||
|
||||
lines = []
|
||||
|
||||
ag2 = []
|
||||
|
||||
def get_arguments(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
args = [
|
||||
"py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()"
|
||||
for item in args
|
||||
]
|
||||
args = ", ".join(args)
|
||||
if args:
|
||||
args = f", {args}"
|
||||
return args
|
||||
|
||||
|
||||
def get_fdec(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
if node.result_type.spelling:
|
||||
return_type = node.result_type.spelling
|
||||
else:
|
||||
return_type = 'void'
|
||||
|
||||
args = ", ".join(args)
|
||||
args = f'({return_type}(Detector::*)({args}))'
|
||||
return args
|
||||
|
||||
|
||||
def visit(node):
|
||||
if node.kind == cindex.CursorKind.CLASS_DECL:
|
||||
if node.displayname == "Detector":
|
||||
for child in node.get_children():
|
||||
if (
|
||||
child.kind == cindex.CursorKind.CXX_METHOD
|
||||
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
||||
):
|
||||
m.append(child)
|
||||
args = get_arguments(child)
|
||||
fs = get_fdec(child)
|
||||
lines.append(
|
||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||
)
|
||||
for child in node.get_children():
|
||||
visit(child)
|
||||
|
||||
# .def("setRxHostname",
|
||||
# (void (Detector::*)(const std::string &, Positions)) &
|
||||
# Detector::setRxHostname,
|
||||
# py::arg(), py::arg() = Positions{})
|
||||
# .def("setRxHostname",
|
||||
# (void (Detector::*)(const std::vector<std::string> &)) &
|
||||
# Detector::setRxHostname,
|
||||
# py::arg())
|
||||
|
||||
|
||||
visit(tu.cursor)
|
||||
|
||||
|
||||
with open("../src/detector_in.cpp") as f:
|
||||
data = f.read()
|
||||
s = "".join(lines)
|
||||
s += ";"
|
||||
text = data.replace("[[FUNCTIONS]]", s)
|
||||
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n"
|
||||
with open("../src/detector.cpp", "w") as f:
|
||||
f.write(warning)
|
||||
f.write(text)
|
||||
|
||||
# run clang format on the output
|
||||
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
|
||||
|
61
python/scripts/list_tested_cmd.py
Executable file
61
python/scripts/list_tested_cmd.py
Executable file
@ -0,0 +1,61 @@
|
||||
"""
|
||||
Utility to find and list which command line functions have tests and
|
||||
where the tests are located
|
||||
"""
|
||||
#local import for for parsing c++
|
||||
import parse
|
||||
|
||||
#General python stuff
|
||||
import os
|
||||
import locale
|
||||
import argparse
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
#Realative path from this dir
|
||||
path = Path('../../slsDetectorSoftware/tests/')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
||||
args = parser.parse_args()
|
||||
|
||||
files = [f for f in os.listdir(path) if 'CmdProxy' in f]
|
||||
tested = []
|
||||
for fname in files:
|
||||
with open(path/fname) as f:
|
||||
data = f.read()
|
||||
data = parse.remove_comments(data)
|
||||
data = data.splitlines()
|
||||
for line in data:
|
||||
if 'TEST_CASE' in line or 'SECTION' in line:
|
||||
cmd = line.split("\"")[1]
|
||||
tested.append([cmd, fname])
|
||||
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
all_cmd = out.stdout.splitlines()
|
||||
all_cmd.pop(0)
|
||||
|
||||
|
||||
|
||||
if args.startswith is not None:
|
||||
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)]
|
||||
|
||||
tn = [cmd[0] for cmd in tested]
|
||||
|
||||
not_tested = [cmd for cmd in all_cmd if cmd not in tn]
|
||||
misnamed = [cmd for cmd in tn if cmd not in all_cmd]
|
||||
tested = [cmd for cmd in tested if cmd[0] in all_cmd]
|
||||
|
||||
|
||||
print("\nThe following commands are tested:")
|
||||
for cmd in tested:
|
||||
print(f'{cmd[0]:>18} : {cmd[1]}')
|
||||
|
||||
print("\nThe following commands are NOT tested:")
|
||||
for cmd in not_tested:
|
||||
print(cmd)
|
||||
|
||||
print(f"\nThe following {len(misnamed)} tests does not match commands and might be misnamed:")
|
||||
for cmd in misnamed:
|
||||
print(cmd)
|
||||
print(f'\nTests cover {len(tested)} of {len(all_cmd)} commands')
|
56
python/scripts/parse.py
Normal file
56
python/scripts/parse.py
Normal file
@ -0,0 +1,56 @@
|
||||
import re
|
||||
import subprocess
|
||||
from subprocess import PIPE
|
||||
import os
|
||||
|
||||
|
||||
def remove_comments(text):
|
||||
def replacer(match):
|
||||
s = match.group(0)
|
||||
if s.startswith('/'):
|
||||
return " " # note: a space and not an empty string
|
||||
else:
|
||||
return s
|
||||
pattern = re.compile(
|
||||
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
||||
re.DOTALL | re.MULTILINE
|
||||
)
|
||||
return re.sub(pattern, replacer, text)
|
||||
|
||||
|
||||
|
||||
|
||||
#based on ccsyspath: https://github.com/AndrewWalker/ccsyspath
|
||||
|
||||
def compiler_preprocessor_verbose(compiler, extraflags):
|
||||
"""Capture the compiler preprocessor stage in verbose mode
|
||||
"""
|
||||
lines = []
|
||||
with open(os.devnull, 'r', encoding='utf-8') as devnull:
|
||||
cmd = [compiler, '-E']
|
||||
cmd += extraflags
|
||||
cmd += ['-', '-v']
|
||||
p = subprocess.Popen(cmd, stdin=devnull, stdout=PIPE, stderr=PIPE)
|
||||
p.wait()
|
||||
lines = p.stderr.read()
|
||||
lines = lines.splitlines()
|
||||
return lines
|
||||
|
||||
def system_include_paths(compiler, cpp=True):
|
||||
extraflags = []
|
||||
if cpp:
|
||||
extraflags = b'-x c++'.split()
|
||||
lines = compiler_preprocessor_verbose(compiler, extraflags)
|
||||
lines = [ line.strip() for line in lines ]
|
||||
|
||||
start = lines.index(b'#include <...> search starts here:')
|
||||
end = lines.index(b'End of search list.')
|
||||
|
||||
lines = lines[start+1:end]
|
||||
paths = []
|
||||
for line in lines:
|
||||
line = line.replace(b'(framework directory)', b'')
|
||||
line = line.strip()
|
||||
paths.append(line)
|
||||
paths = [p.decode('utf-8') for p in paths]
|
||||
return paths
|
164
python/scripts/test_virtual.py
Normal file
164
python/scripts/test_virtual.py
Normal file
@ -0,0 +1,164 @@
|
||||
import pytest
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import datetime as dt
|
||||
|
||||
sys.path.append(os.path.join(os.getcwd(), "bin"))
|
||||
from sls_detector import ExperimentalDetector, detectorSettings
|
||||
|
||||
n_detectors = 3
|
||||
start_port = 1952
|
||||
port_step = 3
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def virtual_jf_detectors(request):
|
||||
"""
|
||||
Fixture that is run once for the module
|
||||
will launch virtual servers and clean up
|
||||
after
|
||||
"""
|
||||
print("Setting up virtual detectors")
|
||||
|
||||
# Ensure that no detector servers are running
|
||||
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
|
||||
|
||||
# Ensure no shared memory exists before tests start
|
||||
d = ExperimentalDetector()
|
||||
d.free()
|
||||
|
||||
# Start servers
|
||||
virtual_jf_detectors = [
|
||||
subprocess.Popen(
|
||||
[
|
||||
"bin/jungfrauDetectorServer_virtual",
|
||||
"--port",
|
||||
f"{start_port+port_step*i}",
|
||||
]
|
||||
)
|
||||
for i in range(n_detectors)
|
||||
]
|
||||
|
||||
# Allow server startup to complete
|
||||
time.sleep(3)
|
||||
|
||||
def fin():
|
||||
print("Cleaning up virtual detectors")
|
||||
d = ExperimentalDetector()
|
||||
d.free()
|
||||
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
|
||||
|
||||
request.addfinalizer(fin)
|
||||
return virtual_jf_detectors # provide the fixture value
|
||||
|
||||
|
||||
def test_shmid(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.getShmId() == 0
|
||||
d.free()
|
||||
|
||||
d = ExperimentalDetector(73)
|
||||
assert d.getShmId() == 73
|
||||
d.free()
|
||||
|
||||
|
||||
def test_hostname(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
d.hostname = "localhost"
|
||||
assert d.hostname == ["localhost"]
|
||||
|
||||
d.hostname = [f"localhost:{start_port+i*port_step}" for i in range(n_detectors)]
|
||||
assert d.hostname == ["localhost"] * n_detectors
|
||||
|
||||
|
||||
def test_fwversion(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.detectorversion == 0 # Firmware of virtual detector
|
||||
assert d.getFirmwareVersion() == [0] * n_detectors
|
||||
|
||||
|
||||
def test_len(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert len(d) == n_detectors
|
||||
assert d.size() == n_detectors
|
||||
|
||||
|
||||
def test_module_geometry(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
geo = d.module_geometry
|
||||
assert geo.x == 1
|
||||
assert geo.y == 3
|
||||
|
||||
|
||||
def test_module_size(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
geo = d.module_size
|
||||
assert geo.x == 1024
|
||||
assert geo.y == 512
|
||||
|
||||
|
||||
def test_settings(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
|
||||
gain_list = [
|
||||
detectorSettings.FIXGAIN1,
|
||||
detectorSettings.FIXGAIN2,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.FORCESWITCHG2,
|
||||
detectorSettings.DYNAMICHG0,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
]
|
||||
|
||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||
for gain in gain_list:
|
||||
d.settings = gain
|
||||
assert d.settings == gain
|
||||
|
||||
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
|
||||
assert d.settings == [
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
]
|
||||
|
||||
d.settings = detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
|
||||
def test_frames(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
d.frames = 10
|
||||
assert d.frames == 10
|
||||
|
||||
# def test_triggers(virtual_jf_detectors):
|
||||
|
||||
def test_exptime(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
|
||||
#default value
|
||||
assert d.exptime == 1e-5
|
||||
|
||||
d.exptime = 1.5
|
||||
assert d.exptime == 1.5
|
||||
|
||||
t = dt.timedelta(microseconds=10)
|
||||
d.exptime = t
|
||||
assert d.exptime == 10e-6
|
||||
|
||||
def test_period(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
|
||||
#default value
|
||||
d.period = 0
|
||||
assert d.period == 0
|
||||
|
||||
d.period = 1.5
|
||||
assert d.period == 1.5
|
||||
|
||||
t = dt.timedelta(microseconds=10)
|
||||
d.period = t
|
||||
assert d.period == 10e-6
|
||||
|
||||
|
@ -8,7 +8,7 @@ import sys
|
||||
import setuptools
|
||||
import os
|
||||
|
||||
__version__ = 'refactor'
|
||||
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
@ -19,31 +19,33 @@ def get_conda_path():
|
||||
return os.environ['CONDA_PREFIX']
|
||||
|
||||
|
||||
class get_pybind_include(object):
|
||||
"""Helper class to determine the pybind11 include path
|
||||
The purpose of this class is to postpone importing pybind11
|
||||
until it is actually installed, so that the ``get_include()``
|
||||
method can be invoked. """
|
||||
# class get_pybind_include(object):
|
||||
# """Helper class to determine the pybind11 include path
|
||||
# The purpose of this class is to postpone importing pybind11
|
||||
# until it is actually installed, so that the ``get_include()``
|
||||
# method can be invoked. """
|
||||
|
||||
def __init__(self, user=False):
|
||||
self.user = user
|
||||
# def __init__(self, user=False):
|
||||
# self.user = user
|
||||
|
||||
def __str__(self):
|
||||
import pybind11
|
||||
return pybind11.get_include(self.user)
|
||||
# def __str__(self):
|
||||
# import pybind11
|
||||
# return pybind11.get_include(self.user)
|
||||
|
||||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'_sls_detector',
|
||||
'_slsdet',
|
||||
['src/main.cpp',
|
||||
'src/enums.cpp',
|
||||
'src/experimental.cpp'],
|
||||
'src/detector.cpp',
|
||||
'src/network.cpp'],
|
||||
include_dirs=[
|
||||
# Path to pybind11 headers
|
||||
get_pybind_include(),
|
||||
get_pybind_include(user=True),
|
||||
os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
|
||||
# get_pybind_include(),
|
||||
# get_pybind_include(user=True),
|
||||
os.path.join('../libs/pybind11/include'),
|
||||
os.path.join(get_conda_path(), 'include'),
|
||||
|
||||
],
|
||||
libraries=['SlsDetector', 'SlsReceiver', 'zmq'],
|
||||
@ -108,20 +110,28 @@ class BuildExt(build_ext):
|
||||
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
||||
for ext in self.extensions:
|
||||
ext.extra_compile_args = opts
|
||||
|
||||
print('**************************************************')
|
||||
print(ct)
|
||||
print(opts)
|
||||
print('**************************************************')
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
|
||||
|
||||
def get_shared_lib():
|
||||
return [f for f in os.listdir('.') if '_slsdet' in f]
|
||||
|
||||
setup(
|
||||
name='sls_detector',
|
||||
name='slsdet',
|
||||
version=__version__,
|
||||
author='Erik Frojdh',
|
||||
author_email='erik.frojdh@psi.ch',
|
||||
url='https://github.com/slsdetectorgroup/sls_detector',
|
||||
url='https://github.com/slsdetectorgroup/slsDetectorPackage',
|
||||
description='Detector API for SLS Detector Group detectors',
|
||||
long_description='',
|
||||
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
||||
ext_modules=ext_modules,
|
||||
install_requires=['pybind11>=2.2'],
|
||||
cmdclass={'build_ext': BuildExt},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
@ -1,9 +0,0 @@
|
||||
from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .experimental import ExperimentalDetector
|
||||
from .jungfrau import Jungfrau
|
||||
from .jungfrau_ctb import JungfrauCTB
|
||||
from _sls_detector import DetectorApi
|
||||
|
||||
import _sls_detector
|
||||
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
File diff suppressed because it is too large
Load Diff
@ -1,596 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Wed Dec 6 11:51:18 2017
|
||||
|
||||
@author: l_frojdh
|
||||
"""
|
||||
|
||||
import socket
|
||||
from collections.abc import Iterable
|
||||
from collections import namedtuple
|
||||
from functools import partial
|
||||
|
||||
from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
from .detector import Detector
|
||||
from .detector_property import DetectorProperty
|
||||
from .utils import element_if_equal
|
||||
from sls_detector.errors import DetectorValueError, DetectorError
|
||||
|
||||
class EigerVcmp:
|
||||
"""
|
||||
Convenience class to be able to loop over vcmp for Eiger
|
||||
|
||||
|
||||
.. todo::
|
||||
|
||||
Support single assignment and perhaps unify with Dac class
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, detector):
|
||||
_names = ['vcmp_ll',
|
||||
'vcmp_lr',
|
||||
'vcmp_rl',
|
||||
'vcmp_rr']
|
||||
self.set = []
|
||||
self.get = []
|
||||
for i in range(detector.n_modules):
|
||||
if i % 2 == 0:
|
||||
name = _names
|
||||
else:
|
||||
name = _names[::-1]
|
||||
for n in name:
|
||||
self.set.append(partial(detector._api.setDac, n, i))
|
||||
self.get.append(partial(detector._api.getDac, n, i))
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [_d() for _d in self.get]
|
||||
return self.get[key]()
|
||||
|
||||
def __setitem__(self, i, value):
|
||||
self.set[i](value)
|
||||
|
||||
def __repr__(self):
|
||||
return 'vcmp: '+ str(self[:])
|
||||
|
||||
|
||||
class EigerDacs(DetectorDacs):
|
||||
_dacs = [('vsvp', 0, 4000, 0),
|
||||
('vtr', 0, 4000, 2500),
|
||||
('vrf', 0, 4000, 3300),
|
||||
('vrs', 0, 4000, 1400),
|
||||
('vsvn', 0, 4000, 4000),
|
||||
('vtgstv', 0, 4000, 2556),
|
||||
('vcmp_ll', 0, 4000, 1500),
|
||||
('vcmp_lr', 0, 4000, 1500),
|
||||
('vcall', 0, 4000, 4000),
|
||||
('vcmp_rl', 0, 4000, 1500),
|
||||
('rxb_rb', 0, 4000, 1100),
|
||||
('rxb_lb', 0, 4000, 1100),
|
||||
('vcmp_rr', 0, 4000, 1500),
|
||||
('vcp', 0, 4000, 200),
|
||||
('vcn', 0, 4000, 2000),
|
||||
('vis', 0, 4000, 1550),
|
||||
('iodelay', 0, 4000, 660)]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
class DetectorDelays:
|
||||
_delaynames = ['frame', 'left', 'right']
|
||||
|
||||
def __init__(self, detector):
|
||||
# We need to at least initially know which detector we are connected to
|
||||
self._detector = detector
|
||||
|
||||
setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
|
||||
detector._api.setDelayFrame,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'frame'))
|
||||
|
||||
setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
|
||||
detector._api.setDelayLeft,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'left'))
|
||||
|
||||
setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
|
||||
detector._api.setDelayRight,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'right'))
|
||||
# Index to support iteration
|
||||
self._current = 0
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self.__getattribute__('_' + name)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if name in self._delaynames:
|
||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
else:
|
||||
super().__setattr__(name, value)
|
||||
|
||||
def __next__(self):
|
||||
if self._current >= len(self._delaynames):
|
||||
self._current = 0
|
||||
raise StopIteration
|
||||
else:
|
||||
self._current += 1
|
||||
return self.__getattr__(self._delaynames[self._current-1])
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
hn = self._detector.hostname
|
||||
r_str = ['Transmission delay [ns]\n'
|
||||
'{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
|
||||
for i in range(self._detector.n_modules):
|
||||
r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
|
||||
return '\n'.join(r_str)
|
||||
|
||||
|
||||
class Eiger(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
|
||||
self._active = DetectorProperty(self._api.getActive,
|
||||
self._api.setActive,
|
||||
self._api.getNumberOfDetectors,
|
||||
'active')
|
||||
|
||||
self._vcmp = EigerVcmp(self)
|
||||
self._dacs = EigerDacs(self)
|
||||
self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
|
||||
self._delay = DetectorDelays(self)
|
||||
|
||||
# Eiger specific adcs
|
||||
self._temp = DetectorAdcs()
|
||||
self._temp.fpga = Adc('temp_fpga', self)
|
||||
self._temp.fpgaext = Adc('temp_fpgaext', self)
|
||||
self._temp.t10ge = Adc('temp_10ge', self)
|
||||
self._temp.dcdc = Adc('temp_dcdc', self)
|
||||
self._temp.sodl = Adc('temp_sodl', self)
|
||||
self._temp.sodr = Adc('temp_sodr', self)
|
||||
self._temp.fpgafl = Adc('temp_fpgafl', self)
|
||||
self._temp.fpgafr = Adc('temp_fpgafr', self)
|
||||
|
||||
@property
|
||||
def active(self):
|
||||
"""
|
||||
Is the detector active? Can be used to enable or disable a detector
|
||||
module
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.active
|
||||
>> active: [True, True]
|
||||
|
||||
d.active[1] = False
|
||||
>> active: [True, False]
|
||||
"""
|
||||
return self._active
|
||||
|
||||
@active.setter
|
||||
def active(self, value):
|
||||
self._active[:] = value
|
||||
|
||||
@property
|
||||
def measured_period(self):
|
||||
return self._api.getMeasuredPeriod()
|
||||
|
||||
@property
|
||||
def measured_subperiod(self):
|
||||
return self._api.getMeasuredSubPeriod()
|
||||
|
||||
@property
|
||||
def add_gappixels(self):
|
||||
"""Enable or disable the (virual) pixels between ASICs
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.add_gappixels = True
|
||||
|
||||
d.add_gappixels
|
||||
>> True
|
||||
|
||||
"""
|
||||
return self._api.getGapPixels()
|
||||
|
||||
@add_gappixels.setter
|
||||
def add_gappixels(self, value):
|
||||
self._api.setGapPixels(value)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
d = Eiger()
|
||||
|
||||
#Set all vrf to 1500
|
||||
d.dacs.vrf = 1500
|
||||
|
||||
#Check vrf
|
||||
d.dacs.vrf
|
||||
>> vrf : 1500, 1500
|
||||
|
||||
#Set a single vtr
|
||||
d.dacs.vtr[0] = 1800
|
||||
|
||||
#Set vrf with multiple values
|
||||
d.dacs.vrf = [3500,3700]
|
||||
d.dacs.vrf
|
||||
>> vrf : 3500, 3700
|
||||
|
||||
#read into a variable
|
||||
var = d.dacs.vrf[:]
|
||||
|
||||
#set multiple with multiple values, mostly used for large systems
|
||||
d.dacs.vcall[0,1] = [3500,3600]
|
||||
d.dacs.vcall
|
||||
>> vcall : 3500, 3600
|
||||
|
||||
d.dacs
|
||||
>>
|
||||
========== DACS =========
|
||||
vsvp : 0, 0
|
||||
vtr : 4000, 4000
|
||||
vrf : 1900, 1900
|
||||
vrs : 1400, 1400
|
||||
vsvn : 4000, 4000
|
||||
vtgstv : 2556, 2556
|
||||
vcmp_ll : 1500, 1500
|
||||
vcmp_lr : 1500, 1500
|
||||
vcall : 4000, 4000
|
||||
vcmp_rl : 1500, 1500
|
||||
rxb_rb : 1100, 1100
|
||||
rxb_lb : 1100, 1100
|
||||
vcmp_rr : 1500, 1500
|
||||
vcp : 1500, 1500
|
||||
vcn : 2000, 2000
|
||||
vis : 1550, 1550
|
||||
iodelay : 660, 660
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def tx_delay(self):
|
||||
"""
|
||||
Transmission delay of the modules to allow running the detector
|
||||
in a network not supporting the full speed of the detector.
|
||||
|
||||
|
||||
::
|
||||
|
||||
d.tx_delay
|
||||
>>
|
||||
Transmission delay [ns]
|
||||
left right frame
|
||||
0:beb048 0 15000 0
|
||||
1:beb049 100 190000 100
|
||||
|
||||
d.tx_delay.left = [2000,5000]
|
||||
"""
|
||||
return self._delay
|
||||
|
||||
def default_settings(self):
|
||||
"""
|
||||
reset the detector to some type of standard settings
|
||||
mostly used when testing
|
||||
"""
|
||||
self.n_frames = 1
|
||||
self.exposure_time = 1
|
||||
self.period = 0
|
||||
self.n_cycles = 1
|
||||
self.n_measurements = 1
|
||||
self.dynamic_range = 16
|
||||
|
||||
@property
|
||||
def eiger_matrix_reset(self):
|
||||
"""
|
||||
Matrix reset bit for Eiger.
|
||||
|
||||
:py:obj:`True` : Normal operation, the matrix is reset before each acq.
|
||||
:py:obj:`False` : Matrix reset disabled. Used to not reset before
|
||||
reading out analog test pulses.
|
||||
"""
|
||||
return self._api.getCounterBit()
|
||||
|
||||
@eiger_matrix_reset.setter
|
||||
def eiger_matrix_reset(self, value):
|
||||
self._api.setCounterBit(value)
|
||||
|
||||
@property
|
||||
def flowcontrol_10g(self):
|
||||
"""
|
||||
:py:obj:`True` - Flow control enabled :py:obj:`False` flow control disabled.
|
||||
Sets for all moduels, if for some reason access to a single module is needed
|
||||
this can be done trough the C++ API.
|
||||
|
||||
"""
|
||||
fc = self._api.getNetworkParameter('flow_control_10g')
|
||||
return element_if_equal([bool(int(e)) for e in fc])
|
||||
|
||||
@flowcontrol_10g.setter
|
||||
def flowcontrol_10g(self, value):
|
||||
if value is True:
|
||||
v = '1'
|
||||
else:
|
||||
v = '0'
|
||||
self._api.setNetworkParameter('flow_control_10g', v, -1)
|
||||
|
||||
def pulse_all_pixels(self, n):
|
||||
"""
|
||||
Pulse each pixel of the chip **n** times using the analog test pulses.
|
||||
The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
|
||||
the highest pulse.
|
||||
|
||||
::
|
||||
|
||||
#Pulse all pixels ten times
|
||||
d.pulse_all_pixels(10)
|
||||
|
||||
#Avoid resetting before acq
|
||||
d.eiger_matrix_reset = False
|
||||
|
||||
d.acq() #take frame
|
||||
|
||||
#Restore normal behaviour
|
||||
d.eiger_matrix_reset = True
|
||||
|
||||
|
||||
"""
|
||||
self._api.pulseAllPixels(n)
|
||||
|
||||
|
||||
def pulse_diagonal(self, n):
|
||||
"""
|
||||
Pulse pixels in super colums in a diagonal fashion. Used for calibration
|
||||
of vcall. Saves time compared to pulsing all pixels.
|
||||
"""
|
||||
self._api.pulseDiagonal(n)
|
||||
|
||||
|
||||
def pulse_chip(self, n):
|
||||
"""
|
||||
Advance the counter by toggling enable. Gives 2*n+2 int the counter
|
||||
|
||||
"""
|
||||
n = int(n)
|
||||
if n >= -1:
|
||||
self._api.pulseChip(n)
|
||||
else:
|
||||
raise ValueError('n must be equal or larger than -1')
|
||||
|
||||
@property
|
||||
def vcmp(self):
|
||||
"""
|
||||
Convenience function to get and set the individual vcmp of chips
|
||||
Used mainly in the calibration code.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Reading
|
||||
d.vcmp[:]
|
||||
>> [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
#Setting
|
||||
d.vcmp = [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
|
||||
"""
|
||||
|
||||
return self._vcmp
|
||||
|
||||
@vcmp.setter
|
||||
def vcmp(self, values):
|
||||
if len(values) == len(self._vcmp.set):
|
||||
for i, v in enumerate(values):
|
||||
self._vcmp.set[i](v)
|
||||
else:
|
||||
raise ValueError('vcmp only compatible with setting all')
|
||||
|
||||
@property
|
||||
def rx_udpport(self):
|
||||
"""
|
||||
UDP port for the receiver. Each module has two ports referred to
|
||||
as rx_udpport and rx_udpport2 in the command line interface
|
||||
here they are grouped for each detector
|
||||
|
||||
::
|
||||
|
||||
[0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
d.rx_udpport
|
||||
>> [50010, 50011, 50004, 50005]
|
||||
|
||||
d.rx_udpport = [50010, 50011, 50012, 50013]
|
||||
|
||||
"""
|
||||
p0 = self._api.getReceiverUDPPort()
|
||||
p1 = self._api.getReceiverUDPPort2()
|
||||
return [int(val) for pair in zip(p0, p1) for val in pair]
|
||||
|
||||
@rx_udpport.setter
|
||||
def rx_udpport(self, ports):
|
||||
"""Requires iterating over elements two and two for setting ports"""
|
||||
a = iter(ports)
|
||||
for i, p in enumerate(zip(a, a)):
|
||||
self._api.setReceiverUDPPort(p[0], i)
|
||||
self._api.setReceiverUDPPort2(p[1], i)
|
||||
|
||||
@property
|
||||
def rx_zmqport(self):
|
||||
"""
|
||||
Return the receiver zmq ports. Note that Eiger has two ports per receiver!
|
||||
|
||||
::
|
||||
|
||||
detector.rx_zmqport
|
||||
>> [30001, 30002, 30003, 30004]
|
||||
|
||||
|
||||
"""
|
||||
_s = self._api.getReceiverStreamingPort()
|
||||
if _s == '':
|
||||
return []
|
||||
else:
|
||||
return [int(_p) + i for _p in _s for i in range(2)]
|
||||
|
||||
@rx_zmqport.setter
|
||||
def rx_zmqport(self, port):
|
||||
if isinstance(port, Iterable):
|
||||
for i, p in enumerate(port):
|
||||
self._api.setReceiverStreamingPort(p, i)
|
||||
else:
|
||||
self._api.setReceiverStreamingPort(port, -1)
|
||||
|
||||
|
||||
@property
|
||||
def sub_exposure_time(self):
|
||||
"""
|
||||
Sub frame exposure time in *seconds* for Eiger in 32bit autosumming mode
|
||||
|
||||
::
|
||||
|
||||
d.sub_exposure_time
|
||||
>> 0.0023
|
||||
|
||||
d.sub_exposure_time = 0.002
|
||||
|
||||
"""
|
||||
return self._api.getSubExposureTime() / 1e9
|
||||
|
||||
|
||||
@sub_exposure_time.setter
|
||||
def sub_exposure_time(self, t):
|
||||
#TODO! checking here or in the detector?
|
||||
ns_time = int(t * 1e9)
|
||||
if ns_time > 0:
|
||||
self._api.setSubExposureTime(ns_time)
|
||||
else:
|
||||
raise DetectorValueError('Sub exposure time must be larger than 0')
|
||||
|
||||
@property
|
||||
def sub_deadtime(self):
|
||||
"""
|
||||
Deadtime between subexposures. Used to mimize noise by delaying the start of the next
|
||||
subexposure.
|
||||
"""
|
||||
return self._api.getSubExposureDeadTime() / 1e9
|
||||
|
||||
|
||||
@sub_deadtime.setter
|
||||
def sub_deadtime(self, t):
|
||||
ns_time = int(t * 1e9)
|
||||
if ns_time >= 0:
|
||||
self._api.setSubExposureDeadTime(ns_time)
|
||||
else:
|
||||
raise ValueError('Sub deadtime time must be larger or equal to 0')
|
||||
|
||||
@property
|
||||
def temp(self):
|
||||
"""
|
||||
An instance of DetectorAdcs used to read the temperature
|
||||
of different components
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
detector.temp
|
||||
>>
|
||||
temp_fpga : 36.90°C, 45.60°C
|
||||
temp_fpgaext : 31.50°C, 32.50°C
|
||||
temp_10ge : 0.00°C, 0.00°C
|
||||
temp_dcdc : 36.00°C, 36.00°C
|
||||
temp_sodl : 33.00°C, 34.50°C
|
||||
temp_sodr : 33.50°C, 34.00°C
|
||||
temp_fpgafl : 33.81°C, 30.93°C
|
||||
temp_fpgafr : 27.88°C, 29.15°C
|
||||
|
||||
a = detector.temp.fpga[:]
|
||||
a
|
||||
>> [36.568, 45.542]
|
||||
|
||||
|
||||
"""
|
||||
return self._temp
|
||||
|
||||
@property
|
||||
def tengiga(self):
|
||||
"""Enable 10Gbit/s data output
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.tengiga
|
||||
>> False
|
||||
|
||||
d.tengiga = True
|
||||
|
||||
"""
|
||||
return self._api.getTenGigabitEthernet()
|
||||
|
||||
@tengiga.setter
|
||||
def tengiga(self, value):
|
||||
self._api.setTenGigabitEthernet(value)
|
||||
|
||||
def set_delays(self, delta):
|
||||
self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
|
||||
self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
|
||||
|
||||
|
||||
def setup500k(self, hostnames):
|
||||
"""
|
||||
Setup the Eiger detector to run on the local machine
|
||||
"""
|
||||
|
||||
self.hostname = hostnames
|
||||
self.file_write = False
|
||||
self.image_size = (512, 1024)
|
||||
self.rx_tcpport = [1954, 1955]
|
||||
self.rx_udpport = [50010, 50011, 50004, 50005]
|
||||
self.rx_hostname = socket.gethostname().split('.')[0]
|
||||
self.rx_datastream = False
|
||||
self.file_write = False
|
||||
self.online = True
|
||||
self.receiver_online = True
|
@ -1,180 +0,0 @@
|
||||
from _sls_detector import multiDetectorApi
|
||||
from _sls_detector import slsDetectorDefs
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
from .utils import element_if_equal, all_equal
|
||||
import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
|
||||
|
||||
def freeze(cls):
|
||||
cls.__frozen = False
|
||||
|
||||
def frozensetattr(self, key, value):
|
||||
if self.__frozen and not hasattr(self, key):
|
||||
raise AttributeError(
|
||||
"Class {} is frozen. Cannot set {} = {}".format(
|
||||
cls.__name__, key, value
|
||||
)
|
||||
)
|
||||
else:
|
||||
object.__setattr__(self, key, value)
|
||||
|
||||
def init_decorator(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
func(self, *args, **kwargs)
|
||||
self.__frozen = True
|
||||
|
||||
return wrapper
|
||||
|
||||
cls.__setattr__ = frozensetattr
|
||||
cls.__init__ = init_decorator(cls.__init__)
|
||||
return cls
|
||||
|
||||
|
||||
@freeze
|
||||
class ExperimentalDetector(multiDetectorApi):
|
||||
"""
|
||||
This class is the base for detector specific
|
||||
interfaces. Most functions exists in two versions
|
||||
like the getExptime() function that uses the
|
||||
C++ API directly and the simplified exptime property.
|
||||
"""
|
||||
def __init__(self, multi_id = 0):
|
||||
"""
|
||||
multi_id refers to the shared memory id of the
|
||||
slsDetectorPackage. Default value is 0.
|
||||
"""
|
||||
super().__init__(multi_id)
|
||||
|
||||
# Acq
|
||||
@property
|
||||
def rx_status(self):
|
||||
"""
|
||||
Read the status of the receiver
|
||||
"""
|
||||
return element_if_equal(self.getReceiverStatus())
|
||||
|
||||
@rx_status.setter
|
||||
def rx_status(self, status_str):
|
||||
if status_str == "start":
|
||||
self.startReceiver()
|
||||
elif status_str == "stop":
|
||||
self.stopReceiver()
|
||||
else:
|
||||
raise NotImplementedError("Unknown argument to rx_status")
|
||||
|
||||
@property
|
||||
def busy(self):
|
||||
"""
|
||||
Checks if the detector is acquiring. Can also be set but should only be used if the acquire fails and
|
||||
leaves the detector with busy == True
|
||||
|
||||
.. note ::
|
||||
|
||||
Only works when the measurement is launched using acquire, not with status start!
|
||||
|
||||
Returns
|
||||
--------
|
||||
bool
|
||||
:py:obj:`True` if the detector is acquiring otherwise :py:obj:`False`
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.busy
|
||||
>> True
|
||||
|
||||
#If the detector is stuck reset by:
|
||||
d.busy = False
|
||||
|
||||
|
||||
"""
|
||||
return self.getAcquiringFlag()
|
||||
|
||||
@busy.setter
|
||||
def busy(self, value):
|
||||
self.setAcquiringFlag(value)
|
||||
|
||||
# Configuration
|
||||
@property
|
||||
def startingfnum(self):
|
||||
return element_if_equal(self.getStartingFrameNumber())
|
||||
|
||||
@startingfnum.setter
|
||||
def startingfnum(self, value):
|
||||
self.setStartingFrameNumber(value)
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return NotImplementedError("config is set only")
|
||||
|
||||
@config.setter
|
||||
def config(self, fname):
|
||||
self.setConfig(fname)
|
||||
|
||||
# File
|
||||
@property
|
||||
def fname(self):
|
||||
return element_if_equal(self.getFileName())
|
||||
|
||||
@fname.setter
|
||||
def fname(self, file_name):
|
||||
self.setFileName(file_name)
|
||||
|
||||
@property
|
||||
def fpath(self):
|
||||
return element_if_equal(self.getFilePath())
|
||||
|
||||
@fpath.setter
|
||||
def fpath(self, path):
|
||||
self.setFilePath(path)
|
||||
|
||||
@property
|
||||
def fwrite(self):
|
||||
return element_if_equal(self.getFileWrite())
|
||||
|
||||
@fwrite.setter
|
||||
def fwrite(self, value):
|
||||
self.setFileWrite(value)
|
||||
|
||||
@property
|
||||
def foverwrite(self):
|
||||
return element_if_equal(self.getFileOverWrite())
|
||||
|
||||
@foverwrite.setter
|
||||
def foverwrite(self, value):
|
||||
self.setFileOverWrite(value)
|
||||
|
||||
# Time
|
||||
@property
|
||||
def exptime(self):
|
||||
res = self.getExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@exptime.setter
|
||||
def exptime(self, t):
|
||||
self.setExptime(dt.timedelta(seconds=t))
|
||||
|
||||
@property
|
||||
def subexptime(self):
|
||||
res = self.getSubExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@subexptime.setter
|
||||
def subexptime(self, t):
|
||||
self.setSubExptime(dt.timedelta(seconds=t))
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
res = self.getPeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@period.setter
|
||||
def period(self, t):
|
||||
self.setPeriod(dt.timedelta(seconds=t))
|
||||
|
@ -1,259 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Jungfrau detector class and support functions.
|
||||
Inherits from Detector.
|
||||
"""
|
||||
from .adcs import Adc, DetectorAdcs
|
||||
from .detector import Detector
|
||||
from .dacs import DetectorDacs
|
||||
from .utils import element_if_equal
|
||||
|
||||
|
||||
class JungfrauDacs(DetectorDacs):
|
||||
_dacs = [('vb_comp', 0, 4000, 1220),
|
||||
('vdd_prot', 0, 4000, 3000),
|
||||
('vin_com', 0, 4000, 1053),
|
||||
('vref_prech', 0, 4000, 1450),
|
||||
('vb_pixbuff', 0, 4000, 750),
|
||||
('vb_ds', 0, 4000, 1000),
|
||||
('vref_ds', 0, 4000, 480),
|
||||
('vref_comp', 0, 4000, 420),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
class Jungfrau(Detector):
|
||||
"""
|
||||
Class used to control a Jungfrau detector. Inherits from the Detector class but a specialized
|
||||
class is needed to provide the correct dacs and unique functions.
|
||||
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
_settings = ['dynamichg0',
|
||||
'dynamicgain',
|
||||
'fixgain1',
|
||||
'fixgain2',
|
||||
'forceswitchg1',
|
||||
'forceswitchg2']
|
||||
"""Available settings for Jungfrau"""
|
||||
|
||||
def __init__(self, multi_id=0):
|
||||
#Init on base calss
|
||||
super().__init__(multi_id)
|
||||
self._dacs = JungfrauDacs(self)
|
||||
|
||||
#Jungfrau specific temps, this can be reduced to a single value?
|
||||
self._temp = DetectorAdcs()
|
||||
self._temp.fpga = Adc('temp_fpga', self)
|
||||
# self._register = Register(self)
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Jungfrau
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def power_chip(self):
|
||||
"""Power on or off the ASICs, True for on False for off"""
|
||||
return self._api.isChipPowered()
|
||||
|
||||
@power_chip.setter
|
||||
def power_chip(self, value):
|
||||
self._api.powerChip(value)
|
||||
|
||||
@property
|
||||
def delay(self):
|
||||
"""Delay after trigger [s]"""
|
||||
return self._api.getDelay()/1e9
|
||||
|
||||
@delay.setter
|
||||
def delay(self, t):
|
||||
ns_time = int(t * 1e9)
|
||||
self._api.setDelay(ns_time)
|
||||
|
||||
@property
|
||||
def n_gates(self):
|
||||
return self._api.getNumberOfGates()
|
||||
|
||||
@n_gates.setter
|
||||
def n_gates(self, n):
|
||||
self._api.setNumberOfGates(n)
|
||||
|
||||
@property
|
||||
def n_probes(self):
|
||||
return self._api.getNumberOfProbes()
|
||||
|
||||
@n_probes.setter
|
||||
def n_probes(self, n):
|
||||
self._api.setNumberOfProbes(n)
|
||||
|
||||
@property
|
||||
def storagecell_start(self):
|
||||
"""
|
||||
First storage cell
|
||||
"""
|
||||
return self._api.getStoragecellStart()
|
||||
|
||||
@storagecell_start.setter
|
||||
def storagecell_start(self, value):
|
||||
self._api.setStoragecellStart(value)
|
||||
|
||||
|
||||
@property
|
||||
def n_storagecells(self):
|
||||
"""
|
||||
number of storage cells used for the measurements
|
||||
"""
|
||||
return self._api.getNumberOfStorageCells()
|
||||
|
||||
@n_storagecells.setter
|
||||
def n_storagecells(self, value):
|
||||
self._api.setNumberOfStorageCells(value)
|
||||
|
||||
@property
|
||||
def temp(self):
|
||||
"""
|
||||
An instance of DetectorAdcs used to read the temperature
|
||||
of different components
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
detector.temp
|
||||
>>
|
||||
temp_fpga : 36.90°C, 45.60°C
|
||||
|
||||
a = detector.temp.fpga[:]
|
||||
a
|
||||
>> [36.568, 45.542]
|
||||
|
||||
|
||||
"""
|
||||
return self._temp
|
||||
|
||||
@property
|
||||
def temperature_threshold(self):
|
||||
"""Threshold for switching of chips"""
|
||||
return self._api.getThresholdTemperature()
|
||||
|
||||
@temperature_threshold.setter
|
||||
def temperature_threshold(self, t):
|
||||
self._api.setThresholdTemperature(t)
|
||||
|
||||
@property
|
||||
def temperature_control(self):
|
||||
"""
|
||||
Monitor the temperature of the detector and switch off chips if temperature_threshold is
|
||||
crossed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#activate
|
||||
detector.temperature_control = True
|
||||
|
||||
#deactivate
|
||||
detector.temperature_control = False
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureControl()
|
||||
|
||||
@temperature_control.setter
|
||||
def temperature_control(self, v):
|
||||
self._api.setTemperatureControl(v)
|
||||
|
||||
@property
|
||||
def temperature_event(self):
|
||||
"""Have the temperature threshold been crossed?
|
||||
|
||||
Returns
|
||||
---------
|
||||
|
||||
:py:obj:`True` if the threshold have been crossed and temperature_control is active
|
||||
otherwise :py:obj:`False`
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureEvent()
|
||||
|
||||
def reset_temperature_event(self):
|
||||
"""Reset the temperature_event. After reset temperature_event is False"""
|
||||
self._api.resetTemperatureEvent()
|
||||
|
||||
@property
|
||||
def rx_udpport(self):
|
||||
"""
|
||||
UDP port for the receiver. Each module have one port.
|
||||
Note! Eiger has two ports
|
||||
|
||||
::
|
||||
|
||||
[0:rx_udpport]
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
d.rx_udpport
|
||||
>> [50010]
|
||||
|
||||
d.rx_udpport = [50010]
|
||||
|
||||
"""
|
||||
return self._api.getNetworkParameter('rx_udpport')
|
||||
|
||||
|
||||
@rx_udpport.setter
|
||||
def rx_udpport(self, ports):
|
||||
"""Requires iterating over elements two and two for setting ports"""
|
||||
for i, p in enumerate(ports):
|
||||
self._api.setNetworkParameter('rx_udpport', str(p), i)
|
||||
|
||||
@property
|
||||
def detector_mac(self):
|
||||
s = self._api.getNetworkParameter('detectormac')
|
||||
return element_if_equal(s)
|
||||
|
||||
|
||||
@detector_mac.setter
|
||||
def detector_mac(self, mac):
|
||||
if isinstance(mac, list):
|
||||
for i, m in enumerate(mac):
|
||||
self._api.setNetworkParameter('detectormac', m, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectormac', mac, -1)
|
||||
|
||||
|
||||
@property
|
||||
def detector_ip(self):
|
||||
s = self._api.getNetworkParameter('detectorip')
|
||||
return element_if_equal(s)
|
||||
|
||||
@detector_ip.setter
|
||||
def detector_ip(self, ip):
|
||||
if isinstance(ip, list):
|
||||
for i, addr in enumerate(ip):
|
||||
self._api.setNetworkParameter('detectorip', addr, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectorip', ip, -1)
|
@ -1,178 +0,0 @@
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from collections import namedtuple
|
||||
import socket
|
||||
|
||||
from .detector import Detector
|
||||
from .utils import element_if_equal
|
||||
from .adcs import DetectorAdcs, Adc
|
||||
from .dacs import DetectorDacs
|
||||
from .detector_property import DetectorProperty
|
||||
from .registers import Register, Adc_register
|
||||
|
||||
class JungfrauCTBDacs(DetectorDacs):
|
||||
_dacs = [('dac0', 0, 4000, 1400),
|
||||
('dac1', 0, 4000, 1200),
|
||||
('dac2', 0, 4000, 900),
|
||||
('dac3', 0, 4000, 1050),
|
||||
('dac4', 0, 4000, 1400),
|
||||
('dac5', 0, 4000, 655),
|
||||
('dac6', 0, 4000, 2000),
|
||||
('dac7', 0, 4000, 1400),
|
||||
('dac8', 0, 4000, 850),
|
||||
('dac9', 0, 4000, 2000),
|
||||
('dac10', 0, 4000, 2294),
|
||||
('dac11', 0, 4000, 983),
|
||||
('dac12', 0, 4000, 1475),
|
||||
('dac13', 0, 4000, 1200),
|
||||
('dac14', 0, 4000, 1600),
|
||||
('dac15', 0, 4000, 1455),
|
||||
('dac16', 0, 4000, 0),
|
||||
('dac17', 0, 4000, 1000),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
class JungfrauCTB(Detector):
|
||||
def __init__(self, id = 0):
|
||||
super().__init__(id)
|
||||
self._dacs = JungfrauCTBDacs(self)
|
||||
self._register = Register(self)
|
||||
self._adc_register = Adc_register(self)
|
||||
|
||||
@property
|
||||
def v_a(self):
|
||||
return self._api.getDac_mV('v_a', -1)
|
||||
|
||||
@v_a.setter
|
||||
def v_a(self, value):
|
||||
self._api.setDac_mV('v_a', -1, value)
|
||||
|
||||
@property
|
||||
def v_b(self):
|
||||
return self._api.getDac_mV('v_b', -1)
|
||||
|
||||
@v_b.setter
|
||||
def v_b(self, value):
|
||||
self._api.setDac_mV('v_b', -1, value)
|
||||
|
||||
|
||||
@property
|
||||
def v_c(self):
|
||||
return self._api.getDac_mV('v_c', -1)
|
||||
|
||||
@v_c.setter
|
||||
def v_c(self, value):
|
||||
self._api.setDac_mV('v_c', -1, value)
|
||||
|
||||
@property
|
||||
def v_d(self):
|
||||
return self._api.getDac_mV('v_d', -1)
|
||||
|
||||
@v_d.setter
|
||||
def v_d(self, value):
|
||||
self._api.setDac_mV('v_d', -1, value)
|
||||
|
||||
@property
|
||||
def v_io(self):
|
||||
return self._api.getDac_mV('v_io', -1)
|
||||
|
||||
@v_io.setter
|
||||
def v_io(self, value):
|
||||
self._api.setDac_mV('v_io', -1, value)
|
||||
|
||||
@property
|
||||
def v_limit(self):
|
||||
return self._api.getDac_mV('v_limit', -1)
|
||||
|
||||
@v_limit.setter
|
||||
def v_limit(self, value):
|
||||
self._api.setDac_mV('v_limit', -1, value)
|
||||
|
||||
@property
|
||||
def adc_register(self):
|
||||
return self._adc_register
|
||||
|
||||
# @property
|
||||
# def register(self):
|
||||
# return self._register
|
||||
|
||||
def adcOFF(self):
|
||||
"""Switch off the ADC"""
|
||||
self.adc_register[0x8] = 1
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#JungfrauCTB
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def dbitpipeline(self):
|
||||
return self._api.getDbitPipeline()
|
||||
|
||||
@dbitpipeline.setter
|
||||
def dbitpipeline(self, value):
|
||||
self._api.setDbitPipeline(value)
|
||||
|
||||
|
||||
@property
|
||||
def dbitphase(self):
|
||||
return self._api.getDbitPhase()
|
||||
|
||||
@dbitphase.setter
|
||||
def dbitphase(self, value):
|
||||
self._api.setDbitPhase(value)
|
||||
|
||||
@property
|
||||
def dbitclock(self):
|
||||
return self._api.getDbitClock()
|
||||
|
||||
@dbitclock.setter
|
||||
def dbitclock(self, value):
|
||||
self._api.setDbitClock(value)
|
||||
|
||||
@property
|
||||
def samples(self):
|
||||
return self._api.getJCTBSamples()
|
||||
|
||||
@samples.setter
|
||||
def samples(self, value):
|
||||
self._api.setJCTBSamples(value)
|
||||
|
||||
@property
|
||||
def readout_clock(self):
|
||||
"""
|
||||
Speed of the readout clock relative to the full speed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getReadoutClockSpeed()
|
||||
|
||||
|
||||
@readout_clock.setter
|
||||
def readout_clock(self, value):
|
||||
self._api.setReadoutClockSpeed(value)
|
@ -1,32 +0,0 @@
|
||||
"""
|
||||
Utility functions that are useful for testing and troubleshooting
|
||||
but not directly used in controlling the detector
|
||||
"""
|
||||
|
||||
|
||||
def all_equal(mylist):
|
||||
"""If all elements are equal return true otherwise false"""
|
||||
return all(x == mylist[0] for x in mylist)
|
||||
|
||||
|
||||
def element_if_equal(mylist):
|
||||
"""If all elements are equal return only one element"""
|
||||
if all_equal(mylist):
|
||||
if len(mylist) == 0:
|
||||
return None
|
||||
else:
|
||||
return mylist[0]
|
||||
else:
|
||||
return mylist
|
||||
|
||||
|
||||
def eiger_register_to_time(register):
|
||||
"""
|
||||
Decode register value and return time in s. Values are stored in
|
||||
a 32bit register with bits 2->0 containing the exponent and bits
|
||||
31->3 containing the significand (int value)
|
||||
|
||||
"""
|
||||
clocks = register >> 3
|
||||
exponent = register & 0b111
|
||||
return clocks*10**exponent / 100e6
|
23
python/slsdet/__init__.py
Executable file
23
python/slsdet/__init__.py
Executable file
@ -0,0 +1,23 @@
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .ctb import Ctb
|
||||
from .dacs import DetectorDacs, Dac
|
||||
from .detector import Detector
|
||||
from .jungfrau import Jungfrau
|
||||
from .mythen3 import Mythen3
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _slsdet import DetectorApi
|
||||
|
||||
import _slsdet
|
||||
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||
timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
MacAddr = _slsdet.MacAddr
|
43
python/slsdet/ctb.py
Normal file
43
python/slsdet/ctb.py
Normal file
@ -0,0 +1,43 @@
|
||||
from .detector import Detector
|
||||
from .utils import element_if_equal
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
class CtbDacs(DetectorDacs):
|
||||
"""
|
||||
Ctb dacs
|
||||
"""
|
||||
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
||||
('dac1', dacIndex(1), 0, 4000, 1200),
|
||||
('dac2', dacIndex(2), 0, 4000, 900),
|
||||
('dac3', dacIndex(3), 0, 4000, 1050),
|
||||
('dac4', dacIndex(4), 0, 4000, 1400),
|
||||
('dac5', dacIndex(5), 0, 4000, 655),
|
||||
('dac6', dacIndex(6), 0, 4000, 2000),
|
||||
('dac7', dacIndex(7), 0, 4000, 1400),
|
||||
('dac8', dacIndex(8), 0, 4000, 850),
|
||||
('dac9', dacIndex(9), 0, 4000, 2000),
|
||||
('dac10', dacIndex(10), 0, 4000, 2294),
|
||||
('dac11', dacIndex(11), 0, 4000, 983),
|
||||
('dac12', dacIndex(12), 0, 4000, 1475),
|
||||
('dac13', dacIndex(13), 0, 4000, 1200),
|
||||
('dac14', dacIndex(14), 0, 4000, 1600),
|
||||
('dac15', dacIndex(15), 0, 4000, 1455),
|
||||
('dac16', dacIndex(16), 0, 4000, 0),
|
||||
('dac17', dacIndex(17), 0, 4000, 1000),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
from .utils import element
|
||||
class Ctb(Detector):
|
||||
def __init__(self, id = 0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = CtbDacs(self)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
return self._dacs
|
||||
|
@ -1,7 +1,9 @@
|
||||
from .detector_property import DetectorProperty
|
||||
from functools import partial
|
||||
import numpy as np
|
||||
|
||||
import _slsdet
|
||||
from .detector import freeze
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
class Dac(DetectorProperty):
|
||||
"""
|
||||
This class represents a dac on the detector. One instance handles all
|
||||
@ -14,11 +16,11 @@ class Dac(DetectorProperty):
|
||||
|
||||
|
||||
"""
|
||||
def __init__(self, name, low, high, default, detector):
|
||||
def __init__(self, name, enum, low, high, default, detector):
|
||||
|
||||
super().__init__(partial(detector._api.getDac, name),
|
||||
partial(detector._api.setDac, name),
|
||||
detector._api.getNumberOfDetectors,
|
||||
super().__init__(partial(detector.getDAC, enum, False),
|
||||
lambda x, y : detector.setDAC(enum, x, False, y),
|
||||
detector.size,
|
||||
name)
|
||||
|
||||
self.min_value = low
|
||||
@ -29,30 +31,16 @@ class Dac(DetectorProperty):
|
||||
|
||||
def __repr__(self):
|
||||
"""String representation for a single dac in all modules"""
|
||||
r_str = ['{:10s}: '.format(self.__name__)]
|
||||
r_str += ['{:5d}, '.format(self.get(i)) for i in range(self.get_nmod())]
|
||||
return ''.join(r_str).strip(', ')
|
||||
|
||||
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||
return f'{self.__name__:10s}:{dacstr}'
|
||||
|
||||
# a = Dac('vrf', dacIndex.VRF, 0, 4000, 2500, d )
|
||||
# @freeze
|
||||
class DetectorDacs:
|
||||
_dacs = [('vsvp', 0, 4000, 0),
|
||||
('vtr', 0, 4000, 2500),
|
||||
('vrf', 0, 4000, 3300),
|
||||
('vrs', 0, 4000, 1400),
|
||||
('vsvn', 0, 4000, 4000),
|
||||
('vtgstv', 0, 4000, 2556),
|
||||
('vcmp_ll', 0, 4000, 1500),
|
||||
('vcmp_lr', 0, 4000, 1500),
|
||||
('vcall', 0, 4000, 4000),
|
||||
('vcmp_rl', 0, 4000, 1500),
|
||||
('rxb_rb', 0, 4000, 1100),
|
||||
('rxb_lb', 0, 4000, 1100),
|
||||
('vcmp_rr', 0, 4000, 1500),
|
||||
('vcp', 0, 4000, 200),
|
||||
('vcn', 0, 4000, 2000),
|
||||
('vis', 0, 4000, 1550),
|
||||
('iodelay', 0, 4000, 660)]
|
||||
_dacs = []
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
_allowed_attr = ['_detector', '_current']
|
||||
_frozen = False
|
||||
|
||||
def __init__(self, detector):
|
||||
# We need to at least initially know which detector we are connected to
|
||||
@ -65,6 +53,8 @@ class DetectorDacs:
|
||||
for _d in self._dacs:
|
||||
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
||||
|
||||
self._frozen = True
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self.__getattribute__('_' + name)
|
||||
|
||||
@ -73,8 +63,11 @@ class DetectorDacs:
|
||||
if name in self._dacnames:
|
||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
else:
|
||||
if self._frozen == True and name not in self._allowed_attr:
|
||||
raise AttributeError(f'Dac not found: {name}')
|
||||
super().__setattr__(name, value)
|
||||
|
||||
|
||||
def __next__(self):
|
||||
if self._current >= len(self._dacs):
|
||||
self._current = 0
|
||||
@ -95,7 +88,7 @@ class DetectorDacs:
|
||||
"""
|
||||
Read the dacs into a numpy array with dimensions [ndacs, nmodules]
|
||||
"""
|
||||
dac_array = np.zeros((len(self._dacs), self._detector.n_modules))
|
||||
dac_array = np.zeros((len(self._dacs), len(self._detector)))
|
||||
for i, _d in enumerate(self):
|
||||
dac_array[i,:] = _d[:]
|
||||
return dac_array
|
||||
@ -115,11 +108,3 @@ class DetectorDacs:
|
||||
for _d in self:
|
||||
_d[:] = _d.default
|
||||
|
||||
def update_nmod(self):
|
||||
"""
|
||||
Update the cached value of nmod, needs to be run after adding or
|
||||
removing detectors
|
||||
"""
|
||||
for _d in self:
|
||||
_d._n_modules = self._detector.n_modules
|
||||
|
1098
python/slsdet/detector.py
Executable file
1098
python/slsdet/detector.py
Executable file
File diff suppressed because it is too large
Load Diff
@ -14,21 +14,20 @@ class DetectorProperty:
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [self.get(i) for i in range(self.get_nmod())]
|
||||
return self.get()
|
||||
elif isinstance(key, Iterable):
|
||||
return [self.get(k) for k in key]
|
||||
return self.get(list(key))
|
||||
else:
|
||||
return self.get(key)
|
||||
return self.get([key])[0] #No list for single value
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
#operate on all values
|
||||
if key == slice(None, None, None):
|
||||
if isinstance(value, (np.integer, int)):
|
||||
for i in range(self.get_nmod()):
|
||||
self.set(i, value)
|
||||
self.set(value, [])
|
||||
elif isinstance(value, Iterable):
|
||||
for i in range(self.get_nmod()):
|
||||
self.set(i, value[i])
|
||||
self.set(value[i], [i])
|
||||
else:
|
||||
raise ValueError('Value should be int or np.integer not', type(value))
|
||||
|
||||
@ -36,15 +35,14 @@ class DetectorProperty:
|
||||
elif isinstance(key, Iterable):
|
||||
if isinstance(value, Iterable):
|
||||
for k,v in zip(key, value):
|
||||
self.set(k,v)
|
||||
self.set(v, [k])
|
||||
|
||||
elif isinstance(value, int):
|
||||
for k in key:
|
||||
self.set(k, value)
|
||||
self.set(value, list(key))
|
||||
|
||||
#Set single value
|
||||
elif isinstance(key, int):
|
||||
self.set(key, value)
|
||||
self.set(value, [key])
|
||||
|
||||
def __repr__(self):
|
||||
s = ', '.join(str(v) for v in self[:])
|
476
python/slsdet/eiger.py
Executable file
476
python/slsdet/eiger.py
Executable file
@ -0,0 +1,476 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Wed Dec 6 11:51:18 2017
|
||||
|
||||
@author: l_frojdh
|
||||
"""
|
||||
|
||||
|
||||
from .detector import Detector
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
# from .utils import element_if_equal
|
||||
# from sls_detector.errors import DetectorValueError, DetectorError
|
||||
|
||||
class EigerVcmp:
|
||||
"""
|
||||
Convenience class to be able to loop over vcmp for Eiger
|
||||
|
||||
|
||||
.. todo::
|
||||
|
||||
Support single assignment and perhaps unify with Dac class
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, detector):
|
||||
_dacs = [ dacIndex.VCMP_LL,
|
||||
dacIndex.VCMP_LR,
|
||||
dacIndex.VCMP_RL,
|
||||
dacIndex.VCMP_RR]
|
||||
self.set = []
|
||||
self.get = []
|
||||
for i in range(detector.size()):
|
||||
if i % 2 == 0:
|
||||
dacs = _dacs
|
||||
else:
|
||||
dacs = _dacs[::-1]
|
||||
for d in dacs:
|
||||
self.set.append(lambda x, d=d, i=i : detector.setDAC(d, x, False, [i]))
|
||||
self.get.append(lambda d=d, i=i : detector.getDAC(d, False, [i])[0])
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [_d() for _d in self.get]
|
||||
return self.get[key]()
|
||||
|
||||
def __setitem__(self, i, value):
|
||||
self.set[i](value)
|
||||
|
||||
def __repr__(self):
|
||||
return 'vcmp: '+ str(self[:])
|
||||
|
||||
|
||||
class EigerDacs(DetectorDacs):
|
||||
"""
|
||||
Eiger specific dacs
|
||||
"""
|
||||
_dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
|
||||
('vtr', dacIndex.VTR,0, 4000, 2500),
|
||||
('vrf', dacIndex.VRF,0, 4000, 3300),
|
||||
('vrs', dacIndex.VRS,0, 4000, 1400),
|
||||
('vsvn', dacIndex.SVN,0, 4000, 4000),
|
||||
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
|
||||
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
|
||||
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
|
||||
('vcall', dacIndex.CAL,0, 4000, 4000),
|
||||
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
|
||||
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
|
||||
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
|
||||
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
|
||||
('vcp', dacIndex.VCP,0, 4000, 200),
|
||||
('vcn', dacIndex.VCN,0, 4000, 2000),
|
||||
('vis', dacIndex.VIS,0, 4000, 1550),
|
||||
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
# # noinspection PyProtectedMember
|
||||
# class DetectorDelays:
|
||||
# _delaynames = ['frame', 'left', 'right']
|
||||
|
||||
# def __init__(self, detector):
|
||||
# # We need to at least initially know which detector we are connected to
|
||||
# self._detector = detector
|
||||
|
||||
# setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
|
||||
# detector._api.setDelayFrame,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'frame'))
|
||||
|
||||
# setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
|
||||
# detector._api.setDelayLeft,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'left'))
|
||||
|
||||
# setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
|
||||
# detector._api.setDelayRight,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'right'))
|
||||
# # Index to support iteration
|
||||
# self._current = 0
|
||||
|
||||
# def __getattr__(self, name):
|
||||
# return self.__getattribute__('_' + name)
|
||||
|
||||
# def __setattr__(self, name, value):
|
||||
# if name in self._delaynames:
|
||||
# return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
# else:
|
||||
# super().__setattr__(name, value)
|
||||
|
||||
# def __next__(self):
|
||||
# if self._current >= len(self._delaynames):
|
||||
# self._current = 0
|
||||
# raise StopIteration
|
||||
# else:
|
||||
# self._current += 1
|
||||
# return self.__getattr__(self._delaynames[self._current-1])
|
||||
|
||||
# def __iter__(self):
|
||||
# return self
|
||||
|
||||
# def __repr__(self):
|
||||
# hn = self._detector.hostname
|
||||
# r_str = ['Transmission delay [ns]\n'
|
||||
# '{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
|
||||
# for i in range(self._detector.n_modules):
|
||||
# r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
|
||||
# return '\n'.join(r_str)
|
||||
|
||||
from .detector import freeze
|
||||
|
||||
@freeze
|
||||
class Eiger(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = EigerDacs(self)
|
||||
self._vcmp = EigerVcmp(self)
|
||||
|
||||
# self._active = DetectorProperty(self.getActive,
|
||||
# self.setActive,
|
||||
# self.size,
|
||||
# 'active')
|
||||
|
||||
# self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
|
||||
# self._delay = DetectorDelays(self)
|
||||
|
||||
# # Eiger specific adcs
|
||||
# self._temp = DetectorAdcs()
|
||||
# self._temp.fpga = Adc('temp_fpga', self)
|
||||
# self._temp.fpgaext = Adc('temp_fpgaext', self)
|
||||
# self._temp.t10ge = Adc('temp_10ge', self)
|
||||
# self._temp.dcdc = Adc('temp_dcdc', self)
|
||||
# self._temp.sodl = Adc('temp_sodl', self)
|
||||
# self._temp.sodr = Adc('temp_sodr', self)
|
||||
# self._temp.fpgafl = Adc('temp_fpgafl', self)
|
||||
# self._temp.fpgafr = Adc('temp_fpgafr', self)
|
||||
|
||||
# @property
|
||||
# def active(self):
|
||||
# """
|
||||
# Is the detector active? Can be used to enable or disable a detector
|
||||
# module
|
||||
|
||||
# Examples
|
||||
# ----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.active
|
||||
# >> active: [True, True]
|
||||
|
||||
# d.active[1] = False
|
||||
# >> active: [True, False]
|
||||
# """
|
||||
# return self._active
|
||||
|
||||
# @active.setter
|
||||
# def active(self, value):
|
||||
# self._active[:] = value
|
||||
|
||||
# @property
|
||||
# def measured_period(self):
|
||||
# return self._api.getMeasuredPeriod()
|
||||
|
||||
# @property
|
||||
# def measured_subperiod(self):
|
||||
# return self._api.getMeasuredSubPeriod()
|
||||
|
||||
# @property
|
||||
# def add_gappixels(self):
|
||||
# """Enable or disable the (virual) pixels between ASICs
|
||||
|
||||
# Examples
|
||||
# ----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.add_gappixels = True
|
||||
|
||||
# d.add_gappixels
|
||||
# >> True
|
||||
|
||||
# """
|
||||
# return self._api.getGapPixels()
|
||||
|
||||
# @add_gappixels.setter
|
||||
# def add_gappixels(self, value):
|
||||
# self._api.setGapPixels(value)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
d = Eiger()
|
||||
|
||||
#Set all vrf to 1500
|
||||
d.dacs.vrf = 1500
|
||||
|
||||
#Check vrf
|
||||
d.dacs.vrf
|
||||
>> vrf : 1500, 1500
|
||||
|
||||
#Set a single vtr
|
||||
d.dacs.vtr[0] = 1800
|
||||
|
||||
#Set vrf with multiple values
|
||||
d.dacs.vrf = [3500,3700]
|
||||
d.dacs.vrf
|
||||
>> vrf : 3500, 3700
|
||||
|
||||
#read into a variable
|
||||
var = d.dacs.vrf[:]
|
||||
|
||||
#set multiple with multiple values, mostly used for large systems
|
||||
d.dacs.vcall[0,1] = [3500,3600]
|
||||
d.dacs.vcall
|
||||
>> vcall : 3500, 3600
|
||||
|
||||
d.dacs
|
||||
>>
|
||||
========== DACS =========
|
||||
vsvp : 0, 0
|
||||
vtr : 4000, 4000
|
||||
vrf : 1900, 1900
|
||||
vrs : 1400, 1400
|
||||
vsvn : 4000, 4000
|
||||
vtgstv : 2556, 2556
|
||||
vcmp_ll : 1500, 1500
|
||||
vcmp_lr : 1500, 1500
|
||||
vcall : 4000, 4000
|
||||
vcmp_rl : 1500, 1500
|
||||
rxb_rb : 1100, 1100
|
||||
rxb_lb : 1100, 1100
|
||||
vcmp_rr : 1500, 1500
|
||||
vcp : 1500, 1500
|
||||
vcn : 2000, 2000
|
||||
vis : 1550, 1550
|
||||
iodelay : 660, 660
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
# @property
|
||||
# def tx_delay(self):
|
||||
# """
|
||||
# Transmission delay of the modules to allow running the detector
|
||||
# in a network not supporting the full speed of the detector.
|
||||
|
||||
|
||||
# ::
|
||||
|
||||
# d.tx_delay
|
||||
# >>
|
||||
# Transmission delay [ns]
|
||||
# left right frame
|
||||
# 0:beb048 0 15000 0
|
||||
# 1:beb049 100 190000 100
|
||||
|
||||
# d.tx_delay.left = [2000,5000]
|
||||
# """
|
||||
# return self._delay
|
||||
|
||||
# def pulse_all_pixels(self, n):
|
||||
# """
|
||||
# Pulse each pixel of the chip **n** times using the analog test pulses.
|
||||
# The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
|
||||
# the highest pulse.
|
||||
|
||||
# ::
|
||||
|
||||
# #Pulse all pixels ten times
|
||||
# d.pulse_all_pixels(10)
|
||||
|
||||
# #Avoid resetting before acq
|
||||
# d.eiger_matrix_reset = False
|
||||
|
||||
# d.acq() #take frame
|
||||
|
||||
# #Restore normal behaviour
|
||||
# d.eiger_matrix_reset = True
|
||||
|
||||
|
||||
# """
|
||||
# self._api.pulseAllPixels(n)
|
||||
|
||||
|
||||
# def pulse_diagonal(self, n):
|
||||
# """
|
||||
# Pulse pixels in super colums in a diagonal fashion. Used for calibration
|
||||
# of vcall. Saves time compared to pulsing all pixels.
|
||||
# """
|
||||
# self._api.pulseDiagonal(n)
|
||||
|
||||
|
||||
# def pulse_chip(self, n):
|
||||
# """
|
||||
# Advance the counter by toggling enable. Gives 2*n+2 int the counter
|
||||
|
||||
# """
|
||||
# n = int(n)
|
||||
# if n >= -1:
|
||||
# self._api.pulseChip(n)
|
||||
# else:
|
||||
# raise ValueError('n must be equal or larger than -1')
|
||||
|
||||
@property
|
||||
def vcmp(self):
|
||||
"""
|
||||
Convenience function to get and set the individual vcmp of chips
|
||||
Used mainly in the calibration code.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Reading
|
||||
d.vcmp[:]
|
||||
>> [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
#Setting
|
||||
d.vcmp = [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
|
||||
"""
|
||||
|
||||
return self._vcmp
|
||||
|
||||
@vcmp.setter
|
||||
def vcmp(self, values):
|
||||
if len(values) == len(self._vcmp.set):
|
||||
for i, v in enumerate(values):
|
||||
self._vcmp.set[i](v)
|
||||
else:
|
||||
raise ValueError('vcmp only compatible with setting all')
|
||||
|
||||
# @property
|
||||
# def rx_udpport(self):
|
||||
# """
|
||||
# UDP port for the receiver. Each module has two ports referred to
|
||||
# as rx_udpport and rx_udpport2 in the command line interface
|
||||
# here they are grouped for each detector
|
||||
|
||||
# ::
|
||||
|
||||
# [0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
|
||||
|
||||
# Examples
|
||||
# -----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.rx_udpport
|
||||
# >> [50010, 50011, 50004, 50005]
|
||||
|
||||
# d.rx_udpport = [50010, 50011, 50012, 50013]
|
||||
|
||||
# """
|
||||
# p0 = self._api.getReceiverUDPPort()
|
||||
# p1 = self._api.getReceiverUDPPort2()
|
||||
# return [int(val) for pair in zip(p0, p1) for val in pair]
|
||||
|
||||
# @rx_udpport.setter
|
||||
# def rx_udpport(self, ports):
|
||||
# """Requires iterating over elements two and two for setting ports"""
|
||||
# a = iter(ports)
|
||||
# for i, p in enumerate(zip(a, a)):
|
||||
# self._api.setReceiverUDPPort(p[0], i)
|
||||
# self._api.setReceiverUDPPort2(p[1], i)
|
||||
|
||||
@property
|
||||
def rx_zmqport(self):
|
||||
"""
|
||||
Return the receiver zmq ports. Note that Eiger has two ports per receiver!
|
||||
This functions therefore differ from the base class.
|
||||
|
||||
::
|
||||
|
||||
e.rx_zmqport
|
||||
>> [30001, 30002, 30003, 30004]
|
||||
|
||||
|
||||
"""
|
||||
ports = self.getRxZmqPort()
|
||||
return [p + i for p in ports for i in range(2)]
|
||||
|
||||
|
||||
# @rx_zmqport.setter
|
||||
# def rx_zmqport(self, port):
|
||||
# if isinstance(port, Iterable):
|
||||
# for i, p in enumerate(port):
|
||||
# self._api.setReceiverStreamingPort(p, i)
|
||||
# else:
|
||||
# self._api.setReceiverStreamingPort(port, -1)
|
||||
|
||||
# @property
|
||||
# def temp(self):
|
||||
# """
|
||||
# An instance of DetectorAdcs used to read the temperature
|
||||
# of different components
|
||||
|
||||
# Examples
|
||||
# -----------
|
||||
|
||||
# ::
|
||||
|
||||
# detector.temp
|
||||
# >>
|
||||
# temp_fpga : 36.90°C, 45.60°C
|
||||
# temp_fpgaext : 31.50°C, 32.50°C
|
||||
# temp_10ge : 0.00°C, 0.00°C
|
||||
# temp_dcdc : 36.00°C, 36.00°C
|
||||
# temp_sodl : 33.00°C, 34.50°C
|
||||
# temp_sodr : 33.50°C, 34.00°C
|
||||
# temp_fpgafl : 33.81°C, 30.93°C
|
||||
# temp_fpgafr : 27.88°C, 29.15°C
|
||||
|
||||
# a = detector.temp.fpga[:]
|
||||
# a
|
||||
# >> [36.568, 45.542]
|
||||
|
||||
|
||||
# """
|
||||
# return self._temp
|
||||
|
||||
|
||||
|
||||
# def set_delays(self, delta):
|
||||
# self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
|
||||
# self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
|
||||
|
||||
|
54
python/slsdet/jungfrau.py
Normal file
54
python/slsdet/jungfrau.py
Normal file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This file contains the specialization for the Jungfrau detector
|
||||
"""
|
||||
|
||||
|
||||
from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# @freeze
|
||||
class JungfrauDacs(DetectorDacs):
|
||||
"""
|
||||
Jungfrau specific DACs
|
||||
"""
|
||||
_dacs = [('vb_comp', dacIndex.VB_COMP, 0, 4000, 1220),
|
||||
('vdd_prot', dacIndex.VDD_PROT, 0, 4000, 3000),
|
||||
('vin_com', dacIndex.VIN_COM, 0, 4000, 1053),
|
||||
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 1450),
|
||||
('vb_pixbuff', dacIndex.VB_PIXBUF, 0, 4000, 750),
|
||||
('vb_ds', dacIndex.VB_DS, 0, 4000, 1000),
|
||||
('vref_ds', dacIndex.VREF_DS, 0, 4000, 480),
|
||||
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 420),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
|
||||
@freeze
|
||||
class Jungfrau(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = JungfrauDacs(self)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
return self._dacs
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user