Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mcpl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
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
cinema-developers
Mcpl
Commits
97bfb436
Commit
97bfb436
authored
8 years ago
by
Thomas Kittelmann
Browse files
Options
Downloads
Patches
Plain Diff
import from dgcode mercurial: version 0.7.0
parent
f1386589
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
VERSION
+1
-0
1 addition, 0 deletions
VERSION
examples/rawexample_filtermcpl.c
+48
-0
48 additions, 0 deletions
examples/rawexample_filtermcpl.c
src/mcxtrace/README
+9
-0
9 additions, 0 deletions
src/mcxtrace/README
with
58 additions
and
0 deletions
VERSION
0 → 100644
+
1
−
0
View file @
97bfb436
0.7.0
This diff is collapsed.
Click to expand it.
examples/rawexample_filtermcpl.c
0 → 100644
+
48
−
0
View file @
97bfb436
///////////////////////////////////////////////////////////////////////////////////
// //
// A small standalone example of how to one might extract a subset of particles //
// from an existing MCPL file in order to create a new smaller file. //
// //
// This file can be freely used as per the terms in the LICENSE file. //
// //
// Written 2015-2016 by Thomas.Kittelmann@esss.se //
// //
///////////////////////////////////////////////////////////////////////////////////
#include
"mcpl.h"
#include
<stdio.h>
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
3
)
{
printf
(
"Please supply input and output filenames
\n
"
);
return
1
;
}
const
char
*
infilename
=
argv
[
1
];
const
char
*
outfilename
=
argv
[
2
];
// Initialisation, open existing file and create output file handle. Transfer
// all meta-data from existing file, and add an extra comment in the output
// file to document the process:
mcpl_file_t
fi
=
mcpl_open_file
(
infilename
);
mcpl_outfile_t
fo
=
mcpl_create_outfile
(
outfilename
);
mcpl_transfer_metadata
(
fi
,
fo
);
mcpl_hdr_add_comment
(
fo
,
"Applied custom filter to select neutrons with ekin<100eV"
);
//Loop over particles from input, only triggering mcpl_add_particle calls for
//the chosen particles:
const
mcpl_particle_t
*
particle
;
while
(
(
particle
=
mcpl_read
(
fi
)
)
)
{
if
(
particle
->
pdgcode
==
2112
&&
particle
->
ekin
<
0
.
1
)
mcpl_add_particle
(
fo
,
particle
);
}
//Close up files:
mcpl_closeandgzip_outfile
(
fo
);
mcpl_close_file
(
fi
);
}
This diff is collapsed.
Click to expand it.
src/mcxtrace/README
0 → 100644
+
9
−
0
View file @
97bfb436
From McXtrace version 1.3, MCPL plugins are shipped as part of the McXtrace
Component distribution. Please refer to the following McXtrace instrument files
in the examples/ directory of that distribution for demonstrations of how to
enable the relevant components:
examples/Test_MCPL_input.instr
examples/Test_MCPL_output.instr
Further instructions are also available at https://mctools.github.io/mcpl/.
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