Software and Computing : Understanding a Kumac code used for PHTHA event generation

 
Below explains  main parts of a kumac code which use to generate PYTHIA events  compatible for starsim framework.


Main Parts:

1) Specify the correct GEOMETRY TAG

Syntax:                   detp geom [TAG] field = [FIELD]
                             gexec [LIBRARY]/geometry.so
                             gexec [LIBRARY]/gstar.so
                             gclose all

Where,

   TAG  = y2006, y2009b, y2012...
   FIELD  =5.0,..
   LIBRARY = $STAR_LIB        

**********************************************************************
             

2) Configure PYTHIA LIBRARAY

Syntax:            gexec [LIBRARY]/[PYTHIA]
                       gexec [LIBRARAY /bpythia.so  

or 
               exec "Name of the Macro which select Pythia configuration" [PYTHIA] [LIBRARY]      

Where, 

   LIBRARY = $STAR_LIB
   PYTHIA  = libPythia6_4_22.so,...

***************************************************************************

              
3) Set up RANDOM NUMBER GENERATOR (if you need series of runs)


Syntax: 
                    rndm [RUN] [SET]
                    istart = 1
                    rung [RUN] [istart]


Where,
   RUN = # of runs you need  eg, 10000,...
   SET = any number               eg, 1, 123,...

*********************************************************************************


4) Open OUTPUT FILE (to use in star+geant detector simulation)

Syntax;
               gfile o [FILE]

Where,
        FILE = filename.fzd    eg, convention:  FILE = [WHERE] // [RUN]_[SET]_[NEVENTS].evts.fzd
                                         Where,
                                                    WHERE = anyname
                                                    RUN = # of runs
                                                    SET = any number you set
                                                    NEVENTS = # of events

************************************************************************************************


5) Set up PYTHIA TUNE   

Syntax,
                      CALL PyTUNE ([MYTUNE])   eg, MYTUNE = 329



*************************************************************************************************


6) Set up COLLISION KINEMATICS for Pyhtia

Syntax;
              frame = [FRAME]            
              beam = [BEAM]
              ener =  [ENERGY]

 
Where,  [FRAME] = cms ,...         ! Chapter 9.1 Pythia manual 6.4 
            [BEAM] = p p,...              ! Chapter 9.1 Pythia manual 6.4 
            [ENERGY] = 510.0 ,...     ! Chapter 9.1 Pythia manual 6.4 



*******************************************************************************************

7) Set up KINEMATIC CUTS

 a) Set up Pt Cuts
 
Syntax;
                CKIN 3 = [PtLOW]
                CKIN 4 = [PtHIGH]


Where, 
 PtLOW = Minimun Pt you need     !Chapter 9.2 Pythia manual 6.4 
 PtHIGH = Maximum Pt you need  !Chapter 9.2 Pythia manual 6.4 

b) Set up eta(Pseudorapidity) Cuts

Syntax;
               CKIN 13 = [EtaMIN]
               CKIN 14 = [EtaMax]

                 
Where,
  EtaMIN, EtaMAX = Min and Max Eta you need       !Chapter 9.2 Pythia manual 6.4 

************************************************************************************************

   
8) Set up COLLISION VERTEX

Syntax;
                gvertex = [XVERTEX] [YVERTEX] [ZVERTEX]         ! put X,Y, Z Vertices in cm eg:   0.0 0.0 0.0
                gspread = [XSIGMA] [YSIGMA] [ZSIGMA]              ! put X,Y,Z Vettices offset  in cm eg: 0.0, 0.0, 0.02

*********************************************************************************************************

9) Set up HISTOGRAM  (if you need)

Syntax; 
                  title [FILE] geom [TAG] config [CONFIG]

Where,
  FILE = filename.fzd
 TAG  = y2006, y2009b, y2012...
 CONFIG = macro name you need to configure!


*********************************************************************************************************
10) Flag Decay modes you need as stable so that GEANT can handle them

eg: 
** These particles will be decayed by geant instead of pythia **
   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              ! Chapter 14.4 Pythia manual 6.4
   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


**********************************************************************************************
  11) Select SUBPROCESSES you need

Syntax,
                 
                     MSEL(0)
                     MSUB(MYLIST) = 1    
! Chapter 9.2 Pythia Manual 6.4



********************************************************************************************
 
12) TRIGGER and LOOP over all Events 

Syntax;

                     DO i=1 , [NEVENTS]            ! Chapter 3.5 Pythia manual 6.4
                     trig = [NEVENTS]    
                     ENDDO

*******************************************************************************************
13) List Events

        CALL PYLIST(1)         ! Chapter 15.1 Pythia Manual 6.4

******************************************************************************************

14) Final Printout of Pythia

      CALL PYSTAT(1)   ! Chapter 9.1 Pythia Manual 9.1




************************************************************************************
***example code****

MACRO codeName NEVE=0  RUN=