### TABLE OF CONTENTS

- 1. /Insertion
- 1.1. Insertion/minimumEnergy
- 1.2. Insertion/propagateNoPhoton
- 1.3. Insertion/readInput
- 1.4. Insertion/insertion
- 1.5. Insertion/GarbageCollection
- 1.6. Insertion/FindLastUsed
- 1.7. Insertion/setIntoVector
- 1.8. Insertion/particlePropagated

## /Insertion [ Modules ]

NAME

module **Insertion**

PURPOSE

This module collects routines for inserting particles into the particle vectors.

## Insertion/minimumEnergy [ Global module-variables ]

[ Top ] [ Insertion ] [ Global module-variables ]

SOURCE

real, save, public ::minimumEnergy=0.005

PURPOSE

Minimal kinetic energy in GeV for produced perturbative nucleons. If their energy is below this threshold, then they are not propagated, i.e. they are not inserted in the particle vector.

NOTES

This value was formerly given in the namelist "collisionterm".

## Insertion/propagateNoPhoton [ Global module-variables ]

[ Top ] [ Insertion ] [ Global module-variables ]

SOURCE

` logical, save :: `**propagateNoPhoton**=.true.

PURPOSE

If .true. then we eliminate all photons, such that they are not propagated and do not show up in the particle vector. If .false. then photons are explicitly propagated.

## Insertion/readInput [ Subroutines ]

[ Top ] [ Insertion ] [ Subroutines ]

NAME

subroutine Insertion_SetInitialized

PURPOSE

just set initflag to .true.

## Insertion/insertion [ Namelists ]

[ Top ] [ Insertion ] [ Namelists ]

NAME

NAMELIST /**insertion**/

PURPOSE

Namelist for module Insertion includes:

## Insertion/GarbageCollection [ Subroutines ]

[ Top ] [ Insertion ] [ Subroutines ]

NAME

subroutine **GarbageCollection**(partVec,DoCollHist)

PURPOSE

Rearrange particles in the vector (per ensemble) in such a way, that there are no holes (i.e. entries with the special ID 'NOP') inbetween. In addition, all particles after the last one get the special ID 'EOV' in order to indicate, that no non-empty entries will follow.

INPUTS

- type(particle), dimension(:,:) :: partVec
- logical, OPTIONAL :: DoCollHist -- Flag whether to do additional rearrangements

OUTPUT

- partVec changed

## Insertion/FindLastUsed [ Subroutines ]

[ Top ] [ Insertion ] [ Subroutines ]

NAME

function **FindLastUsed**(particles)

PURPOSE

Returns the last (used) entry from particle vector particles. The particle with the next index has the special ID 'EOV'.

INPUTS

OUTPUT

- integer ::
**FindLastUsed**-- number of last used entry

NOTES

Uses a (fast) bisection method! Therefore it relies on that "GarbageCollection" has been called.

## Insertion/setIntoVector [ Subroutines ]

[ Top ] [ Insertion ] [ Subroutines ]

NAME

subroutine **setIntoVector**(finalState, partVec, flagOK,numberIsSet,numbers,positions)

PURPOSE

This subroutine tries to find empty spaces in "partVec" and sets the elements of "finalState" into these holes.

INPUTS

- type(particle),dimension(:,:) :: partVec
- type(particle),dimension(:) :: finalState
- logical, optional :: numberIsSet -- .true. if finalstate has already %number set, .false. if this still needs to be done

OUTPUT

- logical :: flagOK -- true, if all Insertions were successful
- integer,dimension(:),optional :: numbers -- Vector with value of %number assigned to each final state entry
- integer,dimension(2,:),optional :: positions -- vector with positions, where particles were inserted (iEns,iPart)
- partVec changed

NOTES

Only particles for which the function "particlePropagated" returns true are really considered.

Concerning the variables "lastEnsemble, lastIndex" : By saving the index of the last hole in the vector we try to save time when searching for the next hole.

## Insertion/particlePropagated [ Functions ]

[ Top ] [ Insertion ] [ Functions ]

NAME

logical function **particlePropagated** (Part)

PURPOSE

Return .true. if "Part" is a particle which shall be propagated in the code: We do not propagate photons and very low-energetic perturbative nucleons (cf. minimumEnergy).

INPUTS

- type(particle) :: Part

OUTPUT

- function value