Functions | Variables
make_fwd_distortions Namespace Reference

Functions

def get_corr_points (hx, hy, hz)
 
def get_bin_points (h)
 
def set_distortions (hx, hy, hz, pts)
 
def get_distorted_pts (grid_pts, tri_in)
 

Variables

 parser = ap()
 
 type
 
 str
 
 help
 
 args = parser.parse_args()
 
 fIn = RT.TFile(args.i, "OPEN")
 
 bkwd_z_pos = fIn.Get("RecoBkwd_Displacement_Z_Pos")
 
 bkwd_z_neg = fIn.Get("RecoBkwd_Displacement_Z_Neg")
 
 bkwd_x_pos = fIn.Get("RecoBkwd_Displacement_X_Pos")
 
 bkwd_x_neg = fIn.Get("RecoBkwd_Displacement_X_Neg")
 
 bkwd_y_pos = fIn.Get("RecoBkwd_Displacement_Y_Pos")
 
 bkwd_y_neg = fIn.Get("RecoBkwd_Displacement_Y_Neg")
 
 fwd_z_pos = bkwd_z_pos.Clone("RecoFwd_Displacement_Z_Pos")
 
 fwd_z_neg = bkwd_z_neg.Clone("RecoFwd_Displacement_Z_Neg")
 
 fwd_x_pos = bkwd_x_pos.Clone("RecoFwd_Displacement_X_Pos")
 
 fwd_x_neg = bkwd_x_neg.Clone("RecoFwd_Displacement_X_Neg")
 
 fwd_y_pos = bkwd_y_pos.Clone("RecoFwd_Displacement_Y_Pos")
 
 fwd_y_neg = bkwd_y_neg.Clone("RecoFwd_Displacement_Y_Neg")
 
 bkwd_pos_points = get_bin_points(bkwd_z_pos)
 
 bkwd_neg_points = get_bin_points(bkwd_z_neg)
 
 bkwd_pos_corrected = get_corr_points(bkwd_x_pos, bkwd_y_pos, bkwd_z_pos)
 
 bkwd_neg_corrected = get_corr_points(bkwd_x_neg, bkwd_y_neg, bkwd_z_neg)
 
 bkwd_pos_corrected_array = np.array(bkwd_pos_corrected)
 
 bkwd_neg_corrected_array = np.array(bkwd_neg_corrected)
 
 tri_pos_corr = Delaunay(bkwd_pos_corrected_array)
 
 tri_neg_corr = Delaunay(bkwd_neg_corrected_array)
 
 distorted_pos = get_distorted_pts(bkwd_pos_points, tri_pos_corr)
 
 distorted_neg = get_distorted_pts(bkwd_neg_points, tri_neg_corr)
 
 fOut = RT.TFile(args.o, "RECREATE")
 
 ex_pos = fIn.Get("Reco_ElecField_X_Pos")
 
 ey_pos = fIn.Get("Reco_ElecField_Y_Pos")
 
 ez_pos = fIn.Get("Reco_ElecField_Z_Pos")
 
 ex_neg = fIn.Get("Reco_ElecField_X_Neg")
 
 ey_neg = fIn.Get("Reco_ElecField_Y_Neg")
 
 ez_neg = fIn.Get("Reco_ElecField_Z_Neg")
 

Function Documentation

def make_fwd_distortions.get_bin_points (   h)

Definition at line 26 of file make_fwd_distortions.py.

27  results = []
28  for i in range(1, h.GetNbinsX()+1):
29  x = h.GetXaxis().GetBinCenter(i)
30  for j in range(1, h.GetNbinsY()+1):
31  y = h.GetYaxis().GetBinCenter(j)
32  for k in range(1, h.GetNbinsZ()+1):
33  z = h.GetZaxis().GetBinCenter(k)
34  results.append([x, y, z])
35  return results
36 
def make_fwd_distortions.get_corr_points (   hx,
  hy,
  hz 
)

Definition at line 12 of file make_fwd_distortions.py.

12 def get_corr_points(hx, hy, hz):
13  results = []
14  for i in range(1, hx.GetNbinsX()+1):
15  x = hx.GetXaxis().GetBinCenter(i)
16  for j in range(1, hx.GetNbinsY()+1):
17  y = hx.GetYaxis().GetBinCenter(j)
18  for k in range(1, hx.GetNbinsZ()+1):
19  z = hx.GetZaxis().GetBinCenter(k)
20  results.append(
21  [x + hx.GetBinContent(i, j, k),
22  y + hy.GetBinContent(i, j, k),
23  z + hz.GetBinContent(i, j, k)])
24  return results
25 
def get_corr_points(hx, hy, hz)
def make_fwd_distortions.get_distorted_pts (   grid_pts,
  tri_in 
)

Definition at line 49 of file make_fwd_distortions.py.

49 def get_distorted_pts(grid_pts, tri_in):
50  results = []
51  for pt in grid_pts:
52  i = tri_in.find_simplex(pt)
53  s = tri_in.simplices[i]
54  r = tri_in.transform[i,3]
55  b = tri_in.transform[i,:3].dot(np.transpose(pt - r))
56  b = np.append(b, 1. - b.sum())
57 
58  new_point_x = 0.
59  new_point_y = 0.
60  new_point_z = 0.
61  for j, bi in zip(s,b):
62  new_point_x += grid_pts[j][0]*bi
63  new_point_y += grid_pts[j][1]*bi
64  new_point_z += grid_pts[j][2]*bi
65 
66  results.append([new_point_x, new_point_y, new_point_z])
67  return results
68 
69 
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
def get_distorted_pts(grid_pts, tri_in)
def make_fwd_distortions.set_distortions (   hx,
  hy,
  hz,
  pts 
)

Definition at line 37 of file make_fwd_distortions.py.

37 def set_distortions(hx, hy, hz, pts):
38  a = 0
39  for i in range(1, hx.GetNbinsX()+1):
40  x = hx.GetXaxis().GetBinCenter(i)
41  for j in range(1, hx.GetNbinsY()+1):
42  y = hx.GetYaxis().GetBinCenter(j)
43  for k in range(1, hx.GetNbinsZ()+1):
44  z = hx.GetZaxis().GetBinCenter(k)
45  hx.SetBinContent(i, j, k, pts[a][0] - x)
46  hy.SetBinContent(i, j, k, pts[a][1] - y)
47  hz.SetBinContent(i, j, k, pts[a][2] - z)
48  a += 1
def set_distortions(hx, hy, hz, pts)

Variable Documentation

make_fwd_distortions.args = parser.parse_args()

Definition at line 10 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_neg_corrected = get_corr_points(bkwd_x_neg, bkwd_y_neg, bkwd_z_neg)

Definition at line 89 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_neg_corrected_array = np.array(bkwd_neg_corrected)

Definition at line 92 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_neg_points = get_bin_points(bkwd_z_neg)

Definition at line 86 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_pos_corrected = get_corr_points(bkwd_x_pos, bkwd_y_pos, bkwd_z_pos)

Definition at line 88 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_pos_corrected_array = np.array(bkwd_pos_corrected)

Definition at line 91 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_pos_points = get_bin_points(bkwd_z_pos)

Definition at line 85 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_x_neg = fIn.Get("RecoBkwd_Displacement_X_Neg")

Definition at line 74 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_x_pos = fIn.Get("RecoBkwd_Displacement_X_Pos")

Definition at line 73 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_y_neg = fIn.Get("RecoBkwd_Displacement_Y_Neg")

Definition at line 76 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_y_pos = fIn.Get("RecoBkwd_Displacement_Y_Pos")

Definition at line 75 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_z_neg = fIn.Get("RecoBkwd_Displacement_Z_Neg")

Definition at line 72 of file make_fwd_distortions.py.

make_fwd_distortions.bkwd_z_pos = fIn.Get("RecoBkwd_Displacement_Z_Pos")

Definition at line 71 of file make_fwd_distortions.py.

make_fwd_distortions.distorted_neg = get_distorted_pts(bkwd_neg_points, tri_neg_corr)

Definition at line 100 of file make_fwd_distortions.py.

make_fwd_distortions.distorted_pos = get_distorted_pts(bkwd_pos_points, tri_pos_corr)

Definition at line 97 of file make_fwd_distortions.py.

make_fwd_distortions.ex_neg = fIn.Get("Reco_ElecField_X_Neg")

Definition at line 121 of file make_fwd_distortions.py.

make_fwd_distortions.ex_pos = fIn.Get("Reco_ElecField_X_Pos")

Definition at line 118 of file make_fwd_distortions.py.

make_fwd_distortions.ey_neg = fIn.Get("Reco_ElecField_Y_Neg")

Definition at line 122 of file make_fwd_distortions.py.

make_fwd_distortions.ey_pos = fIn.Get("Reco_ElecField_Y_Pos")

Definition at line 119 of file make_fwd_distortions.py.

make_fwd_distortions.ez_neg = fIn.Get("Reco_ElecField_Z_Neg")

Definition at line 123 of file make_fwd_distortions.py.

make_fwd_distortions.ez_pos = fIn.Get("Reco_ElecField_Z_Pos")

Definition at line 120 of file make_fwd_distortions.py.

make_fwd_distortions.fIn = RT.TFile(args.i, "OPEN")

Definition at line 70 of file make_fwd_distortions.py.

make_fwd_distortions.fOut = RT.TFile(args.o, "RECREATE")

Definition at line 103 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_x_neg = bkwd_x_neg.Clone("RecoFwd_Displacement_X_Neg")

Definition at line 81 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_x_pos = bkwd_x_pos.Clone("RecoFwd_Displacement_X_Pos")

Definition at line 80 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_y_neg = bkwd_y_neg.Clone("RecoFwd_Displacement_Y_Neg")

Definition at line 83 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_y_pos = bkwd_y_pos.Clone("RecoFwd_Displacement_Y_Pos")

Definition at line 82 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_z_neg = bkwd_z_neg.Clone("RecoFwd_Displacement_Z_Neg")

Definition at line 79 of file make_fwd_distortions.py.

make_fwd_distortions.fwd_z_pos = bkwd_z_pos.Clone("RecoFwd_Displacement_Z_Pos")

Definition at line 78 of file make_fwd_distortions.py.

make_fwd_distortions.help

Definition at line 8 of file make_fwd_distortions.py.

make_fwd_distortions.parser = ap()

Definition at line 7 of file make_fwd_distortions.py.

make_fwd_distortions.str

Definition at line 8 of file make_fwd_distortions.py.

make_fwd_distortions.tri_neg_corr = Delaunay(bkwd_neg_corrected_array)

Definition at line 95 of file make_fwd_distortions.py.

make_fwd_distortions.tri_pos_corr = Delaunay(bkwd_pos_corrected_array)

Definition at line 94 of file make_fwd_distortions.py.

make_fwd_distortions.type

Definition at line 8 of file make_fwd_distortions.py.