$Id: README,v 1.6 2005/11/27 13:13:59 mpiergen Exp $
-------------------------------------------------------------------


     =========================================================
 		      Geant4 - Medical Linac example
     =========================================================

                             README
                      ---------------------


------------------------------------------------------------------------
----> Introduction.

Medical_Linac is an example of application of Geant4 in a medical physics
envinronment. It simulates energy deposit in a Phantom filled with water 
for a typical linac used for intensity modulated radiation therapy.
The experimental set-up is very similar to one used in clinical practice.

------------------------------------------------------------------------
----> 1.Experimental set-up.

The elements simulated are:

1-The point source of electrons (the distribution of the electron energy 
  and the electron radial intensity was assumed Gaussian in shape)
  (the beam is along the z axis)
2-The primary collimator
3-The target
4-The vacuum window
5-The flattening filter
6-The ion chamber
7-The mirror
8-The light field reticle
9-The secondary movable collimators (jaws)
10-The Multi Leaf Collimator
11-The phantom (filled with water)

The objects (2) and (3) are in a box filled with vacuum.
The world volume is filled with air.
The distance between the upper surface of the target and the upper surface
of the phantom (SSD) is 100 cm.
The particles exiting from the target with an angle>25deg are killed.
  
------------------------------------------------------------------------
----> 2.Setting up the environment variables

compiler = gcc-3.2.3

setenv G4SYSTEM Linux-g++

setenv G4INSTALL              points to the installation directory of GEANT4;

setenv G4LIB                  point to the compiled libraries of GEANT4;

setenv G4WORKDIR              points to the work directory;

setenv CLHEP_BASE_DIR         points to the installation directory of CHLEP; 
 
setenv G4LEDATA               points to the low energy electromagnetic libraries - G4EMLOW2.3 

setup for analysis: AIDA 3.2.1, PI 1.3.3                                

Users can download the analysis tools from:  
                                                                        
http://aida.freehep.org/
http://www.cern.ch/PI 
         
#------------------------------------------                                                   

 - Setup for Visualization 

  IMPORTANT: be sure that your Geant4 installation has been done 
  with the proper visualization drivers; for details please see the 
  file geant4/source/visualization/README. 

  To use the visualization drivers set the following variables in 
  your local environment: 

  setenv G4VIS_USE_OPENGLX      1  # OpenGL visualization
  setenv G4VIS_USE_DAWNFILE     1  # DAWN file
  setenv G4VIS_USE_VRMLFILE     1  # VRML file
  setenv G4VRMLFILE_VIEWER  vrmlview  # If installed

------------------------------------------------------------------------
----> 3.How to run the example. 
 
- batch mode:

OpenGL visualization:
  $G4WORDIR/bin/Linux-g++/MedLinac vis.mac

or DAWN file:
  $G4WORDIR/bin/Linux-g++/MedLinac dawnvis.mac

or VRML file:
  $G4WORDIR/bin/Linux-g++/MedLinac vrmlvis.mac 

or without visualization:
  $G4WORDIR/bin/Linux-g++/MedLinac macro.mac 

- Interative mode:                                                      
  3) $G4WORDIR/bin/Linux-g++/MedLinac

-->possible different configurations for interactive mode:  

The user can select the cut of the physics processes:
/PhysicsList/cut 0.2 mm

The user can select the dimension of the water phantom and the dimension of the phantom's voxels in the detector 
construction:
/Phantom/dimension 15. cm
/Phantom/Nvoxels 150/Phantom/maxStep 0.2 mm

and in the definition of the sensitive detector:
/PhantomSD/dimension 15. cm
/PhantomSD/Nvoxels 150
            
The user can select the max step defined in the detector construction:
/Phantom/maxStep 0.2 mm


The user can select the position of the secondary collimators (the jaws)
to obtain the desired field at isocenter:
idle>/Jaws/X1/DistanceFromAxis -20. cm
idle>/Jaws/X2/DistanceFromAxis 20. cm
idle>/Jaws/Y1/DistanceFromAxis -20. cm
idle>/Jaws/Y2/DistanceFromAxis 20. cm
idle>/Jaws/update

The user can select the position of every single leaf of the Multi-Leaf Collimator, for example:
Idle> /MLC/leaf_selection  a1
Idle> /MLC/position 0. cm
Idle> /MLC/leaf_selection  a2
Idle> /MLC/position 0. cm
..
..
..
Idle> /MLC/leaf_selection  b39
Idle> /MLC/position 0. cm
Idle> /MLC/leaf_selection  b40
Idle> /MLC/position 0. cm

The distance selected represent the distance between the leaf tip and the beam axis projected at isocenter.



The user can select the mean energy ad the standard deviation of the electrons:
idle>/energy 6.0 MeV
idle>/sourceType 0.127 MeV
                                                         
idle>/run/beamOn [NumberOfEvents]      ...and then
idle>exit   

-----------------------------------------------------------------------
----> 4. The physics

The electromagnetic physic uses the LowEnergy library,
specifically provided from GEANT4 to treat low energy processes.
The default cut in range value is 0.1 mm, a bigger cut is associated to the first collimator.

------------------------------------------------------------------------
----> 5. Simulation output    
                                          
 The analysis part of Medical_Linac is based on the AIDA interfaces and their
 implementation in Anaphe
 The actual analysis produces some histograms; the histograms are saved at 
 the end of the run in the file "medlinac.hbk".

 It contains:
 1) 2Dhistogram with the distribution of energy in the phantom (plane xz)              
 2) 1Dhistogram with the primary particle energy  
 
 3) 2Dhistogram with the distribution of energy )at a depth in the phantom
     of 15 mm (ZThickness = 1. cm )
 
 4) 1Dhistogram with the distribution of energy along the z axis 
    (Y and X Thickness = 5. mm), from which the user can calculate the PDD
 
 5) 1Dhistogram with the distribution of energy along the x axis 
    (Y and Z Thickness = 5. mm) at a depth in the phantom of 15 mm, 
    from which the user can calculate the flatness
 
 6) 1Dhistogram with the distribution of energy along the x axis 
    (Y and Z Thickness = 5. mm) at a depth in the phantom of 50 mm,
    from which the user can calculate the flatness
 
 7) 1Dhistogram with the distribution of energy along the x axis 
    (Y and Z Thickness = 5. mm) at a depth in the phantom of 100 mm,
    from which the user can calculate the flatness

 8) 1Dhistogram with the distribution of energy along the x axis 
    (Y and Z Thickness = 5. mm) at a depth in the phantom of 200 mm,  
    from which the user can calculate the flatness 
                                                                        
 Units:   the energy deposit is in MeV;
         x, y, z in mm for histograms   

 To fill histograms from (4) to (8) I suggest you to select NumberOfEvents>500000

 Please note that in a multiple run session, the last run always override the 
 hbook file.

 To use analisys remember to set G4ANALYSIS_USE. 

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

for comments, advices, doubts and questions: Michela.Piergentili@ge.infn.it

last modified: Michela Piergentili 24/11/2005


