Skip to content

This library contains the p+p->gamma production cross sections implemented in Python, C/C++, Fortran and Matlab. For details, see Phys.Rev. D90 (2014) 12, 123014

License

Notifications You must be signed in to change notification settings

ervinkafex/LibppGam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

		     _     _ _                 _____
		    | |   (_) |               |  __ \
		    | |    _| |__  _ __  _ __ | |  \/ __ _ _ __ ___
		    | |   | | '_ \| '_ \| '_ \| | __ / _` | '_ ` _ \
		    | |___| | |_) | |_) | |_) | |_\ \ (_| | | | | | |
		    \_____/_|_.__/| .__/| .__/ \____/\__,_|_| |_| |_|
		                  | |   | |
		                  |_|   |_|

Welcome to LibppGam

LibppGam is a library that implements parameterized gamma-ray production cross sections from the process. Details about the parametrization is given in Phys.Rev. D90 (2014) 12, 123014 (or astro-ph/1406.7369) from E. Kafexhiu, F. Aharonian, A. M. Taylor, G. S. Vila.

If you use this library, please cite our paper Phys.Rev. D90 (2014) 12, 123014.

@ARTICLE{2014PhRvD..90l3014K,
       author = {{Kafexhiu}, Ervin and {Aharonian}, Felix and {Taylor}, Andrew M. and {Vila}, Gabriela S.},
        title = "{Parametrization of gamma-ray production cross sections for p p interactions in a broad proton energy range from the kinematic threshold to PeV energies}",
      journal = {\prd},
     keywords = {13.75.Cs, 13.85.Ni, 13.85.Tp, Nucleon-nucleon interactions, Inclusive production with identified hadrons, Cosmic-ray interactions, Astrophysics - High Energy Astrophysical Phenomena, Nuclear Experiment},
         year = 2014,
        month = dec,
       volume = {90},
       number = {12},				
          eid = {123014},
        pages = {123014},
          doi = {10.1103/PhysRevD.90.123014},
archivePrefix = {arXiv},
       eprint = {1406.7369},
 primaryClass = {astro-ph.HE},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2014PhRvD..90l3014K},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

LibppGam functions

LibppGam is implemented in Python, C/C++, Fortran and Matlab. The library is a set of functions that parameterize gamma-ray production cross sections from neutral pion production in pp collisions. The library has minimal dependencies (only the mathematical library for Python and C/C++). LibppGam contains the following functions:

  • Kinematic functions:

    • Epi0_max_LAB -- computes maximum pion energy in the LAB frame for a give proton energy.
    • Egamma_max -- computes maximum gamma-ray energy in the LAB frame for a give proton energy.
  • Pion production cross section:

    • XS_1pi -- One pion production cross section valid for Tp <= 2 GeV.
    • XS_2pi -- Two pion production cross section valid for Tp <= 2 GeV.
    • XS_inel -- pp total inelastic cross section.
    • multip_pi0_XYZ -- pi0 production multiplicity valid for Tp > 2 GeV.
    • XS_pi0_XYZ -- pi0 production cross section valid for Tp from the kinematic threshold to 1 PeV (except for Geant4 model that is valid up to 100 TeV).
  • Gamma-ray differential cross section:

    • Amax_XYZ -- The peak value of the gamma-ray differential cross section in [mb/GeV].
    • F_XYZ -- The shape of the gamma-ray differential cross section function (is unitless)
    • dXSdEg_XYZ for -- Gamma-ray differential cross section function dXS/dEg in [mb/GeV].

Here XYZ can be one of the high energy models, namely: Geant4, Pythia8, SIBYLL or QGSJET.

Using LibppGam

Using Python version:

Download the LibppGam.py file from the python folder, and include it in your working directory or in your system path. Then you have to simply import the library in your code and call the functions you need to compute.

...
import LibppGam as ppG
...
# your code here
...

# calling the differential cross section with Geant4 model at high energies

dXSdEg = ppG.dXSdEg_Geant4(Tp, Eg)

At high energies there are four models that one can consider, namely Geant4, Pythia8, SIBILL and QGSJET. Therefore, all cross sections have an ending that shows the high energy model considered, e.g. dXSdEg\_XYZ where XYZ can be one of the models.

Using C/C++ version:

Similar with Python, first download the LibppGam.h and LibppGam.c and include them in your working directory or the system path. Then you have to simply include in your project files.

// include your libraries, e.g.
#include <stdio.h>
#include <math.h>
...

#include "LibppGam.h"

int main(){
	// declare your variables like proton collision energy Tp and gamma-ra energy
	double Tp, Eg, dXSdEg;
	
	// your code here ....
	....
	// call the parameterization
	dXSdEg = dXSdEg_Geant4(Tp, Eg);
	....

	return 0;
}

Cross sections for different high energy models dXSdEg\_XYZ for XYZ being Geant4, Pythia8, SIBILL or QGSJET.

To compile the code you simply include LibppGam.c in your target files. Suppose that you have a simple project of a single file main.c and compile with gcc, you have to simply do

$ gcc main.c LibppGam.c -o main -lm
$ ./main

Using Fortran version:

Download LibppGam.f and put it in your working directory or system path. The fortran library is not written as a module, therefore, you can call the functions as routines. We provide a main program and how the differential cross section routines are called. If you however, need LibppGam.f as a module, you can turn it yourself with little effort and then link it to your main program during compilation. Below just giving a quick compilation of the program inside LibppGam.f.

$ gfortran LibppGam.f -o main
$ ./main

Using Matlab or Octave version:

Download all Matlab files in your working directory and call them in your main function. All the functions are written in different files.

Wrapping C functions in python

If you are a python user and find the pure python implementation of the LibppGam slow, you may want to wrap specific functions or the whole C library in python. This may accelerate your calculations significantly. Here is a wrapping suggestion utilizing SWIG. Requirements: install swig in your system using specification for your operating system.

First you need to create an interface file LibppGam.i as follows

/*
LibppGam.i

SWIG interface file for wrapping LibppGam into python
*/

%module WrapLibppGam

%{
#include "LibppGam.h"
%}

%include "LibppGam.h"

Save the file and then try to build a shared library. In Unix-like systems you write:

gcc -Wall -I/usr/include/pythonX.Y -lpythonX.Y -c LibppGam.c wrapLibppGam.c -fPIC

gcc -shared LibppGam.o wrapLibppGam.o -o _LibppGam.so -lm

Here the pythonX.Y is the python version you want to use, e.g. python3.8. You can import now the library from your python code using import wrapLibppGam

About

This library contains the p+p->gamma production cross sections implemented in Python, C/C++, Fortran and Matlab. For details, see Phys.Rev. D90 (2014) 12, 123014

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published