%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% GEANT4 codes for the set-ups described in Rutjes & Sarria, "Evaluation of Monte Carlo tools for high energy atmospheric physics"
%%% Contact : David Sarria, david.sarria.89@gmail.com



• Warning : the code will not compile only by its own. The user must have downloaded and installed GEANT4 properly.
  See "http://geant4.web.cern.ch" for complete instructions.


• Two folders are included :

    - GEANT4D : uses the default model, but in addition we de-activated the fluctuations of the continuous energy loss, i.e.
     the energy looses are applied uniformly, without straggling effect.

    - GEANT4L : uses the Livermore model, which uses cross sections from the EPDL and EEDL databases, provided by the Lawrence 
    Livermore National Laboratory. Detailed implementation are provided in (Cullen et al., 1997; Perkins et al.,1991).
    The ‘Universal fluctuationmodel’ is activated to include straggling during the continuous energy losses.

    The "GEANT4_xxx/src/LBE.icc" file contains the physics list used by each code. This file presents the main differences between the two codes.
    See https://twiki.cern.ch/twiki/bin/view/Geant4/LowePhysicsLists for more information about physics lists.
    

• The C++ source codes are inside the sub-folders "GEANT4_xxx/src". They have to be compiled using CMAKE like standard GEANT4 codes 
  (see GEANT4 documentation : http://geant4.web.cern.ch/geant4/support/userdocuments.shtml ).
  
  
• The codes are constructed following the standard GEANT4 construction. They are base on the GEANT4 basic examples.
  (See "http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch10s02.html")


• After compilation, an executable called "Base" is produced inside the "GEANT4_xxx/build/" folder. 
  It must be executed with 6 following input arguments :
   Particle ID (0 for photons, -1 for electron, 1 for positron), Kinetic energy (MeV), Detection distance (cm), Number of particles, 
   Random number generator seed (any integer) and Output file name

   Example : "./Base -1 0.1 1 10000 1 ./output2/GEANT4L_-1_0.1_1.txt"
              for the 100 keV electron Beam of 10000 particles at 1 cm, stored in the file "GEANT4_xxx/build/output2/GEANT4L_-1_0.1_1.txt"


• Three python scripts are provided :

      - g4_script_auto_mt.py : runs the executable "./Base" with various input arguments to produce all the outputs for the 10,000 initial 
          particle cases (see the article). They are stored in the "GEANT4_xxx/build/output2/" folder.

      - merge_data.py : It must to be used inside the "output2" folder to work. It fuses the files generated by "g4_script_auto_mt.py" to produce 
          output files that includes all the the detection distances for any combination of Energy and Particle ID. 
          The is one file by comination, 15 files in total (5 energies, 3 initial particles).

      - g4_script_auto_mt_big_files : runs the executable "./Base" with various input arguments to produce all the outputs for the 
          1,000,000 inital particle cases (see the article).  They are stored in the "GEANT4_xxx/build/bigfiles/" folder.
      
      
• The output files contain the list of detected particles with the following properties :
    Particle ID (0 for photons, -1 for electron, 1 for positron), kinetic energy, x positon (cm), y positon (cm), z positon (cm), time (nanosecond)
    
• The output files' names indicate the Model name, Number of particles, Energy and Particule type.    
    Example : "GEANT4L_1000K_1MeV_ELE.txt" is for the GEANT4 Livermore model, with 1,000,000 initial electrons of 1 MeV kinetic energy
