STAR  Computing  Simulation  
Running a STAR Simulation with Pythia
  Maintained by Maxim Potekhin

Pythia in STARSIM

We have recently switched to version 6.205 of the Pythia event generator, which is currently deployed in DEV.

If you have general questions about the event generator itself, and its input variables and control structures, you'll find the following link useful:

The site contains a complete set of documents in TeX and PS formats. Of particular interest is the control of decays of various particles. Some illustration of how this is done is included in the piece of KUMAC code below.

Calling Pythia

To run Pythia from starsim, do the following:
  • Run the stardev command
  • In starsim (interactively or in the KUMAC script) issue the command

    gexec $STAR_LIB/apythia.so

    This command loads the pythia library, and is not related to the geometry definition and/or "gclose" command.

  • after that, you can input commands as per Pythia interface and call trig to generate single events. The following is a transcript (KUMAC code) of a Pythia session in starsim. It is listed here purely for demo purposes.

    detp geom y2004a
    make geometry
    gclose all
    gexec $STAR_LIB/apythia.so
    dcut cave z 0.1 10 10 .02 .02
    next
    ener 200.
    PMA1 6=175.
    PMA1 23=91.2   24=80.5
    MSEL 1      ! 1:nondifractive only, 2:all
    MSTP 51=7   ! choose pdf. 7:CTEQ5L LO in Pythia 6.1
    CKIN 3=-1.0 ! pt min  --  Pt MIN cut here
    CKIN 8=10.  ! y max
    MDCY (102,1)=0  ! make PI0 stable
    MDCY (106,1)=0  ! make PI+ stable
    * Now, ready to trigger:
    trig
    * use this or other graphics command to visualise:
    dcut cave z 270 17 14 .01 .01; *EEMC
    dhits
    

The MDCY flags tell the program whether to decay certain particles within Pythia or not. This data structure also holds other information. For more detail, the reader is reffered to the above Pythia link.

Please note that in the above, the MDCY code is actually a command rather than an assignment operator. There is a space between it and the subsequent arguments.

The help facility

The starsim application has an extremely useful help facility, which will nicely illustrate the internally available Pythia commands. Please take a look at what's available there.

To do so, one has to simply type "man pythia" at the starsim> prompt, but only after loading the pythia library:

gexec $STAR_LIB/apythia.so

Syntax for defining the Pythia parameters

The "man pythia" help system will list a few commands recognized by starsim, that can be used to specify Pythia input parametes. In fact, some of these have been used in the example above.

Alternatively, the user can always call the built-in Pythia function pygive which gives the user textual interface to most variables. As an example, we can re-initialize the internal Pythia random number generator by issuing command, within our interactive or scripted starsim session:

call pygive('MRPY(1)=3')
call pygive('MRPY(2)=0')
The second setting causes Pythia to recognize that the generator needs to be reset, while the first one supplies the actual seed.

Choice of Random Number generator Settings

Pythia has its own built-in random number generator. The starsim application also has its own generator used in the GEANT simulation.

The user has the option to use the internal Pythia generator if needed. This may be useful, for example, when running Pythia standalone (i.e. with no GEANT component altogether), and comparing events with a GEANT-based simulation later.

As of this writing, the following logic is implemented:

  • if the Pythia event generator has been supplied, by the user, with a seed, and Pythia has been initalized, it will then use the built in random sequence. See the example in the section above for code sample.
  • If the seed has not been supplied and no initialization has been done, the native starsim generator will feed Pythia as well.

Choice of other Pythia Settings

The settings chosen for a particular run would of course depend on the purpose of the simulation. Important choices are the diffractive vs non-diffractive parts of the cross section and what particles will decay inside the Pythia simulation, as opposed to an external afterburner such as GEANT.

In general, if Pythia is used in conjunction with GEANT, we want the latter to take care of the decays, and we also want to use default settings whenever possible. What follows is a general template for a Pythia run whose output is meant to be fed into GEANT. Note: while setting the MCDY values, the so-called "compact" particle codes are used, which are not the same as "full codes" found in the particle code section of the Pythia manual. The full codes are listed in the comment part of the script:

*
MSEL 2         ! Total cross section, i.e. elastic+inelastic D=1
ENER 200.0     ! Collision energy
*
* Make the following stable:
*
MDCY (102,1)=0  ! PI0 111
MDCY (106,1)=0  ! PI+ 211
*
MDCY (109,1)=0  ! ETA 221
*
MDCY (116,1)=0  ! K+ 321
*
MDCY (112,1)=0  ! K_SHORT 310
MDCY (105,1)=0  ! K_LONG 130
*
*
MDCY (164,1)=0  ! LAMBDA0 3122
*
MDCY (167,1)=0  ! SIGMA0 3212
MDCY (162,1)=0  ! SIGMA- 3112
MDCY (169,1)=0  ! SIGMA+ 3222
MDCY (172,1)=0  ! Xi- 3312
MDCY (174,1)=0  ! Xi0 3322
MDCY (176,1)=0  ! OMEGA- 3334
*

Choice of individual Pythia subprocesses

If the user decides to be more specific in their choice of what's happening in Pythia, as opposed to the general elastic vs non-elastic, a sequence like posted below will select the subprocess as per user choice:
MSEL=0
MSUB=11,12,13,28,53,68

Saving the output

The output of the Pythia simulation can be saved as a Zebra file, in a format suitable for the reconstruction chain. The user can use the following command prior to triggering events:

gfile o myfile.fz


Last updated by Maxim Potekhin on 09/01/2004