### TABLE OF CONTENTS

- 1. /collisionNumbering
- 1.1. collisionNumbering/firstEventNumber
- 1.2. collisionNumbering/CountedEvents
- 1.3. collisionNumbering/getCountedEvents
- 1.4. collisionNumbering/nullCountedEvents
- 1.5. collisionNumbering/writeCountedEvents
- 1.6. collisionNumbering/getn_participants
- 1.7. collisionNumbering/nulln_participants
- 1.8. collisionNumbering/ReportEventNumber
- 1.9. collisionNumbering/pert_numbering
- 1.10. collisionNumbering/real_numbering
- 1.10.1. real_numbering/eventNumber
- 1.11. collisionNumbering/pert_firstnumbering
- 1.12. collisionNumbering/pert_firstnumbering12
- 1.13. collisionNumbering/real_firstnumbering
- 1.14. collisionNumbering/check_justCollided

## /collisionNumbering [ Modules ]

NAME

module **collisionNumbering**

PURPOSE

- includes the numbering of the particles according to their collision partners.
- This numbering is stored in the "%event" variable.
- Also includes the routine which based on %event decides whether two particles did collide before.
- Include routines which store and output the number of collisions.

NOTES

In GiBUU we label each particle by the event it stems from. This labeling is different for real and perturbative particles.

REAL PARTICLES:

- We assign a unique number to each event. Event #1 gets %event=firstEventNumber, Event #2 gets %event=firstEventNumber+1,...
- To check whether to particles stem from the same event, we just need to check whether their %event entries coincide.

PERTURBATIVE PARTICLES:

- The perturbative particles produced in some event get as %event the %number of the realParticle which took part in the event
- To check whether a real and perturbative particle stem from the same event, we check whether pert%event=real%number

## collisionNumbering/firstEventNumber [ Global module-variables ]

[ Top ] [ collisionNumbering ] [ Global module-variables ]

PURPOSE

First number to be given to particles in a collision

SOURCE

integer, parameter ::firstEventNumber=1000000

## collisionNumbering/CountedEvents [ Global module-variables ]

[ Top ] [ collisionNumbering ] [ Global module-variables ]

PURPOSE

Global storage of the number of events * first index --- 0: integrated number, 1: from a given time step only * second index --- 0: all, 1: 1-Body, 2: 2-Body, 3: 3-Body * third index --- 1: real particles, 2: perturbative particles

SOURCE

integer, dimension(0:1,0:3,1:2), save ::CountedEvents= 0

## collisionNumbering/getCountedEvents [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function **getCountedEvents**(iStat, iN, iType)

PURPOSE

Returns number of counted events

INPUTS

- integer :: iStat --- 0: integrated number, 1: from a given time step only
- integer :: iN --- 0: all, 1: 1-Body, 2: 2-Body, 3: 3-Body
- integer :: iType --- 1: real particles, 2: perturbative particles

OUTPUT

- integer

NOTES

no range checking

## collisionNumbering/nullCountedEvents [ Subroutines ]

[ Top ] [ collisionNumbering ] [ Subroutines ]

NAME

subroutine **nullCountedEvents**(iflag)

PURPOSE

Sets countedEvents back to zero

INPUTS

- integer:: iflag -- =0: set to zero all countedEvents, =1: set to zero only the previous time step counter

## collisionNumbering/writeCountedEvents [ Subroutines ]

[ Top ] [ collisionNumbering ] [ Subroutines ]

NAME

subroutine **writeCountedEvents**(iChoice)

PURPOSE

Write some values of the stored CountedEvents to stdout

INPUTS

- integer :: iChoice -- selects the values to be printed
- real, optional :: time --- actual time

## collisionNumbering/getn_participants [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

function **getn_participants**()

PURPOSE

Returns number of participants.

RESULT

- integer, dimension(1:2) ::
**getn_participants**

## collisionNumbering/nulln_participants [ Subroutines ]

[ Top ] [ collisionNumbering ] [ Subroutines ]

NAME

subroutine **nulln_participants**

PURPOSE

Sets to zero the number of participants.

## collisionNumbering/ReportEventNumber [ Subroutines ]

[ Top ] [ collisionNumbering ] [ Subroutines ]

NAME

subroutine **ReportEventNumber**(InPart,OutPart, nr,time,code1,code2,weight)

PURPOSE

Used for statistics. Called e.g. by collsionTerm.

INPUTS

- type(particle),dimension(:) :: InPart -- incoming particles
- type(particle),dimension(:) :: OutPart-- outgoing particles
- integer,dimension(1:2) :: nr -- EventNumber
- real :: time -- time of collision
- integer :: code1 -- code of collision
- integer, optional :: code2 -- subcode of collision
- real, optional :: weight -- event-weight

possible values for code1 are:

- 1-body: 11= real particle decay, 12= pert.particle decay
- 2-body: 211= real+real , 212= real+pert
- 3-body: 3111= real+real+real, 3112= real+real+pert

possible values for code2 (2-body) are:

- -3: BaB (Baryon-Antibaryon-Annihilation)
- -2: Manni (Meson-Baryon-Annihilation)
- -1: Elastic
- 1: FRITIOF
- 2: PYTHIA

OUTPUT

---

NOTES

You can (ab)use this routine for debugging purposes: listing the event if a particle with a given ID collides or if a particle, which is produced in some given event collides again, many possibilities...

## collisionNumbering/pert_numbering [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function **pert_numbering**(realteilchen)

PURPOSE

Calculate the Event number of a perturbative particle which collided with the real particle "realteilchen". If realTeilchen is not given than the return value is -999, which can never be associated to any particle.

INPUTS

- type(particle), optional :: realTeilchen

OUTPUT

event number

## collisionNumbering/real_numbering [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function **real_numbering**()

PURPOSE

Calculate the Event number of a real particle. The event number for the real particles are unique. A collision happened at later time will cause a higher event number.

INPUTS

---

OUTPUT

event number

NOTES

The minimal value of numbering is firstEventNumber.

## real_numbering/eventNumber [ Global module-variables ]

[ Top ] [ real_numbering ] [ Global module-variables ]

SOURCE

integer, save ::eventNumber=firstEventNumber

PURPOSE

Number to be given to every real particle stemming from a collision event:

- This number should by unique !
- Therefore we raise "eventnumber" by one for every event.
- All produced particles then get this "eventnumber" set into "teilchen(i,j)%event".

If two real particles agree in "teilchen(i,j)%event", "teilchen(k,l)%event" then they are not allowed to scatter to prevent multiple collisions. of one pair without interaction with the outside world.

## collisionNumbering/pert_firstnumbering [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function pert_numbering(realTeilchen,pertTeilchen)

PURPOSE

calculate the value of firstevent, which has to be given to the final particles, when realTeilchen and pertTeilchen collided

possible return values:

- realTeilchen%number, if pertTeilchen not given
- pertTeilchen%firstEvent, if pertTeilchen%firstEvent.ne.0
- some exotic value, if you wish
- realTeilchen%number as default

INPUTS

NOTES

This routine should be called only, if for a incoming particle we had %firstEvent==0; If not, it does also the right stuff, but slower.

if only realTeilchen is given, it is as calling "pert_numbering(realTeilchen)": return value = realTeilchen%number

## collisionNumbering/pert_firstnumbering12 [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function **pert_firstnumbering12**(reset,DoNotInc)

PURPOSE

just return an increasing number every call

INPUTS

- logical, optional :: reset -- if .true. the internal counter is reset to zero
- logical, optional :: DoNotInc -- if .true. the internal counter is not increased, the returned number is the number given before

NOTES

- called by pert_numbering
- used for eventType == 12 (HiPion)

## collisionNumbering/real_firstnumbering [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

integer function **real_firstnumbering**(reset)

PURPOSE

just return an increasing number every call

INPUTS

- logical, optional :: reset -- if .true. the internal counter is reset to zero

## collisionNumbering/check_justCollided [ Functions ]

[ Top ] [ collisionNumbering ] [ Functions ]

NAME

logical function **check_justCollided**(a,b)

PURPOSE

Checks wether particles a and b stem from the same collision, and no other collision happened yet.

RESULT

- true = if they are just created before by the very same event
- false= if not...