27 template <
typename TEvent>
30 std::shared_ptr<TEvent>;
31 using ParentEventIndex = int;
32 using DataType = std::pair<EventPtr, ParentEventIndex>;
36 void clear() { historyData_.clear(); }
37 unsigned int getSize()
const {
return historyData_.size(); }
38 unsigned int getCapacity()
const {
return historyData_.size(); }
39 void copy(
const int i1,
const int i2) { historyData_[i2] = historyData_[i1]; }
40 void swap(
const int i1,
const int i2) {
41 std::swap(historyData_[i1], historyData_[i2]);
45 void setEvent(
const int i, EventPtr v) { historyData_[i].first = std::move(v); }
46 const EventPtr& getEvent(
const int i)
const {
return historyData_[i].first; }
47 EventPtr& getEvent(
const int i) {
return historyData_[i].first; }
49 void setParentEventIndex(
const int i, ParentEventIndex v) {
50 historyData_[i].second = std::move(v);
52 ParentEventIndex getParentEventIndex(
const int i)
const {
53 return historyData_[i].second;
57 void incrementSize() { historyData_.push_back(DataType{}); }
58 void decrementSize() {
59 if (historyData_.size() > 0) { historyData_.pop_back(); }
64 std::vector<DataType> historyData_;
73 template <
typename T,
typename TEvent>
77 using T::getStackData;
84 void setParticleData() {
85 CORSIKA_LOG_TRACE(
"HistoyDatatInterface::setParticleData()");
86 getStackData().setParentEventIndex(getIndex(), -1);
91 CORSIKA_LOG_TRACE(
"HistoyDatatInterface::setParticleData(parnt)");
95 void setEvent(
const std::shared_ptr<TEvent>& v) {
96 getStackData().setEvent(getIndex(), v);
99 void setParentEventIndex(
int index) {
100 getStackData().setParentEventIndex(getIndex(), index);
103 std::shared_ptr<TEvent> getEvent()
const {
104 return getStackData().getEvent(getIndex());
107 int getParentEventIndex()
const {
108 return getStackData().getParentEventIndex(getIndex());
111 std::string asString()
const {
112 return fmt::format(
"i_parent={}, [evt: {}]", getParentEventIndex(),
113 (
bool(getEvent()) ? getEvent()->as_string() :
"n/a"));
117 template <
typename T,
typename TEvent>
127 #include <corsika/stack/history/Event.hpp> 131 template <
typename TStackIter>
132 using HistoryEventDataInterface =
corresponding definition of a stack-readout object, the iteractor dereference operator will deliver a...
definition of stack-data object to store history information this is vector with shared_ptr<TEvent>, where TEvent is a free template parameter for customization.
CORSIKA8 logging utilities.
Description of particle stacks.