IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Air Shower Physics
corsika
Commits
a15c879a
Commit
a15c879a
authored
4 years ago
by
Maximilian Sackel
Committed by
Ralf Ulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
change template class to RAII templatize constuctor
parent
70467c15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!245
Include proposal process rebase
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Processes/Proposal/Interaction.cc
+22
-18
22 additions, 18 deletions
Processes/Proposal/Interaction.cc
Processes/Proposal/Interaction.h
+3
-9
3 additions, 9 deletions
Processes/Proposal/Interaction.h
with
25 additions
and
27 deletions
Processes/Proposal/Interaction.cc
+
22
−
18
View file @
a15c879a
...
@@ -22,26 +22,27 @@ namespace corsika::process::proposal {
...
@@ -22,26 +22,27 @@ namespace corsika::process::proposal {
using
namespace
corsika
::
units
::
si
;
using
namespace
corsika
::
units
::
si
;
template
<
>
template
<
>
std
::
unordered_map
<
particles
::
Code
,
PROPOSAL
::
ParticleDef
>
std
::
unordered_map
<
particles
::
Code
,
PROPOSAL
::
ParticleDef
>
Interaction
::
particles
{
Interaction
<
SetupEnvironment
>::
particles
{
{
particles
::
Code
::
Gamma
,
PROPOSAL
::
GammaDef
()},
{
particles
::
Code
::
Gamma
,
PROPOSAL
::
GammaDef
()},
{
particles
::
Code
::
Electron
,
PROPOSAL
::
EMinusDef
()},
{
particles
::
Code
::
Electron
,
PROPOSAL
::
EMinusDef
()},
{
particles
::
Code
::
Positron
,
PROPOSAL
::
EPlusDef
()},
{
particles
::
Code
::
Positron
,
PROPOSAL
::
EPlusDef
()},
{
particles
::
Code
::
MuMinus
,
PROPOSAL
::
MuMinusDef
()},
{
particles
::
Code
::
MuMinus
,
PROPOSAL
::
MuMinusDef
()},
{
particles
::
Code
::
MuPlus
,
PROPOSAL
::
MuPlusDef
()},
{
particles
::
Code
::
MuPlus
,
PROPOSAL
::
MuPlusDef
()},
{
particles
::
Code
::
TauPlus
,
PROPOSAL
::
TauPlusDef
()},
{
particles
::
Code
::
TauPlus
,
PROPOSAL
::
TauPlusDef
()},
{
particles
::
Code
::
TauMinus
,
PROPOSAL
::
TauMinusDef
()},
{
particles
::
Code
::
TauMinus
,
PROPOSAL
::
TauMinusDef
()},
};
};
bool
Interaction
::
CanInteract
(
particles
::
Code
pcode
)
const
noexcept
{
auto
search
=
particles
.
find
(
pcode
);
if
(
search
!=
particles
.
end
())
return
true
;
return
false
;
};
template
<
>
template
<
>
Interaction
<
SetupEnvironment
>::
Interaction
(
SetupEnvironment
const
&
env
,
Interaction
::
Interaction
(
SetupEnvironment
const
&
env
,
CORSIKA_ParticleCut
const
&
e_cut
)
CORSIKA_ParticleCut
const
&
e_cut
)
:
fEnvironment
(
env
)
:
fEnvironment
(
env
)
,
cut
(
make_shared
<
const
PROPOSAL
::
EnergyCutSettings
>
(
e_cut
.
GetCutEnergy
()
/
1
_GeV
,
,
cut
(
make_shared
<
const
PROPOSAL
::
EnergyCutSettings
>
(
e_cut
.
GetCutEnergy
()
/
1
_GeV
,
1
,
false
))
{}
1
,
false
))
{
template
<
>
void
Interaction
<
SetupEnvironment
>::
Init
()
{
auto
all_compositions
=
std
::
vector
<
NuclearComposition
>
();
auto
all_compositions
=
std
::
vector
<
NuclearComposition
>
();
fEnvironment
.
GetUniverse
()
->
walk
([
&
](
auto
&
vtn
)
{
fEnvironment
.
GetUniverse
()
->
walk
([
&
](
auto
&
vtn
)
{
if
(
vtn
.
HasModelProperties
())
if
(
vtn
.
HasModelProperties
())
...
@@ -62,9 +63,12 @@ namespace corsika::process::proposal {
...
@@ -62,9 +63,12 @@ namespace corsika::process::proposal {
}
}
}
}
template
<
>
void
Interaction
::
Init
()
{}
template
<
>
template
<
>
template
<
>
template
<
>
corsika
::
process
::
EProcessReturn
Interaction
<
SetupEnvironment
>
::
DoInteraction
(
corsika
::
process
::
EProcessReturn
Interaction
::
DoInteraction
(
setup
::
StackView
::
StackIterator
&
vP
)
{
setup
::
StackView
::
StackIterator
&
vP
)
{
if
(
CanInteract
(
vP
.
GetPID
()))
{
if
(
CanInteract
(
vP
.
GetPID
()))
{
auto
calc
=
GetCalculator
(
vP
);
// [CrossSections]
auto
calc
=
GetCalculator
(
vP
);
// [CrossSections]
...
@@ -107,7 +111,7 @@ namespace corsika::process::proposal {
...
@@ -107,7 +111,7 @@ namespace corsika::process::proposal {
template
<
>
template
<
>
template
<
>
template
<
>
corsika
::
units
::
si
::
GrammageType
Interaction
<
SetupEnvironment
>
::
GetInteractionLength
(
corsika
::
units
::
si
::
GrammageType
Interaction
::
GetInteractionLength
(
setup
::
Stack
::
StackIterator
&
vP
)
{
setup
::
Stack
::
StackIterator
&
vP
)
{
if
(
CanInteract
(
vP
.
GetPID
()))
{
if
(
CanInteract
(
vP
.
GetPID
()))
{
auto
calc
=
GetCalculator
(
vP
);
// [CrossSections]
auto
calc
=
GetCalculator
(
vP
);
// [CrossSections]
...
...
This diff is collapsed.
Click to expand it.
Processes/Proposal/Interaction.h
+
3
−
9
View file @
a15c879a
...
@@ -27,12 +27,9 @@ using CORSIKA_ParticleCut = corsika::process::particle_cut::ParticleCut;
...
@@ -27,12 +27,9 @@ using CORSIKA_ParticleCut = corsika::process::particle_cut::ParticleCut;
namespace
corsika
::
process
::
proposal
{
namespace
corsika
::
process
::
proposal
{
template
<
class
TEnvironment
>
class
Interaction
:
public
corsika
::
process
::
InteractionProcess
<
Interaction
>
{
class
Interaction
:
public
corsika
::
process
::
InteractionProcess
<
Interaction
<
TEnvironment
>>
{
private:
private:
TEnvironment
const
&
fEnvironment
;
shared_ptr
<
const
PROPOSAL
::
EnergyCutSettings
>
cut
;
shared_ptr
<
const
PROPOSAL
::
EnergyCutSettings
>
cut
;
static
std
::
unordered_map
<
particles
::
Code
,
PROPOSAL
::
ParticleDef
>
particles
;
static
std
::
unordered_map
<
particles
::
Code
,
PROPOSAL
::
ParticleDef
>
particles
;
...
@@ -41,11 +38,7 @@ namespace corsika::process::proposal {
...
@@ -41,11 +38,7 @@ namespace corsika::process::proposal {
corsika
::
random
::
RNG
&
fRNG
=
corsika
::
random
::
RNG
&
fRNG
=
corsika
::
random
::
RNGManager
::
GetInstance
().
GetRandomStream
(
"p_rndm"
);
corsika
::
random
::
RNGManager
::
GetInstance
().
GetRandomStream
(
"p_rndm"
);
bool
CanInteract
(
particles
::
Code
pcode
)
const
noexcept
{
bool
CanInteract
(
particles
::
Code
pcode
)
const
noexcept
;
auto
search
=
particles
.
find
(
pcode
);
if
(
search
!=
particles
.
end
())
return
true
;
return
false
;
};
using
calculator_t
=
using
calculator_t
=
tuple
<
PROPOSAL
::
SecondariesCalculator
,
unique_ptr
<
PROPOSAL
::
Interaction
>
,
tuple
<
PROPOSAL
::
SecondariesCalculator
,
unique_ptr
<
PROPOSAL
::
Interaction
>
,
...
@@ -70,6 +63,7 @@ namespace corsika::process::proposal {
...
@@ -70,6 +63,7 @@ namespace corsika::process::proposal {
}
}
public
:
public
:
template
<
typename
TEnvironment
>
Interaction
(
TEnvironment
const
&
env
,
CORSIKA_ParticleCut
const
&
cut
);
Interaction
(
TEnvironment
const
&
env
,
CORSIKA_ParticleCut
const
&
cut
);
void
Init
();
void
Init
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment