CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
WeightStackExtension.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 
14 #include <tuple>
15 #include <utility>
16 #include <vector>
17 
18 namespace corsika::weights {
19 
32  template <typename TParentStack>
33  struct WeightDataInterface : public TParentStack {
34 
35  typedef TParentStack super_type;
36 
37  public:
38  // default version for particle-creation from input data
39  void setParticleData(std::tuple<double> const v);
40  void setParticleData(WeightDataInterface const& parent, std::tuple<double> const);
41  void setParticleData();
42  void setParticleData(WeightDataInterface const& parent);
43 
44  std::string asString() const;
45 
46  void setWeight(double const v);
47 
48  double getWeight() const;
49  };
50 
51  // definition of stack-data object to store geometry information
52 
58  class WeightData {
59 
60  public:
61  typedef std::vector<double> weight_vector_type;
62 
63  WeightData() = default;
64  WeightData(WeightData const&) = default;
65  WeightData(WeightData&&) = default;
66  WeightData& operator=(WeightData const&) = default;
67  WeightData& operator=(WeightData&&) = default;
68 
69  // these functions are needed for the Stack interface
70  void clear();
71 
72  unsigned int getSize() const;
73 
74  unsigned int getCapacity() const;
75 
76  void copy(int const i1, int const i2);
77 
78  void swap(int const i1, int const i2);
79 
80  // custom data access function
81  void setWeight(int const i, double const v);
82 
83  double getWeight(int const i) const;
84 
85  // these functions are also needed by the Stack interface
86  void incrementSize();
87 
88  void decrementSize();
89 
90  // custom private data section
91  private:
92  weight_vector_type weight_vector_;
93  };
94 
95  template <typename TParentStack>
98  };
99 
100 } // namespace corsika::weights
101 
102 #include <corsika/detail/stack/WeightStackExtension.inl>
Describe "particle weights" on a Stack.
CORSIKA8 logging utilities.
Description of particle stacks.
definition of stack-data object to store geometry information.