1 package org.lcsim.geometry.field;
2
3 import hep.physics.vec.BasicHep3Vector;
4
5 import org.jdom.Element;
6 import org.jdom.JDOMException;
7
8
9
10
11
12
13
14 public class BoxDipole extends AbstractFieldMap
15 {
16 private double x, y, z, dx, dy, dz, bx, by, bz;
17 private double xmax, ymax, zmax, xmin, ymin, zmin;
18
19 BoxDipole(Element node) throws JDOMException
20 {
21 super(node);
22
23 x = node.getAttribute("x").getDoubleValue();
24 y = node.getAttribute("y").getDoubleValue();
25 z = node.getAttribute("z").getDoubleValue();
26 dx = node.getAttribute("dx").getDoubleValue();
27 dy = node.getAttribute("dy").getDoubleValue();
28 dz = node.getAttribute("dz").getDoubleValue();
29 bx = node.getAttribute("bx").getDoubleValue();
30 by = node.getAttribute("by").getDoubleValue();
31 bz = node.getAttribute("bz").getDoubleValue();
32
33 xmax = x + dx;
34 xmin = x - dx;
35 ymax = y + dy;
36 ymin = y - dy;
37 zmax = z + dz;
38 zmin = z - dz;
39 }
40
41 void getField(double x, double y, double z, BasicHep3Vector field)
42 {
43
44 if (x > xmax || x < xmin)
45 return;
46 if (y > ymax || y < ymin)
47 return;
48 if (z > zmax || z < zmin)
49 return;
50
51
52 double obx = field.x();
53 double oby = field.y();
54 double obz = field.z();
55 field.setV(bx + obx, by + oby, bz + obz);
56 }
57 }