Kloe Memo 128-98

December 1997


The KLOE Montecarlo GEANFI


A. Antonelli, C. Bloise


  1. Foreword
  2. Introduction
  3. User's guide
  4. Daphne Simulation
  5. Particle Generators
  6. Detector Subsystems
  7. Data Structures


Foreword


As the knowledge of the details of the Kloe apparatus increases, the GEANFI program increases its complexity to take care of the different aspects of the physics that our experiment will attach, and of the detector responses. The simulation program has been essential and it will continue to support our studies to

The program runs everywhere the CERN together with the YBOS and the S_I Libraries have been installed, and it requires, in the most updated version, to accede the Kloe Database to retrieve the basic parameters of the detector, related to both, the apparatus geometry, and the sub-system response simulation.

The GBATCHDB and GEANFILASTDB files contain most of the basic code. The INTERFACE file contains the code for the loading of the parameters from the Database. The main program for the interactive version of GEANFI (GXINTDB) may help everybody to get started with GEANFI and to display the details of the simulation of complicated topologies.

The first version of GEANFI was written in 1992 and it is described in the Kloe Note 52/93. The system has been developed with continuity over the years, and the modifications generally lead to backward incompatibilities. The user is therefore invited to read the $VERSION directory contained in the current GEANFILAST.CMZ file where all changes are described in some detail.

The development and the maintenance of GEANFI are possible only thanks to the continuous collaboration of the Kloe members who use the program and contribute their feedback to the maintainers at LNF. It is of course impossible to mention all of them, and we wish to thank everybody and expresses the hope that they will continue to help us.

GEANFI, as the name suggests, is based on the GEANT code, version 3, originated from Brun and Andy McPherson at CERN in 1982 during the development of the OPAL simulation program.

Antonella Antonelli and Caterina Bloise wrote the greatest part of the detector description, together with the procedures to simulate the detector responses, to obtain and to store the information needed to accomplish the different studies, to create the YBOS banks for the output. Vincenzo Patera implemented the tracking procedure inside the drift chamber, that takes into account of the multiple scattering due to the wires, and calculates the drift times for each cell. Patrizia De Simone provided the description of the time-to-space relations by the analysis of the results of the GARFIELD simulation of the behaviour of each kind of cell existing in the drift chamber. Won Kim provided the basics to simulate the calorimeter responses, concerning timing and energy as well. The physic generators and the treatment of processes like the Kshort regeneration or the kaon interactions at the interesting energies have been developed thanks to the work of different authors. The original Phi decays are due to Alessandro Calcaterra and the code was developed later by Caterina Bloise; the Phi decays into f0-photon have been included thanks to Won Kim; the first Bhabha generator was written by V.Glagolev and the more sophisticated version was due to Elena Drago and Graziano Venanzoni; the cosmic muon generator has been created by Stefano Di Falco thanks also to the work done by Elena Drago and Andrea Smilzo, and the machine background has been implemented by Vincenzo Patera . The treatment of the kaon interactions, stimulated by Rinaldo Baldini, has been studied in the Andrea Michetti thesis and then re-attached by Maurizio Palomba. The Kshort rare decays (pai+pai-photon,3pai0,photon-photon), the Klong into pai+pai-photon, and the matrix element for the pai+pai-pai0/pai+pai-photon channels have been included thanks to Sergio Sinibaldi and Tommaso Spadaro. The routines related to the data retrieving from the Database have been written by Patrizia De Simone who takes care of the Database itself.

Many people contributed to the program development in these years, so that the list can be incomplete and we apologise for any omission.

Despite our efforts, the documentation is still far from perfect, we expect that the feedback from everybody will make it really useful.

The KLOE Montecarlo GEANFI

Caterina Bloise
March 15 1997


Introduction


The present documentation is divided into sections which follow the structure of GEANFI and its major functions.

Within each section, the main system functions or the details of subroutines are described. Subroutines which are not necessary for an understanding of the program flow have been omitted.

Special sections are devoted to the description of the input data cards, to the possible choices for the output, and to practical advices for running and for data retrieving by the analysis programs.

The framework offered by GEANT for event simulation is properly documented and it constitutes the basics to understand the GEANFI program flow. We will not repeat such a description here, apart from some reminders useful to understand the structure of the GEANFI procedures. Sometimes we will indicate inside square brackets the relevant section of the GEANT documentation where more information can be found.

Two main programs are available, for batch type operation (GBATCHDB), and for interactive operation (GXINTDB), both binary and source, in the GEANFI_EXE reference directory at LNF and on the AFS Kloe area both, at LNF, and CASPUR. The binaries refer to HP-UNIX and OSF platforms and are stored in different areas, pointed by the logical names set by the Kloe " setup offline '' command. The source is provided on the same disks in case the user wants to modify it, in the GEANFI_CMZ and in the GEANFI_SRC areas.

The main program allocates the dynamic memory for ZEBRA , for YBOS and HBOOK, it retrieves Database information via a call to the INTERFACE routine, and passes control to the three phases of the run:

  1. initialisation,
  2. event processing,
  3. termination;

in each of the three phases GEANFILASTDB provides the procedures in the appropriate routines.

The initialisation is controlled by UGINIT who has the responsibility:

  1. to call the GEANT routines for the initialisation of the common blocks, of the memory manager, of the link areas and the run header bank; to start the drawing package; to fill the data structure JPART with the particle properties, and the JMATE bank with the characteristics of the materials used; to compute energy loss and cross-section tables and store them in the data structure JMATE;
  2. to read free format data records either to modify the default options, or to provide information on the current run;
  3. to define the geometry of the different components of the setup;
  4. to define tracking medium parameters ;
  5. to specify which elements of the geometrical setup should be considered as sensitive detectors, giving a response when hit by a particle ( [HITS]).

The processing phase is triggered by a call to the subroutine GRUN which, for each event to be processed:

initialise event processing and create the event header bank JHEAD;
process one event;
clean up the part of memory used by the event and check that enough time is left for the next event ( [BASE200]).

The event processing starts with a call to GUKINE that generates or reads ( [IOPA]) the kinematics of the event following the user's prescriptions.

The event processing continues with a call to GTREVE that performs the following operations for each vertex in turn:

  1. moves all the particles attached to the vertex from the permanent stack JKINE to the temporary stack JSTAK;
  2. controls the propagation of each particle through the setup by calling GUTRAK ( [TRAK]); each particle is tracked in turn and when a sensitive detector is traversed, any useful information is kept in JHITS via the GEANT routines described in [HITS].

Secondary products generated by the current particle are processed before proceeding to the next particle.

The data structure JXYZ, containing the coordinates of space points along the tracks, can be filled during tracking ( [TRAK]) according to the data card SWIT. The storage of such an information can be useful in the interactive version because it allows to display the particle trajectory inside the apparatus.

Once the tracking of the entire event has been completed, a call to GUDIGI starts the simulation of the detector responses using the information recorded during particle transport.

At the end GUOUT performs the calling sequence to prepare, fill and output the YBOS banks, requested by the user via data-cards, to be attached by the ANALYSIS_CONTROL (A_C) programs.

Other routines called during the tracking phase triggered by GTREVE should be mentioned for completeness: