Package cnuphys.swim
Class BeamLineStopper
java.lang.Object
cnuphys.swim.BeamLineStopper
- All Implemented Interfaces:
IStopper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the final path length in metersvoid
setFinalT
(double finalPathLength) Set the final path length in metersboolean
stopIntegration
(double t, double[] y) Given the current state of the integration, should we stop?static double[]
SwimToBeamLine
(int charge, double xo, double yo, double zo, double pTot, double theta, double phi, double maxS, double stepSize, double distBetweenSaves, double xB, double yB) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cnuphys.rk4.IStopper
terminateIntegration
-
Constructor Details
-
BeamLineStopper
public BeamLineStopper(double xB, double yB)
-
-
Method Details
-
stopIntegration
public boolean stopIntegration(double t, double[] y) Description copied from interface:IStopper
Given the current state of the integration, should we stop? This allows the integration to stop, for example, if some distance from the origin has been exceeded or if the independent variable passes some threshold. It won't be precise, because the check may not happen on every step, but it should be close.- Specified by:
stopIntegration
in interfaceIStopper
- Parameters:
t
- the current value of the independent variable (typically pathlength)y
- the current state vector (typically [x, y, z, vx, vy, vz])- Returns:
true
if we should stop now.
-
getFinalT
public double getFinalT()Get the final path length in meters -
setFinalT
public void setFinalT(double finalPathLength) Set the final path length in meters -
SwimToBeamLine
public static double[] SwimToBeamLine(int charge, double xo, double yo, double zo, double pTot, double theta, double phi, double maxS, double stepSize, double distBetweenSaves, double xB, double yB) - Parameters:
charge
-charge
- the charge: -1 for electron, 1 for proton, etcxo
- the x vertex position in metersyo
- the y vertex position in meterszo
- the z vertex position in meterspTot
- momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesmaxS
- max path length in meters. This determines the max number of steps based on the step size. If a stopper is used, the integration might terminate before all the steps are taken. A reasonable value for CLAS is 8. metersstepSize
- the uniform step size in meters.distBetweenSaves
- this distance is in meters. It should be bigger than stepSize. It is approximately the distance between "saves" where the point is saved in a trajectory for later drawing.xB
- max x distance to be considered on beam line (m)yB
- max y distance to be considered on beam line (m)- Returns:
- final state vector
-