Particle

class Particle.Particle[source]

Defines a particle object.

The member variables of the Particle class are the quantities in the OSCAR2013/OSCAR2013Extended or JETSCAPE hadron output. If they are not set, they stay None to throw an error if one tries to access a non existing quantity.

Notes

To set a value of one of the attributes by hand, please use the corresponding getter methods with parentheses including the value for the attribute of the particle.

Examples

To use the particle class a particle has to be created and the attributes can be set or obtained with the corresponding functions.

1>>> from Particle import Particle
2>>>
3>>> particle = Particle()
4>>> particle.t = 1.0
5>>> print(particle.t)
61.0
Attributes:
t_float

The time of the particle.

x_float

The x coordinate of the position.

y_float

The y coordinate of the position.

z_float

The z coordinate of the position.

mass_float

The mass of the particle.

E_float

The energy of the particle.

px_float

The x component of the momentum.

py_float

The y component of the momentum.

pz_float

The z component of the momentum.

pdg_int

The PDG code of the particle.

ID_int

The ID of the particle (unique label of each particle in an event).

charge_int

Electric charge of the particle.

ncoll_int

Number of collisions undergone by the particle.

form_time_double

Formation time of the particle.

xsecfac_double

Scaling factor of the cross section.

proc_id_origin_int

ID for the process the particle stems from.

proc_type_origin_int

Thype information for the process the particle stems from.

t_last_coll_double

Time of the last collision.

pdg_mother1_int

PDG code of the mother particle 1.

pdg_mother2_int

PDG code of the mother particle 2.

status_int

Status code of the particle.

baryon_number_int

Baryon number of the particle.

weight_float

Weight of the particle.

Methods

t:

Get/set t

x:

Get/set x

y:

Get/set y

z:

Get/set z

mass:

Get/set mass

E:

Get/set E

px:

Get/set px

py:

Get/set py

pz:

Get/set pz

pdg:

Get/set pdg

ID:

Get/set ID

charge:

Get/set charge

ncoll:

Get/set ncoll

form_time:

Get/set form_time

xsecfac:

Get/set xsecfactor

proc_id_origin:

Get/set proc_id_origin

proc_type_origin:

Get/set proc_type_origin

t_last_coll:

Get/set t_last_coll

pdg_mother1:

Get/set pdg_mother1

pdg_mother2:

Get/set pdg_mother2

status:

Get/set status

baryon_number:

Get/set baryon_number

print_particle:

Print the particle as CSV to terminal

set_quantities_OSCAR2013:

Set particle properties OSCAR2013

set_quantities_OSCAR2013Extended:

Set particle properties OSCAR2013Extended

set_quantities_JETSCAPE:

Set particle properties JETSCAPE

angular_momentum:

Compute angular momentum

momentum_rapidity_Y:

Compute momentum rapidity

p_abs:

Compute absolute momentum

pt_abs:

Compute absolute value of transverse momentum

phi:

Compute azimuthal angle

theta:

Compute polar angle

pseudorapidity:

Compute pseudorapidity

spatial_rapidity:

Compute spatial rapidity

proper_time:

Compute proper time

compute_mass_from_energy_momentum:

Compute mass from energy momentum relation

compute_charge_from_pdg:

Compute charge from PDG code

is_meson:

Is the particle a meson?

is_baryon:

Is the particle a baryon?

is_hadron:

Is the particle a hadron?

is_strange:

Is the particle a strange particle?

is_heavy_flavor:

Is the particle a heavy flavor particle?

weight:

What is the weight of the particle?

Particle.print_particle()[source]

Print the whole particle information as csv string.

This function prints a header line with the different quantities. All particle quantities are then printed in the next line separated by a comma.

Particle.set_quantities_OSCAR2013(line_from_file)[source]

Sets the particle quantities obtained from OSCAR2013.

Parameters:
line_from_file: list, numpy.ndarray

Contains the values read from the file.

Raises:
ValueError

if the input line has not the same number of columns as OSCAR2013

Particle.set_quantities_OSCAR2013Extended(line_from_file, photon=False)[source]

Sets the particle quantities obtained from OSCAR2013Extended.

Parameters:
line_from_file: list, numpy.ndarray

Contains the values read from the file.

photon: bool

Read in the extra field ‘weight’ for photon output.

Raises:
ValueError

if the input line has not the same number of columns as OSCAR2013Extended

Particle.set_quantities_JETSCAPE(line_from_file)[source]

Sets the particle quantities obtained from a JETSCAPE hadron file.

The JETSCAPE hadron output does not directly contain information about the mass and the charge. Thus, they are computed from the four-momentum and the PDG code respectively.

Parameters:
line_from_file: list, numpy.ndarray

Contains the values read from the file.

Raises:
ValueError

if the input line has not the same number of columns as JETSCAPE hadron file

Particle.angular_momentum()[source]

Compute the angular momentum \(L=r \times p\) of a particle

Returns:
angular_momentumnumpy.ndarray

Array containing all three components of the angular momentum as \([L_x, L_y, L_z]\).

Particle.momentum_rapidity_Y()[source]

Compute the momentum rapidity \(Y=\frac{1}{2}\ln\left(\frac{E+p_z}{E-p_z}\right)\) of the particle.

Returns:
float

momentum rapidity

Particle.p_abs()[source]

Compute the absolute momentum \(|\vec{p}|=\sqrt{p_x^2+p_y^2+p_z^2}\) of the particle.

Returns:
float

absolute momentum

Particle.pt_abs()[source]

Compute the absolute transverse momentum \(|\vec{p}_{\mathrm{T}}|=\sqrt{p_x^2+p_y^2}\) of the particle.

Returns:
float

absolute transverse momentum

Particle.phi()[source]

Compute the azimuthal angle of the particle.

Returns:
float

azimuthal angle

Particle.theta()[source]

Compute the polar angle of the particle.

Returns:
float

polar angle

Particle.pseudorapidity()[source]

Compute the pseudorapidity \(\eta=\frac{1}{2}\ln\left(\frac{|\vec{p}|+p_z}{|\vec{p}|-p_z}\right)\) of the particle.

Returns:
float

pseudorapidity

Particle.spatial_rapidity()[source]

Compute the spatial rapidity \(y=\frac{1}{2}\ln\left(\frac{t+z}{t-z}\right)\) of the particle.

Returns:
float

spatial rapidity

Particle.proper_time()[source]

Compute the proper time \(\tau=\sqrt{t^2-z^2}\) of the particle.

Returns:
float

proper time

Particle.compute_mass_from_energy_momentum()[source]

Compute the mass from the energy momentum relation.

Returns:
float

mass

Particle.compute_charge_from_pdg()[source]

Compute the charge from the PDG code.

This function is called automatically if a JETSCAPE file is read in with the ParticleClass.Particle.set_quantities_JETSCAPE() function.

Returns:
float

charge

Particle.is_meson()[source]

Is the particle a meson?

Returns:
bool

True, False

Particle.is_baryon()[source]

Is the particle a baryon?

Returns:
bool

True, False

Particle.is_hadron()[source]

Is the particle a hadron?

Returns:
bool

True, False

Particle.is_strange()[source]

Does the particle contain strangeness?

Returns:
bool

True, False

Particle.is_heavy_flavor()[source]

Is the particle a heavy flavor hadron?

Returns:
bool

True, False