File indexing completed on 2024-11-16 09:01:51
0001 """
0002 @author Jesse Campbell
0003 """
0004
0005 import numpy as np
0006 import sys
0007 import matplotlib.pyplot as plt
0008 circle = 2 * np.pi
0009 epsilon = 1e-2
0010
0011
0012 def makeAngles(theta_min: float, theta_max: float, num_rings: int, hit_density: int) -> list:
0013 """
0014 :param theta_min: minimum polar angle of dRICH in radians
0015 :param theta_max: maximum polar angle of dRICH in radians
0016 :param num_rings: number of concentric rings
0017 :param hit_density: the amount of photon hits for the minimum polar angle
0018 :return: returns a list of tuples containing polar and azimuthal angles, in radians, in the form
0019 [(polar, azimuthal), (...), ...] for generating photons that will have an even distribution on the dRICH sensor
0020 """
0021
0022 angles = []
0023 thetas = np.linspace(theta_min, theta_max, num=num_rings)
0024 phis = np.linspace(hit_density, hit_density * (theta_max / (theta_min + epsilon)), num=num_rings, dtype=int)
0025
0026 for r, t in convert(thetas, phis):
0027 angles.append(tuple((r, t)))
0028 """
0029 plt.plot(r * np.cos(t), r * np.sin(t), 'bo')
0030 plt.show()
0031 """
0032 return angles
0033
0034
0035 def convert(thetas, phis):
0036
0037 for i in range(len(thetas)):
0038 for j in range(phis[i]):
0039 yield thetas[i], j * (circle / phis[i])
0040
0041
0042 if __name__ == '__main__':
0043 args = sys.argv
0044 theta_min = float(args[2])
0045 theta_max = float(args[3])
0046 num_rings = int(args[4])
0047 hit_density = int(args[5])
0048 globals()[args[1]](theta_min, theta_max, num_rings, hit_density)