E.Chudakov       Nov 30, 2007  

   This directory contains the code and tools to generate the low energy (0.15<E<3 GeV)
   photoproduction of hadrons. It uses fits to the experimental data for the 
   most important at these enrgies 10 processes, as well as the measured values of
   the total photoproduction cross section. The beam spectrum is calculated using the 
   code from R.Jones for the coherent bremsstrahlung. For the single pion production
   differential cross sections the SAID code from I.Strakovski is used.

   Two files are used for the input. 
   The output events are written out as a unformatted file and also as an ntuple.

   Directories:
     code/   - contains the code
     run/    - directory to run the code
     paw/    - directory to analyze the resulting ntuple

   a) Compilation:
      > cd code
      > make
      makes ./.bin/bggen

   b) Input files:
      run.input - one line to define the number of events to simulate, the beam energy:

C  #     write    Bremsstr.     Gamma       Collimator
C events ntuple  E e-  Peak    Emin  Emax     L (cm)
  312000    1     12.    9.    0.15  3.00      7600.
      If the second field is 0 - no ntuple is written out.
 
      particle.dat  - particle table

      Attention: set the 2-nd parameter to 0 is no NTUPLE is needed.
                 NTUPLE may give problems for large files (>1M event)

   c) Running:
      > cd ../run/
      > ../code/.bin/bggen > log

      Output files:
      bggen.dat   - events
      bggen.his   - histograms
      bggen.nt    - CW-ntuple with events 
      bggen.hddm  - HDDM file

   d) In order to study the output one can use the ntuple:
      > cd ../paw/
      PAW> exec example_1    - plots several variables of interest

   e) A code to read the output file bggen.dat:
      > cd ../paw/
      > make
      > ./bgg_read.exe

   f) The particle numbering (apart from HDDM):
      # 1  - beam
      # 2  - target particle
      # 3-etc - secondary particles, starts with baryons

   g) The particle numbering (HDDM):
      #1 - ..  secondary particles
      beam, target momenta are defined in the "Reaction" structure

     For feeding these data to GEANT one should take all  secondary particles