add: random algorithm

This commit is contained in:
liuyihui 2022-05-15 17:47:31 +08:00
parent 26f8223362
commit 3b2b20209d
1 changed files with 23 additions and 2 deletions

View File

@ -222,6 +222,27 @@ $$
</div>
1. 位置生成
而发射位置要求在球面上均匀分布。由于球面的面积元$\mathrm{d}\Omega=\sin\theta\mathrm{d}\phi\mathrm{d}\theta$是$\theta$的函数,如果位置向量$\vec{r}(\rho, \phi, \theta)$的$\phi$和$\theta$是在$\phi\in[0, 2\pi)$和$\theta\in[0, \pi]$上均匀分布,选取的点将会在两极较为密集(即),因此可以采用`ITM`方法生成$\theta$$C^{-1}(z)=\cos^{-1}(z)$。
```c
double u = rand();
double v = rand();
double phi = 2 * pi * u;
double theta = arccos(2 * v - 1);
double x = rho * sin(theta) * cos(phi);
double y = rho * sin(theta) * sin(phi);
double z = rho * cos(theta);
```
2. 发射方向
在`Geant4`中,假定粒子的位置矢量为$\vec{r}$,则以$\vec{r}$反方向作为$z$轴正方向建立右手坐标系,粒子的指向为:
$$
P_x = -\sin\theta\cos\phi \\
P_y = -\sin\theta\sin\phi \\
P_z = -\cos\theta
$$
为了保证发射方向是朝向球面内,因此需要限制$\theta$的最大角度为$90^{\circ}$。
## 空间站建模
1. 尺寸与分区[^6]
<div align=center><img src="docs/size.webp" style="max-width: 50%;"></div>