Skip to content
Snippets Groups Projects
Commit 4d3420b4 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 2204 additions and 0 deletions
---
Language: Cpp
BasedOnStyle: Chromium
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
!*.png
*.prim
*/*.eps
*/*/*.eps
*/*/*.png
*/*/*.pdf
*.root
build/*
.DAWN*
*/*.pyc
**.pyc
image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:latest
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_PIPELINE_SOURCE == "webide"'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_TAG'
default:
before_script:
- mkdir -p images && mkdir -p doc/
- git clone https://eicweb.phy.anl.gov/EIC/detectors/accelerator.git && ln -s accelerator/eic
- mkdir build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install && cd ..
artifacts:
paths:
- images/
- doc/
reports:
dotenv: juggler.env
stages:
- config
- build
- docs
- test
- finalize
- deploy
env:
stage: config
script:
- export JUGGLER_DETECTOR="topside"
- |
if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" || "$CI_COMMIT_BRANCH" == "master" ]]; then
export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}"
echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
echo "JUGGLER_DETECTOR_VERSION = ${CI_COMMIT_REF_NAME}"
echo "JUGGLER_DETECTOR_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env
echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
fi
artifacts:
reports:
dotenv: juggler.env
compile:
stage: build
needs:
- ["env"]
script:
- echo "Build successful."
.views:
stage: docs
needs:
- ["compile"]
artifacts:
paths:
- images/
- doc/
include:
- local: 'views/view1.yml'
- local: 'views/view2.yml'
- local: 'views/view3.yml'
- local: 'views/view6.yml'
- local: 'views/view7.yml'
- local: 'views/config.yml'
report:
stage: finalize
needs:
- view_01
- dawn_view_02:detector
- dawn_view_03:detector
artifacts:
paths:
- images/
- doc/
script:
- pip3 install jinja2 && ls -lrth
- ./bin/make_images > doc/dawn_views.md
overlap_check:
stage: test
needs:
- ["compile"]
script:
- checkOverlaps -c topside.xml | tee doc/overlap_check.out
- echo "$(cat doc/overlap_check.out | grep ovlp | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check.out | grep ovlp | wc -l)" -gt "1" ]] ; then echo "Overlaps exist!" && false ; fi
topside:config_testing:
stage: test
needs:
- ["compile"]
script:
- checkOverlaps -c topside.xml | tee doc/overlap_check.out | wc -l
- cat doc/overlap_check.out
allow_failure: true
benchmarks:reconstruction:
stage: deploy
variables:
JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
trigger:
project: EIC/benchmarks/reconstruction_benchmarks
strategy: depend
needs: ["env","overlap_check","report"]
benchmarks:physics:
stage: deploy
variables:
JUGGLER_DETECTOR: "$JUGGLER_DETECTOR"
JUGGLER_DETECTOR_VERSION: "$JUGGLER_DETECTOR_VERSION"
trigger:
project: EIC/benchmarks/physics_benchmarks
strategy: depend
needs: ["env","overlap_check","report"]
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
#set(CMAKE_PREFIX_PATH $ENV{HOME}/lib CMAKE_PREFIX_PATH)
#find_package(Acts REQUIRED COMPONENTS Core IdentificationPlugin TGeoPlugin DD4hepPlugin PATHS /home/whit/lib/cmake NO_DEFAULT_PATH)
find_package(Acts REQUIRED COMPONENTS Core PluginIdentification PluginTGeo PluginDD4hep )
#-----------------------------------------------------------------------------------
set(a_lib_name topside2)
dd4hep_configure_output()
#dd4hep_package (${a_lib_name} MAJOR 0 MINOR 0 PATCH 1
# USES [ROOT REQUIRED COMPONENTS Geom GenVector]
# [DD4hep REQUIRED COMPONENTS DDCore DDRec]
# OPTIONAL XERCESC
# INCLUDE_DIRS include
# )
dd4hep_add_plugin(${a_lib_name} SOURCES src/*.cpp
USES ActsCore ActsPluginDD4hep
)
target_link_libraries(${a_lib_name}
PUBLIC DD4hep::DDCore DD4hep::DDRec
)
#-----------------------------------------------------------------------------------
install(DIRECTORY compact/
DESTINATION share/${PROJECT_NAME}/${a_lib_name}
FILES_MATCHING PATTERN "*.xml"
)
#!/bin/bash
set -o nounset
set -o errexit
PROXY_PROFILE=$USER
PROXY_PORT=8020
SSH_HOST="sodium"
function print_the_help {
echo "USAGE: ${0} [-p <PROXY_PORT>] [-n <PROFILE_NAME>] [-s SSH_HOST] "
echo " OPTIONS: "
echo " -s,--host ssh host. Default: sodium"
echo " -p,--port Proxy port number. Default: 8020"
echo " -n,--profile Profile name to use. Sets profile directory to ~/.proxy-profiles/PROFILE_NAME"
echo " "
echo " EXAMPLE: "
echo " ${0} -p 8920 -n sodium sodium "
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
exit
;;
-p|--port)
PROXY_PORT="$2"
shift # past argument
shift # past value
;;
-n|--profile)
PROXY_PROFILE="$2"
shift # past argument
shift # past value
;;
-s|--host)
SSH_HOST="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
exit
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
#yes_or_no "Upload these plots to logbook HALOG? " && some_command
echo " "
echo "ssh -n -D ${PROXY_PORT} ${SSH_HOST}"
echo " "
ssh -n -D ${PROXY_PORT} ${SSH_HOST} &
chromium-browser \
--user-data-dir="$HOME/.proxy-profiles/${PROXY_PROFILE}" \
--proxy-server="socks5://localhost:${PROXY_PORT}" &> /dev/null &
echo " "
echo "You are now tunneling all traffic through proxy ${SSH_HOST} on port ${PROXY_PORT}"
echo " "
#!/bin/bash
#git clone --depth 1 https://eicweb.phy.anl.gov/EIC/datasets.git
export DAWN_PS_PREVIEWER="ls"
OUT_FILE=".DAWN_1.history"
function print_the_help {
echo "USAGE: ${0} [-s <skip_events>] -d <dawn_run_dir> "
echo " OPTIONS: "
echo " -x targeted x coordinate position"
echo " -y targeted x coordinate position"
echo " -z targeted x coordinate position"
echo " --theta viewing angle"
echo " --phi viewing angle"
echo " -m,--mag magnification"
echo " -d,--dawn-dir <dawn_run_dir> Directory with the .DAWN files and a generate script "
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
SKIP_EVENTS=0
DETECTOR_ONLY=0
FILE_TAG="view"
DAWN_RUN_DIR="."
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-x)
echo "updating x coordinate to ${2}"
sed -i '5d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '5i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-y)
echo "updating y coordinate to ${2}"
sed -i '6d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '6i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-z)
echo "updating z coordinate to ${2}"
sed -i '7d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '7i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--theta)
echo "updating theta angle to ${2}"
sed -i '3d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '3i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--phi)
echo "updating phi angle to ${2}"
sed -i '2d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '2i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--mag)
echo "updating magnification to ${2}"
sed -i '8d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '8i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
-i|--input)
OUT_FILE="$2"
shift # past argument
shift # past value
;;
-o|--ouput-dir)
OUTPUT_DIR="$2"
shift # past argument
shift # past value
;;
-D|--detector-only)
DETECTOR_ONLY=1
shift # past argument
#shift # past value
;;
-d|--dawn-dir)
DAWN_RUN_DIR=$2
shift # past argument
shift # past value
;;
-t|--tag)
FILE_TAG=$2
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
#!/bin/bash
#git clone --depth 1 https://eicweb.phy.anl.gov/EIC/datasets.git
export DAWN_PS_PREVIEWER="ls "
export G4DAWNFILE_VIEWER="ls -lrth "
export G4DAWNFILE_PS_VIEWER="ls "
function print_the_help {
echo "USAGE: ${0} [-s <skip_events>] -d <dawn_run_dir> "
echo " OPTIONS: "
echo " -D,--detector-only Only generate the prim files for the detector geometry."
echo " -s,--skip <skip_events> Required run number"
echo " -i,--input <input_file> Input hepmc file"
echo " -d,--dawn-dir <dawn_run_dir> Directory with the .DAWN files and a generate script "
echo " -t,--tag <file_tag> Output file tag"
exit
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo "No entered" ; return 1 ;;
esac
done
}
if [[ $# -eq 0 ]] ; then
print_the_help
exit
fi
SKIP_EVENTS=0
DETECTOR_ONLY=0
FILE_TAG="view"
DAWN_RUN_DIR="scripts/view1"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-s|--skip)
SKIP_EVENTS="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
-o|--ouput-dir)
OUTPUT_DIR="$2"
shift # past argument
shift # past value
;;
-D|--detector-only)
DETECTOR_ONLY=1
shift # past argument
#shift # past value
;;
-d|--dawn-dir)
DAWN_RUN_DIR=$2
shift # past argument
shift # past value
;;
-t|--tag)
FILE_TAG=$2
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
rm -f *.prim
if [ "${DETECTOR_ONLY}" -eq "1" ] ; then
./scripts/run_topside.py -i scripts/input_data/few_events.hepmc \
-o derp.root -n 1 \
--ui csh --vis -b -m macro/dawn_picture.mac &
sleep 10
echo "sleeping 20 secs .. "
sleep 10
echo "sleeping 10 secs "
sleep 5
echo "sleeping 5 secs "
sleep 5
kill %1
else
echo " Running simulation for tracks"
./scripts/run_topside.py -i scripts/input_data/few_events.hepmc \
-o derp.root -s ${SKIP_EVENTS} -n 1 \
--ui csh --vis -b -m macro/dawn_picture2.mac &
sleep 40
kill %1
fi
#./scripts/run_topside.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 2 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
#./scripts/run_topside.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 5 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
#
#./scripts/run_topside.py -i scripts/input_data/few_events.hepmc \
# -o derp.root -s 6 -n 1 \
# --ui csh --vis -b -m macro/dawn_picture2.mac &
#
#sleep 20
#kill %1
[[ -f "g4_0000.prim" ]] || exit -1
echo "simulating done"
#npsim --runType vis \
# -v WARNING \
# --macroFile macro/dawn_picture.mac \
# --numberOfEvents 1 \
# --compactFile topside.xml \
# --inputFiles scripts/input_data/few_events.hepmc \
# --outputFile derp.root \
# --dumpSteeringFile >> derp.out
ls -lrth
mkdir -p images
#mkdir -p images/prim
pushd ${DAWN_RUN_DIR}
if [ "${DETECTOR_ONLY}" -eq "1" ] ; then
./generate_eps -t ${FILE_TAG} -i ../../g4_0000.prim
else
./generate_eps -t ${FILE_TAG} -i ../../g4_0000.prim
fi
ls -lrth
cp *.pdf ../../images/.
cp *.png ../../images/.
#cp *.prim ../../images/prim/.
popd
#./generate_eps -t view1_ev2 -i ../../g4_0002.prim
#./generate_eps -t view1_ev3 -i ../../g4_0003.prim
#./generate_eps -t view1_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#
#pushd scripts/view2
#./generate_eps -t view2 -i ../../g4_0000.prim
##./generate_eps -t view2_ev1 -i ../../g4_0001.prim
##./generate_eps -t view2_ev2 -i ../../g4_0002.prim
##./generate_eps -t view2_ev3 -i ../../g4_0003.prim
##./generate_eps -t view2_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view3
#./generate_eps ../../g4_0000.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view4
#./generate_eps ../../g4_0000.prim
#cp *.eps ../../images/.
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view5
#./generate_eps ../../g4_0000.prim
#cp *.eps ../../images/.
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view6
#./generate_eps -t view6 -i ../../g4_0000.prim
##./generate_eps -t view6_ev1 -i ../../g4_0001.prim
##./generate_eps -t view6_ev2 -i ../../g4_0002.prim
##./generate_eps -t view6_ev3 -i ../../g4_0003.prim
##./generate_eps -t view6_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view7
#./generate_eps -t view7 -i ../../g4_0000.prim
##./generate_eps -t view7_ev1 -i ../../g4_0001.prim
##./generate_eps -t view7_ev2 -i ../../g4_0002.prim
##./generate_eps -t view7_ev3 -i ../../g4_0003.prim
##./generate_eps -t view7_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view11
#./generate_eps -t view11 -i ../../g4_0000.prim
#./generate_eps -t view11_ev1 -i ../../g4_0001.prim
##./generate_eps -t view11_ev2 -i ../../g4_0002.prim
##./generate_eps -t view11_ev3 -i ../../g4_0003.prim
##./generate_eps -t view11_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view12
#./generate_eps -t view12 -i ../../g4_0000.prim
#./generate_eps -t view12_ev1 -i ../../g4_0001.prim
#./generate_eps -t view12_ev2 -i ../../g4_0002.prim
##./generate_eps -t view12_ev3 -i ../../g4_0003.prim
##./generate_eps -t view12_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#
#pushd scripts/view13
#./generate_eps -t view13 -i ../../g4_0000.prim
#./generate_eps -t view13_ev1 -i ../../g4_0001.prim
##./generate_eps -t view13_ev2 -i ../../g4_0002.prim
##./generate_eps -t view13_ev3 -i ../../g4_0003.prim
##./generate_eps -t view13_ev4 -i ../../g4_0004.prim
#cp *.pdf ../../images/.
#cp *.png ../../images/.
#popd
#!/usr/bin/env python
from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(
loader=FileSystemLoader('reports/templates'),
#loader=PackageLoader('reports', 'templates'),
autoescape=select_autoescape(['html', 'xml'])
)
import glob
base_url = "https://eicweb.phy.anl.gov/api/v4/projects/390/jobs/artifacts/master/raw"
#images = ["images/view2a.png","images/view2b.png", "images/view1.png"]
images = glob.glob("images/*.png")
template = env.get_template('detector_views.md')
print(template.render(base_url=base_url, images=images))
HepMC::Version 3.02.02
HepMC::Asciiv3-START_EVENT_LISTING
E 0 4 9
U GEV CM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 -9.9999999869440064e+00 1.0000000000000000e+01 5.1099888971089147e-04 4
P 2 1 22 -5.8225640056623670e-03 3.7747924008719728e-02 -2.9249301763891555e+00 2.9248270767857321e+00 -4.5408321610621201e-02 3
P 3 1 11 5.8225640056623670e-03 -3.7747924008719728e-02 -7.0750698105548508e+00 7.0751729232142679e+00 5.1101967722736764e-04 1
P 4 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131387851e+01 1.0000000000000000e+02 9.3827199999876709e-01 4
P 5 4 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131482922e+01 1.0000000000009507e+02 9.3827199999973643e-01 3
V -3 0 [2,5]
P 6 -3 553 -1.4745608418116361e-02 -8.6828685571490272e-01 4.7980031183979008e+00 1.0642943648781511e+01 9.4603000000109834e+00 2
P 7 -3 2212 8.9230444123625328e-03 9.0603477972421620e-01 9.2272664838178372e+01 9.2281883429672035e+01 9.3827200000070576e-01 1
P 8 6 -13 4.4907597498767587e-01 2.0906320322010372e+00 -2.1757837479786910e+00 3.0524760533554351e+00 1.0565800000001382e-01 1
P 9 6 13 -4.6382158340577534e-01 -2.9589188879149320e+00 6.9737868663710216e+00 7.5904675954137195e+00 1.0565800000002223e-01 1
E 0 4 10
U GEV CM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 -9.9999999869440064e+00 1.0000000000000000e+01 5.1099888971089147e-04 4
P 2 1 22 -2.6839726606050791e-04 1.1264659797828775e-03 -6.3401069726794805e+00 6.3401067668601172e+00 -1.9876609922101014e-03 3
P 3 1 11 2.6839726606050791e-04 -1.1264659797828775e-03 -3.6598930142645258e+00 3.6598932331398828e+00 5.1103633096365880e-04 1
P 4 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131387851e+01 1.0000000000000000e+02 9.3827199999876709e-01 4
P 5 4 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131482922e+01 1.0000000000009507e+02 9.3827199999973643e-01 3
V -3 0 [2,5]
P 6 -3 553 1.9156252814767760e-01 2.1790735768546463e-01 -2.8073109612741973e+00 9.8723072682332713e+00 9.4603000029807429e+00 2
P 7 -3 2212 -1.9183092541375127e-01 -2.1678089170561543e-01 9.6462802125352582e+01 9.6467799504704473e+01 9.3827199999779787e-01 1
P 8 6 -13 -2.4852998465289872e-01 2.3091049977702758e+00 -5.7337843777899966e+00 6.1871786743193251e+00 1.0565799999995498e-01 1
P 9 6 13 4.4342149179344215e-01 -2.1010576035711188e+00 2.9552377554469285e+00 3.6545395711486477e+00 1.0565800000003905e-01 1
P 10 6 22 -3.3289790532426214e-03 9.8599634176282647e-03 -2.8764338046322176e-02 3.0589019653741657e-02 3.2927225399135965e-10 1
E 0 4 9
U GEV CM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 -9.9999999869440064e+00 1.0000000000000000e+01 5.1099888971089147e-04 4
P 2 1 22 2.1549001953953920e-01 5.3446029602846556e-01 -6.2965867413439192e-01 6.1195545733789913e-01 -5.9503304168678661e-01 3
P 3 1 11 -2.1549001953953920e-01 -5.3446029602846556e-01 -9.3703413128096145e+00 9.3880445426621009e+00 5.0981276742689016e-04 1
P 4 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131387851e+01 1.0000000000000000e+02 9.3827199999876709e-01 4
P 5 4 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131482922e+01 1.0000000000009507e+02 9.3827199999973643e-01 3
V -3 0 [2,5]
P 6 -3 553 2.2825834022061950e-01 3.3334310888886032e-01 3.5569092662904950e+01 3.6807891116586688e+01 9.4603000000031017e+00 2
P 7 -3 2212 -1.2768320678757170e-02 2.0111718714536578e-01 6.3796846795456545e+01 6.3804064341873378e+01 9.3827200000094813e-01 1
P 8 6 -13 -3.2477759288923482e+00 3.3065214111492942e+00 1.3631832024299879e+01 1.4398581189769127e+01 1.0565800000146809e-01 1
P 9 6 13 3.4760342691128936e+00 -2.9731783022605436e+00 2.1937260638593418e+01 2.2409309926805506e+01 1.0565799999797114e-01 1
E 0 4 9
U GEV CM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 -9.9999999869440064e+00 1.0000000000000000e+01 5.1099888971089147e-04 4
P 2 1 22 8.1053930688133671e-03 -1.2356942914208306e-02 -2.8212751471844815e+00 2.8212599310500082e+00 -1.7442735092468440e-02 3
P 3 1 11 -8.1053930688133671e-03 1.2356942914208306e-02 -7.1787248397595249e+00 7.1787400689499918e+00 5.1101148051165002e-04 1
P 4 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131387851e+01 1.0000000000000000e+02 9.3827199999876709e-01 4
P 5 4 2212 0.0000000000000000e+00 0.0000000000000000e+00 9.9995598131482922e+01 1.0000000000009507e+02 9.3827199999973643e-01 3
V -3 0 [2,5]
P 6 -3 553 -2.4074047134142244e-02 2.6879165673024504e-02 5.1101881387075991e+00 1.0752330024333787e+01 9.4602999999952058e+00 2
P 7 -3 2212 3.2179440203073603e-02 -3.9236108587412617e-02 9.2064134846942238e+01 9.2068929908251562e+01 9.3827200000167510e-01 1
P 8 6 -13 3.4101173607658830e+00 -1.3038459453885907e+00 5.9422927439678519e+00 6.9750212423676778e+00 1.0565800000106459e-01 1
P 9 6 13 -3.4341914079000371e+00 1.3307251110616287e+00 -8.3210460525766239e-01 3.7773087819715596e+00 1.0565800000016515e-01 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 8.3077231638512800e-02 3.4688303864359871e-01 -9.3422177831854492e-01 1.0000001305604915e+00 5.1100000015238706e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 7.2104820115711854e-01 1.5628742640734802e-01 -1.8589415622754393e+00 2.0000000652802488e+00 5.1100000036965185e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 -1.4361173664326103e+00 -9.3836236801405426e-01 -2.4611060473140363e+00 3.0000000435201661e+00 5.1100000036965185e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 -2.6126728458756499e-01 2.0189611701651842e+00 -3.4431867796228350e+00 4.0000000326401244e+00 5.1099999515529708e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 8.5091281358231141e-01 -2.4919887833464918e+00 -4.2504046027827407e+00 5.0000000261121000e+00 5.1099999863153363e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 -2.5637625613563038e+00 2.9774447329110156e+00 -4.5345280230083720e+00 6.0000000217600835e+00 5.1100000210777007e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 8.5248676124549916e-01 1.3423464093622672e+00 -6.8169914507188132e+00 7.0000000186514999e+00 5.1100000210777007e-04 1
E 0 1 3
U GEV MM
P 1 0 11 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000000000e+01 1.0000000000000000e+01 0.0000000000000000e+00 4
P 2 0 2212 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 9.3799999999999994e-01 9.3799999999999994e-01 4
V -1 0 [1,2]
P 3 -1 11 2.7295844590149682e-01 -1.0660162875541499e+00 -7.9239575315293242e+00 8.0000000163200617e+00 5.1099999515529708e-04 1
E 0 1 3
U GEV MM
HepMC::Asciiv3-END_EVENT_LISTING
////////////////////////////////////////
// Read reconstruction ROOT output file
// Plot variables
////////////////////////////////////////
int makeplot(const char* input_fname = "sim_output/rec_electron_0GeVto30GeV_100k_output.root")
{
// Setting figures
gROOT->SetStyle("Plain");
gStyle->SetLineWidth(3);
gStyle->SetOptStat("nem");
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
gStyle->SetPadGridX(1);
gStyle->SetPadGridY(1);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadRightMargin(0.14);
// Input ROOT file
TFile *f = new TFile(input_fname,"READ");
TTree *t = (TTree *)f->Get("events");
// Set Branch status and addressed
t->SetMakeClass(1);
t->SetBranchStatus("*", 0);
Int_t EcalClusters_;
t->SetBranchStatus("EcalClusters", 1);
t->SetBranchAddress("EcalClusters", &EcalClusters_);
Int_t RecoEcalHits_;
t->SetBranchStatus("RecoEcalHits", 1);
t->SetBranchAddress("RecoEcalHits", &RecoEcalHits_);
const Int_t kMaxEcalClusters = 100000;
Double_t cluster_x_pos[kMaxEcalClusters];
Double_t cluster_y_pos[kMaxEcalClusters];
Double_t cluster_z_pos[kMaxEcalClusters];
Float_t cluster_energy[kMaxEcalClusters];
t->SetBranchStatus("EcalClusters.position.x",1);
t->SetBranchStatus("EcalClusters.position.y",1);
t->SetBranchStatus("EcalClusters.position.z",1);
t->SetBranchStatus("EcalClusters.energy",1);
t->SetBranchAddress("EcalClusters.position.x",cluster_x_pos);
t->SetBranchAddress("EcalClusters.position.y",cluster_y_pos);
t->SetBranchAddress("EcalClusters.position.z",cluster_z_pos);
t->SetBranchAddress("EcalClusters.energy",cluster_energy);
const Int_t kMaxRecoEcalHits = 100000;
Double_t rec_x_pos[kMaxRecoEcalHits];
Double_t rec_y_pos[kMaxRecoEcalHits];
Double_t rec_energy[kMaxRecoEcalHits];
t->SetBranchStatus("RecoEcalHits.position.x",1);
t->SetBranchStatus("RecoEcalHits.position.y",1);
t->SetBranchStatus("RecoEcalHits.energy",1);
t->SetBranchAddress("RecoEcalHits.position.x",rec_x_pos);
t->SetBranchAddress("RecoEcalHits.position.y",rec_y_pos);
t->SetBranchAddress("RecoEcalHits.energy",rec_energy);
// Setting for Canvas
TCanvas *c1 = new TCanvas("c1", "c1", 500, 500);
TCanvas *c2 = new TCanvas("c2", "c2", 500, 500);
TCanvas *c3 = new TCanvas("c3", "c3", 500, 500);
TCanvas *c4 = new TCanvas("c4", "c4", 500, 500);
TCanvas *c5 = new TCanvas("c5", "c5", 500, 500);
TCanvas *c6 = new TCanvas("c6", "c6", 500, 500);
TCanvas *c7 = new TCanvas("c7", "c7", 500, 500);
TCanvas *c8 = new TCanvas("c8", "c8", 500, 500);
TCanvas *c9 = new TCanvas("c9", "c9", 500, 500);
// Declare histograms
TH1D *h1 = new TH1D("h1","Scattering Angle(#theta)", 100,130.0,180.0);
TH1D *h2 = new TH1D("h2","Pseudo-rapidity(#eta)", 100,-5.0,0.0);
TH2D *h3 = new TH2D("h3","Cluster E vs Pseudo-rapidity", 100,-0.5,30.5,100,-5.0,0.0);
TH1D *h4 = new TH1D("h4","Reconstructed energy per event", 100,-0.5,30.5);
TH1D *h5 = new TH1D("h5","Number of Clusters per event", 5,-0.5,4.5);
TH1D *h6 = new TH1D("h6","Scattering Angle(#theta) with CUT", 100,130.0,180.0);
TH1D *h7 = new TH1D("h7","Pseudo-rapidity(#eta) with CUT", 100,-5.0,0.0);
TH2D *h8 = new TH2D("h8","Cluster Hit Position", 62,-62.0,62.0,62,-62.0,62.0);
TH2D *h9 = new TH2D("h9","All Hit Position", 62,-62.0,62.0,62,-62.0,62.0);
// Declare ellipse for boundary of crystal calorimeter
TEllipse *ell1 = new TEllipse(0.0, 0.0, 60.0, 60.0);
ell1->SetFillStyle(4000);
TEllipse *ell2 = new TEllipse(0.0, 0.0, 12.0, 12.0);
ell2->SetFillStyle(4000);
// Total number of entries
Int_t nentries = t->GetEntries();
// Variables are used in calculation
Double_t r; // Radius [cm]
Double_t phi; // Azimuth [degree]
Double_t theta; // Inclination [degree]
Double_t eta; // Pseudo-rapidity [unitless]
Float_t cluster_e; // Cluster energy [GeV]
Float_t total_cluster_e;// Add up clusters per event [GeV]
Double_t total_thr_e; // Thrown energy [GeV]
// Loop over event by event
for (int ievent = 0; ievent < nentries; ievent++)
{
t->GetEntry(ievent);
Int_t ncluster = EcalClusters_;
Int_t nreconhits = RecoEcalHits_;
total_cluster_e = 0.0;
h5->Fill(ncluster, 1.0);
// Loop over cluster by cluster
for (int icluster=0; icluster < ncluster; icluster++)
{
r = TMath::Sqrt((cluster_x_pos[icluster]*cluster_x_pos[icluster]) +
(cluster_y_pos[icluster]*cluster_y_pos[icluster]) +
(cluster_z_pos[icluster]*cluster_z_pos[icluster]));
phi = TMath::ATan(cluster_y_pos[icluster]/cluster_x_pos[icluster]) * TMath::RadToDeg();
theta = TMath::ACos(cluster_z_pos[icluster] / r) * TMath::RadToDeg();
eta = -1.0 * TMath::Log(TMath::Tan((theta*TMath::DegToRad())/2.0));
cluster_e = cluster_energy[icluster] / 1.e+3;
total_cluster_e += cluster_e;
}
// Select events with one cluster
if(ncluster == 1)
{
h1->Fill(theta, 1.0);
h2->Fill(eta, 1.0);
h3->Fill(cluster_e, eta, 1.0);
h4->Fill(total_cluster_e, 1.0);
h8->Fill(cluster_x_pos[0],cluster_y_pos[0], 1.0);
if(total_cluster_e > 0.5)
{
h6->Fill(theta, 1.0);
h7->Fill(eta, 1.0);
}
}
// Loop over hit by hit
for(int ireconhit=0; ireconhit < nreconhits; ireconhit++)
h9->Fill(rec_x_pos[ireconhit],rec_y_pos[ireconhit], 1.0);
}
// Drawing and Saving figures
c1->cd();
h1->SetLineColor(kBlue);
h1->SetLineWidth(2);
h1->GetYaxis()->SetRangeUser(0.0,h1->GetMaximum()+10.0);
h1->GetXaxis()->SetTitle("#theta [degree]");
h1->GetYaxis()->SetTitle("events");
h1->GetYaxis()->SetTitleOffset(1.4);
h1->DrawClone();
c1->SaveAs("results/electron_theta_hist_0GeVto30GeV.png");
c1->SaveAs("results/electron_theta_hist_0GeVto30GeV.pdf");
c2->cd();
h2->SetLineColor(kBlue);
h2->SetLineWidth(2);
h2->GetYaxis()->SetRangeUser(0.0,h2->GetMaximum()+10.0);
h2->GetXaxis()->SetTitle("#eta");
h2->GetYaxis()->SetTitle("events");
h2->GetYaxis()->SetTitleOffset(1.4);
h2->DrawClone();
c2->SaveAs("results/electron_eta_hist_0GeVto30GeV.png");
c2->SaveAs("results/electron_eta_hist_0GeVto30GeV.pdf");
c3->cd();
h3->GetXaxis()->SetTitle("Cluster energy [GeV]");
h3->GetYaxis()->SetTitle("#eta");
h3->GetYaxis()->SetTitleOffset(1.4);
h3->DrawClone("COLZ");
c3->SaveAs("results/eletron_E_vs_eta_hist_0GeVto30GeV.png");
c3->SaveAs("results/eletron_E_vs_eta_hist_0GeVto30GeV.pdf");
c4->cd();
c4->SetLogy(1);
h4->SetLineColor(kBlue);
h4->SetLineWidth(2);
h4->GetXaxis()->SetTitle("reconstructed energy [GeV]");
h4->GetYaxis()->SetTitle("events");
h4->GetYaxis()->SetTitleOffset(1.4);
h4->DrawClone();
c4->SaveAs("results/electron_Erec_hist_0GeVto30GeV.png");
c4->SaveAs("results/electron_Erec_hist_0GeVto30GeV.pdf");
c5->cd();
c5->SetLogy(1);
h5->SetLineColor(kBlue);
h5->SetLineWidth(2);
h5->GetXaxis()->SetTitle("Number of Clusters");
h5->GetYaxis()->SetTitle("events");
h5->GetYaxis()->SetTitleOffset(1.4);
h5->DrawClone();
c5->SaveAs("results/electron_ncluster_hist_0GeVto30GeV.png");
c5->SaveAs("results/electron_ncluster_hist_0GeVto30GeV.pdf");
c6->cd();
h6->SetLineColor(kBlue);
h6->SetLineWidth(2);
h6->GetYaxis()->SetRangeUser(0.0,h1->GetMaximum()+10.0);
h6->GetXaxis()->SetTitle("#theta [degree]");
h6->GetYaxis()->SetTitle("events");
h6->GetYaxis()->SetTitleOffset(1.4);
h6->DrawClone();
c6->SaveAs("results/electron_theta_hist_CUT_0GeVto30GeV.png");
c6->SaveAs("results/electron_theta_hist_CUT_0GeVto30GeV.pdf");
c7->cd();
h7->SetLineColor(kBlue);
h7->SetLineWidth(2);
h7->GetYaxis()->SetRangeUser(0.0,h2->GetMaximum()+10.0);
h7->GetXaxis()->SetTitle("#eta");
h7->GetYaxis()->SetTitle("events");
h7->GetYaxis()->SetTitleOffset(1.4);
h7->DrawClone();
c7->SaveAs("results/electron_eta_hist_CUT_0GeVto30GeV.png");
c7->SaveAs("results/electron_eta_hist_CUT_0GeVto30GeV.pdf");
c8->cd();
h8->GetXaxis()->SetTitle("Hit position X [cm]");
h8->GetYaxis()->SetTitle("Hit position Y [cm]");
h8->GetYaxis()->SetTitleOffset(1.4);
h8->DrawClone("COLZ");
ell1->Draw("same");
ell2->Draw("same");
c8->SaveAs("results/electron_hit_pos_cluster_0GeVto30GeV.png");
c8->SaveAs("results/electron_hit_pos_cluster_0GeVto30GeV.pdf");
c9->cd();
h9->GetXaxis()->SetTitle("Hit position X [cm]");
h9->GetYaxis()->SetTitle("Hit position Y [cm]");
h9->GetYaxis()->SetTitleOffset(1.4);
h9->DrawClone("COLZ");
ell1->Draw("same");
ell2->Draw("same");
c9->SaveAs("results/electron_hit_pos_all_0GeVto30GeV.png");
c9->SaveAs("results/electron_hit_pos_all_0GeVto30GeV.pdf");
return 0;
}
#!/bin/bash
npsim --runType batch --numberOfEvents 100000 \
--compactFile ./topside.xml \
--inputFiles ../datasets/data/emcal_electron_0GeVto30GeV_100kEvt.hepmc \
--outputFile ./sim_electron_0GeVto30GeV_100k_input.root
#!/usr/bin/env python
from __future__ import absolute_import, unicode_literals
import os
import time
import logging
import argparse
parser = argparse.ArgumentParser(
prog='run_topside',
description='''This runs the simulation the but that is okay''',
epilog='''
This program should be run in the "compact" directory.
''')
parser.add_argument("-v","--verbose", help="increase output verbosity", type=int, default=0)
parser.add_argument("--compact", help="compact detector file",default="topside.xml")
parser.add_argument("--vis", help="vis true/false", action="store_true",default=False)
parser.add_argument("--ui", help="ui setting tcsh or qt; default=qt", type=str,default="qt",dest="ui")
parser.add_argument("-b","--batch", help="batch turns off vis/ui", action="store_true",default=False, dest="batch")
parser.add_argument("-n","--n-events", help="number of events", type=int, default=0)
parser.add_argument("-s","--n-skip", help="number of events to skip", type=int, default=0)
parser.add_argument("-m","--macro", help="macro to execute", default="macro/vis.mac")
parser.add_argument("-o","--output", help="output file", default=None)
parser.add_argument("-i","--input", help="input data file", default=None)
parser.add_argument("--target-position", nargs=3, help="nominal location of the target in units of mm", default=[0.0,0.0,-3000.0],metavar=("X","Y","Z"))
args = parser.parse_args()
import DDG4
from DDG4 import OutputLevel as Output
from g4units import keV, GeV, mm, ns, MeV
def run():
if not args.vis:
os.environ['G4UI_USE_TCSH'] = "0"
else:
#if args.vis:
os.environ['G4UI_USE_TCSH'] = "1"
kernel = DDG4.Kernel()
description = kernel.detectorDescription()
kernel.loadGeometry(str("file:" + args.compact))
DDG4.importConstants(description)
geant4 = DDG4.Geant4(kernel)
if args.vis > 0:
geant4.printDetectors()
n_events = args.n_events
if args.vis:
if args.batch:
geant4.setupUI(typ=args.ui, vis=True,ui=False, macro=args.macro)
else:
geant4.setupUI(typ=args.ui, vis=True,ui=True, macro=args.macro)
else:
if args.batch:
geant4.setupUI(typ=args.ui, vis=False,ui=False)
else:
geant4.setupUI(typ=args.ui, vis=True,ui=True, macro=args.macro)
if n_events <= 0:
n_events = 1
kernel.NumEvents = n_events
geant4.setupTrackingField(stepper='ClassicalRK4', equation='Mag_UsualEqRhs')
rndm = DDG4.Action(kernel, 'Geant4Random/Random')
if os.getenv('SEED') is None:
rndm.Seed = 1234
else :
rndm.Seed = os.getenv('SEED')
rndm.initialize()
rndm.showStatus()
run1 = DDG4.RunAction(kernel, 'Geant4TestRunAction/RunInit')
run1.Property_int = 12345
run1.Property_double = -5e15 * keV
run1.Property_string = 'Startrun: Hello_2'
run1.enableUI()
kernel.registerGlobalAction(run1)
kernel.runAction().adopt(run1)
prt = DDG4.EventAction(kernel, 'Geant4ParticlePrint/ParticlePrint')
#prt.OutputLevel = Output.INFO
#prt.OutputType = 3 # Print both: table and tree
kernel.eventAction().adopt(prt)
outputfile = args.output
if outputfile is None:
outputfile = 'data/topside_' + time.strftime('%Y-%m-%d_%H-%M')
#rootoutput = geant4.setupROOTOutput('RootOutput', outputfile)
#rootoutput.HandleMCTruth = True
podio = DDG4.EventAction(kernel, 'Geant4Output2Podio/RootOutput', True)
podio.HandleMCTruth = False
podio.Control = True
podio.Output = outputfile
podio.enableUI()
kernel.eventAction().adopt(podio)
#--------------------------------
gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorActionInit/GenerationInit")
gen.OutputLevel = 1
gen.enableUI()
kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc3")
#gen.Parameters["Flow1"] = "flow1"
#gen.Parameters["Flow2"] = "flow2"
inputfile = args.input
if inputfile is None:
inputfile = "data/proton_dvcs_eic.hepmc"
gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc3")
gen.Input = "HEPMC3FileReader|" + inputfile
gen.OutputLevel = 0 # generator_output_level
gen.Mask = 0
gen.Sync = args.n_skip
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexSmear/BeamDivergence")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "EICInteractionVertexBoost/CrossingAngle")
gen.Mask = 0
gen.OutputLevel = 5 # generator_output_level
#gen.Sigma = (4 * mm, 1 * mm, 1 * mm, 0 * ns)
kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionVertexSmear/SmearVert")
#gen.Offset = (0 * mm, 0 * mm, 0 * mm, 0 * ns)
#gen.Sigma = (3 * mm, 3 * mm, 200 * mm, 0 * ns)
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4GeneratorWrapper/GPS")
#gen.Uses = 'G4GeneralParticleSource'
##gen.OutputLevel = Output.WARNING
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
#gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
#gen.OutputLevel = 0 # generator_output_level
gen.enableUI()
kernel.generatorAction().adopt(gen)
part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
# part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
part.MinimalKineticEnergy = 100000 * GeV
#part.OutputLevel = 0 # generator_output_level
part.enableUI()
kernel.generatorAction().adopt(part)
#gen = DDG4.GeneratorAction(kernel, "Geant4IsotropeGenerator/IsotropE-")
#gen.Particle = 'e-'
#gen.Energy = 25 * GeV
#gen.Multiplicity = 3
#gen.Distribution = 'uniform'
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4InteractionMerger/InteractionMerger")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#gen = DDG4.GeneratorAction(kernel, "Geant4PrimaryHandler/PrimaryHandler")
#gen.OutputLevel = 4 # generator_output_level
#gen.enableUI()
#kernel.generatorAction().adopt(gen)
#part = DDG4.GeneratorAction(kernel, "Geant4ParticleHandler/ParticleHandler")
#kernel.generatorAction().adopt(part)
## part.SaveProcesses = ['conv','Decay']
#part.SaveProcesses = ['Decay']
#part.MinimalKineticEnergy = 100 * MeV
#part.OutputLevel = 5 # generator_output_level
#part.enableUI()
#user = DDG4.Action(kernel, "Geant4TCUserParticleHandler/UserParticleHandler")
#user.TrackingVolume_Zmax = DDG4.EcalEndcap_zmin
#user.TrackingVolume_Rmax = DDG4.EcalBarrel_rmin
#user.enableUI()
#part.adopt(user)
#f1 = DDG4.Filter(kernel, 'GeantinoRejectFilter/GeantinoRejector')
f2 = DDG4.Filter(kernel, 'ParticleRejectFilter/OpticalPhotonRejector')
f2.particle = 'opticalphoton'
f3 = DDG4.Filter(kernel, 'ParticleSelectFilter/OpticalPhotonSelector')
f3.particle = 'opticalphoton'
#f4 = DDG4.Filter(kernel, 'EnergyDepositMinimumCut')
#f4.Cut = 10 * MeV
#f4.enableUI()
#kernel.registerGlobalFilter(f1)
kernel.registerGlobalFilter(f2)
kernel.registerGlobalFilter(f3)
#kernel.registerGlobalFilter(f4)
#seq, act = geant4.setupDetector('ForwardRICH','PhotoMultiplierSDAction')
#act.adopt(f3)
#seq, act = geant4.setupDetector('HeavyGasCherenkov','PhotoMultiplierSDAction')
#act.adopt(f3)
seq, act = geant4.setupTracker('SiTrackerBarrel_Layer1')
seq, act = geant4.setupTracker('SiTrackerEndcapP_Layer1')
seq, act = geant4.setupTracker('SiTrackerEndcapN_Layer1')
seq, act = geant4.setupTracker('SiTrackerBarrel_Layer2')
seq, act = geant4.setupTracker('SiTrackerEndcapP_Layer2')
seq, act = geant4.setupTracker('SiTrackerEndcapN_Layer2')
seq, act = geant4.setupTracker('SiTrackerBarrel_Layer3')
seq, act = geant4.setupTracker('SiTrackerEndcapP_Layer3')
seq, act = geant4.setupTracker('SiTrackerEndcapN_Layer3')
seq, act = geant4.setupTracker('SiTrackerBarrel_Layer4')
seq, act = geant4.setupTracker('SiTrackerEndcapP_Layer4')
seq, act = geant4.setupTracker('SiTrackerEndcapN_Layer4')
seq, act = geant4.setupTracker('SiTrackerBarrel_Layer5')
seq, act = geant4.setupTracker('SiTrackerEndcapP_Layer5')
seq, act = geant4.setupTracker('SiTrackerEndcapN_Layer5')
#seq, act = geant4.setupTracker('SiVertexBarrel')
#seq, act = geant4.setupTracker('SiTrackerForward')
#seq, act = geant4.setupCalorimeter('EcalBarrel')
#seq, act = geant4.setupCalorimeter('EcalEndcap')
#seq, act = geant4.setupCalorimeter('HcalBarrel')
#seq, act = geant4.setupTracker('RomanPot1')
#seq, act = geant4.setupTracker('RomanPot2')
#seq, act = geant4.setupTracker('RomanPot3')
#seq, act = geant4.setupTracker('RomanPot4')
#seq, act = geant4.setupTracker('RomanPot44')
#seq, act = geant4.setupTracker('RomanPot45')
#seq, act = geant4.setupTracker('RomanPot46')
#seq, act = geant4.setupTracker('RomanPot47')
#seq, act = geant4.setupTracker('RomanPot48')
#seq, act = geant4.setupTracker('RomanPot49')
#seq, act = geant4.setupTracker('RomanPot50')
#seq, act = geant4.setupTracker('RomanPot51')
phys = geant4.setupPhysics('QGSP_BERT')
geant4.addPhysics(str('Geant4PhysicsList/Myphysics'))
ph = DDG4.PhysicsList(kernel, 'Geant4OpticalPhotonPhysics/OpticalPhotonPhys')
ph.VerboseLevel = 0
ph.enableUI()
phys.adopt(ph)
ph = DDG4.PhysicsList(kernel, 'Geant4CerenkovPhysics/CerenkovPhys')
ph.MaxNumPhotonsPerStep = 10
ph.MaxBetaChangePerStep = 10.0
ph.TrackSecondariesFirst = True
ph.VerboseLevel = 0
ph.enableUI()
phys.adopt(ph)
## Add special particle types from specialized physics constructor
#part = geant4.addPhysics('Geant4ExtraParticles/ExtraParticles')
#part.pdgfile = 'checkout/DDG4/examples/particle.tbl'
# Add global range cut
rg = geant4.addPhysics('Geant4DefaultRangeCut/GlobalRangeCut')
rg.RangeCut = 0.7 * mm
phys.dump()
#ui_action = dd4hep.sim.createAction(kernel, "Geant4UIManager/UI")
#ui_action.HaveVIS = True
#ui_action.HaveUI = True
#ui_action.SessionType = qt
#ui_action.SetupUI = macro
#kernel.registerGlobalAction(ui_action)
kernel.configure()
kernel.initialize()
# DDG4.setPrintLevel(Output.DEBUG)
kernel.run()
kernel.terminate()
if __name__ == "__main__":
run()
#!/bin/bash
#export DAWN_PS_PREVIEWER="derp"
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view1"
INPUT_FILE="g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
dawncut 1 0 0 1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
dawncut -1 0 0 1 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
#!/bin/bash
#trignometry
sin ()
{
echo "scale=5;s($1)" | bc -l
}
cos ()
{
echo "scale=5;c($1)" | bc -l
}
tan ()
{
echo "scale=5;s($1)/c($1)" | bc -l
}
#export DAWN_PS_PREVIEWER="derp"
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view11"
INPUT_FILE="g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
echo "view11 produces a series of slightly rotated XY slices a different z locations. Along beamline"
#dawncut 1 0 0 100 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
#dawncut -1 0 0 100 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
#cp ${INPUT_FILE} ${FILE_TAG}.prim
dawncut 1 0 -0.01666 200 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
dawncut -1 0 0.01666 200 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
dawncut 1 0 -0.01666 200 ${INPUT_FILE} ${FILE_TAG}a_temp0.prim
dawncut -1 0 0.01666 200 ${FILE_TAG}a_temp0.prim ${FILE_TAG}a.prim
dawn -d ${FILE_TAG}a.prim
ps2pdf ${FILE_TAG}a.eps ${FILE_TAG}a_full.pdf
gs -o ${FILE_TAG}a.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
-f ${FILE_TAG}a_full.pdf
pdftoppm ${FILE_TAG}a.pdf ${FILE_TAG}a -png -singlefile -cropbox
#!/bin/bash
#trignometry
sin ()
{
echo "scale=5;s($1)" | bc -l
}
cos ()
{
echo "scale=5;c($1)" | bc -l
}
tan ()
{
echo "scale=5;s($1)/c($1)" | bc -l
}
function print_the_help {
echo "USAGE: $0 -i <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view12"
INPUT_FILE="../../g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# units are mm
echo "view12 produces a series of slightly rotated XY slices a different z locations. Along beamline"
# slice at z = 2m
# note the offset has to change with sign of the direction to cut in the opposite direction.
dawncut 0 0 1 2005 ${INPUT_FILE} ${FILE_TAG}b_temp0.prim
dawncut 0 0 -1 -2000 ${FILE_TAG}b_temp0.prim ${FILE_TAG}b.prim
dawn -d ${FILE_TAG}b.prim
ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf
gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}b_full.pdf
pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox
original_file_tag="${FILE_TAG}"
make_slice(){
local zpos="$1"
local tagnum=$(printf "%04d" ${zpos})
local FILE_TAG="${original_file_tag}a${tagnum}"
dawncut 0 0 1 ${zpos}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
dawncut 0 0 -1 -${zpos}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
rm "${FILE_TAG}_temp0.prim"
rm "${FILE_TAG}.prim"
}
for zzz in $(seq 50 50 2000) ;
do
make_slice ${zzz} &
done
wait
#dawncut 0 1 0 10 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim
#dawncut 0 -1 0 0 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim
#dawn -d ${FILE_TAG}c.prim
#ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
#gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}c_full.pdf
#pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
#
## slice at z = -1m
#dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim
#dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim
#dawn -d ${FILE_TAG}d.prim
#ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
#gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}d_full.pdf
#pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
#
## slice at z = -2m
#dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim
#dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim
#dawn -d ${FILE_TAG}e.prim
#ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
#gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}e_full.pdf
#pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
#!/bin/bash
echo "view2 produces a series of XY slices a different z locations."
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view2"
INPUT_FILE="g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# everthing downstream of z = 5 m
dawncut 0 0 -1 -5000 ${INPUT_FILE} ${FILE_TAG}b.prim
dawn -d ${FILE_TAG}b.prim
ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf
gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}b_full.pdf
pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox
#
#dawncut 0 1 0 10 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim
#dawncut 0 -1 0 0 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim
#dawn -d ${FILE_TAG}c.prim
#ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
#gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}c_full.pdf
#pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
#
## slice at z = -1m
#dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim
#dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim
#dawn -d ${FILE_TAG}d.prim
#ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
#gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}d_full.pdf
#pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
#
## slice at z = -2m
#dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim
#dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim
#dawn -d ${FILE_TAG}e.prim
#ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
#gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}e_full.pdf
#pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
#
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
#!/bin/bash
#trignometry
sin ()
{
echo "scale=5;s($1)" | bc -l
}
add ()
{
echo "scale=5;$1 + $2" | bc -l
}
cos ()
{
echo "scale=5;c($1)" | bc -l
}
tan ()
{
echo "scale=5;s($1)/c($1)" | bc -l
}
function print_the_help {
echo "USAGE: $0 -i <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view14"
INPUT_FILE="../../g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# units are mm
echo "view14 produces a series of slightly rotated XY slices a different z locations. Along beamline"
# slice at z = 2m
# note the offset has to change with sign of the direction to cut in the opposite direction.
dawncut 0 0 1 10005 ${INPUT_FILE} ${FILE_TAG}b_temp0.prim
dawncut 0 0 -1 -1000 ${FILE_TAG}b_temp0.prim ${FILE_TAG}b.prim
dawn -d ${FILE_TAG}b.prim
ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf
gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}b_full.pdf
pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox
echo "done ..."
original_file_tag="${FILE_TAG}"
make_slice(){
local zpos="$1"
local tagnum=$(printf "%04d" ${zpos})
local FILE_TAG="${original_file_tag}a${tagnum}"
local z1=$(add ${zpos} 100)
local z2=$(add ${zpos} -100)
#dawncut 0 0 1 ${z1}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
#dawncut 0 0 -1 -${z2}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
../../bin/dawn_tweak -z ${zpos}0
cp ${INPUT_FILE} ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
rm "${FILE_TAG}_temp0.prim"
rm "${FILE_TAG}.prim"
}
for zzz in $(seq 150 50 2000) ;
do
make_slice ${zzz}
done
wait
#dawncut 0 1 0 10 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim
#dawncut 0 -1 0 0 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim
#dawn -d ${FILE_TAG}c.prim
#ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
#gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}c_full.pdf
#pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
#
## slice at z = -1m
#dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim
#dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim
#dawn -d ${FILE_TAG}d.prim
#ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
#gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}d_full.pdf
#pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
#
## slice at z = -2m
#dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim
#dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim
#dawn -d ${FILE_TAG}e.prim
#ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
#gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
# -f ${FILE_TAG}e_full.pdf
#pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
#!/bin/bash
echo "view2 produces a series of XY slices a different z locations."
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view2"
INPUT_FILE="g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# units are mm
dawncut 0 0 -1 1 ${INPUT_FILE} ${FILE_TAG}a_temp0.prim
dawncut 0 0 1 1 ${FILE_TAG}a_temp0.prim ${FILE_TAG}a.prim
dawn -d ${FILE_TAG}a.prim
ps2pdf ${FILE_TAG}a.eps ${FILE_TAG}a_full.pdf
gs -o ${FILE_TAG}a.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}a_full.pdf
pdftoppm ${FILE_TAG}a.pdf ${FILE_TAG}a -png -singlefile -cropbox
# slice at z = 2m
dawncut 0 0 1 2001 ${INPUT_FILE} ${FILE_TAG}b_temp0.prim
dawncut 0 0 -1 -2000 ${FILE_TAG}b_temp0.prim ${FILE_TAG}b.prim
dawn -d ${FILE_TAG}b.prim
ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf
gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}b_full.pdf
pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox
# slice at z = 1m
dawncut 0 0 1 1001 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim
dawncut 0 0 -1 -1000 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim
dawn -d ${FILE_TAG}c.prim
ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}c_full.pdf
pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
# slice at z = -1m
dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim
dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim
dawn -d ${FILE_TAG}d.prim
ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}d_full.pdf
pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
# slice at z = -2m
dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim
dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim
dawn -d ${FILE_TAG}e.prim
ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}e_full.pdf
pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
#!/bin/bash
echo "view3 produces a series of XY slices a different z locations."
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view3"
INPUT_FILE="../../g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# units are mm
dawncut 0 0 -1 1500 ${INPUT_FILE} ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
#!/bin/bash
# this is a detector slice
# units are mm
dawncut 0 0 -1 -1500 $1 out1.prim
dawncut 0 0 1 1600 out1.prim view4.prim
dawn -d view4.prim
ps2pdf view4.eps view4.pdf
pdftoppm view4.pdf view4 -png -singlefile
#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
# input-file : Source DAWN-format file describing a 3D scene.
#
# output-file: Output DAWN-format file describing a plane-clipped
# 3D scene. The default output stream is stdout.
#
# a, b, c, d : Parameters a, b, c, and d are double values to
# define a clipping plane described with the following
# equation:
#
# ax + by + cz + d = 0.
#
# Vector (a,b,c) defines the normal vector of
# the clipping plane.
# 3D scene data in the half space at the front side
# of the clipping plane are clipped out and erased.
# The normal vector (a,b,c) needs not be a unit vector.
# If it is a unit vector, parameter "d" gives distance
# between the clipping plane and origin (0,0,0).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment