Package cnuphys.swim
Class Swimmer
java.lang.Object
cnuphys.swim.Swimmer
Handles the swimming of a particle through a magnetic field.
- Author:
- heddle
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ButcherTableau
static final double
static double[]
static Logger
static final double
static final double
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionSwimmer()
Create a swimmer using the current active fieldCreate a swimmer specific to a magnetic fieldSwimmer
(MagneticField magneticField) Create a swimmer specific to a magnetic field -
Method Summary
Modifier and TypeMethodDescriptionstatic double
getEps()
Get the tolerance used by the CLAS_Toleance arraygetProbe()
Get the underlying field probestatic final String
Return the version stringstatic double
radiusOfCurvature
(int Q, double p, double B) Compute the radius of curvature in cmsectorSwim
(int sector, int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle in a sector coordinate system.sectorSwim
(int sector, int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle in a sector coordinate system.static void
setCLASTolerance
(double eps) Set the tolerance used by the CLAS_Tolerance arrayswim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double rmax, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a Lund particle with a built in stopper for the maximum value of the radial coordinate.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a particle with a built it stopper for the maximum value of the radial coordinate.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double d, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double d, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.int
swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IRkListener listener, double rmax, double maxPathLength, double stepSize) Swims a Lund particle with a built it stopper for the maximum value of the radial coordinate.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a Lund particle with a built it stopper for the maximum value of the radial coordinate.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double maxPathLength, double stepSize, double tolerance, double[] hdata) Swims a charged particle.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double s0, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.int
swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize) Swims a charged particle.int
swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle for the listener mode, where a callback is called for each advance of the integration Uses an adaptive stepsize algorithm.int
swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize, double tolerance, double[] hdata) Swims a Lund particle for the listener mode, where a callback is called for each advance of the integration Uses an adaptive stepsize algorithm.swim
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, Plane plane, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) Swims a charged particle.static SwimTrajectory
swimBackwardsToVertex
(int q, double xo, double yo, double zo, double px, double py, double pz) void
swimCylinder
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double[] centerLineP1, double[] centerLineP2, double radius, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) Swims a particle with a built in stopper at the boundary of an arbitrary cylinder.void
swimCylinder
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double[] centerLineP1, double[] centerLineP2, double radius, double accuracy, double sMax, double stepSize, AdaptiveSwimResult result) Swims a particle with a built in stopper at the boundary of an arbitrary cylinder.void
swimPlane
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double pointX, double pointY, double pointZ, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) void
swimRho
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedRho, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) Swims a particle with a built in stopper for the rho coordinate.void
swimRho
(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedRho, double accuracy, double sMax, double stepSize, AdaptiveSwimResult result) Swims a particle with a built it stopper for the rho coordinate.
-
Field Details
-
LOGGER
-
C
public static final double C- See Also:
-
MINMOMENTUM
public static final double MINMOMENTUM- See Also:
-
SMAX_TOLERANCE
public static final double SMAX_TOLERANCE- See Also:
-
_defaultTableau
-
CLAS_Tolerance
public static double[] CLAS_Tolerance -
VERSION
- See Also:
-
-
Constructor Details
-
Swimmer
public Swimmer()Create a swimmer using the current active field -
Swimmer
Create a swimmer specific to a magnetic field- Parameters:
magneticField
- the magnetic field
-
Swimmer
Create a swimmer specific to a magnetic field- Parameters:
magneticField
- the magnetic field
-
-
Method Details
-
getVersion
Return the version string- Returns:
- the version string
-
getProbe
Get the underlying field probe- Returns:
- the probe
-
radiusOfCurvature
public static double radiusOfCurvature(int Q, double p, double B) Compute the radius of curvature in cm- Parameters:
Q
- the charge in units of ep
- the momentum in GeV/cB
- the field in kG- Returns:
- the radius in cm.
-
setCLASTolerance
public static void setCLASTolerance(double eps) Set the tolerance used by the CLAS_Tolerance array- Parameters:
eps
- the baseline tolerance. The default is 1.0e-5. Probably should stay in the range 1e-10 (accurate but slow) to 1e-4 (inaccurate but fast)
-
swimCylinder
public void swimCylinder(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double[] centerLineP1, double[] centerLineP2, double radius, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) throws RungeKuttaException Swims a particle with a built in stopper at the boundary of an arbitrary cylinder. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreescenterLineP1
- one point [array: (x, y, z)] on the infinite center line (meters)centerLineP2
- another point [array: (x, y, z)] on the infinite center line (meters)radius
- the radius of the cylinder in metersaccuracy
- the accuracy of the fixed rho termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}result
- upon return, results from the swim including the final state vector [x, y, z, px/p, py/p, pz/p]- Throws:
RungeKuttaException
-
swimCylinder
public void swimCylinder(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double[] centerLineP1, double[] centerLineP2, double radius, double accuracy, double sMax, double stepSize, AdaptiveSwimResult result) Swims a particle with a built in stopper at the boundary of an arbitrary cylinder. Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreescenterLineP1
- one point [array: (x, y, z)] on the infinite center line (meters)centerLineP2
- another point [array: (x, y, z)] on the infinite center line (meters)radius
- the radius of the cylinder in meters maxPathLength if reached first)accuracy
- the accuracy of the fixed rho termination, in metersstopper
- an optional object that can terminate the swimming based on some conditionsMax
- 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.result
- upon return, results from the swim including the final state vector [x, y, z, px/p, py/p, pz/p]
-
swimRho
public void swimRho(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedRho, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) throws RungeKuttaException Swims a particle with a built in stopper for the rho coordinate. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedRho
- the fixed rho value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed rho termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}result
- upon return, results from the swim including the final state vector [x, y, z, px/p, py/p, pz/p]- Throws:
RungeKuttaException
-
swimRho
public void swimRho(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedRho, double accuracy, double sMax, double stepSize, AdaptiveSwimResult result) Swims a particle with a built it stopper for the rho coordinate. Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedRho
- the fixed rho value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed rho termination, in metersstopper
- an optional object that can terminate the swimming based on some conditionsMax
- 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.result
- upon return, results from the swim including the final state vector [x, y, z, px/p, py/p, pz/p]
-
swimPlane
public void swimPlane(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double pointX, double pointY, double pointZ, double accuracy, double sMax, double stepSize, double[] relTolerance, AdaptiveSwimResult result) throws RungeKuttaException - Throws:
RungeKuttaException
-
getEps
public static double getEps()Get the tolerance used by the CLAS_Toleance array- Returns:
- the tolerance used by the CLAS_Toleance array
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a Lund particle with a built it stopper for the maximum value of the radial coordinate. This is for the trajectory mode, where you want to cache steps along the path. Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionmaxPathLength
- 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.distanceBetweenSaves
- 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.- Returns:
- the trajectory of the particle
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double rmax, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a Lund particle with a built in stopper for the maximum value of the radial coordinate. This is for the trajectory mode, where you want to cache steps along the path. Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesrmax
- the max radial coordinate in meters.maxPathLength
- in meters. This is used to compute the maximum number of integration steps.stepSize
- either the initial stepsize or the constant step size based on the integration method. Units are meters.distanceBetweenSaves
- this should be bigger than stepSize. It is approximately the distance between "saves" where the point is saved in a trajectory for later drawing.- Returns:
- the trajectory of the particle
-
swim
public int swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize) Swims a charged particle. This is for the listener mode, where a callback is called for each advance of the integration Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionlistener
- a callback object that is called on every stepmaxPathLength
- 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.- Returns:
- the total number of steps taken
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double maxPathLength, double stepSize, double distanceBetweenSaves) Swims a particle with a built it stopper for the maximum value of the radial coordinate. This is for the trajectory mode, where you want to cache steps along the path. Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedZ
- the fixed z value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed z termination, in metersstopper
- an optional object that can terminate the swimming based on some conditionmaxPathLength
- 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.distanceBetweenSaves
- 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.- Returns:
- the trajectory of the particle
-
sectorSwim
public SwimTrajectory sectorSwim(int sector, int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle in a sector coordinate system. This swims to a fixed z value. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm. THIS IS ONLY VALID IF THE FIELD IS A RotatedComnpositeField or RotatedCompositeProbe- Parameters:
sector
- the sector [1..6]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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedZ
- the fixed z value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed z termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
sectorSwim
public SwimTrajectory sectorSwim(int sector, int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle in a sector coordinate system. This swims to a fixed z value. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm. THIS IS ONLY VALID IF THE FIELD IS A RotatedComnpositeField or RotatedCompositeProbe- Parameters:
sector
- the sector [1..6]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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedZ
- the fixed z value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed z termination, in metersmaxRad
- the max radial coordinate NOTE: NO LONGER USED (here for backwards compatibility)sMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double d, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This swims to a fixed plane. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesnormX
- the x component of the normal vectornormY
- the y component of the normal vectornormZ
- the z component of the normal vectord
- the distance from the origin to the planeaccuracy
- the accuracy of the distance from plane termination, in metersmaxRad
- the max radial coordinate NOTE: NO LONGER USED (here for backwards compatibility)sMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double normX, double normY, double normZ, double d, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This swims to a fixed plane. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesnormX
- the x component of the normal vectornormY
- the y component of the normal vectornormZ
- the z component of the normal vectord
- the distance from the origin to the planeaccuracy
- the accuracy of the fixed z termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, Plane plane, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This swims to a fixed plane. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesplane
- the plane to swim toaccuracy
- the accuracy of the fixed z termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double maxRad, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This swims to a fixed z value. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedZ
- the fixed z value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed z termination, in metersmaxRad
- the max radial coordinate NOTE: NO LONGER USED (here for backwards compatibility)sMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, double fixedZ, double accuracy, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This swims to a fixed z value. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesfixedZ
- the fixed z value (meters) that terminates (or maxPathLength if reached first)accuracy
- the accuracy of the fixed z termination, in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionsMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double s0, double sMax, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditions0
- Starting path length in meterssMax
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] is the min stepsize used (m), hdata[1] is the average stepsize used (m), and hdata[2] is the max stepsize (m) used- Returns:
- the trajectory of the particle
- Throws:
RungeKuttaException
-
swim
public int swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize, double[] relTolerance, double[] hdata) throws RungeKuttaException Swims a charged particle for the listener mode, where a callback is called for each advance of the integration Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionlistener
- a callback object that is called on every stepmaxPathLength
- 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 initial step size in meters.relTolerance
- the error tolerance as fractional diffs. Note it is a vector, the same dimension of the problem, e.g., 6 for [x,y,z,vx,vy,vz]. It might be something like {1.0e-10, 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8, 1.0e-8}hdata
- if not null, should be double[3]. Upon return, hdata[0] (m) is the min stepsize used, hdata[1] (m) is the average stepsize used, and hdata[2] (m) is the max stepsize used- Returns:
- the total number of steps taken
- Throws:
RungeKuttaException
-
swim
public SwimTrajectory swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, double maxPathLength, double stepSize, double tolerance, double[] hdata) throws RungeKuttaException Swims a charged particle. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionmaxPathLength
- 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 initial step size in meters.tolerance
- the required accuracy, something like 1.0e07hdata
- if not null, should be double[3]. Upon return, hdata[0] (m) is the min stepsize used, hdata[1] (m) is the average stepsize used, and hdata[2] (m) is the max stepsize used Swims a Lund particle. This is for the trajectory mode, where you want to cache steps along the path. Uses an adaptive stepsize algorithm.- Throws:
RungeKuttaException
-
swim
public int swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IStopper stopper, IRkListener listener, double maxPathLength, double stepSize, double tolerance, double[] hdata) throws RungeKuttaException Swims a Lund particle for the listener mode, where a callback is called for each advance of the integration Uses an adaptive stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreesstopper
- an optional object that can terminate the swimming based on some conditionlistener
- a callback object that is called on every stepmaxPathLength
- 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 initial step size in meters.tolerance
- the required accuracy, something like 1.0e07hdata
- if not null, should be double[3]. Upon return, hdata[0] (m) is the min stepsize used, hdata[1] (m) is the average stepsize used, and hdata[2] (m) is the max stepsize used- Returns:
- the total number of steps taken
- Throws:
RungeKuttaException
-
swim
public int swim(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, IRkListener listener, double rmax, double maxPathLength, double stepSize) Swims a Lund particle with a built it stopper for the maximum value of the radial coordinate. This is for the listener method, where a callback is called for each advance of the integration Uses a fixed stepsize algorithm.- Parameters:
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 metersmomentum
- initial momentum in GeV/ctheta
- initial polar angle in degreesphi
- initial azimuthal angle in degreeslistener
- a callback object that is called on every steprmax
- the max radial coordinate in meters.maxPathLength
- in meters. This determines the max number of steps based on the step size. all the steps are taken. A reasonable value for CLAS is 8. metersstepSize
- the uniform step size in meters.- Returns:
- the total number of steps taken
-
swimBackwardsToVertex
public static SwimTrajectory swimBackwardsToVertex(int q, double xo, double yo, double zo, double px, double py, double pz) - Parameters:
q
- the charge: -1 for electron, 1 for proton, etcxo
- the x start position in metersyo
- the y start position in meterszo
- the z start position in meterspx
- the x start momentum in GeV/cpy
- the y start momentum in GeV/cpz
- the z start momentum in GeV/c
-