public interface IntersectionCalculator
Interface for the IntersectionCalculator implementations. The implementation
of this interface takes trajectory data of a single particle in a ring or a
beam in a transfer line and provides method to calculate intersections with
disks placed along the reference orbit provided. From the intersections the
phase space coordinates are calculated.
- Author:
- lbojtar
-
Method Summary
Modifier and TypeMethodDescriptiongetDisks()
Get the observer disks along the reference orbit.static IntersectionCalculator
getInstance
(String fileName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) Gets an implementation of this interface.static IntersectionCalculator
getInstanceForBeam
(String beamName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) Gets an implementation of this interface for a beam trajectory.static IntersectionCalculator
getInstanceForBeam
(Map<String, List<TrajectoryData>> trajectoryMap, ReferenceOrbit designOrbit, double diskRadius, boolean backward) Gets an implementation of this interface for a beam trajectory.static IntersectionCalculator
getInstanceForParticle
(String particleName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) Gets an implementation of this interface for a single particle trajectory.static IntersectionCalculator
getInstanceForParticle
(List<TrajectoryData> trajectoryData, ReferenceOrbit designOrbit, double diskRadius, boolean backward) Gets an implementation of this interface for a single particle trajectory.Get a list of intersection data along the reference orbit.static Map
<String, List<IntersectionData>> getNameMap
(List<IntersectionData> isData) Helper method to organize intersection data by particle namestatic Map
<Integer, List<PhaseSpaceCoordinates>> getPhaseSpaceCoordinates
(List<IntersectionData> isData) A helper method to organize the intsections along the orbit.void
phaseSpaceToFile
(String fileName) Writes the phase space coordinates to a file.
-
Method Details
-
getInstance
static IntersectionCalculator getInstance(String fileName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) throws IOException Gets an implementation of this interface. The file name parameter must follow theFileNamingConventions
, since the instance returned depends on the file name.- Parameters:
fileName
- A file name for a single particle or a beam trajectory according to theFileNamingConventions
.designOrbit
- The design orbit of the machine or transfer line.diskRadius
- Radius of the observer disks to be used. SeeObserverDisk
.backward
- Must be set true when tracking backward.- Returns:
- An instance for a single particle or a beam, depending of the fileName parameter.
- Throws:
IOException
-
getInstanceForParticle
static IntersectionCalculator getInstanceForParticle(List<TrajectoryData> trajectoryData, ReferenceOrbit designOrbit, double diskRadius, boolean backward) throws IOException Gets an implementation of this interface for a single particle trajectory.- Parameters:
trajectoryData
- The trajectory data obtained from a single particle tracking in a ring or a transfer line.designOrbit
- The design orbit belonging to the ring or transfer line.diskRadius
- Observer disk radius. It must be big enough t cover the aperture, but should not intersect it twice. ( This might happen with a big radius in a ring.)backward
- Must be set true when tracking backward.- Returns:
- An implementation of this interface.
- Throws:
IOException
-
getInstanceForParticle
static IntersectionCalculator getInstanceForParticle(String particleName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) throws IOException Gets an implementation of this interface for a single particle trajectory.- Parameters:
particleName
- Particle name. A trajectory file belonging to the particle named according to theFileNamingConventions
must be present.designOrbit
- The design orbit belonging to the ring or transfer line.diskRadius
- Observer disk radius. It must be big enough t cover the aperture, but should not intersect it twice. ( This might happen with a big radius in a ring.)backward
- Must be set true when tracking backward.- Returns:
- An implementation of this interface.
- Throws:
IOException
-
getInstanceForBeam
static IntersectionCalculator getInstanceForBeam(String beamName, ReferenceOrbit designOrbit, double diskRadius, boolean backward) throws IOException Gets an implementation of this interface for a beam trajectory.- Parameters:
beamName
- Beam name. A trajectory file belonging to the beam named according to theFileNamingConventions
must be present.designOrbit
- The design orbit belonging to a transfer line. Trajectory observers are not supported for rings.diskRadius
- Observer disk radius. It must be big enough t cover the aperture, but should not intersect it twice.backward
- Must be set true when tracking backward.- Returns:
- An implementation of this interface.
- Throws:
IOException
-
getInstanceForBeam
static IntersectionCalculator getInstanceForBeam(Map<String, List<TrajectoryData>> trajectoryMap, ReferenceOrbit designOrbit, double diskRadius, boolean backward) throws IOExceptionGets an implementation of this interface for a beam trajectory.- Parameters:
trajectoryMap
- The trajectory data map obtained from tracking a beam in a transfer line.designOrbit
- The design orbit belonging to a transfer line. Trajectory observers are not supported for rings.diskRadius
- Observer disk radius. It must be big enough t cover the aperture, but should not intersect it twice.backward
- Must be set true when tracking backward.- Returns:
- An implementation of this interface.
- Throws:
IOException
-
getPhaseSpaceCoordinates
static Map<Integer,List<PhaseSpaceCoordinates>> getPhaseSpaceCoordinates(List<IntersectionData> isData) A helper method to organize the intsections along the orbit.- Parameters:
isData
- List of intersections.- Returns:
- A map of PhaseSpaceCoordinates. Key is the orbit index, value is a list of phase space coordinates at that index. The key is sorted in ascending order.
-
getNameMap
Helper method to organize intersection data by particle name- Parameters:
isData
- List of intersections.- Returns:
- Map of intersection data. The key is the particle name, value is a list of intersections belonging to the particle name. The lists are sorted in ascending order according to the orbit index.
-
getIntersections
List<IntersectionData> getIntersections()Get a list of intersection data along the reference orbit. The data in the lists belong to intersection points with a beam in case of a transfer line or intersections with a single particle during consecutive turns in a ring.- Returns:
- List of intersection data.
-
getDisks
List<ObserverDisk> getDisks()Get the observer disks along the reference orbit. There is one disk at each point of the reference orbit.- Returns:
- observer disks.
-
phaseSpaceToFile
Writes the phase space coordinates to a file. In case of a ring the consecutive turns in a ring or the particles in a beam are separated with empty lines.- Parameters:
fileName
- Output file name.
-