Package cnuphys.swim

Class SwimTrajectory

All Implemented Interfaces:
Serializable, Cloneable, Iterable<double[]>, Collection<double[]>, List<double[]>, RandomAccess

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

    • X_IDX

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

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

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

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

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

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

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

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

      public Object 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 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

      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

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

    • clear

      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

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

      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

      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

      public GeneratedParticleRecord 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)
      Specified by:
      add in interface Collection<double[]>
      Specified by:
      add in interface List<double[]>
      Overrides:
      add in class ArrayList<double[]>
    • 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 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

      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

      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

      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

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

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

      public void setSource(String source)
      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

      public void print(PrintStream ps)