Skip to content
Snippets Groups Projects
Commit f79b0a1e authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

New geometry

parent cf96c536
Branches
No related tags found
1 merge request!1New geometry
Showing with 2368 additions and 2 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
images/*
doc/*
accelerator
eic
*.swp
fieldmaps
manifest.txt
acts.txt
acts2.txt
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:
- source .local/bin/env.sh
artifacts:
expire_in: 72 hours
paths:
- .local/detector
- .local/lib
- .local/bin
- .local/include
- .local/share
- results
- config
- images
- doc
- juggler.env
- geo
reports:
dotenv: juggler.env
stages:
- config
- initialize
- build
- test
- docs
- collect
- finalize
- deploy
common:setup:
stage: config
rules:
- if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"'
before_script:
- git clone https://eicweb.phy.anl.gov/EIC/benchmarks/common_bench.git setup
script:
- |
source setup/bin/env.sh && ./setup/bin/install_common.sh
export BEAMLINE_CONFIG="compton"
if [[ -z "${JUGGLER_DETECTOR}" ]]; then
export JUGGLER_DETECTOR="compton"
fi
if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" || "$CI_COMMIT_BRANCH" == "master" ]]; then
export BEAMLINE_CONFIG_VERSION=${CI_COMMIT_REF_NAME}
echo "BEAMLINE_CONFIG = ${BEAMLINE_CONFIG}"
echo "BEAMLINE_CONFIG_VERSION = ${CI_COMMIT_REF_NAME}"
echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
# add to env file testing
echo "BEAMLINE_CONFIG_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env
echo "BEAMLINE_CONFIG=$BEAMLINE_CONFIG" >> juggler.env
echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
# if specific juggler version is requested
if [[ -n "${JUGGLER_DETECTOR_VERSION}" ]]; then
echo "JUGGLER_DETECTOR_VERSION = ${CI_COMMIT_REF_NAME}"
echo "JUGGLER_DETECTOR_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env
fi
fi
- |
source .local/bin/env.sh
mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=${LOCAL_PREFIX} && make -j20 || exit -1
make install && cd ..
mkdir_local_data_link sim_output
ls -lrth
print_env.sh
common:detector:
stage: initialize
needs: ["common:setup"]
script:
- source .local/bin/env.sh
- mkdir_local_data_link sim_output
- mkdir -p results
- mkdir -p config
- mkdir -p doc
- mkdir -p geo
- print_env.sh
.views:
stage: docs
before_script:
- source .local/bin/env.sh
- env
- pip3 install psutil
needs:
- ["common:detector"]
# include:
# - local: 'views/generate_prim_files.yml'
# - local: 'views/view50.yml'
dump_constants:
stage: test
needs:
- ["common:detector"]
script:
- npdet_info dump compton.xml | tee doc/constants.out
dump_geometry:
stage: test
needs:
- common:detector
script:
- echo "dumping geometry"
- mkdir -p geo
- dd_web_display --output geo/detector_geo_full.root compton.xml
- echo "Geometry viewer at https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/compton/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo_full.root?job=dump_geometry&item=default;1&opt=transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&"
xmllint:
stage: test
needs:
- ["common:detector"]
script:
- xmllint compact/*.xml compton.xml > /dev/null
overlap_check:
stage: test
needs:
- ["common:detector"]
script:
- checkOverlaps -c compton.xml
overlap_check_geant4:
stage: test
needs:
- ["common:detector"]
script:
- python scripts/checkOverlaps.py -c compton.xml | tee doc/overlap_check_geant4.out
- echo "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
# CMP0074: find_package() uses <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
PROJECT(compton
LANGUAGES CXX
DESCRIPTION "EIC Compton Detector Description in DD4hep"
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
find_package(DD4hep REQUIRED COMPONENTS DDCore DDG4)
#-----------------------------------------------------------------------------------
set(a_lib_name Compton)
dd4hep_configure_output()
dd4hep_add_plugin(${a_lib_name}
SOURCES
src/CylindricalDipoleMagnet_geo.cpp
src/Tracker_geo.cpp
USES ROOT::Core ROOT::Gdml
)
target_link_libraries(${a_lib_name}
PUBLIC DD4hep::DDCore DD4hep::DDRec DD4hep::DDG4
)
#-----------------------------------------------------------------------------------
install(DIRECTORY compact/
DESTINATION share/${PROJECT_NAME}/compact
FILES_MATCHING PATTERN "*.xml"
)
install(FILES compton.xml
DESTINATION share/${PROJECT_NAME}/
)
# Compton # EIC Compton Detector Description in DD4hep
- [Compton geometry](https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/compton/-/jobs/artifacts/master/raw/geo/detector_geo_full.root?job=dump_geometry&item=default;1&opt=clipxyz;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&)
EIC Compton Detector Description in DD4hep
\ No newline at end of file
#!/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 " --draw draw style "
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
;;
--draw)
echo "updating drawing to ${2}"
sed -i '9d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '9i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--light-theta)
echo "updating drawing to ${2}"
sed -i '19d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '19i'${2} ${DAWN_RUN_DIR}/${OUT_FILE}
shift # past argument
shift # past value
;;
--light-phi)
echo "updating drawing to ${2}"
sed -i '18d' ${DAWN_RUN_DIR}/${OUT_FILE}
sed -i '18i'${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
#!/usr/bin/env python3
# same as make_dawn_views but stops at generating the prim file.
# W. Armstrong (ANL), original bash script
# C. Peng (ANL), translate to python and add flexible run time for simulation
import os
import signal
import subprocess
import argparse
import atexit
import time
from datetime import datetime
import fcntl
import psutil
def readline_nonblocking(output):
fd = output.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
try:
return output.readline()
except:
return ''
# arguments
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--compact-file', type=str, dest='compact',
default=os.path.join(os.environ.get('DETECTOR_PATH', '.'), 'athena.xml'),
help='Top level compact file for detectors')
parser.add_argument('-s', '--skip', type=int,
default=0,
help='Number of events number to skip in the input')
parser.add_argument('-i', '--input', type=str,
default='scripts/input_data/few_events.hepmc',
help='Input hepmc file')
parser.add_argument('-o', '--output-dir', type=str, dest='out_dir',
default='sim_output',
help='output directory')
parser.add_argument('-D', '--detector-only', action='store_true', dest='detector_only',
help='only generate the prim files for the detector geometry')
parser.add_argument('-t', '--tag', type=str,dest='file_tag',
default='view',
help='Output file tag')
parser.add_argument('--timeout', type=int,
default=60,
help='Timeout in seconds')
parser.add_argument('passthrough', nargs='*')
args = parser.parse_args()
macro = 'macro/dawn_picture.mac' if args.detector_only else 'macro/dawn_picture2.mac'
# raise error if cannot create a temporary working dir
# os.makedirs('dawn_view_tmp', exist_ok=False)
os.makedirs(args.out_dir, exist_ok=True)
# use absolute path so the chdir does not affect them
args.input = os.path.abspath(args.input)
args.out_dir = os.path.abspath(args.out_dir)
args.compact = os.path.abspath(args.compact)
macro = os.path.abspath(macro)
prim_file = 'g4_0000.prim'
dawn_env = os.environ.copy()
dawn_env['DAWN_BATCH'] = 'a'
# sdir = os.path.dirname(os.path.realpath(__file__))
# Using a python warpper such as npsim introduces some problem in managing the subprocess.
# The process1 managed by subprocess will generate another process with proc2_pid = proc1_pid + 1, which will not
# be terminated by terminating or killing the process1.
# In addition, running Geant4 with vis mode will never exit automatically (it waits for input).
# Thus the created process 2 will occupy the system resources.
sim_cmd = ['npsim', '--runType', 'vis',
'--compact', args.compact,
'--inputFiles', args.input,
'--outputFile', 'derp.root',
'--numberOfEvents', '1',
'--skipNEvents', str(args.skip),
'--macroFile', macro]
start = datetime.now()
elapse = datetime.now() - start
last_update = datetime.now()
finished = False
# run simulation
print(' '.join(sim_cmd))
p = subprocess.Popen(args=sim_cmd, env=dawn_env,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
__child_pid = p.pid
while elapse.seconds < args.timeout:
line = readline_nonblocking(p.stdout)
elapse = datetime.now() - start
time_left = args.timeout - elapse.seconds
time_str = '[{:02d}:{:02d}]'.format(elapse.seconds // 60, elapse.seconds % 60)
if time_left < 10:
print('{} === TIMEOUT ===: Terminating in {:d} seconds'.format(time_str, time_left))
if line:
decoded_line = line.decode('utf-8').strip()
print('{} {}'.format(time_str, decoded_line))
# what we are looking for
if decoded_line == 'File {} is generated.'.format(prim_file):
print('{} === FINISHED ===: Got the prim file, terminating.'.format(time_str))
finished = True
break
if decoded_line == 'Idle>':
p.stdin.write(b'exit')
break
# do not sleep
continue
# ended early before file
if p.poll() is not None:
print(p.poll())
break
time.sleep(1)
p.kill()
# use to kill the subprocess generated from the python wrapper
# this is unsafe so maybe more checks required
for proc in psutil.process_iter():
pinfo = proc.as_dict(attrs=['pid', 'name', 'create_time'])
if pinfo['pid'] == p.pid + 1 and pinfo['name'] == 'python':
print('kill {}, generated from {}'.format(pinfo, p.pid))
os.kill(pinfo['pid'], signal.SIGTERM)
line = b'stderr outputs:\n'
while line:
print(line.decode('utf-8'), end='')
line = readline_nonblocking(p.stderr)
if finished:
print('Simulation finished')
else:
print('Simulation failed')
exit(1)
# move the prim files (which can be quite large)
# to the local pipeline storage path
os.system('mv g4_0000.prim {}/{}.prim'.format(args.out_dir,args.file_tag))
#!/usr/bin/env python3
# get dawn view of detectors
# W. Armstrong (ANL), original bash script
# C. Peng (ANL), translate to python and add flexible run time for simulation
import os
import signal
import subprocess
import argparse
import atexit
import time
from datetime import datetime
import fcntl
import psutil
def readline_nonblocking(output):
fd = output.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
try:
return output.readline()
except:
return ''
# arguments
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--compact-file', type=str, dest='compact',
default=os.path.join(os.environ.get('DETECTOR_PATH', '.'), 'athena.xml'),
help='Top level compact file for detectors')
parser.add_argument('-s', '--skip', type=int,
default=0,
help='Number of events number to skip in the input')
parser.add_argument('-i', '--input', type=str, dest='input',
default='sim_output',
help='Input hepmc file')
parser.add_argument('-o', '--output-dir', type=str, dest='out_dir',
default='images',
help='output directory')
parser.add_argument('-D', '--detector-only', action='store_true', dest='detector_only',
help='only generate the prim files for the detector geometry')
parser.add_argument('-d', '--dawn-dir', type=str, dest='dawn_dir',
default='scripts/view1',
help='Directory to dawn script dir (with .DAWN files and a generate_eps script)')
parser.add_argument('-t', '--tag', type=str,dest='file_tag',
default='view',
help='Output file tag')
parser.add_argument('--timeout', type=int,
default=60,
help='Timeout in seconds')
parser.add_argument('passthrough', nargs='*')
args = parser.parse_args()
macro = 'macro/dawn_picture.mac' if args.detector_only else 'macro/dawn_picture2.mac'
# raise error if cannot create a temporary working dir
# os.makedirs('dawn_view_tmp', exist_ok=False)
os.makedirs(args.out_dir, exist_ok=True)
# use absolute path so the chdir does not affect them
args.input = os.path.abspath(args.input)
args.out_dir = os.path.abspath(args.out_dir)
args.compact = os.path.abspath(args.compact)
macro = os.path.abspath(macro)
prim_file = 'g4_0000.prim'
dawn_env = os.environ.copy()
dawn_env['DAWN_BATCH'] = 'a'
# sdir = os.path.dirname(os.path.realpath(__file__))
# generate DAWN images
out_dir = os.path.abspath(args.out_dir)
input_file = os.path.abspath(args.input)
#prim_file = '{}/{}.prim'.format(input_dir,args.file_tag)
#prim_file = os.path.abspath(prim_file)
owd = os.getcwd()
os.chdir(args.dawn_dir)
subprocess.run(['pwd'])
subprocess.run(['./generate_eps', '-t', args.file_tag, '-i', input_file] + args.passthrough)
subprocess.run(['ls', '-lrth'])
# upload the results
os.system('cp *.pdf {}'.format(out_dir))
os.system('cp *.png {}'.format(out_dir))
os.chdir(owd)
<lccdd>
<define>
<comment>
name center_x center_y center_z rin(z-in) rin(z-out) dout length angle B gradient
## [m] [m] [m] [m] [m] [m] [m] [rad] [T] [T/m]
QF Q12EF_5 0.106325 0 -97.391559 0.06 0.06 0.5 0.6 -0.0243670556 0 5.5494223
DB D21EF_5 0.151178 0 -95.1303785 0.06 0.06 0.5 2.923301 -0.0173520834 -0.080044540 0
QF Q11EF_5 0.184809 0 -92.8690025 0.06 0.06 0.5 0.6 -0.0103371112 0 -5.5555556
DB D22EF_5 0.197934 0 -90.6074145 0.06 0.06 0.5 2.923301 -0.00332213905 -0.080044540 0
QF Q10EF_5 0.1998355 0 -88.34579 0.06 0.06 0.5 0.6 0.0036928331 0 3.2112834
QF Q9EF_5 0.181002 0 -83.245825 0.06 0.06 0.5 0.6 0.0036928331 0 -4.7576278
QF Q8EF_5 0.1621685 0 -78.145859 0.06 0.06 0.5 0.6 0.0036928331 0 3.6308806
QF Q7EF_5 0.143335 0 -73.045894 0.06 0.06 0.5 0.6 0.0036928331 0 -3.7604250
QF Q6EF_5 0.124502 0 -67.945929 0.06 0.06 0.5 0.6 0.0036928331 0 4.9568612
QF Q5EF_5 0.1056685 0 -62.845964 0.06 0.06 0.5 0.6 0.0036928331 0 -5.4330528
QF Q4EF_5 0.07391 0 -54.246022 0.06 0.06 0.5 0.6 0.0036928331 0 4.8666389
QF CRAB_HF 1.3617469 0 -52.730505 0.1 0.1 1.6 15.06 0.0142039188 0 0
QF Q3PF 1.2423663 0 -44.326352 0.06 0.06 0.5 0.75 0.0142039188 0 -9.21047
DB B2PF 1.1657280 0 -40.752284 0.06 0.06 0.5 4.400000 0.025962030 -4.902576321 0
QF QF3_PF 1.4907171 0 -61.809831 0.06 0.06 0.5 2.100484 0.0142039188 0 -36.58538
QF YO5_TQ5 1.6006513 0 -69.549030 0.06 0.06 0.5 0.75 0.0142039188 0 0
QF YO5_QD5 1.6157219 0 -70.609974 0.06 0.06 0.5 1.11 0.0142039188 0 82.97421
DB YO5_DH5 1.6430920 0 -78.027114 0.1 0.1 0.5 8.698449 -0.0039 -3.782030724 0
QF YO5_TQ4 1.5833771 0 -84.384146 0.06 0.06 0.5 0.75 -0.0216599742 0 0
QF Q3EF_5 0.027554847 0 -41.693231 0.06 0.06 0.5 0.6 0.0036928331 0 -1.7423111
</comment>
<constant name="D21EF_5_XPosition" value="0.151178*m"/>
<constant name="D21EF_5_ZPosition" value="-95.1303785*m"/>
<constant name="D21EF_5_InnerRadius" value="6.0*cm"/>
<constant name="D21EF_5_RotationAngle" value="-0.0173520834*rad"/>
<constant name="D21EF_5_Length" value="2.923301*m"/>
<constant name="D21EF_5_Bmax" value="-0.080044540*tesla"/>
<constant name="D21EF_5_GradientMax" value="0.0*tesla/m"/>
</define>
<detectors>
<detector id="100" name="D21EF_5_BeamlineMagnet" vis="FFMagnetVis" type="compton_CylindricalDipoleMagnet">
<placement x="D21EF_5_XPosition" y="0*m" z="D21EF_5_ZPosition" theta="D21EF_5_RotationAngle" />
<dimensions x="D21EF_5_InnerRadius*4" y="D21EF_5_InnerRadius*4" z="D21EF_5_Length" r="D21EF_5_InnerRadius*2.0" />
<apperture x="D21EF_5_InnerRadius" y="D21EF_5_InnerRadius" r="D21EF_5_InnerRadius" />
<coil vis="MagnetCoilVis" dx="2*cm" dy="1.5*cm" />
</detector>
</detectors>
<fields>
<field name="D21EF_5_Magnet" type="MultipoleMagnet">
<position x="D21EF_5_XPosition" y="0" z="D21EF_5_ZPosition"/>
<rotation x="0" y="D21EF_5_RotationAngle" z="0"/>
<shape type="Tube" rmin="0.0" rmax="D21EF_5_InnerRadius" dz="D21EF_5_Length*0.5"/>
<coefficient coefficient="D21EF_5_Bmax" skew="0.0*tesla"/>
<coefficient coefficient="D21EF_5_GradientMax" skew="0.0*tesla/cm"/>
</field>
</fields>
</lccdd>
<display>
<comment>
Colors tweaked to be displayable by geoViewer
</comment>
<vis name="AnlGreen" alpha="1" r="100/256" g="200/256" b="0/256"/>
<vis name="AnlViolet" alpha="1" r="100/256" g="0/256" b="150/256"/>
<vis name="AnlProcess_Blue" alpha="1" r="0/256" g="100/256" b="202/256"/>
<vis name="AnlOrange" alpha="1" r="255/256" g="121/256" b="0"/>
<vis name="AnlRed" alpha="1" r="205/256" g="45/256 " b="45/256"/>
<vis name="AnlGold" alpha="1" r="248/256" g="188/256" b="0/256"/>
<vis name="AnlBlue" alpha="1" r="0/256" g="96/256" b="156/256"/>
<vis name="AnlTeal" alpha="1" r="0/256" g="161/256" b="156/256"/>
<vis name="AnlGray" alpha="1" r="102/256" g="102/256" b="102/256"/>
<vis name="AnlLight_Gray" alpha="1" r="209/256" g="209/256" b="209/256"/>
<vis name="AnlLightGray" ref="AnlLight_Gray" />
<vis name="AnlDarkRed" alpha="1" r="161/256" g="45/256" b="45/256"/>
<vis name="AnlDarkGreen" alpha="1" r="0" g="110/256" b="50/256"/>
<vis name="AnlDarkBlue" alpha="1" r="45/256" g="45/256" b="110/256"/>
<vis name="AnlDelta_Red" ref="AnlDarkRed"/>
<vis name="AnlDelta_Green" ref="AnlDarkGreen"/>
<vis name="AnlDelta_Blue" ref="AnlDarkBlue"/>
</display>
<define>
<constant name="IPBeampipe_rmax" value="2.5*25.4*mm/2.0"/>
<constant name="Beampipe_rmax" value="IPBeampipe_rmax"/>
<constant name="BeampipeOD" value="2.0*IPBeampipe_rmax"/>
</define>
<display>
<comment>
See compact/compton_colors.xml for list of colors.
</comment>
<vis name="InvisibleNoDaughters" showDaughters="false" visible="false"/>
<vis name="InvisibleWithDaughters" showDaughters="true" visible="false"/>
<comment>
Tracker visualizations
</comment>
<vis name="TrackerVis" ref="AnlRed" />
<vis name="TrackerSupportVis" ref="AnlBlue" visible="true" showDaughters="false"/>
<vis name="TrackerShieldingVis" ref="AnlGray" visible="true" showDaughters="false"/>
<vis name="TrackerServiceVis" ref="AnlGold" visible="true" showDaughters="false"/>
<vis name="TrackerLayerVis" ref="TrackerVis" visible="true" showDaughters="true"/>
<vis name="TrackerModuleVis" ref="TrackerLayerVis" visible="true" showDaughters="true"/>
<vis name="TrackerSurfaceVis" ref="TrackerLayerVis" visible="true" showDaughters="true"/>
<comment>
Calorimeter visualization
</comment>
<comment>
Calorimeter visualizations
</comment>
<vis name="PreVis" ref="AnlGold" showDaughters="true" visible="true"/>
<vis name="PreLayerVis" ref="PreVis" showDaughters="true" visible="true"/>
<vis name="PreModuleVis" ref="PreLayerVis" showDaughters="true" visible="true"/>
<vis name="PreRadiatorVis" ref="PreModuleVis" showDaughters="true" visible="true"/>
<vis name="PreReadoutVis" ref="TrackerSurfaceVis" showDaughters="true" visible="true"/>
<comment>
Magnet/beamline visualization
</comment>
<vis name="MagnetVis" ref="AnlGreen" showDaughters="true" visible="true"/>
<vis name="MagnetCoilVis" ref="AnlRed" showDaughters="true" visible="true"/>
<vis name="BeamPipeVis" ref="AnlLight_Gray" showDaughters="true" visible="true"/>
</display>
<?xml version="1.0" encoding="UTF-8"?>
<lccdd>
<define>
<comment>
Compton Electron Tracker
</comment>
<comment>
- The detector length based on the 0.2*m step size and 4 layers.
</comment>
<constant name="electron_tracker_length" value="60.0*cm"/>
<constant name="electron_tracker_zoffset" value="10.0*cm"/>
<constant name="electron_tracker_center_zpos" value="6.2*m"/>
<constant name="electron_tracker_center_xpos" value="-0.16000052*m" />
<constant name="electron_tracker_zmin" value="electron_tracker_center_zpos - electron_tracker_length/2.0 "/>
<constant name="electron_tracker_rotation" value="ionCrossingAngle"/>
<comment>
average of station 2 and 3 x postions below...
</comment>
<constant name="electron_trackerSlope_x" value="0.0249974*m" />
<constant name="electron_tracker_nlayers" value="4"/>
<constant name="electron_tracker_dz" value="electron_tracker_length/(electron_tracker_nlayers-1)"/>
<comment>
This angle is the angle subtended in phi for each trap segment.
</comment>
<constant name="electron_trackerLayer_nModules" value="36"/>
<constant name="electron_trackerLayerSmallMod_nModules" value="electron_trackerLayer_nModules/6"/>
<constant name="electron_trackerModOpeningAngle" value="360.0*degree/electron_trackerLayer_nModules"/>
<constant name="electron_trackerLayerBigMod_nModules" value="electron_trackerLayer_nModules - electron_trackerLayerSmallMod_nModules"/>
<constant name="electron_trackerLayerBigMod_phi0" value="(electron_trackerLayerSmallMod_nModules/2.0 + 0.5)*electron_trackerModOpeningAngle + Pi"/>
<constant name="electron_trackerLayerSmallMod_phi0" value="(electron_trackerLayerSmallMod_nModules/2.0 - 0.5)*electron_trackerModOpeningAngle + Pi"/>
<constant name="electron_trackerMod1Inner_z" value="1.0*cm" />
<constant name="electron_trackerMod1Inner_r" value="3.5*cm" />
<constant name="electron_trackerMod1Outer_r" value="15.0*cm"/>
<constant name="electron_trackerMod1_x1" value="2.0*electron_trackerMod1Inner_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod1_x2" value="2.0*electron_trackerMod1Outer_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod1_y" value="electron_trackerMod1Outer_r*cos(electron_trackerModOpeningAngle/2.0) - electron_trackerMod1Inner_r"/>
<constant name="electron_trackerMod1SmallOuter_r" value="10.0*cm"/>
<constant name="electron_trackerMod1Small_x2" value="2.0*electron_trackerMod1SmallOuter_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod1Small_y" value="electron_trackerMod1SmallOuter_r*cos(electron_trackerModOpeningAngle/2.0) - electron_trackerMod1Inner_r"/>
<constant name="electron_trackerMod2SmallOuter_r" value="11.0*cm"/>
<constant name="electron_trackerMod2Small_x2" value="2.0*electron_trackerMod2SmallOuter_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod2Small_y" value="electron_trackerMod2SmallOuter_r*cos(electron_trackerModOpeningAngle/2.0) - electron_trackerMod1Inner_r"/>
<constant name="electron_trackerMod3SmallOuter_r" value="11.0*cm"/>
<constant name="electron_trackerMod3Small_x2" value="2.0*electron_trackerMod3SmallOuter_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod3Small_y" value="electron_trackerMod3SmallOuter_r*cos(electron_trackerModOpeningAngle/2.0) - electron_trackerMod1Inner_r"/>
<constant name="electron_trackerMod4SmallOuter_r" value="12.0*cm"/>
<constant name="electron_trackerMod4Small_x2" value="2.0*electron_trackerMod4SmallOuter_r*sin(electron_trackerModOpeningAngle/2.0)"/>
<constant name="electron_trackerMod4Small_y" value="electron_trackerMod4SmallOuter_r*cos(electron_trackerModOpeningAngle/2.0) - electron_trackerMod1Inner_r"/>
</define>
<detectors>
<detector
id="electron_tracker_Station_1_ID"
name="electron_tracker"
type="electron_tracker"
readout="ElectronTrackerHits"
vis="TrackerVis">
<position x="electron_tracker_center_xpos" y="0" z="electron_tracker_center_zpos"/>
<rotation x="0*rad" y="electron_tracker_rotation" z="0*rad"/>
<module name="Module1" vis="TrackerModuleVis"> <!-- AnlProcess_Blue-->
<trd x1="electron_trackerMod1_x1/2.0" x2="electron_trackerMod1_x2/2.0" z="electron_trackerMod1_y/2"/>
<comment> Back-to-front </comment>
<module_component thickness="0.12*mm" material="CarbonFiber" vis="TrackerSupportVis" />
<module_component thickness="0.3*mm" material="SiliconOxide" vis="TrackerSurfaceVis" sensitive="true"/>
</module>
<module name="SmallModule1" vis="TrackerModuleVis">
<trd x1="electron_trackerMod1_x1/2.0" x2="electron_trackerMod1Small_x2/2.0" z="electron_trackerMod1Small_y/2"/>
<module_component thickness="0.12*mm" material="CarbonFiber" vis="TrackerSupportVis" />
<module_component thickness="0.3*mm" material="SiliconOxide" vis="TrackerSurfaceVis" sensitive="true"/>
</module>
<module name="SmallModule2" vis="TrackerModuleVis">
<trd x1="electron_trackerMod1_x1/2.0" x2="electron_trackerMod2Small_x2/2.0" z="electron_trackerMod2Small_y/2"/>
<module_component thickness="0.12*mm" material="CarbonFiber" vis="TrackerSupportVis" />
<module_component thickness="0.3*mm" material="SiliconOxide" vis="TrackerSurfaceVis" sensitive="true"/>
</module>
<module name="SmallModule3" vis="TrackerModuleVis">
<trd x1="electron_trackerMod1_x1/2.0" x2="electron_trackerMod3Small_x2/2.0" z="electron_trackerMod3Small_y/2"/>
<module_component thickness="0.12*mm" material="CarbonFiber" vis="TrackerSupportVis" />
<module_component thickness="0.3*mm" material="SiliconOxide" vis="TrackerSurfaceVis" sensitive="true"/>
</module>
<module name="SmallModule4" vis="TrackerModuleVis">
<trd x1="electron_trackerMod1_x1/2.0" x2="electron_trackerMod4Small_x2/2.0" z="electron_trackerMod4Small_y/2"/>
<module_component thickness="0.12*mm" material="CarbonFiber" vis="TrackerSupportVis" />
<module_component thickness="0.3*mm" material="SiliconOxide" vis="TrackerSurfaceVis" sensitive="true"/>
</module>
<layer id="1">
<envelope vis="TrackerLayerVis" rmin="electron_trackerMod1Inner_r" rmax="electron_trackerMod1Outer_r" length="1.0*cm"
zstart="-electron_tracker_length/2.0" />
<ring phi0="electron_trackerLayerBigMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod1_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerBigMod_nModules" dz="0 * mm" module="Module1" />
<ring phi0="-electron_trackerLayerSmallMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod1Small_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerSmallMod_nModules" dz="0 * mm" module="SmallModule1" />
</layer>
<layer id="2" >
<envelope vis="TrackerLayerVis" rmin="electron_trackerMod1Inner_r" rmax="electron_trackerMod1Outer_r" length="1.0*cm"
zstart="-electron_tracker_length/2.0 + 1.0*electron_tracker_dz" />
<ring phi0="electron_trackerLayerBigMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod1_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerBigMod_nModules" dz="0 * mm" module="Module1" />
<ring phi0="-electron_trackerLayerSmallMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod2Small_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerSmallMod_nModules" dz="0 * mm" module="SmallModule2" />
</layer>
<layer id="3" >
<envelope vis="TrackerLayerVis" rmin="electron_trackerMod1Inner_r" rmax="electron_trackerMod1Outer_r" length="1.0*cm"
zstart="-electron_tracker_length/2.0 + 2.0*electron_tracker_dz" />
<ring phi0="electron_trackerLayerBigMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod1_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerBigMod_nModules" dz="0 * mm" module="Module1" />
<ring phi0="-electron_trackerLayerSmallMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod3Small_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerSmallMod_nModules" dz="0 * mm" module="SmallModule3" />
</layer>
<layer id="4" >
<envelope vis="TrackerLayerVis" rmin="electron_trackerMod1Inner_r" rmax="electron_trackerMod1Outer_r" length="1.0*cm"
zstart="-electron_tracker_length/2.0 + 3.0*electron_tracker_dz" />
<ring phi0="electron_trackerLayerBigMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod1_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerBigMod_nModules" dz="0 * mm" module="Module1" />
<ring phi0="-electron_trackerLayerSmallMod_phi0" dphi="electron_trackerModOpeningAngle"
r="electron_trackerMod1Inner_r+electron_trackerMod4Small_y/2.0" zstart="0.0*mm"
nmodules="electron_trackerLayerSmallMod_nModules" dz="0 * mm" module="SmallModule4" />
</layer>
</detector>
</detectors>
<readouts>
<readout name="ElectronTrackerHits">
<segmentation type="CartesianGridXZ" grid_size_x="0.020*mm" grid_size_z="0.020*mm" />
<id>system:8,layer:4,module:12,sensor:2,x:32:-16,z:-16</id>
</readout>
</readouts>
</lccdd>
This diff is collapsed.
<geant4_setup>
<properties>
<attributes name="geant4_field"
id="0"
type="Geant4FieldSetup"
object="D21EF_5_Magnet"
global="true"
min_chord_step="0.001*mm"
delta_chord="0.025*mm"
delta_intersection="1e-06*mm"
delta_one_step="0.00001*mm"
eps_min="1.0e-6"
eps_max="1.0e-5"
stepper="HelixSimpleRunge"
equation="Mag_UsualEqRhs">
</attributes>
</properties>
</geant4_setup>
<?xml version="1.0" encoding="UTF-8"?>
<materials>
<!--
Air by weight from
http://www.engineeringtoolbox.com/air-composition-24_212.html
-->
<material name="Air">
<D type="density" unit="g/cm3" value="0.0012"/>
<fraction n="0.754" ref="N"/>
<fraction n="0.234" ref="O"/>
<fraction n="0.012" ref="Ar"/>
</material>
<!-- We model vakuum just as very thin air -->
<material name="Vacuum">
<D type="density" unit="g/cm3" value="0.0000000001"/>
<fraction n="0.754" ref="N"/>
<fraction n="0.234" ref="O"/>
<fraction n="0.012" ref="Ar"/>
</material>
<material name="Epoxy">
<D type="density" value="1.3" unit="g/cm3"/>
<composite n="44" ref="H"/>
<composite n="15" ref="C"/>
<composite n="7" ref="O"/>
</material>
<material name="Quartz">
<D type="density" value="2.2" unit="g/cm3"/>
<composite n="1" ref="Si"/>
<composite n="2" ref="O"/>
</material>
<material name="G10">
<D type="density" value="1.7" unit="g/cm3"/>
<fraction n="0.08" ref="Cl"/>
<fraction n="0.773" ref="Quartz"/>
<fraction n="0.147" ref="Epoxy"/>
</material>
<material name="Polystyrene">
<D value="1.032" unit="g/cm3"/>
<composite n="19" ref="C"/>
<composite n="21" ref="H"/>
</material>
<material name="Steel235">
<D value="7.85" unit="g/cm3"/>
<fraction n="0.998" ref="Fe"/>
<fraction n=".002" ref="C"/>
</material>
<material name="SiliconOxide">
<D type="density" value="2.65" unit="g/cm3"/>
<composite n="1" ref="Si"/>
<composite n="2" ref="O"/>
</material>
<material name="BoronOxide">
<D type="density" value="2.46" unit="g/cm3"/>
<composite n="2" ref="B"/>
<composite n="3" ref="O"/>
</material>
<material name="SodiumOxide">
<D type="density" value="2.65" unit="g/cm3"/>
<composite n="2" ref="Na"/>
<composite n="1" ref="O"/>
</material>
<material name="AluminumOxide">
<D type="density" value="3.89" unit="g/cm3"/>
<composite n="2" ref="Al"/>
<composite n="3" ref="O"/>
</material>
<material name="SiliconNitride">
<D type="density" value="3.17" unit="g/cm3"/>
<composite n="3" ref="Si"/>
<composite n="4" ref="N"/>
</material>
<material name="PyrexGlass">
<D type="density" value="2.23" unit="g/cm3"/>
<fraction n="0.806" ref="SiliconOxide"/>
<fraction n="0.130" ref="BoronOxide"/>
<fraction n="0.040" ref="SodiumOxide"/>
<fraction n="0.023" ref="AluminumOxide"/>
</material>
<material name="CarbonFiber">
<D type="density" value="1.5" unit="g/cm3"/>
<fraction n="0.65" ref="C"/>
<fraction n="0.35" ref="Epoxy"/>
</material>
<material name="CarbonFiber_50D">
<D type="density" value="0.75" unit="g/cm3"/>
<fraction n="0.65" ref="C"/>
<fraction n="0.35" ref="Epoxy"/>
</material>
<material name="Rohacell31">
<D type="density" value="0.032" unit="g/cm3"/>
<composite n="9" ref="C"/>
<composite n="13" ref="H"/>
<composite n="2" ref="O"/>
<composite n="1" ref="N"/>
</material>
<material name="Rohacell31_50D">
<D type="density" value="0.016" unit="g/cm3"/>
<composite n="9" ref="C"/>
<composite n="13" ref="H"/>
<composite n="2" ref="O"/>
<composite n="1" ref="N"/>
</material>
<material name="RPCGasDefault" state="gas">
<D type="density" value="0.0037" unit="g/cm3"/>
<composite n="209" ref="C"/>
<composite n="239" ref="H"/>
<composite n="381" ref="F"/>
</material>
<material name="PolystyreneFoam">
<D type="density" value="0.0056" unit="g/cm3"/>
<fraction n="1.0" ref="Polystyrene"/>
</material>
<material name="Kapton">
<D value="1.43" unit="g/cm3"/>
<composite n="22" ref="C"/>
<composite n="10" ref="H"/>
<composite n="2" ref="N"/>
<composite n="5" ref="O"/>
</material>
<material name="PEEK">
<D value="1.37" unit="g/cm3"/>
<composite n="19" ref="C"/>
<composite n="12" ref="H"/>
<composite n="3" ref="O"/>
</material>
<material name="TungstenDens23">
<D value="17.7" unit="g / cm3"/>
<fraction n="0.925" ref="W"/>
<fraction n="0.066" ref="Ni"/>
<fraction n="0.009" ref="Fe"/>
</material>
<material name="TungstenDens24">
<D value="17.8" unit="g / cm3"/>
<fraction n="0.93" ref="W"/>
<fraction n="0.061" ref="Ni"/>
<fraction n="0.009" ref="Fe"/>
</material>
<material name="TungstenDens25">
<D value="18.2" unit="g / cm3"/>
<fraction n="0.950" ref="W"/>
<fraction n="0.044" ref="Ni"/>
<fraction n="0.006" ref="Fe"/>
</material>
<material name="CarbonFiber_25percent">
<D type="density" value="0.375" unit="g / cm3"/>
<fraction n="1.0" ref="CarbonFiber"/>
</material>
<material name="CarbonFiber_15percent">
<D type="density" value="0.225" unit="g / cm3"/>
<fraction n="1.0" ref="CarbonFiber"/>
</material>
<material name="Rohacell31_50percent">
<D type="density" value="0.016" unit="g / cm3"/>
<fraction n="1.0" ref="Rohacell31"/>
</material>
<material name="Rohacell31_15percent">
<D type="density" value="0.0048" unit="g / cm3"/>
<fraction n="1.0" ref="Rohacell31"/>
</material>
<material name="BoratedPolyethylene5">
<D value="0.93" unit="g / cm3"/>
<fraction n="0.612" ref="C"/>
<fraction n="0.222" ref="O"/>
<fraction n="0.116" ref="H"/>
<fraction n="0.050" ref="B"/>
</material>
<material name="SiliconCarbide">
<D value="3.1" unit="g / cm3"/>
<composite n="1" ref="Si"/>
<composite n="1" ref="C"/>
</material>
<material name="SiliconCarbide_6percent">
<D value="0.186" unit="g / cm3"/>
<fraction n="1.0" ref="SiliconCarbide"/>
</material>
<material name="PlasticScint">
<D type="density" unit="g/cm3" value="1.032"/>
<composite n="9" ref="C"/>
<composite n="10" ref="H"/>
</material>
<material name="PbWO4">
<D type="density" value="8.3" unit="g / cm3"/>
<composite n="1" ref="Pb"/>
<composite n="1" ref="W"/>
<composite n="4" ref="O"/>
</material>
<material name="StainlessSteel">
<D type="density" value="8.3" unit="g / cm3"/>
<fraction n="0.74" ref="Fe"/>
<fraction n="0.18" ref="Cr"/>
<fraction n="0.08" ref="Ni"/>
</material>
<material name="ZDC_Tungsten">
<D type="density" value="18.73" unit="g / cm3"/>
<fraction n="0.943" ref="W"/>
<fraction n="0.038" ref="Ni"/>
<fraction n="0.019" ref="Cu"/>
</material>
<material name="ZDC_EpoxyGlue">
<D type="density" value="1.38" unit="g/cm3"/>
<composite n="8" ref="H"/>
<composite n="10" ref="C"/>
<composite n="4" ref="O"/>
</material>
<material name="ZDC_Scintillator">
<D type="density" value="1.032" unit="g/cm3"/>
<composite n="8" ref="C"/>
<composite n="8" ref="H"/>
</material>
<material name="ZDC_WSciFiMixture">
<D type="density" value="10.17" unit="g/cm3"/>
<composite n="0.950" ref="W"/>
<composite n="0.009" ref="H"/>
<composite n="0.041" ref="C"/>
</material>
<material name="WSciFi_UCLA_Abs">
<D type="density" value="12.4" unit="g / cm3"/>
<fraction n="0.96" ref="W"/>
<fraction n="0.04" ref="Polystyrene"/>
</material>
</materials>
<lccdd>
<comment>
Compton Photon Calorimeter
</comment>
<detectors>
<detector
id="photon_calorimeter_ID"
name="photon_calorimeter"
vis="photon_calorimeter_vis"
type="CrystalCalorimeter"
readout="PhotonCalorimeterHits">
<position
x="photon_calorimeter_x_position"
y="photon_calorimeter_y_position"
z="photon_calorimeter_z_position"
/>
<rotation
x="photon_calorimeter_x_angle"
y="photon_calorimeter_y_angle"
z="photon_calorimeter_z_angle"
/>
<dimensions
x="photon_calorimeter_width"
z="photon_calorimeter_length"
/>
<layer repeat="ffi_ZDC_SiWSciFi_NRepeat">
<slice name="Silicon_1_slice" material="Silicon" thickness="ffi_ZDC_Silicon_1_Thickness" vis="RedVis" sensitive="true"/>
<slice name="Glue_1_slice" material="ZDC_EpoxyGlue" thickness="ffi_ZDC_Glue_1_Thickness" vis="AnlGold"/>
<slice name="FPC_slice" material="ZDC_EpoxyGlue" thickness="ffi_ZDC_FPC_Thickness" vis="AnlGold"/>
<slice name="Air_1_slice" material="Air" thickness="ffi_ZDC_Air_1_Thickness" vis="InvisibleNoDaughters"/>
<slice name="WSciFi_slice" material="ZDC_WSciFiMixture" thickness="ffi_ZDC_WSciFi_Thickness" vis="AnlGold" sensitive="true"/> <!-- now this is a WSciFi mixture -->
<slice name="Air_2_slice" material="Air" thickness="ffi_ZDC_Air_2_Thickness" vis="InvisibleNoDaughters"/>
</layer>
</detector>
</detectors>
<readouts>
<readout name="PhotonCalorimeterHits">
<segmentation
name="PbWO4_grid"
type="CartesianGridXY"
grid_size_x="2.0*cm"
grid_size_y="2.0*cm"
/>
<id>system:8,layer:12,slice:12,x:32:-16,y:-16</id>
</readout>
</readouts>
</lccdd>
<?xml version="1.0" encoding="UTF-8"?>
<lccdd>
<define>
<constant name="Pi" value="3.14159265359"/>
<constant name="world_side" value="30*m"/>
<constant name="world_x" value="world_side"/>
<constant name="world_y" value="world_side"/>
<constant name="world_z" value="100*m"/>
<constant name="BeamPipeB0_ID" value="1"/>
<constant name="BeamPipe_ID" value="2"/>
<include ref="compact/definitions.xml" />
<comment>
=====================================
(170-179) Compton Detectors
=====================================
Photon Tracker ID: 170 - 171
Photon Calorimeter ID: 172 - 173
Electron Tracker ID: 175 - 179
</comment>
<constant name="photon_tracker_ID" value="170"/>
<constant name="photon_calorimeter_ID" value="172"/>
<constant name="electron_tracker_1_ID" value="175"/>
<constant name="electron_tracker_2_ID" value="176"/>
<constant name="electron_tracker_3_ID" value="177"/>
<constant name="electron_tracker_4_ID" value="178"/>
<comment>
=====================================
(180-189) Forward Beamline Magnets
=====================================
</comment>
</define>
<includes>
<gdmlFile ref="compact/elements.xml"/>
<gdmlFile ref="compact/materials.xml"/>
</includes>
<display>
<include ref="compact/colors.xml" />
<include ref="compact/display.xml" />
</display>
<!--include ref="compact/photon_tracker.xml" /-->
<!--include ref="compact/photon_calorimeter.xml" /-->
<!--include ref="compact/electron_tracker.xml"/-->
<include ref="compact/beamline.xml" />
</lccdd>
from __future__ import absolute_import, unicode_literals
import os
import time
import logging
import argparse
parser = argparse.ArgumentParser(
prog='checkOverlaps.py',
description='''Runs geant overlap checking ''',
epilog='''
This program runs geant4 to find geometry overlaps.
''')
parser.add_argument("-c", "--compact", help="compact detector file",default="athena.xml")
parser.add_argument("-r", "--resolution", help="number of points on surface",default="10000")
parser.add_argument("-t", "--tolerance", help="minimum distance (in mm) to report overlaps",default="0.1")
parser.add_argument("-v", "--verbose", help="print output", action='store_true')
args = parser.parse_args()
import DDG4
from g4units import keV, GeV, mm, ns, MeV
def run():
kernel = DDG4.Kernel()
description = kernel.detectorDescription()
kernel.loadGeometry(str("file:" + args.compact))
DDG4.importConstants(description)
geant4 = DDG4.Geant4(kernel)
ui = geant4.setupCshUI(ui=None)
ui.Commands = [
'/geometry/test/resolution {}'.format(args.resolution),
'/geometry/test/tolerance {}'.format(args.tolerance),
'/geometry/test/verbosity {}'.format(1 if args.verbose else 0),
'/geometry/test/run'
]
kernel.configure()
kernel.initialize()
kernel.run()
kernel.terminate()
if __name__ == "__main__":
run()
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Shapes.h"
#include "TMath.h"
#include "DDRec/Surface.h"
#include "DDRec/DetectorData.h"
#include "XML/Layering.h"
using namespace std;
using namespace dd4hep;
using namespace dd4hep::rec;
using namespace ROOT::Math;
static Ref_t build_magnet(Detector& dtor, xml_h e, SensitiveDetector /* sens */) {
xml_det_t x_det = e;
int det_id = x_det.id();
string det_name = x_det.nameStr();
xml_dim_t pos = x_det.child(_U(placement));
double pos_x = pos.x();
double pos_y = pos.y();
double pos_z = pos.z();
double pos_theta = pos.attr<double>(_U(theta));
xml_dim_t dims = x_det.dimensions();
double dim_r = dims.r();
double dim_z = dims.z();
xml_dim_t apperture = x_det.child(_Unicode(apperture));
double app_r = apperture.r();
xml_dim_t coil = x_det.child(_Unicode(coil));
double coil_x = coil.dx();
double coil_y = coil.dy();
Material iron = dtor.material("Vacuum");
Material niobium = dtor.material("Vacuum");
//std::cout << det_name << " positioned at z=" << pos.z() << ", x=" << pos.x() << "\n";
DetElement sdet(det_name, det_id);
Assembly assembly(det_name + "_assembly");
const string module_name = "Quad_magnet";
const string yoke_vis = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "GreenVis");
const string coil_vis = dd4hep::getAttrOrDefault(coil, _Unicode(vis), "RedVis");
sdet.setAttributes(dtor, assembly, x_det.regionStr(), x_det.limitsStr(), yoke_vis);
// -- yoke
Tube yoke_tube(app_r + coil_y, dim_r, 0.5*dim_z);
Volume yoke_vol("yoke_vol", yoke_tube, iron);
auto yoke_pv = assembly.placeVolume(yoke_vol);
yoke_pv.addPhysVolID("element", 1);
DetElement yoke_de(sdet, "yoke_de", 1);
yoke_de.setPlacement(yoke_pv);
yoke_de.setAttributes(dtor, yoke_vol, x_det.regionStr(), x_det.limitsStr(), yoke_vis);
// -- coils
double offset = 1.5 * coil_x;
double appc_r = app_r + 0.5 * coil_y;
double offset_angle = atan(offset / appc_r);
Tube longrod(app_r, app_r + coil_y, 0.5*dim_z, atan(coil_x / app_r));
Tube connector(app_r, app_r + coil_y , coil_y, 0.5*M_PI - offset_angle);
UnionSolid coil1(longrod, longrod, Transform3D(RotationZ(-offset_angle)));
UnionSolid coil2(coil1, longrod, Transform3D(RotationZ(0.5*M_PI)));
UnionSolid coil3(coil2, longrod, Transform3D(RotationZ(M_PI)));
UnionSolid coil4(coil3, longrod, Transform3D(RotationZ(1.5*M_PI)));
UnionSolid coil5(coil4, longrod, Transform3D(RotationZ(0.5*M_PI - offset_angle)));
UnionSolid coil6(coil5, longrod, Transform3D(RotationZ(M_PI - offset_angle)));
UnionSolid coil7(coil6, longrod, Transform3D(RotationZ(1.5*M_PI - offset_angle)));
UnionSolid coil8(coil7, connector, Transform3D(Translation3D(0.0, 0.0, -0.5*dim_z + coil_y)));
UnionSolid coil9(coil8, connector, Transform3D(Translation3D(0.0, 0.0, -0.5*dim_z + coil_y) * RotationZ(0.5*M_PI)));
UnionSolid coil10(coil9, connector, Transform3D(Translation3D(0.0, 0.0, -0.5*dim_z + coil_y) * RotationZ(M_PI)));
UnionSolid coil11(coil10, connector, Transform3D(Translation3D(0.0, 0.0, -0.5*dim_z + coil_y) * RotationZ(1.5*M_PI)));
UnionSolid coil12(coil11, connector, Transform3D(Translation3D(0.0, 0.0, 0.5*dim_z - coil_y)));
UnionSolid coil13(coil12, connector, Transform3D(Translation3D(0.0, 0.0, 0.5*dim_z - coil_y) * RotationZ(0.5*M_PI)));
UnionSolid coil14(coil13, connector, Transform3D(Translation3D(0.0, 0.0, 0.5*dim_z - coil_y) * RotationZ(M_PI)));
UnionSolid coil15(coil14, connector, Transform3D(Translation3D(0.0, 0.0, 0.5*dim_z - coil_y) * RotationZ(1.5*M_PI)));
Volume coil_vol("coil_vol", coil14, niobium);
auto coil_pos = Transform3D(RotationZ(0.5*M_PI - offset_angle));
auto coil_pv = assembly.placeVolume(coil_vol, coil_pos);
DetElement coil_de(sdet, "coil_de", 2);
coil_de.setAttributes(dtor, coil_vol, x_det.regionStr(), x_det.limitsStr(), coil_vis);
coil_de.setPlacement(coil_pv);
// -- finishing steps
auto final_pos = Transform3D(Translation3D(pos_x, pos_y, pos_z) * RotationY(pos_theta));
auto pv = dtor.pickMotherVolume(sdet).placeVolume(assembly, final_pos);
pv.addPhysVolID("system", det_id);
sdet.setPlacement(pv);
assembly->GetShape()->ComputeBBox();
return sdet;
}
DECLARE_DETELEMENT(compton_CylindricalDipoleMagnet, build_magnet)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment