IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Pranav Sampathkumar
corsika
Commits
d36ec1ca
"README.md" did not exist on "a23a0a9b24143d106dd91363c06a9dd2cfa69da5"
Commit
d36ec1ca
authored
5 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
infinite interaction length for non-hadrons
parent
a6cc4fda
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Processes/UrQMD/UrQMD.cc
+29
-7
29 additions, 7 deletions
Processes/UrQMD/UrQMD.cc
Processes/UrQMD/UrQMD.h
+4
-2
4 additions, 2 deletions
Processes/UrQMD/UrQMD.h
Processes/UrQMD/testUrQMD.cc
+6
-8
6 additions, 8 deletions
Processes/UrQMD/testUrQMD.cc
with
39 additions
and
17 deletions
Processes/UrQMD/UrQMD.cc
+
29
−
7
View file @
d36ec1ca
...
...
@@ -7,6 +7,7 @@
#include
<corsika/setup/SetupTrajectory.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<algorithm>
#include
<functional>
#include
<iostream>
#include
<random>
...
...
@@ -23,10 +24,8 @@ using SetupTrack = corsika::setup::Trajectory;
template
<
typename
TParticle
>
// need template here, as this is called both with
// SetupParticle as well as SetupProjectile
CrossSectionType
UrQMD
::
GetCrossSection
(
TParticle
const
&
vProjectile
,
corsika
::
particles
::
Code
vTargetCode
)
const
{
CrossSectionType
UrQMD
::
GetCrossSection
(
TParticle
const
&
vProjectile
,
corsika
::
particles
::
Code
vTargetCode
)
const
{
using
namespace
units
::
si
;
// TODO: energy cuts, return 0 for non-hadrons
...
...
@@ -39,9 +38,10 @@ template <typename TParticle> // need template here, as this is called both with
!
IsNucleus
(
vTargetCode
))
{
// both particles are "special"
auto
const
mProj
=
particles
::
GetMass
(
projectileCode
);
auto
const
mTar
=
particles
::
GetMass
(
vTargetCode
);
double
sqrtS
=
sqrt
(
units
::
si
::
detail
::
static_pow
<
2
>
(
mProj
)
+
units
::
si
::
detail
::
static_pow
<
2
>
(
mTar
)
+
2
*
projectileEnergyLab
*
mTar
)
*
(
1
/
1
_GeV
);
double
sqrtS
=
sqrt
(
units
::
si
::
detail
::
static_pow
<
2
>
(
mProj
)
+
units
::
si
::
detail
::
static_pow
<
2
>
(
mTar
)
+
2
*
projectileEnergyLab
*
mTar
)
*
(
1
/
1
_GeV
);
// we must set some UrQMD globals first...
auto
const
[
ityp
,
iso3
]
=
ConvertToUrQMD
(
projectileCode
);
...
...
@@ -66,7 +66,29 @@ template <typename TParticle> // need template here, as this is called both with
}
}
bool
UrQMD
::
CanInteract
(
particles
::
Code
vCode
)
const
{
// According to the manual, UrQMD can use all mesons, baryons and nucleons
// which are modeled also as input particles. I think it is safer to accept
// only the usual long-lived species as input.
// TODO: Charmed mesons should be added to the list, too
static
particles
::
Code
const
validProjectileCodes
[]
=
{
particles
::
Code
::
Nucleus
,
particles
::
Code
::
Proton
,
particles
::
Code
::
AntiProton
,
particles
::
Code
::
Neutron
,
particles
::
Code
::
AntiNeutron
,
particles
::
Code
::
PiPlus
,
particles
::
Code
::
PiMinus
,
particles
::
Code
::
KPlus
,
particles
::
Code
::
KMinus
,
particles
::
Code
::
K0
,
particles
::
Code
::
K0Bar
};
return
std
::
find
(
std
::
cbegin
(
validProjectileCodes
),
std
::
cend
(
validProjectileCodes
),
vCode
)
!=
std
::
cend
(
validProjectileCodes
);
}
GrammageType
UrQMD
::
GetInteractionLength
(
SetupParticle
&
vParticle
,
SetupTrack
&
)
const
{
if
(
!
CanInteract
(
vParticle
.
GetPID
()))
{
// we could do the canInteract check in GetCrossSection, too but if
// we do it here we have the advantage of avoiding the loop
return
std
::
numeric_limits
<
double
>::
infinity
()
*
1
_g
/
(
1
_cm
*
1
_cm
);
}
auto
const
&
mediumComposition
=
vParticle
.
GetNode
()
->
GetModelProperties
().
GetNuclearComposition
();
using
namespace
std
::
placeholders
;
...
...
This diff is collapsed.
Click to expand it.
Processes/UrQMD/UrQMD.h
+
4
−
2
View file @
d36ec1ca
...
...
@@ -19,12 +19,14 @@ namespace corsika::process::UrQMD {
corsika
::
setup
::
Stack
::
StackIterator
&
,
corsika
::
setup
::
Trajectory
&
)
const
;
template
<
typename
TParticle
>
corsika
::
units
::
si
::
CrossSectionType
GetCrossSection
(
TParticle
const
&
,
corsika
::
particles
::
Code
)
const
;
corsika
::
units
::
si
::
CrossSectionType
GetCrossSection
(
TParticle
const
&
,
corsika
::
particles
::
Code
)
const
;
corsika
::
process
::
EProcessReturn
DoInteraction
(
corsika
::
setup
::
StackView
::
StackIterator
&
);
bool
CanInteract
(
particles
::
Code
)
const
;
private:
corsika
::
random
::
RNG
&
fRNG
=
corsika
::
random
::
RNGManager
::
GetInstance
().
GetRandomStream
(
"UrQMD"
);
...
...
This diff is collapsed.
Click to expand it.
Processes/UrQMD/testUrQMD.cc
+
6
−
8
View file @
d36ec1ca
...
...
@@ -42,10 +42,8 @@ using namespace corsika::units::si;
template
<
typename
TStackView
>
auto
sumCharge
(
TStackView
const
&
view
)
{
int
totalCharge
=
0
;
for
(
auto
const
&
p
:
view
)
{
totalCharge
+=
particles
::
GetChargeNumber
(
p
.
GetPID
());
}
for
(
auto
const
&
p
:
view
)
{
totalCharge
+=
particles
::
GetChargeNumber
(
p
.
GetPID
());
}
return
totalCharge
;
}
...
...
@@ -165,7 +163,7 @@ TEST_CASE("UrQMD") {
auto
[
stackPtr
,
secViewPtr
]
=
setupStack
(
A
,
Z
,
400
_GeV
,
nodePtr
,
*
csPtr
);
// must be assigned to variable, cannot be used as rvalue?!
auto
projectile
=
secViewPtr
->
GetProjectile
();
auto
projectile
=
secViewPtr
->
GetProjectile
();
[[
maybe_unused
]]
process
::
EProcessReturn
const
ret
=
urqmd
.
DoInteraction
(
projectile
);
REQUIRE
(
sumCharge
(
*
secViewPtr
)
==
...
...
@@ -175,14 +173,14 @@ TEST_CASE("UrQMD") {
SECTION
(
"
\"
special
\"
projectile"
)
{
auto
[
env
,
csPtr
,
nodePtr
]
=
setupEnvironment
(
particles
::
Code
::
Oxygen
);
auto
[
stackPtr
,
secViewPtr
]
=
setupStack
(
particles
::
Code
::
PiPlus
,
400
_GeV
,
nodePtr
,
*
csPtr
);
setupStack
(
particles
::
Code
::
K0
,
400
_GeV
,
nodePtr
,
*
csPtr
);
// must be assigned to variable, cannot be used as rvalue?!
auto
projectile
=
secViewPtr
->
GetProjectile
();
auto
projectile
=
secViewPtr
->
GetProjectile
();
[[
maybe_unused
]]
process
::
EProcessReturn
const
ret
=
urqmd
.
DoInteraction
(
projectile
);
REQUIRE
(
sumCharge
(
*
secViewPtr
)
==
particles
::
GetChargeNumber
(
particles
::
Code
::
PiPlus
)
+
particles
::
GetChargeNumber
(
particles
::
Code
::
K0
)
+
particles
::
GetChargeNumber
(
particles
::
Code
::
Oxygen
));
}
}
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