IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Showing
with 370 additions and 199 deletions
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -14,7 +13,6 @@ namespace corsika {
/**
* A model for the energy loss property of a medium.
*
*/
template <typename T>
class MediumPropertyModel : public T {
......@@ -36,7 +34,7 @@ namespace corsika {
* @param point The location to evaluate at.
* @returns The medium type as enum environment::Medium
*/
Medium getMedium(Point const&) const override;
Medium getMedium() const override;
/**
* Set the medium type.
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -20,48 +19,71 @@
namespace corsika {
/** Describes the composition of matter
* Allowes and handles the creation of custom matter compositions
**/
/**
* Describes the composition of matter
* Allowes and handles the creation of custom matter compositions.
*/
class NuclearComposition {
public:
/** Constructor
/**
* Constructor
* The constructore takes a list of elements and a list which describe the relative
* amount. Booth lists need to have the same length and the sum all of fractions
* should be 1. Otherwise an exception is thrown
* @param pComponents List of particle types
* should be 1. Otherwise an exception is thrown.
* Example for air: Composition (N2,O2,Ar) = (78.084, 20.946, 0.934)
* Pfraction(Ar) = Ar/(2*N2 + 2*O2 + Ar) = 0.00469
* {Code::Nitrogen, Code::Oxygen, Code::Argon}, {0.78479, 0.21052, 0.00469}}
*
* @param pComponents List of particle types.
* @param pFractions List of fractions how much each particle contributes. The sum
* needs to add up to 1
**/
* needs to add up to 1.
*/
NuclearComposition(std::vector<Code> const& pComponents,
std::vector<float> const& pFractions);
std::vector<double> const& pFractions);
/**
* Returns a vector of the same length as elements in the material with the weighted
* return of "func". The typical default application is for cross section weighted
* with fraction in the material.
*
* @tparam TFunction Type of functions for the weights. The type should be
* Code -> CrossSectionType.
* @param func Functions for reweighting specific elements.
* @retval returns the vector with weighted return types of func.
*/
template <typename TFunction>
auto getWeighted(TFunction func) const;
/** Sum all all relative composition weighted by func(element)
/**
* Sum all all relative composition weighted by func(element)
* This function sums all relative compositions given during this classes
*construction. Each entry is weighted by the user defined function func given to this
*function.
* construction. Each entry is weighted by the user defined function func given to
* this function.
*
* @tparam TFunction Type of functions for the weights. The type should be
* Code -> float
* @param func Functions for reweighting specific elements
* @retval returns the weighted sum with the type defined by the return type of func
**/
* Code -> double.
* @param func Functions for reweighting specific elements.
* @retval returns the weighted sum with the type defined by the return type of func.
*/
template <typename TFunction>
auto getWeightedSum(TFunction const& func) const;
auto getWeightedSum(TFunction func) const -> decltype(func(std::declval<Code>()));
/** Number of elements in the composition array
* @retval returns the number of elements in the composition array
**/
/**
* Number of elements in the composition array
* @retval returns the number of elements in the composition array.
*/
size_t getSize() const;
//! Returns a const reference to the fraction
std::vector<float> const& getFractions() const;
std::vector<double> const& getFractions() const;
//! Returns a const reference to the fraction
std::vector<Code> const& getComponents() const;
double const getAverageMassNumber() const;
template <class TRNG>
Code sampleTarget(std::vector<CrossSectionType> const& sigma,
TRNG& randomStream) const;
TRNG&& randomStream) const;
// Note: when this class ever modifies its internal data, the hash
// must be updated, too!
......@@ -73,8 +95,8 @@ namespace corsika {
private:
void updateHash();
std::vector<float> const numberFractions_; //!< relative fractions of number density
std::vector<Code> const components_; //!< particle codes of consitutents
std::vector<double> const numberFractions_; //!< relative fractions of number density
std::vector<Code> const components_; //!< particle codes of consitutents
double const avgMassNumber_;
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -54,9 +53,26 @@ namespace corsika {
GrammageType getMinimumX() const;
/**
* Returns the grammage along the shower axis of the projection of a point p
* onto the shower axis.
* Will return either getMinimumX() or getMaximumX() in case the projection is outside
* the shower axis.
*
* @param p Point to project onto the shower axis.
* @retval Grammage along shower axis for projection of point p.
*/
GrammageType getProjectedX(Point const& p) const;
GrammageType getX(LengthType) const;
/**
* Returns the grammage along the shower axis for a given length along the shower
* axis. Will return either getMinimumX() or getMaximumX() in case the length is
* outside the shower axis.
*
* @param l Length along shower axis.
* @retval Grammage along shower axis for length l.
*/
GrammageType getX(LengthType l) const;
DirectionVector const& getDirection() const;
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -13,15 +12,14 @@
#include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/random/RNGManager.hpp>
#include <corsika/media/FlatExponential.hpp>
#include <corsika/media/NuclearComposition.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
namespace corsika {
// clang-format off
/**
* The SlidingPlanarExponential models mass density as
* The SlidingPlanarExponential models mass density as:
* \f[
* \varrho(r) = \varrho_0 \exp\left( \frac{|p_0 - r|}{\lambda} \right).
* \f]
......@@ -38,23 +36,21 @@ namespace corsika {
using Base = BaseExponential<SlidingPlanarExponential<T>>;
public:
SlidingPlanarExponential(Point const& p0, MassDensityType rho0, LengthType lambda,
NuclearComposition const& nuclComp,
LengthType referenceHeight = LengthType::zero());
SlidingPlanarExponential(Point const& p0, MassDensityType const rho0,
LengthType const lambda, NuclearComposition const& nuclComp,
LengthType const referenceHeight = LengthType::zero());
MassDensityType getMassDensity(Point const& point) const override;
NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(setup::Trajectory const& line,
LengthType l) const override;
GrammageType getIntegratedGrammage(BaseTrajectory const& line) const override;
LengthType getArclengthFromGrammage(setup::Trajectory const& line,
GrammageType grammage) const override;
LengthType getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType const grammage) const override;
private:
NuclearComposition const nuclComp_;
LengthType const referenceHeight_;
};
} // namespace corsika
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Line.hpp>
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/BaseTrajectory.hpp>
#include <corsika/media/NuclearComposition.hpp>
#include <corsika/media/BaseTabular.hpp>
namespace corsika {
// clang-format off
/**
* The SlidingPlanarTabular models mass density as
* \f[
* \varrho(r) = \varrho_0 \rho\left( |p_0 - r| \right).
* \f]
* For grammage/length conversion, the density distribution is approximated as
* locally flat at the starting point \f$ r_0 \f$ of the trajectory with the
* axis pointing rom \f$ p_0 \f$ to \f$ r_0 \f$ defining the local height.
*/
// clang-format on
template <typename TDerived>
class SlidingPlanarTabular : public BaseTabular<SlidingPlanarTabular<TDerived>>,
public TDerived {
using Base = BaseTabular<SlidingPlanarTabular<TDerived>>;
public:
SlidingPlanarTabular(Point const& p0,
std::function<MassDensityType(LengthType)> const& rho,
unsigned int const nBins, LengthType const deltaHeight,
NuclearComposition const& nuclComp,
LengthType referenceHeight = LengthType::zero());
MassDensityType getMassDensity(Point const& point) const override;
NuclearComposition const& getNuclearComposition() const override;
GrammageType getIntegratedGrammage(BaseTrajectory const& line) const override;
LengthType getArclengthFromGrammage(BaseTrajectory const& line,
GrammageType grammage) const override;
private:
NuclearComposition const nuclComp_;
};
} // namespace corsika
#include <corsika/detail/media/SlidingPlanarTabular.inl>
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -19,7 +18,6 @@ namespace corsika {
*
* This class returns the same magnetic field vector
* for all evaluated locations.
*
*/
template <typename T>
class UniformMagneticField : public T {
......@@ -31,28 +29,30 @@ namespace corsika {
* This is initialized with a fixed magnetic field
* and returns this magnetic field at all locations.
*
* @param field The fixed magnetic field to return.
* @param field The fixed magnetic field to return.
*/
template <typename... Args>
UniformMagneticField(MagneticFieldVector const& B, Args&&... args)
UniformMagneticField(MagneticFieldVector const& field, Args&&... args)
: T(std::forward<Args>(args)...)
, B_(B) {}
, B_(field) {}
/**
* Evaluate the magnetic field at a given location.
*
* @param point The location to evaluate the field at.
* @param point The location to evaluate the field at (not used internally).
* @returns The magnetic field vector.
*/
MagneticFieldVector getMagneticField(Point const&) const final override { return B_; }
MagneticFieldVector getMagneticField([
[maybe_unused]] Point const& point) const final override {
return B_;
}
/**
* Set the magnetic field returned by this instance.
*
* @param point The location to evaluate the field at.
* @returns The magnetic field vector.
* @param Bfield The new vaue of the global magnetic field.
*/
auto setMagneticField(MagneticFieldVector const& Bfield) -> void { B_ = Bfield; }
void setMagneticField(MagneticFieldVector const& Bfield) { B_ = Bfield; }
private:
MagneticFieldVector B_; ///< The constant magnetic field we use.
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -17,10 +16,9 @@ namespace corsika {
*
* This class returns the same refractive index
* for all evaluated locations.
*
*/
template <typename T>
class UniformRefractiveIndex final : public T {
class UniformRefractiveIndex : public T {
double n_; ///< The constant refractive index that we use.
......@@ -31,26 +29,26 @@ namespace corsika {
* This is initialized with a fixed refractive index
* and returns this refractive index at all locations.
*
* @param field The refractive index to return everywhere.
* @param n The refractive index to return everywhere.
*/
template <typename... Args>
UniformRefractiveIndex(double const n, Args&&... args);
/**
* Evaluate the refractive index at a given location.
* Evaluate the refractive index at a given location. Note: since this
* is *uniform* model, it has no position-dependence.
*
* @param point The location to evaluate at.
* @param point The location to evaluate at (not used internally).
* @returns The refractive index at this point.
*/
double getRefractiveIndex(Point const&) const override;
double getRefractiveIndex(Point const& point) const override;
/**
* Set the refractive index returned by this instance.
*
* @param point The location to evaluate at.
* @returns The refractive index at this location.
* @param n The global refractive index.
*/
void setRefractiveIndex(double const& n);
void setRefractiveIndex(double const n);
}; // END: class RefractiveIndex
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -31,12 +30,13 @@ namespace corsika {
//! convenience function equivalent to Volume::isInside
bool contains(Point const& p) const;
VolumeTreeNode<IModelProperties> const* excludes(Point const& p) const;
VTN_type const* excludes(Point const& p) const;
/** returns a pointer to the sub-VolumeTreeNode which is "responsible" for the given
* \class Point \p p, or nullptr iff \p p is not contained in this volume.
*/
VolumeTreeNode<IModelProperties> const* getContainingNode(Point const& p) const;
VolumeTreeNode<IModelProperties>* getContainingNode(Point const& p);
/**
* Traverses the VolumeTree pre- or post-order and calls the functor \p func for each
......@@ -44,10 +44,15 @@ namespace corsika {
* func is ignored.
*/
template <typename TCallable, bool preorder = true>
void walk(TCallable func);
void walk(TCallable func) const;
void addChild(VTNUPtr pChild);
/**
* Adds a child to the node containing \p using the same logic as getContainingNode
*/
void addChildToContainingNode(Point const& p, VTNUPtr pChild);
void excludeOverlapWith(VTNUPtr const& pNode);
VTN_type const* getParent() const { return parentNode_; };
......
/*
* (c) Copyright 2020 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 <vector>
namespace corsika {
/** Double Iterator
* Iterator that allowes the iteration of two individual lists at the same time. The
*user needs to take care that booth lists have the same length.
* @tparam AConstIterator Iterator Type of the first list
* @tparam BConstIterator Iterator Type of the second list
\todo TODO: replace with
https://www.boost.org/doc/libs/1_74_0/libs/iterator/doc/zip_iterator.html or ranges zip
\todo check resource allocation
**/
template <class AConstIterator, class BConstIterator>
class WeightProviderIterator {
AConstIterator aIter_;
BConstIterator bIter_;
public:
using value_type = double;
using iterator_category = std::input_iterator_tag;
using pointer = value_type*;
using reference = value_type&;
using difference_type = ptrdiff_t;
WeightProviderIterator(AConstIterator a, BConstIterator b);
value_type operator*() const;
WeightProviderIterator& operator++();
bool operator==(WeightProviderIterator other);
bool operator!=(WeightProviderIterator other);
};
} // namespace corsika
#include <corsika/detail/media/WeightProvider.inl>
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/modules/epos/ParticleConversion.hpp>
#include <corsika/modules/epos/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file Epos.hpp
*
* Includes all the parts of the EPOS model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::epos {
/**
* epos::Interaction is the process for ProcessSequence.
*
* The epos::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public InteractionModel, public InteractionProcess<Interaction> {
public:
Interaction(std::set<Code> const& stableList)
: InteractionModel{stableList} {};
};
} // namespace corsika::epos
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/modules/fluka/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file FLUKA.hpp
*
* Includes all the parts of the FLUKA model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::fluka {
/**
* fluka::Interaction is the process for ProcessSequence.
*
* The fluka::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public fluka::InteractionModel,
public corsika::InteractionProcess<Interaction> {
public:
template <typename TEnvironment>
Interaction(TEnvironment const& env)
: fluka::InteractionModel{env} {}
};
} // namespace corsika::fluka
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -55,7 +54,7 @@ namespace corsika {
// Froissart-Martin is not violated up for sqrt s < 10^32 eV with these values [DL].
default_prng_type& RNG_ =
RNGManager::getInstance().getRandomStream("HadronicElasticModel");
RNGManager<>::getInstance().getRandomStream("HadronicElasticModel");
};
} // namespace corsika
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -11,6 +10,9 @@
#include <corsika/media/ShowerAxis.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/core/Step.hpp>
#include <corsika/modules/writers/LongitudinalProfileWriterParquet.hpp>
#include <array>
#include <fstream>
......@@ -31,40 +33,25 @@ namespace corsika {
* simulation into a projected grammage range and counts for
* different particle species when they cross dX (default: 10g/cm2)
* boundaries.
*
**/
*/
class LongitudinalProfile : public ContinuousProcess<LongitudinalProfile> {
template <typename TOutput>
class LongitudinalProfile : public ContinuousProcess<LongitudinalProfile<TOutput>>,
public TOutput {
public:
LongitudinalProfile(ShowerAxis const&,
GrammageType dX = 10_g / square(1_cm)); // profile binning);
template <typename... TArgs>
LongitudinalProfile(TArgs&&... args);
template <typename TParticle, typename TTrack>
ProcessReturn doContinuous(
TParticle const&, TTrack const&,
bool const flagLimit = false); // not needed for LongitudinalProfile
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle> const&, bool);
template <typename TParticle, typename TTrack>
LengthType getMaxStepLength(TParticle const&, TTrack const&) {
return meter * std::numeric_limits<double>::infinity();
}
void save(std::string const&, int const width = 14, int const precision = 6);
private:
GrammageType const dX_;
ShowerAxis const& shower_axis_;
using ProfileEntry = std::array<uint32_t, 6>;
enum ProfileIndex {
Gamma = 0,
Positron = 1,
Electron = 2,
MuPlus = 3,
MuMinus = 4,
Hadron = 5
};
std::vector<ProfileEntry> profiles_; // longitudinal profile
YAML::Node getConfig() const;
};
} // namespace corsika
......
/*
* (c) Copyright 2020 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -11,44 +10,71 @@
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Plane.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/setup/SetupStack.hpp>
#include <corsika/setup/SetupTrajectory.hpp>
#include <corsika/modules/writers/ObservationPlaneWriterParquet.hpp>
#include <corsika/modules/writers/ParticleWriterParquet.hpp>
#include <corsika/modules/writers/WriterOff.hpp>
#include <corsika/framework/core/Step.hpp>
namespace corsika {
/**
* The ObservationPlane writes PDG codes, energies, and distances of particles to the
* central point of the plane into its output file. The particles are considered
* "absorbed" afterwards.
* @ingroup Modules
* @{
*
* The ObservationPlane writes PDG codes, kinetic energies, locations and momentum unit
* vectors of particles with respect to the central point of the plane into its output
* file. By default, the particles are considered "absorbed" afterwards. You can also
* set the ObservationPlane as non-absorbing.
*
* The default output format is parquet.
*
* **Note/Limitation:** as discussed in
* https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/issues/397
* you cannot put two ObservationPlanes exactly on top of each
* other. Even if one of them is "permeable". You have to put a
* small gap in between the two plane in such a scenario, or develop
* another more specialized output class.
*/
template <typename TOutputWriter = ObservationPlaneWriterParquet>
class ObservationPlane : public ContinuousProcess<ObservationPlane<TOutputWriter>>,
public TOutputWriter {
template <typename TTracking, typename TOutput = ParticleWriterParquet>
class ObservationPlane : public ContinuousProcess<ObservationPlane<TTracking, TOutput>>,
public TOutput {
using TOutput::write;
public:
ObservationPlane(Plane const&, DirectionVector const&, bool = true);
/**
* Construct a new Observation Plane object.
*
* @tparam TArgs
* @param plane The plane.
* @param x_dir The x-direction/axis.
* @param absorbing Flag to make the plane absorbing.
* @param outputArgs
*/
template <typename... TArgs>
ObservationPlane(Plane const& plane, DirectionVector const& x_dir,
bool const absorbing = true, TArgs&&... outputArgs);
~ObservationPlane() {}
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle>&, bool const stepLimit);
ProcessReturn doContinuous(corsika::setup::Stack::particle_type& vParticle,
corsika::setup::Trajectory& vTrajectory,
bool const stepLimit);
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory);
LengthType getMaxStepLength(corsika::setup::Stack::particle_type const&,
corsika::setup::Trajectory const& vTrajectory);
Plane getPlane() const { return plane_; }
DirectionVector getXAxis() const { return xAxis_; }
DirectionVector getYAxis() const { return yAxis_; }
void showResults() const;
void reset();
HEPEnergyType getEnergyGround() const { return energy_ground_; }
YAML::Node getConfig() const;
private:
Plane const plane_;
bool const deleteOnHit_;
HEPEnergyType energy_ground_;
unsigned int count_ground_;
DirectionVector const xAxis_;
DirectionVector const yAxis_;
bool const deleteOnHit_;
};
//! @}
} // namespace corsika
#include <corsika/detail/modules/ObservationPlane.inl>
/*
* (c) Copyright 2023 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/modules/writers/ParticleWriterParquet.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/Step.hpp>
namespace corsika {
/**
@ingroup Modules
@{
The ObservationVolume writes PDG codes, kinetic energy, position, and direction
of particles in the observation frame into its output file. The particles
are considered "absorbed" afterwards.
*/
template <typename TTracking, typename TVolume,
typename TOutputWriter = ParticleWriterParquet>
class ObservationVolume
: public ContinuousProcess<ObservationVolume<TTracking, TVolume, TOutputWriter>>,
public TOutputWriter {
public:
ObservationVolume(TVolume vol);
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle>&, bool const stepLimit);
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory);
void showResults() const;
void reset();
HEPEnergyType getEnergy() const { return energy_; }
YAML::Node getConfig() const;
private:
TVolume vol_;
HEPEnergyType energy_;
unsigned int count_;
};
//! @}
} // namespace corsika
#include <corsika/detail/modules/ObservationVolume.inl>
/*
* (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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/process/SecondariesProcess.hpp>
#include <corsika/setup/SetupStack.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
namespace corsika {
......