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
a4f8f2c5
"Processes/Pythia/Interaction.h" did not exist on "186b10e5b16c1285b08edb8fcec503d893f8967c"
Commit
a4f8f2c5
authored
4 years ago
by
Remy Prechelt
Browse files
Options
Downloads
Patches
Plain Diff
Move writer implementation into inline file.
parent
f4237457
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/modules/writers/ObservationPlaneWriterParquet.inl
+54
-0
54 additions, 0 deletions
.../detail/modules/writers/ObservationPlaneWriterParquet.inl
corsika/modules/writers/ObservationPlaneWriterParquet.hpp
+10
-38
10 additions, 38 deletions
corsika/modules/writers/ObservationPlaneWriterParquet.hpp
with
64 additions
and
38 deletions
corsika/detail/modules/writers/ObservationPlaneWriterParquet.inl
0 → 100644
+
54
−
0
View file @
a4f8f2c5
/*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
namespace
corsika
{
ObservationPlaneWriterParquet
::
ObservationPlaneWriterParquet
()
:
ParquetStreamer
(){};
void
ObservationPlaneWriterParquet
::
startOfLibrary
(
std
::
filesystem
::
path
const
&
directory
)
{
// setup the streamer
initStreamer
((
directory
/
"particles.parquet"
).
string
());
// build the schema
addField
(
"pdg"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
INT32
,
parquet
::
ConvertedType
::
INT_32
);
addField
(
"energy"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"x"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"y"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"radius"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
// and build the streamer
buildStreamer
();
}
void
ObservationPlaneWriterParquet
::
endOfShower
()
{
++
shower_
;
}
void
ObservationPlaneWriterParquet
::
endOfLibrary
()
{
closeStreamer
();
}
void
ObservationPlaneWriterParquet
::
write
(
Code
const
&
pid
,
units
::
si
::
HEPEnergyType
const
&
energy
,
units
::
si
::
LengthType
const
&
x
,
units
::
si
::
LengthType
const
&
y
,
units
::
si
::
LengthType
const
&
radius
)
{
using
namespace
units
::
si
;
// write the next row - we must write `shower_` first.
(
*
writer_
)
_
<<
shower_
<<
static_cast
<
int
>
(
get_PDG
(
pid
))
<<
energy
/
1
_eV
<<
x
/
1
_m
<<
y
/
1
_m
<<
radius
/
1
_m
<<
parquet
::
EndRow
;
}
}
// namespace corsika
This diff is collapsed.
Click to expand it.
corsika/modules/writers/ObservationPlaneWriterParquet.hpp
+
10
−
38
View file @
a4f8f2c5
...
...
@@ -23,48 +23,25 @@ namespace corsika {
*
* @param name The name of this output.
*/
ObservationPlaneWriterParquet
()
:
ParquetStreamer
(){};
ObservationPlaneWriterParquet
();
/**
* Called at the start of each
run
.
* Called at the start of each
library
.
*/
void
startOfRun
(
std
::
filesystem
::
path
const
&
directory
)
final
override
{
// setup the streamer
initStreamer
((
directory
/
"particles.parquet"
).
string
());
// build the schema
addField
(
"pdg"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
INT32
,
parquet
::
ConvertedType
::
INT_32
);
addField
(
"energy"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"x"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"y"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
addField
(
"radius"
,
parquet
::
Repetition
::
REQUIRED
,
parquet
::
Type
::
DOUBLE
,
parquet
::
ConvertedType
::
NONE
);
// and build the streamer
buildStreamer
();
}
void
startOfLibrary
(
std
::
filesystem
::
path
const
&
directory
)
final
override
;
/**
* Called at the end of each
event/
shower.
* Called at the end of each shower.
*/
void
endOf
Event
()
final
override
{
++
event_
;
}
void
endOf
Shower
()
final
override
;
/**
* Called at the end of each
run
.
* Called at the end of each
library
.
*
* This must also increment the run number since we override
* the default behaviour of BaseOutput.
*/
void
endOfRun
()
final
override
{
closeStreamer
();
++
run_
;
}
void
endOfLibrary
()
final
override
;
protected:
/**
...
...
@@ -72,15 +49,10 @@ namespace corsika {
*/
void
write
(
Code
const
&
pid
,
units
::
si
::
HEPEnergyType
const
&
energy
,
units
::
si
::
LengthType
const
&
x
,
units
::
si
::
LengthType
const
&
y
,
units
::
si
::
LengthType
const
&
radius
)
{
using
namespace
units
::
si
;
// write the next row
// NOTE: we must write run_ and then event_ first
(
*
writer_
)
<<
run_
<<
event_
<<
static_cast
<
int
>
(
get_PDG
(
pid
))
<<
energy
/
1
_eV
<<
x
/
1
_m
<<
y
/
1
_m
<<
radius
/
1
_m
<<
parquet
::
EndRow
;
}
units
::
si
::
LengthType
const
&
radius
);
};
// class ObservationPlaneWriterParquet
}
// namespace corsika
#include
<corsika/details/modules/writers/ObservationPlaneWriterParquet.inl>
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