IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 7ba4c68a authored by ralfulrich's avatar ralfulrich
Browse files

coverage

parent 9b56461a
No related branches found
No related tags found
1 merge request!371Additional outputs ported to new architecture
......@@ -82,6 +82,7 @@ namespace corsika {
deltaX / 1_g * square(1_cm));
if (deltaX < dX_threshold_) {
CORSIKA_LOGGER_TRACE(TOutput::getLogger(), "Point-like dE");
this->write(track.getPosition(0), PID, dE);
return;
}
......
......@@ -69,6 +69,11 @@ namespace corsika {
int const binStart = std::ceil(grammageStart / dX_);
int const binEnd = std::floor(grammageEnd / dX_);
CORSIKA_LOGGER_TRACE(TOutput::getLogger(),
"grammageStart={} End={} binStart={}, end={}",
grammageStart / 1_g * square(1_cm),
grammageEnd / 1_g * square(1_cm), binStart, binEnd);
for (int bin = binStart; bin <= binEnd; ++bin) {
if (pid == Code::Photon) {
profile_.at(bin)[static_cast<int>(number_profile::ProfileIndex::Photon)] +=
......
......@@ -83,21 +83,6 @@ namespace corsika {
}
}
inline void ParticleWriterParquet::write(unsigned int const A, unsigned int const Z,
HEPEnergyType const& energy,
LengthType const& x, LengthType const& y,
LengthType const& z, double const weight) {
// write the next row - we must write `shower_` first.
*(output_.getWriter()) << showerId_ << static_cast<int>(get_PDG(A, Z))
<< static_cast<float>(energy / 1_GeV)
<< static_cast<float>(x / 1_m) << static_cast<float>(y / 1_m)
<< static_cast<float>(z / 1_m) << static_cast<float>(weight)
<< parquet::EndRow;
totalEnergy_ += energy;
++countHadrons_;
}
/**
* Return collected library-level summary for output.
*/
......
......@@ -53,14 +53,6 @@ namespace corsika {
units::si::LengthType const& x, units::si::LengthType const& y,
units::si::LengthType const& z, const double weight);
/**
* Write a Code::Nucleus particle to the file.
*/
void write(unsigned int const A, unsigned int const Z,
units::si::HEPEnergyType const& energy, units::si::LengthType const& x,
units::si::LengthType const& y, units::si::LengthType const& z,
const double weight);
/**
* Return collected library-level summary for output.
*/
......
......@@ -291,7 +291,7 @@ int main(int argc, char** argv) {
corsika::urqmd::UrQMD urqmd_model;
InteractionCounter urqmdCounted{urqmd_model};
TrackCheck trackCheck;
TrackCheck trackCheck(obsPlane);
// assemble all processes into an ordered process list
struct EnergySwitch {
......
......@@ -139,4 +139,7 @@ TEST_CASE("CONEX") {
conex.doCascadeEquations(stack);
CHECK(w1.getEnergyLost() / 1_TeV == Approx(1.0).epsilon(0.1));
auto const cfg = conex.getConfig();
CHECK(cfg.size() == 0);
}
......@@ -65,11 +65,11 @@ TEST_CASE("EnergyLossWriter") {
auto const injectionHeight = 10_km;
auto const t = -observationHeight + injectionHeight;
Point const showerCore{cs, 0_m, 0_m, observationHeight};
Point const injectionPos = showerCore + Vector<dimensionless_d>{cs, {0, 0, 1}} * t;
Point const injectionPos = showerCore + DirectionVector{cs, {0, 0, 1}} * t;
ShowerAxis const showerAxis{injectionPos, (showerCore - injectionPos), *env,
true, // -> throw exceptions
20}; // -> number of bins
false, // -> throw exceptions
1000}; // -> number of bins
// preparation
if (boost::filesystem::exists("./output_dir_eloss")) {
......@@ -89,16 +89,21 @@ TEST_CASE("EnergyLossWriter") {
// generate straight simple track
CoordinateSystemPtr rootCS = get_root_CoordinateSystem();
Point r0(rootCS, {0_m, 0_m, 7_km});
Point r0(rootCS, {0_m, 0_m, 6.555_km});
SpeedType const V0 = constants::c;
VelocityVector v0(rootCS, {V0, 0_m / second, 0_m / second});
VelocityVector v0(rootCS, {0_m / second, 0_m / second, -V0});
Line const line(r0, v0);
auto const time = 1000_ns;
StraightTrajectory track(line, time);
StraightTrajectory trackShort(line, time / 5e3); // short
StraightTrajectory trackPointLike(line, time / 1e7); // ultra short
StraightTrajectory trackInverse({track.getPosition(1), -v0}, time);
// test write
test.write(track, Code::Proton, 100_GeV);
test.write(trackInverse, Code::Proton, 100_GeV); // equivalent
test.write(trackShort, Code::Proton, 100_GeV); // this is in a single bin
test.write(trackPointLike, Code::Proton,
100_GeV); // this is just a located point-like dE
// incompatible binning
CHECK_THROWS(test.write(100_g / square(1_cm), // extra line break by purpose
......@@ -120,7 +125,7 @@ TEST_CASE("EnergyLossWriter") {
CHECK(config["grammage_threshold"].as<double>() == Approx(0.0001));
auto const summary = test.getSummary();
CHECK(summary["sum_dEdX"].as<double>() == 400);
CHECK(summary["sum_dEdX"].as<double>() == 600);
// makes not yet sense:
// CHECK(summary["Xmax"].as<double>() == 200);
// CHECK(summary["dEdXmax"].as<double>() == 200);
......
......@@ -67,11 +67,11 @@ TEST_CASE("LongitudinalWriter") {
auto const injectionHeight = 10_km;
auto const t = -observationHeight + injectionHeight;
Point const showerCore{cs, 0_m, 0_m, observationHeight};
Point const injectionPos = showerCore + Vector<dimensionless_d>{cs, {0, 0, 1}} * t;
Point const injectionPos = showerCore + DirectionVector{cs, {0, 0, 1}} * t;
ShowerAxis const showerAxis{injectionPos, (showerCore - injectionPos), *env,
true, // -> throw exceptions
20}; // -> number of bins
false, // -> throw exceptions
1000}; // -> number of bins
// preparation
if (boost::filesystem::exists("./output_dir_long")) {
......@@ -85,9 +85,9 @@ TEST_CASE("LongitudinalWriter") {
// generate straight simple track
CoordinateSystemPtr rootCS = get_root_CoordinateSystem();
Point r0(rootCS, {0_km, 0_m, 7_m});
Point r0(rootCS, {0_km, 0_m, 8_km});
SpeedType const V0 = constants::c;
VelocityVector v0(rootCS, {V0, 0_m / second, 0_m / second});
VelocityVector v0(rootCS, {0_m / second, 0_m / second, -V0});
Line const line(r0, v0);
auto const time = 1000_ns;
StraightTrajectory track(line, time);
......
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