1
0
Fork 0
mirror of https://github.com/gwm17/Mask.git synced 2024-11-22 10:18:50 -05:00

First commit

This commit is contained in:
Gordon McCann 2020-11-16 13:38:39 -05:00
commit b009f56ba0
61 changed files with 7054 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
###Files to ignore###
*.root
*.png
*.sublime-workspace
*.sublime-project
###Keep this file###
!.gitignore

1
README.md Normal file
View File

@ -0,0 +1 @@
#Kinematics

BIN
bin/kinematics Executable file

Binary file not shown.

Binary file not shown.

484
checkfile.txt Normal file
View File

@ -0,0 +1,484 @@
RINGS
det ch corner x_fl y_fl z_fl r_fl t_fl p_fl x_ti y_ti z_ti r_ti t_ti p_ti
0 0 0 1.78297 3.46928 0 3.90062 90 62.8 3.00456 1.10206 -10.22 10.7093 162.613 20.1428
0 0 1 -1.78297 3.46928 0 3.90062 90 117.2 0.11966 3.19806 -10.22 10.7093 162.613 87.8572
0 0 2 -1.49014 2.8995 0 3.26 90 117.2 0.100008 2.67282 -10.5862 10.9189 165.821 87.8572
0 0 3 1.49014 2.8995 0 3.26 90 62.8 2.5111 0.921061 -10.5862 10.9189 165.821 20.1428
0 1 0 2.0758 4.03906 0 4.54125 90 62.8 3.49802 1.28306 -9.85374 10.5346 159.287 20.1428
0 1 1 -2.0758 4.03906 0 4.54125 90 117.2 0.139313 3.7233 -9.85374 10.5346 159.287 87.8572
0 1 2 -1.78297 3.46928 0 3.90062 90 117.2 0.11966 3.19806 -10.22 10.7093 162.613 87.8572
0 1 3 1.78297 3.46928 0 3.90062 90 62.8 3.00456 1.10206 -10.22 10.7093 162.613 20.1428
0 2 0 2.36862 4.60884 0 5.18187 90 62.8 3.99148 1.46406 -9.48749 10.3965 155.862 20.1428
0 2 1 -2.36862 4.60884 0 5.18187 90 117.2 0.158965 4.24854 -9.48749 10.3965 155.862 87.8572
0 2 2 -2.0758 4.03906 0 4.54125 90 117.2 0.139313 3.7233 -9.85374 10.5346 159.287 87.8572
0 2 3 2.0758 4.03906 0 4.54125 90 62.8 3.49802 1.28306 -9.85374 10.5346 159.287 20.1428
0 3 0 2.66145 5.17863 0 5.8225 90 62.8 4.48494 1.64505 -9.12124 10.2965 152.357 20.1428
0 3 1 -2.66145 5.17863 0 5.8225 90 117.2 0.178618 4.77378 -9.12124 10.2965 152.357 87.8572
0 3 2 -2.36862 4.60884 0 5.18187 90 117.2 0.158965 4.24854 -9.48749 10.3965 155.862 87.8572
0 3 3 2.36862 4.60884 0 5.18187 90 62.8 3.99148 1.46406 -9.48749 10.3965 155.862 20.1428
0 4 0 2.95428 5.74841 0 6.46312 90 62.8 4.9784 1.82605 -8.75499 10.2357 148.798 20.1428
0 4 1 -2.95428 5.74841 0 6.46312 90 117.2 0.19827 5.29902 -8.75499 10.2357 148.798 87.8572
0 4 2 -2.66145 5.17863 0 5.8225 90 117.2 0.178618 4.77378 -9.12124 10.2965 152.357 87.8572
0 4 3 2.66145 5.17863 0 5.8225 90 62.8 4.48494 1.64505 -9.12124 10.2965 152.357 20.1428
0 5 0 3.24711 6.31819 0 7.10375 90 62.8 5.47186 2.00705 -8.38874 10.2147 145.209 20.1428
0 5 1 -3.24711 6.31819 0 7.10375 90 117.2 0.217923 5.82426 -8.38874 10.2147 145.209 87.8572
0 5 2 -2.95428 5.74841 0 6.46312 90 117.2 0.19827 5.29902 -8.75499 10.2357 148.798 87.8572
0 5 3 2.95428 5.74841 0 6.46312 90 62.8 4.9784 1.82605 -8.75499 10.2357 148.798 20.1428
0 6 0 3.53994 6.88797 0 7.74438 90 62.8 5.96532 2.18805 -8.0225 10.2339 141.62 20.1428
0 6 1 -3.53994 6.88797 0 7.74438 90 117.2 0.237576 6.3495 -8.0225 10.2339 141.62 87.8572
0 6 2 -3.24711 6.31819 0 7.10375 90 117.2 0.217923 5.82426 -8.38874 10.2147 145.209 87.8572
0 6 3 3.24711 6.31819 0 7.10375 90 62.8 5.47186 2.00705 -8.38874 10.2147 145.209 20.1428
0 7 0 3.83277 7.45776 0 8.385 90 62.8 6.45877 2.36905 -7.65625 10.293 138.059 20.1428
0 7 1 -3.83277 7.45776 0 8.385 90 117.2 0.257228 6.87474 -7.65625 10.293 138.059 87.8572
0 7 2 -3.53994 6.88797 0 7.74438 90 117.2 0.237576 6.3495 -8.0225 10.2339 141.62 87.8572
0 7 3 3.53994 6.88797 0 7.74438 90 62.8 5.96532 2.18805 -8.0225 10.2339 141.62 20.1428
0 8 0 4.12559 8.02754 0 9.02562 90 62.8 6.95223 2.55005 -7.29 10.3914 134.551 20.1428
0 8 1 -4.12559 8.02754 0 9.02562 90 117.2 0.276881 7.39997 -7.29 10.3914 134.551 87.8572
0 8 2 -3.83277 7.45776 0 8.385 90 117.2 0.257228 6.87474 -7.65625 10.293 138.059 87.8572
0 8 3 3.83277 7.45776 0 8.385 90 62.8 6.45877 2.36905 -7.65625 10.293 138.059 20.1428
0 9 0 4.41842 8.59732 0 9.66625 90 62.8 7.44569 2.73105 -6.92375 10.5278 131.122 20.1428
0 9 1 -4.41842 8.59732 0 9.66625 90 117.2 0.296533 7.92521 -6.92375 10.5278 131.122 87.8572
0 9 2 -4.12559 8.02754 0 9.02562 90 117.2 0.276881 7.39997 -7.29 10.3914 134.551 87.8572
0 9 3 4.12559 8.02754 0 9.02562 90 62.8 6.95223 2.55005 -7.29 10.3914 134.551 20.1428
0 10 0 4.71125 9.1671 0 10.3069 90 62.8 7.93915 2.91204 -6.5575 10.701 127.792 20.1428
0 10 1 -4.71125 9.1671 0 10.3069 90 117.2 0.316186 8.45045 -6.5575 10.701 127.792 87.8572
0 10 2 -4.41842 8.59732 0 9.66625 90 117.2 0.296533 7.92521 -6.92375 10.5278 131.122 87.8572
0 10 3 4.41842 8.59732 0 9.66625 90 62.8 7.44569 2.73105 -6.92375 10.5278 131.122 20.1428
0 11 0 5.00408 9.73689 0 10.9475 90 62.8 8.43261 3.09304 -6.19125 10.9091 124.578 20.1428
0 11 1 -5.00408 9.73689 0 10.9475 90 117.2 0.335839 8.97569 -6.19125 10.9091 124.578 87.8572
0 11 2 -4.71125 9.1671 0 10.3069 90 117.2 0.316186 8.45045 -6.5575 10.701 127.792 87.8572
0 11 3 4.71125 9.1671 0 10.3069 90 62.8 7.93915 2.91204 -6.5575 10.701 127.792 20.1428
0 12 0 5.29691 10.3067 0 11.5881 90 62.8 8.92607 3.27404 -5.825 11.1501 121.495 20.1428
0 12 1 -5.29691 10.3067 0 11.5881 90 117.2 0.355491 9.50093 -5.825 11.1501 121.495 87.8572
0 12 2 -5.00408 9.73689 0 10.9475 90 117.2 0.335839 8.97569 -6.19125 10.9091 124.578 87.8572
0 12 3 5.00408 9.73689 0 10.9475 90 62.8 8.43261 3.09304 -6.19125 10.9091 124.578 20.1428
0 13 0 5.58974 10.8765 0 12.2287 90 62.8 9.41953 3.45504 -5.45875 11.422 118.549 20.1428
0 13 1 -5.58974 10.8765 0 12.2287 90 117.2 0.375144 10.0262 -5.45875 11.422 118.549 87.8572
0 13 2 -5.29691 10.3067 0 11.5881 90 117.2 0.355491 9.50093 -5.825 11.1501 121.495 87.8572
0 13 3 5.29691 10.3067 0 11.5881 90 62.8 8.92607 3.27404 -5.825 11.1501 121.495 20.1428
0 14 0 5.88256 11.4462 0 12.8694 90 62.8 9.91299 3.63604 -5.0925 11.7227 115.748 20.1428
0 14 1 -5.88256 11.4462 0 12.8694 90 117.2 0.394796 10.5514 -5.0925 11.7227 115.748 87.8572
0 14 2 -5.58974 10.8765 0 12.2287 90 117.2 0.375144 10.0262 -5.45875 11.422 118.549 87.8572
0 14 3 5.58974 10.8765 0 12.2287 90 62.8 9.41953 3.45504 -5.45875 11.422 118.549 20.1428
0 15 0 6.17539 12.016 0 13.51 90 62.8 10.4064 3.81704 -4.72625 12.05 113.093 20.1428
0 15 1 -6.17539 12.016 0 13.51 90 117.2 0.414449 11.0766 -4.72625 12.05 113.093 87.8572
0 15 2 -5.88256 11.4462 0 12.8694 90 117.2 0.394796 10.5514 -5.0925 11.7227 115.748 87.8572
0 15 3 5.88256 11.4462 0 12.8694 90 62.8 9.91299 3.63604 -5.0925 11.7227 115.748 20.1428
1 0 0 1.78297 3.46928 0 3.90062 90 62.8 1.97658 -2.51695 -10.22 10.7093 162.613 308.143
1 0 1 -1.78297 3.46928 0 3.90062 90 117.2 3.07852 0.874452 -10.22 10.7093 162.613 15.8572
1 0 2 -1.49014 2.8995 0 3.26 90 117.2 2.57291 0.730835 -10.5862 10.9189 165.821 15.8572
1 0 3 1.49014 2.8995 0 3.26 90 62.8 1.65195 -2.10358 -10.5862 10.9189 165.821 308.143
1 1 0 2.0758 4.03906 0 4.54125 90 62.8 2.30121 -2.93033 -9.85374 10.5346 159.287 308.143
1 1 1 -2.0758 4.03906 0 4.54125 90 117.2 3.58412 1.01807 -9.85374 10.5346 159.287 15.8572
1 1 2 -1.78297 3.46928 0 3.90062 90 117.2 3.07852 0.874452 -10.22 10.7093 162.613 15.8572
1 1 3 1.78297 3.46928 0 3.90062 90 62.8 1.97658 -2.51695 -10.22 10.7093 162.613 308.143
1 2 0 2.36862 4.60884 0 5.18187 90 62.8 2.62584 -3.3437 -9.48749 10.3965 155.862 308.143
1 2 1 -2.36862 4.60884 0 5.18187 90 117.2 4.08973 1.16169 -9.48749 10.3965 155.862 15.8572
1 2 2 -2.0758 4.03906 0 4.54125 90 117.2 3.58412 1.01807 -9.85374 10.5346 159.287 15.8572
1 2 3 2.0758 4.03906 0 4.54125 90 62.8 2.30121 -2.93033 -9.85374 10.5346 159.287 308.143
1 3 0 2.66145 5.17863 0 5.8225 90 62.8 2.95046 -3.75708 -9.12124 10.2965 152.357 308.143
1 3 1 -2.66145 5.17863 0 5.8225 90 117.2 4.59533 1.3053 -9.12124 10.2965 152.357 15.8572
1 3 2 -2.36862 4.60884 0 5.18187 90 117.2 4.08973 1.16169 -9.48749 10.3965 155.862 15.8572
1 3 3 2.36862 4.60884 0 5.18187 90 62.8 2.62584 -3.3437 -9.48749 10.3965 155.862 308.143
1 4 0 2.95428 5.74841 0 6.46312 90 62.8 3.27509 -4.17046 -8.75499 10.2357 148.798 308.143
1 4 1 -2.95428 5.74841 0 6.46312 90 117.2 5.10094 1.44892 -8.75499 10.2357 148.798 15.8572
1 4 2 -2.66145 5.17863 0 5.8225 90 117.2 4.59533 1.3053 -9.12124 10.2965 152.357 15.8572
1 4 3 2.66145 5.17863 0 5.8225 90 62.8 2.95046 -3.75708 -9.12124 10.2965 152.357 308.143
1 5 0 3.24711 6.31819 0 7.10375 90 62.8 3.59972 -4.58383 -8.38874 10.2147 145.209 308.143
1 5 1 -3.24711 6.31819 0 7.10375 90 117.2 5.60654 1.59254 -8.38874 10.2147 145.209 15.8572
1 5 2 -2.95428 5.74841 0 6.46312 90 117.2 5.10094 1.44892 -8.75499 10.2357 148.798 15.8572
1 5 3 2.95428 5.74841 0 6.46312 90 62.8 3.27509 -4.17046 -8.75499 10.2357 148.798 308.143
1 6 0 3.53994 6.88797 0 7.74438 90 62.8 3.92434 -4.99721 -8.0225 10.2339 141.62 308.143
1 6 1 -3.53994 6.88797 0 7.74438 90 117.2 6.11215 1.73615 -8.0225 10.2339 141.62 15.8572
1 6 2 -3.24711 6.31819 0 7.10375 90 117.2 5.60654 1.59254 -8.38874 10.2147 145.209 15.8572
1 6 3 3.24711 6.31819 0 7.10375 90 62.8 3.59972 -4.58383 -8.38874 10.2147 145.209 308.143
1 7 0 3.83277 7.45776 0 8.385 90 62.8 4.24897 -5.41058 -7.65625 10.293 138.059 308.143
1 7 1 -3.83277 7.45776 0 8.385 90 117.2 6.61775 1.87977 -7.65625 10.293 138.059 15.8572
1 7 2 -3.53994 6.88797 0 7.74438 90 117.2 6.11215 1.73615 -8.0225 10.2339 141.62 15.8572
1 7 3 3.53994 6.88797 0 7.74438 90 62.8 3.92434 -4.99721 -8.0225 10.2339 141.62 308.143
1 8 0 4.12559 8.02754 0 9.02562 90 62.8 4.5736 -5.82396 -7.29 10.3914 134.551 308.143
1 8 1 -4.12559 8.02754 0 9.02562 90 117.2 7.12335 2.02339 -7.29 10.3914 134.551 15.8572
1 8 2 -3.83277 7.45776 0 8.385 90 117.2 6.61775 1.87977 -7.65625 10.293 138.059 15.8572
1 8 3 3.83277 7.45776 0 8.385 90 62.8 4.24897 -5.41058 -7.65625 10.293 138.059 308.143
1 9 0 4.41842 8.59732 0 9.66625 90 62.8 4.89822 -6.23733 -6.92375 10.5278 131.122 308.143
1 9 1 -4.41842 8.59732 0 9.66625 90 117.2 7.62896 2.16701 -6.92375 10.5278 131.122 15.8572
1 9 2 -4.12559 8.02754 0 9.02562 90 117.2 7.12335 2.02339 -7.29 10.3914 134.551 15.8572
1 9 3 4.12559 8.02754 0 9.02562 90 62.8 4.5736 -5.82396 -7.29 10.3914 134.551 308.143
1 10 0 4.71125 9.1671 0 10.3069 90 62.8 5.22285 -6.65071 -6.5575 10.701 127.792 308.143
1 10 1 -4.71125 9.1671 0 10.3069 90 117.2 8.13456 2.31062 -6.5575 10.701 127.792 15.8572
1 10 2 -4.41842 8.59732 0 9.66625 90 117.2 7.62896 2.16701 -6.92375 10.5278 131.122 15.8572
1 10 3 4.41842 8.59732 0 9.66625 90 62.8 4.89822 -6.23733 -6.92375 10.5278 131.122 308.143
1 11 0 5.00408 9.73689 0 10.9475 90 62.8 5.54748 -7.06409 -6.19125 10.9091 124.578 308.143
1 11 1 -5.00408 9.73689 0 10.9475 90 117.2 8.64017 2.45424 -6.19125 10.9091 124.578 15.8572
1 11 2 -4.71125 9.1671 0 10.3069 90 117.2 8.13456 2.31062 -6.5575 10.701 127.792 15.8572
1 11 3 4.71125 9.1671 0 10.3069 90 62.8 5.22285 -6.65071 -6.5575 10.701 127.792 308.143
1 12 0 5.29691 10.3067 0 11.5881 90 62.8 5.8721 -7.47746 -5.825 11.1501 121.495 308.143
1 12 1 -5.29691 10.3067 0 11.5881 90 117.2 9.14577 2.59786 -5.825 11.1501 121.495 15.8572
1 12 2 -5.00408 9.73689 0 10.9475 90 117.2 8.64017 2.45424 -6.19125 10.9091 124.578 15.8572
1 12 3 5.00408 9.73689 0 10.9475 90 62.8 5.54748 -7.06409 -6.19125 10.9091 124.578 308.143
1 13 0 5.58974 10.8765 0 12.2287 90 62.8 6.19673 -7.89084 -5.45875 11.422 118.549 308.143
1 13 1 -5.58974 10.8765 0 12.2287 90 117.2 9.65138 2.74147 -5.45875 11.422 118.549 15.8572
1 13 2 -5.29691 10.3067 0 11.5881 90 117.2 9.14577 2.59786 -5.825 11.1501 121.495 15.8572
1 13 3 5.29691 10.3067 0 11.5881 90 62.8 5.8721 -7.47746 -5.825 11.1501 121.495 308.143
1 14 0 5.88256 11.4462 0 12.8694 90 62.8 6.52136 -8.30421 -5.0925 11.7227 115.748 308.143
1 14 1 -5.88256 11.4462 0 12.8694 90 117.2 10.157 2.88509 -5.0925 11.7227 115.748 15.8572
1 14 2 -5.58974 10.8765 0 12.2287 90 117.2 9.65138 2.74147 -5.45875 11.422 118.549 15.8572
1 14 3 5.58974 10.8765 0 12.2287 90 62.8 6.19673 -7.89084 -5.45875 11.422 118.549 308.143
1 15 0 6.17539 12.016 0 13.51 90 62.8 6.84599 -8.71759 -4.72625 12.05 113.093 308.143
1 15 1 -6.17539 12.016 0 13.51 90 117.2 10.6626 3.02871 -4.72625 12.05 113.093 15.8572
1 15 2 -5.88256 11.4462 0 12.8694 90 117.2 10.157 2.88509 -5.0925 11.7227 115.748 15.8572
1 15 3 5.88256 11.4462 0 12.8694 90 62.8 6.52136 -8.30421 -5.0925 11.7227 115.748 308.143
2 0 0 1.78297 3.46928 0 3.90062 90 62.8 -1.78297 -2.65762 -10.22 10.7093 162.613 236.143
2 0 1 -1.78297 3.46928 0 3.90062 90 117.2 1.78297 -2.65762 -10.22 10.7093 162.613 303.857
2 0 2 -1.49014 2.8995 0 3.26 90 117.2 1.49014 -2.22114 -10.5862 10.9189 165.821 303.857
2 0 3 1.49014 2.8995 0 3.26 90 62.8 -1.49014 -2.22114 -10.5862 10.9189 165.821 236.143
2 1 0 2.0758 4.03906 0 4.54125 90 62.8 -2.0758 -3.0941 -9.85374 10.5346 159.287 236.143
2 1 1 -2.0758 4.03906 0 4.54125 90 117.2 2.0758 -3.0941 -9.85374 10.5346 159.287 303.857
2 1 2 -1.78297 3.46928 0 3.90062 90 117.2 1.78297 -2.65762 -10.22 10.7093 162.613 303.857
2 1 3 1.78297 3.46928 0 3.90062 90 62.8 -1.78297 -2.65762 -10.22 10.7093 162.613 236.143
2 2 0 2.36862 4.60884 0 5.18187 90 62.8 -2.36862 -3.53058 -9.48749 10.3965 155.862 236.143
2 2 1 -2.36862 4.60884 0 5.18187 90 117.2 2.36862 -3.53058 -9.48749 10.3965 155.862 303.857
2 2 2 -2.0758 4.03906 0 4.54125 90 117.2 2.0758 -3.0941 -9.85374 10.5346 159.287 303.857
2 2 3 2.0758 4.03906 0 4.54125 90 62.8 -2.0758 -3.0941 -9.85374 10.5346 159.287 236.143
2 3 0 2.66145 5.17863 0 5.8225 90 62.8 -2.66145 -3.96706 -9.12124 10.2965 152.357 236.143
2 3 1 -2.66145 5.17863 0 5.8225 90 117.2 2.66145 -3.96706 -9.12124 10.2965 152.357 303.857
2 3 2 -2.36862 4.60884 0 5.18187 90 117.2 2.36862 -3.53058 -9.48749 10.3965 155.862 303.857
2 3 3 2.36862 4.60884 0 5.18187 90 62.8 -2.36862 -3.53058 -9.48749 10.3965 155.862 236.143
2 4 0 2.95428 5.74841 0 6.46312 90 62.8 -2.95428 -4.40354 -8.75499 10.2357 148.798 236.143
2 4 1 -2.95428 5.74841 0 6.46312 90 117.2 2.95428 -4.40354 -8.75499 10.2357 148.798 303.857
2 4 2 -2.66145 5.17863 0 5.8225 90 117.2 2.66145 -3.96706 -9.12124 10.2965 152.357 303.857
2 4 3 2.66145 5.17863 0 5.8225 90 62.8 -2.66145 -3.96706 -9.12124 10.2965 152.357 236.143
2 5 0 3.24711 6.31819 0 7.10375 90 62.8 -3.24711 -4.84002 -8.38874 10.2147 145.209 236.143
2 5 1 -3.24711 6.31819 0 7.10375 90 117.2 3.24711 -4.84002 -8.38874 10.2147 145.209 303.857
2 5 2 -2.95428 5.74841 0 6.46312 90 117.2 2.95428 -4.40354 -8.75499 10.2357 148.798 303.857
2 5 3 2.95428 5.74841 0 6.46312 90 62.8 -2.95428 -4.40354 -8.75499 10.2357 148.798 236.143
2 6 0 3.53994 6.88797 0 7.74438 90 62.8 -3.53994 -5.27649 -8.0225 10.2339 141.62 236.143
2 6 1 -3.53994 6.88797 0 7.74438 90 117.2 3.53994 -5.27649 -8.0225 10.2339 141.62 303.857
2 6 2 -3.24711 6.31819 0 7.10375 90 117.2 3.24711 -4.84002 -8.38874 10.2147 145.209 303.857
2 6 3 3.24711 6.31819 0 7.10375 90 62.8 -3.24711 -4.84002 -8.38874 10.2147 145.209 236.143
2 7 0 3.83277 7.45776 0 8.385 90 62.8 -3.83277 -5.71297 -7.65625 10.293 138.059 236.143
2 7 1 -3.83277 7.45776 0 8.385 90 117.2 3.83277 -5.71297 -7.65625 10.293 138.059 303.857
2 7 2 -3.53994 6.88797 0 7.74438 90 117.2 3.53994 -5.27649 -8.0225 10.2339 141.62 303.857
2 7 3 3.53994 6.88797 0 7.74438 90 62.8 -3.53994 -5.27649 -8.0225 10.2339 141.62 236.143
2 8 0 4.12559 8.02754 0 9.02562 90 62.8 -4.12559 -6.14945 -7.29 10.3914 134.551 236.143
2 8 1 -4.12559 8.02754 0 9.02562 90 117.2 4.12559 -6.14945 -7.29 10.3914 134.551 303.857
2 8 2 -3.83277 7.45776 0 8.385 90 117.2 3.83277 -5.71297 -7.65625 10.293 138.059 303.857
2 8 3 3.83277 7.45776 0 8.385 90 62.8 -3.83277 -5.71297 -7.65625 10.293 138.059 236.143
2 9 0 4.41842 8.59732 0 9.66625 90 62.8 -4.41842 -6.58593 -6.92375 10.5278 131.122 236.143
2 9 1 -4.41842 8.59732 0 9.66625 90 117.2 4.41842 -6.58593 -6.92375 10.5278 131.122 303.857
2 9 2 -4.12559 8.02754 0 9.02562 90 117.2 4.12559 -6.14945 -7.29 10.3914 134.551 303.857
2 9 3 4.12559 8.02754 0 9.02562 90 62.8 -4.12559 -6.14945 -7.29 10.3914 134.551 236.143
2 10 0 4.71125 9.1671 0 10.3069 90 62.8 -4.71125 -7.02241 -6.5575 10.701 127.792 236.143
2 10 1 -4.71125 9.1671 0 10.3069 90 117.2 4.71125 -7.02241 -6.5575 10.701 127.792 303.857
2 10 2 -4.41842 8.59732 0 9.66625 90 117.2 4.41842 -6.58593 -6.92375 10.5278 131.122 303.857
2 10 3 4.41842 8.59732 0 9.66625 90 62.8 -4.41842 -6.58593 -6.92375 10.5278 131.122 236.143
2 11 0 5.00408 9.73689 0 10.9475 90 62.8 -5.00408 -7.45889 -6.19125 10.9091 124.578 236.143
2 11 1 -5.00408 9.73689 0 10.9475 90 117.2 5.00408 -7.45889 -6.19125 10.9091 124.578 303.857
2 11 2 -4.71125 9.1671 0 10.3069 90 117.2 4.71125 -7.02241 -6.5575 10.701 127.792 303.857
2 11 3 4.71125 9.1671 0 10.3069 90 62.8 -4.71125 -7.02241 -6.5575 10.701 127.792 236.143
2 12 0 5.29691 10.3067 0 11.5881 90 62.8 -5.29691 -7.89537 -5.825 11.1501 121.495 236.143
2 12 1 -5.29691 10.3067 0 11.5881 90 117.2 5.29691 -7.89537 -5.825 11.1501 121.495 303.857
2 12 2 -5.00408 9.73689 0 10.9475 90 117.2 5.00408 -7.45889 -6.19125 10.9091 124.578 303.857
2 12 3 5.00408 9.73689 0 10.9475 90 62.8 -5.00408 -7.45889 -6.19125 10.9091 124.578 236.143
2 13 0 5.58974 10.8765 0 12.2287 90 62.8 -5.58974 -8.33184 -5.45875 11.422 118.549 236.143
2 13 1 -5.58974 10.8765 0 12.2287 90 117.2 5.58974 -8.33184 -5.45875 11.422 118.549 303.857
2 13 2 -5.29691 10.3067 0 11.5881 90 117.2 5.29691 -7.89537 -5.825 11.1501 121.495 303.857
2 13 3 5.29691 10.3067 0 11.5881 90 62.8 -5.29691 -7.89537 -5.825 11.1501 121.495 236.143
2 14 0 5.88256 11.4462 0 12.8694 90 62.8 -5.88256 -8.76832 -5.0925 11.7227 115.748 236.143
2 14 1 -5.88256 11.4462 0 12.8694 90 117.2 5.88256 -8.76832 -5.0925 11.7227 115.748 303.857
2 14 2 -5.58974 10.8765 0 12.2287 90 117.2 5.58974 -8.33184 -5.45875 11.422 118.549 303.857
2 14 3 5.58974 10.8765 0 12.2287 90 62.8 -5.58974 -8.33184 -5.45875 11.422 118.549 236.143
2 15 0 6.17539 12.016 0 13.51 90 62.8 -6.17539 -9.2048 -4.72625 12.05 113.093 236.143
2 15 1 -6.17539 12.016 0 13.51 90 117.2 6.17539 -9.2048 -4.72625 12.05 113.093 303.857
2 15 2 -5.88256 11.4462 0 12.8694 90 117.2 5.88256 -8.76832 -5.0925 11.7227 115.748 303.857
2 15 3 5.88256 11.4462 0 12.8694 90 62.8 -5.88256 -8.76832 -5.0925 11.7227 115.748 236.143
3 0 0 1.78297 3.46928 0 3.90062 90 62.8 -3.07852 0.874452 -10.22 10.7093 162.613 164.143
3 0 1 -1.78297 3.46928 0 3.90062 90 117.2 -1.97658 -2.51695 -10.22 10.7093 162.613 231.857
3 0 2 -1.49014 2.8995 0 3.26 90 117.2 -1.65195 -2.10358 -10.5862 10.9189 165.821 231.857
3 0 3 1.49014 2.8995 0 3.26 90 62.8 -2.57291 0.730835 -10.5862 10.9189 165.821 164.143
3 1 0 2.0758 4.03906 0 4.54125 90 62.8 -3.58412 1.01807 -9.85374 10.5346 159.287 164.143
3 1 1 -2.0758 4.03906 0 4.54125 90 117.2 -2.30121 -2.93033 -9.85374 10.5346 159.287 231.857
3 1 2 -1.78297 3.46928 0 3.90062 90 117.2 -1.97658 -2.51695 -10.22 10.7093 162.613 231.857
3 1 3 1.78297 3.46928 0 3.90062 90 62.8 -3.07852 0.874452 -10.22 10.7093 162.613 164.143
3 2 0 2.36862 4.60884 0 5.18187 90 62.8 -4.08973 1.16169 -9.48749 10.3965 155.862 164.143
3 2 1 -2.36862 4.60884 0 5.18187 90 117.2 -2.62584 -3.3437 -9.48749 10.3965 155.862 231.857
3 2 2 -2.0758 4.03906 0 4.54125 90 117.2 -2.30121 -2.93033 -9.85374 10.5346 159.287 231.857
3 2 3 2.0758 4.03906 0 4.54125 90 62.8 -3.58412 1.01807 -9.85374 10.5346 159.287 164.143
3 3 0 2.66145 5.17863 0 5.8225 90 62.8 -4.59533 1.3053 -9.12124 10.2965 152.357 164.143
3 3 1 -2.66145 5.17863 0 5.8225 90 117.2 -2.95046 -3.75708 -9.12124 10.2965 152.357 231.857
3 3 2 -2.36862 4.60884 0 5.18187 90 117.2 -2.62584 -3.3437 -9.48749 10.3965 155.862 231.857
3 3 3 2.36862 4.60884 0 5.18187 90 62.8 -4.08973 1.16169 -9.48749 10.3965 155.862 164.143
3 4 0 2.95428 5.74841 0 6.46312 90 62.8 -5.10094 1.44892 -8.75499 10.2357 148.798 164.143
3 4 1 -2.95428 5.74841 0 6.46312 90 117.2 -3.27509 -4.17046 -8.75499 10.2357 148.798 231.857
3 4 2 -2.66145 5.17863 0 5.8225 90 117.2 -2.95046 -3.75708 -9.12124 10.2965 152.357 231.857
3 4 3 2.66145 5.17863 0 5.8225 90 62.8 -4.59533 1.3053 -9.12124 10.2965 152.357 164.143
3 5 0 3.24711 6.31819 0 7.10375 90 62.8 -5.60654 1.59254 -8.38874 10.2147 145.209 164.143
3 5 1 -3.24711 6.31819 0 7.10375 90 117.2 -3.59972 -4.58383 -8.38874 10.2147 145.209 231.857
3 5 2 -2.95428 5.74841 0 6.46312 90 117.2 -3.27509 -4.17046 -8.75499 10.2357 148.798 231.857
3 5 3 2.95428 5.74841 0 6.46312 90 62.8 -5.10094 1.44892 -8.75499 10.2357 148.798 164.143
3 6 0 3.53994 6.88797 0 7.74438 90 62.8 -6.11215 1.73615 -8.0225 10.2339 141.62 164.143
3 6 1 -3.53994 6.88797 0 7.74438 90 117.2 -3.92434 -4.99721 -8.0225 10.2339 141.62 231.857
3 6 2 -3.24711 6.31819 0 7.10375 90 117.2 -3.59972 -4.58383 -8.38874 10.2147 145.209 231.857
3 6 3 3.24711 6.31819 0 7.10375 90 62.8 -5.60654 1.59254 -8.38874 10.2147 145.209 164.143
3 7 0 3.83277 7.45776 0 8.385 90 62.8 -6.61775 1.87977 -7.65625 10.293 138.059 164.143
3 7 1 -3.83277 7.45776 0 8.385 90 117.2 -4.24897 -5.41058 -7.65625 10.293 138.059 231.857
3 7 2 -3.53994 6.88797 0 7.74438 90 117.2 -3.92434 -4.99721 -8.0225 10.2339 141.62 231.857
3 7 3 3.53994 6.88797 0 7.74438 90 62.8 -6.11215 1.73615 -8.0225 10.2339 141.62 164.143
3 8 0 4.12559 8.02754 0 9.02562 90 62.8 -7.12335 2.02339 -7.29 10.3914 134.551 164.143
3 8 1 -4.12559 8.02754 0 9.02562 90 117.2 -4.5736 -5.82396 -7.29 10.3914 134.551 231.857
3 8 2 -3.83277 7.45776 0 8.385 90 117.2 -4.24897 -5.41058 -7.65625 10.293 138.059 231.857
3 8 3 3.83277 7.45776 0 8.385 90 62.8 -6.61775 1.87977 -7.65625 10.293 138.059 164.143
3 9 0 4.41842 8.59732 0 9.66625 90 62.8 -7.62896 2.16701 -6.92375 10.5278 131.122 164.143
3 9 1 -4.41842 8.59732 0 9.66625 90 117.2 -4.89822 -6.23733 -6.92375 10.5278 131.122 231.857
3 9 2 -4.12559 8.02754 0 9.02562 90 117.2 -4.5736 -5.82396 -7.29 10.3914 134.551 231.857
3 9 3 4.12559 8.02754 0 9.02562 90 62.8 -7.12335 2.02339 -7.29 10.3914 134.551 164.143
3 10 0 4.71125 9.1671 0 10.3069 90 62.8 -8.13456 2.31062 -6.5575 10.701 127.792 164.143
3 10 1 -4.71125 9.1671 0 10.3069 90 117.2 -5.22285 -6.65071 -6.5575 10.701 127.792 231.857
3 10 2 -4.41842 8.59732 0 9.66625 90 117.2 -4.89822 -6.23733 -6.92375 10.5278 131.122 231.857
3 10 3 4.41842 8.59732 0 9.66625 90 62.8 -7.62896 2.16701 -6.92375 10.5278 131.122 164.143
3 11 0 5.00408 9.73689 0 10.9475 90 62.8 -8.64017 2.45424 -6.19125 10.9091 124.578 164.143
3 11 1 -5.00408 9.73689 0 10.9475 90 117.2 -5.54748 -7.06409 -6.19125 10.9091 124.578 231.857
3 11 2 -4.71125 9.1671 0 10.3069 90 117.2 -5.22285 -6.65071 -6.5575 10.701 127.792 231.857
3 11 3 4.71125 9.1671 0 10.3069 90 62.8 -8.13456 2.31062 -6.5575 10.701 127.792 164.143
3 12 0 5.29691 10.3067 0 11.5881 90 62.8 -9.14577 2.59786 -5.825 11.1501 121.495 164.143
3 12 1 -5.29691 10.3067 0 11.5881 90 117.2 -5.8721 -7.47746 -5.825 11.1501 121.495 231.857
3 12 2 -5.00408 9.73689 0 10.9475 90 117.2 -5.54748 -7.06409 -6.19125 10.9091 124.578 231.857
3 12 3 5.00408 9.73689 0 10.9475 90 62.8 -8.64017 2.45424 -6.19125 10.9091 124.578 164.143
3 13 0 5.58974 10.8765 0 12.2287 90 62.8 -9.65138 2.74147 -5.45875 11.422 118.549 164.143
3 13 1 -5.58974 10.8765 0 12.2287 90 117.2 -6.19673 -7.89084 -5.45875 11.422 118.549 231.857
3 13 2 -5.29691 10.3067 0 11.5881 90 117.2 -5.8721 -7.47746 -5.825 11.1501 121.495 231.857
3 13 3 5.29691 10.3067 0 11.5881 90 62.8 -9.14577 2.59786 -5.825 11.1501 121.495 164.143
3 14 0 5.88256 11.4462 0 12.8694 90 62.8 -10.157 2.88509 -5.0925 11.7227 115.748 164.143
3 14 1 -5.88256 11.4462 0 12.8694 90 117.2 -6.52136 -8.30421 -5.0925 11.7227 115.748 231.857
3 14 2 -5.58974 10.8765 0 12.2287 90 117.2 -6.19673 -7.89084 -5.45875 11.422 118.549 231.857
3 14 3 5.58974 10.8765 0 12.2287 90 62.8 -9.65138 2.74147 -5.45875 11.422 118.549 164.143
3 15 0 6.17539 12.016 0 13.51 90 62.8 -10.6626 3.02871 -4.72625 12.05 113.093 164.143
3 15 1 -6.17539 12.016 0 13.51 90 117.2 -6.84599 -8.71759 -4.72625 12.05 113.093 231.857
3 15 2 -5.88256 11.4462 0 12.8694 90 117.2 -6.52136 -8.30421 -5.0925 11.7227 115.748 231.857
3 15 3 5.88256 11.4462 0 12.8694 90 62.8 -10.157 2.88509 -5.0925 11.7227 115.748 164.143
4 0 0 1.78297 3.46928 0 3.90062 90 62.8 -0.11966 3.19806 -10.22 10.7093 162.613 92.1428
4 0 1 -1.78297 3.46928 0 3.90062 90 117.2 -3.00456 1.10206 -10.22 10.7093 162.613 159.857
4 0 2 -1.49014 2.8995 0 3.26 90 117.2 -2.5111 0.921061 -10.5862 10.9189 165.821 159.857
4 0 3 1.49014 2.8995 0 3.26 90 62.8 -0.100008 2.67282 -10.5862 10.9189 165.821 92.1428
4 1 0 2.0758 4.03906 0 4.54125 90 62.8 -0.139313 3.7233 -9.85374 10.5346 159.287 92.1428
4 1 1 -2.0758 4.03906 0 4.54125 90 117.2 -3.49802 1.28306 -9.85374 10.5346 159.287 159.857
4 1 2 -1.78297 3.46928 0 3.90062 90 117.2 -3.00456 1.10206 -10.22 10.7093 162.613 159.857
4 1 3 1.78297 3.46928 0 3.90062 90 62.8 -0.11966 3.19806 -10.22 10.7093 162.613 92.1428
4 2 0 2.36862 4.60884 0 5.18187 90 62.8 -0.158965 4.24854 -9.48749 10.3965 155.862 92.1428
4 2 1 -2.36862 4.60884 0 5.18187 90 117.2 -3.99148 1.46406 -9.48749 10.3965 155.862 159.857
4 2 2 -2.0758 4.03906 0 4.54125 90 117.2 -3.49802 1.28306 -9.85374 10.5346 159.287 159.857
4 2 3 2.0758 4.03906 0 4.54125 90 62.8 -0.139313 3.7233 -9.85374 10.5346 159.287 92.1428
4 3 0 2.66145 5.17863 0 5.8225 90 62.8 -0.178618 4.77378 -9.12124 10.2965 152.357 92.1428
4 3 1 -2.66145 5.17863 0 5.8225 90 117.2 -4.48494 1.64505 -9.12124 10.2965 152.357 159.857
4 3 2 -2.36862 4.60884 0 5.18187 90 117.2 -3.99148 1.46406 -9.48749 10.3965 155.862 159.857
4 3 3 2.36862 4.60884 0 5.18187 90 62.8 -0.158965 4.24854 -9.48749 10.3965 155.862 92.1428
4 4 0 2.95428 5.74841 0 6.46312 90 62.8 -0.19827 5.29902 -8.75499 10.2357 148.798 92.1428
4 4 1 -2.95428 5.74841 0 6.46312 90 117.2 -4.9784 1.82605 -8.75499 10.2357 148.798 159.857
4 4 2 -2.66145 5.17863 0 5.8225 90 117.2 -4.48494 1.64505 -9.12124 10.2965 152.357 159.857
4 4 3 2.66145 5.17863 0 5.8225 90 62.8 -0.178618 4.77378 -9.12124 10.2965 152.357 92.1428
4 5 0 3.24711 6.31819 0 7.10375 90 62.8 -0.217923 5.82426 -8.38874 10.2147 145.209 92.1428
4 5 1 -3.24711 6.31819 0 7.10375 90 117.2 -5.47186 2.00705 -8.38874 10.2147 145.209 159.857
4 5 2 -2.95428 5.74841 0 6.46312 90 117.2 -4.9784 1.82605 -8.75499 10.2357 148.798 159.857
4 5 3 2.95428 5.74841 0 6.46312 90 62.8 -0.19827 5.29902 -8.75499 10.2357 148.798 92.1428
4 6 0 3.53994 6.88797 0 7.74438 90 62.8 -0.237576 6.3495 -8.0225 10.2339 141.62 92.1428
4 6 1 -3.53994 6.88797 0 7.74438 90 117.2 -5.96532 2.18805 -8.0225 10.2339 141.62 159.857
4 6 2 -3.24711 6.31819 0 7.10375 90 117.2 -5.47186 2.00705 -8.38874 10.2147 145.209 159.857
4 6 3 3.24711 6.31819 0 7.10375 90 62.8 -0.217923 5.82426 -8.38874 10.2147 145.209 92.1428
4 7 0 3.83277 7.45776 0 8.385 90 62.8 -0.257228 6.87474 -7.65625 10.293 138.059 92.1428
4 7 1 -3.83277 7.45776 0 8.385 90 117.2 -6.45877 2.36905 -7.65625 10.293 138.059 159.857
4 7 2 -3.53994 6.88797 0 7.74438 90 117.2 -5.96532 2.18805 -8.0225 10.2339 141.62 159.857
4 7 3 3.53994 6.88797 0 7.74438 90 62.8 -0.237576 6.3495 -8.0225 10.2339 141.62 92.1428
4 8 0 4.12559 8.02754 0 9.02562 90 62.8 -0.276881 7.39997 -7.29 10.3914 134.551 92.1428
4 8 1 -4.12559 8.02754 0 9.02562 90 117.2 -6.95223 2.55005 -7.29 10.3914 134.551 159.857
4 8 2 -3.83277 7.45776 0 8.385 90 117.2 -6.45877 2.36905 -7.65625 10.293 138.059 159.857
4 8 3 3.83277 7.45776 0 8.385 90 62.8 -0.257228 6.87474 -7.65625 10.293 138.059 92.1428
4 9 0 4.41842 8.59732 0 9.66625 90 62.8 -0.296533 7.92521 -6.92375 10.5278 131.122 92.1428
4 9 1 -4.41842 8.59732 0 9.66625 90 117.2 -7.44569 2.73105 -6.92375 10.5278 131.122 159.857
4 9 2 -4.12559 8.02754 0 9.02562 90 117.2 -6.95223 2.55005 -7.29 10.3914 134.551 159.857
4 9 3 4.12559 8.02754 0 9.02562 90 62.8 -0.276881 7.39997 -7.29 10.3914 134.551 92.1428
4 10 0 4.71125 9.1671 0 10.3069 90 62.8 -0.316186 8.45045 -6.5575 10.701 127.792 92.1428
4 10 1 -4.71125 9.1671 0 10.3069 90 117.2 -7.93915 2.91204 -6.5575 10.701 127.792 159.857
4 10 2 -4.41842 8.59732 0 9.66625 90 117.2 -7.44569 2.73105 -6.92375 10.5278 131.122 159.857
4 10 3 4.41842 8.59732 0 9.66625 90 62.8 -0.296533 7.92521 -6.92375 10.5278 131.122 92.1428
4 11 0 5.00408 9.73689 0 10.9475 90 62.8 -0.335839 8.97569 -6.19125 10.9091 124.578 92.1428
4 11 1 -5.00408 9.73689 0 10.9475 90 117.2 -8.43261 3.09304 -6.19125 10.9091 124.578 159.857
4 11 2 -4.71125 9.1671 0 10.3069 90 117.2 -7.93915 2.91204 -6.5575 10.701 127.792 159.857
4 11 3 4.71125 9.1671 0 10.3069 90 62.8 -0.316186 8.45045 -6.5575 10.701 127.792 92.1428
4 12 0 5.29691 10.3067 0 11.5881 90 62.8 -0.355491 9.50093 -5.825 11.1501 121.495 92.1428
4 12 1 -5.29691 10.3067 0 11.5881 90 117.2 -8.92607 3.27404 -5.825 11.1501 121.495 159.857
4 12 2 -5.00408 9.73689 0 10.9475 90 117.2 -8.43261 3.09304 -6.19125 10.9091 124.578 159.857
4 12 3 5.00408 9.73689 0 10.9475 90 62.8 -0.335839 8.97569 -6.19125 10.9091 124.578 92.1428
4 13 0 5.58974 10.8765 0 12.2287 90 62.8 -0.375144 10.0262 -5.45875 11.422 118.549 92.1428
4 13 1 -5.58974 10.8765 0 12.2287 90 117.2 -9.41953 3.45504 -5.45875 11.422 118.549 159.857
4 13 2 -5.29691 10.3067 0 11.5881 90 117.2 -8.92607 3.27404 -5.825 11.1501 121.495 159.857
4 13 3 5.29691 10.3067 0 11.5881 90 62.8 -0.355491 9.50093 -5.825 11.1501 121.495 92.1428
4 14 0 5.88256 11.4462 0 12.8694 90 62.8 -0.394796 10.5514 -5.0925 11.7227 115.748 92.1428
4 14 1 -5.88256 11.4462 0 12.8694 90 117.2 -9.91299 3.63604 -5.0925 11.7227 115.748 159.857
4 14 2 -5.58974 10.8765 0 12.2287 90 117.2 -9.41953 3.45504 -5.45875 11.422 118.549 159.857
4 14 3 5.58974 10.8765 0 12.2287 90 62.8 -0.375144 10.0262 -5.45875 11.422 118.549 92.1428
4 15 0 6.17539 12.016 0 13.51 90 62.8 -0.414449 11.0766 -4.72625 12.05 113.093 92.1428
4 15 1 -6.17539 12.016 0 13.51 90 117.2 -10.4064 3.81704 -4.72625 12.05 113.093 159.857
4 15 2 -5.88256 11.4462 0 12.8694 90 117.2 -9.91299 3.63604 -5.0925 11.7227 115.748 159.857
4 15 3 5.88256 11.4462 0 12.8694 90 62.8 -0.394796 10.5514 -5.0925 11.7227 115.748 92.1428
WEDGES
det ch corner x_fl y_fl z_fl r_fl t_fl p_fl x_ti y_ti z_ti r_ti t_ti p_ti
0 0 0 -4.70921 12.6627 0 13.51 90 110.4 1.89179 10.6156 -4.31059 11.6125 111.79 79.8955
0 0 1 -6.17539 12.016 0 13.51 90 117.2 0.414449 11.0766 -4.72625 12.05 113.093 87.8572
0 0 2 -1.49014 2.8995 0 3.26 90 117.2 0.100008 2.67282 -10.5862 10.9189 165.821 87.8572
0 0 3 -1.13634 3.05554 0 3.26 90 110.4 0.456494 2.56158 -10.4859 10.8039 166.064 79.8955
0 1 0 -3.17677 13.1312 0 13.51 90 103.6 3.34252 10.0052 -4.00943 11.2851 110.811 71.5267
0 1 1 -4.70921 12.6627 0 13.51 90 110.4 1.89179 10.6156 -4.31059 11.6125 111.79 79.8955
0 1 2 -1.13634 3.05554 0 3.26 90 110.4 0.456494 2.56158 -10.4859 10.8039 166.064 79.8955
0 1 3 -0.766563 3.16859 0 3.26 90 103.6 0.806558 2.41429 -10.4133 10.7199 166.264 71.5267
0 2 0 -1.59964 13.415 0 13.51 90 96.8 4.74622 9.25407 -3.82703 11.082 110.202 62.8477
0 2 1 -3.17677 13.1312 0 13.51 90 103.6 3.34252 10.0052 -4.00943 11.2851 110.811 71.5267
0 2 2 -0.766563 3.16859 0 3.26 90 103.6 0.806558 2.41429 -10.4133 10.7199 166.264 71.5267
0 2 3 -0.385997 3.23707 0 3.26 90 96.8 1.14528 2.23303 -10.3693 10.6686 166.395 62.8477
0 3 0 0 13.51 0 13.51 90 90 6.08314 8.37273 -3.76594 11.0132 109.996 54
0 3 1 -1.59964 13.415 0 13.51 90 96.8 4.74622 9.25407 -3.82703 11.082 110.202 62.8477
0 3 2 -0.385997 3.23707 0 3.26 90 96.8 1.14528 2.23303 -10.3693 10.6686 166.395 62.8477
0 3 3 0 3.26 0 3.26 90 90 1.46788 2.02036 -10.3545 10.6514 166.44 54
0 4 0 1.59964 13.415 0 13.51 90 83.2 7.33448 7.37359 -3.82703 11.082 110.202 45.1523
0 4 1 0 13.51 0 13.51 90 90 6.08314 8.37273 -3.76594 11.0132 109.996 54
0 4 2 0 3.26 0 3.26 90 90 1.46788 2.02036 -10.3545 10.6514 166.44 54
0 4 3 0.385997 3.23707 0 3.26 90 83.2 1.76983 1.77927 -10.3693 10.6686 166.395 45.1523
0 5 0 3.17677 13.1312 0 13.51 90 76.4 8.48264 6.27071 -4.00943 11.2851 110.811 36.4733
0 5 1 1.59964 13.415 0 13.51 90 83.2 7.33448 7.37359 -3.82703 11.082 110.202 45.1523
0 5 2 0.385997 3.23707 0 3.26 90 83.2 1.76983 1.77927 -10.3693 10.6686 166.395 45.1523
0 5 3 0.766563 3.16859 0 3.26 90 76.4 2.04688 1.51314 -10.4133 10.7199 166.264 36.4733
0 6 0 4.70921 12.6627 0 13.51 90 69.6 9.51145 5.0796 -4.31059 11.6125 111.79 28.1045
0 6 1 3.17677 13.1312 0 13.51 90 76.4 8.48264 6.27071 -4.00943 11.2851 110.811 36.4733
0 6 2 0.766563 3.16859 0 3.26 90 76.4 2.04688 1.51314 -10.4133 10.7199 166.264 36.4733
0 6 3 1.13634 3.05554 0 3.26 90 69.6 2.29514 1.22572 -10.4859 10.8039 166.064 28.1045
0 7 0 6.17539 12.016 0 13.51 90 62.8 10.4064 3.81704 -4.72625 12.05 113.093 20.1428
0 7 1 4.70921 12.6627 0 13.51 90 69.6 9.51145 5.0796 -4.31059 11.6125 111.79 28.1045
0 7 2 1.13634 3.05554 0 3.26 90 69.6 2.29514 1.22572 -10.4859 10.8039 166.064 28.1045
0 7 3 1.49014 2.8995 0 3.26 90 62.8 2.5111 0.921061 -10.5862 10.9189 165.821 20.1428
1 0 0 -4.70921 12.6627 0 13.51 90 110.4 10.6806 1.4812 -4.31059 11.6125 111.79 7.89549
1 0 1 -6.17539 12.016 0 13.51 90 117.2 10.6626 3.02871 -4.72625 12.05 113.093 15.8572
1 0 2 -1.49014 2.8995 0 3.26 90 117.2 2.57291 0.730835 -10.5862 10.9189 165.821 15.8572
1 0 3 -1.13634 3.05554 0 3.26 90 110.4 2.57727 0.357419 -10.4859 10.8039 166.064 7.89549
1 1 0 -3.17677 13.1312 0 13.51 90 103.6 10.5484 -0.0871381 -4.00943 11.2851 110.811 359.527
1 1 1 -4.70921 12.6627 0 13.51 90 110.4 10.6806 1.4812 -4.31059 11.6125 111.79 7.89549
1 1 2 -1.13634 3.05554 0 3.26 90 110.4 2.57727 0.357419 -10.4859 10.8039 166.064 7.89549
1 1 3 -0.766563 3.16859 0 3.26 90 103.6 2.54536 -0.0210267 -10.4133 10.7199 166.264 359.527
1 2 0 -1.59964 13.415 0 13.51 90 96.8 10.2678 -1.65425 -3.82703 11.082 110.202 350.848
1 2 1 -3.17677 13.1312 0 13.51 90 103.6 10.5484 -0.0871381 -4.00943 11.2851 110.811 359.527
1 2 2 -0.766563 3.16859 0 3.26 90 103.6 2.54536 -0.0210267 -10.4133 10.7199 166.264 359.527
1 2 3 -0.385997 3.23707 0 3.26 90 96.8 2.47765 -0.399176 -10.3693 10.6686 166.395 350.848
1 3 0 0 13.51 0 13.51 90 90 9.84273 -3.1981 -3.76594 11.0132 109.996 342
1 3 1 -1.59964 13.415 0 13.51 90 96.8 10.2678 -1.65425 -3.82703 11.082 110.202 350.848
1 3 2 -0.385997 3.23707 0 3.26 90 96.8 2.47765 -0.399176 -10.3693 10.6686 166.395 350.848
1 3 3 0 3.26 0 3.26 90 90 2.37508 -0.77171 -10.3545 10.6514 166.44 342
1 4 0 1.59964 13.415 0 13.51 90 83.2 9.27918 -4.69695 -3.82703 11.082 110.202 333.152
1 4 1 0 13.51 0 13.51 90 90 9.84273 -3.1981 -3.76594 11.0132 109.996 342
1 4 2 0 3.26 0 3.26 90 90 2.37508 -0.77171 -10.3545 10.6514 166.44 342
1 4 3 0.385997 3.23707 0 3.26 90 83.2 2.23909 -1.13339 -10.3693 10.6686 166.395 333.152
1 5 0 3.17677 13.1312 0 13.51 90 76.4 8.58508 -6.12971 -4.00943 11.2851 110.811 324.473
1 5 1 1.59964 13.415 0 13.51 90 83.2 9.27918 -4.69695 -3.82703 11.082 110.202 333.152
1 5 2 0.385997 3.23707 0 3.26 90 83.2 2.23909 -1.13339 -10.3693 10.6686 166.395 333.152
1 5 3 0.766563 3.16859 0 3.26 90 76.4 2.0716 -1.47912 -10.4133 10.7199 166.264 324.473
1 6 0 4.70921 12.6627 0 13.51 90 69.6 7.77019 -7.47624 -4.31059 11.6125 111.79 316.105
1 6 1 3.17677 13.1312 0 13.51 90 76.4 8.58508 -6.12971 -4.00943 11.2851 110.811 324.473
1 6 2 0.766563 3.16859 0 3.26 90 76.4 2.0716 -1.47912 -10.4133 10.7199 166.264 324.473
1 6 3 1.13634 3.05554 0 3.26 90 69.6 1.87497 -1.80404 -10.4859 10.8039 166.064 316.105
1 7 0 6.17539 12.016 0 13.51 90 62.8 6.84599 -8.71759 -4.72625 12.05 113.093 308.143
1 7 1 4.70921 12.6627 0 13.51 90 69.6 7.77019 -7.47624 -4.31059 11.6125 111.79 316.105
1 7 2 1.13634 3.05554 0 3.26 90 69.6 1.87497 -1.80404 -10.4859 10.8039 166.064 316.105
1 7 3 1.49014 2.8995 0 3.26 90 62.8 1.65195 -2.10358 -10.5862 10.9189 165.821 308.143
2 0 0 -4.70921 12.6627 0 13.51 90 110.4 4.70921 -9.70018 -4.31059 11.6125 111.79 295.895
2 0 1 -6.17539 12.016 0 13.51 90 117.2 6.17539 -9.2048 -4.72625 12.05 113.093 303.857
2 0 2 -1.49014 2.8995 0 3.26 90 117.2 1.49014 -2.22114 -10.5862 10.9189 165.821 303.857
2 0 3 -1.13634 3.05554 0 3.26 90 110.4 1.13634 -2.34068 -10.4859 10.8039 166.064 295.895
2 1 0 -3.17677 13.1312 0 13.51 90 103.6 3.17677 -10.0591 -4.00943 11.2851 110.811 287.527
2 1 1 -4.70921 12.6627 0 13.51 90 110.4 4.70921 -9.70018 -4.31059 11.6125 111.79 295.895
2 1 2 -1.13634 3.05554 0 3.26 90 110.4 1.13634 -2.34068 -10.4859 10.8039 166.064 295.895
2 1 3 -0.766563 3.16859 0 3.26 90 103.6 0.766563 -2.42728 -10.4133 10.7199 166.264 287.527
2 2 0 -1.59964 13.415 0 13.51 90 96.8 1.59964 -10.2765 -3.82703 11.082 110.202 278.848
2 2 1 -3.17677 13.1312 0 13.51 90 103.6 3.17677 -10.0591 -4.00943 11.2851 110.811 287.527
2 2 2 -0.766563 3.16859 0 3.26 90 103.6 0.766563 -2.42728 -10.4133 10.7199 166.264 287.527
2 2 3 -0.385997 3.23707 0 3.26 90 96.8 0.385997 -2.47974 -10.3693 10.6686 166.395 278.848
2 3 0 0 13.51 0 13.51 90 90 1.26742e-15 -10.3493 -3.76594 11.0132 109.996 270
2 3 1 -1.59964 13.415 0 13.51 90 96.8 1.59964 -10.2765 -3.82703 11.082 110.202 278.848
2 3 2 -0.385997 3.23707 0 3.26 90 96.8 0.385997 -2.47974 -10.3693 10.6686 166.395 278.848
2 3 3 0 3.26 0 3.26 90 90 3.05832e-16 -2.4973 -10.3545 10.6514 166.44 270
2 4 0 1.59964 13.415 0 13.51 90 83.2 -1.59964 -10.2765 -3.82703 11.082 110.202 261.152
2 4 1 0 13.51 0 13.51 90 90 1.26742e-15 -10.3493 -3.76594 11.0132 109.996 270
2 4 2 0 3.26 0 3.26 90 90 3.05832e-16 -2.4973 -10.3545 10.6514 166.44 270
2 4 3 0.385997 3.23707 0 3.26 90 83.2 -0.385997 -2.47974 -10.3693 10.6686 166.395 261.152
2 5 0 3.17677 13.1312 0 13.51 90 76.4 -3.17677 -10.0591 -4.00943 11.2851 110.811 252.473
2 5 1 1.59964 13.415 0 13.51 90 83.2 -1.59964 -10.2765 -3.82703 11.082 110.202 261.152
2 5 2 0.385997 3.23707 0 3.26 90 83.2 -0.385997 -2.47974 -10.3693 10.6686 166.395 261.152
2 5 3 0.766563 3.16859 0 3.26 90 76.4 -0.766563 -2.42728 -10.4133 10.7199 166.264 252.473
2 6 0 4.70921 12.6627 0 13.51 90 69.6 -4.70921 -9.70018 -4.31059 11.6125 111.79 244.105
2 6 1 3.17677 13.1312 0 13.51 90 76.4 -3.17677 -10.0591 -4.00943 11.2851 110.811 252.473
2 6 2 0.766563 3.16859 0 3.26 90 76.4 -0.766563 -2.42728 -10.4133 10.7199 166.264 252.473
2 6 3 1.13634 3.05554 0 3.26 90 69.6 -1.13634 -2.34068 -10.4859 10.8039 166.064 244.105
2 7 0 6.17539 12.016 0 13.51 90 62.8 -6.17539 -9.2048 -4.72625 12.05 113.093 236.143
2 7 1 4.70921 12.6627 0 13.51 90 69.6 -4.70921 -9.70018 -4.31059 11.6125 111.79 244.105
2 7 2 1.13634 3.05554 0 3.26 90 69.6 -1.13634 -2.34068 -10.4859 10.8039 166.064 244.105
2 7 3 1.49014 2.8995 0 3.26 90 62.8 -1.49014 -2.22114 -10.5862 10.9189 165.821 236.143
3 0 0 -4.70921 12.6627 0 13.51 90 110.4 -7.77019 -7.47624 -4.31059 11.6125 111.79 223.895
3 0 1 -6.17539 12.016 0 13.51 90 117.2 -6.84599 -8.71759 -4.72625 12.05 113.093 231.857
3 0 2 -1.49014 2.8995 0 3.26 90 117.2 -1.65195 -2.10358 -10.5862 10.9189 165.821 231.857
3 0 3 -1.13634 3.05554 0 3.26 90 110.4 -1.87497 -1.80404 -10.4859 10.8039 166.064 223.895
3 1 0 -3.17677 13.1312 0 13.51 90 103.6 -8.58508 -6.12971 -4.00943 11.2851 110.811 215.527
3 1 1 -4.70921 12.6627 0 13.51 90 110.4 -7.77019 -7.47624 -4.31059 11.6125 111.79 223.895
3 1 2 -1.13634 3.05554 0 3.26 90 110.4 -1.87497 -1.80404 -10.4859 10.8039 166.064 223.895
3 1 3 -0.766563 3.16859 0 3.26 90 103.6 -2.0716 -1.47912 -10.4133 10.7199 166.264 215.527
3 2 0 -1.59964 13.415 0 13.51 90 96.8 -9.27918 -4.69695 -3.82703 11.082 110.202 206.848
3 2 1 -3.17677 13.1312 0 13.51 90 103.6 -8.58508 -6.12971 -4.00943 11.2851 110.811 215.527
3 2 2 -0.766563 3.16859 0 3.26 90 103.6 -2.0716 -1.47912 -10.4133 10.7199 166.264 215.527
3 2 3 -0.385997 3.23707 0 3.26 90 96.8 -2.23909 -1.13339 -10.3693 10.6686 166.395 206.848
3 3 0 0 13.51 0 13.51 90 90 -9.84273 -3.1981 -3.76594 11.0132 109.996 198
3 3 1 -1.59964 13.415 0 13.51 90 96.8 -9.27918 -4.69695 -3.82703 11.082 110.202 206.848
3 3 2 -0.385997 3.23707 0 3.26 90 96.8 -2.23909 -1.13339 -10.3693 10.6686 166.395 206.848
3 3 3 0 3.26 0 3.26 90 90 -2.37508 -0.77171 -10.3545 10.6514 166.44 198
3 4 0 1.59964 13.415 0 13.51 90 83.2 -10.2678 -1.65425 -3.82703 11.082 110.202 189.152
3 4 1 0 13.51 0 13.51 90 90 -9.84273 -3.1981 -3.76594 11.0132 109.996 198
3 4 2 0 3.26 0 3.26 90 90 -2.37508 -0.77171 -10.3545 10.6514 166.44 198
3 4 3 0.385997 3.23707 0 3.26 90 83.2 -2.47765 -0.399176 -10.3693 10.6686 166.395 189.152
3 5 0 3.17677 13.1312 0 13.51 90 76.4 -10.5484 -0.0871381 -4.00943 11.2851 110.811 180.473
3 5 1 1.59964 13.415 0 13.51 90 83.2 -10.2678 -1.65425 -3.82703 11.082 110.202 189.152
3 5 2 0.385997 3.23707 0 3.26 90 83.2 -2.47765 -0.399176 -10.3693 10.6686 166.395 189.152
3 5 3 0.766563 3.16859 0 3.26 90 76.4 -2.54536 -0.0210267 -10.4133 10.7199 166.264 180.473
3 6 0 4.70921 12.6627 0 13.51 90 69.6 -10.6806 1.4812 -4.31059 11.6125 111.79 172.105
3 6 1 3.17677 13.1312 0 13.51 90 76.4 -10.5484 -0.0871381 -4.00943 11.2851 110.811 180.473
3 6 2 0.766563 3.16859 0 3.26 90 76.4 -2.54536 -0.0210267 -10.4133 10.7199 166.264 180.473
3 6 3 1.13634 3.05554 0 3.26 90 69.6 -2.57727 0.357419 -10.4859 10.8039 166.064 172.105
3 7 0 6.17539 12.016 0 13.51 90 62.8 -10.6626 3.02871 -4.72625 12.05 113.093 164.143
3 7 1 4.70921 12.6627 0 13.51 90 69.6 -10.6806 1.4812 -4.31059 11.6125 111.79 172.105
3 7 2 1.13634 3.05554 0 3.26 90 69.6 -2.57727 0.357419 -10.4859 10.8039 166.064 172.105
3 7 3 1.49014 2.8995 0 3.26 90 62.8 -2.57291 0.730835 -10.5862 10.9189 165.821 164.143
4 0 0 -4.70921 12.6627 0 13.51 90 110.4 -9.51145 5.0796 -4.31059 11.6125 111.79 151.895
4 0 1 -6.17539 12.016 0 13.51 90 117.2 -10.4064 3.81704 -4.72625 12.05 113.093 159.857
4 0 2 -1.49014 2.8995 0 3.26 90 117.2 -2.5111 0.921061 -10.5862 10.9189 165.821 159.857
4 0 3 -1.13634 3.05554 0 3.26 90 110.4 -2.29514 1.22572 -10.4859 10.8039 166.064 151.895
4 1 0 -3.17677 13.1312 0 13.51 90 103.6 -8.48264 6.27071 -4.00943 11.2851 110.811 143.527
4 1 1 -4.70921 12.6627 0 13.51 90 110.4 -9.51145 5.0796 -4.31059 11.6125 111.79 151.895
4 1 2 -1.13634 3.05554 0 3.26 90 110.4 -2.29514 1.22572 -10.4859 10.8039 166.064 151.895
4 1 3 -0.766563 3.16859 0 3.26 90 103.6 -2.04688 1.51314 -10.4133 10.7199 166.264 143.527
4 2 0 -1.59964 13.415 0 13.51 90 96.8 -7.33448 7.37359 -3.82703 11.082 110.202 134.848
4 2 1 -3.17677 13.1312 0 13.51 90 103.6 -8.48264 6.27071 -4.00943 11.2851 110.811 143.527
4 2 2 -0.766563 3.16859 0 3.26 90 103.6 -2.04688 1.51314 -10.4133 10.7199 166.264 143.527
4 2 3 -0.385997 3.23707 0 3.26 90 96.8 -1.76983 1.77927 -10.3693 10.6686 166.395 134.848
4 3 0 0 13.51 0 13.51 90 90 -6.08314 8.37273 -3.76594 11.0132 109.996 126
4 3 1 -1.59964 13.415 0 13.51 90 96.8 -7.33448 7.37359 -3.82703 11.082 110.202 134.848
4 3 2 -0.385997 3.23707 0 3.26 90 96.8 -1.76983 1.77927 -10.3693 10.6686 166.395 134.848
4 3 3 0 3.26 0 3.26 90 90 -1.46788 2.02036 -10.3545 10.6514 166.44 126
4 4 0 1.59964 13.415 0 13.51 90 83.2 -4.74622 9.25407 -3.82703 11.082 110.202 117.152
4 4 1 0 13.51 0 13.51 90 90 -6.08314 8.37273 -3.76594 11.0132 109.996 126
4 4 2 0 3.26 0 3.26 90 90 -1.46788 2.02036 -10.3545 10.6514 166.44 126
4 4 3 0.385997 3.23707 0 3.26 90 83.2 -1.14528 2.23303 -10.3693 10.6686 166.395 117.152
4 5 0 3.17677 13.1312 0 13.51 90 76.4 -3.34252 10.0052 -4.00943 11.2851 110.811 108.473
4 5 1 1.59964 13.415 0 13.51 90 83.2 -4.74622 9.25407 -3.82703 11.082 110.202 117.152
4 5 2 0.385997 3.23707 0 3.26 90 83.2 -1.14528 2.23303 -10.3693 10.6686 166.395 117.152
4 5 3 0.766563 3.16859 0 3.26 90 76.4 -0.806558 2.41429 -10.4133 10.7199 166.264 108.473
4 6 0 4.70921 12.6627 0 13.51 90 69.6 -1.89179 10.6156 -4.31059 11.6125 111.79 100.105
4 6 1 3.17677 13.1312 0 13.51 90 76.4 -3.34252 10.0052 -4.00943 11.2851 110.811 108.473
4 6 2 0.766563 3.16859 0 3.26 90 76.4 -0.806558 2.41429 -10.4133 10.7199 166.264 108.473
4 6 3 1.13634 3.05554 0 3.26 90 69.6 -0.456494 2.56158 -10.4859 10.8039 166.064 100.105
4 7 0 6.17539 12.016 0 13.51 90 62.8 -0.414449 11.0766 -4.72625 12.05 113.093 92.1428
4 7 1 4.70921 12.6627 0 13.51 90 69.6 -1.89179 10.6156 -4.31059 11.6125 111.79 100.105
4 7 2 1.13634 3.05554 0 3.26 90 69.6 -0.456494 2.56158 -10.4859 10.8039 166.064 100.105
4 7 3 1.49014 2.8995 0 3.26 90 62.8 -0.100008 2.67282 -10.5862 10.9189 165.821 92.1428

2501
etc/mass.txt Normal file

File diff suppressed because it is too large Load Diff

130
include/Eloss_Tables.h Normal file
View File

@ -0,0 +1,130 @@
#ifndef ELOSS_TABLES_H
#define ELOSS_TABLES_H
#define MAX_Z 93 //Maximum number of elements for which we have hydrogen coefficients
/*Atomic Masses for elements H through U. Taken from ELAST data*/
static double NATURAL_MASS[MAX_Z] =
{0,
1.00797, 4.0026, 6.939, 9.0122, 10.818,
12.01115, 14.0067, 15.9994, 18.99984, 20.183,
22.9898, 24.312, 26.9815, 28.086, 30.9738,
32.064, 35.453, 39.948, 39.102, 40.08,
44.956, 47.90, 50.942, 51.996, 54.938,
55.847, 58.933, 58.71, 63.54, 65.37,
69.72, 72.59, 74.922, 78.96, 79.909,
83.80, 85.47, 87.62, 88.909, 91.22,
92.906, 95.94, 98., 101.07, 102.905,
106.4, 107.87, 112.4, 114.82, 118.69,
121.75, 127.60, 126.904, 131.3, 132.905,
137.34, 138.91, 140.12, 140.907, 144.24,
146., 150.35, 151.96, 157.25, 158.924,
162.50, 164.93, 167.26, 168.934, 173.04,
174.97, 178.49, 180.948, 183.85, 186.2,
190.2, 192.2, 195.09, 196.967, 200.59,
204.37, 207.19, 208.98, 209., 210.,
222., 223., 226., 227., 232.038,
231., 238.03 };
/*Stopping power coefficients for hydrogen into Z
*Taken from Ziegler, Hydrogen Stopping Powers and Ranges in All Elements, Volume 3 of
*The Stopping and Ranges of Ions in Matter, 1977, Pergamon Press Inc.
*Expanded table for method given in O.G. Spanc
*Note: some elements represent extrapolations when there was no data to fit
*/
static double HYDROGEN_COEFF[MAX_Z][12] = {
/*Blank*/{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},
/*H*/{1.262,1.44,242.6,1.2E4,0.1159,0.0005099,5.436E4,-5.052,2.049,-0.3044,0.01966,-0.0004659},
/*He*/{1.229,1.397,484.5,5873,0.05225,0.00102,2.451E4,-2.158,0.8278,-0.1172,0.007259,-0.000166},
/*Li*/{1.411,1.6,725.6,3013,0.04578,0.00153,2.147E4,-0.5831,0.562,-0.1183,0.009298,-0.0002498},
/*Be*/{2.248,2.59,966,153.8,0.03475,0.002039,1.63E4,0.2779,0.1745,-0.05684,0.005155,-0.0001488},
/*B*/{2.474,2.815,1206,1060,0.02855,0.002549,1.345E4,-2.445,1.283,-0.2205,0.0156,-0.000393},
/*C*/{2.631,2.989,1445,957.2,0.02819,0.003059,1.322E4,-4.38,2.044,-0.3283,0.02221,-0.0005417},
/*N*/{2.954,3.35,1683,1900,0.02513,0.003569,1.179E4,-5.054,2.325,-0.3713,0.02506,-0.0006109},
/*O*/{2.652,3,1920,2000,0.0223,0.004079,1.046E4,-6.734,3.019,-0.4748,0.03171,-0.0007669},
/*F*/{2.085,2.352,2157,2634,0.01816,0.004589,8517,-5.571,2.449,-0.3781,0.02483,-0.0005919},
/*Ne*/{1.951,2.199,2393,2699,0.01568,0.005099,7353,-4.408,1.879,-0.2814,0.01796,-0.0004168},
/*Na*/{2.542,2.869,2628,1854,0.01472,0.005609,6905,-4.959,2.073,-0.3054,0.01921,-0.0004403},
/*Mg*/{3.792,4.293,2862,1009,0.01397,0.006118,6551,-5.51,2.266,-0.3295,0.02047,-0.0004637},
/*Al*/{4.154,4.739,2766,164.5,0.02023,0.006628,6309,-6.061,2.46,-0.3535,0.02173,-0.0004871},
/*Si*/{4.15,4.7,3329,550,0.01321,0.007138,6194,-6.294,2.538,-0.3628,0.0222,-0.0004956},
/*P*/{3.232,3.647,3561,1560,0.01267,0.007648,5942,-6.527,2.616,-0.3721,0.02267,-0.000504},
/*S*/{3.447,3.891,3792,1219,0.01211,0.008158,5678,-6.761,2.694,-0.3814,0.02314,-0.0005125},
/*Cl*/{5.047,5.714,4023,878.6,0.01178,0.008668,5524,-6.994,2.773,-0.3907,0.02361,-0.0005209},
/*Ar*/{5.731,6.5,4253,530,0.01123,0.009178,5268,-7.227,2.851,-0.4,0.02407,-0.0005294},
/*K*/{5.151,5.833,4482,545.7,0.01129,0.009687,5295,-7.44,2.923,-0.4094,0.02462,-0.0005411},
/*Ca*/{5.521,6.252,4710,553.3,0.01112,0.0102,5214,-7.653,2.995,-0.4187,0.02516,-0.0005529},
/*Sc*/{5.201,5.884,4938,560.9,0.009995,0.01071,4688,-8.012,3.123,-0.435,0.02605,-0.0005707},
/*Ti*/{4.862,5.496,5165,568.5,0.009474,0.01122,4443,-8.371,3.251,-0.4513,0.02694,-0.0005886},
/*V*/{4.48,5.055,5391,952.3,0.009117,0.01173,4276,-8.731,3.379,-0.4676,0.02783,-0.0006064},
/*Cr*/{3.983,4.489,5616,1336,0.008413,0.01224,3946,-9.09,3.507,-0.4838,0.02872,-0.0006243},
/*Mn*/{3.469,3.907,5725,1461,0.008829,0.01275,3785,-9.449,3.635,-0.5001,0.02961,-0.0006421},
/*Fe*/{3.519,3.963,6065,1243,0.007782,0.01326,3650,-9.809,3.763,-0.5164,0.0305,-0.00066},
/*Co*/{3.14,3.535,6288,1372,0.007361,0.01377,3453,-10.17,3.891,-0.5327,0.03139,-0.0006779},
/*Ni*/{3.553,4.004,6205,555.1,0.008763,0.01428,3297,-10.53,4.019,-0.549,0.03229,-0.0006957},
/*Cu*/{3.696,4.175,4673,387.8,0.02188,0.01479,3174,-11.18,4.252,-0.5791,0.03399,-0.0007314},
/*Zn*/{4.21,4.75,6953,295.2,0.006809,0.0153,3194,-11.57,4.394,-0.598,0.03506,-0.0007537},
/*Ga*/{5.041,5.697,7173,202.6,0.006725,0.01581,3154,-11.95,4.537,-0.6169,0.03613,-0.0007759},
/*Ge*/{5.554,6.3,6496,110,0.009689,0.01632,3097,-12.34,4.68,-0.6358,0.03721,-0.0007981},
/*As*/{5.323,6.012,7611,292.5,0.006447,0.01683,3024,-12.72,4.823,-0.6547,0.03828,-0.0008203},
/*Se*/{5.874,6.656,7395,117.5,0.007684,0.01734,3006,-13.11,4.965,-0.6735,0.03935,-0.0008425},
/*Br*/{5.611,6.335,8046,365.2,0.006244,0.01785,2928,-13.4,5.083,-0.6906,0.04042,-0.0008675},
/*Kr*/{6.411,7.25,8262,220,0.006087,0.01836,2855,-13.69,5.2,-0.7076,0.0415,-0.0008925},
/*Rb*/{5.694,6.429,8478,292.9,0.006087,0.01886,2855,-13.92,5.266,-0.714,0.04173,-0.0008943},
/*Sr*/{6.339,7.159,8693,330.3,0.006003,0.01937,2815,-14.14,5.331,-0.7205,0.04196,-0.0008962},
/*Y*/{6.407,7.234,8907,367.8,0.005889,0.01988,2762,-14.36,5.397,-0.7269,0.04219,-0.000898},
/*Zr*/{6.734,7.603,9120,405.2,0.005765,0.02039,2704,-14.59,5.463,-0.7333,0.04242,-0.0008998},
/*Nb*/{6.902,7.791,9333,442.7,0.005587,0.0209,2621,-16.22,6.094,-0.8225,0.04791,-0.001024},
/*Mo*/{6.425,7.248,9545,480.2,0.005367,0.02141,2517,-17.85,6.725,-0.9116,0.05339,-0.001148},
/*Tc*/{6.799,7.671,9756,517.6,0.005315,0.02192,2493,-17.96,6.752,-0.9135,0.05341,-0.001147},
/*Ru*/{6.108,6.887,9966,555.1,0.005151,0.02243,2416,-18.07,6.779,-0.9154,0.05342,-0.001145},
/*Rh*/{5.924,6.677,1.018E4,592.5,0.004919,0.02294,2307,-18.18,6.806,-0.9173,0.05343,-0.001143},
/*Pd*/{5.238,5.9,1.038E4,630,0.004758,0.02345,2231,-18.28,6.833,-0.9192,0.05345,-0.001142},
/*Ag*/{5.623,6.354,7160,337.6,0.01394,0.02396,2193,-18.39,6.86,-0.9211,0.05346,-0.00114},
/*Cd*/{5.814,6.554,1.08E4,355.5,0.004626,0.02447,2170,-18.62,6.915,-0.9243,0.0534,-0.001134},
/*In*/{6.23,7.024,1.101E4,370.9,0.00454,0.02498,2129,-18.85,6.969,-0.9275,0.05335,-0.001127},
/*Sn*/{6.41,7.227,1.121E4,386.4,0.004474,0.02549,2099,-19.07,7.024,-0.9308,0.05329,-0.001121},
/*Sb*/{7.5,8.48,8608,348,0.009074,0.026,2069,-19.57,7.225,-0.9603,0.05518,-0.001165},
/*Te*/{6.979,7.871,1.162E4,392.4,0.004402,0.02651,2065,-20.07,7.426,-0.9899,0.05707,-0.001209},
/*I*/{7.725,8.716,1.183E4,394.8,0.004376,0.02702,2052,-20.56,7.627,-1.019,0.05896,-0.001254},
/*Xe*/{8.231,9.289,1.203E4,397.3,0.004384,0.02753,2056,-21.06,7.828,-1.049,0.06085,-0.001298},
/*Cs*/{7.287,8.218,1.223E4,399.7,0.004447,0.02804,2086,-20.4,7.54,-1.004,0.05782,-0.001224},
/*Ba*/{7.899,8.911,1.243E4,402.1,0.004511,0.02855,2116,-19.74,7.252,-0.9588,0.05479,-0.001151},
/*La*/{8.041,9.071,1.263E4,404.5,0.00454,0.02906,2129,-19.08,6.964,-0.9136,0.05176,-0.001077},
/*Ce*/{7.489,8.444,1.283E4,406.9,0.00442,0.02957,2073,-18.43,6.677,-0.8684,0.04872,-0.001003},
/*Pr*/{7.291,8.219,1.303E4,409.3,0.004298,0.03008,2016,-17.77,6.389,-0.8233,0.04569,-0.0009292},
/*Nd*/{7.098,8,1.323E4,411.8,0.004182,0.03059,1962,-17.11,6.101,-0.7781,0.04266,-0.0008553},
/*Pm*/{6.91,7.786,1.343E4,414.2,0.00405,0.0311,1903,-16.45,5.813,-0.733,0.03963,-0.0007815},
/*Sm*/{6.728,7.58,1.362E4,416.6,0.003976,0.03161,1865,-15.79,5.526,-0.6878,0.0366,-0.0007077},
/*Eu*/{6.551,7.38,1.382E4,419,0.003877,0.03212,1819,-15.13,5.238,-0.6426,0.03357,-0.0006339},
/*Gd*/{6.739,7.592,1.402E4,421.4,0.003863,0.03263,1812,-14.47,4.95,-0.5975,0.03053,-0.0005601},
/*Tb*/{6.212,6.996,1.421E4,423.9,0.003725,0.03314,1747,-14.56,4.984,-0.6022,0.03082,-0.0005668},
/*Dy*/{5.517,6.21,1.44E4,426.3,0.003632,0.03365,1703,-14.65,5.018,-0.6069,0.03111,-0.0005734},
/*Ho*/{5.219,5.874,1.46E4,428.7,0.003498,0.03416,1640,-14.74,5.051,-0.6117,0.03141,-0.0005801},
/*Er*/{5.071,5.706,1.479E4,433,0.003405,0.03467,1597,-14.83,5.085,-0.6164,0.0317,-0.0005867},
/*Tm*/{4.926,5.542,1.498E4,433.5,0.003342,0.03518,1567,-14.91,5.119,-0.6211,0.03199,-0.0005933},
/*Yb*/{4.787, 5.386,1.517E4,435.9,0.003292,0.03569,1544,-15,5.153,-0.6258,0.03228,-0.0006},
/*Lu*/{4.893, 5.505,1.536E4,438.4,0.003243,0.0362,1521,-15.09,5.186,-0.6305,0.03257,-0.0006066},
/*Hf*/{5.028, 5.657,1.555E4,440.8,0.003195,0.03671,1499,-15.18,5.22,-0.6353,0.03286,-0.0006133},
/*Ta*/{4.738, 5.329,1.574E4,443.2,0.003186,0.03722,1494,-15.27,5.254,-0.64,0.03315,-0.0006199},
/*W*/{4.574, 5.144,1.593E4,442.4,0.003144,0.03773,1475,-15.67,5.392,-0.6577,0.03418,-0.0006426},
/*Re*/{5.2, 5.851,1.612E4,441.6,0.003122,0.03824,1464,-16.07,5.529,-0.6755,0.03521,-0.0006654},
/*Os*/{5.07, 5.704,1.63E4,440.9,0.003082,0.03875,1446,-16.47,5.667,-0.6932,0.03624,-0.0006881},
/*Ir*/{4.945, 5.563,1.649E4,440.1,0.002965,0.03926,1390,-16.88,5.804,-0.711,0.03727,-0.0007109},
/*Pt*/{4.476, 5.034,1.667E4,439.3,0.002871,0.03977,1347,-17.28,5.942,-0.7287,0.0383,-0.0007336},
/*Au*/{4.856, 5.46,1.832E4,438.5,0.002542,0.04028,1354,-17.02,5.846,-0.7149,0.0374,-0.0007114},
/*Hg*/{4.308, 4.843,1.704E4,487.8,0.002882,0.04079,1352,-17.84,6.183,-0.7659,0.04076,-0.0007925},
/*Tl*/{4.723, 5.311,1.722E4,537,0.002913,0.0413,1366,-18.66,6.52,-0.8169,0.04411,-0.0008737},
/*Pb*/{5.319, 5.982,1.74E4,586.3,0.002871,0.04181,1347,-19.48,6.857,-0.8678,0.04747,-0.0009548},
/*Bi*/{5.956, 6.7,1.78E4,677,0.00266,0.04232,1336,-19.55,6.871,-0.8686,0.04748,-0.0009544},
/*Po*/{6.158, 6.928,1.777E4,586.3,0.002812,0.04283,1319,-19.62,6.884,-0.8694,0.04748,-0.000954},
/*At*/{6.204, 6.979,1.795E4,586.3,0.002776,0.04334,1302,-19.69,6.898,-0.8702,0.04749,-0.0009536},
/*Rn*/{6.181, 6.954,1.812E4,586.3,0.002748,0.04385,1289,-19.76,6.912,-0.871,0.04749,-0.0009532},
/*Fr*/{6.949, 7.82,1.83E4,586.3,0.002737,0.04436,1284,-19.83,6.926,-0.8718,0.0475,-0.0009528},
/*Ra*/{7.506, 8.448,1.848E4,586.3,0.002727,0.04487,1279,-19.9,6.94,-0.8726,0.04751,-0.0009524},
/*Ac*/{7.649, 8.609,1.866E4,586.3,0.002697,0.04538,1265,-19.97,6.953,-0.8733,0.04751,-0.000952},
/*Th*/{7.71, 8.679,1.883E4,586.3,0.002641,0.04589,1239,-20.04,6.967,-0.8741,0.04752,-0.0009516},
/*Pa*/{7.407, 8.336,1.901E4,586.3,0.002603,0.0464,1221,-20.11,6.981,-0.8749,0.04752,-0.0009512},
/*U*/{7.29, 8.204,1.918E4,586.3,0.002573,0.04691,1207,-20.18,6.995,-0.8757,0.04753,-0.0009508}
};
#endif

57
include/EnergyLoss.h Normal file
View File

@ -0,0 +1,57 @@
/*
EnergyLoss.h
Code for calculating the energy loss of a charged, massive particle through an arbitrary medium.
Based on code written by D.W. Visser at Yale for the original SPANC. Uses energy loss calulations
described by Ziegler in various SRIM textbooks.
Written by G.W. McCann Aug. 2020
*/
#ifndef ENERGYLOSS_H
#define ENERGYLOSS_H
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <cmath>
#include "Eloss_Tables.h"
#include "MassLookup.h"
class EnergyLoss {
public:
EnergyLoss();
~EnergyLoss();
double GetEnergyLoss(int zp, int ap, double e_initial, double thickness);
double GetReverseEnergyLoss(int zp, int ap, double e_final, double thickness);
double GetRange(double energy);
void SetTargetComponents(std::vector<int>& Zt, std::vector<int>& At, std::vector<int>& Stoich);
private:
double GetElectronicStoppingPower(double energy);
double GetNuclearStoppingPower(double energy);
double GetTotalStoppingPower(double energy);
double Hydrogen_dEdx_Low(double e_per_u, int z);
double Hydrogen_dEdx_Med(double e_per_u, int z);
double Hydrogen_dEdx_High(double e_per_u, double energy, int z);
double CalculateEffectiveChargeRatio(double e_per_u, int z);
int ZP, AP;
double MP; //units of u, isotopic
double comp_denom;
std::vector<int> ZT, AT;
std::vector<double> targ_composition;
//constants for calculations
static constexpr double MAX_FRACTIONAL_STEP = 0.001;
static constexpr double MAX_H_E_PER_U = 100000.0;
static constexpr double AVOGADRO = 0.60221367; //N_A times 10^(-24) for converting
static constexpr double MEV2U = 1.0/931.4940954;
static constexpr double PI = 3.14159265358979323846;
static constexpr double H_RESTMASS = 938.27231; //MeV, for beta calc
};
#endif

47
include/G4Vec.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef G4VEC_H
#define G4VEC_H
#include <cmath>
class G4Vec {
public:
G4Vec();
G4Vec(double px, double py, double pz, double E);
virtual ~G4Vec();
void SetVectorCartesian(double px, double py, double pz, double E);
void SetVectorSpherical(double theta, double phi, double p, double E);
inline double GetE() const {return m_data[3];};
inline double GetPx() const {return m_data[0];};
inline double GetPy() const {return m_data[1];};
inline double GetPz() const {return m_data[2];};
inline double GetP() const {return std::sqrt(m_data[0]*m_data[0] + m_data[1]*m_data[1] + m_data[2]*m_data[2]);};
inline double GetTheta() const {return GetP() == 0.0 ? 0.0 : acos(GetPz()/GetP());};
inline double GetPhi() const {
if(GetPx() == 0) return M_PI/2.0;
double phi = std::atan(GetPy()/GetPx());
if(GetPx()<0) phi += M_PI;
else if(GetPy()<0) phi += 2.0*M_PI;
return phi;
};
inline double GetInvMass() const {return std::sqrt(GetE()*GetE() - GetP()*GetP());};
inline double GetKE() const {return GetE() - GetInvMass();};
inline const double* GetBoost() const {return &m_boost[0];};
void ApplyBoost(const double* boost);
//Only intended for use in looping access!
inline const double operator[] (int index) const {return index>3 || index < 0 ? 0.0 : m_data[index];};
inline G4Vec& operator=(const G4Vec& rhs) {SetVectorCartesian(rhs.GetPx(), rhs.GetPy(), rhs.GetPz(), rhs.GetE()); return *this;};
inline G4Vec operator+(const G4Vec& rhs) const {return G4Vec(rhs.GetPx()+GetPx(), rhs.GetPy()+GetPy(), rhs.GetPz()+GetPz(), rhs.GetE()+GetE());};
inline G4Vec operator-(const G4Vec& rhs) const {return G4Vec(rhs.GetPx()-GetPx(), rhs.GetPy()-GetPy(), rhs.GetPz()-GetPz(), rhs.GetE()-GetE());};
double Dot(const G4Vec& rhs) const;
G4Vec Cross(const G4Vec& rhs) const;
private:
void CalcBoostToCM();
double m_data[4];
double m_boost[3];
};
#endif

63
include/Kinematics.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef KINEMATICS_H
#define KINEMATICS_H
#include "ReactionSystem.h"
#include "TwoStepSystem.h"
#include "ThreeStepSystem.h"
#include "Plotter.h"
#include <TFile.h>
#include <TTree.h>
//For tree
struct NucData {
double KE = -1;
double E = -1;
double Ex = -1;
double p = -1;
double theta = -1;
double phi = -1;
};
class Kinematics {
public:
Kinematics();
~Kinematics();
bool LoadConfig(const char* filename);
bool SaveConfig(const char* filename);
inline void SetTreeFlag() { save_tree_flag = true; };
inline void SetPlotterFlag() { do_plotter_flag = true; };
inline int GetNumberOfSamples() { return m_nsamples; };
inline const char* GetSystemName() { return sys == nullptr ? "" : sys->GetSystemEquation(); };
inline const char* GetOutputName() { return m_outfile_name.c_str(); };
inline int GetReactionType() { return m_rxn_type; };
void Run();
enum RxnType {
ONESTEP_RXN,
ONESTEP_DECAY,
TWOSTEP,
THREESTEP
};
private:
void RunOneStepRxn();
void RunOneStepDecay();
void RunTwoStep();
void RunThreeStep();
ReactionSystem* sys;
Plotter plotman;
NucData ConvertNucleus(const Nucleus& nuc);
bool save_tree_flag, do_plotter_flag;
std::string m_outfile_name;
int m_rxn_type, m_nsamples;
TRandom3* global_generator;
};
#endif

View File

@ -0,0 +1,66 @@
#ifndef KINEMATICSEXCEPTIONS_H
#define KINEMATICSEXCEPTIONS_H
#include <exception>
#include <stdexcept>
/*
ELossException
This is an exception that is thrown by the Energy loss calculator. It is not specific to one particular
location in EnergyLoss.cpp/.h, however there are really only a couple of ways that these can fail.
Either your nucleus is not well defined (i.e. doe not exist in the Eloss_Tables.h) or you've tried to run
it without defining the proper information. See the SetTargetComponentsand GetElectronicStoppingPower functions
for locations where this could be thrown
*/
struct ELossException : public std::exception {
const char* what() const noexcept {
return "Failure to calculate particle energy loss. See KinematicsExceptions.h for documentation.";
};
};
/*
MassException
This is an exception thrown when the MassLookup is queried for an isotope for which it does not have a defined
mass. The masses are defined in ./etc/mass.txt, which is a condensed version of the AMDC Mass Evaluation from 2017.
*/
struct MassException : public std::exception {
const char* what() const noexcept {
return "Unable to find a given isotopic mass. See Kinematics.h for documentation.";
};
};
/*
MassFileException
This is an exception thrown when the MassLookup cannot find the ./etc/mass.txt file.
*/
struct MassFileException : public std::exception {
const char* what() const noexcept {
return "Unable to find ./etc/mass.txt. Check that it is present.";
};
};
/*
ReactionLayerException
This is an exception thrown when the ReactionSystem cannot find a good layer in its LayeredTarget
to set as the layer where the reaction takes place. A good layer is a layer which contains the isotope which
corresponds to the isotope defined as the "target" in the reaction equation.
*/
struct ReactionLayerException : public std::exception {
const char* what() const noexcept {
return "Unable to find a valid layer for reaction in the target. See KinematicsExceptions.h for documentation.";
};
};
/*
QValueException
This is an exception thrown when the Reaction caluclates a decay Q-value that is negative, indicating
that there is not enough energy to create the decay products.
*/
struct QValueException : public std::exception {
const char* what() const noexcept {
return "Q-value is negative for decay calculation. See KinematicsExceptions.h for documentation.";
};
};
#endif

41
include/LayeredTarget.h Normal file
View File

@ -0,0 +1,41 @@
/*
LayeredTarget.h
Functional unit for targets in the SPANCRedux environment. Contains a
set (read: vector) of Targets for use in reaction calculations. In this
way handles situations such as carbon backed targets
Based on code by D.W. Visser written at Yale for the original SPANC
Written by G.W. McCann Aug. 2020
*/
#ifndef LAYEREDTARGET_H
#define LAYEREDTARGET_H
#include <vector>
#include <string>
#include <iostream>
#include "Target.h"
class LayeredTarget {
public:
LayeredTarget();
~LayeredTarget();
void AddLayer(std::vector<int>& Z, std::vector<int>& A, std::vector<int>& stoich, double thickness);
double GetProjectileEnergyLoss(int zp, int ap, double startEnergy, int rxnLayer, double angle);
double GetEjectileEnergyLoss(int ze, int ae, double startEnergy, int rxnLayer, double angle);
double GetEjectileReverseEnergyLoss(int ze, int ae, double startEnergy, int rxnLayer, double angle);
int GetNumberOfLayers();
int FindLayerContaining(int Z, int A);
void SetName(std::string& n);
Target& GetLayerInfo(int index);
std::string& GetName();
private:
std::vector<Target> layers;
std::string name;
};
#endif

View File

@ -0,0 +1,5 @@
#ifdef __CLING__
#pragma link C++ struct NucData+;
#endif

40
include/MassLookup.h Normal file
View File

@ -0,0 +1,40 @@
/*
MassLookup.h
Generates a map for isotopic masses using AMDC data; subtracts away
electron mass from the atomic mass by default. Creates a static global instance
of this map (MASS) for use throughout code it is included into.
Written by G.W. McCann Aug. 2020
*/
#ifndef MASS_LOOKUP_H
#define MASS_LOOKUP_H
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdexcept>
class MassLookup {
public:
MassLookup();
~MassLookup();
double FindMass(int Z, int A);
std::string FindSymbol(int Z, int A);
private:
std::unordered_map<std::string, double> massTable;
std::unordered_map<int, std::string> elementTable;
//constants
static constexpr double u_to_mev = 931.4940954;
static constexpr double electron_mass = 0.000548579909;
};
//static instance for use throught program
static MassLookup MASS;
#endif

42
include/Nucleus.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef NUCLEUS_H
#define NUCLEUS_H
#include "G4Vec.h"
#include <string>
class Nucleus : public G4Vec {
public:
Nucleus();
Nucleus(int Z, int A);
Nucleus(int Z, int A, double px, double py, double pz, double E);
~Nucleus();
bool SetIsotope(int Z, int A);
inline int GetZ() const { return m_z; };
inline int GetA() const { return m_a; };
inline double GetExcitationEnergy() const { return GetInvMass() - m_gs_mass; };
inline double GetGroundStateMass() const { return m_gs_mass; };
inline const char* GetIsotopicSymbol() const { return m_symbol.c_str(); };
inline Nucleus& operator=(const Nucleus& rhs) {
SetIsotope(rhs.GetZ(), rhs.GetA());
SetVectorCartesian(rhs.GetPx(), rhs.GetPy(), rhs.GetPz(), rhs.GetE());
return *this;
};
inline Nucleus operator+(const Nucleus& daughter) {
return Nucleus(GetZ()+daughter.GetZ(), GetA()+daughter.GetA(), GetPx()+daughter.GetPx(), GetPy()+daughter.GetPy(), GetPz()+daughter.GetPz(), GetE()+daughter.GetE());
};
inline Nucleus operator-(const Nucleus& daughter) {
return (GetZ() - daughter.GetZ()) <= 0 || (GetA() - daughter.GetA()) <= 0 ? Nucleus() :
Nucleus(GetZ()-daughter.GetZ(), GetA() - daughter.GetA(), GetPx()-daughter.GetPx(), GetPy()-daughter.GetPy(), GetPz()-daughter.GetPz(), GetE()-daughter.GetE());
};
private:
int m_z, m_a;
double m_gs_mass;
std::string m_symbol;
};
#endif

45
include/Plotter.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef PLOTTER_H
#define PLOTTER_H
#include <TROOT.h>
#include <TH1.h>
#include <TH2.h>
#include <TGraph.h>
#include <THashTable.h>
#include "Nucleus.h"
struct GraphData {
std::string name;
std::string title;
std::vector<double> xvec;
std::vector<double> yvec;
int color;
};
class Plotter {
public:
Plotter();
~Plotter();
inline void ClearTable() { table->Clear(); };
inline THashTable* GetTable() {
GenerateGraphs();
return table;
};
void FillData(const Nucleus& nuc);
private:
THashTable* table;
void GenerateGraphs();
void MyFill(const char* name, const char* title, int bins, float min, float max, double val);
void MyFill(const char* name, const char* title, int binsx, float minx, float maxx, int binsy, float miny, float maxy, double valx, double valy);
void MyFill(const char* name, const char* title, double valx, double valy, int color); //TGraph
std::vector<TGraph*> garbage_collection;
std::vector<GraphData> graphs;
static constexpr double rad2deg = 180.0/M_PI;
};
#endif

54
include/Reaction.h Normal file
View File

@ -0,0 +1,54 @@
#ifndef REACTION_H
#define REACTION_H
#include "Nucleus.h"
#include "LayeredTarget.h"
class Reaction {
public:
Reaction();
Reaction(int zt, int at, int zp, int ap, int ze, int ae);
~Reaction();
bool Calculate();
void SetNuclei(int zt, int at, int zp, int ap, int ze, int ae);
void SetNuclei(const Nucleus* nucs);
void SetBeamKE(double bke);
inline void SetLayeredTarget(LayeredTarget* targ) { target = targ; };
inline void SetPolarRxnAngle(double theta) { m_theta = theta; };
inline void SetAzimRxnAngle(double phi) { m_phi = phi; };
inline void SetExcitation(double ex) { m_ex = ex; };
inline void SetTarget(const Nucleus& nuc) { reactants[0] = nuc; };
inline void SetTarget(int z, int a) { reactants[0] = Nucleus(z, a); };
inline void SetProjectile(const Nucleus& nuc) { reactants[1] = nuc; };
inline void SetProjectile(int z, int a) { reactants[1] = Nucleus(z, a); };
inline void SetEjectile(const Nucleus& nuc) { reactants[2] = nuc; };
inline void SetEjectile(int z, int a) { reactants[2] = Nucleus(z, a); };
inline void SetResidual(const Nucleus& nuc) { reactants[3] = nuc; };
inline void SetResidual(int z, int a) { reactants[3] = Nucleus(z, a); };
inline void SetRxnLayer(int layer) { rxnLayer = layer; };
inline void TurnOffResidualEloss() { resid_elossFlag = false; };
inline void TurnOnResidualEloss() { resid_elossFlag = true; };
inline bool IsDecay() { return decayFlag; };
inline const Nucleus* GetNuclei() const { return &(reactants[0]); };
inline const Nucleus& GetProjectile() const { return reactants[1]; };
inline const Nucleus& GetTarget() const { return reactants[0]; };
inline const Nucleus& GetEjectile() const { return reactants[2]; };
inline const Nucleus& GetResidual() const { return reactants[3]; };
inline int GetRxnLayer() { return rxnLayer; };
private:
void CalculateReaction(); //target + project -> eject + resid
void CalculateDecay(); //target -> light_decay (eject) + heavy_decay(resid)
Nucleus reactants[4]; //0=target, 1=projectile, 2=ejectile, 3=residual
LayeredTarget* target; //not owned by Reaction
double m_bke, m_theta, m_phi, m_ex;
int rxnLayer;
bool decayFlag, nuc_initFlag, resid_elossFlag;
};
#endif

42
include/ReactionSystem.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef REACTIONSYSTEM_H
#define REACTIONSYSTEM_H
#include "Reaction.h"
#include <vector>
#include <TRandom3.h>
class ReactionSystem {
public:
ReactionSystem();
ReactionSystem(std::vector<int>& z, std::vector<int>& a);
virtual ~ReactionSystem();
virtual bool SetNuclei(std::vector<int>& z, std::vector<int>& a);
void AddTargetLayer(std::vector<int>& zt, std::vector<int>& at, std::vector<int>& stoich, double thickness);
inline void SetRandomGenerator(TRandom3* gen) { generator = gen; gen_set_flag = true; };
inline void SetBeamDistro(double mean, double sigma) { m_beamDist = std::make_pair(mean, sigma); };
inline void SetTheta1Range(double min, double max) { m_theta1Range = std::make_pair(min*deg2rad, max*deg2rad); };
inline void SetExcitationDistro(double mean, double sigma) { m_exDist = std::make_pair(mean, sigma); };
virtual void RunSystem();
inline const Nucleus& GetTarget() const { return step1.GetTarget(); };
inline const Nucleus& GetProjectile() const { return step1.GetProjectile(); };
inline const Nucleus& GetEjectile() const { return step1.GetEjectile(); };
inline const Nucleus& GetResidual() const { return step1.GetResidual(); };
inline const char* GetSystemEquation() { return m_sys_equation.c_str(); };
protected:
virtual void LinkTarget();
virtual void SetSystemEquation();
Reaction step1;
LayeredTarget target;
std::pair<double, double> m_beamDist, m_theta1Range, m_exDist;
TRandom3* generator; //not owned by ReactionSystem
bool target_set_flag, gen_set_flag;
int rxnLayer;
std::string m_sys_equation;
static constexpr double deg2rad = M_PI/180.0;
};
#endif

137
include/SabreDetector.h Normal file
View File

@ -0,0 +1,137 @@
#ifndef __SABREDETECTOR_H
#define __SABREDETECTOR_H
#include <TRandom3.h>
struct CartCoords {
double x;
double y;
double z;
double operator[](int i) { //Overloaded for compatibility with Get_Cart. Only for access
switch(i) {
case(0): return this->x;
case(1): return this->y;
case(2): return this->z;
default: return 0;
}
}
double GetTheta();
double GetR();
double GetPhi();
double GetDetectorPhi();
};
class SabreDetGeometry {
public:
SabreDetGeometry(double iRinner_flat,
double iRouter_flat,
double ideltaPhi_flat,
double ibeamPhi_central,
double itiltFromVertical,
double idistFromTarget,
double xoffset=0,
double yoffset=0);
~SabreDetGeometry();
double Get_Ring_Flat_X(int ch, int corner);
double Get_Ring_Flat_Y(int ch, int corner);
double Get_Ring_Flat_Z(int ch, int corner);
double Get_Ring_Flat_R(int ch, int corner);
double Get_Ring_Flat_Theta(int ch, int corner);
double Get_Ring_Flat_Phi(int ch, int corner);
double Get_Wedge_Flat_X(int ch, int corner);
double Get_Wedge_Flat_Y(int ch, int corner);
double Get_Wedge_Flat_Z(int ch, int corner);
double Get_Wedge_Flat_R(int ch, int corner);
double Get_Wedge_Flat_Theta(int ch, int corner);
double Get_Wedge_Flat_Phi(int ch, int corner);
double Get_Ring_Tilted_X(int ch, int corner);
double Get_Ring_Tilted_Y(int ch, int corner);
double Get_Ring_Tilted_Z(int ch, int corner);
double Get_Ring_Tilted_R(int ch, int corner);
double Get_Ring_Tilted_Theta(int ch, int corner);
double Get_Ring_Tilted_Phi(int ch, int corner);
double Get_Wedge_Tilted_X(int ch, int corner);
double Get_Wedge_Tilted_Y(int ch, int corner);
double Get_Wedge_Tilted_Z(int ch, int corner);
double Get_Wedge_Tilted_R(int ch, int corner);
double Get_Wedge_Tilted_Theta(int ch, int corner);
double Get_Wedge_Tilted_Phi(int ch, int corner);
bool IsInside(double theta, double phi);
CartCoords GetTrajectoryCoordinates(double theta, double phi);
void Recenter(double x, double y);
int NumRings();
int NumWedges();
/*** Determine coordinates of the hit (ringch, wedgech) ***/
CartCoords GetCoordinates(int ringch, int wedgech);
double GetScatteringAngle(int ringch, int wedgech); //shortcut to Scattering angle
private:
const int NUMRINGS;
const int NUMWEDGES;
//detector corners
int rbc; //ring bottom channel
int rtc; //ring top channel
int wrc; //wedge right channel
int wlc; //wedge left channel
double Rinner_flat;
double Router_flat;
double deltaR_flat;
double deltaR_flat_ring;
double deltaPhi_flat;
double deltaPhi_flat_wedge;
double beamPhi_central;
double tiltFromVertical;
double ZdistFromTarget;
double XdistFromTarget;
double YdistFromTarget;
TRandom3* random;
//default storage is cartesian
//0=x, 1=y, 2=z
CartCoords **ringch_flat_cart;
CartCoords **wedgech_flat_cart;
CartCoords **ringch_tilted_cart;
CartCoords **wedgech_tilted_cart;
double Get_Cart(int fot, int row, int ch, int corner, int cart);
//fot = flat (0) or tilted (1)
//row = ring (0) or wedge (1)
bool CheckRingChannel(int);
bool CheckWedgeChannel(int);
bool CheckCorner(int);
bool CheckBothRing(int,int);
bool CheckBothWedge(int,int);
/*** Perform transformation for arbitrary point on plane ***/
double **XRotMatrix; //rotation about x-axis
double **ZRotMatrix; //rotation about z-axis
double **XRotMatrixInv; //inverse of x-rotation
double **ZRotMatrixInv; //inverse of z-rotation
CartCoords TransformVector(CartCoords vector);
CartCoords InverseTransformVector(CartCoords vector);
};
#endif

40
include/SabreEfficiency.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef SABREEFFICIENCY_H
#define SABREEFFICIENCY_H
#include "SabreDetector.h"
class SabreEfficiency {
public:
SabreEfficiency();
~SabreEfficiency();
inline void SetReactionType(int t) { m_rxn_type = t; };
void CalculateEfficiency(const char* file);
private:
void Run2Step(const char*);
void Run3Step(const char*);
void RunDecay(const char*);
int m_rxn_type;
std::vector<SabreDetGeometry> detectors;
//Sabre constants
const double INNER_R = 0.0326;
const double OUTER_R = 0.1351;
const double TILT = 40.0;
//const double DIST_2_TARG = 0.14549;
const double DIST_2_TARG = 0.1245;
const double PHI_COVERAGE = 54.4; //delta phi for each det
const double PHI0 = 36.0; //center phi values for each det in array
const double PHI1 = 108.0; //# is equal to detID in channel map
const double PHI2 = 324.0;
const double PHI3 = 252.0;
const double PHI4 = 180.0;
const double DEG2RAD = M_PI/180.0;
const double ENERGY_THRESHOLD = 0.1; //in MeV
};
#endif

46
include/Target.h Normal file
View File

@ -0,0 +1,46 @@
/*
Target.h
A basic target unit for use in the SPANCRedux environment. A target
is defined as a single compound with elements Z,A of a given stoichiometry
Holds an energy loss class
Based on code by D.W. Visser written at Yale for the original SPANC
Written by G.W. McCann Aug. 2020
*/
#ifndef TARGET_H
#define TARGET_H
#include <string>
#include <vector>
#include "EnergyLoss.h"
class Target {
public:
Target(double thick);
~Target();
void SetElements(std::vector<int>& z, std::vector<int>& a, std::vector<int>& stoich);
bool ContainsElement(int z, int a);
double getEnergyLossTotal(int zp, int ap, double startEnergy, double angle);
double getEnergyLossHalf(int zp, int ap, double startEnergy, double angle);
double getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double angle);
double getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double angle);
double& GetThickness();
int GetNumberOfElements();
int GetElementZ(int index);
int GetElementA(int index);
int GetElementStoich(int index);
private:
EnergyLoss eloss;
double thickness;
std::vector<int> Z, A, Stoich;
static constexpr double PI = 3.14159265358979323846;
};
#endif

27
include/ThreeStepSystem.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef THREESTEPSYSTEM_H
#define THREESTEPSYSTEM_H
#include "ReactionSystem.h"
class ThreeStepSystem : public ReactionSystem {
public:
ThreeStepSystem();
ThreeStepSystem(std::vector<int>& z, std::vector<int>& a);
~ThreeStepSystem();
bool SetNuclei(std::vector<int>& z, std::vector<int>& a);
void RunSystem();
inline const Nucleus& GetBreakup1() const { return step2.GetEjectile(); };
inline const Nucleus& GetBreakup2() const { return step2.GetResidual(); };
inline const Nucleus& GetBreakup3() const { return step3.GetEjectile(); };
inline const Nucleus& GetBreakup4() const { return step3.GetResidual(); };
protected:
void LinkTarget();
void SetSystemEquation();
Reaction step2, step3;
};
#endif

25
include/TwoStepSystem.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef TWOSTEPSYSTEM_H
#define TWOSTEPSYSTEM_H
#include "ReactionSystem.h"
class TwoStepSystem : public ReactionSystem {
public:
TwoStepSystem();
TwoStepSystem(std::vector<int>& z, std::vector<int>& a);
~TwoStepSystem();
bool SetNuclei(std::vector<int>& z, std::vector<int>& a);
void RunSystem();
inline const Nucleus& GetBreakup1() const { return step2.GetEjectile(); };
inline const Nucleus& GetBreakup2() const { return step2.GetResidual(); };
private:
void LinkTarget();
void SetSystemEquation();
Reaction step2;
};
#endif

31
input.txt Normal file
View File

@ -0,0 +1,31 @@
----------Data Information----------
OutputFile: /Volumes/LaCie/test_newkine.root
SaveTree: yes
SavePlots: yes
----------Reaction Information----------
ReactionType: 0
Z A (order is target, projectile, ejectile, break1, break3)
5 9
0 0
1 1
----------Target Information----------
Name: test_targ
Layers: 2
~Layer1
Thickness(ug/cm^2): 0
Z A Stoich
6 12 1
0
~
~Layer2
Thickness(ug/cm^2): 0
Z A Stoich
5 9 1
0
~
----------Sampling Information----------
NumberOfSamples: 1000000
BeamMeanEnergy(MeV): 24 BeamEnergySigma(MeV): 0.001
EjectileThetaMin(deg): 20.0 EjectileThetaMax(deg): 20.0
ResidualExMean(MeV): 16.708 ResidualExSigma(MeV): 0.038
--------------------------------------

49
makefile Normal file
View File

@ -0,0 +1,49 @@
CC=g++
ROOTGEN=rootcint
CFLAGS=-std=c++11 -g -Wall `root-config --cflags`
CPPFLAGS=-I ./include
LDFLAGS=`root-config --glibs`
ROOTINCLDIR=./
INCLDIR=./include
SRCDIR=./src
OBJDIR=./objs
BINDIR=./bin
SRC=$(wildcard $(SRCDIR)/*.cpp)
OBJS=$(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
TPOBJ=objs/testplots.o
TPEXE=tp
DICTOBJ=$(OBJDIR)/kinematics_dict.o
DICTSRC=$(SRCDIR)/kinematics_dict.cxx
DICT_PAGES=$(INCLDIR)/Kinematics.h $(INCLDIR)/LinkDef_Kinematics.h
EXE=$(BINDIR)/kinematics
CLEANUP=$(EXE) $(OBJS) $(DICTOBJ) $(DICTSRC) $(TPOBJ)
.PHONY: all clean
all: $(EXE) $(TPEXE)
$(EXE): $(DICTOBJ) $(OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(TPEXE): ./objs/SabreDetector.o $(TPOBJ)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(DICTOBJ): $(DICTSRC)
$(CC) $(CFLAGS) $(CPPFLAGS) -I $(ROOTINCLDIR) -c $^ -o $@
mv $(SRCDIR)/*.pcm $(BINDIR)
$(DICTSRC): $(DICT_PAGES)
$(ROOTGEN) -f $@ $^
VPATH= $(SRCDIR):./testplots/
$(OBJDIR)/%.o: %.cpp
$(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
clean:
$(RM) $(CLEANUP) $(BINDIR)/%.pcm

BIN
objs/EnergyLoss.o Normal file

Binary file not shown.

BIN
objs/G4Vec.o Normal file

Binary file not shown.

BIN
objs/Kinematics.o Normal file

Binary file not shown.

BIN
objs/LayeredTarget.o Normal file

Binary file not shown.

BIN
objs/MassLookup.o Normal file

Binary file not shown.

BIN
objs/Nucleus.o Normal file

Binary file not shown.

BIN
objs/Plotter.o Normal file

Binary file not shown.

BIN
objs/Reaction.o Normal file

Binary file not shown.

BIN
objs/ReactionSystem.o Normal file

Binary file not shown.

BIN
objs/SabreDetector.o Normal file

Binary file not shown.

BIN
objs/SabreEfficiency.o Normal file

Binary file not shown.

BIN
objs/Target.o Normal file

Binary file not shown.

BIN
objs/ThreeStepSystem.o Normal file

Binary file not shown.

BIN
objs/TwoStepSystem.o Normal file

Binary file not shown.

BIN
objs/kinematics_dict.o Normal file

Binary file not shown.

BIN
objs/main.o Normal file

Binary file not shown.

BIN
objs/testplots.o Normal file

Binary file not shown.

234
src/EnergyLoss.cpp Normal file
View File

@ -0,0 +1,234 @@
/*
EnergyLoss.cpp
Code for calculating the energy loss of a charged, massive particle through an arbitrary medium.
Based on code written by D.W. Visser at Yale for the original SPANC. Uses energy loss calulations
described by Ziegler in various SRIM textbooks.
Written by G.W. McCann Aug. 2020
*/
#include "EnergyLoss.h"
#include "KinematicsExceptions.h"
#include <iostream>
EnergyLoss::EnergyLoss() {
comp_denom = 0;
ZP = -1;
}
EnergyLoss::~EnergyLoss() {}
/*Targets are defined by their atomic number, total number of nucleons, and their stoichiometry within the target compound*/
void EnergyLoss::SetTargetComponents(std::vector<int>& Zt, std::vector<int>& At, std::vector<int>& Stoich) {
comp_denom = 0;
ZT = Zt;
AT = At;
for(unsigned int i=0; i<Stoich.size(); i++) {
comp_denom += Stoich[i];
if(ZT[i] > MAX_Z) {
throw ELossException();
}
}
targ_composition.resize(Stoich.size());
for(unsigned int i=0; i<Stoich.size(); i++) {
targ_composition[i] = Stoich[i]/comp_denom;
}
}
/*
Returns units of MeV; thickness in ug/cm^2; e_initial in units of MeV
Energy loss going through the target
*/
double EnergyLoss::GetEnergyLoss(int zp, int ap, double e_initial, double thickness) {
if( ZP != zp) {
ZP = zp;
AP = ap;
MP = MASS.FindMass(ZP, AP)*MEV2U;
}
double e_final = e_initial;
double x_traversed = 0;
double x_step = 0.25*thickness; //initial step in x
double e_step = GetTotalStoppingPower(e_final)*x_step/1000.0; //initial step in e
double e_threshold = 0.05*e_initial;
if(thickness == 0.0) return 0;
else if(e_initial == 0.0) return 0;
bool go = true;
while(go) {
//If intial guess of step size is too large, shrink until in range
if(e_step/e_final > MAX_FRACTIONAL_STEP /*&& e_step >= E_PRECISION_LIMIT*/) {
x_step *= 0.5;
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
} else if((x_step + x_traversed) >= thickness) { //last chunk
go = false;
x_step = thickness - x_traversed; //get valid portion of last chunk
e_final -= GetTotalStoppingPower(e_final)*x_step/1000.0;
if(e_final <= e_threshold) {
return e_initial;
}
} else {
x_traversed += x_step;
e_step = GetTotalStoppingPower(e_final)*x_step/1000.0;
e_final -= e_step;
if(e_final <= e_threshold) {
return e_initial;
}
}
}
return e_initial - e_final;
}
/*
Returns units of MeV; thickness in ug/cm^2; e_final in units of MeV
Energy loss going through the target using energy of particle after traversal
*/
double EnergyLoss::GetReverseEnergyLoss(int zp, int ap, double e_final, double thickness) {
if( ZP != zp) {
ZP = zp;
AP = ap;
MP = MASS.FindMass(ZP, AP)*MEV2U;
}
double e_initial = e_final;
double x_traversed = 0.0;
double x_step = 0.25*thickness; //initial step in x
double e_step = GetTotalStoppingPower(e_initial)*x_step/1000.0; //initial step in E
bool go = true;
while(go) {
if(e_step/e_initial > MAX_FRACTIONAL_STEP) {
x_step *= 0.5;
e_step = GetTotalStoppingPower(e_initial)*x_step/1000.0;
} else if (x_traversed+x_step > thickness) {
go = false;
x_step = thickness - x_traversed;
e_initial += GetTotalStoppingPower(e_initial)*x_step/1000.0;
} else {
x_traversed += x_step;
e_step = GetTotalStoppingPower(e_initial)*x_step/1000.0;
e_initial += e_step;
}
}
return e_initial-e_final;
}
/*
Returns units of keV/(ug/cm^2)
Calculates Electronic stopping power by first calculating SE for hydrogen through the target and then using
corrections to calculate SE for projectile of interest
*/
double EnergyLoss::GetElectronicStoppingPower(double energy) {
//Wants in units of keV
energy *= 1000.0;
double e_per_u = energy/MP;
std::vector<double> values;
if(e_per_u > MAX_H_E_PER_U) {
throw ELossException();
} else if (e_per_u > 1000.0) {
for(auto& z: ZT) {
values.push_back(Hydrogen_dEdx_High(e_per_u, energy, z));
}
} else if (e_per_u > 10.0) {
for(auto& z: ZT) {
values.push_back(Hydrogen_dEdx_Med(e_per_u, z));
}
} else if (e_per_u > 0.0) {
for(auto& z: ZT) {
values.push_back(Hydrogen_dEdx_Low(e_per_u, z));
}
} else {
throw ELossException();
}
if(values.size() == 0) {
throw ELossException();
}
if(ZP > 1) { //not hydrogen, need to account for effective charge
for(unsigned int i=0; i<values.size(); i++) {
values[i] *= CalculateEffectiveChargeRatio(e_per_u, ZT[i]);
}
}
double stopping_total = 0;
double conversion_factor = 0;
for(unsigned int i=0; i<ZT.size(); i++) {
conversion_factor += targ_composition[i]*NATURAL_MASS[ZT[i]];
stopping_total += values[i]*targ_composition[i];
}
stopping_total *= AVOGADRO/conversion_factor;
return stopping_total;
}
//Returns units of keV/(ug/cm^2)
double EnergyLoss::GetNuclearStoppingPower(double energy) {
energy *= 1000.0;
double stopping_total = 0.0;
double sn, x, epsilon, conversion_factor;
for(unsigned int i=0; i<ZT.size(); i++) {
x = (MP + NATURAL_MASS[ZT[i]]) * std::sqrt(std::pow(ZP, 2.0/3.0) + std::pow(ZT[i], 2.0/3.0));
epsilon = 32.53*NATURAL_MASS[ZT[i]]*energy/(ZP*ZT[i]*x);
sn = 8.462*(0.5*std::log(1.0+epsilon)/(epsilon+0.10718*std::pow(epsilon, 0.37544)))*ZP*ZT[i]*MP/x;
conversion_factor = AVOGADRO/NATURAL_MASS[ZT[i]];
stopping_total += sn*conversion_factor*targ_composition[i];
}
return stopping_total;
}
/*Wrapper function for aquiring total stopping (elec + nuc)*/
double EnergyLoss::GetTotalStoppingPower(double energy) {
return GetElectronicStoppingPower(energy)+GetNuclearStoppingPower(energy);
}
/*Charge rel to H*/
double EnergyLoss::CalculateEffectiveChargeRatio(double e_per_u, int z) {
double z_ratio;
if(ZP == 2) {
double ln_epu = std::log(e_per_u);
double gamma = 1.0+(0.007+0.00005*z)*std::exp(-std::pow(7.6-ln_epu,2.0));
double alpha = 0.7446 + 0.1429*ln_epu + 0.01562*std::pow(ln_epu, 2.0) - 0.00267*std::pow(ln_epu,3.0)
+ 1.338E-6*std::pow(ln_epu,8.0);
z_ratio = gamma*(1.0-std::exp(-alpha))*2.0; //test this; SPANC has factor of 2. mult
} else if (ZP == 3) {
double ln_epu = std::log(e_per_u);
double gamma = 1.0+(0.007+0.00005*z)*std::exp(-std::pow(7.6-ln_epu,2.0));
double alpha = 0.7138+0.002797*e_per_u+1.348E-6*std::pow(e_per_u, 2.0);
z_ratio = gamma*(1-std::exp(-alpha))*3.0; //test this; SPANC has factor of 3. mult
} else {
double B = 0.886*std::pow(e_per_u/25.0, 0.5)/std::pow(ZP, 2.0/3.0);
double A = B + 0.0378*std::sin(PI/2.0*B);
z_ratio = 1.0 - std::exp(-A)*(1.034-0.1777*std::exp(-0.08114*ZP))*z; //test this; SPANC has factor of ZT[i] mult
}
return z_ratio*z_ratio; //for stopping power uses ratio sq.
}
double EnergyLoss::Hydrogen_dEdx_Low(double e_per_u, int z) {
return std::sqrt(e_per_u)*HYDROGEN_COEFF[z][0];
}
double EnergyLoss::Hydrogen_dEdx_Med(double e_per_u, int z) {
double x = HYDROGEN_COEFF[z][1]*std::pow(e_per_u, 0.45);
double y = HYDROGEN_COEFF[z][2]/e_per_u * std::log(1.0+HYDROGEN_COEFF[z][3]/e_per_u+HYDROGEN_COEFF[z][4]*e_per_u);
return x*y/(x+y);
}
double EnergyLoss::Hydrogen_dEdx_High(double e_per_u, double energy, int z) {
energy /= 1000.0; //back to MeV for ease of beta calc
double beta_sq = energy * (energy+2.0*MP/MEV2U)/std::pow(energy+MP/MEV2U, 2.0);
double alpha = HYDROGEN_COEFF[z][5]/beta_sq;
double epsilon = HYDROGEN_COEFF[z][6]*beta_sq/(1.0-beta_sq) - beta_sq - HYDROGEN_COEFF[z][7];
for(int i=1; i<5; i++) {
epsilon += HYDROGEN_COEFF[z][7+i]*std::pow(std::log(e_per_u), i);
}
return alpha * std::log(epsilon);
}
double EnergyLoss::GetRange(double energy) {return 0.0;} //unimplemented

62
src/G4Vec.cpp Normal file
View File

@ -0,0 +1,62 @@
#include "G4Vec.h"
//NOTE: uses (-,-,-,+) metric (same as ROOT convention)
G4Vec::G4Vec() {
for(auto& val: m_data)
val = 0.0;
for(auto& val: m_boost)
val = 0.0;
}
G4Vec::G4Vec(double px, double py, double pz, double E) {
m_data[0] = px;
m_data[1] = py;
m_data[2] = pz;
m_data[3] = E;
CalcBoostToCM();
}
G4Vec::~G4Vec() {}
void G4Vec::SetVectorCartesian(double px, double py, double pz, double E) {
m_data[0] = px;
m_data[1] = py;
m_data[2] = pz;
m_data[3] = E;
CalcBoostToCM();
}
void G4Vec::SetVectorSpherical(double theta, double phi, double p, double E) {
m_data[0] = p*cos(phi)*sin(theta);
m_data[1] = p*sin(phi)*sin(theta);
m_data[2] = p*cos(theta);
m_data[3] = E;
CalcBoostToCM();
}
void G4Vec::CalcBoostToCM() {
m_boost[0] = m_data[0]/m_data[3];
m_boost[1] = m_data[1]/m_data[3];
m_boost[2] = m_data[2]/m_data[3];
}
void G4Vec::ApplyBoost(const double* beta) {
double beta2 = beta[0]*beta[0] + beta[1]*beta[1] + beta[2]*beta[2];
double gamma = 1.0/std::sqrt(1.0 - beta2);
double bdotp = beta[0]*m_data[0] + beta[1]*m_data[1] + beta[2]*m_data[2];
double gfactor = beta2>0.0 ? (gamma - 1.0)/beta2 : 0.0;
SetVectorCartesian(GetPx()+gfactor*bdotp*beta[0]+gamma*beta[0]*GetE(),
GetPy()+gfactor*bdotp*beta[1]+gamma*beta[1]*GetE(),
GetPz()+gfactor*bdotp*beta[2]+gamma*beta[2]*GetE(),
gamma*(GetE() + bdotp));
}
double G4Vec::Dot(const G4Vec& rhs) const {
return GetE()*rhs.GetE() - GetPx()*rhs.GetPx() - GetPy()*rhs.GetPy() - GetPz()*rhs.GetPz();
}
G4Vec G4Vec::Cross(const G4Vec& rhs) const {
return G4Vec();
}

394
src/Kinematics.cpp Normal file
View File

@ -0,0 +1,394 @@
#include "Kinematics.h"
#include <fstream>
#include <iostream>
Kinematics::Kinematics() :
sys(nullptr), save_tree_flag(false), do_plotter_flag(false), global_generator(new TRandom3(0))
{
std::cout<<"----------GWM Kinematics Simulation----------"<<std::endl;
}
Kinematics::~Kinematics() {
delete global_generator;
if(sys) delete sys;
}
bool Kinematics::LoadConfig(const char* filename) {
std::cout<<"Loading configuration in "<<filename<<"..."<<std::endl;
std::ifstream input(filename);
if(!input.is_open()) {
std::cerr<<"Unable to load configuration in "<<filename<<", check that it exists"<<std::endl;
return false;
}
std::string junk;
getline(input, junk);
input>>junk>>m_outfile_name;
input>>junk>>junk;
if(junk == "yes") save_tree_flag = true;
input>>junk>>junk;
if(junk == "yes") do_plotter_flag = true;
std::vector<int> avec, zvec, svec;
int z, a, s;
getline(input, junk);
getline(input, junk);
input>>junk>>m_rxn_type;
getline(input, junk);
getline(input, junk);
switch(m_rxn_type) {
case 0:
{
sys = new ReactionSystem();
m_rxn_type = ONESTEP_DECAY;
for(int i=0; i<3; i++) {
input>>z>>a;
avec.push_back(a);
zvec.push_back(z);
}
break;
}
case 1:
{
sys = new ReactionSystem();
m_rxn_type = ONESTEP_RXN;
for(int i=0; i<3; i++) {
input>>z>>a;
avec.push_back(a);
zvec.push_back(z);
}
break;
}
case 2:
{
sys = new TwoStepSystem();
m_rxn_type = TWOSTEP;
for(int i=0; i<4; i++) {
input>>z>>a;
avec.push_back(a);
zvec.push_back(z);
}
break;
}
case 3:
{
sys = new ThreeStepSystem();
m_rxn_type = THREESTEP;
for(int i=0; i<5; i++) {
input>>z>>a;
avec.push_back(a);
zvec.push_back(z);
}
break;
}
default:
return false;
}
sys->SetNuclei(zvec, avec);
int nlayers;
double thickness;
getline(input, junk);
getline(input, junk);
input>>junk>>junk;
input>>junk>>nlayers;
for(int i=0; i<nlayers; i++) {
input>>junk>>junk>>thickness;
getline(input, junk);
getline(input, junk);
avec.clear(); zvec.clear(); svec.clear();
while(input>>z) {
if(z == 0) break;
input>>a>>s;
zvec.push_back(z); avec.push_back(a); svec.push_back(s);
}
sys->AddTargetLayer(zvec, avec, svec, thickness);
input>>junk;
}
double par1, par2;
getline(input, junk);
getline(input, junk);
input>>junk>>m_nsamples;
input>>junk>>par1>>junk>>par2;
sys->SetBeamDistro(par1, par2);
input>>junk>>par1>>junk>>par2;
sys->SetTheta1Range(par1, par2);
input>>junk>>par1>>junk>>par2;
sys->SetExcitationDistro(par1, par2);
sys->SetRandomGenerator(global_generator);
std::cout<<"Reaction equation: "<<GetSystemName()<<std::endl;
std::cout<<"Number of samples: "<<GetNumberOfSamples()<<std::endl;
return true;
}
bool Kinematics::SaveConfig(const char* filename) { return true; }
NucData Kinematics::ConvertNucleus(const Nucleus& nuc) {
NucData datum;
datum.E = nuc.GetE();
datum.KE = nuc.GetKE();
datum.p = nuc.GetP();
datum.theta = nuc.GetTheta();
datum.phi = nuc.GetPhi();
datum.Ex = nuc.GetExcitationEnergy();
return datum;
}
void Kinematics::Run() {
std::cout<<"Running simulation..."<<std::endl;
switch(m_rxn_type) {
case ONESTEP_DECAY:
{
RunOneStepDecay();
break;
}
case ONESTEP_RXN:
{
RunOneStepRxn();
break;
}
case TWOSTEP:
{
RunTwoStep();
break;
}
case THREESTEP:
{
RunThreeStep();
break;
}
}
std::cout<<std::endl;
std::cout<<"Complete."<<std::endl;
std::cout<<"---------------------------------------------"<<std::endl;
}
void Kinematics::RunOneStepRxn() {
TFile* output = TFile::Open(m_outfile_name.c_str(), "RECREATE");
TTree* tree;
NucData targ, proj, eject, residual;
if(save_tree_flag) {
tree = new TTree("DataTree","DataTree");
tree->Branch("target", &targ);
tree->Branch("projectile", &proj);
tree->Branch("ejectile", &eject);
tree->Branch("residual", &residual);
}
//For progress tracking
int percent5 = 0.05*m_nsamples;
int count = 0;
int npercent = 0;
for(int i=0; i<m_nsamples; i++) {
if(++count == percent5) {//Show update every 5 percent
npercent++;
count = 0;
std::cout<<"\rPercent complete: "<<npercent*5<<"%"<<std::flush;
}
sys->RunSystem();
if(save_tree_flag) {
targ = ConvertNucleus(sys->GetTarget());
proj = ConvertNucleus(sys->GetProjectile());
eject = ConvertNucleus(sys->GetEjectile());
residual = ConvertNucleus(sys->GetResidual());
tree->Fill();
}
if(do_plotter_flag) {
plotman.FillData(sys->GetTarget());
plotman.FillData(sys->GetProjectile());
plotman.FillData(sys->GetEjectile());
plotman.FillData(sys->GetResidual());
}
}
output->cd();
if(save_tree_flag) tree->Write(tree->GetName(), TObject::kOverwrite);
if(do_plotter_flag) {
plotman.GetTable()->Write();
plotman.ClearTable();
}
output->Close();
}
void Kinematics::RunOneStepDecay() {
TFile* output = TFile::Open(m_outfile_name.c_str(), "RECREATE");
TTree* tree;
NucData targ, eject, residual;
if(save_tree_flag) {
tree = new TTree("DataTree","DataTree");
tree->Branch("target", &targ);
tree->Branch("ejectile", &eject);
tree->Branch("residual", &residual);
}
//For progress tracking
int percent5 = 0.05*m_nsamples;
int count = 0;
int npercent = 0;
for(int i=0; i<m_nsamples; i++) {
if(++count == percent5) {//Show update every 5 percent
npercent++;
count = 0;
std::cout<<"\rPercent complete: "<<npercent*5<<"%"<<std::flush;
}
sys->RunSystem();
if(save_tree_flag) {
targ = ConvertNucleus(sys->GetTarget());
eject = ConvertNucleus(sys->GetEjectile());
residual = ConvertNucleus(sys->GetResidual());
tree->Fill();
}
if(do_plotter_flag) {
plotman.FillData(sys->GetTarget());
plotman.FillData(sys->GetEjectile());
plotman.FillData(sys->GetResidual());
}
}
output->cd();
if(save_tree_flag) tree->Write(tree->GetName(), TObject::kOverwrite);
if(do_plotter_flag) {
plotman.GetTable()->Write();
plotman.ClearTable();
}
output->Close();
}
void Kinematics::RunTwoStep() {
TwoStepSystem* this_sys = dynamic_cast<TwoStepSystem*>(sys);
if(this_sys == nullptr) {
return;
}
TFile* output = TFile::Open(m_outfile_name.c_str(), "RECREATE");
TTree* tree;
NucData targ, proj, eject, residual, break1, break2;
if(save_tree_flag) {
tree = new TTree("DataTree","DataTree");
tree->Branch("target", &targ);
tree->Branch("projectile", &proj);
tree->Branch("ejectile", &eject);
tree->Branch("residual", &residual);
tree->Branch("breakup1", &break1);
tree->Branch("breakup2", &break2);
}
//For progress tracking
int percent5 = 0.05*m_nsamples;
int count = 0;
int npercent = 0;
for(int i=0; i<m_nsamples; i++) {
if(++count == percent5) {//Show update every 5 percent
npercent++;
count = 0;
std::cout<<"\rPercent complete: "<<npercent*5<<"%"<<std::flush;
}
this_sys->RunSystem();
if(save_tree_flag) {
targ = ConvertNucleus(this_sys->GetTarget());
proj = ConvertNucleus(this_sys->GetProjectile());
eject = ConvertNucleus(this_sys->GetEjectile());
residual = ConvertNucleus(this_sys->GetResidual());
break1 = ConvertNucleus(this_sys->GetBreakup1());
break2 = ConvertNucleus(this_sys->GetBreakup2());
tree->Fill();
}
if(do_plotter_flag) {
plotman.FillData(this_sys->GetTarget());
plotman.FillData(this_sys->GetProjectile());
plotman.FillData(this_sys->GetEjectile());
plotman.FillData(this_sys->GetResidual());
plotman.FillData(this_sys->GetBreakup1());
plotman.FillData(this_sys->GetBreakup2());
}
}
output->cd();
if(save_tree_flag) tree->Write(tree->GetName(), TObject::kOverwrite);
if(do_plotter_flag) {
plotman.GetTable()->Write();
plotman.ClearTable();
}
output->Close();
}
void Kinematics::RunThreeStep() {
ThreeStepSystem* this_sys = dynamic_cast<ThreeStepSystem*>(sys);
if(this_sys == nullptr) {
return;
}
TFile* output = TFile::Open(m_outfile_name.c_str(), "RECREATE");
TTree* tree;
NucData targ, proj, eject, residual, break1, break2, break3, break4;
if(save_tree_flag) {
tree = new TTree("DataTree","DataTree");
tree->Branch("target", &targ);
tree->Branch("projectile", &proj);
tree->Branch("ejectile", &eject);
tree->Branch("residual", &residual);
tree->Branch("breakup1", &break1);
tree->Branch("breakup2", &break2);
tree->Branch("breakup3", &break3);
tree->Branch("breakup4", &break4);
}
//For progress updating
int percent5 = 0.05*m_nsamples;
int count = 0;
int npercent = 0;
for(int i=0; i<m_nsamples; i++) {
if(++count == percent5) {//Show update every 5 percent
npercent++;
count = 0;
std::cout<<"\rPercent complete: "<<npercent*5<<"%"<<std::flush;
}
this_sys->RunSystem();
if(save_tree_flag) {
targ = ConvertNucleus(this_sys->GetTarget());
proj = ConvertNucleus(this_sys->GetProjectile());
eject = ConvertNucleus(this_sys->GetEjectile());
residual = ConvertNucleus(this_sys->GetResidual());
break1 = ConvertNucleus(this_sys->GetBreakup1());
break2 = ConvertNucleus(this_sys->GetBreakup2());
break3 = ConvertNucleus(this_sys->GetBreakup3());
break4 = ConvertNucleus(this_sys->GetBreakup4());
tree->Fill();
}
if(do_plotter_flag) {
plotman.FillData(this_sys->GetTarget());
plotman.FillData(this_sys->GetProjectile());
plotman.FillData(this_sys->GetEjectile());
plotman.FillData(this_sys->GetResidual());
plotman.FillData(this_sys->GetBreakup1());
plotman.FillData(this_sys->GetBreakup2());
plotman.FillData(this_sys->GetBreakup3());
plotman.FillData(this_sys->GetBreakup4());
}
}
output->cd();
if(save_tree_flag) tree->Write(tree->GetName(), TObject::kOverwrite);
if(do_plotter_flag) {
plotman.GetTable()->Write();
plotman.ClearTable();
}
output->Close();
}

127
src/LayeredTarget.cpp Normal file
View File

@ -0,0 +1,127 @@
/*
LayeredTarget.h
Functional unit for targets in the SPANCRedux environment. Contains a
set (read: vector) of Targets for use in reaction calculations. In this
way handles situations such as carbon backed targets
Based on code by D.W. Visser written at Yale for the original SPANC
Written by G.W. McCann Aug. 2020
*/
#include "LayeredTarget.h"
LayeredTarget::LayeredTarget() {}
LayeredTarget::~LayeredTarget() {}
/*Add in a Target made of a compound defined by a set of Zs, As, Ss, and a thickness*/
void LayeredTarget::AddLayer(std::vector<int>& Z, std::vector<int>& A, std::vector<int>& stoich, double thickness) {
Target t(thickness);
t.SetElements(Z, A, stoich);
layers.push_back(t);
}
/*
Here projectile refers to the incoming reactant particle (i.e. the beam)
Calculates energy loss assuming that the reaction occurs in the middle of the target
Note that the layer order can matter!
*/
double LayeredTarget::GetProjectileEnergyLoss(int zp, int ap, double startEnergy, int rxnLayer, double angle) {
if(rxnLayer < 0 || rxnLayer > layers.size()) {
std::cerr<<"Reaction layer in eloss calculation is not in range! Returning 0"<<std::endl;
return 0.0;
}
double eloss = 0.0;
double newEnergy = startEnergy;
for(int i=0; i<=rxnLayer; i++) {
if(i == rxnLayer) {
eloss += layers[i].getEnergyLossHalf(zp, ap, newEnergy, angle);
newEnergy = startEnergy - eloss;
} else {
eloss += layers[i].getEnergyLossTotal(zp, ap, newEnergy, angle);
newEnergy = startEnergy-eloss;
}
}
return eloss;
}
/*
Here ejectile refers to the outgoing reactant particle
Calculates energy loss assuming that the reaction occurs in the middle of the target
Note that the layer order can matter!
*/
double LayeredTarget::GetEjectileEnergyLoss(int ze, int ae, double startEnergy, int rxnLayer, double angle) {
if(rxnLayer < 0 || rxnLayer > layers.size()) {
std::cerr<<"Reaction layer in eloss calculation is not in range! Returning 0"<<std::endl;
return 0.0;
}
double eloss = 0.0;
double newEnergy = startEnergy;
for(unsigned int i=rxnLayer; i<layers.size(); i++) {
if(i == rxnLayer) {
eloss += layers[i].getEnergyLossHalf(ze, ae, newEnergy, angle);
newEnergy = startEnergy - eloss;
} else {
eloss += layers[i].getEnergyLossTotal(ze, ae, newEnergy, angle);
newEnergy = startEnergy - eloss;
}
}
return eloss;
}
/*ReverseEnergyLoss version of GetEjectileEnergyLoss*/
double LayeredTarget::GetEjectileReverseEnergyLoss(int ze, int ae, double startEnergy, int rxnLayer, double angle) {
if(rxnLayer < 0 || rxnLayer > layers.size()) {
std::cerr<<"Reaction layer in eloss calculation is not in range! Returning 0"<<std::endl;
return 0.0;
}
double eloss = 0.0;
double newEnergy = startEnergy;
for(int i=(layers.size()-1); i>=rxnLayer; i--) {
if(i == rxnLayer) {
eloss += layers[i].getReverseEnergyLossHalf(ze, ae, newEnergy, angle);
newEnergy = startEnergy + eloss;
} else {
eloss += layers[i].getReverseEnergyLossTotal(ze, ae, newEnergy, angle);
newEnergy = startEnergy + eloss;
}
}
return eloss;
}
/*Getters and Setters*/
int LayeredTarget::GetNumberOfLayers() {
return layers.size();
}
int LayeredTarget::FindLayerContaining(int Z, int A) {
for(unsigned int i=0; i<layers.size(); i++) {
if(layers[i].ContainsElement(Z, A)) return i;
}
return -1;
}
void LayeredTarget::SetName(std::string& n) {
name = n;
}
Target& LayeredTarget::GetLayerInfo(int index) {
return layers[index];
}
std::string& LayeredTarget::GetName() {
return name;
}

76
src/MassLookup.cpp Normal file
View File

@ -0,0 +1,76 @@
/*
MassLookup.h
Generates a map for isotopic masses using AMDC data; subtracts away
electron mass from the atomic mass by default. Creates a static global instance
of this map (MASS) for use throughout code it is included into.
Written by G.W. McCann Aug. 2020
*/
#include "MassLookup.h"
#include "KinematicsExceptions.h"
/*
Read in AMDC mass file, preformated to remove excess info. Here assumes that by default
the file is in a local directory etc/
*/
MassLookup::MassLookup() {
std::ifstream massfile("./etc/mass.txt");
if(massfile.is_open()) {
std::string junk, A, element;
int Z;
double atomicMassBig, atomicMassSmall, isotopicMass;
getline(massfile,junk);
getline(massfile,junk);
while(massfile>>junk) {
massfile>>Z>>A>>element>>atomicMassBig>>atomicMassSmall;
isotopicMass = (atomicMassBig + atomicMassSmall*1e-6 - Z*electron_mass)*u_to_mev;
std::string key = "("+std::to_string(Z)+","+A+")";
massTable[key] = isotopicMass;
elementTable[Z] = element;
}
} else {
throw MassFileException();
}
}
MassLookup::~MassLookup() {}
//Returns nuclear mass in MeV
double MassLookup::FindMass(int Z, int A) {
std::string key = "("+std::to_string(Z)+","+std::to_string(A)+")";
auto data = massTable.find(key);
if(data == massTable.end()) {
throw MassException();
}
return data->second;
/*try {
double mass = massTable.at(key);
return mass;
} catch (std::out_of_range& oor) {
std::cerr<<"Mass of "<<key<<" (Z,A) not found in Mass Table! Returning 1"<<std::endl;
return 1;
}*/
}
//returns element symbol
std::string MassLookup::FindSymbol(int Z, int A) {
auto data = elementTable.find(Z);
if(data == elementTable.end()) {
throw MassException();
}
std::string fullsymbol = std::to_string(A) + data->second;
return fullsymbol;
/*try {
std::string element = elementTable.at(Z);
std::string fullsymbol = std::to_string(A) + element;
return fullsymbol;
} catch (std::out_of_range& oor) {
std::cerr<<"Atomic number: "<<Z<<" not found in Element Table! Returning void."<<std::endl;
std::string element = "void";
return element;
}*/
}

35
src/Nucleus.cpp Normal file
View File

@ -0,0 +1,35 @@
#include "Nucleus.h"
#include "MassLookup.h"
Nucleus::Nucleus () :
G4Vec(), m_z(0), m_a(0), m_gs_mass(0), m_symbol("")
{
}
Nucleus::Nucleus(int Z, int A) :
G4Vec(), m_z(Z), m_a(A)
{
m_gs_mass = MASS.FindMass(Z, A);
m_symbol = MASS.FindSymbol(Z, A);
SetVectorCartesian(0,0,0,m_gs_mass);
}
Nucleus::Nucleus(int Z, int A, double px, double py, double pz, double E) :
G4Vec(px, py, pz, E), m_z(Z), m_a(A)
{
m_gs_mass = MASS.FindMass(Z, A);
m_symbol = MASS.FindSymbol(Z, A);
}
Nucleus::~Nucleus() {}
bool Nucleus::SetIsotope(int Z, int A) {
if(Z>A) return false;
m_z = Z;
m_a = A;
m_gs_mass = MASS.FindMass(Z, A);
m_symbol = MASS.FindSymbol(Z, A);
SetVectorCartesian(0,0,0,m_gs_mass);
return true;
}

81
src/Plotter.cpp Normal file
View File

@ -0,0 +1,81 @@
#include "Plotter.h"
Plotter::Plotter() :
table(new THashTable())
{
}
Plotter::~Plotter() {
for(unsigned int i=0; i<garbage_collection.size(); i++) {
delete garbage_collection[i];
}
garbage_collection.clear();
delete table;
}
void Plotter::FillData(const Nucleus& nuc) {
std::string sym = nuc.GetIsotopicSymbol();
std::string ke_vs_th_name = sym + "_ke_vs_theta";
std::string ke_vs_th_title = ke_vs_th_name + ";#theta_{lab} (degrees);Kinetic Energy (MeV)";
std::string ke_vs_ph_name = sym + "_ke_vs_phi";
std::string ke_vs_ph_title = ke_vs_ph_name + ";#phi_{lab} (degrees);Kinetic Energy (MeV)";
std::string ex_name = sym + "_ex";
std::string ex_title = ex_name + ";E_{ex} (MeV);counts";
MyFill(ke_vs_th_name.c_str(), ke_vs_th_title.c_str(), nuc.GetTheta()*rad2deg, nuc.GetKE(), 2);
MyFill(ke_vs_ph_name.c_str(), ke_vs_ph_title.c_str(), nuc.GetPhi()*rad2deg, nuc.GetKE(), 4);
MyFill(ex_name.c_str(),ex_title.c_str(),260,-1.0,25,nuc.GetExcitationEnergy());
}
void Plotter::MyFill(const char* name, const char* title, int bins, float min, float max, double val) {
TH1F* h = (TH1F*) table->FindObject(name);
if(h) {
h->Fill(val);
} else {
h = new TH1F(name, title, bins, min, max);
h->Fill(val);
table->Add(h);
}
}
void Plotter::MyFill(const char* name, const char* title, int binsx, float minx, float maxx, int binsy, float miny, float maxy, double valx, double valy) {
TH2F* h = (TH2F*) table->FindObject(name);
if(h) {
h->Fill(valx, valy);
} else {
h = new TH2F(name, title, binsx, minx, maxx, binsy, miny, maxy);
h->Fill(valx, valy);
table->Add(h);
}
}
void Plotter::MyFill(const char* name, const char* title, double valx, double valy, int color) {
for(auto& g : graphs) {
if(g.name == name) {
g.xvec.push_back(valx);
g.yvec.push_back(valy);
return;
}
}
GraphData new_g;
new_g.name = name;
new_g.title = title;
new_g.xvec.push_back(valx);
new_g.yvec.push_back(valy);
new_g.color = color;
graphs.push_back(new_g);
}
void Plotter::GenerateGraphs() {
for(auto& g : graphs) {
TGraph* graph = new TGraph(g.xvec.size(), &(g.xvec[0]), &(g.yvec[0]));
graph->SetName(g.name.c_str());
graph->SetTitle(g.title.c_str());
graph->SetMarkerColor(g.color);
table->Add(graph);
garbage_collection.push_back(graph);
}
}

159
src/Reaction.cpp Normal file
View File

@ -0,0 +1,159 @@
#include "Reaction.h"
#include "KinematicsExceptions.h"
Reaction::Reaction() :
target(nullptr), m_bke(0), m_theta(0), m_phi(0), m_ex(0), rxnLayer(0), nuc_initFlag(false), resid_elossFlag(false)
{
}
Reaction::Reaction(int zt, int at, int zp, int ap, int ze, int ae) :
target(nullptr), m_bke(0), m_theta(0), m_phi(0), m_ex(0), rxnLayer(0), resid_elossFlag(false)
{
SetNuclei(zt, at, zp, ap, ze, ae);
}
Reaction::~Reaction()
{
}
bool Reaction::Calculate() {
if(!nuc_initFlag) return false;
if(decayFlag) {
CalculateDecay();
return true;
} else {
CalculateReaction();
return true;
}
}
//Deep copy of nucleus array
void Reaction::SetNuclei(const Nucleus* nucs) {
reactants[0] = nucs[0];
reactants[1] = nucs[1];
reactants[2] = nucs[2];
reactants[3] = nucs[3];
nuc_initFlag = true;
}
void Reaction::SetNuclei(int zt, int at, int zp, int ap, int ze, int ae) {
int zr, ar;
reactants[0] = Nucleus(zt, at);
reactants[2] = Nucleus(ze, ae);
if(ap == 0) {
decayFlag = true;
zr = zt - ze;
ar = at - ae;
} else {
reactants[1] = Nucleus(zp, ap);
decayFlag = false;
zr = zt + zp - ze;
ar = at + ap - ae;
}
if(zr < 0 || ar <= 0) {
nuc_initFlag = false;
} else {
reactants[3] = Nucleus(zr, ar);
nuc_initFlag = true;
}
}
void Reaction::SetBeamKE(double bke) {
if(!nuc_initFlag) return;
else if(decayFlag) return;
m_bke = bke - target->GetProjectileEnergyLoss(reactants[1].GetZ(), reactants[1].GetA(), bke, rxnLayer, 0);
};
void Reaction::CalculateReaction() {
//Target assumed at rest, with 0 excitation energy
reactants[0].SetVectorCartesian(0.,0.,0.,reactants[0].GetGroundStateMass());
double beam_pz = std::sqrt(m_bke*(m_bke + 2.0 * reactants[1].GetGroundStateMass()));
double beam_E = m_bke + reactants[1].GetGroundStateMass();
reactants[1].SetVectorCartesian(0.,0.,beam_pz,beam_E);
double Q = reactants[0].GetGroundStateMass() + reactants[1].GetGroundStateMass() - (reactants[2].GetGroundStateMass() + reactants[3].GetGroundStateMass() + m_ex);
double term1 = sqrt(reactants[1].GetGroundStateMass()*reactants[2].GetGroundStateMass()*m_bke)/(reactants[2].GetGroundStateMass()+reactants[3].GetGroundStateMass())*cos(m_theta);
double term2 = (m_bke*(reactants[3].GetGroundStateMass() - reactants[1].GetGroundStateMass()) + reactants[3].GetGroundStateMass()*Q)/(reactants[3].GetGroundStateMass() + reactants[2].GetGroundStateMass());
double sqrt_pos_ejectKE = term1 + sqrt(term1*term1 + term2);
double sqrt_neg_ejectKE = term1 - sqrt(term1*term1 + term2);
double ejectKE;
if(sqrt_pos_ejectKE > 0) {
ejectKE = sqrt_pos_ejectKE*sqrt_pos_ejectKE;
} else {
ejectKE = sqrt_neg_ejectKE*sqrt_neg_ejectKE;
}
double ejectP = std::sqrt(ejectKE*(ejectKE + 2.0 * reactants[2].GetGroundStateMass()));
double ejectE = ejectKE + reactants[2].GetGroundStateMass();
reactants[2].SetVectorSpherical(m_theta, m_phi, ejectP, ejectE);
reactants[3] = reactants[0] + reactants[1] - reactants[2];
//energy loss for ejectile (after reaction!)
ejectKE -= target->GetEjectileEnergyLoss(reactants[2].GetZ(), reactants[2].GetA(), ejectKE, rxnLayer, m_theta);
ejectP = std::sqrt(ejectKE*(ejectKE + 2.0 * reactants[2].GetGroundStateMass()));
ejectE = ejectKE + reactants[2].GetGroundStateMass();
reactants[2].SetVectorSpherical(m_theta, m_phi, ejectP, ejectE);
//if on, get eloss for residual (after reaction!)
if(resid_elossFlag) {
double residKE = reactants[3].GetKE() - target->GetEjectileEnergyLoss(reactants[3].GetZ(), reactants[3].GetA(), reactants[3].GetKE(), rxnLayer, reactants[3].GetTheta());
double residP = std::sqrt(residKE*(residKE + 2.0*reactants[3].GetInvMass()));
double residE = residKE + reactants[3].GetInvMass();
reactants[3].SetVectorSpherical(reactants[3].GetTheta(), reactants[3].GetPhi(), residP, residE);
}
}
void Reaction::CalculateDecay() {
double Q = reactants[0].GetInvMass() - reactants[2].GetGroundStateMass() - reactants[3].GetGroundStateMass();
if(Q < 0) {
throw QValueException();
}
const double* boost = reactants[0].GetBoost();
double boost2cm[3];
double boost2lab[3];
for(int i=0; i<3; i++) {
boost2lab[i] = boost[i];
boost2cm[i] = boost[i]*(-1.0);
}
reactants[0].ApplyBoost(&(boost2cm[0]));
double ejectE_cm = (reactants[2].GetGroundStateMass()*reactants[2].GetGroundStateMass() - reactants[3].GetGroundStateMass()*reactants[3].GetGroundStateMass() + reactants[0].GetE()*reactants[0].GetE())/
(2.0*reactants[0].GetE());
double ejectP_cm = std::sqrt(ejectE_cm*ejectE_cm - reactants[2].GetGroundStateMass()*reactants[2].GetGroundStateMass());
reactants[2].SetVectorSpherical(m_theta, m_phi, ejectP_cm, ejectE_cm);
reactants[0].ApplyBoost(boost2lab);
reactants[2].ApplyBoost(boost2lab);
reactants[3] = reactants[0] - reactants[2];
//energy loss for the *light* break up nucleus
double ejectKE = reactants[2].GetKE() - target->GetEjectileEnergyLoss(reactants[2].GetZ(), reactants[2].GetA(), reactants[2].GetKE(), rxnLayer, reactants[2].GetTheta());
double ejectP = std::sqrt(ejectKE*(ejectKE + 2.0*reactants[2].GetGroundStateMass()));
double ejectE = ejectKE + reactants[2].GetGroundStateMass();
reactants[2].SetVectorSpherical(reactants[2].GetTheta(), reactants[2].GetPhi(), ejectP, ejectE);
//if on, get eloss for *heavy* break up nucleus
if(resid_elossFlag) {
double residKE = reactants[3].GetKE() - target->GetEjectileEnergyLoss(reactants[3].GetZ(), reactants[3].GetA(), reactants[3].GetKE(), rxnLayer, reactants[3].GetTheta());
double residP = std::sqrt(residKE*(residKE + 2.0*reactants[3].GetInvMass()));
double residE = residKE + reactants[3].GetInvMass();
reactants[3].SetVectorSpherical(reactants[3].GetTheta(), reactants[3].GetPhi(), residP, residE);
}
}

88
src/ReactionSystem.cpp Normal file
View File

@ -0,0 +1,88 @@
#include "ReactionSystem.h"
#include "KinematicsExceptions.h"
#include <iostream>
ReactionSystem::ReactionSystem() :
m_beamDist(0,0), m_theta1Range(0,0), m_exDist(0,0), generator(nullptr), target_set_flag(false), gen_set_flag(false), rxnLayer(0), m_sys_equation("")
{
}
ReactionSystem::ReactionSystem(std::vector<int>& z, std::vector<int>& a) :
m_beamDist(0,0), m_theta1Range(0,0), m_exDist(0,0), generator(nullptr), target_set_flag(false), gen_set_flag(false), rxnLayer(0), m_sys_equation("")
{
SetNuclei(z, a);
}
ReactionSystem::~ReactionSystem() {
}
bool ReactionSystem::SetNuclei(std::vector<int>&z, std::vector<int>& a) {
if(z.size() != a.size() || z.size() < 3) {
return false;
}
step1.SetNuclei(z[0], a[0], z[1], a[1], z[2], a[2]);
SetSystemEquation();
return true;
}
void ReactionSystem::AddTargetLayer(std::vector<int>& zt, std::vector<int>& at, std::vector<int>& stoich, double thickness) {
target.AddLayer(zt, at, stoich, thickness);
}
void ReactionSystem::LinkTarget() {
step1.SetLayeredTarget(&target);
rxnLayer = target.FindLayerContaining(step1.GetTarget().GetZ(), step1.GetTarget().GetA());
if(rxnLayer != -1) {
step1.SetRxnLayer(rxnLayer);
target_set_flag = true;
} else {
throw ReactionLayerException();
}
}
void ReactionSystem::SetSystemEquation() {
m_sys_equation = step1.GetTarget().GetIsotopicSymbol();
m_sys_equation += "(";
m_sys_equation += step1.GetProjectile().GetIsotopicSymbol();
m_sys_equation += ", ";
m_sys_equation += step1.GetEjectile().GetIsotopicSymbol();
m_sys_equation += ")";
m_sys_equation += step1.GetResidual().GetIsotopicSymbol();
}
void ReactionSystem::RunSystem() {
if(!gen_set_flag) return;
//Link up the target if it hasn't been done yet
if(!target_set_flag) {
LinkTarget();
}
if(step1.IsDecay()) {
double rxnTheta = acos(generator->Uniform(-1, 1));
double rxnPhi = generator->Uniform(0, 2.0*M_PI);
step1.SetPolarRxnAngle(rxnTheta);
step1.SetAzimRxnAngle(rxnPhi);
step1.TurnOnResidualEloss();
step1.Calculate();
} else {
//Sample parameters
double bke = generator->Gaus(m_beamDist.first, m_beamDist.second);
double rxnTheta = acos(generator->Uniform(cos(m_theta1Range.first), cos(m_theta1Range.second)));
double rxnPhi = 0;
double residEx = generator->Gaus(m_exDist.first, m_exDist.second);
step1.SetBeamKE(bke);
step1.SetPolarRxnAngle(rxnTheta);
step1.SetAzimRxnAngle(rxnPhi);
step1.SetExcitation(residEx);
step1.TurnOnResidualEloss();
step1.Calculate();
}
}

653
src/SabreDetector.cpp Normal file
View File

@ -0,0 +1,653 @@
#include "SabreDetector.h"
#include <cmath>
#include <iostream>
using namespace std;
/*
Distances in meters, angles in radians.
The channel arrays have four points, one for each corner. The corners are
as follows, as if looking BACK along beam (i.e. from the target's pov):
0---------------------1
| |
| | y
| | ^
| | |
| | |
3---------------------2 -----> x
(z is hence positive along beam direction)
The channel numbers, also as looking back from target pov, are:
>> rings are 0 -- 15 from inner to outer:
15 -------------------
14 -------------------
13 -------------------
.
.
.
2 -------------------
1 -------------------
0 -------------------
>> wedges are 0 -- 7 moving counterclockwise:
7 6 ... 1 0
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
***note that these are for ARRAY storage, and may not necessarily
correspond to the PHYSICAL channels; this will need to be taken
into account if used in actual data analysis
-- kgh, March 2020
*/
SabreDetGeometry::SabreDetGeometry(double iRinner_flat,
double iRouter_flat,
double ideltaPhi_flat,
double ibeamPhi_central,
double itiltFromVertical,
double idistFromTarget,
double xoffset,
double yoffset) :
NUMRINGS(16), NUMWEDGES(8) {
rbc = 0; //ring bottom channel
rtc = NUMRINGS-1; //ring top channel
wrc = 0; //wedge right channel
wlc = NUMWEDGES-1; //wedge left channel
Rinner_flat = iRinner_flat;
Router_flat = iRouter_flat;
deltaR_flat = iRouter_flat - iRinner_flat;
deltaR_flat_ring = deltaR_flat/NUMRINGS;
deltaPhi_flat = ideltaPhi_flat;
deltaPhi_flat_wedge = deltaPhi_flat/NUMWEDGES;
beamPhi_central = ibeamPhi_central;
tiltFromVertical = itiltFromVertical;
//this distance from target is from the CENTRAL point of
//the detector, i.e. the center of the "circle" which the
//detector forms. NOTE: these are all assumed to be negative!
ZdistFromTarget = idistFromTarget;
XdistFromTarget = xoffset;
YdistFromTarget = yoffset;
random = new TRandom3();
random->SetSeed();
ringch_flat_cart = new CartCoords*[NUMRINGS];
wedgech_flat_cart = new CartCoords*[NUMWEDGES];
ringch_tilted_cart = new CartCoords*[NUMRINGS];
wedgech_tilted_cart = new CartCoords*[NUMWEDGES];
for (int i=0; i<NUMRINGS; i++) {
ringch_flat_cart[i] = new CartCoords[4];
ringch_tilted_cart[i] = new CartCoords[4];
}
for (int i=0; i<NUMWEDGES; i++) {
wedgech_flat_cart[i] = new CartCoords[4];
wedgech_tilted_cart[i] = new CartCoords[4];
}
//Define rotation matricies
XRotMatrix = new double*[3];
ZRotMatrix = new double*[3];
XRotMatrixInv = new double*[3];
ZRotMatrixInv = new double*[3];
for (int i=0; i<3; i++) {
XRotMatrix[i] = new double[3];
ZRotMatrix[i] = new double[3];
XRotMatrixInv[i] = new double[3];
ZRotMatrixInv[i] = new double[3];
}
XRotMatrix[0][0] = 1;
XRotMatrix[0][1] = 0; XRotMatrix[0][2] = 0; XRotMatrix[1][0] = 0; XRotMatrix[2][0] = 0;
XRotMatrix[1][1] = cos(tiltFromVertical); XRotMatrix[1][2] = -sin(tiltFromVertical);
XRotMatrix[2][1] = sin(tiltFromVertical); XRotMatrix[2][2] = cos(tiltFromVertical);
ZRotMatrix[0][0] = cos(beamPhi_central); ZRotMatrix[0][1] = -sin(beamPhi_central);
ZRotMatrix[1][0] = sin(beamPhi_central); ZRotMatrix[1][1] = cos(beamPhi_central);
ZRotMatrix[2][2] = 1;
ZRotMatrix[2][0] = 0; ZRotMatrix[2][1] = 0; ZRotMatrix[0][2] = 0; ZRotMatrix[1][2] = 0;
//Inverse of a rotation is its transpose
XRotMatrixInv[0][0] = XRotMatrix[0][0]; XRotMatrixInv[0][1] = XRotMatrix[1][0]; XRotMatrixInv[0][2] = XRotMatrix[2][0];
XRotMatrixInv[1][0] = XRotMatrix[0][1]; XRotMatrixInv[1][1] = XRotMatrix[1][1]; XRotMatrixInv[1][2] = XRotMatrix[2][1];
XRotMatrixInv[2][0] = XRotMatrix[0][2]; XRotMatrixInv[2][1] = XRotMatrix[1][2]; XRotMatrixInv[2][2] = XRotMatrix[2][2];
ZRotMatrixInv[0][0] = ZRotMatrix[0][0]; ZRotMatrixInv[0][1] = ZRotMatrix[1][0]; ZRotMatrixInv[0][2] = ZRotMatrix[2][0];
ZRotMatrixInv[1][0] = ZRotMatrix[0][1]; ZRotMatrixInv[1][1] = ZRotMatrix[1][1]; ZRotMatrixInv[1][2] = ZRotMatrix[2][1];
ZRotMatrixInv[2][0] = ZRotMatrix[0][2]; ZRotMatrixInv[2][1] = ZRotMatrix[1][2]; ZRotMatrixInv[2][2] = ZRotMatrix[2][2];
//
/* SETTING FLAT GEOMETRY */
//RINGS:
for (int rch=0; rch<NUMRINGS; rch++) {
//top left:
ringch_flat_cart[rch][0].x = (Rinner_flat + (rch+1)*deltaR_flat_ring)*sin(deltaPhi_flat/2); //x
ringch_flat_cart[rch][0].y = (Rinner_flat + (rch+1)*deltaR_flat_ring)*cos(deltaPhi_flat/2); //y
ringch_flat_cart[rch][0].z = 0; //z
//top right:
ringch_flat_cart[rch][1].x = (Rinner_flat + (rch+1)*deltaR_flat_ring)*sin(-deltaPhi_flat/2); //x
ringch_flat_cart[rch][1].y = (Rinner_flat + (rch+1)*deltaR_flat_ring)*cos(-deltaPhi_flat/2); //y
ringch_flat_cart[rch][1].z = 0; //z
//bottom right:
ringch_flat_cart[rch][2].x = (Rinner_flat + rch*deltaR_flat_ring)*sin(-deltaPhi_flat/2); //x
ringch_flat_cart[rch][2].y = (Rinner_flat + rch*deltaR_flat_ring)*cos(-deltaPhi_flat/2); //y
ringch_flat_cart[rch][2].z = 0; //z
//bottom left:
ringch_flat_cart[rch][3].x = (Rinner_flat + rch*deltaR_flat_ring)*sin(deltaPhi_flat/2); //x
ringch_flat_cart[rch][3].y = (Rinner_flat + rch*deltaR_flat_ring)*cos(deltaPhi_flat/2); //y
ringch_flat_cart[rch][3].z = 0; //z
}
//WEDGES:
for (int wch=0; wch<NUMWEDGES; wch++) {
//top left:
wedgech_flat_cart[wch][0].x = Router_flat*sin(-deltaPhi_flat/2 + (wch+1)*deltaPhi_flat_wedge); //x
wedgech_flat_cart[wch][0].y = Router_flat*cos(-deltaPhi_flat/2 + (wch+1)*deltaPhi_flat_wedge); //y
wedgech_flat_cart[wch][0].z = 0; //z
//top right:
wedgech_flat_cart[wch][1].x = Router_flat*sin(-deltaPhi_flat/2 + wch*deltaPhi_flat_wedge); //x
wedgech_flat_cart[wch][1].y = Router_flat*cos(-deltaPhi_flat/2 + wch*deltaPhi_flat_wedge); //y
wedgech_flat_cart[wch][1].z = 0; //z
//bottom right:
wedgech_flat_cart[wch][2].x = Rinner_flat*sin(-deltaPhi_flat/2 + wch*deltaPhi_flat_wedge); //x
wedgech_flat_cart[wch][2].y = Rinner_flat*cos(-deltaPhi_flat/2 + wch*deltaPhi_flat_wedge); //y
wedgech_flat_cart[wch][2].z = 0; //z
//bottom left:
wedgech_flat_cart[wch][3].x = Rinner_flat*sin(-deltaPhi_flat/2 + (wch+1)*deltaPhi_flat_wedge); //x
wedgech_flat_cart[wch][3].y = Rinner_flat*cos(-deltaPhi_flat/2 + (wch+1)*deltaPhi_flat_wedge); //y
wedgech_flat_cart[wch][3].z = 0; //z
}
//now tilting, rotating, and translating
//RINGS:
for (int rch=0; rch<NUMRINGS; rch++) {
for (int c=0; c<4; c++) {
ringch_tilted_cart[rch][c] = TransformVector(ringch_flat_cart[rch][c]);
}
}
//WEDGES:
for (int wch=0; wch<NUMWEDGES; wch++) {
for (int c=0; c<4; c++) {
wedgech_tilted_cart[wch][c] = TransformVector(wedgech_flat_cart[wch][c]);
}
}
}
SabreDetGeometry::~SabreDetGeometry() {
for (int i=0; i<NUMRINGS; i++) {
delete [] ringch_flat_cart[i];
delete [] ringch_tilted_cart[i];
}
delete [] ringch_flat_cart;
delete [] ringch_tilted_cart;
for (int i=0; i<NUMWEDGES; i++) {
delete [] wedgech_flat_cart[i];
delete [] wedgech_tilted_cart[i];
}
delete [] wedgech_flat_cart;
delete [] wedgech_tilted_cart;
for(int i=0; i<3; i++) {
delete [] XRotMatrix[i];
delete [] ZRotMatrix[i];
delete [] XRotMatrixInv[i];
delete [] ZRotMatrixInv[i];
}
delete [] XRotMatrix;
delete [] ZRotMatrix;
delete random;
}
double SabreDetGeometry::Get_Ring_Flat_X(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(0,0,ch,corner,0) : 0.;
}
double SabreDetGeometry::Get_Ring_Flat_Y(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(0,0,ch,corner,1) : 0.;
}
double SabreDetGeometry::Get_Ring_Flat_Z(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(0,0,ch,corner,2) : 0.;
}
double SabreDetGeometry::Get_Ring_Flat_R(int ch, int corner) {
return CheckBothRing(ch,corner) ?
sqrt(pow(Get_Cart(0,0,ch,corner,0),2) +
pow(Get_Cart(0,0,ch,corner,1),2) +
pow(Get_Cart(0,0,ch,corner,2),2))
: 0.;
}
double SabreDetGeometry::Get_Ring_Flat_Theta(int ch, int corner) {
return CheckBothRing(ch,corner) ?
acos(Get_Ring_Flat_Z(ch,corner)/Get_Ring_Flat_R(ch,corner))
: 0.;
}
//GWM: Note this now returns in normal phi from x-axis format
double SabreDetGeometry::Get_Ring_Flat_Phi(int ch, int corner) {
if (!(CheckBothRing(ch,corner))) return 0.;
double x = Get_Ring_Flat_X(ch,corner);
double y = Get_Ring_Flat_Y(ch,corner);
double phi = std::atan2(y,x);
if (phi<0) phi += M_PI*2.0;
return phi;
}
double SabreDetGeometry::Get_Wedge_Flat_X(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(0,1,ch,corner,0) : 0.;
}
double SabreDetGeometry::Get_Wedge_Flat_Y(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(0,1,ch,corner,1) : 0.;
}
double SabreDetGeometry::Get_Wedge_Flat_Z(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(0,1,ch,corner,2) : 0.;
}
double SabreDetGeometry::Get_Wedge_Flat_R(int ch, int corner) {
return CheckBothWedge(ch,corner) ?
sqrt(pow(Get_Cart(0,1,ch,corner,0),2) +
pow(Get_Cart(0,1,ch,corner,1),2) +
pow(Get_Cart(0,1,ch,corner,2),2))
: 0.;
}
double SabreDetGeometry::Get_Wedge_Flat_Theta(int ch, int corner) {
return CheckBothWedge(ch,corner) ?
acos(Get_Wedge_Flat_Z(ch,corner)/Get_Wedge_Flat_R(ch,corner))
: 0.;
}
//GWM: Note this now returns in normal phi from x-axis format
double SabreDetGeometry::Get_Wedge_Flat_Phi(int ch, int corner) {
if (!(CheckBothWedge(ch,corner))) return false;
double x = Get_Wedge_Flat_X(ch,corner);
double y = Get_Wedge_Flat_Y(ch,corner);
double phi = std::atan2(y,x);
if(phi<0) phi += M_PI*2.0;
return phi;
}
double SabreDetGeometry::Get_Ring_Tilted_X(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(1,0,ch,corner,0) : 0.;
}
double SabreDetGeometry::Get_Ring_Tilted_Y(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(1,0,ch,corner,1) : 0.;
}
double SabreDetGeometry::Get_Ring_Tilted_Z(int ch, int corner) {
return CheckBothRing(ch,corner) ? Get_Cart(1,0,ch,corner,2) : 0.;
}
double SabreDetGeometry::Get_Ring_Tilted_R(int ch, int corner) {
return CheckBothRing(ch,corner) ?
sqrt(pow(Get_Cart(1,0,ch,corner,0),2) +
pow(Get_Cart(1,0,ch,corner,1),2) +
pow(Get_Cart(1,0,ch,corner,2),2))
: 0.;
}
double SabreDetGeometry::Get_Ring_Tilted_Theta(int ch, int corner) {
return CheckBothRing(ch,corner) ?
acos(Get_Ring_Tilted_Z(ch,corner)/Get_Ring_Tilted_R(ch,corner))
: 0.;
}
//GWM: Note this now returns in normal phi from x-axis format
double SabreDetGeometry::Get_Ring_Tilted_Phi(int ch, int corner) {
if (!(CheckBothRing(ch,corner))) return false;
double x = Get_Ring_Tilted_X(ch,corner);
double y = Get_Ring_Tilted_Y(ch,corner);
double phi = std::atan2(y,x);
if(phi<0) phi += M_PI*2.0;
return phi;
}
double SabreDetGeometry::Get_Wedge_Tilted_X(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(1,1,ch,corner,0) : 0.;
}
double SabreDetGeometry::Get_Wedge_Tilted_Y(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(1,1,ch,corner,1) : 0.;
}
double SabreDetGeometry::Get_Wedge_Tilted_Z(int ch, int corner) {
return CheckBothWedge(ch,corner) ? Get_Cart(1,1,ch,corner,2) : 0.;
}
double SabreDetGeometry::Get_Wedge_Tilted_R(int ch, int corner) {
return CheckBothWedge(ch,corner) ?
sqrt(pow(Get_Cart(1,1,ch,corner,0),2) +
pow(Get_Cart(1,1,ch,corner,1),2) +
pow(Get_Cart(1,1,ch,corner,2),2))
: 0.;
}
double SabreDetGeometry::Get_Wedge_Tilted_Theta(int ch, int corner) {
return CheckBothWedge(ch,corner) ?
acos(Get_Wedge_Tilted_Z(ch,corner)/Get_Wedge_Tilted_R(ch,corner))
: 0.;
}
//GWM: Note this now returns in normal phi from x-axis format
double SabreDetGeometry::Get_Wedge_Tilted_Phi(int ch, int corner) {
if (!(CheckBothWedge(ch,corner))) return false;
double x = Get_Wedge_Tilted_X(ch,corner);
double y = Get_Wedge_Tilted_Y(ch,corner);
double phi = std::atan2(y, x);
if(phi<0) phi += 2.0*M_PI;
return phi;
}
int SabreDetGeometry::NumRings() {return NUMRINGS;}
int SabreDetGeometry::NumWedges() {return NUMWEDGES;}
double SabreDetGeometry::Get_Cart(int fot, int row, int ch, int corner, int cart) {
//fot = flat (0) or tilted (1)
//row = ring (0) or wedge (1)
int marker = 10*fot + row;
switch (marker) {
case (00): return ringch_flat_cart[ch][corner][cart];
case (01): return wedgech_flat_cart[ch][corner][cart];
case (10): return ringch_tilted_cart[ch][corner][cart];
case (11): return wedgech_tilted_cart[ch][corner][cart];
default: return 0;
}
}
bool SabreDetGeometry::CheckRingChannel(int ich) {
return ((ich >= 0 && ich < NUMRINGS) ? true : false);
}
bool SabreDetGeometry::CheckWedgeChannel(int ich) {
return ((ich >= 0 && ich < NUMWEDGES) ? true: false);
}
bool SabreDetGeometry::CheckCorner(int icn) {
return ((icn >= 0 && icn < 4) ? true : false);
}
bool SabreDetGeometry::CheckBothRing(int ich, int icn) {
return (CheckRingChannel(ich)&&CheckCorner(icn));
}
bool SabreDetGeometry::CheckBothWedge(int ich, int icn) {
return (CheckWedgeChannel(ich)&&CheckCorner(icn));
}
/*Method by which the coordinates of a hit in a wedge/ring pixel are calculated.
*Currently, takes the center of the pixel as the value of a pixel hit, could be altered
*to take a uniformly sampled random point with in the pixel
*/
CartCoords SabreDetGeometry::GetCoordinates(int ringch, int wedgech) {
if(!CheckRingChannel(ringch) || !CheckWedgeChannel(wedgech)) {
CartCoords temp;
temp.x = 0;
temp.y = 0;
temp.z = 0;
return temp;
}
//define pixel by its center (half way between top and bottom radius, halfway between left and right phi)
//EDIT GWM: July 2020 change to randomize the location within the sabre pixel
double rcenter = Rinner_flat + deltaR_flat_ring*(ringch + random->Uniform(0.0, 1.0));
double phi_center = deltaPhi_flat/2.0-(wedgech + random->Uniform(0.0, 1.0))*deltaPhi_flat_wedge;
CartCoords PixelCenter;
PixelCenter.x = rcenter*sin(phi_center);
PixelCenter.y = rcenter*cos(phi_center);
PixelCenter.z = 0;
//return coords in final orientation
return TransformVector(PixelCenter);
}
CartCoords SabreDetGeometry::TransformVector(CartCoords vector) {
CartCoords xrot_vector, xzrot_vector, xzrot_t_vector;
std::cout<<"Starting coords -- x: "<<vector.x<<" y: "<<vector.y<<" z: "<<vector.z<<" r: "<<vector.GetR()<<std::endl;
//rotation about x-axis
xrot_vector.x = vector.x;
xrot_vector.y = XRotMatrix[1][1]*vector.y+XRotMatrix[1][2]*vector.z;
xrot_vector.z = XRotMatrix[2][1]*vector.y+XRotMatrix[2][2]*vector.z;
std::cout<<"after x-rotation -- x: "<<xrot_vector.x<<" y: "<<xrot_vector.y<<" z: "<<xrot_vector.z<<" r: "<<vector.GetR()<<std::endl;
//rotation about z-axis
xzrot_vector.x = ZRotMatrix[0][0]*xrot_vector.x+ZRotMatrix[0][1]*xrot_vector.y;
xzrot_vector.y = ZRotMatrix[1][0]*xrot_vector.x+ZRotMatrix[1][1]*xrot_vector.y;
xzrot_vector.z = ZRotMatrix[2][2]*xrot_vector.z;
std::cout<<"after z-rotation -- x: "<<xzrot_vector.x<<" y: "<<xzrot_vector.y<<" z: "<<xzrot_vector.z<<" r: "<<vector.GetR()<<std::endl;
//translate as needed
xzrot_t_vector.x = xzrot_vector.x-XdistFromTarget;
xzrot_t_vector.y = xzrot_vector.y-YdistFromTarget;
xzrot_t_vector.z = xzrot_vector.z-ZdistFromTarget;
std::cout<<"after z-translation -- x: "<<xzrot_t_vector.x<<" y: "<<xzrot_t_vector.y<<" z: "<<xzrot_t_vector.z<<std::endl;
return xzrot_t_vector;
}
CartCoords SabreDetGeometry::InverseTransformVector(CartCoords vector) {
CartCoords it_vector, izrot_vector, ixzrot_vector;
//Inverse of translation
/*it_vector.x = vector.x + XdistFromTarget;
it_vector.y = vector.y + YdistFromTarget;
it_vector.z = vector.z + ZdistFromTarget;*/
//Inverse of rotation about z-axis
izrot_vector.x = vector.x*ZRotMatrixInv[0][0] + vector.y*ZRotMatrixInv[0][1] + vector.z*ZRotMatrixInv[0][2];
izrot_vector.y = vector.x*ZRotMatrixInv[1][0] + vector.y*ZRotMatrixInv[1][1] + vector.z*ZRotMatrixInv[1][2];
izrot_vector.z = vector.x*ZRotMatrixInv[2][0] + vector.y*ZRotMatrixInv[2][1] + vector.z*ZRotMatrixInv[2][2];
//Inverse of rotation about x-axis
ixzrot_vector.x = izrot_vector.x*XRotMatrixInv[0][0] + izrot_vector.y*XRotMatrixInv[0][1] + izrot_vector.z*XRotMatrixInv[0][2];
ixzrot_vector.y = izrot_vector.x*XRotMatrixInv[1][0] + izrot_vector.y*XRotMatrixInv[1][1] + izrot_vector.z*XRotMatrixInv[1][2];
ixzrot_vector.z = izrot_vector.x*XRotMatrixInv[2][0] + izrot_vector.y*XRotMatrixInv[2][1] + izrot_vector.z*XRotMatrixInv[2][2];
return ixzrot_vector;
}
void SabreDetGeometry::Recenter(double x, double y) {
XdistFromTarget = x;
YdistFromTarget = y;
}
double SabreDetGeometry::GetScatteringAngle(int ringch, int wedgech) {
if(!CheckRingChannel(ringch) || !CheckWedgeChannel(wedgech)) return 0;
CartCoords these_coords = GetCoordinates(ringch, wedgech);
double r = sqrt(pow(these_coords.x, 2.) + pow(these_coords.y, 2.) + pow(these_coords.z, 2.));
return acos(these_coords.z/r);
}
/*
*/
bool SabreDetGeometry::IsInside(double theta, double phi) {
//Make unit vector
CartCoords unit, origin;
origin.x = 0; origin.y = 0; origin.z = ZdistFromTarget;
origin = InverseTransformVector(origin);
unit.x = sin(theta)*cos(phi); unit.y = sin(theta)*sin(phi); unit.z = cos(theta);
unit = InverseTransformVector(unit);
double s = origin.y/unit.y;
double px = origin.x + s*unit.x;
double py = origin.z + s*unit.z;
double radius = std::sqrt(px*px + py*py);
std::cout<<"radius: "<<radius<<std::endl;
double phi_in_detector = unit.GetPhi();
double theta_in_detector = unit.GetTheta();
double xy_radius = std::sqrt(unit.x*unit.x + unit.y*unit.y);
double xz_radius = std::sqrt(unit.x*unit.x + unit.z*unit.z);
double val = std::atan2(py, px);
if(val < 0 ) val += M_PI*2.0;
std::cout<<"val: "<<val*180.0/M_PI<<std::endl;
std::cout<<"phi in det: "<<phi_in_detector*180.0/M_PI<<std::endl;
std::cout<<"theta in det: "<<theta_in_detector*180.0/M_PI<<std::endl;
std::cout<<"xy radius: "<<xy_radius<<std::endl;
std::cout<<"xz radius: "<<xz_radius<<std::endl;
std::cout<<"unit -- x: "<<unit.x<<" y: "<<unit.y<<" z: "<<unit.z<<std::endl;
std::cout<<" phi range tilt -- min: "<<Get_Wedge_Tilted_Phi(0,1)*180.0/M_PI<<" max: "<<Get_Wedge_Tilted_Phi(7,0)*180.0/M_PI<<std::endl;
std::cout<<" phi range flat -- min: "<<Get_Wedge_Flat_Phi(0,1)*180.0/M_PI<<" max: "<<Get_Wedge_Flat_Phi(7,0)*180.0/M_PI<<std::endl;
std::cout<<" wedge 0 1 theta -- "<<Get_Wedge_Tilted_Theta(0,1)*180.0/M_PI<<std::endl;
std::cout<<" ring 0 0 x: "<<Get_Ring_Flat_X(0,0)<<std::endl;
std::cout<<" ring 0 1 x: "<<Get_Ring_Flat_X(0,1)<<std::endl;
std::cout<<" ring 0 0 y: "<<Get_Ring_Flat_Y(0,0)<<std::endl;
std::cout<<" ring 0 1 y: "<<Get_Ring_Flat_Y(0,1)<<std::endl;
std::cout<<" t ring 0 0 x: "<<Get_Ring_Tilted_X(0,0)<<std::endl;
std::cout<<" t ring 0 1 x: "<<Get_Ring_Tilted_X(0,1)<<std::endl;
std::cout<<" t ring 0 0 y: "<<Get_Ring_Tilted_Y(0,0)<<std::endl;
std::cout<<" t ring 0 1 y: "<<Get_Ring_Tilted_Y(0,1)<<std::endl;
std::cout<<"Test inversion"<<std::endl;
CartCoords test = InverseTransformVector(wedgech_tilted_cart[0][1]);
std::cout<<"Inverted x: "<<test.x<<" y: "<<test.y<<" z: "<<test.z<<std::endl;
std::cout<<"Given x: "<<wedgech_flat_cart[0][1].x<<" y: "<<wedgech_flat_cart[0][1].y<<" z: "<<wedgech_flat_cart[0][1].z<<std::endl;
//Check phi condition
//double phi_in_detector = phi - beamPhi_central;
double phi_min = Get_Wedge_Tilted_Phi(0,1);
double phi_max = Get_Wedge_Tilted_Phi(7,0);
bool passed;
if(phi > phi_min && phi < phi_max) {
passed = true;
} else {
return false;
}
std::cout<<" passed phi "<<std::endl;
if(xy_radius>Router_flat || xy_radius<Rinner_flat) passed = false;
return passed;
}
CartCoords SabreDetGeometry::GetTrajectoryCoordinates(double theta, double phi) {
CartCoords temp;
temp.x = 0; temp.y = 0; temp.z = 0;
int ringchan = -1, wedgechan = -1;
double phi_in_detector = phi - beamPhi_central;
double phi_min, phi_max;
for(int i=0; i<NUMWEDGES; i++) {
phi_min = wedgech_flat_cart[i][0].GetPhi();
phi_max = wedgech_flat_cart[i][1].GetPhi();
if(phi_in_detector > phi_min && phi_in_detector < phi_max) {
wedgechan = i;
break;
}
}
if(wedgechan == -1) return temp;
CartCoords innerPosition_flat, innerPosition_tilt;
CartCoords outerPosition_flat, outerPosition_tilt;
double r_inner, r_outer;
double theta_min, theta_max;
//Since we passed phi, use the phi coordinate to calculate the point at the "top" and
//bottom of the detector at the given phi, then transform to the lampshade frame.
for(int i=0; i<NUMRINGS; i++) {
r_inner = Rinner_flat + deltaR_flat_ring*(i);
r_outer = Rinner_flat + deltaR_flat_ring*(i+1);
innerPosition_flat.x = r_inner*sin(phi_in_detector);
innerPosition_flat.y = r_inner*cos(phi_in_detector);
innerPosition_flat.z = 0;
innerPosition_tilt = TransformVector(innerPosition_flat);
outerPosition_flat.x = r_outer*sin(phi_in_detector);
outerPosition_flat.y = r_outer*cos(phi_in_detector);
outerPosition_flat.z = 0;
outerPosition_tilt = TransformVector(outerPosition_flat);
//Get the theta values
theta_max = innerPosition_tilt.GetTheta();
theta_min = outerPosition_tilt.GetTheta();
if(theta<=theta_max && theta>=theta_min) {
ringchan = i;
break;
}
}
if(ringchan == -1) return temp;
return GetCoordinates(ringchan, wedgechan);
}
//Coordinate functions
double CartCoords::GetTheta() {
double r = std::sqrt(std::pow(x, 2.) + std::pow(y, 2.) + std::pow(z, 2.));
return std::acos(z/r);
}
double CartCoords::GetR() {
return std::sqrt(std::pow(x, 2.) + std::pow(y, 2.) + std::pow(z, 2.));
}
double CartCoords::GetPhi() {
/*double r = std::sqrt(std::pow(x, 2.) + std::pow(y, 2.));
if((x >= 0 && y >= 0) || (x <= 0 && y >= 0)) return std::acos(x/r);
else if((x <= 0 && y <= 0) || (x >= 0 && y <= 0)) return (2.0*M_PI - std::acos(x/r));
else return 0.0;*/
double phi = std::atan2(y, x);
if(phi<0) phi += M_PI*2.0;
return phi;
}
double CartCoords::GetDetectorPhi() {
/*double r = std::sqrt(std::pow(x, 2.) + std::pow(y, 2.));
if((x >= 0 && y >= 0) || (x <= 0 && y >= 0)) return std::acos(x/r);
else if((x <= 0 && y <= 0) || (x >= 0 && y <= 0)) return (2.0*M_PI - std::acos(x/r));
else return 0.0;*/
double phi = std::atan2(x, y);
if(phi<0) phi += M_PI*2.0;
return phi;
}

262
src/SabreEfficiency.cpp Normal file
View File

@ -0,0 +1,262 @@
#include "SabreEfficiency.h"
#include "Kinematics.h"
#include <iostream>
#include <TFile.h>
#include <TTree.h>
#include <TParameter.h>
#include <TGraph.h>
#include <TGraph2D.h>
#include <TCanvas.h>
SabreEfficiency::SabreEfficiency() :
m_rxn_type(-1)
{
detectors.reserve(5);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI0*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI1*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI2*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI3*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI4*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
}
SabreEfficiency::~SabreEfficiency() {}
void SabreEfficiency::CalculateEfficiency(const char* file) {
std::cout<<"----------SABRE Efficiency Calculation----------"<<std::endl;
std::cout<<"Loading in output from kinematics simulation: "<<file<<std::endl;
std::cout<<"Running efficiency calculation..."<<std::endl;
switch(m_rxn_type) {
case Kinematics::ONESTEP_DECAY:
{
RunDecay(file);
break;
}
case Kinematics::TWOSTEP:
{
Run2Step(file);
break;
}
case Kinematics::THREESTEP:
{
Run3Step(file);
break;
}
}
std::cout<<std::endl;
std::cout<<"Complete."<<std::endl;
std::cout<<"---------------------------------------------"<<std::endl;
}
void SabreEfficiency::RunDecay(const char* file) {
TFile* input = TFile::Open(file, "UPDATE");
TTree* tree = (TTree*) input->Get("DataTree");
NucData* eject = new NucData();
NucData* resid = new NucData();
tree->SetBranchAddress("ejectile", &eject);
tree->SetBranchAddress("residual", &resid);
double nevents = tree->GetEntries();
std::vector<double> resid_thetas, eject_thetas;
std::vector<double> resid_phis, eject_phis;
std::vector<double> resid_kes, eject_kes;
//Progress tracking
int percent5 = nevents*0.05;
int count = 0;
int npercent = 0;
for(int i=0; i<tree->GetEntries(); i++) {
if(++count == percent5) {//Show progress every 5%
npercent++;
count = 0;
std::cout<<"\rPercent completed: "<<npercent*5<<"%"<<std::flush;
}
tree->GetEntry(i);
if(eject->KE >= ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(eject->theta, eject->phi)) {
eject_thetas.push_back(eject->theta);
eject_phis.push_back(eject->phi);
eject_kes.push_back(eject->KE);
break;
}
}
}
if(resid->KE > ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(resid->theta, resid->phi)) {
resid_thetas.push_back(resid->theta);
resid_phis.push_back(resid->phi);
resid_kes.push_back(resid->KE);
break;
}
}
}
}
double ejecteff = ((double) eject_thetas.size())/nevents;
double resideff = ((double) resid_thetas.size())/nevents;
TParameter<double> eject_eff("Light Breakup Efficiency", ejecteff);
TParameter<double> resid_eff("Heavy Breakup Efficiency", resideff);
input->cd();
eject_eff.Write();
resid_eff.Write();
input->Close();
}
void SabreEfficiency::Run2Step(const char* file) {
TFile* input = TFile::Open(file, "UPDATE");
TTree* tree = (TTree*) input->Get("DataTree");
NucData* break1 = new NucData();
NucData* break2 = new NucData();
tree->SetBranchAddress("breakup1", &break1);
tree->SetBranchAddress("breakup2", &break2);
double nevents = tree->GetEntries();
std::vector<double> b1_thetas, b2_thetas;
std::vector<double> b1_phis, b2_phis;
std::vector<double> b1_kes, b2_kes;
//Progress tracking
int percent5 = nevents*0.05;
int count = 0;
int npercent = 0;
for(int i=0; i<tree->GetEntries(); i++) {
if(++count == percent5) {//Show progress every 5%
npercent++;
count = 0;
std::cout<<"\rPercent completed: "<<npercent*5<<"%"<<std::flush;
}
tree->GetEntry(i);
if(break1->KE >= ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(break1->theta, break1->phi)) {
b1_thetas.push_back(break1->theta);
b1_phis.push_back(break1->phi);
b1_kes.push_back(break1->KE);
break;
}
}
}
if(break2->KE > ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(break2->theta, break2->phi)) {
b2_thetas.push_back(break2->theta);
b2_phis.push_back(break2->phi);
b2_kes.push_back(break2->KE);
break;
}
}
}
}
double b1eff = ((double) b1_thetas.size())/nevents;
double b2eff = ((double) b2_thetas.size())/nevents;
TParameter<double> break1_eff("Light Breakup Efficiency", b1eff);
TParameter<double> break2_eff("Heavy Breakup Efficiency", b2eff);
input->cd();
break1_eff.Write();
break2_eff.Write();
input->Close();
}
void SabreEfficiency::Run3Step(const char* file) {
TFile* input = TFile::Open(file, "UPDATE");
TTree* tree = (TTree*) input->Get("DataTree");
NucData* break1 = new NucData();
NucData* break3 = new NucData();
NucData* break4 = new NucData();
tree->SetBranchAddress("breakup1", &break1);
tree->SetBranchAddress("breakup3", &break3);
tree->SetBranchAddress("breakup4", &break4);
double nevents = tree->GetEntries();
std::vector<double> b1_thetas, b3_thetas, b4_thetas;
std::vector<double> b1_phis, b3_phis, b4_phis;
std::vector<double> b1_kes, b3_kes, b4_kes;
//Progress tracking
int percent5 = nevents*0.05;
int count = 0;
int npercent = 0;
for(int i=0; i<tree->GetEntries(); i++) {
if(++count == percent5) {//Show progress every 5%
npercent++;
count = 0;
std::cout<<"\rPercent completed: "<<npercent*5<<"%"<<std::flush;
}
tree->GetEntry(i);
if(break1->KE > ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(break1->theta, break1->phi)) {
b1_thetas.push_back(break1->theta);
b1_phis.push_back(break1->phi);
b1_kes.push_back(break1->KE);
break;
}
}
}
if(break3->KE > ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(break3->theta, break3->phi)) {
b3_thetas.push_back(break3->theta);
b3_phis.push_back(break3->phi);
b3_kes.push_back(break3->KE);
break;
}
}
}
if(break4->KE > ENERGY_THRESHOLD) {
for(auto& det : detectors) {
if(det.IsInside(break4->theta, break4->phi)) {
b4_thetas.push_back(break4->theta);
b4_phis.push_back(break4->phi);
b4_kes.push_back(break4->KE);
break;
}
}
}
}
double b1eff = ((double) b1_thetas.size())/nevents;
double b3eff = ((double) b3_thetas.size())/nevents;
double b4eff = ((double) b4_thetas.size())/nevents;
TParameter<double> break1_eff("Light Initial Breakup Efficiency", b1eff);
TParameter<double> break3_eff("Light Final Breakup Efficiency", b3eff);
TParameter<double> break4_eff("Heavy Final Breakup Efficiency", b4eff);
input->cd();
break1_eff.Write();
break3_eff.Write();
break4_eff.Write();
input->Close();
}

84
src/Target.cpp Normal file
View File

@ -0,0 +1,84 @@
/*
Target.cpp
A basic target unit for use in the SPANCRedux environment. A target
is defined as a single compound with elements Z,A of a given stoichiometry
Holds an energy loss class
Based on code by D.W. Visser written at Yale for the original SPANC
Written by G.W. McCann Aug. 2020
*/
#include "Target.h"
/*Targets must be of known thickness*/
Target::Target(double thick) {
thickness = thick;
}
Target::~Target() {
}
/*Set target elements of given Z, A, S*/
void Target::SetElements(std::vector<int>& z, std::vector<int>& a, std::vector<int>& stoich) {
Z = z;
A = a;
Stoich = stoich;
eloss.SetTargetComponents(Z, A, Stoich);
}
/*Element verification*/
bool Target::ContainsElement(int z, int a) {
for(unsigned int i=0; i<Z.size(); i++) {
if( z == Z[i] && a == A[i]) return true;
}
return false;
}
/*Calculates energy loss for travelling all the way through the target*/
double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta)));
}
/*Calculates energy loss for travelling halfway through the target*/
double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/(2.0*fabs(cos(theta))));
}
/*Calculates reverse energy loss for travelling all the way through the target*/
double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta)));
}
/*Calculates reverse energy loss for travelling half way through the target*/
double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/(2.0*fabs(cos(theta))));
}
/*Getter functions*/
double& Target::GetThickness() {
return thickness;
}
int Target::GetNumberOfElements() {
return Z.size();
}
int Target::GetElementZ(int index) {
return Z[index];
}
int Target::GetElementA(int index) {
return A[index];
}
int Target::GetElementStoich(int index) {
return Stoich[index];
}

107
src/ThreeStepSystem.cpp Normal file
View File

@ -0,0 +1,107 @@
#include "ThreeStepSystem.h"
#include "KinematicsExceptions.h"
ThreeStepSystem::ThreeStepSystem() :
ReactionSystem()
{
}
ThreeStepSystem::ThreeStepSystem(std::vector<int>& z, std::vector<int>& a) :
ReactionSystem()
{
SetNuclei(z, a);
}
ThreeStepSystem::~ThreeStepSystem() {
}
bool ThreeStepSystem::SetNuclei(std::vector<int>&z, std::vector<int>& a) {
if(z.size() != a.size() || z.size() < 5) {
return false;
}
int zr = z[0] + z[1] - z[2];
int zb2 = zr - z[3];
int ar = a[0] + a[1] - a[2];
int ab2 = ar - a[3];
step1.SetNuclei(z[0], a[0], z[1], a[1], z[2], a[2]);
step2.SetNuclei(zr, ar, 0, 0, z[3], a[3]);
step3.SetNuclei(zb2, ab2, 0, 0, z[4], a[4]);
SetSystemEquation();
return true;
}
void ThreeStepSystem::LinkTarget() {
step1.SetLayeredTarget(&target);
step2.SetLayeredTarget(&target);
step3.SetLayeredTarget(&target);
rxnLayer = target.FindLayerContaining(step1.GetTarget().GetZ(), step1.GetTarget().GetA());
if(rxnLayer != -1) {
step1.SetRxnLayer(rxnLayer);
step2.SetRxnLayer(rxnLayer);
step3.SetRxnLayer(rxnLayer);
target_set_flag = true;
} else {
throw ReactionLayerException();
}
}
void ThreeStepSystem::SetSystemEquation() {
m_sys_equation = step1.GetTarget().GetIsotopicSymbol();
m_sys_equation += "(";
m_sys_equation += step1.GetProjectile().GetIsotopicSymbol();
m_sys_equation += ", ";
m_sys_equation += step1.GetEjectile().GetIsotopicSymbol();
m_sys_equation += ")";
m_sys_equation += step1.GetResidual().GetIsotopicSymbol();
m_sys_equation += "-> ";
m_sys_equation += step2.GetEjectile().GetIsotopicSymbol();
m_sys_equation += " + ";
m_sys_equation += step2.GetResidual().GetIsotopicSymbol();
m_sys_equation += "-> ";
m_sys_equation += step3.GetEjectile().GetIsotopicSymbol();
m_sys_equation += " + ";
m_sys_equation += step3.GetResidual().GetIsotopicSymbol();
}
void ThreeStepSystem::RunSystem() {
if(!gen_set_flag) return;
//Link up the target if it hasn't been done yet
if(!target_set_flag) {
LinkTarget();
}
//Sample parameters
double bke = generator->Gaus(m_beamDist.first, m_beamDist.second);
double rxnTheta = acos(generator->Uniform(cos(m_theta1Range.first), cos(m_theta1Range.second)));
double rxnPhi = 0;
double decay1Theta = acos(generator->Uniform(-1, 1));
double decay1Phi = generator->Uniform(0, M_PI*2.0);
double decay2Theta = acos(generator->Uniform(-1,1));
double decay2Phi = generator->Uniform(0, M_PI*2.0);
double residEx = generator->Gaus(m_exDist.first, m_exDist.second);
step1.SetBeamKE(bke);
step1.SetPolarRxnAngle(rxnTheta);
step1.SetAzimRxnAngle(rxnPhi);
step1.SetExcitation(residEx);
step2.SetPolarRxnAngle(decay1Theta);
step2.SetAzimRxnAngle(decay1Phi);
step3.SetPolarRxnAngle(decay2Theta);
step3.SetAzimRxnAngle(decay2Phi);
step1.Calculate();
step2.SetTarget(step1.GetResidual());
step2.Calculate();
step3.SetTarget(step2.GetResidual());
step3.TurnOnResidualEloss();
step3.Calculate();
}

90
src/TwoStepSystem.cpp Normal file
View File

@ -0,0 +1,90 @@
#include "TwoStepSystem.h"
#include "KinematicsExceptions.h"
TwoStepSystem::TwoStepSystem() :
ReactionSystem()
{
}
TwoStepSystem::TwoStepSystem(std::vector<int>& z, std::vector<int>& a) :
ReactionSystem()
{
SetNuclei(z, a);
}
TwoStepSystem::~TwoStepSystem() {
}
bool TwoStepSystem::SetNuclei(std::vector<int>&z, std::vector<int>& a) {
if(z.size() != a.size() || z.size() < 4) {
return false;
}
int zr = z[0] + z[1] - z[2];
int ar = a[0] + a[1] - a[2];
step1.SetNuclei(z[0], a[0], z[1], a[1], z[2], a[2]);
step2.SetNuclei(zr, ar, 0, 0, z[3], a[3]);
SetSystemEquation();
return true;
}
void TwoStepSystem::LinkTarget() {
step1.SetLayeredTarget(&target);
step2.SetLayeredTarget(&target);
rxnLayer = target.FindLayerContaining(step1.GetTarget().GetZ(), step1.GetTarget().GetA());
if(rxnLayer != -1) {
step1.SetRxnLayer(rxnLayer);
step2.SetRxnLayer(rxnLayer);
target_set_flag = true;
} else {
throw ReactionLayerException();
}
}
void TwoStepSystem::SetSystemEquation() {
m_sys_equation = step1.GetTarget().GetIsotopicSymbol();
m_sys_equation += "(";
m_sys_equation += step1.GetProjectile().GetIsotopicSymbol();
m_sys_equation += ", ";
m_sys_equation += step1.GetEjectile().GetIsotopicSymbol();
m_sys_equation += ")";
m_sys_equation += step1.GetResidual().GetIsotopicSymbol();
m_sys_equation += "-> ";
m_sys_equation += step2.GetEjectile().GetIsotopicSymbol();
m_sys_equation += "+";
m_sys_equation += step2.GetResidual().GetIsotopicSymbol();
}
void TwoStepSystem::RunSystem() {
if(!gen_set_flag) return;
//Link up the target if it hasn't been done yet
if(!target_set_flag) {
LinkTarget();
}
//Sample parameters
double bke = generator->Gaus(m_beamDist.first, m_beamDist.second);
double rxnTheta = acos(generator->Uniform(cos(m_theta1Range.first), cos(m_theta1Range.second)));
double rxnPhi = 0;
double decay1Theta = acos(generator->Uniform(-1, 1));
double decay1Phi = generator->Uniform(0, M_PI*2.0);
double residEx = generator->Gaus(m_exDist.first, m_exDist.second);
step1.SetBeamKE(bke);
step1.SetPolarRxnAngle(rxnTheta);
step1.SetAzimRxnAngle(rxnPhi);
step1.SetExcitation(residEx);
step2.SetPolarRxnAngle(decay1Theta);
step2.SetAzimRxnAngle(decay1Phi);
step1.Calculate();
step2.SetTarget(step1.GetResidual());
step2.TurnOnResidualEloss();
step2.Calculate();
}

160
src/kinematics_dict.cxx Normal file
View File

@ -0,0 +1,160 @@
// Do NOT change. Changes will be lost next time file is generated
#define R__DICTIONARY_FILENAME srcdIkinematics_dict
#define R__NO_DEPRECATION
/*******************************************************************/
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define G__DICTIONARY
#include "RConfig.h"
#include "TClass.h"
#include "TDictAttributeMap.h"
#include "TInterpreter.h"
#include "TROOT.h"
#include "TBuffer.h"
#include "TMemberInspector.h"
#include "TInterpreter.h"
#include "TVirtualMutex.h"
#include "TError.h"
#ifndef G__ROOT
#define G__ROOT
#endif
#include "RtypesImp.h"
#include "TIsAProxy.h"
#include "TFileMergeInfo.h"
#include <algorithm>
#include "TCollectionProxyInfo.h"
/*******************************************************************/
#include "TDataMember.h"
// The generated code does not explicitly qualifies STL entities
namespace std {} using namespace std;
// Header files passed as explicit arguments
#include "include/Kinematics.h"
// Header files passed via #pragma extra_include
namespace ROOT {
static TClass *NucData_Dictionary();
static void NucData_TClassManip(TClass*);
static void *new_NucData(void *p = 0);
static void *newArray_NucData(Long_t size, void *p);
static void delete_NucData(void *p);
static void deleteArray_NucData(void *p);
static void destruct_NucData(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::NucData*)
{
::NucData *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::NucData));
static ::ROOT::TGenericClassInfo
instance("NucData", "include/Kinematics.h", 13,
typeid(::NucData), ::ROOT::Internal::DefineBehavior(ptr, ptr),
&NucData_Dictionary, isa_proxy, 4,
sizeof(::NucData) );
instance.SetNew(&new_NucData);
instance.SetNewArray(&newArray_NucData);
instance.SetDelete(&delete_NucData);
instance.SetDeleteArray(&deleteArray_NucData);
instance.SetDestructor(&destruct_NucData);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::NucData*)
{
return GenerateInitInstanceLocal((::NucData*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::NucData*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
// Dictionary for non-ClassDef classes
static TClass *NucData_Dictionary() {
TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::NucData*)0x0)->GetClass();
NucData_TClassManip(theClass);
return theClass;
}
static void NucData_TClassManip(TClass* ){
}
} // end of namespace ROOT
namespace ROOT {
// Wrappers around operator new
static void *new_NucData(void *p) {
return p ? new(p) ::NucData : new ::NucData;
}
static void *newArray_NucData(Long_t nElements, void *p) {
return p ? new(p) ::NucData[nElements] : new ::NucData[nElements];
}
// Wrapper around operator delete
static void delete_NucData(void *p) {
delete ((::NucData*)p);
}
static void deleteArray_NucData(void *p) {
delete [] ((::NucData*)p);
}
static void destruct_NucData(void *p) {
typedef ::NucData current_t;
((current_t*)p)->~current_t();
}
} // end of namespace ROOT for class ::NucData
namespace {
void TriggerDictionaryInitialization_kinematics_dict_Impl() {
static const char* headers[] = {
"include/Kinematics.h",
0
};
static const char* includePaths[] = {
"/usr/local/root/include/",
"/Users/gordonmccann/Desktop/kinematics/",
0
};
static const char* fwdDeclCode = R"DICTFWDDCLS(
#line 1 "kinematics_dict dictionary forward declarations' payload"
#pragma clang diagnostic ignored "-Wkeyword-compat"
#pragma clang diagnostic ignored "-Wignored-attributes"
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
extern int __Cling_AutoLoading_Map;
struct __attribute__((annotate("$clingAutoload$include/Kinematics.h"))) NucData;
)DICTFWDDCLS";
static const char* payloadCode = R"DICTPAYLOAD(
#line 1 "kinematics_dict dictionary payload"
#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
#include "include/Kinematics.h"
#undef _BACKWARD_BACKWARD_WARNING_H
)DICTPAYLOAD";
static const char* classesHeaders[] = {
"NucData", payloadCode, "@",
nullptr
};
static bool isInitialized = false;
if (!isInitialized) {
TROOT::RegisterModule("kinematics_dict",
headers, includePaths, payloadCode, fwdDeclCode,
TriggerDictionaryInitialization_kinematics_dict_Impl, {}, classesHeaders, /*hasCxxModule*/false);
isInitialized = true;
}
}
static struct DictInit {
DictInit() {
TriggerDictionaryInitialization_kinematics_dict_Impl();
}
} __TheDictionaryInitializer;
}
void TriggerDictionaryInitialization_kinematics_dict() {
TriggerDictionaryInitialization_kinematics_dict_Impl();
}

65
src/main.cpp Normal file
View File

@ -0,0 +1,65 @@
#include <iostream>
#include "Kinematics.h"
#include "SabreEfficiency.h"
#include "KinematicsExceptions.h"
#include <TGraph2D.h>
#include <TGraph.h>
#include <TFile.h>
#include <TAxis.h>
#include <TCanvas.h>
int main(int argc, char** argv) {
if(argc<2) {
std::cerr<<"Incorrect number of arguments!"<<std::endl;
return 1;
}
/*Kinematics calculator;
try {
if(!calculator.LoadConfig(argv[1])) {
return 1;
}
calculator.Run();
} catch(const std::exception& e) {
std::cerr<<"Exception caught! Information: "<<e.what()<<std::endl;
std::cerr<<"Terminating process."<<std::endl;
return 1;
}
SabreEfficiency sabre;
sabre.SetReactionType(calculator.GetReactionType());
sabre.CalculateEfficiency(calculator.GetOutputName());*/
std::vector<SabreDetGeometry> detectors;
const double INNER_R = 0.0326;
const double OUTER_R = 0.1351;
const double TILT = 40.0;
const double DIST_2_TARG = 0.1245;
const double PHI_COVERAGE = 54.4; //delta phi for each det
const double PHI0 = 36.0; //center phi values for each det in array
const double PHI1 = 108.0; //# is equal to detID in channel map
const double PHI2 = 324.0;
const double PHI3 = 252.0;
const double PHI4 = 180.0;
const double DEG2RAD = M_PI/180.0;
detectors.reserve(5);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI0*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI1*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI2*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI3*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
detectors.emplace_back(INNER_R,OUTER_R,PHI_COVERAGE*DEG2RAD,PHI4*DEG2RAD,TILT*DEG2RAD,DIST_2_TARG);
double theta = 145*M_PI/180.0; double phi = 92.1428*M_PI/180.0;
std::cout<<"theta: "<<theta<<" phi: "<<phi<<std::endl;
for(int i=0; i<5; i++) {
if(detectors[i].IsInside(theta, phi)) {
std::cout<<"Caught it in detector: "<<i<<std::endl;
}
break;
}
return 0;
}

396
testplots/testplots.cpp Normal file
View File

@ -0,0 +1,396 @@
#include <iostream>
#include <cmath>
#include <fstream>
#include <TGraph.h>
#include <TFile.h>
#include <TCanvas.h>
#include <TGraph2D.h>
#include <TLatex.h>
#include <TRandom3.h>
#include "SabreDetector.h"
using namespace std;
int main() {
const int NUMDETS = 5;
SabreDetGeometry **sabdet = new SabreDetGeometry*[NUMDETS];
//dimensions common to all dets:
const double INNER_RADIUS = 0.0326; //meters
const double OUTER_RADIUS = 0.1351; //meters
const double TILT_FROM_VERTICAL = 40.0; //degrees
const double DIST_FROM_TARGET = 0.1245; //meters
sabdet[0] = new SabreDetGeometry(INNER_RADIUS,
OUTER_RADIUS,
54.4*M_PI/180., //delta phi
36.*M_PI/180., //center phi
TILT_FROM_VERTICAL*M_PI/180.,
DIST_FROM_TARGET);
sabdet[1] = new SabreDetGeometry(INNER_RADIUS,
OUTER_RADIUS,
54.4*M_PI/180.,
108.*M_PI/180.,
TILT_FROM_VERTICAL*M_PI/180.,
DIST_FROM_TARGET);
sabdet[2] = new SabreDetGeometry(INNER_RADIUS,
OUTER_RADIUS,
54.4*M_PI/180.,
180.*M_PI/180.,
TILT_FROM_VERTICAL*M_PI/180.,
DIST_FROM_TARGET);
sabdet[3] = new SabreDetGeometry(INNER_RADIUS,
OUTER_RADIUS,
54.4*M_PI/180.,
252.*M_PI/180.,
TILT_FROM_VERTICAL*M_PI/180.,
DIST_FROM_TARGET);
sabdet[4] = new SabreDetGeometry(INNER_RADIUS,
OUTER_RADIUS,
54.4*M_PI/180.,
324.*M_PI/180.,
TILT_FROM_VERTICAL*M_PI/180.,
DIST_FROM_TARGET);
const int NUMCORNERS = 4;
const int NUMRINGS = sabdet[0]->NumRings();
const int NUMWEDGES = sabdet[0]->NumWedges();
const int NUMRINGPTS = NUMDETS*NUMRINGS*NUMCORNERS;
const int NUMWEDGEPTS = NUMDETS*NUMWEDGES*NUMCORNERS;
//const int NUMMCCOUNTS = 1E8;
double ring_xpts_flat[NUMRINGPTS];
double ring_ypts_flat[NUMRINGPTS];
double ring_zpts_flat[NUMRINGPTS];
double ring_rpts_flat[NUMRINGPTS];
double ring_tpts_flat[NUMRINGPTS];
double ring_ppts_flat[NUMRINGPTS];
double wedge_xpts_flat[NUMWEDGEPTS];
double wedge_ypts_flat[NUMWEDGEPTS];
double wedge_zpts_flat[NUMWEDGEPTS];
double wedge_rpts_flat[NUMWEDGEPTS];
double wedge_tpts_flat[NUMWEDGEPTS];
double wedge_ppts_flat[NUMWEDGEPTS];
double ring_xpts_tilted[NUMRINGPTS];
double ring_ypts_tilted[NUMRINGPTS];
double ring_zpts_tilted[NUMRINGPTS];
double ring_rpts_tilted[NUMRINGPTS];
double ring_tpts_tilted[NUMRINGPTS];
double ring_ppts_tilted[NUMRINGPTS];
double wedge_xpts_tilted[NUMWEDGEPTS];
double wedge_ypts_tilted[NUMWEDGEPTS];
double wedge_zpts_tilted[NUMWEDGEPTS];
double wedge_rpts_tilted[NUMWEDGEPTS];
double wedge_tpts_tilted[NUMWEDGEPTS];
double wedge_ppts_tilted[NUMWEDGEPTS];
ofstream checkfile;
checkfile.open("checkfile.txt");
checkfile << "RINGS\n"
<< "det ch corner x_fl y_fl z_fl r_fl t_fl p_fl x_ti y_ti z_ti r_ti t_ti p_ti\n";
for (int d=0; d<NUMDETS; d++) {
for (int i=0; i<NUMRINGS; i++) {
for (int j=0; j<NUMCORNERS; j++) {
int index = NUMCORNERS*NUMRINGS*d + NUMCORNERS*i + j;
ring_xpts_flat[index] = sabdet[d]->Get_Ring_Flat_X(i,j)*100;
ring_ypts_flat[index] = sabdet[d]->Get_Ring_Flat_Y(i,j)*100;
ring_zpts_flat[index] = sabdet[d]->Get_Ring_Flat_Z(i,j)*100;
ring_rpts_flat[index] = sabdet[d]->Get_Ring_Flat_R(i,j)*100;
ring_tpts_flat[index] = sabdet[d]->Get_Ring_Flat_Theta(i,j)*180./M_PI;
ring_ppts_flat[index] = sabdet[d]->Get_Ring_Flat_Phi(i,j)*180./M_PI;
ring_xpts_tilted[index] = sabdet[d]->Get_Ring_Tilted_X(i,j)*100;
ring_ypts_tilted[index] = sabdet[d]->Get_Ring_Tilted_Y(i,j)*100;
ring_zpts_tilted[index] = sabdet[d]->Get_Ring_Tilted_Z(i,j)*100;
ring_rpts_tilted[index] = sabdet[d]->Get_Ring_Tilted_R(i,j)*100;
ring_tpts_tilted[index] = sabdet[d]->Get_Ring_Tilted_Theta(i,j)*180./M_PI;
ring_ppts_tilted[index] = sabdet[d]->Get_Ring_Tilted_Phi(i,j)*180./M_PI;
checkfile << d << " " << i << " " << j << " "
<< ring_xpts_flat[index] << " "
<< ring_ypts_flat[index] << " "
<< ring_zpts_flat[index] << " "
<< ring_rpts_flat[index] << " "
<< ring_tpts_flat[index] << " "
<< ring_ppts_flat[index] << " "
<< ring_xpts_tilted[index] << " "
<< ring_ypts_tilted[index] << " "
<< ring_zpts_tilted[index] << " "
<< ring_rpts_tilted[index] << " "
<< ring_tpts_tilted[index] << " "
<< ring_ppts_tilted[index] << endl;
}
}
}
checkfile << "WEDGES\n"
<< "det ch corner x_fl y_fl z_fl r_fl t_fl p_fl x_ti y_ti z_ti r_ti t_ti p_ti\n";
for (int d=0; d<NUMDETS; d++) {
for (int i=0; i<NUMWEDGES; i++) {
for (int j=0; j<NUMCORNERS; j++) {
int index = NUMCORNERS*NUMWEDGES*d + NUMCORNERS*i + j;
wedge_xpts_flat[index] = sabdet[d]->Get_Wedge_Flat_X(i,j)*100;
wedge_ypts_flat[index] = sabdet[d]->Get_Wedge_Flat_Y(i,j)*100;
wedge_zpts_flat[index] = sabdet[d]->Get_Wedge_Flat_Z(i,j)*100;
wedge_rpts_flat[index] = sabdet[d]->Get_Wedge_Flat_R(i,j)*100;
wedge_tpts_flat[index] = sabdet[d]->Get_Wedge_Flat_Theta(i,j)*180./M_PI;
wedge_ppts_flat[index] = sabdet[d]->Get_Wedge_Flat_Phi(i,j)*180./M_PI;
wedge_xpts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_X(i,j)*100;
wedge_ypts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_Y(i,j)*100;
wedge_zpts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_Z(i,j)*100;
wedge_rpts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_R(i,j)*100;
wedge_tpts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_Theta(i,j)*180./M_PI;
wedge_ppts_tilted[index] = sabdet[d]->Get_Wedge_Tilted_Phi(i,j)*180./M_PI;
checkfile << d << " " << i << " " << j << " "
<< wedge_xpts_flat[index] << " "
<< wedge_ypts_flat[index] << " "
<< wedge_zpts_flat[index] << " "
<< wedge_rpts_flat[index] << " "
<< wedge_tpts_flat[index] << " "
<< wedge_ppts_flat[index] << " "
<< wedge_xpts_tilted[index] << " "
<< wedge_ypts_tilted[index] << " "
<< wedge_zpts_tilted[index] << " "
<< wedge_rpts_tilted[index] << " "
<< wedge_tpts_tilted[index] << " "
<< wedge_ppts_tilted[index] << endl;
}
}
}
checkfile.close();
/*
UNDER CONSTRUCTION: MC efficiency integration
TRandom3 *rand = new TRandom3();
rand->SetSeed();
int hits=0;
bool didhit=false;
double randx=0;
double randy=0;
double randz=0;
double randr=0;
double randt=0;
double randp=0;
for (int mc=0; mc<NUMMCCOUNTS; mc++) {
didhit = false;
randx = rand->Uniform(0,1);
randy = rand->Uniform(0,1);
randz = rand->Uniform(0,1);
randr = sqrt(pow(randx,2)+pow(randy,2)+pow(randz,2));
randt = acos(randz/randr)*180./M_PI;
randp = atan(randy/randx)*180./M_PI;
if (randx <= 0 && randy >= 0) randp += 90;
else if (randx <= 0 && randy <= 0) randp += 90;
else if (randx >= 0 && randy <= 0) randp += 270;
else if (randx >= 0 && randy >= 0) randp += 270;
for (int d=0; d<NUMDETS; d++) {
if (didhit) break;
for (int f=0; f<NUMRINGS; f++) {
if (didhit) break;
for (int b=0; b<NUMWEDGES; b++) {
if (randt <= sabdet[d]->Get_Ring_Tilted_Theta(f,)) {
hit++;
didhit=true;
break;
}
}
}
}
}
cout << "Geom eff = " << 1.*hits/NUMMCCOUNTS*100 << "%" << endl;
*/
TGraph ring_flat_xy_gr(NUMRINGPTS,ring_xpts_flat,ring_ypts_flat);
ring_flat_xy_gr.SetMarkerStyle(2);
ring_flat_xy_gr.SetName("ring_flat_xy_gr");
TGraph wedge_flat_xy_gr(NUMWEDGEPTS,wedge_xpts_flat,wedge_ypts_flat);
wedge_flat_xy_gr.SetMarkerStyle(2);
wedge_flat_xy_gr.SetName("wedge_flat_xy_gr");
wedge_flat_xy_gr.SetTitle("Flat (Untilted);x (cm);y (cm)");
TGraph ring_flat_zy_gr(NUMRINGPTS,ring_zpts_flat,ring_ypts_flat);
ring_flat_zy_gr.SetMarkerStyle(2);
ring_flat_zy_gr.SetName("ring_flat_zy_gr");
TGraph wedge_flat_zy_gr(NUMWEDGEPTS,wedge_zpts_flat,wedge_ypts_flat);
wedge_flat_zy_gr.SetMarkerStyle(2);
wedge_flat_zy_gr.SetName("wedge_flat_zy_gr");
wedge_flat_zy_gr.SetTitle("Flat (Untilted);z (cm);y (cm)");
TGraph ring_flat_pt_gr(NUMRINGPTS,ring_ppts_flat,ring_tpts_flat);
ring_flat_pt_gr.SetMarkerStyle(2);
ring_flat_pt_gr.SetName("ring_flat_pt_gr");
TGraph wedge_flat_pt_gr(NUMWEDGEPTS,wedge_ppts_flat,wedge_tpts_flat);
wedge_flat_pt_gr.SetMarkerStyle(2);
wedge_flat_pt_gr.SetName("wedge_flat_pt_gr");
wedge_flat_pt_gr.SetTitle("Flat (Untilted);#phi (deg.);#theta (deg.)");
TGraph2D ring_flat_2d_gr(NUMRINGPTS,ring_xpts_flat,ring_zpts_flat,ring_ypts_flat);
ring_flat_2d_gr.SetMarkerStyle(2);
ring_flat_2d_gr.SetName("ring_flat_2d_gr");
TGraph2D wedge_flat_2d_gr(NUMWEDGEPTS,wedge_xpts_flat,wedge_zpts_flat,wedge_ypts_flat);
wedge_flat_2d_gr.SetMarkerStyle(2);
wedge_flat_2d_gr.SetName("wedge_flat_2d_gr");
wedge_flat_2d_gr.SetTitle("Flat (Untilted);x (cm); z (cm); y (cm)");
TGraph ring_tilted_xy_gr(NUMRINGPTS,ring_xpts_tilted,ring_ypts_tilted);
ring_tilted_xy_gr.SetMarkerStyle(2);
ring_tilted_xy_gr.SetName("ring_tilted_xy_gr");
TGraph wedge_tilted_xy_gr(NUMWEDGEPTS,wedge_xpts_tilted,wedge_ypts_tilted);
wedge_tilted_xy_gr.SetMarkerStyle(2);
wedge_tilted_xy_gr.SetName("wedge_tilted_xy_gr");
wedge_tilted_xy_gr.SetTitle("Tilted;x (cm);y (cm)");
TGraph ring_tilted_zy_gr(NUMRINGPTS,ring_zpts_tilted,ring_ypts_tilted);
ring_tilted_zy_gr.SetMarkerStyle(2);
ring_tilted_zy_gr.SetName("ring_tilted_zy_gr");
TGraph wedge_tilted_zy_gr(NUMWEDGEPTS,wedge_zpts_tilted,wedge_ypts_tilted);
wedge_tilted_zy_gr.SetMarkerStyle(2);
wedge_tilted_zy_gr.SetName("wedge_tilted_zy_gr");
wedge_tilted_zy_gr.SetTitle("Tilted;z (cm);y (cm)");
TGraph ring_tilted_pt_gr(NUMRINGPTS,ring_ppts_tilted,ring_tpts_tilted);
ring_tilted_pt_gr.SetMarkerStyle(2);
ring_tilted_pt_gr.SetName("ring_tilted_pt_gr");
TGraph wedge_tilted_pt_gr(NUMWEDGEPTS,wedge_ppts_tilted,wedge_tpts_tilted);
wedge_tilted_pt_gr.SetMarkerStyle(2);
wedge_tilted_pt_gr.SetName("wedge_tilted_pt_gr");
wedge_tilted_pt_gr.SetTitle("Tilted;#phi (deg.);#theta (deg.)");
TGraph2D ring_tilted_2d_gr(NUMRINGPTS,ring_xpts_tilted,ring_zpts_tilted,ring_ypts_tilted);
ring_tilted_2d_gr.SetMarkerStyle(2);
ring_tilted_2d_gr.SetName("ring_tilted_2d_gr");
TGraph2D wedge_tilted_2d_gr(NUMWEDGEPTS,wedge_xpts_tilted,wedge_zpts_tilted,wedge_ypts_tilted);
wedge_tilted_2d_gr.SetMarkerStyle(2);
wedge_tilted_2d_gr.SetName("wedge_tilted_2d_gr");
wedge_tilted_2d_gr.SetTitle("Tilted;x (cm); z (cm); y (cm)");
int nCenters = 5*16*8;
int nCent_det = 16*8;
double centerx[nCenters], centery[nCenters], centerz[nCenters];
double **det_centx, **det_centy, **det_centz;
det_centx = new double*[5]; det_centy = new double*[5]; det_centz = new double*[5];
for(int i=0; i<5; i++) {
det_centx[i] = new double[nCent_det];
det_centy[i] = new double[nCent_det];
det_centz[i] = new double[nCent_det];
}
CartCoords point;
int index = 0;
int small_index;
for(int d=0; d<5; d++) {
small_index = 0;
for(int r=0; r<16; r++) {
for(int w=0; w<8; w++) {
point = sabdet[d]->GetCoordinates(r,w);
centerx[index] = point.x*100;
centery[index] = point.y*100;
centerz[index] = point.z*100;
det_centx[d][small_index] = point.x*100;
det_centy[d][small_index] = point.y*100;
det_centz[d][small_index] = point.z*100;
index++; small_index++;
}
}
}
TGraph2D centerpoint(nCenters, &centerx[0], &centerz[0], &centery[0]);
centerpoint.SetName("centerpoint");
centerpoint.SetTitle("centerpoint;x;z;y");
centerpoint.SetMarkerStyle(2);
centerpoint.SetMarkerColor(2);
TGraph2D centerpoint_d1(nCent_det, &(det_centx[0][0]), &(det_centz[0][0]), &(det_centy[0][0]));
centerpoint_d1.SetName("centerpoint_d1");
centerpoint_d1.SetMarkerStyle(2);
centerpoint_d1.SetMarkerColor(1);
TGraph2D centerpoint_d2(nCent_det, &(det_centx[1][0]), &(det_centz[1][0]), &(det_centy[1][0]));
centerpoint_d2.SetName("centerpoint_d2");
centerpoint_d2.SetMarkerStyle(2);
centerpoint_d2.SetMarkerColor(2);
TGraph2D centerpoint_d3(nCent_det, &(det_centx[2][0]), &(det_centz[2][0]), &(det_centy[2][0]));
centerpoint_d3.SetName("centerpoint_d3");
centerpoint_d3.SetMarkerStyle(2);
centerpoint_d3.SetMarkerColor(3);
TGraph2D centerpoint_d4(nCent_det, &(det_centx[3][0]), &(det_centz[3][0]), &(det_centy[3][0]));
centerpoint_d4.SetName("centerpoint_d4");
centerpoint_d4.SetMarkerStyle(2);
centerpoint_d4.SetMarkerColor(4);
TGraph2D centerpoint_d5(nCent_det, &(det_centx[4][0]), &(det_centz[4][0]), &(det_centy[4][0]));
centerpoint_d5.SetName("centerpoint_d5");
centerpoint_d5.SetMarkerStyle(2);
centerpoint_d5.SetMarkerColor(5);
TCanvas flat_xy_canv("flat_xy_canv");
wedge_flat_xy_gr.Draw("AP");
ring_flat_xy_gr.Draw("same P");
TCanvas flat_zy_canv("flat_zy_canv");
wedge_flat_zy_gr.Draw("AP");
ring_flat_zy_gr.Draw("same P");
TCanvas flat_pt_canv("flat_pt_canv");
wedge_flat_pt_gr.Draw("AP");
ring_flat_pt_gr.Draw("same P");
TCanvas flat_2d_canv("flat_2d_canv");
wedge_flat_2d_gr.Draw("P");
ring_flat_2d_gr.Draw("same P");
TCanvas tilted_xy_canv("tilted_xy_canv");
wedge_tilted_xy_gr.Draw("AP");
ring_tilted_xy_gr.Draw("same P");
TCanvas tilted_zy_canv("tilted_zy_canv");
wedge_tilted_zy_gr.Draw("AP");
ring_tilted_zy_gr.Draw("same P");
TCanvas tilted_pt_canv("tilted_pt_canv");
wedge_tilted_pt_gr.Draw("AP");
ring_tilted_pt_gr.Draw("same P");
TCanvas tilted_2d_canv("tilted_2d_canv");
wedge_tilted_2d_gr.Draw("P");
ring_tilted_2d_gr.Draw("same P");
centerpoint.Draw("same P");
TCanvas tilted_point("tilted_point");
centerpoint.Draw("P");
TCanvas tilted_point_det("tilted_point_det");
wedge_tilted_2d_gr.Draw("P");
ring_tilted_2d_gr.Draw("same P");
centerpoint_d1.Draw("P same");
centerpoint_d2.Draw("P same");
centerpoint_d3.Draw("P same");
centerpoint_d4.Draw("P same");
centerpoint_d5.Draw("P same");
TFile outfile("outfile.root","RECREATE");
ring_flat_xy_gr.Write();
wedge_flat_xy_gr.Write();
flat_xy_canv.Write();
ring_tilted_xy_gr.Write();
wedge_tilted_xy_gr.Write();
tilted_xy_canv.Write();
ring_flat_zy_gr.Write();
wedge_flat_zy_gr.Write();
flat_zy_canv.Write();
ring_tilted_zy_gr.Write();
wedge_tilted_zy_gr.Write();
tilted_zy_canv.Write();
ring_flat_pt_gr.Write();
wedge_flat_pt_gr.Write();
flat_pt_canv.Write();
ring_tilted_pt_gr.Write();
wedge_tilted_pt_gr.Write();
tilted_pt_canv.Write();
ring_flat_2d_gr.Write();
wedge_flat_2d_gr.Write();
flat_2d_canv.Write();
ring_tilted_2d_gr.Write();
wedge_tilted_2d_gr.Write();
tilted_2d_canv.Write();
tilted_point.Write();
tilted_point_det.Write();
outfile.Close();
delete [] sabdet;
return 0;
}

BIN
tp Executable file

Binary file not shown.