GeneralizedTarget#

class MCEq.geometry.density_profiles.GeneralizedTarget(len_target=100000.0, env_density=0.001225, env_name='air')[source]#

Bases: object

This class provides a way to run MCEq on piece-wise constant one-dimenional density profiles.

The default values for the average density are taken from config file variables len_target, env_density and env_name. The density profile has to be built by calling subsequently add_material(). The current composition of the target can be checked with draw_materials() or print_table().

Note

If the target is not air or hydrogen, the result is approximate, since seconday particle yields are provided for nucleon-air or proton-proton collisions. Depending on this choice one has to adjust the nuclear mass in mceq_config.

Parameters:
  • len_target (float) – total length of the target in meters

  • env_density (float) – density of the default material in g/cm**3

  • env_name (str) – title for this environment

Attributes Summary

max_X

Maximal depth of target.

max_den

s_X2h

Spline for depth at distance.

s_h2X

Spline for distance at depth.

Methods Summary

add_material(start_position_cm, density, name)

Adds one additional material to a composite target.

draw_materials([axes, logx])

Makes a plot of depth and density profile as a function of the target length.

get_density(l_cm)

Returns the density in g/cm**3 as a function of position l in cm.

get_density_X(X)

Returns the density in g/cm**3 as a function of depth X.

print_table([min_dbg_lev])

Prints table of materials to standard output.

r_X2rho(X)

Returns the inverse density \(\frac{1}{\rho}(X)\).

reset()

Resets material list to defaults.

set_length(new_length_cm)

Updates the total length of the target.

set_theta(*args)

This method is not defined for the generalized target.

Attributes Documentation

max_X#

Maximal depth of target.

max_den#
s_X2h#

Spline for depth at distance.

s_h2X#

Spline for distance at depth.

Methods Documentation

add_material(start_position_cm, density, name)[source]#

Adds one additional material to a composite target.

Parameters:
  • start_position_cm (float) – position where the material starts counted from target origin l|X = 0 in cm

  • density (float) – density of material in g/cm**3

  • name (str) – any user defined name

Raises:

Exception – If requested start_position_cm is not properly defined.

draw_materials(axes=None, logx=False)[source]#

Makes a plot of depth and density profile as a function of the target length. The list of materials is printed out, too.

Parameters:

axes (plt.axes, optional) – handle for matplotlib axes

get_density(l_cm)[source]#

Returns the density in g/cm**3 as a function of position l in cm.

Parameters:

l (float) – position in target in cm

Returns:

density in g/cm**3

Return type:

float

Raises:

Exception – If requested depth exceeds target.

get_density_X(X)[source]#

Returns the density in g/cm**3 as a function of depth X.

Parameters:

X (float) – depth in g/cm**2

Returns:

density in g/cm**3

Return type:

float

Raises:

Exception – If requested position exceeds target.

print_table(min_dbg_lev=0)[source]#

Prints table of materials to standard output.

r_X2rho(X)[source]#

Returns the inverse density \(\frac{1}{\rho}(X)\).

Parameters:

X (float) – slant depth in g/cm**2

Returns:

\(1/\rho\) in cm**3/g

Return type:

float

reset()[source]#

Resets material list to defaults.

set_length(new_length_cm)[source]#

Updates the total length of the target.

set_theta(*args)[source]#

This method is not defined for the generalized target. The purpose is to catch usage errors.

Raises:

NotImplementedError – always