test_gen_rays_pdsp.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Created by Wenqiang Gu, 8/20/2019
4 
5 import sys, math
6 argc = len(sys.argv)
7 if argc!=2:
8  print "Usage example: python test_gen_rays_pdsp.py 45 # unit in degree"
9  exit()
10 
11 deg = math.radians(1)
12 meter = 1.0
13 
14 theta = float(sys.argv[1]) *deg
15 tanth = math.tan(theta)
16 
17 Ltpc = 3.6*meter
18 Htpc = 6.0*meter
19 Wtpc = 2.3*meter
20 
21 p1 = [-Ltpc, 0.5*Htpc, 0]
22 p2 = [ 0, 0.5*Htpc, Ltpc/tanth]
23 Nreplica = int(3.*Wtpc / (Ltpc/tanth)) + 1
24 print '''local wc = import 'wirecell.jsonnet';
25 {
26  rays: [
27 '''
28 
29 for i in range(Nreplica):
30  print ''' {
31  tail: wc.point(%.3f, %.3f, %.3f, wc.m),
32  head: wc.point(%.3f, %.3f, %.3f, wc.m),
33  },
34  {
35  tail: wc.point(%.3f, %.3f, %.3f, wc.m),
36  head: wc.point(%.3f, %.3f, %.3f, wc.m),
37  },
38  ''' %(p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], p1[0]+Ltpc, p1[1], p1[2], p2[0]+Ltpc, p2[1], p2[2])
39  p1[2] += Ltpc/tanth
40  p2[2] += Ltpc/tanth
41 
42  p1[2] += 0.05*meter
43  p2[2] += 0.05*meter
44 
45 print ''' ],
46 }
47 '''