CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
HistorySecondaryProducer.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
11
#include <corsika/framework/stack/SecondaryView.hpp>
12
#include <corsika/stack/history/Event.hpp>
13
14
#include <
corsika/framework/core/Logging.hpp
>
15
16
#include <boost/type_index.hpp>
17
18
#include <memory>
19
#include <type_traits>
20
#include <utility>
21
22
namespace
corsika::history
{
23
25
template
<
class
T1,
template
<
class
>
class
T2>
26
class
HistorySecondaryProducer {
27
public
:
28
EventPtr event_;
29
static
bool
constexpr has_event{
true
};
30
31
public
:
32
template
<
typename
Particle>
33
HistorySecondaryProducer(Particle
const
& p)
34
: event_{std::make_shared<Event>()} {
35
CORSIKA_LOG_TRACE(
"HistorySecondaryProducer::HistorySecondaryProducer"
);
36
event_->setProjectileIndex(p.getIndex());
37
event_->setParentEvent(p.getEvent());
38
}
39
47
template
<
typename
Particle>
48
auto
new_secondary
(Particle& sec) {
49
CORSIKA_LOG_TRACE(
"HistorySecondaryProducer::new_secondary(sec)"
);
50
51
// store particles at production time in Event here
52
auto
const
sec_index =
53
event_->addSecondary(sec.getEnergy(), sec.getMomentum(), sec.getPID());
54
sec.setParentEventIndex(sec_index);
55
sec.setEvent(event_);
56
}
57
};
58
59
}
// namespace corsika::history
corsika::history
Definition:
HistoryObservationPlane.hpp:13
Logging.hpp
CORSIKA8 logging utilities.
corsika::history::HistorySecondaryProducer::new_secondary
auto new_secondary(Particle &sec)
Method is called after a new Secondary has been created on the SecondaryView.
Definition:
HistorySecondaryProducer.hpp:48
corsika
stack
history
HistorySecondaryProducer.hpp
Generated by
1.8.13