MOCADI 4.2

Naohito IWASA
GSI, Helmholtzzentrum für Schwerionenforschung GmbH,
Planckstr. 1, 64291 Darmstadt, Germany

Present Address: Department of Physics, Tohoku University
Sendai, Miyagi, 980-8578, Japan

revised: 25th Aug 2017

Index

  1. Introduction
  2. Environment Setup
  3. MOCADI Input Files
  4. ATIMA-1.0, BEAM, BR_SLIT, CALL,
    CHARGE_STATES, COLL, COMMENTS, COOLER,
    CROSS-SECTION, DECAY-IN-MAGNET, DRIFT, DRIFT-IN-GAS,
    END, EPAX, EPAX-PARAMETER, EQUILIBRIUM_CHARGE_STATES,
    EXPECTED_VALUES, FRAGMENT, HBOOK, IN-FLIGHT-DECAY,
    LOOP-ENDLOOP, MATRIX, MATRIXFILE, MATTER,
    OPTION, PRIMARY_BEAM, PRINT_COLL, PRINT_MATRIX,
    RAND, RANDOMIZE, REACTION_TARGET, READ,
    RESET, SAVE, SHIFT, SLIT,
    STOP, TABLE, TARGET, WEDGE
  5. How to execute MOCADI
  6. MOCADI Output Files
  7. A standard routine for MOCADI calculation

1 Introduction

A precise knowledge of distributions of relativistic heavy ions penetrating through layers of matter in ion-optical systems taking into account higher-order image aberrations is important for experiments with energetic secondary beams. For the purpose, the Monte Carlo code MOCADI was developed in the late 1980's by T. Schwab, H. Geissel, and A. Magel on IBM computers with PL/I language. MOCADI has been used for design studies of the fragment separator (FRS) at GSI and is used for preparation and analysis of experimental programs at the FRS. MOCADI is an excellent tool for studying beam properties, luminosity, separation quality, implantation profiles, optimization of the experimental setup, and transmission.
We translated MOCADI into C-language on LINUX and improved its input and output format [1]. CERN-standard one- and two-dimensional histograms (HBOOK) and list-mode output as well as NTUPLE and ROOT Trees are available [2]. The precise knowledge of the atomic and nuclear interaction of relativistic heavy ions is important. It was tested in series of experiments [3, 4] and led to an improved theory. MOCADI includes this in the form of the energy loss code for heavy ions ATIMA-1.3. If you have any problems with the MOCADI, please contact with Naohito Iwasa, or Helmut Weick.

2 Environment Setup

In this section, we explain how to install MOCADI on your Linux computer. You can download the executable MOCADI and data files. Since new spline files calculated by ATIMA1.3 are used from version 3.5, we recommend you to install the new spline files. First, unpack the mocadi-data-35.tgz file using the following command
tar zxvf mocadi-data-35.tgz
If you have a super user account, we recommend to move the data directory to /usr/local/mocadi, which is the default directory for MOCADI. If not, one can set the directory by defining the environment variable MOCADI_DIR using the following command.
setenv MOCADI_DIR /home/user/mocadi (for csh)      or
export MOCADI_DIR="/home/user/mocadi" (for ksh))

If you have super user account, please type following commands.

su
cd /usr/local
mkdir mocadi
cd mocadi
tar zxvf ~user/mocadi-data-35.tgz
mkdir exe
cd exe
mv ~user/mocadi-35 ./
ln -s mocadi-35 /usr/local/bin/mocadi
When you don't have super user account, please type following commands.
cd
mkdir mocadi
cd mocadi
tar zxvf ../mocadi-data-35.tgz
mkdir exe
cd exe
mv ~/mocadi-35 ./
ln -s mocadi-35 mocadi
alias mocadi ~/mocadi/exe/mocadi
setenv MOCADI_DIR /home/user/mocadi/ (in case of csh)

A MOCADI version which can make ROOT-Tree output is available (mocadiR). Please install a matching version of root on your computer, because mocadiR cannot run when root is not installed or a different version of root or gcc are installed. One version was compiled by Scientific Linux 6.1 using root_v5.32.00 is mocadi-35.SL61R532, and another version by Debian 4.0 using root_v5.23.04 is mocadi-35.DB40R527. A static link version is possible, but we cannot distribute it because of strong restrictions by the GNU Lesser General Public Licence (LGPL) of root. There is a GUI for MOCADI called as GMOCADI.

3.MOCADI Input Files

A MOCADI input file (the default extension is ".in") is necessary for executing MOCADI. The input file consists of comment lines and keyword lines. The keywords are not case sensitive.

3.1 Comments

Comments can be inserted at any place in the input file as line comments and block comments

Line Comment

* line of comment

Block Comments

/*
lines
of
comments
*/

3.2 END

END

The "END" keyword marks the end of an input file. The keyword should be written at least once in a MOCADI input file. Keywords that follow the "END" keyword are ignored.

3.3 BEAM

The "BEAM" keyword marks the beginning of Monte Carlo simulation. The keyword should be written once in the beginning of a MOCADI input file.

BEAM
N
E0, T0, mass, charge, electron
modeXA
maxX, maxA, rXA,X0, A0
modeYB
maxY, maxB, rYB, Y0, B0
modeET
maxE, maxT, rET, E1, T1

N ions of the primary beam with charge, mass, and electrons are produced with initial position distribution (X, Y), angular distribution (A, B), energy distribution (E) and time distribution (T). The initial distributions are calculated event by event as follows. (The r parameter is not used up to now.)

X=X0+dX
A=A0+dA
Y=Y0+dY
B=B0+dB
E=E0*(1+(E1+dE)/100)
T=T0*(1+(T1+dT)/100)

where distributions dX, dA, dY, dB, dE, and dT are calculated from mode*, max* and r* parameters.
mode
0 fixed. d=max
1 uniform distribution, -max* < d* < +max*
2 Gaussian distribution, sigma*=max*
4 uniform distribution in the Ellipse (d1/max1)2+(d2/max2)2<= 1
6 uniform distribution in the 6 dimensional Ellipse (only for modeXA), (dX/maxX)2 + (dA/maxA)2 + (dY/maxY)2 + (dB/maxB)2 + (dE/maxE)2 + (dT/maxT)2 <= 1
7 uniform distribution in the 4 dimensional Ellipse (only for modeXA), (dX/maxX)2 + (dA/maxA)2 + (dY/maxY)2 + (dB/maxB)2 <= 1
8 uniform distribution in the 2 dimensional Ellipse (only for modeXA), (dX/maxX)2 + (dY/maxY)2 <=1, (dA/maxA)2 + (dB/maxB)2 <= 1
9 Gaussian distribution with sigmaX=maxX, sigmaA=maxA, sigmaY=maxY, sigmaB=maxB, sigmaE=maxE, sigmaT=maxT, (only for modeXA
The units of energy(E), time(T), position(X, Y), and angle(A, B) are MeV/u, micro-second, centimeter, and milli-radian, respectively.

3.3a READ

READ
N
filename
format, isave, fragment, option

The "READ" keyword marks to read ion coordinates from listmode file of filename instead of using the "BEAM" keyword. Note that the keyword cannot be used together with the "TARGET" keyword.
format 5: ASCII format 6: gzipped ASCII format
isave 1: first save point
2: second save point
.........
fragment 0:primary beam
1:fragment 1 (fragment written in TARGET card)
2:fragment 2 (fragment written in FRAGMENT card)
......

3.4 DRIFT

DRIFT length

or

DRIFT
length

The "DRIFT" keyword defines a distance of length[cm] along the optical axis in vacuum.

3.4a DRIFT-IN-GAS

DRIFT-IN-GAS
length,mass,charge,thickness
Fklwi, Fenstr

The "DRIFT-in-gas" keyword defines an element of length[cm] along the optical axis in a gas specified as mass and charge with a certain thickness[mg/cm2]. Fklwi and Fenstr are flags (1:on, 0:off) to calculate angular and energy straggling, respectively.

3.4b IN-FLIGHT-DECAY

IN-FLIGHT-DECAY
length, mass, charge, decay_mode, half-life, Q-value, turn

The "IN-FLIGHT-DECAY" keyword defines a drift element of length[cm] along the optical axis in vacuum. Particles with mass[amu] and nuclear charge[e] can decay with a distribution along the path according to their half-life[ms]. When half-life is set to zero, all particles must decay inside the given length. When Q-value[MeV] is set to zero or is higher than the Q-value to the ground state a new Q-value is calculated from the mass table, assuming decay to the ground state of the daughter nucleus. When turn is set to zero, the decay can occur in all turns of a loop. In case of possitive value, the decay can occur only in corresponding turn of the loop.
decay_mode
1 α decay
2 β- decay
3 electron capture decay
4 β+ decay
5 proton decay
6 neutron decay

3.5 COLL

COLL shape, X0, Y0, Xmax, Ymax, sig_fac

or

COLL
shape, X0, Y0, Xmax, Ymax, sig_fac

The "COLL" keyword marks to place a collimator. The possible collimator shapes are given in the table. The units of X0, Y0, Xmax, Ymax, sig_fac are centimeters.
shape
1 A rectangular position collimator X0-Xmax < X < X0+Xmax, Y0-Ymax < Y < Y0+Ymax
2 A rectangular angular collimator X0-Xmax < A < X0+Xmax, Y0-Ymax < B < Y0+Ymax
3 A elliptical position collimator ((X-X0)/Xmax)2 + ((Y-Y0)/Ymax)2 < 1
4 A special position collimator designed for FRS X0-Xmax < X < X0+Xmax, Y0-Ymax < Y < Y0+Ymax, abs((X-X0)(Y-Y0)) < sig_fac2/2 

3.5a SLIT

SLIT

XMIN, XMAX, YMIN, YMAX

The "SLIT" keyword defines a rectangular collimator (XMIN < X < XMAX, YMIN < Y < YMAX)

3.6 MATRIX

MATRIX
filename
A0, Z0, E0
order1, order2

or

MATRIX, filename, order1, order2, A0, Z0, E0

The "MATRIX" keyword marks to place a part of an electro-magnetic ion-optical system described by a transfer matrix.
The matrix parameters of the system should be written in filename in the directory which is marked by the "MATRIXFILE" keyword. MOCADI can read output files by GIOS, TRANSPORT and GICOSY (GICOSY matrix is tested). The matrix parameters up to order1th order are used in the calculation (max. up to 3rd order). The magnetic rigidity is calculated from information of the reference particle, A0 [amu], Z0 , and E0 [MeV/nucleon]. Note that this keyword moves the z-position by the length specified in the matrix file.

3.7 SAVE

SAVE

The "SAVE" keyword sets that MOCADI stores a list-mode output file with all particle coordinates (positions, directions, energies and so on) by event by event. Output filename and format are chosen by using the "OPTION LISTMODE" keyword.

3.8 TARGET

TARGET
At, Zt, rho, distr, E1, E2, θmin, θmax,
Af, Zf
mode, thickness, Aref, Zref, Eref
Fklwi, Fenstr, Fgold, Fwico, Fkauf, Freact

The "TARGET" keyword places a target.
At mass number of target
Zt nuclear charge of target
rho density in mg/cm3
distr
case Freact=0
formula for momentum distribution of fragment
1: Goldhaber (Phys. Lett. 53B, 306)
2: Morrissey (Phys. Rev. C39, 460)
3: Lorentzian (width given only by parameter Fgold)
4: zero spread
else: default is Goldhaber
case Freact=-2,-3
formula for energy distribution of evaporation neutron (from 3.5)
1: constant Erel=1.7MeV, En=Erel*mass(A-1,Z)/mass(A,Z)
2: constant Erel=2*sqrt(E**10/mass(A,Z))
else: default is 1
E1,E2
case Freact=-1
excitation energies of outgoing and residual particles in MeV respectively.
case Freact=-2,-3
energy window of fusion reaction in the center of mass system in MeV (see Freact)
θmin
θmax
case Freact=-1
angular range to consider in calculation of two body kinematics, isotropic between θmin and θmax in the center of mass system in degree
Af fragment mass
Zf fragment nuclear charge
mode thickness input mode
1,2 : thickness in ratio of range of reference particle
3,4 : thickness in cm
5,6 : thickness in mg/cm2
thickness target thickness
Aref mass of reference particle
Zref charge of reference particle
Eref energy of reference particle [MeV/nucleon]
Fklwi small angle scattering
1 : on
0 : off
Fenstr energy straggling
1 : on
0 : off
Fgold parameter to scale the width of momentum distribution. The usual value is 1.
case distr>=0
scale factor for chosen type of distribution. see paremeter distr
case distr<0
the absolute of Fgold is used to scale the width of Morrissey distribution.
The mode if automatically switched to Morrissey to be compatible with old input file.
Fwico Coulomb scattering
1 : on
0 : off
Fkauf energy loss in fragmentation
 0 : off
 1 : Kaufman (Phys. Rev. C22, 1897)
-1 :Morrissey (Phys. Rev. C39, 460)
-2 :parabolic formula by Notani (Phys. Rev. C76, 044605) with e=12MeV (E<200AMeV)
-3 :parabolic formula by Notani (Phys. Rev. C76, 044605) with e=8MeV
Freact select reaction mode
0 : fragmentation
1 : fission energy from table of M.Bernas
2 : old original Viola systematics from 1966
3 : Brosa formula (Nucl .Phys. A502 423C (1989)); Viola style formula but based on theory
4 : D.J. Hinde et al.'sformula (Nucl. Phys. A472 318 (1987)), considers asymmetric fission for TKE, symmetric coincides with new Viola
5 : B.D. Wilkins et al.'s formula (Phys. Rev. C14, 1832 (1976)) as used by K.-H. Schmidt, considers asymmetric fission
6 : new article by Viola (Phys. Rev. C31,, 1550 (1985))
-1 : two body kinematics (from 3.3) excitation energies of fragment and residue are defined by E1 and E2. θmin and θmax are angular range in center of mass system.
-2 : a simple model of fusion evaporation reaction (from 3.5) fusion process occurs when Ecm is in the window from Bfu+E1 to Bfu+E2, where Bfu is fusion barrier in MeV. When E1<0, E1 is set to 0 MeV. When E2<0, E2 is set to 10 MeV. Neutrons are evaporated while excitation energy is above Sn+Erel. The parameters Af and Zf are not used in the mode.
-3: same as Freact=-2, except for fusion process occurs when Ecm is in the window from E1 toE2. (from 3.5)
In case of fission, two body kinematics, and fusion-evaporation, Fgold, Fkaufare not used.
Material list are described in subsection 3-25.

3.8a REACTION-TARGET

REACTION-TARGET
At, Zt, rho, distr, E1, E2, θmin, θmax ,
Af, Zf, ID,
mode, thickness, Aref, Zref, Eref,
Fklwi, Fenstr, Fgold, Fwico, Fkauf, Freact

The "REACTION-TARGET" keyword places a secondary target. The difference from the "TARGET" keyword is following.
1) The beam particles impinge on a target material (At, Zt) with the thickness. All the particles defined by the fragment identifier ID (0: primary beam, 1: secondary beam defined by the TARGET, 2: secondary beam defined by the FRAGMENT keyword) change to another particle (Af,Zf) by the reaction (100%). The other particles pass through the material without a change.
2) The reaction probability of 100% is not realistic. Please multiply the real reaction probability to the yield.
The other parameters were described as follows.
At mass of the target
Zt charge of target
rho density in mg/cm3
distr
case Freact=0
formula for momentum distribution of fragment
1: Goldhaber (Phys. Lett. 53B, 306)
2: Morrissey (Phys. Rev. C39, 460)
3: Lorentzian 4: zero spread else: default is Goldhaber
case Freact=-2,-3
formula for energy distribution of evaporation neutron (from 3.5)
1: constant Erel=1.7MeV, En=Erel*mass(A-1,Z)/mass(A,Z)
2: constant Erel=2*sqrt(E**10/mass(A,Z))
else: default is 1
E1,E2
case Freact=-1
excitation energies of outgoing and residual particles in MeV respectively.
case Freact=-2,-3
energy window of fusion reaction in the center of mass system in MeV (see Freact)
θmin
θmax
case Freact=-1
angular range to consider in calculation of two body kinematics, isotropic between θmin and θmax in the center of mass system in degree
Af fragment mass number
Zf fragment nuclear charge
ID fragment ID to select reacting particle
0: from primary beam
1: from fragment defined in the TARGET keyword,
n: from full list of fragments entry number n, 1=defined in TARGET
others: no reaction
mode thickness input mode
1,2 : thickness in ratio of range of reference particle
3,4 : thickness in cm
5,6 : thickness in mg/cm2
thickness target thickness
Aref mass of reference particle
Zref charge of reference particle
Eref energy of reference particle [MeV/nucleon]
Fklwi small angle scattering
1 : on
0 : off
Fenstr energy straggling
1 : on
0 : off
Fgold parameter of scale the width of momentum distribution
distr>=0, scale factor for chosen distribution, see parameter distr.
distr<0, the absolute of Fgold is used to scale the width of the Morrissey distribution.
The mode is automatically switched to Morrissey to be compatible with old input files.
Fwico Coulomb scattering
1 : on
0 : off
Fkauf energy loss in fragmentation
0 : off (velocity of fragment= velocity of projectile)
1 : Kaufmann (Phys. Rev. C22, 1897)
-1 : Morrissey (Phys. Rev. C39, 460)
-2 : parabolic formula by Notani with e=12MeV (E<200AMeV)
-3 : parabolic formula by Notani with e=8MeV
Freact select reaction mode
0 : fragmentation
1 : fission energy from table of M.Bernas
2 : old original Viola systematics from 1966
3 : Brosa formula Nucl .Phys. A502 423C (1989), Viola style formula but based on theory
4 : D.J. Hinde et al. Nucl. Phys. A472 318 (1987), considers asymmetric fission for TKE in the symmetric case it coincides with new Viola
5 : B.D. Wilkins et al. Phys. Rev. C14, 1832 (1976), as used by K.-H. Schmidt, considers asymmetric fission
6 : new article by Viola Phys. Rev. C31, 1550 (1985)
-1 : two body kinematics (from 3.3) excitation energies of fragment and residue are defined by E1 and E2. θmin and θmax are angular range in center of mass system.
-2 : a simple model of fusion evaporation reaction (from 3.5). fusion process occurs when Ecm is in the window from Bfu+E1 to Bfu+E2, where Bfu is fusion barrier in MeV. When E1<0, E1 is set to 0 MeV. When E2<0, E2 is set to 10 MeV. Neutrons are evaporated while excitation energy is above Sn+Erel. The parameters Af and Zf are not used in the mode.
-3: same as Freact=-2, except for fusion process occurs when Ecm is in the window from E1 to E2. (from 3.5)
In case of fission, two body kinematics, and fusion evaporation, Fgold, Fkauf are not used.
The material list is described in subsection 3-25.

3.9 WEDGE

WEDGE
Aw, Zw, rho
thick0, thick1, thick2
mode, Aref, Zref, Eref
Fklwi, Fenstr, Fgold, Fwico,Fchstr
modeu, thicku0, thicku1, thicku2

The "WEDGE" keyword marks to place a wedge-shaped energy degrader.

Aw mass number of degrader material
Zw nuclear charge of degrader material
rho density in mg/cm3
thickness = thick0 + thick1*X + thick2*X2
mode input mode of degrader thickness
1,2: thickness in fraction of the range of the reference particle
3,4: thickness in cm
5,6: thickness in mg/cm2
7,8: curved sheet thickness in cm
9,10: curved sheet thickness in mg/cm2
11,12: polynomial of curve z(x) in cm
7,9,11 defines sheet bend to +z for positive x
8,10,12 defines sheet bend to -z for positive x
Aref mass of reference particle
Zref charge of reference particle
Eref energy of reference particle [MeV/nucleon]
Fklwi small angle scattering
1 :on;
0 :off
Fenstr energy straggling
1 :on;
0 :off
Fgold empirical momentum distribution of fragments
1 :Goldhaber (Phys. Lett. 536, 306)
-1 :Morrissey (Phys. Rev. C39, 460)
0 :off
Fwico Coulomb scattering
1:on
0:off
Fchstr charge-state straggling (from 3.3)
1 :on
0 :off
modeu wedge thickness random mode;
0 :degrader thickness fixed
1 :rectangular distribution
2 :Gaussian distribution
thicku0 thick0 = thick0 * (1 + rnd * thicku0)
thicku1 thick1 = thick1 * (1 + rnd * thicku1)
thicku2 thick2 = thick2 * (1 + rnd * thicku2)
The material list is described in subsection 3-25.
More information on degrader shapes.

3.10 FRAGMENT

FRAGMENT
mode, para
Z1, A1
..., ...
Zn, An

calculation of many fragments
mode para
1 loop around selected fragment number of loop around reference
2 use fragment list number of fragments in following lists

3.11 BR_SLIT

BR_SLIT
A, Z, E, dBrho/Brho
X0, Y0, Xmax, Ymax
A0, B0, Amax, Bmax

Only particles within the specified Brho,X,Y,A,B gate are transmitted.
A mass
Z charge
E energy in MeV/nucleon
dBrho/Brho momentum width in %
X0 x-center in cm
Y0 y-center in cm
Xmax horizontal position acceptance in cm
Ymax vertical position acceptance in cm
A0 horizontal angular center in X in mrad
B0 vertical angular center in Y in mrad
Amax horizontal angular acceptance in mrad
Bmax vertical angular acceptance in mrad

3.12 EXPECTED_VALUES

EXPECTED_VALUES
Gives mean values and standard deviations at this plane in the *.out file. When one use it inside of a loop, the values are printed only for the first and final turn.
  ********* erwartungswerte   1 *********************************************
   i_fragment  =         1
   tr: teilchen  =       5000 wi: teilchen  =        5000.000 (      5000.000)
The values of ``tr: teilchen'' and `` wi: teilchen'' are the number of particles out of the initial number "N" defined in the "BEAM" keyword, which reached the position with and without reaction loss in matter, respectively. The number in the bracket is normalized by production ratio of the first fragment.
      tr: opt    =          1    tr: total =          1
The values of ``tr: opt'' and `` tr: total'' are optical and total transmission, respectively.
      yield  =     1.75199e-15 particle/incident particle
                       z   =          0.0000cm

     <     x     >=  1.845662e-03 cm     sigma     x     =  1.504662e-01 cm
   max     x      =  2.978668e-01 cm       min     x     = -2.985561e-01 cm

     <     a     >=  3.880326e-02 mrad   sigma     a     =  9.157174e+00 mrad
   max     a      =  3.433984e+01 mrad     min     a     = -3.546690e+01 mrad

     <     y     >= -2.233547e-04 cm     sigma     y     =  1.508757e-01 cm
   max     y      =  2.988374e-01 cm       min     y     = -2.982259e-01 cm

     <     b     >= -7.961342e-02 mrad   sigma     b     =  9.101841e+00 mrad
   max     b      =  2.994561e+01 mrad     min     b     = -2.841818e+01 mrad

     <  energie  >=  6.608078e+02 MeV/u  sigma  energie  =  1.736236e+01 MeV/u
   max  energie   =  7.184377e+02 MeV/u    min  energie  =  6.011868e+02 MeV/u

     <   time    >=  0.000000e+00 mu s   sigma   time    =  0.000000e+00 mu s
   max   time     =  0.000000e+00 mu s     min   time    =  0.000000e+00 mu s

     <  mass     >=  7.594830e+01  u     sigma  mass     =  2.829050e-05  u
   max  mass      =  7.594830e+01  u       min  mass     =  7.594830e+01  u

     <    z      >=  2.800000e+01        sigma    z      =  0.000000e+00
   max    z       =  2.800000e+01          min    z      =  2.800000e+01

     < electrons >=  0.000000e+00        sigma electrons =  0.000000e+00
   max electrons  =  0.000000e+00          min electrons =  0.000000e+00

     <  nf/nsf   >=  1.000000e+00        sigma  nf/nsf   =  0.000000e+00
   max  nf/nsf    =  1.000000e+00          min  nf/nsf   =  1.000000e+00

     <  tof-tim  >=  0.000000e+00 mu s   sigma  tof-tim  =  0.000000e+00 mu s
   max  tof-tim   =  0.000000e+00 mu s     min  tof-tim  =  0.000000e+00 mu s

     <  delta e  >=  8.212329e+03 MeV    sigma  delta e  =  3.961656e+03 MeV
   max  delta e   =  1.522776e+04 MeV      min  delta e  =  1.336284e+03 MeV

     <   brho    >=  1.168379e+01  Tm    sigma   brho    =  1.936613e-01  Tm
   max   brho     =  1.232150e+01  Tm      min   brho    =  1.101235e+01  Tm

3.13 STOP

STOP
A, Z
The ``STOP'' keyword stops the beam and the remaining flight length in matter with molar mass A and charge Z is calculated.
An input of exact integer A will be shifted to the real mass of a monoisotopic target with mass number A. Input "0" can be used for the standard natural average molar mass on earth.
The mass number is important, as the number of atoms in a target with given areal density varies with it, and the atomic energy loss will differ.
The material list is described in subsection 3-25.

3.14 RESET

RESET
The ``RESET'' keyword defines the start of the TOF measurement.

3.15 RAND

RAND
sigmaX, sigmaA, sigmaY, sigmaB, sigmaE, sigmaT, sigmaTOF
sigma X=X+sigmaX*rand
sigma A=A+sigmaA*rand
sigma Y=Y+sigmaY*rand
sigma B=B+sigmaB*rand
sigma E=E+sigmaE*rand
sigma T=T+sigmaT*rand
sigmaTOF TOF=TOF+sigmaTOF*rand
A Gaussian distribution is randomly added to each variables.

3.15a SHIFT

SHIFT
dX, dY, dZ, dX', dY', dTOF

The "SHIFT" keyword shifts all the ions coordinates by -dX cm, -dY cm, -dZ cm, -dX' mrad, -dY'mrad -dTOF us.

X=X+dX
Y=Y+dY
Z=Z+dZ
X'=X'+dX'
Y'=Y'+dY'
TOF=TOF+dTOF

3.16 MATTER

MATTER
Am, Zm, rho
mode, t1, t2, t3,t4
modeg, g1, g2
dx, dy, turn_angle
Fklwi, Fenstr, Fchstr
modeu, thicku0, thickdu1,thickdu2

Am molar mass of matter (0 = std. average molar mass)
Zm nuclear charge of matter
rho density in mg/cm3
An input of exact integer Am will be shifted to the real mass of a monoisotopic target with mass number A. Input "0" can be used for the standard natural average molar mass on earth.
The mass number is important, as the number of atoms in a target with given areal density varies with it, and the atomic energy loss will differ.

mode target thickness input mode
parameter t1 t2 t3 t4
1 reference fraction mass charge energy
2 cm thickness
3 mg/cm2 thickness

modeg geometry input mode
parameter g1 g2
0 homogeneous matter
1 degrader slope
[/cm](mode=1)
[](mode=2)
[mg/cm3](mode=3)
2 round wire distance [cm]
3 rectangular wire distance [cm] strip width[cm]
4 hole target hole radius [cm]

dx shift in x-direction in cm
dy shift in y-direction in cm
turn_angle in degree around z-axis

Fklwi small angle scattering 1:on, 0:off
Fenstr energy straggling 1:on, 0:off
Fchstr charge-state straggling
0:off
1: (0.5 .. 1.5) built in GLOBAL x-sections, simple scaling q2*Fchstr for dE/dx(q)
2: built in GLOBAL x-sections, dE/dx(q) from special spline files
-1: (-0.5 .. -1.5) ext. x-sections table, simple scaling q-2*Fchstr for dE/dx(q)
-2: ext. x-sections table, dE/dx(q) from special spline files

modeu matter thickness random mode
0 degrader thickness fixed
1 rectangular distribution
2 Gaussian distribution
thicku0 thick0=thick0*(1+rnd*thicku0)
thicku1 thick1=thick1*(1+rnd*thicku1)
thicku2 thick2=thick2*(1+rnd*thicku2)

The material list is described in subsection 3-25.
In a calculation with charge-state changes the matter is divided into many layers of a free path length. Since 4.0d the calculation of cross sections by the GLOBAL routines is directly included in the code. However, using a precalculated table gives much faster calculation. Some common cases can be found here. There is one file for each combination of atomic number Z of projectile and matter. It contains polynomial coeffcients as function of energy and up to 19 charge-states.

3.17 TABLE

TABLE
N
erwa1, element1
.................
erwan, elementn

To generate a table with the determined values.
n number of table entry
erwa number of"EXPECTED_VALUES" in the input file (e.g. when 3, a value of the 3rd EXPECTED_VALUES is printed)
element key number from list below
element
1x [cm]
2a [mrad]
3y [cm]
4b [mrad]
5energy [MeV/nucleon]
6time [micro-second]
7masse [amu]
8z
9electrons
10nf/nsf
11range [mg/cm2]
12tof-tim [micro-second]
13delta-e [MeV/nucleon]
14brho [Tm]
15optical transmission, no sigma value
16total transmission, no sigma value
17z-position [cm], no sigma value
18yield(particle/incident particle)
for sigma value, add 100 to respective key number.

3.18 MATRIXFILE

MATRIXFILE
directory

The ``MATRIXFILE'' keyword sets the path name to the directory where the matrix files are read from using the ``MATRIX'' keyword.
directory name of the directory for matrix input
default: current directory

3.19 PRIMARY_BEAM

PRIMARY_BEAM
primcharge

The "PRIMARY_BEAM" keyword is a flag to calculate primary beam as well after the target .
primcharge =0 Atomic charge states are calculated in the same way as for fragments
=1Charge-state distribution is calculated (independent of switch in the keyword "CHARGE_STATES", but the distribution, which is defined in this element is used)

3.20 CHARGE_STATES

CHARGE_STATES
n, offset
prob0, prob1, ..., prob(n-2)

The charge-state distribution is generated. Each ion is randomly assigned a new charge state according to the given probabilities.
n distribution with n charge states
offset offset of charge states. default 0 (from version 3-5)
prob0 ions with offset electrons in %
prob1 ions with offset+1 electrons in %
prob(n-1) ions with offset+n-1 electrons in %
The fraction missing to 100% is filled up with ions with n-1 electrons. Up to 8 "CHARGE-STATES" keywords can be used.

special option:
n<0  Z_t  
...
For n<0 and E > 30MeV/u an equilibrium charge-state dsitribution is calculated from GLOBAL cross sections.
The second parameter then describes the atomic number Z of the target material, and the following parameters have no meaning so far.

3.21 HBOOK

hbook, 1, xid, xbin, xmin, xmax (for 1 dimensional histogram)
or
hbook, 2, xid, xbin, xmin, xmax, yid, ybin, ymin, ymax (for 2 dimensional histogram)

The keyword marks to produces HBook histogram from all ion data at this point,
variables type
xid, yid integer ID number of information which you want to see. 1:x, 2:a, 3:y, 4:b, 5:energy, 6:time, 7:mass, 8:charge, 9:electrons, 10:nf/nst, 11:range, 12:ToF_time, 13:dE, 14:Brho 
xbin, ybin integer number of channels for x and y axis
xmin, xmax real lower and upper edges of X channels
ymin, ymax real lower and upper edges of Y channels

3.22 OPTION

OPTION option [,option]....

Available options are follows.

3.22.1 PMATRIX

OPTION, PMATRIX

The keyword sets that all matrix elements of all magnets is written to the standard output file "*.out". The order of matrix printed is determined by the order2 parameter set in the ``MATRIX'' keywords.

3.22.2 PCOLL

OPTION, PCOLL

The keyword sets that the number of particles after passing through each collimator is written to the standard output file "*.out" and to a collimator output file "*.coll".

3.22.3 LISTMODE

OPTION, LISTMODE, CWN
or
OPTION, LISTMODE, RWN
or
OPTION, LISTMODE, ASCII
or
OPTION, LISTMODE, GZASCII
or
OPTION, LISTMODE, TREE (experimental)
or
OPTION, LISTMODE, NONE

The keyword defines the format of the list-mode output as described in the next column. MOCADI makes an NTUPLE entry "1" with a CWN variable length format in an HBOOK output file ``*.hbk'' when you write the "OPTION LISTMODE CWN" keywords in the standard input file.
In the case of the "OPTION LISTMODE RWN" keyword, MOCADI makes NTUPLE entries for all save points with an RWN fixed length format in the HBOOK output file.
The "OPTION LISTMODE ASCII" keywords gives ascii tables. GZASCII is the same but gzipped.
The "OPTION LISTMODE TREE" keyword can be used in the special version of MOCADI (see section 2). Using this keyword, MOCADI makes Tree entries of ROOT for all save points. (from version 3-2)
In the case of the ``OPTION LISTMODE NONE'' keywords, MOCADI does not create any list-mode outputs (the "save" keyword is ignored). The defaults list-mode is CWN format.

3.22.4 ELECTRIC (from version 3-0)

OPTION ELECTRIC

From version 3.0, the additional matrix elements for electric fields made by GICOSY also can be considered in the calculation. In this case the dependence on magnetic rigidity stays the same but another coefficient depending on mass/charge is added. Together they represent the deviation in electric rigidity but also that of mixed fields. In principle this option can always be switched on but for compatibility with other matrix file formats it may also be omitted.

3.23 PRINT_MATRIX

PRINT_MATRIX

The function of the keyword is same as ``OPTION PMATRIX''

3.24 PRINT_COLL

PRINT_COLL

The function of the keyword is same as ``OPTION PCOLL''

3.25 ATIMA-1.0

ATIMA-1.0

The keyword defines that MOCADI uses the spline files calculated by ATIMA for energy loss, energy-loss straggling, and angular straggling in the layers of matter. All material (A, Z) from Z=1 to Z=99 including isotopes, and in addition some composite materials or materials in other state are listed in the table below (compounds are identified by using Z higher than 200). The isotopic composition is important for nuclear reactions and the number of atoms in a target with given mass per area. The standard average molar mass can be chosen with input A=0. Note that compound materials cannot be used as a target.
From version 3.2, MOCADI uses only ATIMA spline files for energy-loss, the older tables are not supported anymore.
a material list with
the ATIMA-1.0 keyword
material AZ
H-U 0-238 1-92
Np-Es 237-252 93-99
plastic 0 201
air 0 202
polyethylene 0 203
liquid Hydrogen 0 204
liquid Deuterium 0 205
water 0 206
diamond 0 207
glass 0 208
AlMg3 (3% Mg) 0 209
Ar_CO2_30 0 210
CF4 0 211
Isobutene 0 212
Kapton 0 213
Mylar 0 214
NaF 0 215
P10_gas 0 216
Polyolefin 0 217
CmO2 0 218
Suprasil2(glass) 0 219
HAVAR 0 220

3.26 EPAX-PARAMETER

EPAX-PARAMETER, p1, p2, p3

The EPAX-V1 empirical formula for the fragmentation reaction cross section σ is calculated as
σ = y(Afrag) * exp(-r(Zprob-Zfrag)u) * sqr(r/3.1415926)
where u=1.5 for Zprob > Zfrag and Aproj>33, and u=2.0 for the others. [5]
The keyword can be used to make small modification of the formula
σ = p1 * y(Afrag) * exp(-r(Zprob-Zfrag)u) * sqr(r/3.1415926)
where u=p3 for zprob > Zf and Aproj>33 and u=p2 for the others.
The projectile fragmentation cross sections was systematically studied by using an 40Ar primary beam impinging on Be and Ta targets at RIKEN. The results suggest to modify the parameter set, p1=0.667, p2=2.0, and p3=1.7. [6]
Please use this keyword on your own risk.

3.27 RANDOMIZE

RANDOMIZE iseed

The keyword sets initial seed for random number generator.

3.28 LOOP-ENDLOOP

LOOP n
...... (another keywords)
ENDLOOP

3.29 CALL

CALL library,function
dpar1 dpar2 dpar3 dpar4 dpar5 .... dpar15
option

The "CALL" keyword marks to use an external user function named as function in a shared library (*.so). Note that library should be specified with the full path name. The function is called with 15 double parameters dpar* and a string (120 characters) option. The source code for the library could look as below in test.c. In the test program, the ion coordinates(out[i]) are defined event by event. If the return value of ext_beam is negative the particle is lost. The maximal number of external functions in a MOCADI input file is 100.

----------------------- test.c --------------------------------------------

int ext_beam(double *in, double *out, double *dpar, char *option)
{
  /* in[0]=X [cm]   in[4]=energy[AMeV] in[8]=electron       in[12]=deltaE[MeV]
     in[1]=X'[mrad] in[5]=time  [us]   in[9]=nf/nsf         in[13]=reserved
     in[2]=Y [cm]   in[6]=mass  [amu]  in[10]=range[mg/c2]  in[13]=reserved
     in[3]=Y'[mrad] in[7]=z            in[11]=tof  [us]
     the element range is valid after the "stop" keyword
     the element deltaE is valid behind energy loss materials
                                          (matter, wedge etc.)
  */
  int i;
  for(i=0;i<14;i++)
    printf("%le\t",in[i]);     /* print all ion-optics parameters */ 
  printf("\n");
  for(i=0;i<15;i++)
    printf("%le\t",dpar[i]);  /* print all numerical parameters */
  printf("\n");
  printf("%s\n",option);       /* print option */
  for(i=0;i<14;i++)
    out[i]=i*10;               /* change ion-optics parameters */ 
  return(0);                   /* when this particle is be lost, the
                                  return value is set to be negative */
}

-----------------------------------------------------------------------------

To create a shared library (e.g. test.so) from a source file (e.g.test.c) the following commands are used.
   gcc -fPIC -c test.c
   gcc -shared -Wl,-soname,test.so -o test.so test.o
The function can be used using the following lines.
   call /home/iwasa/mocadi/work/test.so ext_beam
   9 4 1.8 19 6 5 100 1 1 1 1 1 0 0 0             
   parameters                                     

3.30 EPAX

EPAX version

This keyword defines version number of the empirical formula, EPAX, which calculates production cross section of projectile fragments.
c.f.
version=1: EPAX version 1 [5]
version=2: EPAX version 2 [7]
version=3: EPAX version 3 [8]

3.31 COOLER

COOLER mode, mean_energy[MeV/u],deviation[%]

redefines the longitudinal and transversal momentum distribution and resets the mean energy
modewidth parameter
0 fixed valuerelative shift
1 rectangular distribution full width
2 Gaussian distributionsigma
3 Lorentzian distributions

3.32 DECAY-IN-MAGNET (from 3.4)

DECAY-IN-MAGNET length, A, Z, decay-mode, life-time, Q-value, nloop
shape, A0, Z0, Eref, param1, param2,

The "DECAY-IN-MAGNET" keyword defines an optical element of length[cm] along the optical axis in vacuum. The particles with mass[amu] and nuclear charge[e] can be decay with half-life[ms]. When half-life is set to zero, the life-time is infinitely long, but all the particles must decay inside of the element. When Q-value[MeV] is set to zero or higher than Q value to the ground state, Q value is calculated from the mass table, assuming decay to the ground state of daughter nucleus. When turn is set to zero, the decay occurs in all turns in a loop. When it is larger than zero, the decay occurs in specified turn only.
Presently, only shape=1 (dipole magnet in first order) can be used. Rho value [cm] of dipole magnet is specified to param1. The magnetic rigidity is calculated from information of the reference particle, A0 [amu], Z0 , and E0 [MeV/nucleon]. Note that this keyword moves the z-position by the length specified in the matrix file.
decay_mode
1 alpha decay
2 beta - decay
3 electron capture decay
4 beta + decay
5 proton decay
6 neutron decay
magnetshapeparam1param2
dipole(1st order)1rhonot used

3.33 CROSS-SECTION

CROSS-SECTION file name
read production cross sections from file, default is "sigma1.cs"
The file is an ascii list with the following format:
 
! comments
! Z  N  σ[mb]
82 126 0.3
82 125 1.2
...

3.34 EQUILIBRIUM_CHARGE_STATES (from V4.0)

EQUILIBRIUM_CHARGE_STATES
mode, param1, param2
The number of electrons is redistributed according a given equilibrium charge-state distribution.
modeparam1param2
1<q>σq
2ZmShima formula
3ZmGLOBAL x-sections

mode=1, mean charge state <q> and σq of Gaussian distribution as direct input.
mode=2, mean charge state <q> and σq from Shima formula according to atomic number of material Zm.
mode=3, charge-state distribution from GLOBAL cross sections according to atomic number of material Zm. Works for Zp>=20 and E>30 MeV/u.

4 How to execute MOCADI

After having prepared an input file, type the command:

MOCADI input_file_name

when you do not type an extension of input_file_name, MOCADI assumes the default extension ".in". When you don't type input_file_name, MOCADI will prompt for a file name.

5 MOCADI Output Files

MOCADI creates the following output files
*.out standard output file
*.coll collimator output file
*.tab table output file (when you use TABLE keyword in input file)
*.hbk HBOOK output file including NTUPLE output (when you use HBOOK or SAVE keywords in input file)
*.lmdi SATAN output file
*.asc list-mode output file in the ASCII code
*.asc-gz gzipped list-mode output file in the ASCII code
*.root ROOT/TREE list-mode output file
The standard output file, *.out, *.coll, *.tab, and *.asc are text files, whereas the HBook, ROOT/Tree, and *.asc-gz are binary. For displaying the data from the HBook output file, you can use ``PAW'' from the CERN Library. For the ROOT/TREE output file, you can use ``ROOT''

6 A standard routine for MOCADI calculation

  1. Copy a input file for a beam line of your interest.
  2. Modify the parameters of the "BEAM" and "TARGET" keywords to your case.
  3. Place an "END" keyword just after the first "EXPECTED_VALUES" keyword.
  4. Execute MOCADI and check the standard output to obtain precise mass, charge and energy after the penetrating through the target material.
  5. Change the mass, charge, and energy of reference particle of the "MATRIX" keywords.
  6. When the "MATTER" and "WEDGE" keywords appears, place "EXPECTED_VALUES" keyword and ``END'' keyword after the material keyword, execute MOCADI to check the energy of the particle, and change the energy of reference particle in the "MATRIX" keywords downstream of the material.

Acknowledgment

It is our pleasure to thank H. Geissel for providing us with the source codes. Many thanks are due to H. Weick for his help on programmng, checking, and making spline files (version 3.5) and manual. I am grateful to K. Sümmerer, M. Dahlinger, T.Baumann, for their help for their help. I thank M. Pfünzner and A. Ozawa for their fruitful suggestions. Special thanks are due to P. Malzacher and C. Scheidenberger for providing energy-loss, energy-straggling, and angular-straggling functions of ATIMA-1.0.

APPENDIX

A.1 How to use PAW

For using "PAW", type "paw". PAW asks for a workstation number. Type the number corresponding to the graphics output device you want to use. (1:X-Terminal, 7879:TEX4010, 0:no graphic) When PAW cannot make a HIGZ window on your X-terminal, please type the following commands, and execute PAW again.

set display /cre/node=IP_address_of_your_terminal/trans=tcpip

% PAW
******************************************************
*                                                    *
*            W E L C O M E    to   P A W             *
*                                                    *
*       Version 2.06/00       9 November 1994        *
*                                                    *
******************************************************
Workstation type (?=HELP) =1 :
Enter terminal number (1:X-terminal, 7879:TEX4010, 0:no graphic)
Version 1.21/12 of HIGZ started

PAW >
Now you can type PAW commands at the PAW prompt.

A.1.1 Open an HBOOK file and the way to see information

PAW > H/file 44 B8.HBK   (open Hbook file B8.HBK on the unit 44)
PAW > h/list


===>Directory :
         1 (N)   Save                   when you use CWN format

         1 (N)   Save 1                 \
         2 (N)   Save 2                  when you use RWN format
         3 (N)   Save 3                 /

       101 (2)   1:x*y                  \     
       102 (2)   2:x*y                   when you use HBOOK command
       103 (2)   3:x*y                  /
Note that units of position, angle, energy, time, and rigidity are cm, mrad, MeV/u, micro-second, and MeV/c, respectively.

A.1.2 How to show histograms from HBOOK output

PAW > h/plot  101  (plots a scatter plot of a 2D-histogram 101)
PAW > contour 101  (draws a contour plot of a 2D-histogram 101)
PAW > surface 101  (plots a scatter plot of a 2D-histogram 101
                    as 3 dim. view)

A.1.3 How to show histograms from Row-Wise-NTUPLE output

PAW > n/print 1              (print information at save 1)


********************************************************
* NTUPLE ID=    1  ENTRIES= 103579   Save 1
********************************************************
*  Var numb  *   Name    *    Lower     *    Upper     *
********************************************************
*      1     * X         * -.164687E+01 * 0.176604E+01 *
*      2     * A         * -.137222E+02 * 0.135885E+02 *
*      3     * Y         * -.134754E+01 * 0.136219E+01 *
*      4     * B         * -.629065E+01 * 0.626050E+01 *
*      5     * energy    * 0.256659E+03 * 0.271148E+03 *
*      6     * time      * 0.923414E+00 * 0.977539E+00 *
*      7     * mass      * 0.802461E+01 * 0.802461E+01 *
*      8     * z         * 0.500000E+01 * 0.500000E+01 *
*      9     * electron  * 0.000000E+00 * 0.000000E+00 *
*     10     * nf_nsf    * 0.888366E+00 * 0.896811E+00 *
*     11     * range     * 0.000000E+00 * 0.000000E+00 *
*     12     * tof       * 0.923414E+00 * 0.977539E+00 *
*     13     * dE        * 0.343888E+03 * 0.376508E+03 *
*     14     * brho      * 0.000000E+00 * 0.000000E+00 *
*     15     * weight    * 0.000000E+00 * 1.000000E+00 *
********************************************************

PAW > n/plot 1.x
                   (plot an 1D-histogram of x position at save 1)
PAW > n/plot 1.x%y
                   (plot a 2D-histogram of x v.s. y of save 1)
PAW > n/plot 1.x Energy>100
                   (plot an 1D-histogram of x gated by E>100 A MeV)

Note that units of position, angle, energy, time, and rigidity are cm, mrad, MeV/u, micro-seconds, and MeV/c, respectively.

A.1.4 How to show histograms from Column-Wise-NTUPLE output

PAW > n/print 1              (print information)


******************************************************************
* Ntuple ID = 1      Entries = 10000     SAVE
******************************************************************
* Var numb * Type * Packing *    Range     *  Block   *  Name    *
******************************************************************
*      1   * I*4  *         * [0,15]       * TEILCHEN * N
*      2   * R*4  *         *              * TEILCHEN * X(N)
*      3   * R*4  *         *              * TEILCHEN * A(N)
*      4   * R*4  *         *              * TEILCHEN * Y(N)
*      5   * R*4  *         *              * TEILCHEN * B(N)
*      6   * R*4  *         *              * TEILCHEN * ENERGY(N)
*      7   * R*4  *         *              * TEILCHEN * TIME(N)
*      8   * R*4  *         *              * TEILCHEN * MASS(N)
*      9   * R*4  *         *              * TEILCHEN * Z(N)
*     10   * R*4  *         *              * TEILCHEN * ELNUM(N)
*     11   * R*4  *         *              * TEILCHEN * TOF(N)
*     12   * R*4  *         *              * TEILCHEN * DE(N)
*     13   * R*4  *         *              * TEILCHEN * BRHO(N)
*     14   * R*4  *         *              * TEILCHEN * WEIGHT(N)
*     15   * R*4  *         *              * TEILCHEN * RANGE
******************************************************************
*  Block   *  Entries  * Unpacked * Packed *   Packing Factor    *
******************************************************************
* TEILCHEN *  10000    * 724      * Var.   *    Variable         *
* Total    *    ---    * 724      * Var.   *    Variable         *
******************************************************************
* Blocks = 1            Variables = 13      Max. Columns = 181   *
******************************************************************

PAW > n/plot 1.x(1)       (plot an 1D-histogram of x at save 1)
PAW > n/plot 1.x(2) n>=2  (plot an 1D-histogram of x at save 2)
PAW > n/plot 1.x(1)%y(1)  (plot a 2D-histogram of x v.s. y at save 1)
PAW > n/plot 1.x(1) N>=2  (plot an 1D-histogram of x at save 1 gated by 
                           events passing though to save 2)
PAW > n/plot 1.x(1)%x(2)  (plot a 2D-histogram of x at save 1 and x at save 2)
PAW > n/plot 1.x(1)%mass(1) ! ! ! ! box
                          (plot transmission for each fragment) 
PAW > n/plot 1.z(1)%mass(1) weight(1) ! ! ! box
                          (plot yield of each fragment) 
PAW > n/plot 1.x(1) z(1)=5&&mass(1)>8&&mass(1)<9&&weight(1)
                          (plot yield of 8B as a function of x at
                           save 1)
PAW > n/plot 1.range range>0&&z(1)=5&&mass(1)>8&&mass(1)<9
                          (plot range of 8B in the matter described
                           by the "stop" keyword)

Note that units of position, angle, energy, time, rigidity, weight, and range are cm, mrad, MeV/u, micro-seconds, Tm, particle/incident particle, and mg/cm2, respectively. In case you get an error message about the array index, probably the ion with a certain index was cut off due to the collimators. Try adding a condition to avoid this error, e.g. nt/plot 1.x(3) N>=3. In this case PAW looks only at ions with array at least 3 and no error will occur.

A.1.5 How to print histograms on printer

PAW > for/file 45 MOCADI.ps  (open a postscript file "MOCADI.PS"
                              on the unit 45)
PAW > metafile 45 -111       (activate postscript-output on the unit 45)
Type plot commands as described in previous subsections.
PAW > close 45          (close the postscript file)
PAW > shell lpr -P"printer name" MOCADI.ps 
                        (print the postscript file to the printer psaf)
or to print content of current graphics window
    PAW > opt zfl1
Type plot commands
   
    PAW > pic/print filename.ps
    PAW > shell lpr -P"printer name" filename.ps

A.1.6 Exit from PAW

PAW > close 44          (close hbook file for the unit number 44)
PAW > exit
%

A.2 How to use ROOT

A.2.1 Start ROOT and fast plots

>. /cvmfs/csee.gsi.de/bin/go4login                              (at GSI to set path names to root) or
>. /cvmfs/csee.gsi.de/bin/rootlogin 608-02                 (at GSI to choose library version explicetly)
> root                                                                            (starts root)
TBrowser b;                                                                 (at root prompt, starts the browser window)
TFile *my = new TFile("test.root");                             (load root file created by MOCADI)
my->ls();                                                                      (display content of root file, a tree with the name T)
my->Close();                                                               (close file again, for example after new calculation)
T->Print();                                                                   (shows content of tree)
T->Draw("x[0]");                                                         (simple plot of position)
T->Draw("a[0]","(a[0]>-1)&&(a[0]<1.5)");              (plot with conditions)
T->Draw("x[3]","n>=8");                                            (plot with condition on number of SAVE, counting in ROOT starts at zero)
T->Draw("a[0]:x[0]+a[0]*0.3");                                (two dimensional plot with arithmetic expression) 
 

A.2.2 Create histograms

TH1F *h1= new TH1F("h1","h1 title",80,-4,4);         (create a 1dim. histogram name "h1" with 80 channels from -4 to 4)
TH2F *h2= new TH2F("h2","h2 t2",80,-4,4,10,-1,1);  (create a 2dim. histogram)
T->Draw("x[0]>>h1");                                                (plot histogram and fill it with x[0])
h1->Draw();                                                                (plot histogram "h1")
h1->SetFillColor(2);                                                   (change color)
h1->Fit("gaus");                                                           (simple Gauss fit)

TH1F *h1b= new TH1F("h1b","h1b title",80,-4,4);   (create a second 1dim. histogram)
T->Draw("x[0]>>h1b","x[0]<-4");                              (plot histogram filled with x[0] and condition)
h1->Draw();                                                                (plot old histogram "h1")
h1b->Draw("SAME");                                                (plot new histogram "h1b" on top of previous picture)

 

A.2.3 Read Tree and Fill inside a loop

In this case you need a full function, which is compiled first and then loaded from a library.
It gets the entries from the ROOT Tree, manipulates them and fills a histogram.
Here is an example which plots the nuclear charge derived from a calculated energy loss.

.L plot.C                                        (compile and create library)
music("mus86-18.root",0.17);      (call function to create histograms and plot)

-------------------------  the file plot.C --------------

// macro for plotting MOCADI data in root tree, file plot.C
// Helmut Weick, 01.06.2010
// first compile:
//  .L plot.C++
//
// for file mus86-18.root.root with dZi=0.17
// music("mus86-18.root",0.17);
// filename = MOCADI output file
// dzi = intrinsic MUSIC resolution without charge exchange

Float_t MUSIC_Z1(Float_t e1, Float_t e2, Float_t coeff);

void music(char* filename="test.root", Double_t dzi=0.)
{
  Int_t n;
  Float_t x[15], a[15], y[15], b[15], energy[15], time[15], mass[15], z[15],
  elnum[15], tof[15], de[15], brho[15], weight[15], range, tpos;
  TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
 
// check file
  if (f==NULL) {
    cout << "Opening " << filename << endl;
    f = new TFile(filename);
    if (!f->IsOpen()) return;
  } else {
    // cout << "File " << filename << " already opened..." <<endl;
    f->ReOpen("READ");
  }

// read Tree
  TTree *tree = (TTree*)f->Get("T");
  tree->SetBranchAddress("n",&n);
  tree->SetBranchAddress("x",&x);
  tree->SetBranchAddress("a",&a);
  tree->SetBranchAddress("y",&y);
  tree->SetBranchAddress("b",&b);
  tree->SetBranchAddress("energy",&energy);
  tree->SetBranchAddress("time",&time);
  tree->SetBranchAddress("mass",&mass);
  tree->SetBranchAddress("z",&z);
  tree->SetBranchAddress("elnum",&elnum);
  tree->SetBranchAddress("tof",&tof);
  tree->SetBranchAddress("de",&de);
  tree->SetBranchAddress("brho",&brho);
  tree->SetBranchAddress("weight",&weight);
  tree->SetBranchAddress("range",&range);
  tree->SetBranchAddress("tpos",&tpos);

// clean the old spectra from memory
  TH1F *h=NULL;
  h= (TH1F*)gROOT->FindObjectAny("hz1");
  if (h!=NULL) delete h;
  TH1F *hz1 =new TH1F("hz1" ,"MUSIC Z1",300,80,92);

// loop to fill histograms
  Int_t nentries=tree->GetEntries();
  if(nentries>nplot) nentries = nplot ;
  Float_t z1=0;

  for(Int_t i=0; i<nentries; i++){
    tree->GetEntry(i);
    z1=MUSIC_Z1(energy[0],energy[1],2.184);
    z1=z1 + gRandom->Gaus(0,dzi);
    hz1->Fill(z1);
  }

  // plot histogram
  hz1->Draw();
}


// function for Z1
Float_t MUSIC_Z1(Float_t e1, Float_t e2, Float_t coeff)
{
   return sqrt(e1-e2)*85/coeff;
}

-------------------------------------------------------------

 

A.3 Examples of input files

MOCADI download page at GSI
RIPS @ RIKEN

REFERNCES

[1] N. Iwasa et al., Nucl. Instr. Meth. B126, 284 (1997); Th.Schwab, GSI Report No. 91-10 (1991).
[2] N. Iwasa, H.Weick, H.Geissel, Nucl. Instr. Meth. B269, 752-758 (2011).
[3] C. Scheidenberger et al., Phys. Rev. Lett. 73, 50 (1994).
[4] C. Scheidenberger et al., Phys. Rev. Lett. 77, 3987 (1996).
[5] K. Sümmerer et al., Phys Rev. C42, 2546 (1990).
[6] A. Ozawa, private communications.
[7] K.Sümmerer, B.Blank, Phys. Rev. C 61, 34607 (2000).
[8] K.Sümmerer, Phys. Rev. C 86, 014601 (2012).


This page was last modified by Dr. Helmut Weick,25th May 2018, contact h.weick(at)gsi.de,  Imprint (Impressum), Privacy Policy (Datenschutzerklärung)