Warning, /geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/README.md is written in an unsupported language. File is not indexed.
0001 # Description
0002
0003 This example allows the study of G4 cross-sections,
0004 and in addition, of the `FLUKA` hadron-nucleus reaction cross sections.
0005
0006 The user can printout any particle-material XS.
0007 The XS are exactly the ones defined in any G4 physicsList chosen by the user,
0008 or from `FLUKA` (hadron-nucleus inelastic case).
0009
0010 In the input file, the user can set:
0011 - projectile.
0012 - target material (element, compound or even mixture).
0013 - plotting options.
0014
0015 All plots (created via the G4 analysis manager) can be dumped
0016 to any of the usually supported formats (e.g. `ROOT` format),
0017 but also in a Flair-compatible format.
0018 Regarding the extension of `G4H1` to insure `Flair` compatibility,
0019 see `geant4/examples/extended/hadronic/FlukaCern/utils`.
0020
0021 Note that the Geant4 run SERIAL manager is used, since `FLUKA` is single-threaded
0022 (in actual `FLUKA` runs, parallelism is achieved via a multi-processing approach).
0023
0024 Before you can access the `FLUKA` hadron-nucleus inelastic model in this example,
0025 you will need to install and setup `FLUKA` and its interface.
0026 See "Dependencies" paragraph below.
0027
0028 A version of the interface to `FLUKA` is directly located at `geant4/examples/extended/hadronic/FlukaCern/FlukaInterface`.
0029
0030
0031 # Dependencies
0032
0033 ### Environment
0034 - **gcc** >= 7 (Linux) and **gcc** >= 9 (MacOS)
0035 In practice, a recent version is recommended, at least `gcc >=10`.
0036 ```
0037 gcc --version
0038 ```
0039
0040 - **CMake** >= 3.16...3.21
0041 ```
0042 cmake3 --version
0043 ```
0044
0045 - **G4** >= 11.0.3 (Not tested on older G4 releases: might still work, but with no guarantee).
0046 IMPORTANT: YOU NEED TO SOURCE YOUR G4 ENVIRONMENT.
0047 It needs to be sourced in whichever terminal you want to build / run a G4 application with the `FLUKA` interface.
0048 ```
0049 source path_to_geant4/install/bin/geant4.sh
0050 which geant4-config # NB: Your geant4-config should support the modern CMake way of building G4.
0051 ```
0052
0053 - **Easy setup on lxplus** (lxplus7):
0054 All you need to do on lxplus, to setup an environment satisfying all the conditions above, is, for example:
0055 ```
0056 source /cvmfs/sft.cern.ch/lcg/releases/gcc/10.1.0/x86_64-centos7/setup.sh
0057 source /cvmfs/geant4.cern.ch/geant4/11.1/x86_64-centos7-gcc10-optdeb-MT/CMake-setup.sh
0058 # NB: Your geant4.sh is at: /cvmfs/geant4.cern.ch/geant4/11.1/x86_64-centos7-gcc10-optdeb-MT/bin/geant4.sh
0059 ```
0060
0061 ### `FLUKA4`
0062 Release: >= **4-3.2**
0063
0064 Please install the latest `FLUKA` release.
0065 (1) You first need to register (and accept the licence when relevant): https://fluka.cern/download/registration
0066 (2) You can then download the `binary libraries` (or potentially the `source code` package, depending on your case):
0067 https://fluka.cern/download/latest-fluka-release.
0068 (3) Follow the `FLUKA` installation instructions: https://fluka.cern/documentation/installation
0069 In particular, for a Linux/MacOS install: https://fluka.cern/documentation/installation/fluka-linux-macos
0070 They will show you how to setup `FLUKA`.
0071 If (and only if) you went for the source code package option, you will need to build `fluka`, and, in addition, to do `make cpp_headers` at `path_to_fluka/src`.
0072 (4) Eventually, all you need are the headers `fluka_repo/include`, libraries `fluka_repo/lib`, and data `fluka_repo/data`. Check that they are not empty.
0073 Do not forget to add `/path_to_fluka/bin` to your `PATH`. Check with `which fluka`.
0074
0075 ### `FlukaInterface`
0076 A version of the G4-FLUKA interface (`FLUKA` hadron-nucleus inelastic physics)
0077 is located at `geant4/examples/extended/hadronic/FlukaCern/FlukaInterface`.
0078 You will first need to build the interface to `FLUKA`, and create the environment scripts.
0079 ```bash
0080 $ cd geant4/examples/extended/hadronic/FlukaCern/FlukaInterface/
0081 # Check with `which fluka` that fluka executable is added to your `PATH`.
0082 $ source path_to_geant4/install/bin/geant4.sh
0083 $ make interface
0084 $ make env # Creates `env_FLUKA.sh` and `env_FLUKA_G4_interface.sh`
0085 ```
0086 IMPORTANT: `env_FLUKA_G4_interface.sh` needs to be sourced in whichever terminal
0087 you want to build / run a G4 application with the `FLUKA` interface.
0088
0089
0090 # Build this example
0091 ```bash
0092 $ cd geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/
0093 # Check with `which fluka` that fluka executable is added to your `PATH`.
0094 $ source path_to_geant4/install/bin/geant4.sh
0095 $ source ../../FlukaInterface/env_FLUKA_G4_interface.sh
0096 $ mkdir build
0097 $ cd build
0098 $ cmake3 -DG4_USE_FLUKA=1 ..
0099 $ make -j8
0100 ```
0101
0102
0103 # Run this example
0104 ```bash
0105 $ cd geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/
0106 # Check with `which fluka` that fluka executable is added to your `PATH`.
0107 $ source path_to_geant4/install/bin/geant4.sh
0108 $ source ../../FlukaInterface/env_FLUKA_G4_interface.sh
0109 # Edit all_XS.in (choice of particle, material, energy range...)
0110 # XS used by FTFP_BERT_HP physics list:
0111 $ ./build/HadronNucleusXS all_XS.in FTFP_BERT_HP
0112 # XS used by G4_HP_CernFLUKAHadronInelastic_PhysicsList physics list:
0113 $ ./build/HadronNucleusXS all_XS.in G4_HP_CFLUKAHI
0114 ```
0115
0116
0117 # Study the cross-sections
0118 All plots are dumped at the end of the run in `all_XS.ext`.
0119 2 formats are supported: `ROOT` and `Flair`.
0120
0121
0122 - You can use `ROOT`:
0123 ```bash
0124 $ cd geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/
0125 $ root all_XS.root
0126 ```
0127
0128 - Alternatively, the use of `Flair` is also supported.
0129 Please see http://flair.web.cern.ch/flair/download.html for `Flair` download.
0130 `Flair` tutorials are also available from that website.
0131 You can download the package corresponding to your distribution at the top of the page
0132 (no need for `geoviewer`, which is for geometry display). Then look at the requirements & installation instructions at the bottom of the page.
0133 If you face issues installing `Flair`, you can get support at: https://fluka-forum.web.cern.ch/c/installation/
0134
0135 An example file, showing how to directly visualize all XS with `Flair`,
0136 is provided in this G4 example.
0137 By default, it directly provides comparison plots:
0138 `FTFP_BERT_HP` versus `G4_HP_CernFLUKAHadronInelastic`.
0139 One can very easily adapt it (directly from `Flair` GUI) to any study of interest.
0140 ```bash
0141 $ cd geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/
0142 $ mkdir -p results/FTFP_BERT_HP results/G4_HP_CernFLUKAHadronInelastic
0143 $ # First run the example for FTFP_BERT, G4_HP_CernFLUKAHadronInelastic, and move the results!
0144 $ ./build/HadronNucleusXS all_XS.in FTFP_BERT_HP
0145 $ mv all_XS.hist results/FTFP_BERT_HP
0146 $ ./build/HadronNucleusXS all_XS.in G4_HP_CFLUKAHI
0147 $ mv all_XS.hist results/G4_HP_CernFLUKAHadronInelastic
0148 $
0149 $ flair study_all_XS.flair &
0150 ```
0151 In the `Plot` tab, you can select the plot of interest in the left column,
0152 and then click `Plot` (top banner, yellow button).
0153 You can select a physics list by clicking on its name in the `Detectors` box (center). You can then decide to change its color, line width (`Options` box). You can decide to plot it or not, by selecting / unselecting `graph` in the `Show` box (in the center).
0154 You can change the path of the data file by clicking on the folder button (button on the right).
0155 You can set the plots extrema, as well as select or unselect the log format, in the top right corner.
0156
0157
0158