$Id: README,v 1.32 2008/10/22 16:15:20 maire Exp $
-------------------------------------------------------------------

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

                            TestEm3
                            -------
  
 How to collect energy deposition in a sampling calorimeter.
 How to survey energy flow.
 how to print stopping power. 
	
 1- GEOMETRY DEFINITION
 
  The calorimeter is a box made of a given number of layers.
  A layer consists of a sequence of various absorbers (maximum MaxAbsor=9).
  The layer is replicated.
 	
  Parameters defining the calorimeter :
    - the number of layers,
    - the number of absorbers within a layer,		
    - the material of the absorbers,
    - the thickness of the absorbers,
    - the transverse size of the calorimeter (the input face is a square). 
 	
  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 modified interactively via the commands 
  defined in the DetectorMessenger class.
  

	|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
	|			|			|			|
	==========================================================================
	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
	||   abs 1	| abs 2	||   abs 1	| abs 2	||   abs 1	| abs 2	||
	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
 beam	||		|	||		|	||		|	||
======>	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
	||		|	||		|	||		|	||
	||    cell 1	| cell 2||    cell 3	| cell 4||    cell 5	| cell 6||
	==========================================================================
	^		^	^		^	^		^	^
	pln1		pln2	pln3		pln4	pln5		pln6	pln7
 	
  NB. The number of absorbers and the number of layers can be set to 1.
  In this case we have a unique homogeneous block of matter, which looks like 
  a bubble chamber rather than a calorimeter ...
  (see the macro of commands: newgeom.mac)
	    
 2- PHYSICS LISTS
 
    Physics lists can be local (eg. in this example) or from G4 kernel
    physics_lists subdirectory.
     
    Local physics lists:	 
    - "standard"	standard EM physics with current 'best' options setting.
                        these options are explicited in PhysListEmStandard
    - "livermore"       low-energy EM physics using Livermore data
    - "penelope"        low-energy EM physics implementing Penelope models
    
    From geant4/source/physics_lists/builders:	 
    - "emstandard"      recommended standard EM physics for LHC
    - "emstandard_opt1" best CPU performance standard physics for LHC
    - "emstandard_opt2"     
    - "emstandard_opt3" 
    
    Physics lists and options can be (re)set with UI commands
    
    Please, notice that options set through G4EmProcessOPtions are global, eg
    for all particle types. In G4 builders, it is shown how to set options per
    particle type.
        	    
 3- AN EVENT : THE PRIMARY GENERATOR
 
  The primary kinematic consists of a single particle which hits the calorimeter
  perpendicular to the input face. The type of the particle and its energy are 
  set in the PrimaryGeneratorAction class, and can be changed via the 
  G4 build-in commands of ParticleGun class (see the macros provided with this 
  example).
 	
  In addition one can choose randomly the impact point of the incident particle.
  The corresponding interactive command is built in PrimaryGeneratorMessenger.
 	
  A RUN is a set of events.
  
  TestEm3 computes the energy deposited per absorber and the energy flow through
  the calorimeter 
 				
 4- VISUALIZATION
 
  The Visualization Manager is set in the main().
  The initialisation of the drawing is done via the commands :
  /vis/... in the macro vis.mac. In interactive session:
  PreInit or Idle > /control/execute vis.mac
 	
  The default view is a longitudinal view of the calorimeter.
 	
  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- PHYSICS DEMO
 
  The particle's type and the physic processes which will be available
  in this example are set in PhysicsList class.
 	
  In addition a build-in interactive command (/process/inactivate processName)
  allows to activate/inactivate the processes one by one.
  Then one can well visualize the processes one by one, especially 
  in the bubble chamber setup with a transverse magnetic field.
 
  As a homework try to visualize a gamma conversion alone, 
  or the effect of the multiple scattering.
	
  Notice that one can control the maximum step size in each absorber, via the
  StepMax process and the command /testem/stepMax/absorber  
  (see StepMax and PhysicsList classes)
 	
 6- HOW TO START ?
 
  - compile and link to generate an executable
 	% cd TestEm3
 	% gmake
 		
  - execute TestEm3 in 'batch' mode from macro files
 	% TestEm3   run01.mac
 		
  - execute TestEm3 in 'interactive mode' with visualization
 	% TestEm3
 	....
 	Idle> type your commands. For instance:
 	Idle> /control/execute run01.mac
 	....
 	Idle> exit
 	
 7- HISTOGRAMS
 
 Testem3 can produce histograms : 
  histo 1 : energy deposit in absorber 1
  histo 2 : energy deposit in absorber 2
  ...etc...........
  
 One can control the binning of the histo with the command:
  /testem/histo/setHisto   idAbsor  nbin  Emin  Emax  unit 
  ...etc...........  
  where unit is the desired energy unit for that histo (see TestEm3.in).
  
  histo 11 : longitudinal profile of energy deposit in absorber 1 (MeV/event)
  histo 12 : longitudinal profile of energy deposit in absorber 2 (MeV/event)  
  ...etc...........  
  
  histo 21 : energy flow (MeV/event)
  histo 22 : lateral energy leak (MeV/event)  

 One can control the name of the histograms file with the commands:
 /testem/histo/setFileName  name  (default testem3)
 /testem/histo/setFileType  type  (choice: hbook, root(default), XML)
  
  NB. Numbering scheme for histograms:
  layer     : from 1 to NbOfLayers (inclued)
  absorbers : from 1 to NbOfAbsor (inclued)
  planes    : from 1 to NbOfLayers*NbOfAbsor + 1 (inclued)      
 	
 It is also possible to print selected histograms on an ascii file:
 /testem/histo/printHisto id
 All selected histos will be written on a file name.ascii  (default testem3)
     
 Note that, by default, histograms are disabled. To activate them, uncomment
 the flag G4ANALYSIS_USE in GNUmakefile.

 Before compilation of the example it is optimal to clean up old files:
  gmake histclean
  gmake
  
   
 8- USING HISTOGRAMS

  To use histograms, at least one of the AIDA implementations should be 
  available. See InstallAida.txt
  
