IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 849b2b2c authored by Felix Riehn's avatar Felix Riehn Committed by Maximilian Reininghaus
Browse files

added fortran link and random number generator link

parent 6619e371
No related branches found
No related tags found
1 merge request!465Resolve "SOPHIA for low energy photo-hadronic interaction"
/*
* (c) Copyright 2022 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
#include <corsika/framework/random/RNGManager.hpp>
#include <random>
/**
* \file sophia/Random.hpp
*
* This file is an integral part of the sophia interface. It must be
* linked to the executable linked to sophia exactly once
*
*/
namespace sophia {
double rndm_interface() {
static corsika::default_prng_type& rng =
corsika::RNGManager<>::getInstance().getRandomStream("sophia");
std::uniform_real_distribution<double> dist;
return dist(rng);
}
} // namespace sophia
/*
* (c) Copyright 2022 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <sophia.hpp>
#include <cmath>
double get_sophia_mass2(int& id) { return so_mass1_.am2[std::abs(id) - 1]; }
double rndm_(int&) { return ::sophia::rndm_interface(); }
/*
* (c) Copyright 2022 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
/**
* \file sophia.hpp
*
* Interface definition to link to sophia library.
*
*/
namespace sophia {
/**
* \function sophia::rndm_interface
*
* this is the random number hook to external packages.
*
* CORSIKA8, for example, has to provide an implementation of this.
**/
double rndm_interface();
} // namespace sophia
//----------------------------------------------
// C++ interface for the SOPHIA event generator
//----------------------------------------------
// wrapper
extern "C" {
/**
\struct so_plist_
SOPHIA particle stack (FORTRAN COMMON)
variables are: np : numer of particles on stack
p : 4momentum + mass of particles on stack
llist : id of particles on stack
**/
extern struct {
double p[5][2000];
int llist[2000];
int np;
} so_plist_;
extern struct {
double cbr[102];
int idb[49];
int kdec[612];
int lbarp[49];
} so_csydec_;
// additional particle stack for the mother particles of unstable particles
// stable particles have entry zero
extern struct { int llist1[2000]; } so_plist1_;
// tables with particle properties
// charge, strangeness and baryon number
extern struct {
double s_life_[49];
int ichp[49];
int istr[49];
int ibar[49];
} so_chp_;
// tables with particle properties
// mass and mass squared
extern struct {
double am[49];
double am2[49];
} so_mass1_;
// sophia main subroutine
void eventgen_(const int&, const double&, const double&, const double&, const int&);
// print event
void print_event_(int&);
// decay routine (LA,P0,ND,LL,P)
// void decpar_(const int&, const double*, int&, int*, double*);
double rndm_(int&);
double get_sophia_mass2(int&);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment