$Id: README,v 1.29 2007/11/12 17:04:55 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

    The following options for EM physics are available:	 
    - "standard"        the best standard EM physics (default)
    - "G4standard"      recommended standard EM physics for LHC
    - "G4standard_fast" the best CPU performance standard physics for LHC
    - "Livermore"       low-energy EM physics using Livermore data
    - "Penelope"        low-energy EM physics implementing Penelope models
         	    
 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 command:
 /testem/histo/setFileName  name  (default testem3.hbook)
 
  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 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
