-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagnetTrack.java
More file actions
71 lines (60 loc) · 1.79 KB
/
MagnetTrack.java
File metadata and controls
71 lines (60 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.io.*;
public class MagnetTrack
{
static PrintWriter screen = new PrintWriter (System.out, true);
protected final static double B = 4;
protected final static double R = 1.2;
protected static double px, py, angleI, pT, E, pz, Q, Delta, Phi, x, y, z, l, ZAngle;
public static void MagnetTracker( double Energy, double Px, double Py, double Pz, double Charge)
{
E = Energy;
px = Px;
py = Py;
pz = Pz;
Q = Charge;
angleI = Math.atan2(py,px); //calculates little phi
pT = Math.sqrt((px*px)+(py*py)); //perpendicular momentum
ZAngle = Math.atan2(pz,pT);
Delta = 1000*0.3*B*R*Q/(2*pT);
Phi = angleI + Delta; //calculates big phi
x = 100*R*Math.cos(Phi); //exit x coordinate
y = 100*R*Math.sin(Phi); //exit x coordinate
l = Math.sqrt((x*x)+(y*y));
z = l*Math.tan(ZAngle);
//screen.println("px= " +px+ "py= " +py);
//screen.println("angleI = " +angleI+ " , pT = " +pT+ ", Delta = " +Delta+ ", Phi = " +Phi+ ", (x,y,z) = (" +x+ "," +y+ "," +z+ ")");
}
public static double getInitialAngle()
{
return angleI;
}
public static double getInitialMomentum()
{
return pT;
}
public static double getDelta()
{
return Delta;
}
public static double getPhi()
{
//screen.println("phi" + Phi);
return Phi;
}
public static double getE()
{
return E;
}
public static double getX()
{
return x;
}
public static double getY()
{
return y;
}
public static double getZAngle()
{
return ZAngle;
}
}