GSIM- New Features
Introduction
As more people work on the code they may wish to report improvements and
new features that are not in the main user
guide but should be because they change the behavior of the program.
This page intends to keep people up to date on such changes in the main
gsim distribution. If you would like add your own improvements feel free
to edit this page and send me the revised copy by mail to Maurik at improv.unh.edu
, or let me know what you did and I'll try to include a summary here.
Changes, Improvements, New Features:
SAVE - The option to save secondary tracks/vertexes.
Franz Klein.
I defined MCTK (#1) and MCVX (#1) banks that contain
secondary
particles/vertices.
It took a while because I couldn't simply copy the ZEBRA
banks
into BOS (if you use the electron library, not all input
tracks
were copied into ZEBRA banks ...).
The other problem was the inconsistent creation of a
KINE subbank
in step_ec.F.
The way how I implemented the code is the following:
if a daughter particle is produced during the tracking,
the corresponding generating process, medium and volume
numbers,
and parent track are stored in a KINE subbank.
This info is read out at the end of a event (bos_mcev.F)
and copied into the corresponding BOS banks:
MCTK (#1) and MCVX (#1) (<-record
no.=1)
You can specify which particles you want to save via the
geant lsave list:
FFread card: SAVE (or interactively: > SAVE ).
To get any secondaries the SAVE card has to be set:
SAVE 'ALL '
<-save all secondaries
SAVE 'DCAY' 'ALLP'
<-save all secondaries from
decay/absorption processes
SAVE 'DCAY' 'HADR'
<-save all hadrons from
decay/absorption processes
SAVE 'HADR' 0.01
<-save all hadrons with energy>0.01 GeV
SAVE 'ALL ' 'LEVL' 10
<-save all secondaries up to cascade
level 10
SAVE 'ELMG' 'MUON' 'DCAY' <-save
all elmg.parts (photon,e^-,e^+)
and muons from decay/abs. processes
etc.
For 'HADR' 'ELMG' 'MUON' one can specify the
min. energy (as above)
default values: Emin_hadr=0.1 GeV (i.e. all hadrons)
Emin_muon=0.1 GeV (i.e. all muons)
Emin_elmg=0.05 GeV
max. cascade level=100
The MCTK (#1) bank entries contain information about generating
and ending vertices as well as parent tracks
(if parent_track<0 : track_no from MCTK (#0) i.e.
primary track)
The flag entry in MCTK (#1) reflects the process that
causes
this track (the number corresponds to the geant NAMEC
names).
The flag entry in MCVX (#1) shows the (unique) volume
no. so that
one can retrieve those geometry informations.
Good luck
Franz
New Target for E2
Natalya Dashyan <natasha@jlab.org>
I made modifications in some of GSIM routines and
added few other routines in order to
include CLAS target cells and physical targets used during
E2 running period (there were
4 target cells for 3He and 4He and 3 solid targets used).
Changes had been made in the following files:
gsim//clas_ffky.F
gsim//clas_geom.F
gsim//clmate.inc
gsim//gsimcontrol.inc
gsim//cltmed.inc
gsim//gsimpar.inc
gsim//init_mate.F
gsim//init_tmed.F
The following files were added:
gsim//ugeom_12_15.F
gsim//ugeom_15_27.F
gsim//ugeom_8_12.F
gsim//ugeom_stg.F
gsim//ugeom_tg_e2.F
gsim//ugeom_ur.F
There are 2 parameters that control cell/target settings
(should be defined in ffread
file):
1. TGE2 - logical variable to turn new stuff on and off,
default .FALSE. - GSIM runs
with old target definitions.
2. TGTP - integer area of 3 elements
TGTP(1) - cell type, 0=No cell, 1=all Al cell (as for E1 and beginning
of E2),
2=E2 second cell, 3=E2 third cell, 4=E2 last cell.
TGTP(2) - liquid target type 0=empty, 1=H2, 2=D2, 3=3He, 4=4He.
TGTP(3) - solid target type 2=CH2, 12=12C, 56=56Fe, nothing otherwise.
Example of ffread with new target:
TGE2 TRUE
TGTP 4 3
Liquid 3He in the last cell of E2 run period.
TGE2 TRUE
TGTP 1 1
Liquid hydrogen in the aluminum cell (E1 setting).
Please let me know if you will fiend anything wrong with
new stuff or if you will have
any difficulties to run with.
A new BOS bank was added to the GSIM output which contains all the
FFREAD keys, the user name of the person executing the code, the name of
the input file and the unix time. The new bank, GPAR, contains an integer,
float and 16 character key name. For encoding details see gsimpar_2_bos.F
and gpar.ddl
Modified FFREAD flag: RNDM
|
Maurik Holtrop |
The basic behavior for the FFREAD flag is changed with the new version
of clas_ffgo.F. Now when RNDM is NOT specified, or set to 0 0, the random
seed will be derived from the unix time as:
seed1 = unix_time/100000+mod(unix_time,10)
seed2 = mod(unix_time/10,10000)
This ensures that both seeds change from second to second, and will
be usefull when farming out long runs.
Tracking Improvements: clas_step.c
|
Maurik Holtrop |
This is a major revision and rewrite of the clas_step.F routine. It
is converted to c, and the internal logic is much improved and new features
are enabled.
New features include:
-
All decay products are now always tracked regardless of the NOSEC setting.
contributed
by Cole Smith.
-
Of the decay products, neutrinos are skipped. contributed
by Cole Smith.
-
The NOSEC switch now works properly for MINI and TORU and FOIL.
-
Tracks are now stopped right after the EC, we no longer step through meters
of empty space.
-
The track debugging features are much improved (see below Track
Debugger).
-
The LAC and ST stepping function in now properly called.
Decays: In GEANT when a particle decays the resulting new particles
are normally treated exactly like the secondary particles from other processes.
However, to increase the speed of GSIM we usually turn of the generation
of secondaries in inert volumes. As a result, the decay products of a pi0
or Kaon would be lost. The new step routine will first check whether a
particle decayed or not. If it did decay it will store all the secondaries,
except for neutrinos, for further tracking. If it did not decay, it will
check the setting of the NOSEC flags to decide whether secondaries are
tracked or not.
Track Debugger: swit 3 #
|
Maurik Holtrop |
Debugging the tracks that GEANT produces poses some problems. Drawing
the track on the screen with "swit 1 2" is great, but does not always
provide sufficient information. Printing out the track to the console with
"swit 1 1" provides screen after screen of step information that
is difficult to sort through, and still does not give all the info you
may want. Thus a reason for the new track debugger.
This new feature for debugging is controlled with the "swit 3 #" command
line switch ( which performs the same action as the ISWIT ffread flag).
Currently two settings are implemented:
-
Every step is printed to the screen, but with different information than
swit
1 1
-
A line is printed every time the track leaves a volume.
The second setting is most usefull, allowing you to see instantly how many
steps were taken to cross a particular volume and how much energy was lost.
Each line contains the following elements:
[Track #, Stack #, Particle Name] Name of Volumes in tree
(#of steps in this Volume, Tot # of steps for track)
Kinetic Energy of track,
List of Physics processes
that affected this step.
An example printout of the first 4 lines with swit 3 2 and kine
3 1 1. 1. 30. 30. 0. 0. ( 1 Gev electron at 30 degrees.):
Trk# partname ] Volumes
(#step #step_tot) Kin_e Processes.
[ 1 0 ELECTRON ]: CLAS FOIL
GAS2
( 8 8) E: 999.486 MeV NEXT MULS
LOSS FIEL
[ 1 0 ELECTRON ]: CLAS FOIL
FOI1 FOI2
( 3 11) E: 999.434 MeV NEXT MULS LOSS
FIEL
[ 1 0 ELECTRON ]: CLAS FOIL
FOI1 FOI2 WIND
( 2 13) E: 999.396 MeV NEXT MULS LOSS
FIEL
[ 1 0 ELECTRON ]: CLAS FOIL
FOI1 FOI2
( 48 61) E: 999.291 MeV NEXT MULS LOSS FIEL
One can see that 48 steps were taken in the volume FOI2 which is a
daughter of FOI1 which is a daughter of FOIL in CLAS. The particle underwent
MULS LOSS and FIEL = multiple scattering, energy loss, and bending is a
field.
An example of the decay of K0-short kine 3 16 1. 1.
30. 30. 0. 0.:
[Trk# partname ] Volumes
(#step #step_tot) Kin_e Processes.
GUSER_STEP I: *** Default version of guser_step called
***
[ 1 0 KAON 0 SHORT]: CLAS FOIL GAS2
( 2 2) E: 619.323 MeV NEXT
Track 1 total # of steps:
2: 0
Secondaries [2] = PION PION
[Trk# partname ] Volumes
(#step #step_tot) Kin_e Processes.
[ 3 0 PION 0
]: CLAS FOIL GAS2
( 2 2) E: 220.271 MeV NEXT
Track 3 total # of steps:
2: 0
Secondaries [2] = GAMMA GAMMA
[Trk# partname ] Volumes
(#step #step_tot) Kin_e Processes.
[ 5 0 GAMMA
]: CLAS FOIL GAS2
( 2 2) E: 126.588 MeV NEXT
[ 5 0 GAMMA
]: CLAS FOIL FOI1 FOI2
( 2 4) E: 126.588 MeV NEXT
[ 5 0 GAMMA
]: CLAS FOIL FOI1 FOI2 WIND
( 2 6) E: 126.588 MeV NEXT
This shows that the kaon (with 600 MeV kinetic energy) decays into two
pions immediately, and the pion-0 decays into 2 gamma's immediately. The
gamma is then stepping through the detector, relatively unaffected by any
physics processes.
A new BOS bank, the DOCA bank, stores information from the Drift Chamber
(DC) hits, which allows the gsimko code to post-process DC wire information.
GSIMKO is now able to add resolution smearing and distance to time conversions.
A new commandline switch which allows GSIM to skip the first # events
of the BOS input file.
New FFREAD Card: FAST
|
Maurik Holtrop |
A new FFREAD card definition was added. The "FAST" card is now recognized
in the FFREAD input file. Alternatively you can use the command line switch
"-fast" which is equivalent to the FFREAD statement: "FAST 'ALL'" . This
switch is intended to allow you to switch between different levels of detail
in the code. The "fast" version will include less detail, and therefore
be less accurate, but execute faster. So far fast code has been implemented
for the SC system (30% speed improvement.)
Coding Using the new "FAST" switch:
To add code that makes use of the FAST switch, you need to include gsimcontrol.inc
(FORTRAN) of gsim_c_common.h (C code). For C code the statements would
then be:
#include "gsim_c_common.h"
extern GSIMCONTROL_t gsimcontrol_;
if( !gsimcontrol_.fast_code[SC] ){
/* Your SLOW code goes here. */
}else{
/* Your FAST code goes here. */
}
For Fortran:
#include "gsimcontrol.inc"
if(.not.fast_code(SC))then
else
endif
Please try to make use of this new feature !
Updated SC Geometry:
|
Maurik Holtrop |
The SC code dealing with geometry was completely re-written in C and
now makes use of 3-vectors to calculate proper geometry. All 6 sectors
are now independent and the geometry definition comes from the BOS bank:
sc_geom.bfp with the translations of the forward carriage and clam shells
applied for run #1 through a call to make_SCG_banks(1). This ensures that
the geometry for GSIM is identical the to geometry for RECSIS/A1.
If compiled with -DUSE_NOMINAL_BANK the file sc_geom.bfp.old_nominal.3.5.98
is used instead and the translations from the MAP are not applied.
The code has two modes: SLOW and FAST.
The slow code includes the lead wrapper around the SC paddle and the foam
backing and steel support structure, the fast code leaves these features
out. A speed gain of 30% is achieved when using the FAST
option.
The geometry of the mini torus has been updated by William
Dale Conwell from the University of Virginia Physics Dept. More information
and pictures of this update are available at UVA: "New
Mini Torus Geometry"
Unfortunately this code still needs a MAJOR revision for a code cleanup.
Updated Torus Geometry
|
Maurik Holtrop |
Modified Files: geom_mg.F clas_init.F
I have updated the geometry of the main CLAS Torus to correspond to
the outer limits of the vacuum case, according to the ACAD drawings
provided by Oxford (as dxf files.) Drawings used are: 0100-1.dxf, 0200-1.dxf,0350-1.dxf.
This is somewhat larger than the previous torus, which was implemented
as the coil windings. The old configuration can still be used by
specifying -DUSE_OLD_TORUS when compiling geom_mg.F of the gsim library.
The file clas_init.F was only changed to increase the half thickness of
the coil from 7. to 7.2 cm.
I have also added the three support rings as a set of four tube shapes
(tubs) in the mother volume LSS-. I used this mother
volume rather than MG because the support rings would extrude from
MG.
Drawings used are 0100-1.dxf ,0426-1.dxf and 66100-E002499. The material
chosen for the rings is clas_med_iron. The drawings below show cutouts
of the 3 rings shown in red.
Main shortcomming: The geometries are still hard coded in a "data"
statement instead of read from a BOS bank.
New Makefiles for gsim_int and gsim_bat:
|
Maurik Holtrop |
The new Makefile is very close to the old one, with the added feature
that all the *.F and *.c files in the gsim_int or gsim_bat directory are
included in the compilation, and will be included in the linking before
any
of the libraries. (Note that they are also included in the libgsim_int.a
or libgsim_bat.a library, but the standard make-scheme does not ensure
that those will be the routines used when linking.) Caveat
Empor: This will most likely FAIL on the Sun's with the new OS,
since the (stupid?) linker can't figure out which object to use: the one
from the library or the one from the command line. Solution:
use Linux.
The big advantage of this new Makefile is that you can now edit only
one of the files from the gsim library and recompile gsim_int or gsim_bat
without
having to checkout and recompile the entire libgsim.a The following
example assumes that you have a "packages" directory, we checkout the gsim_int
package, and only some of the guser*.F files from the gsim package, next
we move those files to gsim_int, edit them, and recompile:
packages>cvs checkout gsim_int
packages>cvs checkout gsim/guser_book.F gsim/guser_hist.F
gsim/guser_last.F
packages>mv gsim/guser_book.F gsim/guser_hist.F gsim/guser_last.F
gsim_int
packages>cd gsim_int
gsim_int>sed -e 's/Default/Personal/' < guser_book.F
> tmp.tmp && mv tmp.tmp guser_book.F
gsim_int>sed -e 's/Default/Personal/' < guser_hist.F
> tmp.tmp && mv tmp.tmp guser_hist.F
gsim_int>sed -e 's/Default/Personal/' < guser_last.F
> tmp.tmp && mv tmp.tmp guser_last.F
gsim_int>make exe
The resulting gsim_int (which will be in the usual place, most likely
~/bin/SunOS ) will report with "*** Personal version of guser_hist called
***" after the first trigger.
Now you can edit the guser*.F routines (and any other routine you checkout
and copy to the gsim_int directory) and modify them as you like.
REMEMBER: Never "commit" the personal modifications you made to guser*.F
routines. Never "commit" modified routines from the gsim_int or gsim_bat
directories !
Add PART bank to mcin format:
|
Maurik Holtrop |
The BOS input file format now also supports the PART bank. This new
bank is one of the output banks of RECSIS. Thus it is now possible to read
a RECSIS output file (once the RECSIS modifications are finished) directly
back into GSIM. This completes the loop: GSIM->RECSIS->GSIM which is usefull
for testing the consistency of the data analysis.
A small utility "gsim_bos_io" is now available in packages/utilities/bosanal
which reads, writes and converts GSIM BOS files. To get it use "cvs checkout
packages/utilities/bosanal" and compile with "make gsim_bos_io". To get
help on it's use type: "gsim_bos_io -help". This code is also intended
as an example event-generator code. See "Example
Generator"
I've added the polarized target field map. I created this map by a
Volker Burkert program and I've modified a set of subroutines to use this
map. I created two maps for polarized target field: the first is defined
in a small region around the target where the target field has an high
gradient and it has a finer step (bgrid_ptg.fpk ) the second is defined
in an external region and it has the same parameters of the existing torus
and mini map. This map is added to the other two in the file bgrid.fpk
New behaviour:
I defined a new value for PTGIFIELD. GSIM read the map if PTGIFIELD=3
I've summarised in the next table all possible magnetic field configuration
MAGTYPE |
PTG |
PTGIFIELD |
action |
0 |
F |
- |
no magnetic field |
0 |
T |
1,2 |
only ptg field analytically evaluated |
0 |
T |
3 |
only ptg field from map |
1 |
F |
- |
only torus field analytically evaluated in a simple way. |
1 |
T |
1,2 |
torus field analytically evaluated in a simple way +ptg field analytically
evaluated |
1 |
T |
3 |
only torus field analytically evaluated in a simple way ptg field from
map |
2 |
F |
- |
only torus field from map |
2 |
T |
1,2 |
torus field from map ptg field analytically evaluated |
2 |
T |
3 |
torus field from map ptg field from map |
3 |
F |
- |
torus field from map+mini field from map |
4 |
F |
- |
only mini field from map |
3,4 |
T |
- |
error mini and ptg are incompatible |
- |
F |
3 |
error ptg field without ptg geometry |
The default name of the ptg map is bgrid_ptg.fpk and the default directory
is $CLAS_PARMS . To change the name and the path I defined a new command
line flag and a new environment variable command line flag : -bptg
or environment variable : GSIM_BGRIDPTG
Modified files:
bgrid.inc : Contains the definitions of the polarized grid parameters
gsimpar.inc : Contains the definitions of the command line flag "bptg",
of the environment variable "GSIM_BGRIDPTG" and of the fpack file key "PTG"
init_mg.F : reads , if requested, the polarized target maps
clas_fld.F : evaluates the field in a point using the polarized target
maps if requested
ptg_field.F : evaluates the polarized target field in a point by interpolating
from the polarized target map like snake.F
init_flag.F : now, if MAGTYPE=0 it's possible to have only the polarized
target field
A copy of the polarized target field is in $CLAS_PARMS with the name
bgrid_ptgnew.fpk. If you want to use the new features you have to set the
name of the map with the environment variable GSIM_BGRIDPTG or with the
command line flag -bptg.
Example: -bptg $CLAS_PARMS/bgrid_ptgnew.fpk
For questions or comments: biselli@infnge.ge.infn.it
Background Simulation:
|
Maurik Holtrop |
Two screen shots of gsim_int with background simulation
turned on. The picture on the left has no mini-toroid field, the picture
on the right does. Note that the electron tracks (red tracks) for low energy
electrons are truncated because gsim does not do more than 1000 steps per
particle.
I have implemented a new set of subroutines for the gsim package that
simulate target related background events. This code was directly derived
from Volker Burkert's background routine in the old geant simulation. These
routines produce background event distributions that are based on an EGS
simulation of the target. These distributions are stored in an HBOOK file
and sampled randomly. The code will generate electron, photon (including
bremstrahlung) and positron background events.
New behavior:
The kine switch ( ffread key or gsim command-line) now accept new values
which are equal to the original kine value +10 ( -10 for negative kine
values). This turns on the background event generator. Thus, kine=1 reads
events from mcin, kine=11 reads events from mcin, plus generated background
events. A new value, kine=4, does nothing so that kine=14 generates only
background events.
New ffread keys:
NTARG: Select target type: (defaults to 1)
NTARG = 1 |
Hydrogen gas dens. 0.007g/cm3, length 76mm reads file $CLAS_PARMS/h_76mm_g.hst |
NTARG = 2 |
Hydrogen liquid dens. 0.07g/cm3 , length 76mm reads file $CLAS_PARMS/h_76mm_l.hst |
NTARG = 3 |
NH3 solid dens. 1g/cm3 , lenght 15mm reads file $CLAS_PARMS/nh3_15mm.hst |
NTARG = 4 |
Cu solid dens. 8.9 g/cm3 , lenght 10microm reads file $CLAS_PARMS/cu_10um.hst |
NTARG >= 5 |
User supplies background information, set ZTAR,ATAR,RHOT,TLENG and
supply a file bckgr.hbook. |
LUMEN - Luminocity, (defaults to 1E-32)
TIMDC - Time that one event is sensitive to background. (defaults
to 250E-9 sec)
NINCE - Number of events used to generate background file. (defaults
to 100000000)
ZELEM - Z of target. ATOM - A of target. RHOT - density of target
(g/cm3)
TLENG - lenght of target (cm)
New files: (in gsim package)
clas_bckgr.F - Contains the routines to calculate background
events.
ffky_bckgr.F - Handles the new keys (ffread) for target description.
ffpar_bckgr.inc - Contains common block that controls clas_bckgr
routine.
Modified files:
clas_kine.F - Now calls clas_bckgr when the flag ikine (kine
command on gsim command line) is set to previous kine value +10 - A new
"event generator", kine=4, was defined which does nothing. Thus kine=4
does nothing, kine=14 gives only background events.
clas_ffky.F - Now also calls ffky_bckgr
For comments or questions: holtrop(at)jlab.org