Class Probe<S extends ProbeState<S>>
- Direct Known Subclasses:
BunchProbe,DiagnosticProbe,ParticleProbe,TransferMapProbe
Provides a base class implementation of the IProbe interface that is useful for most standard probe types. This class provides most of the functionality necessary for the implementation of the IProbe interface, except a definition and implementation of a probe "state". Thus, it is up to base classes to provide and implement the particular aspect of a beam the probe represents.
- Author:
- Christopher K. Allen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringelement tag for comment datastatic final Stringelement tag for probe dataprotected Scurrent state of the probe - defines the probeprotected static final Stringattribute tag for comment textprotected static final Stringattribute tag for the time stampprotected Trajectory<S>Current probe trajHistprotected static final Stringattribute tag for probe type nameFields inherited from interface xal.model.IProbe
LIGHT_SPEED, PERMITTIVITY, UNIT_CHARGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyState(S state) Apply the contents of ProbeState to update my current state.This method returns a clone of the current state of this probe.copy()Creates a deep copy of the probeabstract SCreates a new, blankProbeStateof the appropriate species.abstract SCaptures the probe's state in a ProbeState of the appropriate species.abstract Trajectory<S>Require concrete implementations to override this method to create aTrajectoryobject of the appropriate species.protected voidThis is a convenience function for derived classes when implementing their deepCopy() method.Return the algorithm defining the probes dynamics.Return the archiving interface for this object.doublegetBeta()Returns the probe velocity normalized to the speed of light.Returns the comment string associated with the probeReturns the id of the current lattice element that the probe is visiting.Get the type identifier string of the modeling element where this probe currently exists.Returns the identifier of the hardware modeled by the element associated with this state.Returns the current state object maintained by this probe.doublegetGamma()Returns the relativistic parameter corresponding to the probe velocity.Returns the initial state of this probe.doubleReturn the kinetic energy of the probe.doubleReturns the longitudinal phase of this probe with respect to the RF phase.doubleReturns the momentumdoubleReturns the current beam-line position of the probedoubleReturns the charge of probe's particle speciesreturns the species namedoubleReturns the rest energy of particle speciesdoublegetTime()Return the time elapsed since the probe began propagation.Returns the time stamp of the probe.Get the state history of the probe.voidInitializes the probe, resetting state as necessary.protected voidinitializeFrom(Probe<S> probe) Deprecated.This method is only called from child class overrides which are never called themselves.voidload(DataAdaptor daptSource) Load the contents of a probe from an data archive represented by aDataAdaptorinterface.ProbeState<?>lookupLastStateFor(String strElemTypeId) Looks up the last probe state created by a modeling element of the given identifier.static Probe<?>newProbeInitializedFrom(Probe<?> probeInit) Clone factory method.voidDeprecated.This method is called in several places I don't think it ever is implemented to do anything.static Probe<?>readFrom(DataAdaptor container) Read the contents of the suppliedDataAdaptorand return an instance of the appropriate Probe species.protected abstract SreadStateFrom(DataAdaptor container) Read the contents of the suppliedDataAdaptorand return an instance of the appropriate Trajectory species.voidreset()Resets the probe to the saved initial state, if there is one and clears the trajHist.voidsave(DataAdaptor daSink) Save the contents of a probe to a data archive represented by aDataAdaptorinterface.booleansetAlgorithm(IAlgorithm ifcAlg) Set the algorithm defining the probes dynamics through elementsvoidsetComment(String strComment) Provide a user comment associated with the probevoidSet the current lattice element id.voidsetCurrentElementTypeId(String strTypeId) Sets the type identifier string of the modeling element where this probe currently exists.voidsetCurrentHardwareId(String strSmfId) Sets the identifier of the hardware modeled by the current element.voidsetKineticEnergy(double w) Set the current kinetic energy of the probe.voidsetLongitudinalPhase(double dblPhsLng) Set the longitudinal phase of this probe with respect to the RF phase.voidsetPosition(double s) Set the current position of the probe along the beamline.voidsetSpeciesCharge(double q) Set the charge of the particle species in the beamvoidsetSpeciesName(String name) Set the species namevoidsetSpeciesRestEnergy(double eR) Set the rest energy of a single particle in the beamvoidsetTime(double dblTime) Set the current time since the probe began propagatingvoidsetTimestamp(Date dateStamp) Sets a time stamp for the probe.voidsetTracking(boolean bolTrack) Set particle trajHist tracking for probes.voidupdate()Save the probe state into trajHist.
-
Field Details
-
PROBE_LABEL
element tag for probe data- See Also:
-
TYPE_LABEL
attribute tag for probe type name- See Also:
-
TIME_LABEL
attribute tag for the time stamp- See Also:
-
COMMENT_LABEL
element tag for comment data- See Also:
-
TEXT_LABEL
attribute tag for comment text- See Also:
-
stateCurrent
current state of the probe - defines the probe -
trajHist
Current probe trajHist
-
-
Constructor Details
-
Probe
protected Probe()Creates a new instance of Probe. Since Probe is an abstract base only derived classes may call constructor. -
Probe
Creates a new instance of Probe. Since Probe is an abstract base only derived classes may call constructor.- Parameters:
ifcAlg- default dynamics algorithm for probe
-
Probe
Copy constructor for Probe. This constructor does a deep copy of the Probe base attributes by calling member support method deepCopyProbeBase().- Parameters:
probe- Probe object to be cloned
-
-
Method Details
-
readFrom
Read the contents of the suppliedDataAdaptorand return an instance of the appropriate Probe species.- Parameters:
container-DataAdaptorto read a Probe from- Returns:
- a Probe for the contents of the DataAdaptor
- Throws:
DataFormatException- error encountered reading the DataAdaptor
-
newProbeInitializedFrom
Clone factory method. Creates a new
Probeobject, of the appropriate type, initialized to the argumentProbe.NOTE:
There is now a reset() method that is preferable to this one. It clears the probe trajHist and restores the initial state saved in the initialize() method, without creating a new probe instance.
- Parameters:
probeInit-Probeobject containing initial data- Returns:
- new
Probeobject initialized to argument
-
createTrajectory
Require concrete implementations to override this method to create aTrajectoryobject of the appropriate species.- Returns:
- a
Trajectoryof the appropriate species for this probe type
-
createProbeState
Captures the probe's state in a ProbeState of the appropriate species. -
createEmptyProbeState
Creates a new, blankProbeStateof the appropriate species.- Returns:
- a new, blank
ProbeState - Since:
- Jul 1, 2014
-
readStateFrom
Read the contents of the suppliedDataAdaptorand return an instance of the appropriate Trajectory species.- Parameters:
container-DataAdaptorto read a Trajectory from- Returns:
- a ProbeState for the contents of the DataAdaptor
- Throws:
DataFormatException- error encountered reading the DataAdaptor
-
copy
Creates a deep copy of the probe -
setComment
Provide a user comment associated with the probe- Parameters:
strComment- user comment string
-
setTimestamp
Sets a time stamp for the probe.- Parameters:
dateStamp- time stamp for probe
-
setSpeciesName
Set the species name- Parameters:
name- the species name
-
setAlgorithm
Set the algorithm defining the probes dynamics through elements- Parameters:
ifcAlg- object exposing the IAlgorithm interface
-
setTracking
public void setTracking(boolean bolTrack) Set particle trajHist tracking for probes.- Parameters:
bolTrack- turn tracking on or off
-
initializeFrom
Deprecated.This method is only called from child class overrides which are never called themselves.Initialize this probe from the one specified.- Parameters:
probe- the probe from which to initialize this one
-
cloneCurrentProbeState
This method returns a clone of the current state of this probe. That is, theProbeStateobject is a representation of this probe at the moment this method was called.- Returns:
- a deep copy of the current state of this probe
- Since:
- Jun 26, 2014
-
applyState
Apply the contents of ProbeState to update my current state. Subclass implementations should call super.applyState to ensure superclass state is applied.- Parameters:
state-ProbeStateobject containing new probe state data
-
reset
public void reset()Resets the probe to the saved initial state, if there is one and clears the trajHist.
CKA NOTES:
These notes concern the refactoring of the probe component in order to tighten the typing.
· The new behavior should be the same as before, only the implementation differs. The current state is set to a clone of the (previously saved) initial state. · The trajectory is cleared. -
getComment
Returns the comment string associated with the probe- Returns:
- comment string
-
getTimestamp
Returns the time stamp of the probe.- Returns:
- time stamp
-
getMomentum
public double getMomentum()Returns the momentum- Returns:
- particle momentum
-
getCurrentState
Returns the current state object maintained by this probe. The state object contains all the defining state information at the current simulation trajectory location.- Returns:
- the current state of this probe
- Since:
- Nov 18, 2014
-
getInitialState
Returns the initial state of this probe. This is the state with which the probe begins the simulation. Whenever thecommand is called the current state of the simulation is set to this state.reset()- Returns:
- the current starting state for this probe
- Since:
- Dec 29, 2015, Christopher K. Allen
-
getTrajectory
Get the state history of the probe.- Specified by:
getTrajectoryin interfaceIProbe- Returns:
- Trajectory object of the proper sub-type for the probe type
-
getLongitinalPhase
public double getLongitinalPhase()Returns the longitudinal phase of this probe with respect to the RF phase. Typically used to account for phase delay/advance in cavities incurred due to finite propagation time. For example
φ ≜ φ0 - Δφ
where Δφ = 2πfΔt is the phase delay due to elapsed time Δt, f is the cavity resonant frequency, and φ0 is the operating phase of the cavity (w.r.t. the synchronous particle).- Specified by:
getLongitinalPhasein interfaceIProbe- Returns:
- the probe phase φ with respect to the machine RF frequency
- Since:
- Nov 17, 2014
-
getSpeciesName
returns the species name- Specified by:
getSpeciesNamein interfaceIProbe- Returns:
- species name
-
getSpeciesCharge
public double getSpeciesCharge()Returns the charge of probe's particle species- Specified by:
getSpeciesChargein interfaceIProbe- Returns:
- particle species charge (Coulombs)
-
getSpeciesRestEnergy
public double getSpeciesRestEnergy()Returns the rest energy of particle species- Specified by:
getSpeciesRestEnergyin interfaceIProbe- Returns:
- particle species rest energy (electron-volts)
-
getCurrentElement
Returns the id of the current lattice element that the probe is visiting.- Specified by:
getCurrentElementin interfaceIProbe- Returns:
- id of current lattice element
-
getCurrentElementTypeId
Description copied from interface:IProbeGet the type identifier string of the modeling element where this probe currently exists. Note that all modeling elements have a static string identifier defined in their class definition.- Specified by:
getCurrentElementTypeIdin interfaceIProbe- Since:
- Dec 16, 2014 by Christopher K. Allen
- See Also:
-
getCurrentHardwareId
Returns the identifier of the hardware modeled by the element associated with this state.- Specified by:
getCurrentHardwareIdin interfaceIProbe- Returns:
- hardware ID of the associated modeling element
- Since:
- Sep 3, 2014
- See Also:
-
getPosition
public double getPosition()Returns the current beam-line position of the probe- Specified by:
getPositionin interfaceIProbe- Returns:
- probe position (meters)
-
getTime
public double getTime()Return the time elapsed since the probe began propagation. -
getKineticEnergy
public double getKineticEnergy()Return the kinetic energy of the probe. Depending upon the probe type, this could be the actual kinetic energy of a single constituent particle, the average kinetic energy of an ensemble, the design energy, etc.- Specified by:
getKineticEnergyin interfaceIProbe- Returns:
- probe kinetic energy (electron-volts)
-
getBeta
public double getBeta()Returns the probe velocity normalized to the speed of light. -
getGamma
public double getGamma()Returns the relativistic parameter corresponding to the probe velocity. The relativistic factor is given by the formulae
γ = (W/mc2) + 1 = [1/(1-β2)]1/2 -
lookupLastStateFor
Description copied from interface:IProbeLooks up the last probe state created by a modeling element of the given identifier. The history of the probe (i.e., aTrajectoryobject is searched for the last state with the modeling type ID equal to the given value.- Specified by:
lookupLastStateForin interfaceIProbe- Parameters:
strElemTypeId- modeling element type identification string- Returns:
- the last state created by such a modeling element
- Since:
- Dec 17, 2014 by Christopher K. Allen
- See Also:
-
setCurrentElement
Set the current lattice element id.- Specified by:
setCurrentElementin interfaceIProbe- Parameters:
id- element id of current lattice element
-
setCurrentElementTypeId
Description copied from interface:IProbeSets the type identifier string of the modeling element where this probe currently exists. Note that all modeling elements have a static string identifier defined in their class definition.- Specified by:
setCurrentElementTypeIdin interfaceIProbe- Parameters:
strTypeId- static identifier string of the modeling element class- Since:
- Dec 16, 2014 by Christopher K. Allen
- See Also:
-
setCurrentHardwareId
Sets the identifier of the hardware modeled by the current element.- Specified by:
setCurrentHardwareIdin interfaceIProbe- Parameters:
strSmfId- hardware ID of the current modeling element- Since:
- Sep 3, 2014
- See Also:
-
setPosition
public void setPosition(double s) Set the current position of the probe along the beamline.- Specified by:
setPositionin interfaceIProbe- Parameters:
s- new probe position (meters)- See Also:
-
setTime
public void setTime(double dblTime) Set the current time since the probe began propagating -
setLongitudinalPhase
public void setLongitudinalPhase(double dblPhsLng) Set the longitudinal phase of this probe with respect to the RF phase. Typically used to account for phase delay/advance in cavities incurred due to finite propagation time. For example
φ ≜ φ0 - Δφ
where Δφ = 2πfΔt is the phase delay due to elapsed time Δt, f is the cavity resonant frequency, and φ0 is the operating phase of the cavity (w.r.t. the synchronous particle).- Specified by:
setLongitudinalPhasein interfaceIProbe- Parameters:
dblPhsLng- the phase delay Δφ incurred from probe propagate between RF cavities- Since:
- Nov 17, 2014
-
setKineticEnergy
public void setKineticEnergy(double w) Set the current kinetic energy of the probe.- Specified by:
setKineticEnergyin interfaceIProbe- Parameters:
w- new probe kinetic energy (electron-volts)- See Also:
-
setSpeciesCharge
public void setSpeciesCharge(double q) Set the charge of the particle species in the beam- Specified by:
setSpeciesChargein interfaceIProbe- Parameters:
q- species particle charge in units of positive electron charge- See Also:
-
setSpeciesRestEnergy
public void setSpeciesRestEnergy(double eR) Set the rest energy of a single particle in the beam- Specified by:
setSpeciesRestEnergyin interfaceIProbe- Parameters:
eR- particle rest energy (electron-volts)- See Also:
-
initialize
public void initialize()Initializes the probe, resetting state as necessary.
CKA NOTES:
These notes concern the refactoring of the probe component in order to tighten the typing.
· In order to make this method compatible with the previous behavior it must set the saved "initial state" to the current probe state. The previous incarnation assigned the new initial state by calling thecreateProbeState()method to which created a new probe state representing the current state of the probe.
· The trajectory is cleared, that is, there is no longer any history in the probe
· Thus, initialize() is really a poor choice, since all that is done is
- The initial state is reset to the current state
- The trajectory is cleared- Specified by:
initializein interfaceIProbe
-
update
Save the probe state into trajHist.- Specified by:
updatein interfaceIProbe- Throws:
ModelException- an error occurred while trying to update the probe
-
performPostProcessing
Deprecated.This method is called in several places I don't think it ever is implemented to do anything.Subclasses should override this method to perform any required post processing upon completion of algorithm processing. This method implementation does nothing.- Specified by:
performPostProcessingin interfaceIProbe
-
getAlgorithm
Return the algorithm defining the probes dynamics.- Specified by:
getAlgorithmin interfaceIProbe- Returns:
- interface to probe dynamics
-
getArchive
Return the archiving interface for this object.- Specified by:
getArchivein interfaceIProbe- See Also:
-
load
Load the contents of a probe from an data archive represented by aDataAdaptorinterface.- Specified by:
loadin interfaceIArchive- Parameters:
daptSource- data archive containing probe info- Throws:
DataFormatException- bad probe type, missing child data node, or bad number format
-
save
Save the contents of a probe to a data archive represented by aDataAdaptorinterface. -
deepCopy
This is a convenience function for derived classes when implementing their deepCopy() method. This functions deep copies all attributes in the Probe base class. The derived classes need only then deep copy all attributes particular to their type (e.g., state, etc.).- Parameters:
probe- probe object whose Probe base is to be deep copied into this
-