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
516c6324
Commit
516c6324
authored
6 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
added position/momentum/time to super-stupid-stack
parent
0eb5e670
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Stack/SuperStupidStack/CMakeLists.txt
+1
-0
1 addition, 0 deletions
Stack/SuperStupidStack/CMakeLists.txt
Stack/SuperStupidStack/SuperStupidStack.h
+53
-13
53 additions, 13 deletions
Stack/SuperStupidStack/SuperStupidStack.h
with
54 additions
and
13 deletions
Stack/SuperStupidStack/CMakeLists.txt
+
1
−
0
View file @
516c6324
...
@@ -12,6 +12,7 @@ target_link_libraries (
...
@@ -12,6 +12,7 @@ target_link_libraries (
CORSIKAstackinterface
CORSIKAstackinterface
CORSIKAunits
CORSIKAunits
CORSIKAparticles
CORSIKAparticles
CORSIKAgeometry
)
)
target_include_directories
(
target_include_directories
(
...
...
This diff is collapsed.
Click to expand it.
Stack/SuperStupidStack/SuperStupidStack.h
+
53
−
13
View file @
516c6324
...
@@ -16,7 +16,12 @@
...
@@ -16,7 +16,12 @@
#include
<corsika/stack/Stack.h>
#include
<corsika/stack/Stack.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<corsika/geometry/CoordinateSystem.h>
// remove
#include
<corsika/geometry/Point.h>
#include
<corsika/geometry/Vector.h>
#include
<vector>
#include
<vector>
#include
<algorithm>
namespace
corsika
::
stack
{
namespace
corsika
::
stack
{
...
@@ -24,8 +29,16 @@ namespace corsika::stack {
...
@@ -24,8 +29,16 @@ namespace corsika::stack {
using
corsika
::
particles
::
Code
;
using
corsika
::
particles
::
Code
;
using
corsika
::
units
::
si
::
EnergyType
;
using
corsika
::
units
::
si
::
EnergyType
;
using
corsika
::
units
::
si
::
operator
""
_GeV
;
// literals;
using
corsika
::
units
::
si
::
TimeType
;
using
corsika
::
units
::
si
::
second
;
using
corsika
::
units
::
si
::
meter
;
using
corsika
::
units
::
si
::
joule
;
using
corsika
::
units
::
si
::
energy_d
;
using
corsika
::
geometry
::
Point
;
using
corsika
::
geometry
::
Vector
;
typedef
Vector
<
energy_d
>
MomentumVector
;
/**
/**
* Example of a particle object on the stack.
* Example of a particle object on the stack.
*/
*/
...
@@ -39,9 +52,15 @@ namespace corsika::stack {
...
@@ -39,9 +52,15 @@ namespace corsika::stack {
public:
public:
void
SetPID
(
const
Code
id
)
{
GetStackData
().
SetPID
(
GetIndex
(),
id
);
}
void
SetPID
(
const
Code
id
)
{
GetStackData
().
SetPID
(
GetIndex
(),
id
);
}
void
SetEnergy
(
const
EnergyType
&
e
)
{
GetStackData
().
SetEnergy
(
GetIndex
(),
e
);
}
void
SetEnergy
(
const
EnergyType
&
e
)
{
GetStackData
().
SetEnergy
(
GetIndex
(),
e
);
}
void
SetMomentum
(
const
MomentumVector
&
v
)
{
GetStackData
().
SetMomentum
(
GetIndex
(),
v
);
}
void
SetPosition
(
const
Point
&
v
)
{
GetStackData
().
SetPosition
(
GetIndex
(),
v
);
}
void
SetTime
(
const
TimeType
&
v
)
{
GetStackData
().
SetTime
(
GetIndex
(),
v
);
}
Code
GetPID
()
const
{
return
GetStackData
().
GetPID
(
GetIndex
());
}
Code
GetPID
()
const
{
return
GetStackData
().
GetPID
(
GetIndex
());
}
EnergyType
GetEnergy
()
const
{
return
GetStackData
().
GetEnergy
(
GetIndex
());
}
EnergyType
GetEnergy
()
const
{
return
GetStackData
().
GetEnergy
(
GetIndex
());
}
MomentumVector
GetMomentum
()
const
{
return
GetStackData
().
GetMomentum
(
GetIndex
());
}
Point
GetPosition
()
const
{
return
GetStackData
().
GetPosition
(
GetIndex
());
}
TimeType
GetTime
()
const
{
return
GetStackData
().
GetTime
(
GetIndex
());
}
};
};
/**
/**
...
@@ -61,42 +80,60 @@ namespace corsika::stack {
...
@@ -61,42 +80,60 @@ namespace corsika::stack {
int
GetSize
()
const
{
return
fDataPID
.
size
();
}
int
GetSize
()
const
{
return
fDataPID
.
size
();
}
int
GetCapacity
()
const
{
return
fDataPID
.
size
();
}
int
GetCapacity
()
const
{
return
fDataPID
.
size
();
}
void
SetPID
(
const
int
i
,
const
Code
id
)
{
fDataPID
[
i
]
=
id
;
}
void
SetPID
(
const
int
i
,
const
Code
id
)
{
fDataPID
[
i
]
=
id
;
}
void
SetEnergy
(
const
int
i
,
const
EnergyType
e
)
{
fDataE
[
i
]
=
e
;
}
void
SetEnergy
(
const
int
i
,
const
EnergyType
e
)
{
fDataE
[
i
]
=
e
;
}
void
SetMomentum
(
const
int
i
,
const
MomentumVector
&
v
)
{
fMomentum
[
i
]
=
v
;
}
void
SetPosition
(
const
int
i
,
const
Point
&
v
)
{
fPosition
[
i
]
=
v
;
}
void
SetTime
(
const
int
i
,
const
TimeType
&
v
)
{
fTime
[
i
]
=
v
;
}
Code
GetPID
(
const
int
i
)
const
{
return
fDataPID
[
i
];
}
Code
GetPID
(
const
int
i
)
const
{
return
fDataPID
[
i
];
}
EnergyType
GetEnergy
(
const
int
i
)
const
{
return
fDataE
[
i
];
}
EnergyType
GetEnergy
(
const
int
i
)
const
{
return
fDataE
[
i
];
}
MomentumVector
GetMomentum
(
const
int
i
)
{
return
fMomentum
[
i
];
}
Point
GetPosition
(
const
int
i
)
{
return
fPosition
[
i
];
}
TimeType
GetTime
(
const
int
i
)
{
return
fTime
[
i
];
}
/**
/**
* Function to copy particle at location i2 in stack to i1
* Function to copy particle at location i2 in stack to i1
*/
*/
void
Copy
(
const
int
i1
,
const
int
i2
)
{
void
Copy
(
const
int
i1
,
const
int
i2
)
{
fDataE
[
i2
]
=
fDataE
[
i1
];
fDataPID
[
i2
]
=
fDataPID
[
i1
];
fDataPID
[
i2
]
=
fDataPID
[
i1
];
fDataE
[
i2
]
=
fDataE
[
i1
];
fMomentum
[
i2
]
=
fMomentum
[
i1
];
fPosition
[
i2
]
=
fPosition
[
i1
];
fTime
[
i2
]
=
fTime
[
i1
];
}
}
/**
/**
* Function to copy particle at location i2 in stack to i1
* Function to copy particle at location i2 in stack to i1
*/
*/
void
Swap
(
const
int
i1
,
const
int
i2
)
{
void
Swap
(
const
int
i1
,
const
int
i2
)
{
EnergyType
tE
=
fDataE
[
i2
];
std
::
swap
(
fDataPID
[
i2
],
fDataPID
[
i1
]);
Code
tC
=
fDataPID
[
i2
];
std
::
swap
(
fDataE
[
i2
],
fDataE
[
i1
]);
fDataE
[
i2
]
=
fDataE
[
i1
];
std
::
swap
(
fMomentum
[
i2
],
fMomentum
[
i1
]);
// should be Momentum !!!!
fDataPID
[
i2
]
=
fDataPID
[
i1
];
std
::
swap
(
fPosition
[
i2
],
fPosition
[
i1
]);
fDataE
[
i1
]
=
tE
;
std
::
swap
(
fTime
[
i2
],
fTime
[
i1
]);
fDataPID
[
i1
]
=
tC
;
}
}
protected
:
protected
:
void
IncrementSize
()
{
void
IncrementSize
()
{
fDataE
.
push_back
(
0
_GeV
);
fDataPID
.
push_back
(
Code
::
Unknown
);
fDataPID
.
push_back
(
Code
::
Unknown
);
fDataE
.
push_back
(
0
*
joule
);
#warning this here makes no sense: see issue #48
auto
const
dummyCS
=
corsika
::
geometry
::
CoordinateSystem
::
CreateRootCS
();
fMomentum
.
push_back
(
MomentumVector
(
dummyCS
,
{
0
*
joule
,
0
*
joule
,
0
*
joule
}));
fPosition
.
push_back
(
Point
(
dummyCS
,
{
0
*
meter
,
0
*
meter
,
0
*
meter
}));
fTime
.
push_back
(
0
*
second
);
}
}
void
DecrementSize
()
{
void
DecrementSize
()
{
if
(
fDataE
.
size
()
>
0
)
{
if
(
fDataE
.
size
()
>
0
)
{
fDataPID
.
pop_back
();
fDataE
.
pop_back
();
fDataE
.
pop_back
();
fDataPID
.
pop_back
();
fMomentum
.
pop_back
();
fPosition
.
pop_back
();
fTime
.
pop_back
();
}
}
}
}
...
@@ -105,6 +142,9 @@ namespace corsika::stack {
...
@@ -105,6 +142,9 @@ namespace corsika::stack {
std
::
vector
<
Code
>
fDataPID
;
std
::
vector
<
Code
>
fDataPID
;
std
::
vector
<
EnergyType
>
fDataE
;
std
::
vector
<
EnergyType
>
fDataE
;
std
::
vector
<
Vector
<
corsika
::
units
::
si
::
energy_d
>>
fMomentum
;
// should be Momentum !!!!
std
::
vector
<
Point
>
fPosition
;
std
::
vector
<
TimeType
>
fTime
;
};
// end class SuperStupidStackImpl
};
// end class SuperStupidStackImpl
...
...
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