Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • EIC/detectors/athena
  • zwzhao/athena
  • FernandoTA/athena
  • palspeic/athena
4 results
Show changes
Commits on Source (238)
Showing
with 922 additions and 411 deletions
...@@ -22,3 +22,10 @@ ip6 ...@@ -22,3 +22,10 @@ ip6
*.swp *.swp
fieldmaps
manifest.txt
acts.txt
acts2.txt
materials-map.cbor
...@@ -6,6 +6,7 @@ workflow: ...@@ -6,6 +6,7 @@ workflow:
- if: '$CI_PIPELINE_SOURCE == "web"' - if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_PIPELINE_SOURCE == "webide"' - if: '$CI_PIPELINE_SOURCE == "webide"'
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "acadia"'
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
default: default:
...@@ -30,10 +31,9 @@ default: ...@@ -30,10 +31,9 @@ default:
stages: stages:
- config - config
- initialize
- build - build
- test
- docs - docs
- test
- collect - collect
- finalize - finalize
- deploy - deploy
...@@ -47,7 +47,7 @@ common:setup: ...@@ -47,7 +47,7 @@ common:setup:
script: script:
- export JUGGLER_DETECTOR="athena" - export JUGGLER_DETECTOR="athena"
- | - |
if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" || "$CI_COMMIT_BRANCH" == "master" ]]; then # if [[ "x${CI_PIPELINE_SOURCE}" == "xmerge_request_event" || "$CI_COMMIT_BRANCH" == "master" ]]; then
export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}" export JUGGLER_DETECTOR_VERSION="${CI_COMMIT_REF_NAME}"
echo "BEAMLINE_CONFIG = ${BEAMLINE_CONFIG}" echo "BEAMLINE_CONFIG = ${BEAMLINE_CONFIG}"
echo "BEAMLINE_CONFIG_VERSION = ${BEAMLINE_CONFIG_VERSION}" echo "BEAMLINE_CONFIG_VERSION = ${BEAMLINE_CONFIG_VERSION}"
...@@ -55,35 +55,42 @@ common:setup: ...@@ -55,35 +55,42 @@ common:setup:
echo "JUGGLER_DETECTOR_VERSION = ${CI_COMMIT_REF_NAME}" echo "JUGGLER_DETECTOR_VERSION = ${CI_COMMIT_REF_NAME}"
echo "JUGGLER_DETECTOR_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env echo "JUGGLER_DETECTOR_VERSION=$CI_COMMIT_REF_NAME" >> juggler.env
echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env echo "JUGGLER_DETECTOR=$JUGGLER_DETECTOR" >> juggler.env
fi #fi
- source setup/bin/env.sh && ./setup/bin/install_common.sh - source setup/bin/env.sh && ./setup/bin/install_common.sh
common:detector: common:detector:
stage: initialize stage: build
needs: ["common:setup"] needs:
- common:setup
script: script:
- source .local/bin/env.sh && build_detector.sh #- source .local/bin/env.sh && build_detector.sh
- mkdir_local_data_link sim_output - build_detector.sh
- mkdir -p results - mkdir -p results
- mkdir -p config - mkdir -p config
- mkdir -p doc - mkdir -p doc
- mkdir -p geo - mkdir -p geo
- print_env.sh - print_env.sh
compile: build:simple:
stage: build stage: build
needs:
- ["common:detector"]
script: script:
- mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install && cd .. - mkdir -p build && cd build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j20 && make install && cd ..
- echo "Build successful." - echo "Build successful."
.views: .views:
stage: docs stage: docs
tags:
- phy-scratch
before_script:
- source .local/bin/env.sh
- env
- pip3 install psutil
needs: needs:
- ["common:detector"] - ["common:detector"]
include: include:
- local: 'views/generate_prim_files.yml'
- local: 'views/view1.yml' - local: 'views/view1.yml'
- local: 'views/view2.yml' - local: 'views/view2.yml'
- local: 'views/view3.yml' - local: 'views/view3.yml'
...@@ -94,20 +101,67 @@ include: ...@@ -94,20 +101,67 @@ include:
- local: 'views/view13.yml' - local: 'views/view13.yml'
- local: 'views/view14.yml' - local: 'views/view14.yml'
- local: 'views/view15.yml' - local: 'views/view15.yml'
- local: 'views/view20.yml'
dump_geometry: dump_geometry:
stage: test stage: test
needs: needs:
- common:detector - common:detector
script: script:
- echo "dumping geometry" - echo "dumping geometry"
- mkdir -p geo ## DEBUG
## full geo with downstream beamline - echo "LD_LIBRARY_PATH - $LD_LIBRARY_PATH"
- dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/athena.xml - echo "PATH - $PATH"
## only central detector geo - print_env.sh
- sed -i '/forward_ion_beamline/d' ${DETECTOR_PATH}/athena.xml ## DEBUG
- sed -i '/far_forward/d' ${DETECTOR_PATH}/athena.xml - mkdir -p geo
- dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/athena.xml - |
sed -i -e '/<detectors>/,/<\/detectors>/d' ${DETECTOR_PATH}/compact/tracking_config*.xml
mv ${DETECTOR_PATH}/compact/display_geoviewer.xml ${DETECTOR_PATH}/compact/display.xml
for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
echo $xml
geo_name=`basename $xml .xml`_geo.root
cp $xml ${DETECTOR_PATH}/geo.xml
dd_web_display --output geo/${geo_name} ${DETECTOR_PATH}/geo.xml
done
## Lower-resolution display of the pfRICH sensors for global views
- sed -i 's/_default"\/>/_lores"\/>/' ${DETECTOR_PATH}/compact/pfrich.xml
## full geo with downstream beamline
- dd_web_display --output geo/detector_geo_full.root ${DETECTOR_PATH}/athena.xml
## only central detector geo
- sed -i '/forward_ion_beamline/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/beampipe_hadron_B0/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/B0_/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/far_forward_offM/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/far_forward_detectors/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/roman_pots/d' ${DETECTOR_PATH}/athena.xml
- sed -i '/inner_vacuum_FF_magnets/d' ${DETECTOR_PATH}/athena.xml
- dd_web_display --output geo/detector_geo.root ${DETECTOR_PATH}/athena.xml
## print some useful output
- |
echo "Geometry viewer at:"
echo "https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo_full.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all"
echo " - Central detector view at: "
echo "https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all"
for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
geo_name=`basename $xml .xml`_geo.root
echo " - Subsystem view for `basename $xml .xml` at:"
echo " https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/${geo_name}?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all"
done
detector_documentation:
stage: docs
needs:
- common:detector
script:
- mkdir -p doc
- bash bin/build_documentation | tee doc/detector.md
#- |
# xmllint --format --xpath '//comment/text()' ${DETECTOR_PATH}/athena.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee doc/detector.md
# xmllint --format --xpath '//comment/text()' ${DETECTOR_PATH}/ip6/definitions.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
# for afile in ${DETECTOR_PATH}/compact/*.xml ; do
# xmllint --format --xpath '//comment/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
# done
report: report:
stage: finalize stage: finalize
...@@ -122,12 +176,14 @@ report: ...@@ -122,12 +176,14 @@ report:
- view_13 - view_13
- view_14 - view_14
- view_15 - view_15
- view_20
- dump_constants - dump_constants
- dump_geometry - dump_geometry
- convert_to_gdml - dump_gdml
script: script:
- pip3 install jinja2 && ls -lrth - pip3 install jinja2 && ls -lrth
- ./bin/make_images > doc/dawn_views.md - ./bin/make_images > doc/dawn_views.md
- echo "Geometry viewer at https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/${CI_JOB_ID}/artifacts/raw/geo/detector_geo_full.root?job=finalize&item=default;1&opt=clipxyz;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&"
dump_constants: dump_constants:
stage: test stage: test
...@@ -141,34 +197,61 @@ overlap_check_tgeo: ...@@ -141,34 +197,61 @@ overlap_check_tgeo:
needs: needs:
- ["common:detector"] - ["common:detector"]
script: script:
## disable fibers in ECAL for normal overlap check
- sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
- sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
- checkOverlaps -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_tgeo.out - checkOverlaps -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_tgeo.out
- echo "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l) overlaps..." - echo "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi - if [[ "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
overlap_check_geant4: overlap_check_geant4:full_fast:
stage: test stage: test
needs: needs:
- ["common:detector"] - ["common:detector"]
script: script:
## disable fibers in ECAL for normal overlap check
- sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml
- sed -i '/<fiber/,+4d' ${DETECTOR_PATH}/ip6/far_forward/ZDC_Ecal_WSciFi.xml
## reduce the number of fibers in Hadron EMCal for overlap check
## not needed, as we are running with a different setup now
#- sed -i 's/radius="EcalEndcapP_FiberRadius"/radius="EcalEndcapP_FiberRadius*10"/' ${DETECTOR_PATH}/compact/ci_ecal_scfi.xml
- python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_geant4.out - python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_geant4.out
- echo "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l) overlaps..." - 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 - if [[ "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
convert_to_gdml: ## TODO: add real full overlap check as child pipeline to run on branches only
overlap_check_geant4:inner_detector:
stage: test
needs:
- ["common:detector"]
script:
- cp ${DETECTOR_PATH}/compact/subsystem_views/inner_detector.xml ${DETECTOR_PATH}/inner_detector.xml
- python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/inner_detector.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
dump_gdml:
stage: test stage: test
needs: needs:
- ["common:detector"] - ["common:detector"]
script: script:
- mkdir -p geo - mkdir -p geo
- python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/athena.xml --output geo/athena.gdml - |
python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/athena.xml --output geo/athena.gdml
for xml in ${DETECTOR_PATH}/compact/subsystem_views/*.xml; do
cp $xml ${DETECTOR_PATH}/geo.xml
gdml_name=`basename $xml .xml`.gdml
python scripts/convert_to_gdml.py --compact ${DETECTOR_PATH}/geo.xml --output geo/${gdml_name}
done
tracking_geometry_debug: tracking_geometry_debug:
stage: test stage: test
allow_failure: true
needs: needs:
- ["common:detector"] - ["common:detector"]
script: script:
- root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/athena.xml\")" | tee geo/tracking_geometry_debug.out - root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/athena.xml\")" | tee geo/tracking_geometry_debug.out
- ./bin/acts_geo_check geo/tracking_geometry_debug.out
detector:config_testing: detector:config_testing:
stage: test stage: test
...@@ -186,28 +269,6 @@ benchmarks:detector: ...@@ -186,28 +269,6 @@ benchmarks:detector:
trigger: trigger:
project: EIC/benchmarks/detector_benchmarks project: EIC/benchmarks/detector_benchmarks
strategy: depend strategy: depend
needs: ["overlap_check_tgeo","overlap_check_geant4","report"] needs:
allow_failure: true - overlap_check_geant4:full_fast
- common:detector
#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_tgeo","overlap_check_geant4","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_tgeo","overlap_check_geant4","report"]
cmake_minimum_required(VERSION 3.3 FATAL_ERROR) cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
# CMP0074: find_package() uses <PackageName>_ROOT variables
cmake_policy(SET CMP0074 NEW)
PROJECT(athena PROJECT(athena
VERSION 0.0.1 VERSION 0.0.1
LANGUAGES CXX LANGUAGES CXX
...@@ -6,20 +10,51 @@ PROJECT(athena ...@@ -6,20 +10,51 @@ PROJECT(athena
) )
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
find_package( DD4hep REQUIRED COMPONENTS DDCore DDG4 ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
find_package(Acts REQUIRED COMPONENTS Core PluginIdentification PluginTGeo PluginDD4hep ) find_package(DD4hep REQUIRED COMPONENTS DDCore DDG4)
find_package(ActsDD4hep)
if(ActsDD4hep_FOUND)
add_compile_definitions(USE_ACTSDD4HEP)
set(ActsDD4hep ActsDD4hep::ActsDD4hep)
else()
find_package(Acts REQUIRED COMPONENTS Core PluginIdentification PluginTGeo PluginDD4hep)
set(ActsDD4hep ActsCore ActsPluginDD4hep)
endif()
find_package(fmt REQUIRED)
#----------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------
set(a_lib_name athena) set(a_lib_name athena)
dd4hep_configure_output() dd4hep_configure_output()
dd4hep_add_plugin(${a_lib_name} SOURCES src/*.cpp dd4hep_add_plugin(${a_lib_name} SOURCES
USES ActsCore ActsPluginDD4hep src/BarrelBarDetectorWithSideFrame_geo.cpp
src/BarrelCalorimeter_geo.cpp
src/BarrelCalorimeterInterlayers_geo.cpp
src/BarrelTrackerWithFrame_geo.cpp
src/CompositeTracker_geo.cpp
src/CylinderTrackerBarrel_geo.cpp
src/DIRC_geo.cpp
src/DRICH_geo.cpp
src/PFRICH_geo.cpp
src/FileLoader.cpp
src/FieldMapBrBz.cpp
src/GaseousRICH_geo.cpp
src/GeometryHelpers.cpp
src/HomogeneousCalorimeter_geo.cpp
src/HybridCalorimeter_geo.cpp
src/MRich_geo.cpp
src/PolyhedraEndcapCalorimeter2_geo.cpp
src/ScFiCalorimeter_geo.cpp
src/ShashlikCalorimeter_geo.cpp
src/SimpleDiskDetector_geo.cpp
src/SolenoidCoil_geo.cpp
src/TrapEndcapTracker_geo.cpp
USES ${ActsDD4hep}
) )
target_link_libraries(${a_lib_name} target_link_libraries(${a_lib_name}
PUBLIC DD4hep::DDCore DD4hep::DDRec PUBLIC DD4hep::DDCore DD4hep::DDRec fmt::fmt
) )
#----------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------
...@@ -28,3 +63,15 @@ install(DIRECTORY compact/ ...@@ -28,3 +63,15 @@ install(DIRECTORY compact/
DESTINATION share/${PROJECT_NAME}/${a_lib_name} DESTINATION share/${PROJECT_NAME}/${a_lib_name}
FILES_MATCHING PATTERN "*.xml" FILES_MATCHING PATTERN "*.xml"
) )
install(DIRECTORY compact/
DESTINATION share/${PROJECT_NAME}/compact
FILES_MATCHING PATTERN "*.xml"
)
install(FILES athena.xml
DESTINATION share/${PROJECT_NAME}/
)
#-----------------------------------------------------------------------------------
# Install the detector calibration files.
install(DIRECTORY calibrations/
DESTINATION share/${PROJECT_NAME}/calibrations
)
...@@ -3,22 +3,34 @@ Overview ...@@ -3,22 +3,34 @@ Overview
The Athena Detector at IP6 for Electron-Ion Collider experiment. The Athena Detector at IP6 for Electron-Ion Collider experiment.
**Detector geometry viewer:** **Detector geometry viewer:**
- [Central detector geometry](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/geo/detector_geo.root?job=report&item=default;1&opt=clipxyz;transp30;zoom100;ROTY0;ROTZ0;trz100;trr0;ctrl;all&) - [Central detector](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/detector_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [Full Detector geometry (including beamline)](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/geo/detector_geo_full.root?job=report&item=default;1&opt=clipxyz;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all&) - [Full Detector (including beamline)](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/detector_geo_full.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all)
- [Inner detector (without calorimetry)](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/inner_detector_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
<a href="https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/images/view01.pdf?job=report"> - Subsystem views:
<img src="https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/images/view01.png?job=report" width="400px" /> - [Calorimetry](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/calorimeters_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [PID](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/pid_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [dRICH](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/drich_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all)
- [pfRICH](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/pfrich_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all&)
- [DIRC](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/dirc_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [ToF](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/tof_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all&)
- [Tracking](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/tracking_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [Vertex detector](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/vertex_only_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- [Far-forward](https://eic.phy.anl.gov/geoviewer/index.htm?nobrowser&file=https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/geo/ip6_geo.root?job=dump_geometry&item=default;1&opt=clipx;clipy;transp30;zoom40;ROTY290;ROTZ350;trz0;trr0;ctrl;all)
<a href="https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/images/view01.pdf?job=report">
<img src="https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/images/view01.png?job=report" width="400px" />
</a> </a>
<br /> <br />
<a href="https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/images/view01_top.pdf?job=report"> <a href="https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/images/view01_top.pdf?job=report">
<img src="https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/images/view01_top.png?job=report" width="400px" /> <img src="https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/images/view01_top.png?job=report" width="400px" />
</a> </a>
[Browse latest](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/browse/images?job=report) [Browse latest](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/browse/images?job=report)
[Detector views](views/detector_views.md) [Detector views](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/doc/dawn_views.md?job=report)
[Constants listing](https://eicweb.phy.anl.gov/EIC/detectors/athena/-/jobs/artifacts/master/raw/doc/constants.out?job=report)
Getting Started Getting Started
--------------- ---------------
......
<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" <lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
<debug>
<type name="surface" value="0"/>
<type name="material" value="0"/>
<type name="readout" value="0"/>
<type name="segmentation" value="0"/>
<type name="limits" value="0"/>
<type name="region" value="0"/>
<type name="includes" value="0"/>
</debug>
<documentation level="-1">
# Athena Detector
- https://eicweb.phy.anl.gov/EIC/detectors/athena.git
- https://eicweb.phy.anl.gov/EIC/detectors/ip6.git
</documentation>
<!-- Some information about detector --> <!-- Some information about detector -->
<info name="Athena Detector" title="Athena Detector" <info name="Athena Detector" title="Athena Detector"
author="Jihee Kim, Whitney Armstrong" author="Athena Collaboration"
url="https://eicweb.phy.anl.gov/EIC/detectors/athena.git" url="https://eicweb.phy.anl.gov/EIC/detectors/athena.git"
status="development" status="development"
version="v1 2021-03-16"> version="v1 2021-03-16">
<comment>Athena Detector</comment> <comment> Athena </comment>
</info> </info>
<define> <define>
<include ref="ip6/ip6_defs.xml" /> <comment> IP definitions should be first</comment> <documentation level="2">
## Main Constant Definitions
The ip6 (or other ip) defines should be included first.
These files have only a define tags.
</documentation>
<include ref="ip6/definitions.xml" />
<include ref="ip6/far_forward/fields_275.xml" />
<include ref="compact/definitions.xml" /> <include ref="compact/definitions.xml" />
</define> </define>
<properties>
<matrix name="RINDEX__Vacuum" coldim="2" values="
1.0*eV 1.0
5.1*eV 1.0
"/>
<matrix name="RINDEX__Air" coldim="2" values="
1.0*eV 1.00029
5.1*eV 1.00029
"/>
<matrix name="RINDEX__Quartz" coldim="2" values="
1.0*eV 1.46
5.1*eV 1.46
"/>
<matrix name="RINDEX__N2" coldim="2" values="
1.0*eV 1.00033
4.0*eV 1.00033
5.1*eV 1.00033
"/>
<matrix name="RINDEX__Pyrex" coldim="2" values="
1.0*eV 1.5
4.0*eV 1.5
5.1*eV 1.5
"/>
<matrix name= "REFLECTIVITY_mirror" coldim="2" values="
1.0*eV 0.9
4.0*eV 0.9
5.1*eV 0.9
"/>
</properties>
<includes> <includes>
<gdmlFile ref="compact/elements.xml"/> <gdmlFile ref="compact/elements.xml"/>
<gdmlFile ref="compact/materials.xml"/> <gdmlFile ref="compact/materials.xml"/>
<file ref="compact/optical_materials.xml"/>
</includes> </includes>
<materials>
<material name="AirOptical">
<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"/>
<property name="RINDEX" ref="RINDEX__Vacuum"/>
</material>
<material name="N2cherenkov">
<D type="density" value="0.00125" unit="g/cm3"/>
<composite n="1" ref="N"/>
<property name="RINDEX" ref="RINDEX__N2"/>
</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"/>
<property name="RINDEX" ref="RINDEX__Pyrex"/>
</material>
</materials>
<surfaces>
<comment> For the values of "finish", model and type, see TGeoOpticalSurface.h !
</comment>
<opticalsurface finish="polished" model="glisur" name="MirrorOpticalSurface" type="dielectric_metal" value="0">
<property name="REFLECTIVITY" ref="REFLECTIVITY_mirror"/>
<property name="RINDEX" coldim="2" values="1.034*eV 1.5 4.136*eV 1.5"/>
<!--<property name="EFFICIENCY" ref="EFFICIENCY0x8b77240"/>-->
</opticalsurface>
<opticalsurface name="mirror2" finish="polished" model="glisur" type="dielectric_dielectric">
<property name="REFLECTIVITY" coldim="2" values="1.034*eV 0.8 4.136*eV 0.9"/>
<property name="EFFICIENCY" coldim="2" values="2.034*eV 0.8 4.136*eV 1.0"/>
<property name="RINDEX" coldim="2" values="1.034*eV 1.5 4.136*eV 1.5"/>
</opticalsurface>
<!-- Define the dimensions of the world volume -->
</surfaces>
<limits> <limits>
<limitset name="EICBeamlineLimits"> <limitset name="EICBeamlineLimits">
<limit name="step_length_max" particles="*" value="1.0" unit="mm" /> <limit name="step_length_max" particles="*" value="1.0" unit="mm" />
...@@ -104,107 +58,84 @@ ...@@ -104,107 +58,84 @@
</limits> </limits>
<display> <display>
<include ref="compact/colors.xml" />
<!--include ref="compact/colors2.xml"/-->
<include ref="compact/display.xml" /> <include ref="compact/display.xml" />
<!--include ref="compact/display_detailed.xml"/-->
</display> </display>
<comment> Include the IP components first </comment> <documentation level="0">
<include ref="ip6/forward_ion_beamline.xml"/> ## Detector Subsystems
<include ref="ip6/beampipe.xml"/>
### IP Subsystems
<detectors>
<detector id="VertexBarrelSubAssembly_ID" The interaction point subsystems are included before the central detector subsystems.
name="VertexBarrelSubAssembly" This is becuase the IP subsystems, for exmaple the beampipe, will define paramters
type="DD4hep_SubdetectorAssembly" which are subsquently used in the central detector construction -- e.g. the vertex tracker
vis="TrackerSubAssemblyVis"> uses the beampipe OD to help define its placement.
<composite name="VertexBarrel" />
</detector>
<detector id="VertexEndcapSubAssembly_ID"
name="VertexEndcapSubAssembly"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="VertexEndcapN" />
<composite name="VertexEndcapP" />
</detector>
<detector id="TrackerEndcapSubAssembly_Inner_ID"
name="TrackerSubAssembly_Inner"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerEndcapN_Inner"/>
<composite name="TrackerBarrel_Inner"/>
<composite name="TrackerEndcapP_Inner"/>
</detector>
<detector id="TrackerBarrelSubAssembly_Outer_ID"
name="TrackerSubAssembly_Outer"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerBarrel_Outer"/>
<composite name="TrackerEndcapP_Outer"/>
<composite name="TrackerEndcapN_Outer"/>
</detector>
<!--
<detector id="TrackerBarrelSubAssembly_Inner_ID"
name="TrackerBarrelSubAssembly_Inner"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerBarrel_Inner"/>
</detector>
<detector id="TrackerEndcapSubAssembly_Inner_ID"
name="TrackerEndcapSubAssembly_Inner"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerEndcapN_Inner"/>
<composite name="TrackerBarrel_Inner"/>
<composite name="TrackerEndcapP_Inner"/>
</detector>
<detector id="TrackerBarrelSubAssembly_Outer_ID"
name="TrackerBarrelSubAssembly_Outer"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerBarrel_Outer"/>
</detector>
<detector id="TrackerEndcapSubAssembly_Outer_ID"
name="TrackerEndcapSubAssembly_Outer"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="TrackerEndcapP_Outer"/>
<composite name="TrackerEndcapN_Outer"/>
</detector>
-->
</detectors>
<include ref="compact/vertex_tracker.xml"/>
<include ref="compact/central_tracker.xml"/>
<!--
<include ref="compact/rwell_tracker_barrel.xml"/>
<include ref="compact/cb_DIRC.xml"/>
-->
The IP subsystems include the Far forward and backward regions. The list of subsystem includes:
- Interaction region beampipe
- B0 tracker
- Off-momentum tracker
- Far forward roman pots
- Zero Degree Calorimeter
- Beam line magnets.
- and more...
</documentation>
<documentation level="5">
## Main magnet
Note: When changing magnet, also select dimensions in definitions.xml.
</documentation>
<include ref="compact/solenoid.xml"/> <include ref="compact/solenoid.xml"/>
<documentation level="10">
## Central tracking detectors
</documentation>
<!--include ref="compact/tracking_config_acadia.xml"/-->
<!--include ref="compact/tracking_config_canyonlands.xml"/-->
<include ref="compact/tracking_config_deathvalley.xml"/>
<documentation level="10">
### PID detectors
</documentation>
<!--include ref="compact/pid_config_acadia.xml" /-->
<!--include ref="compact/pid_config_canyonlands.xml" /-->
<include ref="compact/pid_config_deathvalley.xml" />
<documentation level="10">
## Central calorimetry
</documentation>
<include ref="compact/ecal.xml"/> <include ref="compact/ecal.xml"/>
<include ref="compact/hcal.xml"/> <include ref="compact/hcal.xml"/>
<!--include ref="compact/ce_GEM.xml"/-->
<!--include ref="compact/gem_tracker_endcap.xml"/--> <documentation level="11">
<include ref="compact/ce_mrich.xml"/> ## Far foward detectors
<include ref="compact/tof_endcap.xml"/> </documentation>
<include ref="compact/forward_trd.xml"/> <include ref="ip6/central_beampipe.xml"/>
<include ref="compact/forward_rich.xml"/>
<documentation level="11">
<include ref="compact/B0_tracker.xml"/> ## Far foward detectors
<include ref="compact/far_forward_offM_tracker.xml"/> </documentation>
<include ref="compact/far_forward_romanpots.xml"/> <include ref="ip6/far_forward.xml"/>
<include ref="compact/far_forward_detectors.xml"/>
<documentation level="11">
<!-- ## Far backward detectors
<include ref="compact/mm_tracker_barrel.xml"/> </documentation>
<include ref="compact/cb_VTX_Barrel.xml"/> <include ref="ip6/far_backward.xml"/>
-->
<comment>
FB elements
-----------
None (TODO)
What is FB?
</comment>
<readouts> <readouts>
</readouts> </readouts>
</lccdd> </lccdd>
#!/bin/bash
logfile=$1
# parse the verobse output of scripts/test_ACTS.cxx
res=0
nlines=$(grep -in error ${logfile} | grep -in D2A_ | wc -l)
if [[ "$nlines" > "0" ]] ; then
echo " ACTS geometry error: "
grep -in error ${logfile} | grep -in D2A_
res="1"
fi
nlines=$(grep -in warn ${logfile} | grep -in D2A_ | wc -l)
if [[ "$nlines" > "0" ]] ; then
echo " ACTS geometry error: "
grep -in warn ${logfile} | grep -in D2A_
res="1"
fi
exit ${res}
#!/bin/bash
#included files
detector_file="./athena.xml"
#filelist=$(xmllint --format --xpath '//include/@ref' ${detector_file} | sed 's/ref=\"//g' | sed 's/\"/\n/g' )
#echo $filelist
# Searches for included files two levels down
get_includes() {
local input_file="${1}"
#echo ${1}
local filelist=$(xmllint --format --xpath '//include/@ref' ${input_file} | sed 's/ref=\"//g' | sed 's/\"//g' )
for afile in $filelist ; do
xmllint --format --xpath '//include/@ref' ${input_file} &> /dev/null
local res="$?"
if [ "${res}" == "0" ] ; then
local subincluded=$(xmllint --format --xpath '//include/@ref' ${input_file} 2> /dev/null | sed 's/ref=\"//g' | sed 's/\"//g' )
filelist="${filelist} ${subincluded}"
#echo "sub include $afile"
fi
done
# <includes > <gdmlFile > <file>
local otherfiles=$(xmllint --format --xpath '//includes/file/@ref | //includes/gdmlFile/@ref' ${input_file} | sed 's/ref=\"//g' | sed 's/\"/\n/g' )
#echo $otherfiles
filelist=$(echo "${filelist} ${otherfiles}" | sed 's/ /\n/g' | sort | uniq )
echo "$input_file $filelist"
}
xml_files=$(get_includes ${detector_file})
#echo $xml_files
get_doc_levels() {
# levels
local levels=0
for afile in $xml_files ; do
xmllint --format --xpath '//documentation/@level' $afile &> /dev/null
local res="$?"
if [ "${res}" == "0" ] ; then
local new_levels=$(xmllint --format --xpath '//documentation/@level' $afile 2> /dev/null | sed 's/level=\"/ /g' | sed 's/\"//g' )
levels="${levels} ${new_levels}"
fi
# see if there are tags without level attribute
xmllint --format --xpath '//documentation[not(@level)]' $afile &> /dev/null
if [ "${?}" == "0" ] ; then
#echo "DERP"
levels="${levels} 100"
fi
done
echo "$levels" | sed 's/ /\n/g' | sort | uniq
}
all_levels=$(get_doc_levels ${xml_file_array})
#echo " levels: "
#echo $all_levels
for alevel in $(echo ${all_levels} | sed 's/ /\n/g' | sort -n | uniq ) ; do
#echo " doing level $alevel ..."
for afile in $(echo $xml_files | sed 's/ / \n/g') ; do
#echo $afile
#xmllint --format --xpath '//documentation[@level="'"$alevel"'"]/text()' $afile
level_doc=$(xmllint --format --xpath '//documentation[@level="'$alevel'"]' ${afile} 2> /dev/null )
if [ "$?" -eq "0" ] ; then
xmllint --format --xpath '//documentation[@level="'$alevel'"]/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/g'
fi
# sets the tags without attribute level to 100
xmllint --format --xpath '//documentation[not(@level)]/text()' ${afile} &> /dev/null
if [ "$?" -eq "0" ] ; then
if [ "$alevel" -eq "100" ] ; then
xmllint --format --xpath '//documentation[not(@level)]/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/g'
fi
fi
done
done
#${DETECTOR_PATH}=.
#
#
#xmllint --format --xpath '//
#
#xmllint --format --xpath '//documentation/text()' ${DETECTOR_PATH}/athena.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee doc/detector.md
#xmllint --format --xpath '//documentation/text()' ${DETECTOR_PATH}/ip6/ip6_defs.xml | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
#for afile in ${DETECTOR_PATH}/compact/*.xml ; do
# xmllint --format --xpath '//documentation/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/' | tee -a doc/detector.md || true
#done
#
...@@ -99,6 +99,20 @@ do ...@@ -99,6 +99,20 @@ do
shift # past argument shift # past argument
shift # past value 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) -i|--input)
OUT_FILE="$2" OUT_FILE="$2"
shift # past argument shift # past argument
......
#!/bin/bash
npsim --enableG4GPS \
--compact athena.xml \
--runType vis \
--macro macro/mrich_vis.mac \
-O derp.root
#!/usr/local/bin/python
# 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=3600,
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)
# adjust fiber radius to reduce the number of fibers
compact_dir = os.path.dirname(os.path.realpath(args.compact))
ci_ecal = os.path.join(compact_dir, 'compact', 'ci_ecal_scfi.xml')
os.system('sed -i \'s/radius=\"EcalEndcapP_FiberRadius\"/radius=\"EcalEndcapP_FiberRadius*10\"/\' {}'.format(ci_ecal))
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)
# revert the change
os.system('sed -i \'s/radius=\"EcalEndcapP_FiberRadius*10\"/radius=\"EcalEndcapP_FiberRadius\"/\' {}'.format(ci_ecal))
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))
#!/bin/bash #!/usr/local/bin/python
#git clone --depth 1 https://eicweb.phy.anl.gov/EIC/datasets.git # get dawn view of detectors
export DAWN_PS_PREVIEWER="ls " # W. Armstrong (ANL), original bash script
export G4DAWNFILE_VIEWER="ls -lrth " # C. Peng (ANL), translate to python and add flexible run time for simulation
export G4DAWNFILE_PS_VIEWER="ls "
import os
function print_the_help { import signal
echo "USAGE: ${0} [-s <skip_events>] -d <dawn_run_dir> " import subprocess
echo " OPTIONS: " import argparse
echo " -D,--detector-only Only generate the prim files for the detector geometry." import atexit
echo " -s,--skip <skip_events> Required run number" import time
echo " -i,--input <input_file> Input hepmc file" from datetime import datetime
echo " -d,--dawn-dir <dawn_run_dir> Directory with the .DAWN files and a generate script " import fcntl
echo " -t,--tag <file_tag> Output file tag" import psutil
exit
}
def readline_nonblocking(output):
function yes_or_no { fd = output.fileno()
while true; do fl = fcntl.fcntl(fd, fcntl.F_GETFL)
read -p "$* [y/n]: " yn fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
case $yn in try:
[Yy]*) return 0 ;; return output.readline()
[Nn]*) echo "No entered" ; return 1 ;; except:
esac return ''
done
}
# arguments
if [[ $# -eq 0 ]] ; then parser = argparse.ArgumentParser()
print_the_help
exit parser.add_argument('-c', '--compact-file', type=str, dest='compact',
fi default=os.path.join(os.environ.get('DETECTOR_PATH', '.'), 'athena.xml'),
help='Top level compact file for detectors')
SKIP_EVENTS=0
DETECTOR_ONLY=0 parser.add_argument('-s', '--skip', type=int,
FILE_TAG="view" default=0,
DAWN_RUN_DIR="scripts/view1" help='Number of events number to skip in the input')
DETECTOR_FILE="${DETECTOR_PATH}/athena.xml"
parser.add_argument('-i', '--input', type=str, dest='input',
POSITIONAL=() default='sim_output',
while [[ $# -gt 0 ]] help='Input hepmc file')
do
key="$1" parser.add_argument('-o', '--output-dir', type=str, dest='out_dir',
default='images',
case $key in help='output directory')
-h|--help)
shift # past argument parser.add_argument('-D', '--detector-only', action='store_true', dest='detector_only',
print_the_help help='only generate the prim files for the detector geometry')
;;
-c|--compact-file) parser.add_argument('-d', '--dawn-dir', type=str, dest='dawn_dir',
DETECTOR_FILE="$2" default='scripts/view1',
shift # past argument help='Directory to dawn script dir (with .DAWN files and a generate_eps script)')
shift # past value
;; parser.add_argument('-t', '--tag', type=str,dest='file_tag',
-s|--skip) default='view',
SKIP_EVENTS="$2" help='Output file tag')
shift # past argument
shift # past value parser.add_argument('--timeout', type=int,
;; default=60,
-i|--input) help='Timeout in seconds')
INPUT_FILE="$2"
shift # past argument parser.add_argument('passthrough', nargs='*')
shift # past value
;; args = parser.parse_args()
-o|--ouput-dir)
OUTPUT_DIR="$2" macro = 'macro/dawn_picture.mac' if args.detector_only else 'macro/dawn_picture2.mac'
shift # past argument
shift # past value # raise error if cannot create a temporary working dir
;; # os.makedirs('dawn_view_tmp', exist_ok=False)
-D|--detector-only) os.makedirs(args.out_dir, exist_ok=True)
DETECTOR_ONLY=1
shift # past argument # use absolute path so the chdir does not affect them
#shift # past value args.input = os.path.abspath(args.input)
;; args.out_dir = os.path.abspath(args.out_dir)
-d|--dawn-dir) args.compact = os.path.abspath(args.compact)
DAWN_RUN_DIR=$2 macro = os.path.abspath(macro)
shift # past argument
shift # past value prim_file = 'g4_0000.prim'
;; dawn_env = os.environ.copy()
-t|--tag) dawn_env['DAWN_BATCH'] = 'a'
FILE_TAG=$2 # sdir = os.path.dirname(os.path.realpath(__file__))
shift # past argument
shift # past value
;; # generate DAWN images
*) # unknown option out_dir = os.path.abspath(args.out_dir)
#POSITIONAL+=("$1") # save it in an array for later input_file = os.path.abspath(args.input)
echo "unknown option $1" #prim_file = '{}/{}.prim'.format(input_dir,args.file_tag)
print_the_help #prim_file = os.path.abspath(prim_file)
shift # past argument owd = os.getcwd()
;; os.chdir(args.dawn_dir)
esac subprocess.run(['pwd'])
done subprocess.run(['./generate_eps', '-t', args.file_tag, '-i', input_file] + args.passthrough)
set -- "${POSITIONAL[@]}" # restore positional parameters subprocess.run(['ls', '-lrth'])
# upload the results
rm -f *.prim os.system('cp *.pdf {}'.format(out_dir))
os.system('cp *.png {}'.format(out_dir))
if [ "${DETECTOR_ONLY}" -eq "1" ] ; then os.chdir(owd)
./scripts/run_detector_simulation.py \
--compact ${DETECTOR_PATH}/athena.xml \
-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_detector_simulation.py \
--compact ${DETECTOR_PATH}/athena.xml \
-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_detector_simulation.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_detector_simulation.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_detector_simulation.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
...@@ -7,9 +7,15 @@ env = Environment( ...@@ -7,9 +7,15 @@ env = Environment(
autoescape=select_autoescape(['html', 'xml']) autoescape=select_autoescape(['html', 'xml'])
) )
import os
import glob import glob
base_url = "https://eicweb.phy.anl.gov/api/v4/projects/390/jobs/artifacts/master/raw" if "CI_PROJECT_ID" in os.environ:
CI_PROJECT_ID = str(os.environ["CI_PROJECT_ID"])
else:
CI_PROJECT_ID = "473"
base_url = f"https://eicweb.phy.anl.gov/api/v4/projects/{CI_PROJECT_ID}/jobs/artifacts/master/raw"
#images = ["images/view2a.png","images/view2b.png", "images/view1.png"] #images = ["images/view2a.png","images/view2b.png", "images/view1.png"]
images = glob.glob("images/*.png") images = glob.glob("images/*.png")
......
#!/bin/bash
function print_the_help {
echo "USAGE: --ebeam E --pbeam E -c compact.xml"
echo "REQUIRED ARGUMENTS:"
echo " -h|--help Print this message"
echo " --ebeam Electron beam energy (5, 10 or 18)"
echo " --pbeam Ion beam energy (41, 100 or 275)"
echo " -c|--compact Compact file to set beam energy for"
exit
}
EBEAM=
PBEAM=
COMPACT=
while [ $# -gt 0 ]
do
key="$1"
case $key in
-h|--help)
print_the_help
;;
--ebeam)
EBEAM=$2
shift
shift
;;
--pbeam)
PBEAM=$2
shift
shift
;;
-c|--compact)
COMPACT=$2
shift
shift
;;
*) # unknown option
echo "unknown option"
exit 1
;;
esac
done
echo "Setting beam energies to $EBEAM on $PBEAM for $COMPACT"
if [ -z $COMPACT ]; then
echo "Error: no compact file given, use -h for help"
exit 1
fi
if [ -z $EBEAM ]; then
echo "Error: --ebeam argument missing, use -h for help"
exit 1
fi
if [ -z $PBEAM ]; then
echo "Error: --pbeam argument missing, use -h for help"
exit 1
fi
if [[ $PBEAM != "41" && $PBEAM != "100" && $PBEAM != "275" ]]; then
echo "Error: Ion beam energy should be 41, 100, or 275 GeV"
exit 1
fi
if [[ $EBEAM != 5 && $EBEAM != 10 && $EBEAM != 18 ]]; then
echo "Error: Electron beam energy should be 5, 10, or 18 GeV"
exit 1
fi
if [ ! -f ${COMPACT} ]; then
echo "Error: Compact file ${COMPACT} does not exist"
exit 1
fi
sed -i "s?far_forward_fields_.\{2,3\}.xml?far_forward_fields_${PBEAM}.xml?" athena.xml
sed -i "s?far_backward_fields_.\{1,2\}.xml?far_backward_fields_${EBEAM}.xml?" athena.xml
## Calibrations for the ATHENA detector
Calibrations and constants for this ATHENA detector setup. These values are used in the
reconstruction. Each relevant subsystem that requires calibration data should have
its own subdirectory with relevant calibration files, preferably in JSON format.
Note that these calibrations are strongly versioned and tied directy to this specific
detector configuration. Therefore, please do not add an extra layer of versioning in the
file names, but rather only add those calibrations relevant for this particular setup.
{
"ecal_neg_endcap": {
"readout": "module",
"dynamicRange": "20*GeV",
"capacityBitsADC": 14,
"pedestalMean": 100,
"pedestalSigma": 1,
"thresholdValue": 3
},
"hcal_neg_endcap": {
"readout": "tile",
"dynamicRange": "20*MeV",
"capacityBitsADC": 8,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
},
"ecal_pos_endcap": {
"readout": "module",
"dynamicRange": "3*GeV",
"capacityBitsADC": 14,
"pedestalMean": 100,
"pedestalSigma": 0.7,
"thresholdValue": 2
},
"hcal_pos_endcap": {
"readout": "tile",
"dynamicRange": "3.6*GeV",
"capacityBitsADC": 10,
"pedestalMean": 20,
"pedestalSigma": 0.8,
"thresholdValue": 3
},
"ecal_barrel_imaging": {
"readout": "pixel",
"dynamicRange": "3*MeV",
"capacityBitsADC": 13,
"pedestalMean": 100,
"pedestalSigma": 14,
"thresholdValue": 50
},
"ecal_barrel_scfi": {
"readout": "light_guide",
"dynamicRange": "750*MeV",
"capacityBitsADC": 14,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
},
"hcal_barrel": {
"readout": "tile",
"dynamicRange": "20*MeV",
"capacityBitsADC": 8,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
}
}
{
"ecal_neg_endcap": {
"readout": "module",
"dynamicRange": "20*GeV",
"capacityBitsADC": 14,
"pedestalMean": 100,
"pedestalSigma": 1,
"thresholdValue": 3
},
"hcal_neg_endcap": {
"readout": "tile",
"dynamicRange": "20*MeV",
"capacityBitsADC": 8,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
},
"ecal_pos_endcap": {
"readout": "module",
"dynamicRange": "3*GeV",
"capacityBitsADC": 14,
"pedestalMean": 100,
"pedestalSigma": 0.7,
"thresholdValue": 2
},
"hcal_pos_endcap": {
"readout": "tile",
"dynamicRange": "3.6*GeV",
"capacityBitsADC": 10,
"pedestalMean": 20,
"pedestalSigma": 0.8,
"thresholdValue": 3
},
"ecal_barrel_imaging": {
"readout": "pixel",
"dynamicRange": "3*MeV",
"capacityBitsADC": 13,
"pedestalMean": 100,
"pedestalSigma": 14,
"thresholdValue": 50
},
"ecal_barrel_scfi": {
"readout": "light_guide",
"dynamicRange": "750*MeV",
"capacityBitsADC": 14,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
},
"hcal_barrel": {
"readout": "tile",
"dynamicRange": "20*MeV",
"capacityBitsADC": 8,
"pedestalMean": 20,
"pedestalSigma": 0.3,
"thresholdValue": 1
}
}
calo_digi_canyonlands.json
\ No newline at end of file
File added
{
"electron": {
"particle_name": "electron",
"sampling_fraction": 0.1053739677993623,
"sampling_fraction_error": 0.00014385360879111712,
"sampling_fraction_error_img": 7.262477989358573e-05,
"sampling_fraction_error_scfi": 0.0001238835428684493,
"sampling_fraction_img": 0.006008855583640059,
"sampling_fraction_scfi": 0.09940809338992981,
"thrown_energy": 5.000000028019361
}
}
{
"ffi_zdc_ecal": {
"sampling_fraction": 1.0,
"minClusterCenterEdep": "3.*MeV",
"minClusterHitEdep": "0.1*MeV",
"localDistXY": ["50*mm", "50*mm"],
"splitCluster": true
},
"ffi_zdc_hcal": {
"sampling_fraction": 1.0,
"minClusterCenterEdep": "1.*MeV",
"minClusterHitEdep": "0.1*MeV",
"localDistXY": ["200*mm", "200*mm"],
"splitCluster": false
}
}