IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 16c98b1f authored by Felix Riehn's avatar Felix Riehn Committed by ralfulrich
Browse files

finished corsika style init and event init

parent 63528c40
No related branches found
No related tags found
1 merge request!318Resolve "EPOS is missing"
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <epos.hpp> #include <epos.hpp>
#include <string>
#include <tuple> #include <tuple>
using namespace corsika; using namespace corsika;
...@@ -28,81 +29,121 @@ using SetupParticle = setup::Stack::stack_iterator_type; ...@@ -28,81 +29,121 @@ using SetupParticle = setup::Stack::stack_iterator_type;
namespace corsika::epos { namespace corsika::epos {
inline Interaction::Interaction() { inline Interaction::Interaction(const std::string& dataPath)
: data_path_(dataPath) {
// if(ilowegy.ne.1.or.MCleModel.eq.4)xsegymin=dble(0.5*egymin**2) if (dataPath == "") {
// if(MCModel.eq.4)xsegymax=min(xsegymax,dble(0.5*egymax**2)) if (std::getenv("CORSIKA_DATA")) {
// nrnody=nrnodyxs data_path_ = std::string(std::getenv("CORSIKA_DATA")) + "/EPOS/";
// do i=1,nrnody CORSIKA_LOG_DEBUG("Searching for EPOSLHC data tables in {}", data_path_);
// nody(i)= nodyxs(i) }
// enddo }
// #if !__CXCORSIKA__ && !__CORSIKA8__
// initialize Eposlhc
// inicnt=inicnt+1 static bool initialized = false;
// c isetcs=2 ! epos cross-section from tabulated calculation (h-A and AA) if (!initialized) {
::epos::hadr6_.isetcs=3; // epos cross-section from tabulated simulations initialize_eposlhc_c7();
// (h-A and A-A) initialized = true;
::epos::nucl6_.infragm=2; // --> model how projectiles fragment! }
::epos::hadr6_.isigma=0; // !do not print out the }
// cross section on screen ionudi=1
// nfnii=nxsfnii ! epos file name inline void Interaction::initialize_eposlhc_c7() {
// fnii=xsfnii
// nfnid=nxsfnid // corsika7 ini
// fnid=xsfnid int iarg = 0;
// nfnie=nxsfnie ::epos::aaset_(iarg);
// fnie=xsfnie //::epos::atitle_();
// nfnrj=nxsfnrj
// fnrj=xsfnrj //::epos::prnt1_.ish = 3; // debug level in epos
// nfncs=nxsfncs //::epos::prnt1_.ifch = 6; // output unit
// fncs=xsfncs //::epos::prnt1_.iecho = 1;
// nfnch=nxsfnch
// fnch=xsfnch // dummy set seeds for random number generator in epos. need to fool epos checks...
// we will use external generator
// c air ::epos::cseed_.seedi = 1;
/* for (int i=1; i<=3; ++i) { ::epos::cseed_.seedj = 1;
::epos::nxsair_.airanxs[i]=aira[i]; ::epos::cseed_.seedc = 1;
::epos::nxsair_.airznxs[i]=airz[i];
::epos::nxsair_.airwnxs[i]=airw[i]; ::epos::enrgy_.egymin = 6.;
} ::epos::enrgy_.egymax = 2.e6;
::epos::nxsair_.airavanxs=airava;
::epos::nxsair_.airavznxs=airavz; ::epos::lhcparameters_();
*/
::epos::hadr6_.isigma = 0;// do not show cross section
::epos::appli_.iappl = iapplxs; ::epos::hadr6_.isetcs = 3; /* !option to obtain pomeron parameters
::epos::events_.nevent = neventxs; ! 0.....determine parameters but do not use Kfit
::epos::othe2_.iframe = iframexs; ! 1.....determine parameters and use Kfit
! else..get from table
// if(fnch(1:nfnch).ne.'none') ! should be sufficiently detailed
// & open(ifcx,file=fnch(1:nfnch),status='unknown') ! say iclegy1=1,iclegy2=99
! table is always done, more or less detailed!!!
// call iclass(idproj,iclpro) !and option to use cross section tables
// call iclass(idtarg,icltar) ! 2....tabulation
// if(inicnt.eq.1)then ! 3....simulation
// call ranfgt(seedp) !not to change the seed ... */
::epos::hdecin_(false); ::epos::cjinti_.ionudi =
::epos::hnbspd_(iospec); 1; // !include quasi elastic events but strict calculation of xs
// ktnbod=0 ::epos::cjinti_.iorsce = 0; // !color exchange turned on(1) or off(0)
::epos::hnbpajini_(); ::epos::cjinti_.iorsdf = 3; // !droplet formation turned on(>0) or off(0)
// if(iclegy2.gt.1)then ::epos::cjinti_.iorshh = 0; // !other hadron-hadron int. turned on(1) or off(0)
// egyfac=(egymax*1.0001/egylow)**(1./float(iclegy2-1))
// else ::epos::othe1_.istore = 0; // do not produce epos output file
// egyfac=1. ::epos::nucl6_.infragm = 0; // keep free nucleons in fragmentation
// endif
// endif // set paths to tables in corsika data
// maproj=mamx !to set difnuc up to the maximum mass ::epos::datadir BASE(data_path_);
// call conini strcpy(::epos::fname_.fnnx, BASE.data);
// call psaini ::epos::nfname_.nfnnx = BASE.length;
// call ranfst(seedp) ! ... after this initialization
::epos::datadir TL(data_path_ + "epos.initl");
strcpy(::epos::fname_.fnii, TL.data);
::epos::nfname_.nfnii = TL.length;
::epos::datadir EV(data_path_ + "epos.iniev");
strcpy(::epos::fname_.fnie, EV.data);
::epos::nfname_.nfnie = EV.length;
::epos::datadir RJ(data_path_ + "epos.inirj"); // lhcparameters adds ".lhc"
strcpy(::epos::fname_.fnrj, RJ.data);
::epos::nfname_.nfnrj = RJ.length;
::epos::datadir CS(data_path_ + "epos.inics"); // lhcparameters adds ".lhc"
strcpy(::epos::fname_.fncs, CS.data);
::epos::nfname_.nfncs = CS.length;
//::epos::fname_.fnid="/home/felix/ngcorsika/corsika/modules/data/EPOS/epos.inidi";
// EPOPAR input ../epos/epos.param !initialization input file for epos
// EPOPAR fname inics ../epos/epos.inics !initialization input file for epos
// EPOPAR fname iniev ../epos/epos.iniev !initialization input file for epos
// EPOPAR fname initl ../epos/epos.initl !initialization input file for epos
// EPOPAR fname inirj ../epos/epos.inirj !initialization input file for epos
// EPOPAR fname inihy ../epos/epos.ini1b !initialization input file for epos
// dummy event
::epos::hadr25_.idprojin = 1120;
::epos::hadr25_.idtargin = 1120;
//#if __CONEX__ && __EPOS__ && __HIGHMEM__
// maproj = 250
//#else
::epos::nucl1_.maproj = 56;
// #endif
::epos::nucl1_.laproj = 28;
::epos::nucl1_.matarg = 14;
::epos::nucl1_.latarg = 1;
::epos::hadr1_.pnll = 200.;
::epos::lept1_.engy = -1.;
::epos::ainit_();
} }
inline Interaction::~Interaction() { inline Interaction::~Interaction() {
CORSIKA_LOG_DEBUG("Epos::Interaction n={} ", count_); CORSIKA_LOG_DEBUG("Epos::Interaction n={} ", count_);
} }
inline corsika::CrossSectionType Interaction::getCrossSection( inline std::tuple<corsika::CrossSectionType, corsika::CrossSectionType>
const corsika::Code BeamId, const corsika::Code TargetId, Interaction::getCrossSection(const corsika::Code BeamId, const corsika::Code TargetId,
const corsika::HEPEnergyType CoMenergy) const {} const corsika::HEPEnergyType CoMenergy) const {}
template <> template <>
inline corsika::GrammageType Interaction::getInteractionLength( inline corsika::GrammageType Interaction::getInteractionLength(
...@@ -111,23 +152,18 @@ namespace corsika::epos { ...@@ -111,23 +152,18 @@ namespace corsika::epos {
return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm); return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm);
} }
/**
In this function SIBYLL is called to produce one event. The
event is copied (and boosted) into the shower lab frame.
*/
template <typename TSecondaryView> template <typename TSecondaryView>
inline void Interaction::doInteraction(TSecondaryView& view) { inline void Interaction::doInteraction(TSecondaryView& view) {
auto const projectile = view.getProjectile(); auto const projectile = view.getProjectile();
const auto corsikaBeamId = projectile.getPID(); auto const corsikaBeamId = projectile.getPID();
if (corsika::is_nucleus(corsikaBeamId)) { if (corsika::is_nucleus(corsikaBeamId)) {
// nuclei handled by different process, this should not happen // nuclei handled by different process, this should not happen
throw std::runtime_error("Nuclear projectile are not handled by SIBYLL!"); throw std::runtime_error("Nuclear projectile are not handled by EPOSLHC!");
} }
// position and time of interaction, not used in Sibyll // position and time of interaction, not used in Epos
Point const pOrig = projectile.getPosition(); Point const pOrig = projectile.getPosition();
TimeType const tOrig = projectile.getTime(); TimeType const tOrig = projectile.getTime();
...@@ -138,7 +174,7 @@ namespace corsika::epos { ...@@ -138,7 +174,7 @@ namespace corsika::epos {
CORSIKA_LOG_DEBUG( CORSIKA_LOG_DEBUG(
"ProcessEPOS: " "ProcessEPOS: "
"DoInteraction: pid {} interaction ", "DoInteraction: {} interaction ",
corsikaBeamId); corsikaBeamId);
// define target // define target
...@@ -207,7 +243,8 @@ namespace corsika::epos { ...@@ -207,7 +243,8 @@ namespace corsika::epos {
for (size_t i = 0; i < compVec.size(); ++i) { for (size_t i = 0; i < compVec.size(); ++i) {
auto const targetId = compVec[i]; auto const targetId = compVec[i];
auto const sigProd = getCrossSection(corsikaBeamId, targetId, Ecm); [[maybe_unused]] auto const [sigProd, sigEla] =
getCrossSection(corsikaBeamId, targetId, Ecm);
cross_section_of_components[i] = sigProd; cross_section_of_components[i] = sigProd;
} }
...@@ -215,8 +252,45 @@ namespace corsika::epos { ...@@ -215,8 +252,45 @@ namespace corsika::epos {
mediumComposition.sampleTarget(cross_section_of_components, RNG_); mediumComposition.sampleTarget(cross_section_of_components, RNG_);
CORSIKA_LOG_DEBUG("Interaction: target selected: {} ", targetCode); CORSIKA_LOG_DEBUG("Interaction: target selected: {} ", targetCode);
// // from corsika7 interface
// NEXLNK-part
//projectile
// if(is_nucleus(corsikaBeamId)){
// ::epos::hadr25_.idprojin =1120;
// ::epos::nucl1_.laproj = projectile.get_nucleus_Z(); // Z
// ::epos::nucl1_.maproj = projectile.get_nucleus_A();; // A
// } else {
::epos::hadr25_.idprojin = 1120 ; // id "NEXUS code"
::epos::nucl1_.laproj = -1; // Z (-1 for hadron)
::epos::nucl1_.maproj = 1; // A
//}
// target
//if(is_nucleus(targetCode)){
::epos::hadr25_.idtargin = 1120; // id "NEXUS code"
::epos::nucl1_.latarg = 1; // Z (-1 with id 1220 for neutron)
::epos::nucl1_.matarg = 1; // A
// hadron-nucleon momentum
::epos::hadr1_.pnll = float(200);
// C SET ENGY NEGATIVE TO FORCE CALCULATION IN LAB FRAME
::epos::lept1_.engy = -1.;
::epos::enrgy_.ecms = -1.;
::epos::enrgy_.elab = -1.;
::epos::enrgy_.ekin = -1.;
//C INTIALIZE ENERGY AND PARTICLE DEPENDENT PORTION OF EPOS/NEXUS
//C AT THE FIRST CALL: READ ALSO DATA SETS
::epos::ainit_();
// create event
int iarg = 1;
::epos::aepos_(iarg);
// NSTORE-part
std::cout << "npart: " << ::epos::cptl_.nptl << std::endl;
/* /*
maproj=maprojxs maproj=maprojxs
laproj=laprojxs laproj=laprojxs
......
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