Procedure to generate ASCII output using Pythia event generator

advertisement
Complete Procedure to Generate HEPEvt ASCII Output Using
Pandora-Pythia Event Generator
Venkatesh Kaushik
venkat@hepmail.uta.edu
Univ. of Texas at Arlington
Dec. 10, 2002
Introduction
Geant 4[1] interfaced with Mokka [2] uses the ASCII format as input and output for
simulation of the detector. The need to generate events using Pythia is a standard
procedure. This document discusses a few minor modifications necessary for the Pythia
event generator to generate the ASCII output that is compatible with all versions of
Mokka starting with version 6 and above.
Modifications necessary
1. Unpack and install the current version of the pandora_pythia by logging in your
area. The version we are using currently is Pandora_Pythia3.2. The home
directory consists of the following 7 subdirectories
 bld
 lib
 pandpyth_src
 pandpyth_inc
 tauola
 pythia
 examples
2. Go to the Pythia homepage and download the latest version of the Pythia (the one
we are using is 6.208) into the ~/pandora_pythia_V3.2_simdet/pythia/
3. Modify the Makefile to include the current version as shown below.
# Makefile for library pythia
#
#
include ../bld/Makefile.setup
LIBPYTHIA = ../lib/libPythia.a
OBJS = $(LIBPYTHIA)(pythia6208.o)
all: $(OBJS)
clean:
rm -f $(LIBPYTHIA)
4. Go to the ~/pandora_pythia_V3.2_simdet/pandpyth_src/ subdirectory and include
the following FORTRAN code which generates the ASCII output format needed
by Geant4 as well as Mokka. Presently I have saved the program as HEP2G4.f.
Include the file for compiling along with pythia6208.f into the makefile above.
*
SUBROUTINE HEP2G4.f
*
* Convert /HEPEVT/ event structure to an ASCII file
* to be fed by G4HEPEvtInterface
*
http://wwwinfo.cern.ch/asd/geant4/G4UsersDocuments/UsersGuides/ForApplicati
on$
* Aug 09/02 Venkat
***********************************************************
PARAMETER (NMXHEP=2000)
COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
>JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,N
MXHEP)
DOUBLE PRECISION PHEP,VHEP
*
WRITE(6,*) NHEP
DO IHEP=1,NHEP
WRITE(6,10)
> ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP),
> PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP)
10 FORMAT(4I10,4(1X,D15.8))
ENDDO
*
RETURN
END
You
can
also
make
the
same
changes
in
the
~/pandora_pythia_V3.2_simdet/pandpyth_src/asciuser.f program instead, if you
choose to do that, you will have to include the above changes at the end of the
subroutine as follows –
….. other lines of code present here….
if (JMOHEP(1,I) .gt. 9999) JMOHEP(1,I) = 0
if (JMOHEP(2,I) .gt. 9999) JMOHEP(2,I) = 0
if (JDAHEP(1,I) .gt. 9999) JDAHEP(1,I) = 0
if (JDAHEP(2,I) .gt. 9999) JDAHEP(2,I) = 0
c Modified the output format to suit Geant 4
c Also refer HEP2G4.f, and asciuser.old to see how this file differs.
c Refer Pythia manual v6.02 (Section 5.2 through 5.4) for more info
WRITE(LUN,12,ERR=999) ISTHEP(I),IDHEP(I),(JDAHEP(J,I),J=1,2),
& (PHEP(J,I),J=1,3),PHEP(5,I)
ENDDO
12 FORMAT(4I10,4(1X, D15.8))
c End of modification..
RETURN
999 WRITE(*,*) 'LCWRITE: Error writing to file on unit ',LUN
5. Add a subroutine call to HEP2G4.f in the program gen_ascii.C at place it writes
the output. The subroutine call is done as follows in gen_ascii.C;
// there are other lines of code here….
// Write Event record to a file
// Format is the same structure as SIMDET
call HEP2G4
6. In the ~/pandora_pythia_V3.2_simdet/examples/ subdirectory, modify the C
program gen_ascii.C to include the following lines ( shown in boldface) at the end
of the file.
// there are other lines of code here….
pandora P(b1,b2,pr);
pandorarun PR(&P, nEvent, iseed_pan);
//PR.SetPrintEvent(10); // Set # events to be listed (default = 5 )
int LUN = 1;
PR.SetASCII(LUN);
// Output ascii file
The Pandora_pythia event generator is now set to output ASCII output as required by
Mokka interface to Geant4. By commenting out the line PR.SetASCII(LUN) from
the above example and rebuilding, one can write output in binary format.
References
[1] http://wwwinfo.cern.ch/asd/geant4
[2] http://polywww.in2p3.fr/geant4/tesla/www/mokka/mokka.html
Other useful links
http://polywww.in2p3.fr/geant4/tesla/www/mokka/software/install.html
Download