CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
DummyStack.hpp
1 /*
2  * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
13 #include <corsika/framework/geometry/PhysicalGeometry.hpp>
15 
16 #include <string>
17 #include <tuple>
18 
19 namespace corsika::dummy_stack {
20 
30  struct NoData { /* nothing */
31  int nothing = 0;
32  };
33 
34  template <typename StackIteratorInterface>
35  struct ParticleInterface : public corsika::ParticleBase<StackIteratorInterface> {
36 
38 
39  public:
40  void setParticleData(const std::tuple<NoData>& /*v*/) {}
41  void setParticleData(super_type& /*parent*/, const std::tuple<NoData>& /*v*/) {}
42 
43  std::string asString() const { return "dummy-data"; }
44 
45  // unfortunately we need those dummy getter
46  // for some more complex tests with "history"
47  HEPEnergyType getEnergy() const { return 0_GeV; }
48  MomentumVector getMomentum() const {
49  return MomentumVector(get_root_CoordinateSystem(), {0_GeV, 0_GeV, 0_GeV});
50  }
51  Code getPID() const { return Code::Unknown; }
52  };
53 
60 
61  public:
62  DummyStackImpl() = default;
63 
64  DummyStackImpl(DummyStackImpl const&) = default;
65 
66  DummyStackImpl(DummyStackImpl&&) = default;
67 
68  DummyStackImpl& operator=(DummyStackImpl const&) = default;
69  DummyStackImpl& operator=(DummyStackImpl&&) = default;
70 
71  void init() { entries_ = 0; }
72 
73  void clear() { entries_ = 0; }
74 
75  int getSize() const { return entries_; }
76  int getCapacity() const { return entries_; }
77 
81  void copy(const int /*i1*/, const int /*i2*/) {}
82 
83  void swap(const int, const int) {}
84 
85  void incrementSize() { entries_++; }
86  void decrementSize() { entries_--; }
87 
88  int getEntries() const { return entries_; }
89  void setEntries(int entries = 0) { entries_ = entries; }
90 
91  private:
92  int entries_ = 0;
93 
94  }; // end class DummyStackImpl
95 
97 
98 } // namespace corsika::dummy_stack
Import and extend the phys::units package.
Memory implementation of the most simple (no-data) particle stack object.
Definition: DummyStack.hpp:59
void copy(const int, const int)
Function to copy particle at location i2 in stack to i1.
Definition: DummyStack.hpp:81
The Stack class provides (and connects) the main particle data storage machinery. ...
Definition: Stack.hpp:77
Vector< hepmomentum_d > MomentumVector
A 3D vector defined in a specific coordinate system with units HEPMomentumType.
CoordinateSystemPtr const & get_root_CoordinateSystem()
this is the only way to create ONE unique root CS
Example of a particle object on the stack, with NO DATA.
Definition: DummyStack.hpp:30
Description of particle stacks.
Interface to particle properties.
The base class to define the readout of particle properties from a particle stack.