IAP GITLAB

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

coverage

parent b70f4a4f
No related branches found
No related tags found
1 merge request!371Additional outputs ported to new architecture
......@@ -23,13 +23,12 @@
namespace corsika {
template <typename TOutputE, typename TOutputN>
// template <typename... TArgs1, typename... TArgs2>
inline CONEXhybrid<TOutputE, TOutputN>::CONEXhybrid(
Point const& center, ShowerAxis const& showerAxis, LengthType groundDist,
LengthType injectionHeight, HEPEnergyType primaryEnergy, PDGCode primaryPDG,
TOutputE& args1, TOutputN& args2)
: SubWriter<TOutputE>(args1) //(std::forward<TArgs1>(args1)...)
, SubWriter<TOutputN>(args2) // std::forward<TArgs2>(args2)...)
: SubWriter<TOutputE>(args1)
, SubWriter<TOutputN>(args2)
, center_{center}
, showerAxis_{showerAxis}
, groundDist_{groundDist}
......@@ -154,7 +153,7 @@ namespace corsika {
template <typename TOutputE, typename TOutputN>
inline bool CONEXhybrid<TOutputE, TOutputN>::addParticle(
Code pid, HEPEnergyType energy, HEPEnergyType mass, Point const& position,
DirectionVector const& direction, TimeType t) {
DirectionVector const& direction, TimeType t, double weight) {
auto const it = std::find_if(egs_em_codes_.cbegin(), egs_em_codes_.cend(),
[=](auto const& p) { return pid == p.first; });
......@@ -189,9 +188,6 @@ namespace corsika {
double const v = direction.dot(x_sf_).magnitude();
double const w = direction.dot(showerAxis_.getDirection()).magnitude();
double const weight =
1; // particle.getWeight(); // NEEDS TO BE CHANGED WHEN WE HAVE WEIGHTS!
// generation, TO BE CHANGED WHEN WE HAVE THAT INFORMATION AVAILABLE
int const latchin = 1;
......@@ -282,6 +278,7 @@ namespace corsika {
for (int i = 0; i < nX; ++i) {
GrammageType curX = X[i] * 1_g / square(1_cm);
SubWriter<TOutputE>::write(curX, curX + dX,
Code::Unknown, // this is sum of all dEdX
dEdX[i] * 1_GeV / 1_g * square(1_cm) * dX);
SubWriter<TOutputN>::write(curX, curX + dX, Code::Photon, Photon[i]);
SubWriter<TOutputN>::write(curX, curX + dX, Code::Proton, Hadrons[i]);
......
......@@ -119,7 +119,7 @@ namespace corsika {
}
template <typename TOutput>
inline void EnergyLossWriter<TOutput>::write(Point const& point, Code const PID,
inline void EnergyLossWriter<TOutput>::write(Point const& point, Code const,
HEPEnergyType const dE) {
GrammageType grammage = showerAxis_.getProjectedX(point);
int const maxBin = int(profile_.size() - 1);
......@@ -135,7 +135,7 @@ namespace corsika {
template <typename TOutput>
inline void EnergyLossWriter<TOutput>::write(GrammageType const Xstart,
GrammageType const Xend,
GrammageType const Xend, Code const,
HEPEnergyType const dE) {
double const bstart = Xstart / dX_;
double const bend = Xend / dX_;
......
......@@ -95,7 +95,7 @@ namespace corsika {
*/
bool addParticle(Code pid, HEPEnergyType energy, HEPEnergyType mass,
Point const& position, Vector<dimensionless_d> const& direction,
TimeType t);
TimeType t, double weight = 1);
CoordinateSystemPtr const& getObserverCS() const { return conexObservationCS_; }
......
......@@ -139,7 +139,7 @@ namespace corsika {
/**
* Add binned energy loss.
*/
void write(GrammageType const Xstart, GrammageType const Xend,
void write(GrammageType const Xstart, GrammageType const Xend, Code const PID,
HEPEnergyType const dE);
/**
......
......@@ -22,6 +22,7 @@ set (test_framework_sources
testInteractionCounter.cpp
testInteractionLengthModifier.cpp
testSolver.cpp
testEnergyMomentum.cpp
)
CORSIKA_ADD_TEST (testFramework SOURCES ${test_framework_sources})
......
......@@ -5,6 +5,8 @@ set (test_output_sources
testParquetStreamer.cpp
testWriterObservationPlane.cpp
testWriterTracks.cpp
testWriterEnergyLoss.cpp
testWriterLongitudinal.cpp
)
CORSIKA_ADD_TEST (testOutput SOURCES ${test_output_sources})
......
......@@ -24,7 +24,6 @@ struct DummyNoOutput : public NoOutput {
NoOutput::endOfShower(0);
NoOutput::endOfLibrary();
}
YAML::Node getConfig() const final override { return YAML::Node(); }
void checkWrite() { NoOutput::write(Code::Unknown, 1_eV, 1_m, 1_m, 1_ns); }
};
......@@ -37,8 +36,11 @@ struct DummyOutput : public BaseOutput {
void startOfLibrary(boost::filesystem::path const&) override { startLibrary_ = true; }
YAML::Node getConfig() const final override { return YAML::Node(); }
void startOfShower(unsigned int const shower = 0) override {
BaseOutput::startOfShower(shower);
setInit(true);
startShower_ = true;
}
......@@ -46,8 +48,6 @@ struct DummyOutput : public BaseOutput {
void endOfLibrary() override { endLibrary_ = true; }
YAML::Node getConfig() const final override { return YAML::Node(); }
YAML::Node getSummary() const final override {
YAML::Node summary;
summary["test"] = "test";
......@@ -82,7 +82,9 @@ TEST_CASE("OutputManager") {
CHECK(test.startLibrary_);
test.startLibrary_ = false;
CHECK_FALSE(test.isInit());
output.startOfShower();
CHECK(test.isInit());
CHECK(test.startShower_);
test.startShower_ = false;
......@@ -156,5 +158,7 @@ TEST_CASE("OutputManager") {
nothing.check();
nothing.checkWrite();
nothing.getConfig();
nothing.getSummary();
}
}
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