call CGAInit(steer, model, setup, host, user, passwd)
The parameters of this subroutine allow access to the MySql geometry
database used by the geometry model:
steer=the content of the steering file. If not present, the
empty string ("") can be passed.
model=the model name in the geometry database. Required.
setup=the detector setup. Can be passed the empty string ("").
host=the host name where the geometry database is running. Can
be passed as ' ' if one wants to connect to the geometry database
running
on aldebaran.in2p3.fr.
user=the user name for geometry database access. Can be passed
as ' ' if one wants to log on the "consult" account on the geometry
database
running on aldebaran.in2p3.fr.
passwd=the user password for geometry database access. Can be
passed as ' ' which means the default password for the "consult"
account
on the geometry database running on aldebaran.in2p3.fr.
The following example shows how one could call this subroutine:
CHARACTER*6 steer, model, setup, host, user, passwd
steer=' '
model='D08'
setup=' '
host=' '
user=' '
passwd=' '
call CGAInit(steer, model, setup, host, user, passwd)
OR
call CGAInit(' ', 'D08', ' ', ' ', ' ', ' ')
call CGAWhereAmI(point, volname)
The parameters of the subroutine are as follows:
point=the x, y, z coordinates (in centimeters) of the point.
MUST be defined REAL*8.
volname=the name of the volume (GEANT 4 logical volume) that
"point" is situated in. This is filled by the subroutine. If one did
not
allocate enough memory for volname, the name will be truncated.
The following example shows how one could call this subroutine and use its return value:
CHARACTER*30 volname
REAL*8 point(3)
point(1)=0
point(2)=175
point(3)=0
call CGAWhereAmI(point, volname)
write(*,15) volname
15 format(a)
call CGABeamOn(initial, final, direction, particle, energy, nbp)
The parameters of this subroutine are:
initial: the coordinates (in centimeters) of the point from
where
the particle is shot. MUST be defined REAL*8.
final: the coordinates (in centimeters) of the final point of
the particle's trajectory. If the particle is charged, it shall be
killed
as soon as it enters the volume (layer) that the final point is
situated
in. MUST be defined REAL*8.
direction: the direction that the particle is shot. MUST be
defined REAL*8.
particle: the particle's name
energy: the particle's energy. MUST be defined REAL.
nbp: the number of particles that we want to shoot
The following example shows how one could call this subroutine:
CHARACTER*30 particle
REAL*8 initial(3), final(3), direction(3)
REAL energy
INTEGER nbp
initial(1)=-68
initial(2)=169
initial(3)=0
final(1)=-200*sin(3.1418/8)
final(2)=200*cos(3.1418/8)
final(3)=0
direction(1)=final(1)-initial(1)
direction(2)=final(2)-initial(2)
direction(3)=final(3)-initial(3)
particle='geantino'
energy=20
nbp=1
call CGABeamOn(initial, final, direction, particle, energy, nbp)
OR
call CGABeamOn(initial, final, direction, 'chargedgeantino', 20.0,
1)
call CGAGetSteps(volnames, matnames, distance, prepoints, nbx0, ninterlen, nsteps, okflag)
The parameters of the subroutine are as follows:
volnames=an array of names of the volumes (GEANT 4 logical
volumes)
that the particle went through. This array is filled by the subroutine.
If one did not allocate enough memory for every name, the names will be
truncated.
matnames=an array of names of the materials (GEANT 4 materials)
that the particle went through. This array is filled by the subroutine.
If one did not allocate enough memory for every name, the names will be
truncated.
distance=an array of distances that the particle went along
in each volume. This array is filled by the subroutine. MUST be defined
REAL*8.
prepoints=a matrix of the x, y, z coordinates of the entrance
point in evry volume. This matrix is filled by the subroutine. MUST be
defined REAL*8.
nbx0=an array containig the number of radiation lengths in evry
volume that
the particle went through. This array is filled by the subroutine. MUST
be defined REAL*8.
ninterlen=an array containig the number of interaction lengths
in evry volume that
the particle went through. This array is filled by the subroutine. MUST
be defined REAL*8.
nsteps=the number of elements/volumes:
- the initial value is the number of elements
allocated
for volnames, distance, nbx0, and the number of rows allocated for
prepoints.
- the value after this subroutine returns is the
real number of layers that the particle went through.
okflag=when this subroutine returns, it is set to true if the
initial value of nsteps is greater or equal to the number of volumes
that
the particle went through, and if not, okflag is set to false
Thus,
one should test okflag before trying to use the return values of the
subroutine.
If it is false, one should allocate a larger amount of elements for the
above parameters.
The following example shows how one could call this subroutine and use its return values:
CHARACTER*30 volnames(1000), matnames(1000)
REAL*8 distance(1000), nbx0(1000), nintlen(1000), prepoints(1000, 3)
LOGICAL okflag
INTEGER nsteps
okflag=.true.
nsteps=1000
call CGAGetSteps(volnames, matnames, distance, prepoints, nbx0, nintlen, nsteps, okflag)
if(okflag .eqv. .true.) then
do i=1,nsteps
write(*,12)volnames(i),
matnames(i),
distance(i), prepoints(i,1), prepoints(i,2), prepoints(i,3), nbx0(i),
nintlen(i)
enddo
endif
12 format(a, 3x, a, 3x, f9.3, 3x, 3(f9.3, 3x),
f9.5, 3x, f9.5)
call CGAGetVolumeData(volname, distance, prepoints, nbx0, ninterlen, nsteps, okflag)
The parameters of the subroutine are as follows:
volname=the name of the (GEANT 4 logical volume) of the
module
of interest.
distance=an array of distances that the particle went along
in each module. This array is filled by the subroutine. MUST be defined
REAL*8.
prepoints=a matrix of the x, y, z coordinates of the entrance
point in evry module. This matrix is filled by the subroutine. MUST be
defined REAL*8.
nbx0=an array containig the number of X0 in evry module that
the particle went through. This array is filled by the subroutine. MUST
be defined REAL*8.
ninterlen=an array containig the number of interaction lengths
in evry volume that
the particle went through. This array is filled by the subroutine. MUST
be defined REAL*8.
nsteps=the number of elements/modules:
- the initial value is the number of elements
allocated
for distance, nbx0, and the number of rows allocated for prepoints
- the value after this subroutine returns is the
real number of modules that the particle went through.
okflag=when this subroutine returns, it is set to true if the
initial value of nsteps is greater or equal to the number of modules
that
the particle went through, and if not, okflag is set to false
Thus,
one should test okflag before trying to use the return values of the
subroutine.
If it is false, one should allocate a larger amount of elements for the
above parameters.
The following example shows how one could call this subroutine and use its return values:
CHARACTER*30 volname
REAL*8 distance(1000), nbx0(1000), nintlen(1000), prepoints(1000, 3)
LOGICAL okflag
INTEGER nsteps
okflag=.true.
nsteps=1000
volname='EnvLog'
call CGAGetVolumeData(volname, distance, prepoints, nbx0, nintlen, nsteps, okflag)
if(okflag .eqv. .true.) then
do i=1,nsteps
write(*,17)volname, distance(i),
prepoints(i,1),prepoints(i,2),
prepoints(i,3), nbx0(i)
enddo
endif
17 format(a, 3x, f12.8, 3x, 3(f9.3, 3x), f9.5)
Just call this subroutine with the flag as argument:
INTEGER Flag
call CGASetSD(Flag)
The subroutine selects the sensitive detector corresponding to the flag.
One can call this subroutine with the CellID as argument and the x, y, z variables that will contain the coordinates of the cell center as returned by the subroutine:
REAL*8 x, y, z
INTEGER CellID
call CGACellIndex(CellID, x, y, z)
Team working on the Geant4 simulation for The Next Linear Collider: