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

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

                            GunGPS 
                            ------
  
 This example compares G4particleGun and G4GeneralParticleSource (GPS) in 2 simple situations. 
  1) point source, isotropic radiation, monoenergetic
  2) spherical surface source, isotropic radiation within the cavity, monoenergetic 
 	
 1- Geometry construction
    ---------------------

 It is a simple box which represents an 'infinite' homogeneous medium.
  
 2- Physics list
    ------------

 PhysicsList.cc defines only geantino and transportation process.
         	
 3- Primary generators
    ------------------

 There are 3 concrete primary generator action classes :
 PrimaryGeneratorGPS, PrimaryGeneratorGun1, PrimaryGeneratorGun2
 In main GunGPS.cc, select one of them before to compile.
 Each concrete generator action shoots geantinoes in a distribution decribed below.

 3.1- Point source, isotropic radiation
      ---------------------------------

 Use PrimaryGeneratorGun1 with gun1.mac, or PrimaryGeneratorGPS with gps1.mac
  
 3.2- Spherical surface source, isotropic radiation within the cavity
      ---------------------------------------------------------------

 Use PrimaryGeneratorGun2 with gun2.mac, or PrimaryGeneratorGPS with gps2.mac

 One wants to limit particle direction uniformly within (alphaMin, alphaMax).
 First, one generates momentum direction in the master frame (eg. World).
 Then, one rotates momentum in vertex_position frame, using rotateUz() function.
 RotateUz() transforms uz to ur. It is composition of two elementary rotations:
 theta around oy, then phi around oz (non commutative).
 Histograms 4,5 show particle direction in vertex_position frame.

 4- Visualisation
    -------------
 
 Visualization Manager is set in the main().
 Initialisation of the drawing is done via the commands
 /vis/.. in the macro vis.mac. This macro is automatically read from the main 
 in case of interactive running mode.
 
 5- How to start ?
    --------------
 
  - execute GunGPS in 'batch' mode from macro files
 	% GunGPS   gun1.mac
 		
  - execute GunGPS in 'interactive mode' with visualization
 	% GunGPS
 	....
 	Idle>      ---> type your commands. For instance:
    Idle> /control/execute gps0.mac
	Idle> /run/beamOn 10
	....
 	Idle> exit
	
 6- Histograms
    ----------
 
  GunGPS produces several 1D histograms which are saved as GunGPS.root by default.
      1: vertex posi: dN = f(radius)
      2: vertex posi: dN = f(costheta)
      3: vertex posi: dN = f(phi)
      4: particle dir in vertex frame: dN = f(cosalpha)
      5: particle dir in vertex frame: dN = f(psi)
      6: particle dir in master frame: dN = f(cosalphaM)
      7: particle dir in master frame: dN = f(psiM)
	  
  The histograms are managed by the HistoManager class and its Messenger. 
  The histos can be individually activated with the command :
  /analysis/h1/set id nbBins  valMin valMax unit 
  where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
   
  One can control the name of the histograms file with the command:
  /analysis/setFileName  name  (default GunGPS)