IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 8ee886e4 authored by ralfulrich's avatar ralfulrich
Browse files

fixed compiler warnings and tests

parent 5a11b530
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ TEST_CASE("CONEX", "[processes]") {
using std::cout;
using std::endl;
/*
std::string parameterPathName = "";
// auto cxModel = eSibyll23;
// ConexDynamicInterface cx(cxModel);
......@@ -48,5 +49,6 @@ TEST_CASE("CONEX", "[processes]") {
// cx.RunConex(randomSeeds, energyInGeV, zenith, azimuth, impactParameter,
// particleType);
*/
}
}
......@@ -78,11 +78,11 @@ void CONEXSourceCut::addParticle(int egs_pid, HEPEnergyType energy,
double v = direction.dot(x_sf_).magnitude();
double w = direction.dot(showerAxis_.GetDirection()).magnitude();
int iri = 2; // EGS medium air
// int iri = 2; // EGS medium air
double weight = 1;
int latchin = 1; // generation, we don't have the actual value...
// int latchin = 1; // generation, we don't have the actual value...
double E = energy / 1_GeV;
std::cout << "CONEXSourceCut: removing " << egs_pid << " " << std::scientific << energy
......@@ -129,17 +129,11 @@ void CONEXSourceCut::addParticle(int egs_pid, HEPEnergyType energy,
void CONEXSourceCut::Init() {}
void CONEXSourceCut::SolveCE() {
int zero = 0;
int iCEmode = 1;
int id = 0; // RU: max, fix this
int nshtot_ = 0; // RU: max, fix this
// conex_.HadronCascade(id, nshtot_, zero, iCEmode);
// conex_.SolveMomentEquations(zero);
conex::conexcascade_();
// RU: this here is from cxroot,
// RU: this here is from cxroot:
// int nX = conex_.GetNumberOfDepthBins(); // make sure this works!
int nX = conex::get_number_of_depth_bins_(); // make sure this works!
int icut = 1;
......@@ -162,14 +156,8 @@ void CONEXSourceCut::SolveCE() {
auto Electrons = std::make_unique<float[]>(maxX);
auto Hadrons = std::make_unique<float[]>(maxX);
float EGround[3], fitpars[13], currlgE, Xmx, Nmx, XmxdEdX, dEdXmx;
float EGround[3], fitpars[13];
// conex_.GetShowerData(icut, iSec, nX, X[0], N[0], fitpars[0], H[0], D[0]);
// conex_.GetdEdXProfile(icut, nX, dEdX[0], EGround[0]);
// conex_.GetMuonProfile(icutm, nX, Mu[0], dMu[0]);
// conex_.GetGammaProfile(icutg, nX, Gamma[0]);
// conex_.GetElectronProfile(icute, nX, Electrons[0]);
// conex_.GetHadronProfile(icuth, nX, Hadrons[0]);
conex::get_shower_data_(icut, iSec, nX, X[0], N[0], fitpars[0], H[0], D[0]);
conex::get_shower_edep_(icut, nX, dEdX[0], EGround[0]);
conex::get_shower_muon_(icutm, nX, Mu[0], dMu[0]);
......@@ -193,8 +181,7 @@ CONEXSourceCut::CONEXSourceCut(geometry::Point center,
units::si::LengthType injectionHeight,
units::si::HEPEnergyType primaryEnergy,
particles::PDGCode primaryID)
: // conex_{ConexDynamicInterface(eSibyll23)}
center_{center}
: center_{center}
, showerAxis_{showerAxis}
, groundDist_{groundDist}
, showerCore_{showerAxis_.GetStart() + showerAxis_.GetDirection() * groundDist_}
......@@ -259,8 +246,9 @@ CONEXSourceCut::CONEXSourceCut(geometry::Point center,
int nShower = 1; // large to avoid final stats.
int maxDetail = 0;
#ifdef CONEX_EXTENSIONS
int particleListMode = 0;
// conex_.Init(nShower, randomSeeds, maxDetail, particleListMode, parameterPathName);
#endif
std::string configPath = CONEX_CONFIG_PATH;
conex::initconex_(nShower, randomSeeds, heModel, maxDetail,
......@@ -295,6 +283,5 @@ CONEXSourceCut::CONEXSourceCut(geometry::Point center,
double xminp = injectionHeight / 1_m;
// conex_.ConexRun(ipart, eprima, theta, phi, dimpact, ioseed.data());
conex::conexrun_(ipart, eprima, theta, phi, xminp, dimpact, ioseed.data());
}
......@@ -122,6 +122,8 @@ TEST_CASE("InteractionCounter") {
SECTION("DoInteraction nucleus") {
unsigned short constexpr A = 14, Z = 7;
auto [stackPtr, secViewPtr] = setupStack(A, Z, 105_TeV, nodePtr, *csPtr);
REQUIRE(stackPtr->GetSize() == 1);
REQUIRE(secViewPtr->GetSize() == 0);
auto projectile = secViewPtr->GetProjectile();
auto const ret = countedProcess.DoInteraction(projectile);
......@@ -140,6 +142,8 @@ TEST_CASE("InteractionCounter") {
auto constexpr code = particles::Code::Lambda0;
auto constexpr codeInt = static_cast<particles::CodeIntType>(code);
auto [stackPtr, secViewPtr] = setupStack(code, 105_TeV, nodePtr, *csPtr);
REQUIRE(stackPtr->GetSize() == 1);
REQUIRE(secViewPtr->GetSize() == 0);
auto projectile = secViewPtr->GetProjectile();
auto const ret = countedProcess.DoInteraction(projectile);
......
......@@ -45,36 +45,36 @@ auto sumMomentum(TStackView const& view, geometry::CoordinateSystem const& vCS)
TEST_CASE("QgsjetII", "[processes]") {
SECTION("QgsjetII -> Corsika") {
REQUIRE(particles::PiPlus::GetCode() == process::qgsjetII::ConvertFromQgsjetII(
CHECK( particles::PiPlus::GetCode() == process::qgsjetII::ConvertFromQgsjetII(
process::qgsjetII::QgsjetIICode::PiPlus));
}
SECTION("Corsika -> QgsjetII") {
REQUIRE(process::qgsjetII::ConvertToQgsjetII(particles::PiMinus::GetCode()) ==
CHECK( process::qgsjetII::ConvertToQgsjetII(particles::PiMinus::GetCode()) ==
process::qgsjetII::QgsjetIICode::PiMinus);
REQUIRE(process::qgsjetII::ConvertToQgsjetIIRaw(particles::Proton::GetCode()) == 2);
CHECK( process::qgsjetII::ConvertToQgsjetIIRaw(particles::Proton::GetCode()) == 2);
}
SECTION("canInteractInQgsjetII") {
REQUIRE(process::qgsjetII::CanInteract(particles::Proton::GetCode()));
REQUIRE(process::qgsjetII::CanInteract(particles::Code::KPlus));
REQUIRE(process::qgsjetII::CanInteract(particles::Nucleus::GetCode()));
// REQUIRE(process::qgsjetII::CanInteract(particles::Helium::GetCode()));
CHECK( process::qgsjetII::CanInteract(particles::Proton::GetCode()));
CHECK( process::qgsjetII::CanInteract(particles::Code::KPlus));
CHECK( process::qgsjetII::CanInteract(particles::Nucleus::GetCode()));
// CHECK(process::qgsjetII::CanInteract(particles::Helium::GetCode()));
REQUIRE_FALSE(process::qgsjetII::CanInteract(particles::EtaC::GetCode()));
REQUIRE_FALSE(process::qgsjetII::CanInteract(particles::SigmaC0::GetCode()));
CHECK_FALSE( process::qgsjetII::CanInteract(particles::EtaC::GetCode()));
CHECK_FALSE( process::qgsjetII::CanInteract(particles::SigmaC0::GetCode()));
}
SECTION("cross-section type") {
REQUIRE(process::qgsjetII::GetQgsjetIIXSCode(particles::Code::Neutron) ==
CHECK( process::qgsjetII::GetQgsjetIIXSCode(particles::Code::Neutron) ==
process::qgsjetII::QgsjetIIXSClass::Baryons);
REQUIRE(process::qgsjetII::GetQgsjetIIXSCode(particles::Code::K0Long) ==
CHECK( process::qgsjetII::GetQgsjetIIXSCode(particles::Code::K0Long) ==
process::qgsjetII::QgsjetIIXSClass::Kaons);
REQUIRE(process::qgsjetII::GetQgsjetIIXSCode(particles::Code::Proton) ==
CHECK( process::qgsjetII::GetQgsjetIIXSCode(particles::Code::Proton) ==
process::qgsjetII::QgsjetIIXSClass::Baryons);
REQUIRE(process::qgsjetII::GetQgsjetIIXSCode(particles::Code::PiMinus) ==
CHECK( process::qgsjetII::GetQgsjetIIXSCode(particles::Code::PiMinus) ==
process::qgsjetII::QgsjetIIXSClass::LightMesons);
}
}
......@@ -120,6 +120,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
const geometry::CoordinateSystem& cs = env.GetCoordinateSystem();
random::RNGManager::GetInstance().RegisterRandomStream("qgran");
random::RNGManager::GetInstance().SeedAll(111);
SECTION("InteractionInterface") {
......@@ -144,12 +145,11 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
[[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile);
[[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle);
REQUIRE(length / (1_g / square(1_cm)) == Approx(93.47).margin(0.1));
REQUIRE(view.GetSize() == 13);
/*REQUIRE( sumCharge(view) ==
1 + particles::GetChargeNumber(particles::Code::Oxygen) );*/
CHECK( length / (1_g / square(1_cm)) == Approx(26568.64).margin(0.1) );
CHECK( view.GetSize() == 8 );
CHECK( sumCharge(view) == 2 );
auto const secMomSum = sumMomentum(view, projectileMomentum.GetCoordinateSystem());
REQUIRE((secMomSum - projectileMomentum).norm() / projectileMomentum.norm() ==
Approx(0).margin(1e-2));
CHECK( (secMomSum - projectileMomentum).norm() / projectileMomentum.norm() ==
Approx(0).margin(1e-2) );
}
}
......@@ -138,6 +138,8 @@ TEST_CASE("UrQMD") {
SECTION("interaction length") {
auto [env, csPtr, nodePtr] = setupEnvironment(particles::Code::Nitrogen);
auto const& cs = *csPtr;
[[maybe_unused]] auto const& env_dummy = env;
[[maybe_unused]] auto const& node_dummy = nodePtr;
particles::Code validProjectileCodes[] = {
particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::Proton,
......@@ -147,6 +149,7 @@ TEST_CASE("UrQMD") {
for (auto code : validProjectileCodes) {
auto [stack, view] = setupStack(code, 100_GeV, nodePtr, cs);
REQUIRE(stack->GetSize() == 1);
REQUIRE(view->GetSize() == 0);
// simple check whether the cross-section is non-vanishing
// only nuclei with available tabluated data so far
......@@ -156,8 +159,13 @@ TEST_CASE("UrQMD") {
SECTION("nucleus projectile") {
auto [env, csPtr, nodePtr] = setupEnvironment(particles::Code::Oxygen);
[[maybe_unused]] auto const& env_dummy = env; // against warnings
[[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
unsigned short constexpr A = 14, Z = 7;
auto [stackPtr, secViewPtr] = setupStack(A, Z, 400_GeV, nodePtr, *csPtr);
REQUIRE(stackPtr->GetSize() == 1);
REQUIRE(secViewPtr->GetSize() == 0);
// must be assigned to variable, cannot be used as rvalue?!
auto projectile = secViewPtr->GetProjectile();
......@@ -175,8 +183,13 @@ TEST_CASE("UrQMD") {
SECTION("\"special\" projectile") {
auto [env, csPtr, nodePtr] = setupEnvironment(particles::Code::Oxygen);
[[maybe_unused]] auto const& env_dummy = env; // against warnings
[[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
auto [stackPtr, secViewPtr] =
setupStack(particles::Code::PiPlus, 400_GeV, nodePtr, *csPtr);
REQUIRE(stackPtr->GetSize() == 1);
REQUIRE(secViewPtr->GetSize() == 0);
// must be assigned to variable, cannot be used as rvalue?!
auto projectile = secViewPtr->GetProjectile();
......@@ -196,8 +209,13 @@ TEST_CASE("UrQMD") {
SECTION("K0Long projectile") {
auto [env, csPtr, nodePtr] = setupEnvironment(particles::Code::Oxygen);
[[maybe_unused]] auto const& env_dummy = env; // against warnings
[[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
auto [stackPtr, secViewPtr] =
setupStack(particles::Code::K0Long, 400_GeV, nodePtr, *csPtr);
REQUIRE(stackPtr->GetSize() == 1);
REQUIRE(secViewPtr->GetSize() == 0);
// must be assigned to variable, cannot be used as rvalue?!
auto projectile = secViewPtr->GetProjectile();
......
......@@ -228,13 +228,13 @@ message (STATUS "USE_CONEX_C8='${USE_CONEX_C8}'")
add_library (C8::ext::conex STATIC IMPORTED GLOBAL)
# this is from the corsika-data/readLib submodule:
get_directory_property (Boost_iostreams_FOUND DIRECTORY ${CORSIKA_DATA}/readLib DEFINITION Boost_iostreams_FOUND)
get_directory_property (Boost_IOSTREAMS_FOUND DIRECTORY ${CORSIKA_DATA}/readLib DEFINITION Boost_IOSTREAMS_FOUND)
set (conex_boost "")
set (boost_lib "boost_iostreams")
if (NOT Boost_iostreams_FOUND)
if (NOT Boost_IOSTREAMS_FOUND)
set (conex_boost "NO_BOOST=1")
set (boost_lib "")
endif (NOT Boost_iostreams_FOUND)
endif (NOT Boost_IOSTREAMS_FOUND)
if ("x_${USE_CONEX_C8}" STREQUAL "x_SYSTEM")
find_package (CONEX REQUIRED)
......@@ -277,7 +277,7 @@ else ()
endif ()
if (Boost_iostreams_FOUND)
if (Boost_IOSTREAMS_FOUND)
set_target_properties (
C8::ext::conex PROPERTIES
IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXsibyll.a
......@@ -287,7 +287,7 @@ if (Boost_iostreams_FOUND)
INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>
)
else (Boost_iostreams_FOUND)
else (Boost_IOSTREAMS_FOUND)
set_target_properties (
C8::ext::conex PROPERTIES
IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXsibyll.a
......@@ -296,4 +296,4 @@ else (Boost_iostreams_FOUND)
INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}>
)
endif (Boost_iostreams_FOUND)
endif (Boost_IOSTREAMS_FOUND)
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