IAP GITLAB

Commit 311a17db authored by Antonio Augusto Alves Junior's avatar Antonio Augusto Alves Junior Committed by Ralf Ulrich

g# This is a combination of 3 commits.

initial refactory

Refactoring corsika/core corsica/framework/geometry

...

refactory: corsika/framework/sequence

refactorying...

header.h -> header.hpp + other refacorying...

...

refactory media directory...

refactory: corsika/processes

...

refactoring...

testing...

Sibyll headers...

Pythia headers...

module sub-dir

some floating cc files around

eliminate relative include paths on top directories

fixing include file paths, remove quotes from include directives, fix remaining include guards and correct file names ...

unit tests: fixing include file paths, remove quotes from include directives, fix remaining include guards and correct file names ...

corsika/detail inclusion

corsika/detail changes

corsika::secondary_namespaces supressed in favor of detail

more include guards, relative file path, etc ...

nested class promotion to corsika::detail

Inteface to Pythia

one more relative path...

eliminating files...

dependencies managment...

...

dependencies refactory

adding corsika/modules and catch2

build scripts for UrQMD

make modules compile

cmake

first working vesion of new fwk

need to generate some header files

build scripts for dependencies

sibyll works now

proper file endings in many places
parent a6fa68d4
This diff is collapsed.
set (
COAST_HEADERS
COASTProcess.h
COASTStack.h
ParticleConversion.h
)
set (
COAST_SOURCES
COASTUserLib.cc
COASTProcess.cc
ParticleConversion.cc
)
set (
COAST_NAMESPACE
corsika/coast
)
add_library (COAST SHARED ${COAST_SOURCES})
CORSIKA_COPY_HEADERS_TO_NAMESPACE (COAST ${COAST_NAMESPACE} ${COAST_HEADERS})
set_target_properties (
COAST
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
# PUBLIC_HEADER "${MODEL_HEADERS}"
)
target_link_libraries (
COAST
PUBLIC
CORSIKAgeometry
CORSIKAunits
CORSIKAparticles
CORSIKAgeometry
CORSIKAsetup
# SuperStupidStack
)
target_include_directories (
COAST
PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/include>
)
target_include_directories (
COAST
SYSTEM
PUBLIC
$ENV{COAST_DIR}/include
)
install (
TARGETS COAST
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/${COAST_NAMESPACE}
)
#install (
# FILES ${COAST_HEADERS}
# DESTINATION include/${COAST_NAMESPACE}
# )
/*
* (c) Copyright 2018 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 <corsika/coast/COASTProcess.h>
#include <corsika/coast/COASTStack.h>
#include <iostream>
using namespace std;
namespace corsika::coast {
/**
the init function is called during the start of corsika.
*/
void COASTProcess::Init() {
cout << "************* Greetings from CORSIKA8 *****************" << endl;
}
/**
the docontinous function is called for each tracking step in
corsika. Take care: you cannot modify the particle, the track or
the stack from here (docontinuous) inside corisika7. In corsika8
you will be able to do that.
*/
corsika::process::EProcessReturn COASTProcess::DoContinuous(const Particle& p,
const Track& t,
const Stack&) {
using namespace corsika::units::si;
auto const start = t.GetPosition(0).GetCoordinates();
auto const delta = t.GetPosition(1).GetCoordinates() - start;
auto const name = corsika::particles::GetName(p.GetPID());
cout << "CORSIKA8: particle=" << name << ", pos=" << start
<< " track-l=" << delta.norm() << ", track-t=" << t.GetDuration() << endl;
return corsika::process::EProcessReturn::eOk;
}
} // namespace corsika::coast
/*
* (c) Copyright 2018 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/particles/ParticleProperties.h>
#include <corsika/process/ContinuousProcess.h>
#include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/coast/COASTStack.h>
#include <limits>
typedef corsika::coast::COASTStack Stack;
typedef corsika::coast::COASTStack::ParticleType Particle;
typedef corsika::geometry::Trajectory<corsika::geometry::Line> Track;
namespace corsika::coast {
class COASTProcess : public corsika::process::ContinuousProcess<COASTProcess> {
public:
void Init();
corsika::process::EProcessReturn DoContinuous(const Particle&, const Track&,
const Stack&);
corsika::units::si::LengthType MaxStepLength(Particle&, Track&) {
return corsika::units::si::meter * std::numeric_limits<double>::infinity();
}
private:
};
} // namespace corsika::coast
/*
* (c) Copyright 2018 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/coast/ParticleConversion.h>
#include <corsika/particles/ParticleProperties.h>
#include <corsika/stack/ParticleBase.h>
#include <corsika/stack/Stack.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/RootCoordinateSystem.h> // remove
#include <corsika/geometry/Vector.h>
#include <crs/CParticle.h>
#include <crs/CorsikaTypes.h>
#include <algorithm>
#include <vector>
namespace corsika::coast {
typedef corsika::geometry::Vector<corsika::units::si::hepmomentum_d> MomentumVector;
/**
* Example of a particle object on the stack.
*/
template <typename StackIteratorInterface>
class ParticleInterface : public corsika::stack::ParticleBase<StackIteratorInterface> {
using corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData;
using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex;
public:
corsika::particles::Code GetPID() const { return GetStackData().GetPID(GetIndex()); }
corsika::units::si::HEPEnergyType GetEnergy() const {
return GetStackData().GetEnergy(GetIndex());
}
MomentumVector GetMomentum(const corsika::geometry::CoordinateSystem& cs) const {
using namespace corsika::units::si;
const HEPEnergyType mass = corsika::particles::GetMass(GetPID());
const auto P = sqrt((GetEnergy() - mass) * (GetEnergy() + mass));
const auto p = GetStackData().GetDirection(cs);
return p * P;
}
corsika::geometry::Point GetPosition(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetPosition(cs, GetIndex());
}
corsika::geometry::Vector<corsika::units::si::speed_d> GetVelocity(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetVelocity(cs, GetIndex());
}
corsika::units::si::TimeType GetTime() const {
return GetStackData().GetTime(GetIndex());
}
corsika::geometry::Vector<corsika::units::si::dimensionless_d> GetDirection(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetDirection(cs);
}
corsika::units::si::TimeType GetTimeInterval() const {
return GetStackData().GetTimeInterval();
}
};
/**
*
* Memory implementation of the most simple (stupid) particle stack object.
*/
class COASTStackImpl {
const crs::CParticle* fParticle1 = 0;
const crs::CParticle* fParticle2 = 0;
public:
COASTStackImpl(const crs::CParticle* v1, const crs::CParticle* v2) {
fParticle1 = v1;
fParticle2 = v2;
}
void Init() {}
void Clear() {}
// there is one particle only
int GetSize() const { return 1; }
int GetCapacity() const { return 1; }
// you cannot modify the particle:
// there are no Set... function defined
// readout particle data, there is just one particle!
/*
double x;
double y;
double z;
double depth;
double time;
double energy;
double weight;
int particleId;
int hadronicGeneration;
*/
corsika::particles::Code GetPID(const int) const {
return ConvertFromCoast(static_cast<CoastCode>(fParticle1->particleId));
}
corsika::units::si::HEPEnergyType GetEnergy(const int) const {
using namespace corsika::units::si;
return fParticle1->energy * 1_GeV;
}
corsika::geometry::Vector<corsika::units::si::dimensionless_d> GetDirection(
const corsika::geometry::CoordinateSystem& cs) const {
using namespace corsika::units::si;
corsika::geometry::Point p1(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
corsika::geometry::Point p2(
cs, {fParticle2->x * 1_cm, fParticle2->y * 1_cm, fParticle2->z * 1_cm});
const corsika::geometry::Vector D = p2 - p1;
const auto magD = D.norm();
const corsika::geometry::Vector dir = D / magD;
return dir;
}
corsika::geometry::Vector<corsika::units::si::speed_d> GetVelocity(
const corsika::geometry::CoordinateSystem& cs, const int) const {
using namespace corsika::units::si;
corsika::geometry::Vector<corsika::units::si::dimensionless_d> dir =
GetDirection(cs);
corsika::geometry::Point p1(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
corsika::geometry::Point p2(
cs, {fParticle2->x * 1_cm, fParticle2->y * 1_cm, fParticle2->z * 1_cm});
const corsika::geometry::Vector D = p2 - p1;
const LengthType magD = D.norm();
const TimeType deltaT = GetTimeInterval();
return dir * magD / deltaT;
}
corsika::geometry::Point GetPosition(const corsika::geometry::CoordinateSystem& cs,
const int) const {
using namespace corsika::units::si;
return corsika::geometry::Point(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
}
corsika::units::si::TimeType GetTime(const int) const {
using namespace corsika::units::si;
return fParticle1->time * 1_s;
}
corsika::units::si::TimeType GetTimeInterval() const {
using namespace corsika::units::si;
return (fParticle2->time - fParticle1->time) * 1_s;
}
/**
* We do not allow copying!
*/
void Copy(const int, const int) {}
/**
* We do not allow swapping particles, there is just one...
*/
void Swap(const int, const int) {}
// size cannot be increased, do nothing
void IncrementSize() {}
// size cannot be decremented, do nothing
void DecrementSize() {}
}; // end class COASTStackImpl
typedef corsika::stack::Stack<COASTStackImpl, ParticleInterface> COASTStack;
} // namespace corsika::coast
/*
* (c) Copyright 2018 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 <interface/CorsikaInterface.h>
#include <corsika/coast/COASTProcess.h>
#include <corsika/coast/COASTStack.h>
#include <corsika/geometry/CoordinateSystem.h>
#include <corsika/geometry/Line.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/Trajectory.h>
#include <corsika/geometry/Vector.h>
#include <corsika/units/PhysicalUnits.h>
#include <crs/CInteraction.h>
#include <crs/CParticle.h>
#include <crs/CorsikaTypes.h>
#include <crs/TSubBlock.h>
#include <iostream>
#include <sstream>
using namespace std;
using namespace corsika;
using namespace corsika::units::si;
corsika::coast::COASTProcess gCorsikaProcess;
/*
Data is one CORSIKA data-block constining of 21 SubBlocks.
A SubBlock can be:
- thinned mode: 39 (Particles) * 8 (ENTRIES) * 4 (BYTES)
- not-thinned mode: 39 (Particles) * 7 (ENTRIES) * 4 (BYTES)
*/
extern "C" void wrida_([[maybe_unused]] const CREAL* Data) {
// crs::CParticleFortranPtr p;
// const bool isF = prminfo_(p);
}
extern "C" void inida_([[maybe_unused]] const char* filename,
[[maybe_unused]] const int& thinning,
[[maybe_unused]] const int& /*curved*/,
[[maybe_unused]] const int& /*slant*/,
[[maybe_unused]] const int& /*stackinput*/,
[[maybe_unused]] const int& /*preshower*/,
[[maybe_unused]] int str_length) {
gCorsikaProcess.Init();
}
extern "C" void cloda_() {
// crs::CParticleFortranPtr pptr;
// const bool isF = prminfo_(pptr);
// gCorsikaProcess.Close();
}
void interaction_([[maybe_unused]] const crs::CInteraction& interaction) {
/*
all interactions in the shower are available in this function !
the information availabel in the CInteraction class are:
double x;
double y;
double z;
double etot; // lab energy
double sigma; // cross-section of process
double kela; // elasticity
int projId; // projectile
int targetId; // target
double time;
*/
}
extern "C" void track_([[maybe_unused]] const crs::CParticle& pre,
[[maybe_unused]] const crs::CParticle& post) {
/*
all particles in the shower are available in this function !
The pre and post objecte are the two endpoints for one single track
in the shower, where the information available in CParticle is:
double x;
double y;
double z;
double depth;
double time;
double energy;
double weight;
int particleId;
int hadronicGeneration;
*/
coast::COASTStack stack(&pre, &post);
const auto particle = stack.GetNextParticle();
const geometry::CoordinateSystem& rootCS =
geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem();
geometry::Line const line(particle.GetPosition(rootCS), particle.GetVelocity(rootCS));
const TimeType time = particle.GetTimeInterval();
const geometry::Trajectory<geometry::Line> track(line, time);
gCorsikaProcess.DoContinuous(particle, track, stack);
}