Package cnuphys.swim
Class SwimTrajectory
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<double[]>
cnuphys.swim.SwimTrajectory
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<double[]>,Collection<double[]>,List<double[]>,RandomAccess
Combines a generated particle record with a path (trajectory). A trajectory
is a collection of state vectors. A state vector is the six component vector:
Q = [x, y, z, px/p, py/p, pz/p]
Q = [x, y, z, px/p, py/p, pz/p]
- Author:
- heddle
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intindex for the accumulated integral |B x dL| component (kG-m)static final intindex for the px/p direction cosinestatic final intindex for the py/p direction cosinestatic final intindex for the pz/p direction cosinestatic final intindex for the accumulated path length (m)user objectstatic final intindex for the x component (m)static final intindex for the y component (m)static final intindex for the z component (m)Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreate a swim trajectory with no initial contentSwimTrajectory(int charge, double xo, double yo, double zo, double momentum, double theta, double phi) Create a one point trajectory.SwimTrajectory(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, int initialCapacity) SwimTrajectory(GeneratedParticleRecord genPartRec, int initialCapacity) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(double[] u) booleanadd(double[] u, double s) voidadd(double xo, double yo, double zo, double momentum, double theta, double phi) voidclear()Clear the trajectoryvoidcomputeBDL(FieldProbe probe) Compute the integral B cross dl.double[]getArray(int index) Get an array of elements of the state vectordoubleGet the average phi for this trajectory based on positions, not directionsdoubleGet the total BDL integral if computeddoubleGet the final radial coordinateGet the underlying generated particle recordGet the lund id.doubleGet the original phi for this trajectorydoubleGet the original theta for this trajectorydoublegetR(int index) Get the r coordinate in cm for the given indexGet the source of the trajectory e.g. hbtrackingdouble[]getX()double[]getY()double[]getZ()booleanCheck whether the accumulated integral bdl has been computeddouble[]Get the last elementvoidprint(PrintStream ps) voidsectorComputeBDL(int sector, RotatedCompositeProbe probe) Compute the integral B cross dl.voidSet the generated particle recordvoidSet the lund id.voidSet the source of the trajectory e.g. hbtrackingMethods inherited from class java.util.ArrayList
add, addAll, addAll, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Field Details
-
X_IDX
public static final int X_IDXindex for the x component (m)- See Also:
-
Y_IDX
public static final int Y_IDXindex for the y component (m)- See Also:
-
Z_IDX
public static final int Z_IDXindex for the z component (m)- See Also:
-
DIRCOSX_IDX
public static final int DIRCOSX_IDXindex for the px/p direction cosine- See Also:
-
DIRCOSY_IDX
public static final int DIRCOSY_IDXindex for the py/p direction cosine- See Also:
-
DIRCOSZ_IDX
public static final int DIRCOSZ_IDXindex for the pz/p direction cosine- See Also:
-
PATHLEN_IDX
public static final int PATHLEN_IDXindex for the accumulated path length (m)- See Also:
-
BXDL_IDX
public static final int BXDL_IDXindex for the accumulated integral |B x dL| component (kG-m)- See Also:
-
userObject
user object
-
-
Constructor Details
-
SwimTrajectory
public SwimTrajectory()Create a swim trajectory with no initial content -
SwimTrajectory
public SwimTrajectory(int charge, double xo, double yo, double zo, double momentum, double theta, double phi) Create a one point trajectory. Used hrn the initial momentum is lower than some minimum value.- Parameters:
charge- the charge of the particle (-1 for electron, +1 for proton, etc.)xo- the x vertex position in myo- the y vertex position in mzo- the z vertex position in mmomentum- initial momentum in GeV/ctheta- initial polar angle in degreesphi- initial azimuthal angle in degrees
-
SwimTrajectory
public SwimTrajectory(int charge, double xo, double yo, double zo, double momentum, double theta, double phi, int initialCapacity) - Parameters:
charge- the charge of the particle (-1 for electron, +1 for proton, etc.)xo- the x vertex position in myo- the y vertex position in mzo- the z vertex position in mmomentum- initial momentum in GeV/ctheta- initial polar angle in degreesphi- initial azimuthal angle in degreesinitialCapacity- the initial capacity of the trajectory list
-
SwimTrajectory
- Parameters:
genPartRec- the generated particle recordinitialCapacity- the initial capacity of the trajectory list
-
-
Method Details
-
clear
public void clear()Clear the trajectory -
setGeneratedParticleRecord
Set the generated particle record- Parameters:
genPart- the generated particle record
-
setLundId
Set the lund id. This is not needed for swimming, but is useful for ced or when MonteCarlo truth is known.- Parameters:
lundId- the Lund Id.
-
getLundId
Get the lund id. This is not needed for swimming, and may benull. It is useful for ced or when MonteCarlo truth is known. return the Lund Id. -
getGeneratedParticleRecord
Get the underlying generated particle record- Returns:
- the underlying generated particle record
-
getOriginalTheta
public double getOriginalTheta()Get the original theta for this trajectory- Returns:
- the original theta for this trajectory in degrees
-
getOriginalPhi
public double getOriginalPhi()Get the original phi for this trajectory- Returns:
- the original phi for this trajectory in degrees
-
getR
public double getR(int index) Get the r coordinate in cm for the given index- Parameters:
index- the index- Returns:
- the r coordinate
-
add
public boolean add(double[] u) -
add
public boolean add(double[] u, double s) -
add
public void add(double xo, double yo, double zo, double momentum, double theta, double phi) - Parameters:
xo- the x vertex position in myo- the y vertex position in mzo- the z vertex position in mmomentum- initial momentum in GeV/ctheta- initial polar angle in degreesphi- initial azimuthal angle in degrees
-
getAveragePhi
public double getAveragePhi()Get the average phi for this trajectory based on positions, not directions- Returns:
- the average phi value in degrees
-
lastElement
public double[] lastElement()Get the last element- Returns:
- the last element
-
getFinalR
public double getFinalR()Get the final radial coordinate- Returns:
- final radial coordinate in meters
-
getComputedBDL
public double getComputedBDL()Get the total BDL integral if computed- Returns:
- the total BDL integral in kG-m
-
computeBDL
Compute the integral B cross dl. This will cause the state vector arrays to expand by two, becoming [x, y, z, px/p, py/p, pz/p, l, bdl] where the 7th entry l is cumulative pathlength in m and the eighth entry bdl is the cumulative integral bdl in kG-m.- Parameters:
probe- the field getter
-
sectorComputeBDL
Compute the integral B cross dl. This will cause the state vector arrays to expand by two, becoming [x, y, z, px/p, py/p, pz/p, l, bdl] where the 7th entry l is cumulative pathlength in m and the eighth entry bdl is the cumulative integral bdl in kG-m.- Parameters:
sector- sector 1..6probe- the field getter
-
isBDLComputed
public boolean isBDLComputed()Check whether the accumulated integral bdl has been computed- Returns:
trueif the accumulated integral bdl has been computed
-
getSource
Get the source of the trajectory e.g. hbtracking- Returns:
- the source of the trajectory
-
setSource
Set the source of the trajectory e.g. hbtracking- Parameters:
source- the source of the trajectory
-
getArray
public double[] getArray(int index) Get an array of elements of the state vector- Parameters:
index- the desired element index- Returns:
- the array
-
getX
public double[] getX() -
getY
public double[] getY() -
getZ
public double[] getZ() -
print
-