4. How to optimize my simulation?

4.1. Hadronic interaction model

ON GOING

Hadronic interaction models are selected through IntModel in the param file. An example found in the FirstKiss sample is:

IntModel = '"phits" 2.0 "dpmjet3" ',

meaning PHITS and DPMJET3 are used below and above 2 GeV, respectively.

How can we know the list of available models and the version of each model? Move to the directory $COSMOSTOP/LibLoft/Script, and type:

./intModel.sh

You can find the choice of high energy hadronic interaction models, qgsjet2, epos and sibyll, and current version. If you want to switch between the versions, you can select from the

4.2. Thinning

4.3. AS, hybrid method

4.4. Magnetic field

The magnetic field is controlled by the parameter HowGeomag. By default, HowGeomag is 11 where constant magnetic field will be applied, calculated by the IGRF model at the date of YearOfGeomag at the place of the detector system at (LatitOfSite, LongitOfSite).

Table 4.1 HowGeomag parameter

HowGeomag

description

1

no magnetic field is taken into account until the first collision. The field is position dependent and calculated with the IGRF model at each position.

2

magnetic field exists everywhere. The field is position dependent and calculated with the IGRF model at each position.

11

same as 1 but constant. The field is calculated with the IGRF model at BaseL.

12

same as 2 but constant. The field is calculated with the IGRF model at BaseL.

21

same as 1 but constant. The field is defined by MagN, MagE and MagD parameters in &HPARAM.

22

same as 2 but constant. The field is defined by MagN, MagE and MagD parameters in &HPARAM.

31

same as 1

32

same as 12

others

same as one of the above

In most cases, HowGeomag=11 is recommended but when Reverse is not 0 (back-tracking is enabled), please set HowGeomag=2.

When you want to define arbitrary magnetic field, in environment such as another planet, you have to define subroutine cmyBfield( yearin, pos, MagF, icon ) and ObjFile to enable the subroutine.

4.5. Electric field

4.5.1. Introduction

Simple but unrealistic electric fields can be used without any coding by the user. It may be used to see the basic effect of electric field on charged particle motion. If the user wants to use more realistic field effect, it is better to make the cosmos library following the procedure described in Section 4.5.3.

In every case, the field strength must be given in unit of V/m. The final field vector, \(\vec{\mathcal{E}}\), must be given in the E-xyz system.

4.5.2. Simple electric field

An electric field can be specified by referring to the height(H), distance to the shower axis (R) and time information (T) of each charged particle, where H is the height in m a.s.l, R (in m) the horizontal distance if DefofR='h' (default) or perpendicular distance if DefofR='p', T the time (in ns) spent from the starting point of the primary particle.

  • If T is used, H is neglected.

  • So the field is determined by H and R or T and R.

  • If R is not given, only H or T is used.

  • If neither H nor T is used, only R is used.

  • If non of H,T,R is used, the filed will be 0.

To specify H,T,R, a variable, myEf and its components are used. For example, if the user want to give an electric field at \(0<H<1000\) and \(2000<H<3000\), respectively

myEf(1)%H1=0
myEf(1)%H2=1000
myEf(2)%H1=2000
myEf(2)%H2=3000

may be given in the param file. Corresponding field vectors may be given as

myEf(1)%Ef=Ex,Ey,Ez
myEf(2)%Ef=Ex',Ey',Ez'

where Ex etc are numerical values in V/m. The vectors must be given in the detector system (vertically upward direction is the +Z direction. Internally, the values are converted into the ones in the E-xyz system.

The height list by myEf must be given from lower ones (note: the observation height list in the param file is given from higher to lower height order). For T, R, the same format is used. The max number of fields is 5.

To activate the specifications by myEf, HowEfield=1 must be given in the &HPARAM section of param file. Its default is 0 which means non-existence of the electric field.

4.5.3. Arbitrary electric field

To use more realistic fields, the user must define a subroutine whose name is cmyEfield(aTrack, Efout), where aTrack is the track information in the E-xyz coordinate system and Efout is the electric field the user should define in the E-xyz system. And finally HowEfield=2 should be specified in the &HPARAM section of param file at run.

Even if cmyEfield() is defined as above, the user can set HowEfield=0 or 1.

Let’s assume the filename cmyEfield.f where cmyEfield(aTrack, Efout) is defined.

  1. First, copy $COSMOSTOP/cosmos/cmain.f to your project directory. And comment out #include "cmyEfield.f".

  2. Edit cmyEfield.f to define customized electric field, cmyEfield(aTrack, Efout).

  3. Edit makefile.

    • If you use cmake, edit CMakeLists.txt to add cmyEfield.f.

      #add_executable(cosmos${ARCH} chook.f)
      add_executable(cosmos${ARCH} chook.f cmyEfield.f)
      
    • If you use make, edit chook.mk, Notice that cmyEfield.o have to be added, not cmyEfield.f.

      #objs = chook.o
      objs = chook.o cmyEfield.o
      
  4. Build executable as described in Section 2.4.

An example project to enable arbitrary electric field can be found in Application/Example/MyField/, which will be useful as a template.

4.6. Non-air material, non-earth sphere

Usually air shower simulation codes handle only air (mixture of \(\mathrm{N}_2\) , \(\mathrm{O}_2\) and other rarer gas) as a medium. Also usual simulation codes assume a flat atmosphere or a spherically symmetric atmosphere centered at the center of the earth. However, COSMOS X allows to arrange non-air material such as water and soil. Their shapes are limited in shells with a common center, but the radius is not limited to the radius of the earth. This means COSMOS X is able to simulate air showers in the other planets, or stars including their ground.

To define non-standard environment, users can use a variable ObjFile in the param file such as:

ObjFile = ”obsfile”

Here obsfile is a file name that contains actual definition of the environment. When the ObjFile variable is not specified in the param file, usual atmosphere is setup.

4.7. User defined Trace output