IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 0093a324 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

implemented TrackWriter

parent 8616e037
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,10 @@ namespace corsika::geometry { ...@@ -43,6 +43,10 @@ namespace corsika::geometry {
assert(t >= 0 * corsika::units::si::second); assert(t >= 0 * corsika::units::si::second);
return T::ArcLength(0, t); return T::ArcLength(0, t);
} }
void LimitEndTo(corsika::units::si::LengthType limit) {
fTimeLength = T::TimeFromArclength(limit);
}
}; };
} // namespace corsika::geometry } // namespace corsika::geometry
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
add_subdirectory (NullModel) add_subdirectory (NullModel)
add_subdirectory (Sibyll) add_subdirectory (Sibyll)
add_subdirectory (StackInspector) add_subdirectory (StackInspector)
add_subdirectory (TrackWriter)
add_subdirectory (TrackingLine) add_subdirectory (TrackingLine)
#add_custom_target(CORSIKAprocesses) #add_custom_target(CORSIKAprocesses)
......
set (
MODEL_SOURCES
TrackWriter.cc
)
set (
MODEL_HEADERS
TrackWriter.h
)
set (
MODEL_NAMESPACE
corsika/process/track_writer
)
add_library (ProcessTrackWriter STATIC ${MODEL_SOURCES})
CORSIKA_COPY_HEADERS_TO_NAMESPACE (ProcessTrackWriter ${MODEL_NAMESPACE} ${MODEL_HEADERS})
set_target_properties (
ProcessTrackWriter
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
# PUBLIC_HEADER "${MODEL_HEADERS}"
)
# target dependencies on other libraries (also the header onlys)
target_link_libraries (
ProcessTrackWriter
CORSIKAunits
CORSIKAparticles
CORSIKAgeometry
CORSIKAsetup
)
target_include_directories (
ProcessTrackWriter
INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/include>
)
install (
TARGETS ProcessTrackWriter
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
# PUBLIC_HEADER DESTINATION include/${MODEL_NAMESPACE}
)
# --------------------
# code unit testing
#add_executable (testNullModel testNullModel.cc)
#target_link_libraries (
# testNullModel ProcessNullModel
# CORSIKAsetup
# CORSIKAgeometry
# CORSIKAunits
# CORSIKAthirdparty # for catch2
# )
#add_test (NAME testNullModel COMMAND testNullModel)
/**
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* 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/process/track_writer/TrackWriter.h>
void corsika::process::TrackWriter::TrackWriter::Init() { fFile.open(fFilename); }
/**
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* 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.
*/
#ifndef _Processes_TrackWriter_h_
#define _Processes_TrackWriter_h_
#include <corsika/particles/ParticleProperties.h>
#include <corsika/process/ContinuousProcess.h>
#include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h>
#include <fstream>
#include <limits>
#include <string>
namespace corsika::process::TrackWriter {
class TrackWriter : public corsika::process::ContinuousProcess<TrackWriter> {
public:
TrackWriter(std::string const& filename)
: fFilename(filename) {}
void Init();
template <typename Particle, typename Track, typename Stack>
corsika::process::EProcessReturn DoContinuous(Particle& p, Track& t, Stack&) const {
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());
std::cerr << name << " " << start[0] / 1_m << ' ' << start[1] / 1_m << ' '
<< start[2] / 1_m << " " << delta[0] / 1_m << ' ' << delta[1] / 1_m
<< ' ' << delta[2] / 1_m << '\n';
return corsika::process::EProcessReturn::eOk;
}
template <typename Particle, typename Track>
corsika::units::si::LengthType MaxStepLength(Particle&, Track&) const {
return corsika::units::si::meter * std::numeric_limits<double>::infinity();
}
private:
std::string const fFilename;
std::ofstream fFile;
};
} // namespace corsika::process::TrackWriter
#endif
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