CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
Event.hpp
1
/*
2
* (c) Copyright 2020 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
11
#include <
corsika/framework/core/Logging.hpp
>
12
#include <
corsika/framework/core/ParticleProperties.hpp
>
13
#include <corsika/stack/history/EventType.hpp>
14
#include <corsika/stack/history/SecondaryParticle.hpp>
15
16
#include <memory>
17
#include <optional>
18
#include <vector>
19
20
namespace
corsika::history
{
21
22
class
Event;
23
using
EventPtr = std::shared_ptr<history::Event>;
24
25
class
Event
{
26
27
size_t
projectile_index_ = 0;
28
std::vector<SecondaryParticle> secondaries_;
29
EventPtr parent_event_;
30
31
EventType type_ = EventType::Uninitialized;
32
33
std::optional<Code> targetCode_;
34
35
public
:
36
Event
() =
default
;
37
38
void
setParentEvent(EventPtr
const
& evt) { parent_event_ = evt; }
39
40
bool
hasParentEvent()
const
{
return
bool(parent_event_); }
41
EventPtr& parentEvent() {
return
parent_event_; }
42
EventPtr
const
& parentEvent()
const
{
return
parent_event_; }
43
44
void
setProjectileIndex(
size_t
i) { projectile_index_ = i; }
45
size_t
projectileIndex()
const
{
return
projectile_index_; }
46
47
size_t
addSecondary(
HEPEnergyType
energy,
Vector<hepmomentum_d>
const
& momentum,
48
Code pid) {
49
secondaries_.emplace_back(energy, momentum, pid);
50
return
secondaries_.size() - 1;
51
}
52
53
std::vector<SecondaryParticle>
const
& secondaries()
const
{
return
secondaries_; }
54
55
void
setTargetCode(
const
Code t) { targetCode_ = t; }
56
57
std::string as_string()
const
{
58
return
fmt::format(
"hasParent={}, projIndex={}, Nsec={}"
, hasParentEvent(),
59
projectile_index_, secondaries_.size());
60
}
61
62
EventType eventType()
const
{
return
type_; }
63
64
void
setEventType(EventType t) { type_ = t; }
65
};
66
67
}
// namespace corsika::history
corsika::history
Definition:
HistoryObservationPlane.hpp:13
Logging.hpp
CORSIKA8 logging utilities.
phys::units::quantity< phys::units::hepenergy_d, double >
corsika::history::Event
mix-in class for SecondaryView that fills secondaries into an
Definition:
Event.hpp:25
corsika::Vector
Definition:
CoordinateSystem.hpp:29
ParticleProperties.hpp
Interface to particle properties.
corsika
stack
history
Event.hpp
Generated by
1.8.13