12 #include <corsika/framework/geometry/RootCoordinateSystem.hpp> 13 #include <corsika/framework/geometry/Vector.hpp> 15 #include <corsika/modules/sophia/ParticleConversion.hpp> 28 void clear() { so_plist_.np = 0; }
29 unsigned int getSize()
const {
return so_plist_.np; }
30 unsigned int getCapacity()
const {
return 2000; }
32 void setId(
const unsigned int i,
const int v) { so_plist_.llist[i] = v; }
34 so_plist_.p[3][i] = v / 1_GeV;
36 void setMass(
const unsigned int i,
const HEPMassType v) {
37 so_plist_.p[4][i] = v / 1_GeV;
39 void setMomentum(
const unsigned int i,
const MomentumVector& v) {
41 for (
int idx = 0; idx < 3; ++idx) so_plist_.p[idx][i] = tmp[idx] / 1_GeV;
44 int getId(
const unsigned int i)
const {
return so_plist_.llist[i]; }
45 HEPEnergyType getEnergy(
const int i)
const {
return so_plist_.p[3][i] * 1_GeV; }
47 return so_plist_.p[4][i] * 1_GeV;
50 MomentumVector getMomentum(
const unsigned int i,
53 so_plist_.p[1][i] * 1_GeV,
54 so_plist_.p[2][i] * 1_GeV};
58 void copy(
const unsigned int i1,
const unsigned int i2) {
59 so_plist_.llist[i2] = so_plist_.llist[i1];
60 for (
unsigned int i = 0; i < 5; ++i) so_plist_.p[i][i2] = so_plist_.p[i][i1];
63 void swap(
const unsigned int i1,
const unsigned int i2) {
64 std::swap(so_plist_.llist[i1], so_plist_.llist[i2]);
65 for (
unsigned int i = 0; i < 5; ++i)
66 std::swap(so_plist_.p[i][i1], so_plist_.p[i][i2]);
69 void incrementSize() { so_plist_.np++; }
70 void decrementSize() {
71 if (so_plist_.np > 0) { so_plist_.np--; }
75 template <
typename TStackIterator>
82 void setParticleData(
const int vID,
const HEPEnergyType vE,
const MomentumVector& vP,
99 void setEnergy(
const HEPEnergyType v) { getStackData().setEnergy(getIndex(), v); }
101 HEPEnergyType getEnergy()
const {
return getStackData().getEnergy(getIndex()); }
103 bool hasDecayed()
const {
return abs(getStackData().getId(getIndex())) > 100; }
105 void setMass(
const HEPMassType v) { getStackData().setMass(getIndex(), v); }
107 HEPEnergyType getMass()
const {
return getStackData().getMass(getIndex()); }
109 void setPID(
const int v) { getStackData().setId(getIndex(), v); }
111 corsika::sophia::SophiaCode getPID()
const {
112 return static_cast<corsika::sophia::SophiaCode
>(getStackData().getId(getIndex()));
116 return getStackData().getMomentum(getIndex(), CS);
119 void setMomentum(
const MomentumVector& v) {
120 getStackData().setMomentum(getIndex(), v);
quantity< D, X > constexpr abs(quantity< D, X > const &x)
absolute value.
Import and extend the phys::units package.
The Stack class provides (and connects) the main particle data storage machinery. ...
Vector< hepmomentum_d > MomentumVector
A 3D vector defined in a specific coordinate system with units HEPMomentumType.
Description of particle stacks.
std::shared_ptr< CoordinateSystem const > CoordinateSystemPtr
To refer to CoordinateSystems, only the CoordinateSystemPtr must be used.
The base class to define the readout of particle properties from a particle stack.
QuantityVector< TDimension > const & getComponents() const