$Id: README,v 1.2 2001/12/11 13:07:14 gcosmo Exp $
-------------------------------------------------------------------

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

                            xray_fluorescence
                            -----------------
XrayFluo is an advanced Geant4 example based on a realistic simulation of 
a test beam. 
The aim of the test beam was to characterize the response function of an
HPGe detector used to measure fluorescence emissions from samples composed
of different materials irradiated with a monochromatic beam of photons.
In this example the geometry of the detector is simplified:
one single pixel is used instead of an array of pixels.
The response function is tabulated for ten different values of incident 
energy and stored in the file response.dat.
The sample, a simple box whose material can be selected, can be irradiated
with different particles, with different spectra for the incident energy and
with different shapes of the primary generator. 
Apart from the sample and the detector there are two diaphragm reproducing 
those used to collimate the incident beam during the test beam.

The aim of this advanced example is to illustrate the use of particle 
generation and analysis schemes available in Geant4:

- the generation of particles is done via the G4ParticleGun: the example
  shows how to use it in order to obtain a beam of circular section or
  a particle source isotropic in space

_ the example includes the possibility to shoot particles according to a 
  given energy spectrum: the files B_flare.dat, C_Flare.dat and M_flare.dat
  store the spectra of photons during solar flares, the files 
  mercury2_flx_solmax.dat and mercury_flx_solmin.dat contain the spectra of
  protons respectively during solar maximum and solar minimum conditions, and 
  merc2_flx_alp_max.dat merc_flx_alp_min.dat contain  the spectra of alpha
  particles again respectively during solar maximum and solar minimum
  conditions.

 - histograming facilities are presently provided for the Linux environment 
   either by using the AIDA interfaces, or through the Anaphe/Lizard system.
   The AIDA compliant version has not been tested by the developers and is
   here as a example of "forward compatibility" on how to use analysis.

In order to be able to use any of these packages, prior installation is 
necessary and a number of environment variables will have to be set.


#set up VRMLview
setenv G4VRMLFILE_MAX_FILE_NUM     100
setenv G4VRMLFILE_VIEWER        vrmlview    #if installed
setenv PATH ${PATH}:"/afs/cern.ch/sw/contrib/VRML/bin/Linux"

#set up OpenGL or Mesa 
setenv G4VIS_BUILD_OPENGLX_DRIVER   1
setenv G4VIS_USE_OPENGLX            1
setenv OGLHOME /afs/cern.ch/sw/geant4/dev/Mesa/Linux-g++

#set up DAWN
setenv G4VIS_BUILD_DAWN_DRIVER      1
setenv G4VIS_USE_DAWN               1
setenv PATH ${PATH}:"/afs/cern.ch/sw/geant4/dev/DAWN/Linux-g++"

# flag that we want to use analysis:
setenv G4ANALYSIS_USE               1

# select analysis system: any AIDA 2.2 compliant system or Anaphe 3.6.5

# set up for AIDA 2.2 compliancy:
# Compilation and link flags to hook and AIDA compliant system 
# are passed to the Geant4 GNUmakefile system by using the "aida-config" tool
# that should come with any AIDA compliant system. Examples are:
# setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --include`
# setenv G4ANALYSIS_AIDA_CONFIG_LIBS   `aida-config --libs`

#set up Anaphe/Lizard for the gcc-2.95 compiler
setenv G4ANALYSIS_SYSTEM Lizard
setenv PATH ${PATH}:/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.5/bin
source /afs/cern.ch/sw/lhcxx/share/LHCXX/3.6.5/install/sharedstart.csh

#path to the lowEnergy data base

setenv G4LEDATA /afs/cern.ch/sw/geant4/stt/dev1/src/G4EMLOW0.5

1. Run
To execute a sample simulation with visualisation of tracks
reaching the detector run:

XrayFluo 

execute command "/control/execute xxxxx.mac"


If the Lizard analysis options are set, histograming windows will
automatically stored in the corresponding files

2. Detector description

The telescope and detector geometry is defined in 
XrayFluoDetectorConstruction.cc

3. Physics processes

The physics processes are in XrayFluoPhysicsList.cc
The main process in this example is fluorescence emission from the sample.

4. Event generation

This is done using the G4ParticleGun with some modifications. See 
XrayFluoParticleGeneratorAction.cc

5. Analysis

At present there are two options for analysis packages: either 
explicitely the Anaphe 3.6.5 (or compatible) version is selected, 
or any AIDA-2.2 compliant analysis system is chosen.  This dual
approach will be removed in the next release when only the AIDA
compliant version will be present. Presently, the OpenScientist 
package (version 8) provides an implementation of AIDA 2.2, 
other packages as Anaphe and JAS will follow soon. The AIDA 
compliant version has not been tested by the developers and is
here as a example of "forward compatibility" on how to use analysis.

To build and execute the example on platforms where there is no
implementation of the analysis system, the environment variables 
must not be set.

The example provides also two Python files used to display and fit the 
histograms.

