$Id: README,v 1.17 2007/12/04 12:06:28 vnivanch Exp $
-------------------------------------------------------------------

     =========================================================
     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
     =========================================================

                            TestEm7 
                            -------

     How to produce a Bragg curve in a water phantom.
     How to compute the dose in small 'test volumes' called tallies.
     How to define a maximum step size.
	
 1- GEOMETRY DEFINITION
 
     The geometry consists of a single block of a homogenous material,
     placed in a world.
     	
     Three parameters define the geometry :
 	- the material of the box,
	- the thickness of the box (sizeX),
	- the  tranverse dimension of the box (sizeYZ).
	
     The default is 20 cm of water.
     	 	
     In addition a transverse uniform magnetic field can be applied.
 	
     The default geometry is constructed in DetectorConstruction class,
     but all of the above parameters can be changed interactively via
     the commands defined in the DetectorMessenger class.
     
     The size, matter, positions of several test-volumes (tallies) can be
     defined via UI commands : /testem/det/tally...    
 	
 2- PHYSICS LIST

    The following EM physics lists are available in this example:	 
    - "standard"     standard EM physics (default)
    - "livermore"    low-energy EM physics using Livermore data
    - "penelope"     low-energy EM physics implementing Penelope models
    - "standardSS"   standard EM physics with single Coulomb scattering 
                     instead of multiple scattering; G4ionIonisation is 
                     substituted by G4ionGasIonisation for GenericIons
    - "standardNR"   standard EM physics with single Coulomb scattering 
                     process G4ScreenedNuclearRecoil instead of the 
                     multiple scattering; the new process was developed 
                     by M.H. Mendenhall and R.A. Weller from Vanderbuilt 
                     University and published in NIM B 277 (2005) 420.
                     In later Geant4 releases the process will be a part
                     of Geant4 source, currently it is released together
                     with its mathematical tool c2_functions in current 
                     example
    
    Alternatively, the user may use predefined Geant4 builders:
    - "emstandard"        G4EmStandardPhysics builder
    - "emstandard_opt1"   G4EmStandardPhysics_option1 builder
    - "emstandard_opt2"   G4EmStandardPhysics_option2 builder
    See geant4/source/physics_lists/History for details        

    Optional components can be added:
    - "elastic"       elastic scattering of hadrons
    - "HElastic"
    - "QElastic"    
    - "binary"        QBBC configuration of hadron inelastic models
    - "binary_ion"    Binary ion inelastic models 		
 	 
 3- AN EVENT : THE PRIMARY GENERATOR
 
     The primary kinematic consists of a single particle which hits the
     block perpendicular to the input face. The type of the particle
     and its energy are set in the PrimaryGeneratorAction class, and can
     changed via the G4 build-in commands of ParticleGun class (see
     the macros provided with this example).
     The default is proton 160 MeV
     	
     In addition one can define randomly the impact point of the incident
     particle. The corresponding interactive command is built in
     PrimaryGeneratorMessenger class.
	 	
     A RUN is a set of events.
 	
 				
 4- VISUALIZATION
 
     The Visualization Manager is set in the main().
     The initialisation of the drawing is done via the command
     > /control/execute vis.mac
 	
     The detector has a default view which is a longitudinal view of the box.
 	
     The tracks are drawn at the end of event, and erased at the end of run.
     Optionaly one can choose to draw all particles, only the charged one,
     or none. This command is defined in EventActionMessenger class.
     
		  	
 5- HOW TO START ?
 
     - compile and link to generate an executable
	% cd geant4/examples/extended/electromagnetic/TestEm7 
 	% gmake
 		
     - execute Test  in 'batch' mode from macro files
 	% TestEm7    proton.mac
 		
     - execute Test  in 'interactive mode' with visualization
 	% TestEm7 
 		....
 	Idle> type your commands
 		....
 	Idle> exit


 6- HISTOGRAM OF THE BRAGG PEAK
 
     Testem7 computes the total energy deposited along the trajectory of 
     the incident particle : the so-called Bragg peak.
     
     In order to control the accuracy of the deposition, the user can limit
     the maximum allowed for the step size of charged particles.
     (command /testem/stepMax )
 
     The result is a 1D histogram  which is the total energy deposited along 
     the trajectory of the incident particle.
     
     The histogram is saved in hbook format (testem7.hbook) 
     
     The bin size is egal to stepMax. The number of bins is determined by 
     the thickness of the absorber (with a minimum of 100 bins).
     The total energy deposited is plotted in MeV/mm per incident particle.  

     Note that, by default, histograms are disabled. To activate them, uncomment
     G4ANALYSIS_USE in GNUmakefile.
     
  7- DOSE IN 'TEST-VOLUMES'
  
     The energy deposited in the test-volumes (tallies) defined in
     DetectorConstruction are printed at EndOfRun, both in MeV and gray.
 

 8- USING HISTOGRAMS

  By default the histograms are not activated. To activate histograms
  the environment variable G4ANALYSIS_USE should be defined. For instance
  uncomment the flag G4ANALYSIS_USE in GNUmakefile.

  It is possible to choose the format of the histogram file (hbook, root, XML):
  comment/uncomment 1 line in  RunAction::bookHisto().
  
  Before compilation of the example it is optimal to clean up old files:
  	gmake histclean
  	gmake 

  To use histograms, at least one of the AIDA implementations should be 
  available (see http://aida.freehep.org).
  
 8a - PI 

  A package including AIDA and extended interfaces also using Python is PI, 
  available from: http://cern.ch/pi

  Once installed PI or PI-Lite in a specified local area $MYPY, it is required 
  to add the installation path to $PATH, i.e. for example, for release 1.2.1 of 
  PI:
  setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin

  CERN users can use the PATH to the LCG area on AFS.
  Before running the example the command should be issued:
  eval `aida-config --runtime csh`

 8b -  OpenScientist

  OpenScientist is available at http://OpenScientist.lal.in2p3.fr.

  You have to "setup" the OpenScientist AIDA implementation before compiling
  (then with G4ANALYSIS_USE set) and running your Geant4 application.

 On UNIX you setup, with a csh flavoured shell : 
	csh> source <<OpenScientist install path>/aida-setup.csh 
        or with a sh flavoured shell : 
	sh> . <<OpenScientist install path>/aida-setup.sh
 On Windows : 
	DOS> call <<OpenScientist install path>/aida-setup.bat 

  You can use various file formats for writing (AIDA-XML, hbook, root).
  These formats are readable by the Lab onx interactive program
  or the OpenPAW application. See the web pages.


  With OpenPAW, on a run.hbook file, one can view the histograms
  with something like :
	OS> opaw 
        opaw> h/file 1 run.hbook  ( or opaw> h/file 1 run.aida or run.root)  
	opaw> zone 2 2 
	opaw> h/plot 1 
	opaw> h/plot 2
