Class SwimTrajectory

java.lang.Object
java.util.AbstractCollection<double[]>
java.util.AbstractList<double[]>
java.util.ArrayList<double[]>
cnuphys.swim.SwimTrajectory
All Implemented Interfaces:
Serializable, Cloneable, Iterable<double[]>, Collection<double[]>, List<double[]>, RandomAccess, SequencedCollection<double[]>

public class SwimTrajectory extends ArrayList<double[]> implements Serializable
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]
Author:
heddle
See Also:
  • Field Details Link icon

    • X_IDX Link icon

      public static final int X_IDX
      index for the x component (m)
      See Also:
    • Y_IDX Link icon

      public static final int Y_IDX
      index for the y component (m)
      See Also:
    • Z_IDX Link icon

      public static final int Z_IDX
      index for the z component (m)
      See Also:
    • DIRCOSX_IDX Link icon

      public static final int DIRCOSX_IDX
      index for the px/p direction cosine
      See Also:
    • DIRCOSY_IDX Link icon

      public static final int DIRCOSY_IDX
      index for the py/p direction cosine
      See Also:
    • DIRCOSZ_IDX Link icon

      public static final int DIRCOSZ_IDX
      index for the pz/p direction cosine
      See Also:
    • PATHLEN_IDX Link icon

      public static final int PATHLEN_IDX
      index for the accumulated path length (m)
      See Also:
    • BXDL_IDX Link icon

      public static final int BXDL_IDX
      index for the accumulated integral |B x dL| component (kG-m)
      See Also:
    • userObject Link icon

      public Object userObject
      user object
  • Constructor Details Link icon

    • SwimTrajectory Link icon

      public SwimTrajectory()
      Create a swim trajectory with no initial content
    • SwimTrajectory Link icon

      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 m
      yo - the y vertex position in m
      zo - the z vertex position in m
      momentum - initial momentum in GeV/c
      theta - initial polar angle in degrees
      phi - initial azimuthal angle in degrees
    • SwimTrajectory Link icon

      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 m
      yo - the y vertex position in m
      zo - the z vertex position in m
      momentum - initial momentum in GeV/c
      theta - initial polar angle in degrees
      phi - initial azimuthal angle in degrees
      initialCapacity - the initial capacity of the trajectory list
    • SwimTrajectory Link icon

      public SwimTrajectory(GeneratedParticleRecord genPartRec, int initialCapacity)
      Parameters:
      genPartRec - the generated particle record
      initialCapacity - the initial capacity of the trajectory list
  • Method Details Link icon

    • clear Link icon

      public void clear()
      Clear the trajectory
      Specified by:
      clear in interface Collection<double[]>
      Specified by:
      clear in interface List<double[]>
      Overrides:
      clear in class ArrayList<double[]>
    • setGeneratedParticleRecord Link icon

      public void setGeneratedParticleRecord(GeneratedParticleRecord genPart)
      Set the generated particle record
      Parameters:
      genPart - the generated particle record
    • setLundId Link icon

      public void setLundId(LundId lundId)
      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 Link icon

      public LundId getLundId()
      Get the lund id. This is not needed for swimming, and may be null. It is useful for ced or when MonteCarlo truth is known. return the Lund Id.
    • getGeneratedParticleRecord Link icon

      public GeneratedParticleRecord getGeneratedParticleRecord()
      Get the underlying generated particle record
      Returns:
      the underlying generated particle record
    • getOriginalTheta Link icon

      public double getOriginalTheta()
      Get the original theta for this trajectory
      Returns:
      the original theta for this trajectory in degrees
    • getOriginalPhi Link icon

      public double getOriginalPhi()
      Get the original phi for this trajectory
      Returns:
      the original phi for this trajectory in degrees
    • getR Link icon

      public double getR(int index)
      Get the r coordinate in cm for the given index
      Parameters:
      index - the index
      Returns:
      the r coordinate
    • add Link icon

      public boolean add(double[] u)
      Specified by:
      add in interface Collection<double[]>
      Specified by:
      add in interface List<double[]>
      Overrides:
      add in class ArrayList<double[]>
    • add Link icon

      public boolean add(double[] u, double s)
    • add Link icon

      public void add(double xo, double yo, double zo, double momentum, double theta, double phi)
      Parameters:
      xo - the x vertex position in m
      yo - the y vertex position in m
      zo - the z vertex position in m
      momentum - initial momentum in GeV/c
      theta - initial polar angle in degrees
      phi - initial azimuthal angle in degrees
    • getAveragePhi Link icon

      public double getAveragePhi()
      Get the average phi for this trajectory based on positions, not directions
      Returns:
      the average phi value in degrees
    • lastElement Link icon

      public double[] lastElement()
      Get the last element
      Returns:
      the last element
    • getFinalR Link icon

      public double getFinalR()
      Get the final radial coordinate
      Returns:
      final radial coordinate in meters
    • getComputedBDL Link icon

      public double getComputedBDL()
      Get the total BDL integral if computed
      Returns:
      the total BDL integral in kG-m
    • computeBDL Link icon

      public void computeBDL(FieldProbe probe)
      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 Link icon

      public void sectorComputeBDL(int sector, RotatedCompositeProbe probe)
      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..6
      probe - the field getter
    • isBDLComputed Link icon

      public boolean isBDLComputed()
      Check whether the accumulated integral bdl has been computed
      Returns:
      true if the accumulated integral bdl has been computed
    • getSource Link icon

      public String getSource()
      Get the source of the trajectory e.g. hbtracking
      Returns:
      the source of the trajectory
    • setSource Link icon

      public void setSource(String source)
      Set the source of the trajectory e.g. hbtracking
      Parameters:
      source - the source of the trajectory
    • getArray Link icon

      public double[] getArray(int index)
      Get an array of elements of the state vector
      Parameters:
      index - the desired element index
      Returns:
      the array
    • getX Link icon

      public double[] getX()
    • getY Link icon

      public double[] getY()
    • getZ Link icon

      public double[] getZ()
    • print Link icon

      public void print(PrintStream ps)