diff --git a/.clang-format b/.clang-format
index 48164f6bb..6041e2653 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,111 +1,17 @@
---
-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
+BasedOnStyle: LLVM
+BreakConstructorInitializersBeforeComma: true
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: true
-DerivePointerAlignment: false
-DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
-FixNamespaceComments: true
-ForEachMacros:
- - foreach
- - Q_FOREACH
- - BOOST_FOREACH
+Standard: c++20
+#SpaceBeforeParens: ControlStatements
+SpaceAfterControlStatementKeyword: true
+PointerBindsToType: true
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
+ColumnLimit: 100
+NamespaceIndentation: Inner
+AlignConsecutiveAssignments: true
+SortIncludes: Never
+ReflowComments: false
...
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 140ae12d0..c0eb14386 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,4 +1,4 @@
{
- "name": "eic-shell",
- "image": "ghcr.io/eic/jug_xl:nightly"
+ "name": "eic-shell",
+ "image": "ghcr.io/eic/jug_xl:nightly"
}
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 000000000..75c7c5838
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1 @@
+2ffa142d0bd7055cfbfd9ab7838f5e0b7f6c551c # feat(ci): change pre-commit clang-format to run in ci
diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml
index fe7a81a42..449d03beb 100644
--- a/.github/workflows/linux-eic-shell.yml
+++ b/.github/workflows/linux-eic-shell.yml
@@ -173,6 +173,9 @@ jobs:
check-tracking-geometry:
runs-on: ubuntu-latest
needs: build
+ strategy:
+ matrix:
+ detector_config: [epic_craterlake, epic_ip6]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
@@ -186,9 +189,40 @@ jobs:
network_types: "none"
setup: install/setup.sh
run: |
- root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml\")" | tee check_tracking_geometry.out
+ root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/${{matrix.detector_config}}.xml\")" | tee check_tracking_geometry.out
bin/acts_geo_check check_tracking_geometry.out
+ validate-material-map:
+ runs-on: ubuntu-latest
+ needs:
+ - build
+ - check-tracking-geometry
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/download-artifact@v4
+ with:
+ name: build-gcc-full-eic-shell
+ path: install/
+ - uses: cvmfs-contrib/github-action-cvmfs@v4
+ - uses: eic/run-cvmfs-osg-eic-shell@main
+ with:
+ platform-release: "jug_xl:nightly"
+ setup: install/setup.sh
+ run: |
+ pushd scripts/material_map
+ export DETECTOR_CONFIG=epic_craterlake_material_map
+ ./run_material_map_validation.sh
+ popd
+ - uses: actions/upload-artifact@v4
+ with:
+ name: material_map
+ path: |
+ "scripts/material_map/*.json"
+ "scripts/material_map/*.root"
+ scripts/material_map/Surfaces/
+ scripts/material_map/Validation/
+ if-no-files-found: error
+
convert-to-gdml:
runs-on: ubuntu-latest
needs:
@@ -253,9 +287,9 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
+ - list-detector-configs
strategy:
- matrix:
- detector_config: [epic_craterlake_no_bhcal, epic_craterlake_tracking_only, epic_dirc_only, epic_drich_only, epic_imaging_only, epic_ip6, epic_lfhcal_with_insert]
+ matrix: ${{fromJson(needs.list-detector-configs.outputs.configs_json)}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
@@ -275,6 +309,7 @@ jobs:
declare -A detectors
while read d ; do detectors[$d]='-l 3' ; done <<< $(npdet_to_step list $DETECTOR_PATH/${{matrix.detector_config}}.xml | sed '/world/d;s/.*(vol: \(.*\)).*/\1/g')
# Then tweak the levels (default is 1)
+ detectors[HcalBarrel]='-l 1'
detectors[LFHCAL]='-l 2'
detectors[OuterBarrelMPGDSubAssembly]='-l 4'
# Export to one STEP file
diff --git a/.gitignore b/.gitignore
index afb9d6591..16ecd1f1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,9 @@ ip6_build
*.swp
-fieldmaps
+fieldmaps/
+gdml/
+calibrations/
manifest.txt
acts.txt
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c8a6affb0..236d6ff38 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,14 +1,12 @@
-ci:
- skip: [clang-format]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.5.0
+ rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
-- repo: https://github.com/pocc/pre-commit-hooks
- rev: v1.3.5
+- repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v18.1.4
hooks:
- id: clang-format
- repo: https://github.com/Lucas-C/pre-commit-hooks
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfdbad6d9..0f8da16e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,6 +113,10 @@ configure_file(templates/setup.sh.in ${CMAKE_CURRENT_BINARY_DIR}/setup.sh @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.sh
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ RENAME this${PROJECT_NAME}.sh
+)
# install programs
install(PROGRAMS bin/g4MaterialScan_to_csv
diff --git a/README.md b/README.md
index c3d5f5bfe..b26cf36ff 100644
--- a/README.md
+++ b/README.md
@@ -3,30 +3,26 @@
Overview
--------
-**Detector geometry viewer:**
-- [Viewer only](https://eic.github.io/epic/geoviewer)
-- Main configurations:
- - [CraterLake](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_craterlake.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
-- Additional viewers:
- - [Inner detector (without calorimetry)](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_inner_detector.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [Calorimetry](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_calorimeters.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [Imaging](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_imaging_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all)
- - [PID](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_pid_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [dRICH](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_drich_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all)
- - [pfRICH](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_pfrich_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all)
- - [DIRC](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_dirc_only.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [Tracking](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_tracking_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [Vertex](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_vertex_only.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all)
- - [ToF](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_tof_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all)
- - [Beamline](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_ip6.root&item=default;1&opt=clipx;clipy;transp30;zoom40;ROTY290;ROTZ350;trz0;trr0;ctrl;all)
-
-[](https://eic.github.io/epic/artifacts/epic_craterlake_views/view1_top.pdf)
+
+
+**Detector geometry:**
+- [Empty viewer](https://eic.github.io/epic/geoviewer)
+- Craterlake: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_craterlake.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [step](https://eic.github.io/epic//artifacts/epic_craterlake_no_bhcal.stp/epic_craterlake_no_bhcal.stp)
+- Subsystems:
+ - Inner detector: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_inner_detector.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_inner_detector.root)
+ - Calorimetry: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_calorimeters.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_calorimeters.root)
+ - Imaging: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_imaging_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_imaging.root) [step](https://eic.github.io/epic//artifacts/epic_imaging_only.stp/epic_imaging_only.stp)
+ - PID: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_pid_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_pid_only.root)
+ - dRICH: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_drich_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY290;ROTZ350;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_drich_only.root) [step](https://eic.github.io/epic//artifacts/epic_drich_only.stp/epic_drich_only.stp)
+ - pfRICH: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_pfrich_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_pfrich_only.root)
+ - DIRC: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_dirc_only.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_dirc_only.root) [step](https://eic.github.io/epic//artifacts/epic_dirc_only.stp/epic_dirc_only.stp)
+ - Tracking: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_tracking_only.root&item=default;1&opt=clipx;clipy;transp30;zoom75;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_tracking_only.root) [step](https://eic.github.io/epic//artifacts/epic_craterlake_tracking_only.stp/epic_craterlake_tracking_only.stp)
+ - Vertex: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_vertex_only.root&item=default;1&opt=clipx;clipy;transp30;zoom120;ROTY320;ROTZ340;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_vertex_only.root)
+ - TOF: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_tof_only.root&item=default;1&opt=clipx;clipy;transp30;zoom55;ROTY49;ROTZ350;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_tof_only.root)
+ - Beamline: [viewer](https://eic.github.io/epic/geoviewer?nobrowser&file=artifacts/tgeo/epic_ip6.root&item=default;1&opt=clipx;clipy;transp30;zoom40;ROTY290;ROTZ350;trz0;trr0;ctrl;all) [tgeo](https://eic.github.io/epic//artifacts/tgeo/epic_ip6.root) [step](https://eic.github.io/epic//artifacts/epic_ip6.stp/epic_ip6.stp)
**Detector parameters:**
-- text: [CraterLake](https://eic.github.io/epic/artifacts/constants/epic_craterlake_constants.out)
-- toml: [CraterLake](https://eic.github.io/epic/artifacts/constants/epic_craterlake_constants.toml)
-- csv: [CraterLake](https://eic.github.io/epic/artifacts/DetectorParameterTable/epic_craterlake.csv)
-- html: [CraterLake](https://eic.github.io/epic/artifacts/DetectorParameterTable/epic_craterlake.html)
+- Craterlake: [text](https://eic.github.io/epic/artifacts/constants/epic_craterlake_constants.out) [toml](https://eic.github.io/epic/artifacts/constants/epic_craterlake_constants.toml) [csv](https://eic.github.io/epic/artifacts/DetectorParameterTable/epic_craterlake.csv) [html](https://eic.github.io/epic/artifacts/DetectorParameterTable/epic_craterlake.html)
Getting Started
---------------
@@ -48,10 +44,6 @@ To load the geometry, you can use the scripts in the `install` directory:
```bash
source install/setup.sh
```
-or
-```tcsh
-source install/setup.csh
-```
### Adding/changing detector geometry
diff --git a/bin/acts_geo_check b/bin/acts_geo_check
index 697c415f6..fde323451 100755
--- a/bin/acts_geo_check
+++ b/bin/acts_geo_check
@@ -20,4 +20,11 @@ if [[ "$nlines" > "0" ]] ; then
res="1"
fi
+nlines=$(grep -in inconsistent ${logfile} | grep -in acts | wc -l)
+if [[ "$nlines" > "0" ]] ; then
+ echo " ACTS geometry error: "
+ grep -in inconsistent ${logfile} | grep -in acts
+ res="1"
+fi
+
exit ${res}
diff --git a/bin/generate_prim_file b/bin/generate_prim_file
index 9474472f4..3e7f9fcb6 100755
--- a/bin/generate_prim_file
+++ b/bin/generate_prim_file
@@ -12,7 +12,6 @@ import atexit
import time
from datetime import datetime
import fcntl
-import psutil
def readline_nonblocking(output):
@@ -102,7 +101,8 @@ 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)
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE,
+ preexec_fn=os.setsid)
__child_pid = p.pid
while elapse.seconds < args.timeout:
line = readline_nonblocking(p.stdout)
@@ -134,14 +134,10 @@ while elapse.seconds < args.timeout:
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)
+try:
+ os.killpg(os.getpgid(p.pid), signal.SIGTERM)
+except ProcessLookupError:
+ pass # assume process is dead
# revert the change
#os.system('sed -i \'s/radius=\"EcalEndcapP_FiberRadius*10\"/radius=\"EcalEndcapP_FiberRadius\"/\' {}'.format(ci_ecal))
diff --git a/bin/make_dawn_views b/bin/make_dawn_views
index c2ed66387..c27757b36 100755
--- a/bin/make_dawn_views
+++ b/bin/make_dawn_views
@@ -5,14 +5,9 @@
# 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):
diff --git a/calibrations/calo_digi_default.json b/calibrations/calo_digi_default.json
index 387f1a18e..6f39a7fe6 100644
--- a/calibrations/calo_digi_default.json
+++ b/calibrations/calo_digi_default.json
@@ -1,66 +1,66 @@
{
- "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
- },
- "hcal_pos_endcap_insert": {
- "readout": "tile",
- "dynamicRange": "200*MeV",
- "capacityBitsADC": 15,
- "pedestalMean": 400,
- "pedestalSigma": 10,
- "thresholdValue": 0
- },
- "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
+ },
+ "hcal_pos_endcap_insert": {
+ "readout": "tile",
+ "dynamicRange": "200*MeV",
+ "capacityBitsADC": 15,
+ "pedestalMean": 400,
+ "pedestalSigma": 10,
+ "thresholdValue": 0
+ },
+ "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
+ }
}
diff --git a/calibrations/emcal_barrel_calibration.json b/calibrations/emcal_barrel_calibration.json
index a24a048aa..8a696b9bb 100644
--- a/calibrations/emcal_barrel_calibration.json
+++ b/calibrations/emcal_barrel_calibration.json
@@ -1,9 +1,9 @@
{
- "electron": {
- "particle_name": "electron",
- "sampling_fraction": 0.10856976476514045,
- "sampling_fraction_img": 0.00595078393326404,
- "sampling_fraction_scfi": 0.10262666247845109,
- "thrown_energy": 4.975791477972636
- }
+ "electron": {
+ "particle_name": "electron",
+ "sampling_fraction": 0.10856976476514045,
+ "sampling_fraction_img": 0.00595078393326404,
+ "sampling_fraction_scfi": 0.10262666247845109,
+ "thrown_energy": 4.975791477972636
+ }
}
diff --git a/calibrations/ffi_zdc.json b/calibrations/ffi_zdc.json
index 40ba1d697..543b04599 100644
--- a/calibrations/ffi_zdc.json
+++ b/calibrations/ffi_zdc.json
@@ -1,16 +1,22 @@
{
- "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
- }
+ "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
+ }
}
diff --git a/compact/calibrations.xml b/compact/calibrations.xml
new file mode 100644
index 000000000..b5392ec18
--- /dev/null
+++ b/compact/calibrations.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compact/definitions.xml b/compact/definitions.xml
index 08fd68a08..a50a06e66 100644
--- a/compact/definitions.xml
+++ b/compact/definitions.xml
@@ -630,17 +630,36 @@ Service gaps in FW direction (before endcapP ECAL) and BW direction (before endc
-
-
+ Lepton_Assy_21.stp, rwimmer, 2024-04-03
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+ Hadron End Cap Assembly_North Half.stp, rwimmer, 2024-04-03
+
+
+
+
+
+
+
+ LFHCAL includes support, which is part of the flux return
+
+
+ STAR Asm for EPIC w cradle.stp, rwimmer, 2024-04-03
+
+
+
+
+
+
+
These are used by ddsim, the region where we store all secondaries
diff --git a/compact/display.xml b/compact/display.xml
index 4b54d080b..e9f6adef9 100644
--- a/compact/display.xml
+++ b/compact/display.xml
@@ -105,9 +105,13 @@
-
-
+
+
+
+
+
+
Passive steel for flux return
diff --git a/compact/ecal/backward_hybrid.xml b/compact/ecal/backward_hybrid.xml
deleted file mode 100644
index bee40e905..000000000
--- a/compact/ecal/backward_hybrid.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
- Transition area.
- The idea behind this parametrization is that:
- one glass module with its wrap is always
- a size of 4 crystal modules with its wraps.
- Then the transition area (where glass meets crystals) has no gaps
-
- +----------------+----------------+
- | +----+ +----+ | +----------+ |
- | | | | | | | | |
- | +----+ +----+ | | | |
- | +----+ +----+ | | | |
- | | | | | | | | |
- | +----+ +----+ | +----------+ |
- +----------------+----------------+
- crystal glass
-
- This implies that:
- GlassModule_wrap = 2*CrystalModule_wrap
- GlassModule_sx = 2*CrystalModule_sx
- GlassModule_sy = 2*CrystalModule_sy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #### Backwards Endcap EM Calorimeter
-
- Backwards Endcap EM Calorimeter, placements generated by script
-
-
-
-
-
-
-
- Effectively no segmentation, the segmentation is used to provide cell dimension info
-
-
-
-
-
- system:8,sector:4,module:20,x:32:-16,y:-16
-
-
-
diff --git a/compact/far_forward/beampipe_hadron_B0.xml b/compact/far_forward/beampipe_hadron_B0.xml
index f02790921..e739fdf68 100644
--- a/compact/far_forward/beampipe_hadron_B0.xml
+++ b/compact/far_forward/beampipe_hadron_B0.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/compact/far_forward/roman_pots_eRD24_design.xml b/compact/far_forward/roman_pots_eRD24_design.xml
index 1fdf153d2..f3a393c62 100644
--- a/compact/far_forward/roman_pots_eRD24_design.xml
+++ b/compact/far_forward/roman_pots_eRD24_design.xml
@@ -2,241 +2,238 @@
-
-
- ---------------------------------
- Roman Pots Implementation from eRD24 RD Effort
- Author: Alex Jentsch
- Date of first commit: June 15th, 2021
- ---------------------------------
-
+
+
+ ---------------------------------
+ Roman Pots Implementation from eRD24 RD Effort
+ Author: Alex Jentsch
+ Date of first commit: June 15th, 2021
+ ---------------------------------
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,assembly:3,layer:4,module:4,sensor:4,x:32:-16,y:-16
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:8,assembly:3,layer:4,module:4,sensor:4,x:32:-16,y:-16
+
+
diff --git a/compact/hcal/backward_endcap_flux.xml b/compact/hcal/backward_endcap_flux.xml
index 64595615c..a568e071f 100644
--- a/compact/hcal/backward_endcap_flux.xml
+++ b/compact/hcal/backward_endcap_flux.xml
@@ -6,7 +6,7 @@
#### Dimension constants
-
+
@@ -15,9 +15,9 @@
- ### Backwards (Negative Z) Endcap Flux Return
+ ### Backward (Negative Z) Endcap Flux Return
-
+
diff --git a/compact/hcal/barrel_flux_return.xml b/compact/hcal/barrel_flux_return.xml
new file mode 100644
index 000000000..59249c545
--- /dev/null
+++ b/compact/hcal/barrel_flux_return.xml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+ #### Dimension constants
+
+
+
+
+ Trapezoid for STAR backlegs
+
+
+
+
+
+
+
+
+ Box for spacers
+
+
+
+
+
+
+
+
+
+
+
+ ### Barrel Flux Return
+
+
+
+
+ Trd1 is defined such that x1/x2 are equivalent with y at phi = 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compact/hcal/forward_endcap_flux.xml b/compact/hcal/forward_endcap_flux.xml
new file mode 100644
index 000000000..e13745836
--- /dev/null
+++ b/compact/hcal/forward_endcap_flux.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ #### Dimension constants
+
+
+
+
+
+
+
+
+
+ ### Forward (Positive Z) Endcap Flux Return
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compact/hcal/lfhcal.xml b/compact/hcal/lfhcal.xml
index 3c18598e2..3a903e6c7 100644
--- a/compact/hcal/lfhcal.xml
+++ b/compact/hcal/lfhcal.xml
@@ -94,7 +94,12 @@
+ rmax="LFHCAL_rmax"
+ x="3*EightM_OuterWidth"
+ y="6*EightM_OuterHeight"
+ x0="-FourM_OuterWidth"/>
+
+
+
+
+ SAE AISI 1008 cold-rolled low-carbon steel
+ https://www.azom.com/article.aspx?ArticleID=6538
+
+
+
+
+
+
+
+
diff --git a/compact/pid/drich.xml b/compact/pid/drich.xml
index 7dc0e5b05..cde823bfa 100644
--- a/compact/pid/drich.xml
+++ b/compact/pid/drich.xml
@@ -22,9 +22,9 @@
-
+
-
+
@@ -328,7 +328,7 @@ photodetector unit (PDU) assembly diagram: matrix of SiPMs with services
radius="110.0*cm"
/>
Service/Support setup
-
-
+ Ref: Services Material Budget 24.03.04..stp -- 450.00 mm
+ Ref: Services Material Budget 24.03.13.stp -- 670.00 mm, nudged 5 mm
+ Ref: Services Material Budget 24.03.04..stp -- 520.00 mm
These may belong in definitions.xml
diff --git a/compact/tracking/support_service_craterlake.xml b/compact/tracking/support_service_craterlake.xml
index 55ba62bff..9deca9f98 100644
--- a/compact/tracking/support_service_craterlake.xml
+++ b/compact/tracking/support_service_craterlake.xml
@@ -7,6 +7,26 @@
See https://indico.bnl.gov/event/19854/#1-updated-epic-tracking-config
Silicon tracker: the same effective thickness parameters from previous versions, routing changed
MPGD: estimated by M. Posik
+ ┌─────
+ B
+ │
+ /
+ A
+ /
+ │
+ │
+ ─2C─2B─2A─\ Outer Support Cone /─2A─2B─2C─2D─2E─┘
+ Ecal pfRICH \ /
+ \ /
+ \─1C──1B──1A─\ Inner Support /─1A────1B─────1C────/ Outer Support Cone
+ \ Cones /
+ \ /
+ \ /
+ │ │
+ │ │
+ N (-) └ ┘ (+) P
+ ──·──·──·──·──·────·──·──·──·──·── x ──·──·──·──·──·──·──·──·──·────·──·──·──·──·──·── z
+
@@ -24,34 +44,33 @@
Inner tracker service/support cones, symmetric
Effective Aluminum for services for now
-
-
-
-
-
+ Ref: Services Material Budget 24.03.13.stp - 0.5*mm to avoid overlap with OuterSiBarrel
+ Ref: Services Material Budget 24.03.13.stp - 0.5*mm to avoid overlap with OuterSiBarrel
+
+
+
-
+
- Tracker disk support barrels. 1: inner, 2: outer. All z parameters are unsigned
- TBD: second cones to connect two barrels
-
+
+ Tracker disk support barrels. 1: inner, 2: outer. All z parameters are unsigned
1: Inner barrel for Si disk, 3 slices each ends (Negative CBA, Positive ABC)
Positive
-
+
- 136cm
+ Ref: Services Material Budget 24.03.13.stp
@@ -61,21 +80,21 @@
-
-
-
-
-
-
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
Negative
-
+
- 106cm
+ Ref: Services Material Budget 24.03.13.stp
@@ -85,12 +104,43 @@
- place holder to avoid zero thickness error
-
-
-
-
-
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+
+ Outer tracker service/support cones, asymmetric
+
+ Effective Aluminum for services for now
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+ Negative outer tracker service/support cone
+
+
+
+
+
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+ Positive outer tracker service/support cone
+
+
+
+
+
+
+
+
+
2. Outer barrel for Si barrel cables (guided out projectively) and MPGD (inner+disks).
@@ -98,17 +148,17 @@
Positive
- ~48.75cm
-
-
-
-
+
+
+
+
+
- 180cm. Should be ~174cm
+
@@ -122,32 +172,48 @@
- cables from Si tracker to outer barrels
- cables from the Si cone
- cables from the Si disks
-
- cables from MPGD
-
-
-
-
-
+
+ grounds-up thickness determination
+ cables from Si tracker to outer barrels
+ cables from the Si cone
+ cables from the Si disks
+
+ cables from MPGD
+
+
+
+
+
+
+ total
+
+
+
+
+
+
- total
-
-
-
-
-
+ effective thickness
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+
Negative
- ~ 48.75cm
-
-
+
+
+
- 123.6cm. Should be 120cm
+ Ref: Services Material Budget 24.03.13.stp
@@ -157,24 +223,98 @@
- cables from Si tracker to outer barrels
-
-
- cables from MPGD
-
-
-
-
-
-
-
- Inner detector support cylinder
-
-
-
-
-
-
+
+ grounds-up thickness determination
+ cables from Si tracker to outer barrels
+
+
+ cables from MPGD
+
+
+
+
+
+
+
+
+ effective thickness
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+ 3. Positive endcap disk routing for services.
+
+ Average of inner and outer thickness
+
+
+
+
+ Ref: Services Material Budget 24.03.13.stp
+
+
+ 4. Segments between DRICH readout boxes.
+
+ Blind cone segments that do not continue into DRICH readout boxes
+
+ Average of inner and outer thickness
+
+
+
+
+
+
+ Modified from 110*cm to DRICH_sensorbox_rmin = 108*cm
+
+
+
+
+ Cone segments "A" that continue between the DRICH readout boxes
+
+
+
+
+
+
+
+
+
+
+
+
+ Cone segments "B" that go between the DRICH readout boxes
+
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+
+
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+ Ref: Services Material Budget 24.03.13.stp
+
+
+
+
+
+
+
+
+ Inner detector support cylinder
+
+
+
+
+
+
@@ -211,10 +351,11 @@
vis="TrackerSupportVis"
rmin1="InnerSupportCone_rmin2"
rmin2="InnerSupportCone_rmin1"
+ rmax="TrackerSupportCyl_rmin1+TrackerSupportCylN_thickness1A"
length="InnerSupportCone_length"
thickness="InnerSupportConeN_thickness">
-
+
-
+
@@ -290,11 +432,34 @@
+
+
+
+
+
+
+
+
+
+
+
outer barrel
@@ -304,7 +469,7 @@
@@ -314,7 +479,7 @@
@@ -325,7 +490,7 @@
@@ -335,7 +500,7 @@
@@ -345,7 +510,7 @@
@@ -355,7 +520,7 @@
@@ -365,7 +530,7 @@
@@ -373,6 +538,333 @@
+
+
+
+
+
+
+ Service routings in front of DRICH
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Service routings outside DRICH
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Inner detector support barrel
+
diff --git a/configurations/craterlake.yml b/configurations/craterlake.yml
index 050c73b00..2b9b241d1 100644
--- a/configurations/craterlake.yml
+++ b/configurations/craterlake.yml
@@ -28,6 +28,8 @@ features:
lfhcal_with_space_for_insert:
forward_insert:
barrel_gdml:
+ barrel_flux_return:
+ forward_endcap_flux:
backward:
backward_endcap_flux:
far_forward:
diff --git a/configurations/craterlake_10x100.yml b/configurations/craterlake_10x100.yml
index e2fefd19b..39bfe43ad 100644
--- a/configurations/craterlake_10x100.yml
+++ b/configurations/craterlake_10x100.yml
@@ -27,6 +27,8 @@ features:
hcal:
lfhcal_with_space_for_insert:
forward_insert:
+ forward_endcap_flux:
+ barrel_flux_return:
barrel_gdml:
backward:
backward_endcap_flux:
diff --git a/configurations/craterlake_10x275.yml b/configurations/craterlake_10x275.yml
index 760891776..c645a6926 100644
--- a/configurations/craterlake_10x275.yml
+++ b/configurations/craterlake_10x275.yml
@@ -28,6 +28,8 @@ features:
lfhcal_with_space_for_insert:
forward_insert:
barrel_gdml:
+ barrel_flux_return:
+ forward_endcap_flux:
backward:
backward_endcap_flux:
far_forward:
diff --git a/configurations/craterlake_18x110_Au.yml b/configurations/craterlake_18x110_Au.yml
index 53994b674..e9736a234 100644
--- a/configurations/craterlake_18x110_Au.yml
+++ b/configurations/craterlake_18x110_Au.yml
@@ -28,6 +28,8 @@ features:
lfhcal_with_space_for_insert:
forward_insert:
barrel_gdml:
+ barrel_flux_return:
+ forward_endcap_flux:
backward:
backward_endcap_flux:
far_forward:
diff --git a/configurations/craterlake_18x275.yml b/configurations/craterlake_18x275.yml
index 76721d71f..7f0972f1d 100644
--- a/configurations/craterlake_18x275.yml
+++ b/configurations/craterlake_18x275.yml
@@ -28,6 +28,8 @@ features:
lfhcal_with_space_for_insert:
forward_insert:
barrel_gdml:
+ barrel_flux_return:
+ forward_endcap_flux:
backward:
backward_endcap_flux:
far_forward:
diff --git a/configurations/craterlake_no_bhcal.yml b/configurations/craterlake_no_bhcal.yml
index 2ed315a8a..94223d402 100644
--- a/configurations/craterlake_no_bhcal.yml
+++ b/configurations/craterlake_no_bhcal.yml
@@ -27,6 +27,8 @@ features:
hcal:
lfhcal_with_space_for_insert:
forward_insert:
+ barrel_flux_return:
+ forward_endcap_flux:
backward:
backward_endcap_flux:
far_forward:
diff --git a/configurations/ip6.yml b/configurations/ip6.yml
index 66fa680e6..cd9591e83 100644
--- a/configurations/ip6.yml
+++ b/configurations/ip6.yml
@@ -1,5 +1,7 @@
features:
beampipe:
+ tracking:
+ definitions_craterlake:
far_forward:
default:
far_backward:
diff --git a/configurations/ip6_extended.yml b/configurations/ip6_extended.yml
index d1a1f000c..5e4a172f9 100644
--- a/configurations/ip6_extended.yml
+++ b/configurations/ip6_extended.yml
@@ -1,5 +1,7 @@
features:
beampipe:
+ tracking:
+ definitions_craterlake:
far_forward:
default:
far_backward:
diff --git a/scripts/material_map/.gitignore b/scripts/material_map/.gitignore
new file mode 100644
index 000000000..302d91010
--- /dev/null
+++ b/scripts/material_map/.gitignore
@@ -0,0 +1,5 @@
+Examples/
+Surfaces/
+Validation/
+calibrations/
+*.json
diff --git a/scripts/material_map/epic.py b/scripts/material_map/epic.py
new file mode 100644
index 000000000..4e8fc2858
--- /dev/null
+++ b/scripts/material_map/epic.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+## Stand alone function to build ePIC geometry with ACTS python bindings
+## for material mapping
+## Shujie Li, 03, 2024
+
+from pathlib import Path
+
+import acts
+import acts.examples.dd4hep
+
+from acts import (
+ Vector4,
+ MaterialMapJsonConverter
+)
+
+import json
+
+def getDetector(
+ xmlFile,
+ jsonFile="",
+ logLevel=acts.logging.WARNING,
+):
+ customLogLevel = acts.examples.defaultLogging(logLevel=logLevel)
+ logger = acts.logging.getLogger("epic.getDetector")
+
+ matDeco = None
+ if len(jsonFile)>0:
+ file = Path(jsonFile)
+ logger.info("Adding material from %s", file.absolute())
+ matDeco = acts.IMaterialDecorator.fromFile(
+ file,
+ level=customLogLevel(maxLevel=acts.logging.INFO),
+ )
+
+ dd4hepConfig = acts.examples.dd4hep.DD4hepGeometryService.Config(
+ xmlFileNames=[xmlFile],
+ logLevel=logLevel,
+ dd4hepLogLevel=customLogLevel(),
+ )
+ detector = acts.examples.dd4hep.DD4hepDetector()
+
+ config = acts.MaterialMapJsonConverter.Config()
+
+ trackingGeometry, deco = detector.finalize(dd4hepConfig, matDeco)
+
+ return detector, trackingGeometry, deco
diff --git a/scripts/material_map/geometry_epic.py b/scripts/material_map/geometry_epic.py
new file mode 100644
index 000000000..596afa6ca
--- /dev/null
+++ b/scripts/material_map/geometry_epic.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+import os
+import argparse
+
+import acts
+
+import epic
+from geometry import runGeometry
+
+if "__main__" == __name__:
+ p = argparse.ArgumentParser(
+ description="Script to generate geometry-map.json for ePIC geometry"
+ )
+ p.add_argument(
+ "-i",
+ "--xmlFile",
+ default=(
+ os.environ.get("DETECTOR_PATH", "")
+ + "/"
+ + os.environ.get("DETECTOR_CONFIG", "")
+ + ".xml"
+ ),
+ help="Input xml file containing ePIC geometry",
+ )
+ args = p.parse_args()
+
+ detector, trackingGeometry, decorators = epic.getDetector(args.xmlFile)
+
+ runGeometry(
+ trackingGeometry,
+ decorators,
+ outputDir=os.getcwd(),
+ outputObj=False,
+ outputCsv=False,
+ outputJson=True,
+ outputRoot=True,
+ )
diff --git a/scripts/material_map/material_mapping_epic.py b/scripts/material_map/material_mapping_epic.py
new file mode 100644
index 000000000..ded6fc7d8
--- /dev/null
+++ b/scripts/material_map/material_mapping_epic.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+import os
+import argparse
+
+import acts
+from acts.examples import JsonFormat
+
+import epic
+from material_mapping import runMaterialMapping
+
+if "__main__" == __name__:
+
+ p = argparse.ArgumentParser(
+ description="Script to generate material map for ePIC geometry"
+ )
+ p.add_argument(
+ "--xmlFile",
+ default=os.environ.get("DETECTOR_PATH", "")+"epic_craterlake.xml",
+ help="input xml file containing ePIC geometry",
+ )
+ p.add_argument(
+ "--geoFile",
+ type=str,
+ default="geometry-map.json",
+ help="input json file to define volumes and layers used in material mapping",
+ )
+ p.add_argument(
+ "--matFile",
+ type=str,
+ default="material-map.json",
+ help="output filename for the generated material map, can be json and cbor formats",
+ )
+ args = p.parse_args()
+
+ mapName = args.matFile.split('.')[0]
+
+ detector, trackingGeometry, decorators = epic.getDetector(
+ args.xmlFile, args.geoFile)
+
+ runMaterialMapping(
+ trackingGeometry,
+ decorators,
+ outputDir = os.getcwd(),
+ inputDir = os.getcwd(),
+ readCachedSurfaceInformation=False,
+ mapVolume= False,
+ mapName = mapName,
+ ).run()
diff --git a/scripts/material_map/material_recording_epic.py b/scripts/material_map/material_recording_epic.py
new file mode 100644
index 000000000..85290e955
--- /dev/null
+++ b/scripts/material_map/material_recording_epic.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+import os
+import warnings
+from pathlib import Path
+import argparse
+
+import acts
+from acts.examples import (
+ GaussianVertexGenerator,
+ ParametricParticleGenerator,
+ FixedMultiplicityGenerator,
+ EventGenerator,
+ RandomNumbers,
+)
+
+import acts.examples.dd4hep
+import acts.examples.geant4
+import acts.examples.geant4.dd4hep
+
+import epic
+from material_recording import runMaterialRecording
+
+u = acts.UnitConstants
+
+_material_recording_executed = False
+
+
+def main():
+
+ p = argparse.ArgumentParser()
+ p.add_argument(
+ "-n", "--events", type=int, default=1000, help="Number of events to generate"
+ )
+ p.add_argument(
+ "-t", "--tracks", type=int, default=100, help="Particle tracks per event"
+ )
+ p.add_argument(
+ "-i", "--xmlFile", type=str, default=os.environ.get("DETECTOR_PATH", "") + os.environ.get("DETECTOR_CONFIG", "") + ".xml", help="DD4hep input file"
+ )
+ p.add_argument(
+ "-o", "--outputName", type=str, default="geant4_material_tracks.root", help="Name of the output rootfile"
+ )
+ p.add_argument(
+ "--eta_min",
+ type=float,
+ default=-8.0,
+ help="eta min (optional)",
+ )
+ p.add_argument(
+ "--eta_max",
+ type=float,
+ default=8.0,
+ help="eta max (optional)",
+ )
+ args = p.parse_args()
+
+ detector, trackingGeometry, decorators = epic.getDetector(
+ args.xmlFile)
+
+ detectorConstructionFactory = (
+ acts.examples.geant4.dd4hep.DDG4DetectorConstructionFactory(detector)
+ )
+
+ runMaterialRecording(
+ detectorConstructionFactory=detectorConstructionFactory,
+ tracksPerEvent=args.tracks,
+ outputDir=os.getcwd(),
+ etaRange=(args.eta_min, args.eta_max),
+ s=acts.examples.Sequencer(events=args.events, numThreads=1),
+ ).run()
+
+
+if "__main__" == __name__:
+ main()
diff --git a/scripts/material_map/material_validation_epic.py b/scripts/material_map/material_validation_epic.py
new file mode 100644
index 000000000..6317ba08f
--- /dev/null
+++ b/scripts/material_map/material_validation_epic.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+import os
+import argparse
+
+import acts
+import acts.examples.dd4hep
+from acts.examples import Sequencer
+
+import epic
+from material_validation import runMaterialValidation
+
+
+if "__main__" == __name__:
+
+ p = argparse.ArgumentParser(
+ description="Script to produce propogation validation for ePIC material mapping."
+ )
+ p.add_argument(
+ "--xmlFile",
+ default=os.environ.get("DETECTOR_PATH", "") + os.environ.get("DETECTOR_CONFIG", "") + ".xml",
+ help="input xml file containing ePIC geometry",
+ )
+ p.add_argument(
+ "--matFile",
+ type=str,
+ default="material-map.json",
+ help="input material map file, can be either Json or Cbor",
+ )
+ p.add_argument(
+ "--outputName",
+ type=str,
+ default="propagation-material.root",
+ help="customized name of the output rootfile",
+ )
+ p.add_argument(
+ "-n","--nevents",
+ type=int,
+ default=100,
+ help="number of events to run",
+ )
+ args = p.parse_args()
+
+ detector, trackingGeometry, decorators = epic.getDetector(args.xmlFile, args.matFile)
+
+ field = acts.ConstantBField(acts.Vector3(0, 0, 0))
+
+ runMaterialValidation(
+ trackingGeometry, decorators, field,
+ outputDir=os.getcwd(), outputName=args.outputName,
+ s=Sequencer(events=args.nevents, numThreads=-1)
+ ).run()
diff --git a/scripts/material_map/materialmap_config.py b/scripts/material_map/materialmap_config.py
new file mode 100644
index 000000000..ead046234
--- /dev/null
+++ b/scripts/material_map/materialmap_config.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2024 Shujie Li
+
+## Generate ePIC material map for ACTS
+## read config-map.json and turn on mapping for approach 1 and 2 of each sensitive surface.
+import pandas as pd
+import numpy as np
+import json
+import os
+import argparse
+
+if "__main__" == __name__:
+ p = argparse.ArgumentParser(
+ description="Script to turn on all approach 1 and 2, and also the beampipe surface in config json file for matieral mapping"
+ )
+ p.add_argument(
+ "-i","--inputFile",
+ type=str,
+ default="config-map.json",
+ help=" input json file to be modified",
+ )
+ p.add_argument(
+ "-o","--outputFile",
+ type=str,
+ default="config-map_new.json",
+ help=" output json file",
+ )
+
+args = p.parse_args()
+print(args)
+fname = args.inputFile
+out_name = args.outputFile
+
+
+## load json file
+f = open(fname)
+dd = json.load(f)
+
+ee=dd['Volumes']['entries']
+
+## print volume name and ID
+print ("Volume ID Name Approaches")
+for vv in np.arange(len(ee)):
+ nn = ee[vv]['value']['NAME']
+
+ if "|" not in nn and "Gap" not in nn:
+ print(ee[vv]['volume'], nn,"1, 2")#print(ee[vv]['value'])#['NAME'])
+ if "acts_beampipe_central::Barrel" in nn:
+ v_beampipe = vv+1
+ print(v_beampipe, nn, "X")
+
+## find apporach 1 and 2 to turn on mapping
+for vv in np.arange(1,1+len(dd['Surfaces'])):
+ for ii,tt in enumerate(dd['Surfaces'][str(vv)]):
+ if 'approach' in tt:
+ dd['Surfaces'][str(vv)][ii]['value']['material']['mapMaterial']=True
+ ## turn on beampipe surface and defind binning
+ elif vv==v_beampipe:
+ if tt['value']['bounds']['type']=='CylinderBounds':
+ # print (dd['Surfaces'][str(vv)][ii])
+ dd['Surfaces'][str(vv)][ii]['value']['material']['mapMaterial']=True
+ dd['Surfaces'][str(vv)][ii]['value']['material']['binUtility']['binningdata'][0]['bins']=36
+ dd['Surfaces'][str(vv)][ii]['value']['material']['binUtility']['binningdata'][1]['bins']=200
+
+
+with open(out_name, "w") as outfile:
+ json.dump(dd, outfile, indent=4)
+
+print("Done! Updated config file at "+out_name)
diff --git a/scripts/material_map/run_material_map_validation.sh b/scripts/material_map/run_material_map_validation.sh
new file mode 100755
index 000000000..3daafd1bd
--- /dev/null
+++ b/scripts/material_map/run_material_map_validation.sh
@@ -0,0 +1,127 @@
+#!/bin/bash
+set -e
+# script for material map validation with ACTS python bindings
+# run as : ./run_material_map_validation.sh --nevents 1000
+# Shujie Li, 03. 2024 (https://github.com/eic/snippets/pull/3)
+
+# Check if DETECTOR_PATH and DETECTOR_CONFIG are set
+if [[ -z ${DETECTOR_PATH} || -z ${DETECTOR_CONFIG} ]] ; then
+ echo "You must set \$DETECTOR_PATH and \$DETECTOR_CONFIG before running this script."
+ exit -1
+fi
+
+# Download required Acts files
+ACTS_VERSION="682d2080d36712ac15975340c92f860b25169213"
+ACTS_URL="https://github.com/acts-project/acts/raw/"
+ACTS_FILES=(
+ "Examples/Scripts/Python/geometry.py"
+ "Examples/Scripts/Python/material_mapping.py"
+ "Examples/Scripts/Python/material_recording.py"
+ "Examples/Scripts/Python/material_validation.py"
+ "Examples/Scripts/MaterialMapping/writeMapConfig.py"
+ "Examples/Scripts/MaterialMapping/configureMap.py"
+ "Examples/Scripts/MaterialMapping/Mat_map.C"
+ "Examples/Scripts/MaterialMapping/Mat_map_surface_plot.C"
+ "Examples/Scripts/MaterialMapping/Mat_map_surface_plot_ratio.C"
+ "Examples/Scripts/MaterialMapping/Mat_map_surface_plot_dist.C"
+ "Examples/Scripts/MaterialMapping/Mat_map_surface_plot_1D.C"
+ "Examples/Scripts/MaterialMapping/materialPlotHelper.cpp"
+ "Examples/Scripts/MaterialMapping/materialPlotHelper.hpp"
+)
+for file in ${ACTS_FILES[@]} ; do
+ if [ ! -f ${file} ] ; then
+ curl --silent --location --create-dirs --output ${file} ${ACTS_URL}/${ACTS_VERSION}/${file}
+ fi
+done
+export PYTHONPATH=$PWD/Examples/Scripts/Python:$PYTHONPATH
+
+# Default arguments
+nevents=1000
+nparticles=1000
+while [[ $# -gt 1 ]]
+do
+ key="$1"
+ case $key in
+ --nevents)
+ nevents=$2
+ shift # past value
+ shift
+ ;;
+ --nparticles)
+ nparticles=$2
+ shift # past value
+ shift
+ ;;
+ *) # 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
+
+recordingFile=geant4_material_tracks.root
+geoFile=geometry-map.json
+matFile=material-map.json
+trackFile=material-map_tracks.root
+propFile=propagation_material
+
+echo "::group::----GEANTINO SCAN------"
+# output geant4_material_tracks.root
+# The result of the geantino scan will be a root file containing material tracks. Those contain the direction and production vertex of the geantino, the total material accumulated and all the interaction points in the detector.
+python material_recording_epic.py -i ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml -n ${nevents} -t ${nparticles} -o ${recordingFile}
+echo "::endgroup::"
+
+echo "::group::-----MAPPING Configuration-----"
+# map geometry to geometry-map.json
+python geometry_epic.py -i ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml
+
+# take geometry-map.json and read out config-map.json
+python Examples/Scripts/MaterialMapping/writeMapConfig.py ${geoFile} config-map.json
+
+# turn on approaches and beampipe surfaces for material mapping
+# you can always manually adjust the mapmaterial flag and binnings in config-map.json
+python materialmap_config.py -i config-map.json -o config-map_new.json
+
+# turn config-map.json into modified geometry-map.json
+python Examples/Scripts/MaterialMapping/configureMap.py ${geoFile} config-map_new.json
+echo "::endgroup::"
+
+echo "::group::----MAPPING------------"
+# input: geant4_material_tracks.root, geometry-map.json
+# output: material-maps.json or cbor. This is the material map that you want to provide to EICrecon, i.e. -Pacts:MaterialMap=XXX .Please --matFile to specify the name and type
+# material-maps_tracks.root(recorded steps from geantino, for validation purpose)
+python material_mapping_epic.py --xmlFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml --geoFile ${geoFile} --matFile ${matFile}
+echo "::endgroup::"
+
+echo "::group::----Prepare validation rootfile--------"
+# output propagation-material.root
+python material_validation_epic.py --xmlFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml --outputName ${propFile}_new --matFile ${matFile} -n ${nevents}
+python material_validation_epic.py --xmlFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml --outputName ${propFile}_old --matFile "calibrations/materials-map.cbor" -n ${nevents}
+echo "::endgroup::"
+
+echo "::group::-------Comparison plots---------"
+rm -rf Validation/new
+mkdir -p Validation/new
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map.C'("'${propFile}_new'.root","'${trackFile}'","Validation/new")'
+rm -rf Validation/old
+mkdir -p Validation/old
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map.C'("'${propFile}_old'.root","'${trackFile}'","Validation/old")'
+
+rm -rf Surfaces
+mkdir -p Surfaces/new/ratio_plot
+mkdir -p Surfaces/new/prop_plot
+mkdir -p Surfaces/new/map_plot
+mkdir -p Surfaces/old/ratio_plot
+mkdir -p Surfaces/old/prop_plot
+mkdir -p Surfaces/old/map_plot
+mkdir -p Surfaces/dist_plot
+mkdir -p Surfaces/1D_plot
+
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map_surface_plot_ratio.C'("'${propFile}_new'.root","'${trackFile}'",-1,"Surfaces/new/ratio_plot","Surfaces/new/prop_plot","Surfaces/new/map_plot")'
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map_surface_plot_ratio.C'("'${propFile}_old'.root","'${trackFile}'",-1,"Surfaces/old/ratio_plot","Surfaces/old/prop_plot","Surfaces/old/map_plot")'
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map_surface_plot_dist.C'("'${trackFile}'",-1,"Surfaces/dist_plot")'
+root -l -b -q Examples/Scripts/MaterialMapping/Mat_map_surface_plot_1D.C'("'${trackFile}'",-1,"Surfaces/1D_plot")'
+echo "::endgroup::"
diff --git a/scripts/test_ACTS.cxx b/scripts/test_ACTS.cxx
index a949db76c..26416f9c4 100644
--- a/scripts/test_ACTS.cxx
+++ b/scripts/test_ACTS.cxx
@@ -11,8 +11,7 @@
*
*
*/
-void test_ACTS(const char* compact = "epic.xml")
-{
+void test_ACTS(const char* compact = "epic.xml") {
// -------------------------
// Get the DD4hep instance
// Load the compact XML file
@@ -20,9 +19,9 @@ void test_ACTS(const char* compact = "epic.xml")
auto detector = dd4hep::Detector::make_unique("");
detector->fromCompact(compact);
- auto logger = Acts::getDefaultLogger("Acts", Acts::Logging::Level::VERBOSE);
+ auto logger = Acts::getDefaultLogger("Acts", Acts::Logging::Level::VERBOSE);
auto acts_tracking_geometry = Acts::convertDD4hepDetector(detector->world(), *logger);
// Visit all surfaces
- acts_tracking_geometry->visitSurfaces([](const Acts::Surface *surface) { });
+ acts_tracking_geometry->visitSurfaces([](const Acts::Surface* surface) {});
}
diff --git a/scripts/view1/generate_eps b/scripts/view1/generate_eps
index b7d4419ed..33beae078 100755
--- a/scripts/view1/generate_eps
+++ b/scripts/view1/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#export DAWN_PS_PREVIEWER="derp"
diff --git a/scripts/view11/generate_eps b/scripts/view11/generate_eps
index 1f53c6534..c93288c27 100755
--- a/scripts/view11/generate_eps
+++ b/scripts/view11/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#trignometry
sin ()
diff --git a/scripts/view12/generate_eps b/scripts/view12/generate_eps
index 3668d000c..08ce870eb 100755
--- a/scripts/view12/generate_eps
+++ b/scripts/view12/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#trignometry
sin ()
@@ -72,8 +72,8 @@ make_slice(){
local zpos="$1"
local tagnum=$(printf "%04d" ${zpos})
local FILE_TAG="${original_file_tag}a${tagnum}"
- dawncut 0 0 1 ${zpos}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
- dawncut 0 0 -1 -${zpos}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
+ dawncut 0 0 1 $(( 10 * ${zpos} + 1 )) ${INPUT_FILE} ${FILE_TAG}_temp0.prim
+ dawncut 0 0 -1 $(( -10 * ${zpos} )) ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
diff --git a/scripts/view13/generate_eps b/scripts/view13/generate_eps
index 748badbf6..1aab04df1 100755
--- a/scripts/view13/generate_eps
+++ b/scripts/view13/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "view2 produces a series of XY slices a different z locations."
diff --git a/scripts/view14/generate_eps b/scripts/view14/generate_eps
index 1f2c9afe9..ca1fca10b 100755
--- a/scripts/view14/generate_eps
+++ b/scripts/view14/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#trignometry
sin ()
@@ -75,10 +75,10 @@ make_slice(){
local zpos="$1"
local tagnum=$(printf "%04d" ${zpos})
local FILE_TAG="${original_file_tag}a${tagnum}"
- local z1=$(add ${zpos} 100)
- local z2=$(add ${zpos} -100)
- #dawncut 0 0 1 ${z1}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
- #dawncut 0 0 -1 -${z2}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
+ local z1=$(( ${zpos} + 100 ))
+ local z2=$(( ${zpos} - 100 ))
+ #dawncut 0 0 1 $(( 10 * ${z1} + 1 )) ${INPUT_FILE} ${FILE_TAG}_temp0.prim
+ #dawncut 0 0 -1 $(( -10 * ${z2} )) ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
../../bin/dawn_tweak -z ${zpos}0
cp ${INPUT_FILE} ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
diff --git a/scripts/view15/generate_eps b/scripts/view15/generate_eps
index 8bc18aaf5..d05e5ca81 100755
--- a/scripts/view15/generate_eps
+++ b/scripts/view15/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#trignometry
sin ()
@@ -91,10 +91,10 @@ make_slice(){
local zpos="$1"
local tagnum=$(printf "%04d" ${zpos})
local FILE_TAG="${original_file_tag}a${tagnum}"
- local z1=$(add ${zpos} 100)
- local z2=$(add ${zpos} -100)
- #dawncut 0 0 1 ${z1}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
- #dawncut 0 0 -1 -${z2}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
+ local z1=$(( ${zpos} + 100 ))
+ local z2=$(( ${zpos} - 100 ))
+ #dawncut 0 0 1 $(( 10 * ${z1} + 1 )) ${INPUT_FILE} ${FILE_TAG}_temp0.prim
+ #dawncut 0 0 -1 $(( -10 * ${z2} )) ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
../../bin/dawn_tweak -z ${zpos}0 --draw 5
#cp ${INPUT_FILE} ${FILE_TAG}.prim
dawncut -1 0 0 0 ${INPUT_FILE} ${FILE_TAG}.prim
diff --git a/scripts/view2/generate_eps b/scripts/view2/generate_eps
index d3162019e..bcbcec379 100755
--- a/scripts/view2/generate_eps
+++ b/scripts/view2/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "view2 produces a series of XY slices a different z locations."
diff --git a/scripts/view20/generate_eps b/scripts/view20/generate_eps
index 5822e8eb3..9289de069 100755
--- a/scripts/view20/generate_eps
+++ b/scripts/view20/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#export DAWN_PS_PREVIEWER="derp"
diff --git a/scripts/view3/generate_eps b/scripts/view3/generate_eps
index 1abde4653..d01291487 100755
--- a/scripts/view3/generate_eps
+++ b/scripts/view3/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "view3 produces a series of XY slices a different z locations."
diff --git a/scripts/view4/generate_eps b/scripts/view4/generate_eps
index 0cf16687b..fbc0c7dea 100755
--- a/scripts/view4/generate_eps
+++ b/scripts/view4/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# this is a detector slice
diff --git a/scripts/view5/generate_eps b/scripts/view5/generate_eps
index c551627db..b9626e2c1 100755
--- a/scripts/view5/generate_eps
+++ b/scripts/view5/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# this is a detector slice
diff --git a/scripts/view50/generate_eps b/scripts/view50/generate_eps
index f2de94608..2a8e40fbf 100755
--- a/scripts/view50/generate_eps
+++ b/scripts/view50/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#export DAWN_PS_PREVIEWER="derp"
diff --git a/scripts/view6/generate_eps b/scripts/view6/generate_eps
index 27040afdb..639c9fee5 100755
--- a/scripts/view6/generate_eps
+++ b/scripts/view6/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "view6 produces a series of XY slices a different z locations."
diff --git a/scripts/view7/generate_eps b/scripts/view7/generate_eps
index 4f33c544b..a227de4f9 100755
--- a/scripts/view7/generate_eps
+++ b/scripts/view7/generate_eps
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "view7 produces a series of XY slices a different z locations."
diff --git a/src/B0ECal_geo.cpp b/src/B0ECal_geo.cpp
index 6a8ad9bc4..f5c271266 100644
--- a/src/B0ECal_geo.cpp
+++ b/src/B0ECal_geo.cpp
@@ -22,13 +22,13 @@ using std::tuple;
using std::vector;
using namespace dd4hep;
-static tuple build_module(Detector& desc, xml_coll_t& plm, SensitiveDetector& sens);
+static tuple build_module(Detector& desc, xml_coll_t& plm,
+ SensitiveDetector& sens);
-static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
-{
- xml_det_t x_det = e;
- string detName = x_det.nameStr();
- int detID = x_det.id();
+static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) {
+ xml_det_t x_det = e;
+ string detName = x_det.nameStr();
+ int detID = x_det.id();
DetElement det(detName, detID);
sens.setType("calorimeter");
@@ -39,9 +39,9 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
xml_dim_t rot = x_det.rotation();
// module placement
- xml_comp_t plm = x_det.child(_Unicode(placements));
+ xml_comp_t plm = x_det.child(_Unicode(placements));
map sectorModuleNumbers;
- auto addModuleNumbers = [§orModuleNumbers](int sector, int nmod) {
+ auto addModuleNumbers = [§orModuleNumbers](int sector, int nmod) {
auto it = sectorModuleNumbers.find(sector);
if (it != sectorModuleNumbers.end()) {
it->second += nmod;
@@ -53,7 +53,8 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
int sector_id = 1;
for (xml_coll_t mod(plm, _Unicode(individuals)); mod; ++mod) {
- auto [sector, nmod] = ip6::geo::add_individuals(build_module, desc, detVol, mod, sens, sector_id++);
+ auto [sector, nmod] =
+ ip6::geo::add_individuals(build_module, desc, detVol, mod, sens, sector_id++);
addModuleNumbers(sector, nmod);
}
@@ -63,8 +64,8 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
}
// position and rotation of parent volume
- Volume motherVol = desc.pickMotherVolume(det);
- Transform3D tr(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
+ Volume motherVol = desc.pickMotherVolume(det);
+ Transform3D tr(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
PlacedVolume detPV = motherVol.placeVolume(detVol, tr);
detPV.addPhysVolID("system", detID);
det.setPlacement(detPV);
@@ -72,14 +73,14 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
}
// helper function to build module with or w/o wrapper
-static tuple build_module(Detector& desc, xml::Collection_t& plm, SensitiveDetector& sens)
-{
- auto mod = plm.child(_Unicode(module));
- auto sx = mod.attr(_Unicode(sizex));
- auto sy = mod.attr(_Unicode(sizey));
- auto sz = mod.attr(_Unicode(sizez));
- Box modShape(sx / 2., sy / 2., sz / 2.);
- auto modMat = desc.material(mod.attr(_Unicode(material)));
+static tuple build_module(Detector& desc, xml::Collection_t& plm,
+ SensitiveDetector& sens) {
+ auto mod = plm.child(_Unicode(module));
+ auto sx = mod.attr(_Unicode(sizex));
+ auto sy = mod.attr(_Unicode(sizey));
+ auto sz = mod.attr(_Unicode(sizez));
+ Box modShape(sx / 2., sy / 2., sz / 2.);
+ auto modMat = desc.material(mod.attr(_Unicode(material)));
Volume modVol("module_vol", modShape, modMat);
modVol.setSensitiveDetector(sens);
modVol.setVisAttributes(desc.visAttributes(mod.attr(_Unicode(vis))));
@@ -94,8 +95,8 @@ static tuple build_module(Detector& desc, xml::Collection_t& p
if (thickness < 1e-12 * mm) {
return make_tuple(modVol, Position{sx, sy, sz});
}
- auto wrpMat = desc.material(wrp.attr(_Unicode(material)));
- Box wrpShape((sx + thickness) / 2., (sy + thickness) / 2., sz / 2.);
+ auto wrpMat = desc.material(wrp.attr(_Unicode(material)));
+ Box wrpShape((sx + thickness) / 2., (sy + thickness) / 2., sz / 2.);
Volume wrpVol("wrapper_vol", wrpShape, wrpMat);
wrpVol.placeVolume(modVol, Position(0., 0., 0.));
wrpVol.setVisAttributes(desc.visAttributes(wrp.attr(_Unicode(vis))));
diff --git a/src/B0Preshower_geo.cpp b/src/B0Preshower_geo.cpp
index 27f8e49a9..f85e417fd 100644
--- a/src/B0Preshower_geo.cpp
+++ b/src/B0Preshower_geo.cpp
@@ -14,67 +14,66 @@ using namespace dd4hep::detail;
*
* This geometric element has been deprecated. ACTS tracking interface has also been removed. - Sakib Rahman (Dec 20, 2022)
*/
-static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetector sens)
-{
+static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetector sens) {
typedef vector Placements;
- xml_det_t x_det = e;
- Material vacuum = description.vacuum();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- bool reflect = x_det.reflect(false);
- DetElement sdet(det_name, det_id);
- Assembly assembly(det_name);
- xml::Component pos = x_det.position();
- xml::Component rot = x_det.rotation();
+ xml_det_t x_det = e;
+ Material vacuum = description.vacuum();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ bool reflect = x_det.reflect(false);
+ DetElement sdet(det_name, det_id);
+ Assembly assembly(det_name);
+ xml::Component pos = x_det.position();
+ xml::Component rot = x_det.rotation();
// Material air = description.material("Air");
// Volume assembly (det_name,Box(10000,10000,10000),vacuum);
- Volume motherVol = description.pickMotherVolume(sdet);
- int m_id = 0, c_id = 0, n_sensor = 0;
- map modules;
+ Volume motherVol = description.pickMotherVolume(sdet);
+ int m_id = 0, c_id = 0, n_sensor = 0;
+ map modules;
map sensitives;
- PlacedVolume pv;
+ PlacedVolume pv;
assembly.setVisAttributes(description.invisible());
sens.setType("tracker");
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
xml_comp_t x_mod = mi;
- string m_nam = x_mod.nameStr();
+ string m_nam = x_mod.nameStr();
xml_comp_t trd = x_mod.trd();
- double posY;
- double x1 = trd.x1();
- double x2 = trd.x2();
- double z = trd.z();
- double y1, y2, total_thickness = 0.;
+ double posY;
+ double x1 = trd.x1();
+ double x2 = trd.x2();
+ double z = trd.z();
+ double y1, y2, total_thickness = 0.;
xml_coll_t ci(x_mod, _U(module_component));
for (ci.reset(), total_thickness = 0.0; ci; ++ci)
total_thickness += xml_comp_t(ci).thickness();
y1 = y2 = total_thickness / 2;
Trapezoid m_solid(x1, x2, y1, y2, z);
- Volume m_volume(m_nam, m_solid, vacuum);
+ Volume m_volume(m_nam, m_solid, vacuum);
m_volume.setVisAttributes(description.visAttributes(x_mod.visStr()));
Solid frame_s;
if (x_mod.hasChild(_U(frame))) {
// build frame from trd (assumed to be smaller)
- xml_comp_t m_frame = x_mod.child(_U(frame));
- xml_comp_t f_pos = m_frame.child(_U(position));
- xml_comp_t frame_trd = m_frame.trd();
- double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
- double frame_x1 = frame_trd.x1();
- double frame_x2 = frame_trd.x2();
- double frame_z = frame_trd.z();
+ xml_comp_t m_frame = x_mod.child(_U(frame));
+ xml_comp_t f_pos = m_frame.child(_U(position));
+ xml_comp_t frame_trd = m_frame.trd();
+ double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
+ double frame_x1 = frame_trd.x1();
+ double frame_x2 = frame_trd.x2();
+ double frame_z = frame_trd.z();
// make the frame match the total thickness if thickness attribute is not given
- Trapezoid f_solid1(x1, x2, frame_thickness / 2.0, frame_thickness / 2.0, z);
- Trapezoid f_solid(frame_x1, frame_x2, frame_thickness / 2.0, frame_thickness / 2.0, frame_z);
+ Trapezoid f_solid1(x1, x2, frame_thickness / 2.0, frame_thickness / 2.0, z);
+ Trapezoid f_solid(frame_x1, frame_x2, frame_thickness / 2.0, frame_thickness / 2.0, frame_z);
SubtractionSolid frame_shape(f_solid1, f_solid);
frame_s = frame_shape;
Material f_mat = description.material(m_frame.materialStr());
- Volume f_vol(m_nam + "_frame", frame_shape, f_mat);
+ Volume f_vol(m_nam + "_frame", frame_shape, f_mat);
f_vol.setVisAttributes(description.visAttributes(m_frame.visStr()));
// figure out how to best place
@@ -82,17 +81,17 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
}
for (ci.reset(), n_sensor = 1, c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
- xml_comp_t c = ci;
- double c_thick = c.thickness();
- auto comp_x1 = getAttrOrDefault(c, _Unicode(x1), x1);
- auto comp_x2 = getAttrOrDefault(c, _Unicode(x2), x2);
- auto comp_height = getAttrOrDefault(c, _Unicode(height), z);
+ xml_comp_t c = ci;
+ double c_thick = c.thickness();
+ auto comp_x1 = getAttrOrDefault(c, _Unicode(x1), x1);
+ auto comp_x2 = getAttrOrDefault(c, _Unicode(x2), x2);
+ auto comp_height = getAttrOrDefault(c, _Unicode(height), z);
- Material c_mat = description.material(c.materialStr());
- string c_name = _toString(c_id, "component%d");
+ Material c_mat = description.material(c.materialStr());
+ string c_name = _toString(c_id, "component%d");
Trapezoid comp_s1(comp_x1, comp_x2, c_thick / 2e0, c_thick / 2e0, comp_height);
- Solid comp_shape = comp_s1;
+ Solid comp_shape = comp_s1;
if (frame_s.isValid()) {
comp_shape = SubtractionSolid(comp_s1, frame_s);
}
@@ -102,7 +101,8 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
pv = m_volume.placeVolume(c_vol, Position(0, posY + c_thick / 2, 0));
if (c.isSensitive()) {
// std::cout << " adding sensitive volume" << c_name << "\n";
- sdet.check(n_sensor > 2, "SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
+ sdet.check(n_sensor > 2,
+ "SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
pv.addPhysVolID("sensor", n_sensor);
sens.setType("tracker");
c_vol.setSensitiveDetector(sens);
@@ -116,11 +116,11 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
for (xml_coll_t li(x_det, _U(layer)); li; ++li) {
xml_comp_t x_layer(li);
- int l_id = x_layer.id();
- int mod_num = 1;
+ int l_id = x_layer.id();
+ int mod_num = 1;
- xml_comp_t l_env = x_layer.child(_U(envelope));
- string layer_name = det_name + std::string("_layer") + std::to_string(l_id);
+ xml_comp_t l_env = x_layer.child(_U(envelope));
+ string layer_name = det_name + std::string("_layer") + std::to_string(l_id);
std::string layer_vis = l_env.attr(_Unicode(vis));
// double layer_rmin = l_env.attr(_Unicode(rmin));
@@ -140,8 +140,8 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
PlacedVolume layer_pv;
if (reflect) {
- layer_pv =
- assembly.placeVolume(layer_vol, Transform3D(RotationZYX(0.0, -M_PI, 0.0), Position(0, 0, -layer_center_z)));
+ layer_pv = assembly.placeVolume(
+ layer_vol, Transform3D(RotationZYX(0.0, -M_PI, 0.0), Position(0, 0, -layer_center_z)));
layer_pv.addPhysVolID("barrel", 3).addPhysVolID("layer", l_id);
layer_name += "_N";
} else {
@@ -153,17 +153,17 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
layer_element.setPlacement(layer_pv);
for (xml_coll_t ri(x_layer, _U(ring)); ri; ++ri) {
- xml_comp_t x_ring = ri;
- double r = x_ring.r();
- double phi0 = x_ring.phi0(0);
- double zstart = x_ring.zstart();
- double dz = x_ring.dz(0);
- int nmodules = x_ring.nmodules();
- string m_nam = x_ring.moduleStr();
- Volume m_vol = modules[m_nam];
- double iphi = 2 * M_PI / nmodules;
- double dphi = dd4hep::getAttrOrDefault(x_ring, _Unicode(dphi), iphi);
- double phi = phi0;
+ xml_comp_t x_ring = ri;
+ double r = x_ring.r();
+ double phi0 = x_ring.phi0(0);
+ double zstart = x_ring.zstart();
+ double dz = x_ring.dz(0);
+ int nmodules = x_ring.nmodules();
+ string m_nam = x_ring.moduleStr();
+ Volume m_vol = modules[m_nam];
+ double iphi = 2 * M_PI / nmodules;
+ double dphi = dd4hep::getAttrOrDefault(x_ring, _Unicode(dphi), iphi);
+ double phi = phi0;
Placements& sensVols = sensitives[m_nam];
for (int k = 0; k < nmodules; ++k) {
@@ -173,27 +173,25 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
if (!reflect) {
DetElement module(layer_element, m_base + "_pos", det_id);
- pv = layer_vol.placeVolume(
- m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, zstart + dz)));
+ pv = layer_vol.placeVolume(m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2),
+ Position(x, y, zstart + dz)));
pv.addPhysVolID("barrel", 1).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num);
module.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_elt(module, sens_pv.volume().name(), mod_num);
+ DetElement comp_elt(module, sens_pv.volume().name(), mod_num);
comp_elt.setPlacement(sens_pv);
-
}
} else {
- pv = layer_vol.placeVolume(
- m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, -zstart - dz)));
+ pv = layer_vol.placeVolume(m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2),
+ Position(x, y, -zstart - dz)));
pv.addPhysVolID("barrel", 2).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num);
DetElement r_module(layer_element, m_base + "_neg", det_id);
r_module.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_elt(r_module, sens_pv.volume().name(), mod_num);
+ DetElement comp_elt(r_module, sens_pv.volume().name(), mod_num);
comp_elt.setPlacement(sens_pv);
-
}
}
dz = -dz;
@@ -202,7 +200,8 @@ static Ref_t create_B0Preshower(Detector& description, xml_h e, SensitiveDetecto
}
}
}
- Transform3D posAndRot(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
+ Transform3D posAndRot(RotationZYX(rot.z(), rot.y(), rot.x()),
+ Position(pos.x(), pos.y(), pos.z()));
pv = motherVol.placeVolume(assembly, posAndRot);
pv.addPhysVolID("system", det_id);
sdet.setPlacement(pv);
diff --git a/src/B0Tracker_geo.cpp b/src/B0Tracker_geo.cpp
index ab175d319..ac6a3dc9d 100644
--- a/src/B0Tracker_geo.cpp
+++ b/src/B0Tracker_geo.cpp
@@ -22,37 +22,35 @@ using namespace dd4hep::detail;
* @author Whitney Armstrong
*
*/
-static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector sens)
-{
+static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector sens) {
typedef vector Placements;
- xml_det_t x_det = e;
- Material vacuum = description.vacuum();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- DetElement sdet(det_name, det_id);
- Assembly assembly(det_name);
+ xml_det_t x_det = e;
+ Material vacuum = description.vacuum();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ DetElement sdet(det_name, det_id);
+ Assembly assembly(det_name);
xml::Component pos = x_det.position();
xml::Component rot = x_det.rotation();
- Volume motherVol = description.pickMotherVolume(sdet);
- int m_id = 0, c_id = 0, n_sensor = 0;
+ Volume motherVol = description.pickMotherVolume(sdet);
+ int m_id = 0, c_id = 0, n_sensor = 0;
PlacedVolume pv;
- map modules;
- map sensitives;
+ map modules;
+ map sensitives;
map> volplane_surfaces;
map> module_thicknesses;
// Set detector type flag
dd4hep::xml::setDetectorTypeFlag(x_det, sdet);
- auto ¶ms = DD4hepDetectorHelper::ensureExtension(
- sdet);
+ auto& params = DD4hepDetectorHelper::ensureExtension(sdet);
// Add the volume boundary material if configured
for (xml_coll_t bmat(x_det, _Unicode(boundary_material)); bmat; ++bmat) {
xml_comp_t x_boundary_material = bmat;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, params,
- "boundary_material");
+ "boundary_material");
}
assembly.setVisAttributes(description.invisible());
@@ -60,41 +58,41 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) {
xml_comp_t x_mod = mi;
- string m_nam = x_mod.nameStr();
+ string m_nam = x_mod.nameStr();
xml_comp_t trd = x_mod.trd();
- double posY;
- double x1 = trd.x1();
- double x2 = trd.x2();
- double z = trd.z();
- double y1, y2, total_thickness = 0.;
+ double posY;
+ double x1 = trd.x1();
+ double x2 = trd.x2();
+ double z = trd.z();
+ double y1, y2, total_thickness = 0.;
xml_coll_t ci(x_mod, _U(module_component));
for (ci.reset(), total_thickness = 0.0; ci; ++ci)
total_thickness += xml_comp_t(ci).thickness();
y1 = y2 = total_thickness / 2;
Trapezoid m_solid(x1, x2, y1, y2, z);
- Volume m_volume(m_nam, m_solid, vacuum);
+ Volume m_volume(m_nam, m_solid, vacuum);
m_volume.setVisAttributes(description.visAttributes(x_mod.visStr()));
Solid frame_s;
if (x_mod.hasChild(_U(frame))) {
// build frame from trd (assumed to be smaller)
- xml_comp_t m_frame = x_mod.child(_U(frame));
- xml_comp_t f_pos = m_frame.child(_U(position));
- xml_comp_t frame_trd = m_frame.trd();
- double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
- double frame_x1 = frame_trd.x1();
- double frame_x2 = frame_trd.x2();
- double frame_z = frame_trd.z();
+ xml_comp_t m_frame = x_mod.child(_U(frame));
+ xml_comp_t f_pos = m_frame.child(_U(position));
+ xml_comp_t frame_trd = m_frame.trd();
+ double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
+ double frame_x1 = frame_trd.x1();
+ double frame_x2 = frame_trd.x2();
+ double frame_z = frame_trd.z();
// make the frame match the total thickness if thickness attribute is not given
- Trapezoid f_solid1(x1, x2, frame_thickness / 2.0, frame_thickness / 2.0, z);
- Trapezoid f_solid(frame_x1, frame_x2, frame_thickness / 2.0, frame_thickness / 2.0, frame_z);
+ Trapezoid f_solid1(x1, x2, frame_thickness / 2.0, frame_thickness / 2.0, z);
+ Trapezoid f_solid(frame_x1, frame_x2, frame_thickness / 2.0, frame_thickness / 2.0, frame_z);
SubtractionSolid frame_shape(f_solid1, f_solid);
frame_s = frame_shape;
Material f_mat = description.material(m_frame.materialStr());
- Volume f_vol(m_nam + "_frame", frame_shape, f_mat);
+ Volume f_vol(m_nam + "_frame", frame_shape, f_mat);
// f_vol.setVisAttributes(description.visAttributes(m_frame.visStr()));
// figure out how to best place
@@ -103,17 +101,17 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
double thickness_so_far = 0.0;
for (ci.reset(), n_sensor = 1, c_id = 0, posY = -y1; ci; ++ci, ++c_id) {
- xml_comp_t c = ci;
- double c_thick = c.thickness();
- auto comp_x1 = getAttrOrDefault(c, _Unicode(x1), x1);
- auto comp_x2 = getAttrOrDefault(c, _Unicode(x2), x2);
- auto comp_height = getAttrOrDefault(c, _Unicode(height), z);
+ xml_comp_t c = ci;
+ double c_thick = c.thickness();
+ auto comp_x1 = getAttrOrDefault(c, _Unicode(x1), x1);
+ auto comp_x2 = getAttrOrDefault(c, _Unicode(x2), x2);
+ auto comp_height = getAttrOrDefault(c, _Unicode(height), z);
- Material c_mat = description.material(c.materialStr());
- string c_name = _toString(c_id, "component%d");
+ Material c_mat = description.material(c.materialStr());
+ string c_name = _toString(c_id, "component%d");
Trapezoid comp_s1(comp_x1, comp_x2, c_thick / 2e0, c_thick / 2e0, comp_height);
- Solid comp_shape = comp_s1;
+ Solid comp_shape = comp_s1;
if (frame_s.isValid()) {
comp_shape = SubtractionSolid(comp_s1, frame_s);
}
@@ -123,7 +121,8 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
pv = m_volume.placeVolume(c_vol, Position(0, posY + c_thick / 2, 0));
if (c.isSensitive()) {
// std::cout << " adding sensitive volume" << c_name << "\n";
- sdet.check(n_sensor > 2, "SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
+ sdet.check(n_sensor > 2,
+ "SiTrackerEndcap2::fromCompact: " + c_name + " Max of 2 modules allowed!");
pv.addPhysVolID("sensor", n_sensor);
c_vol.setSensitiveDetector(sens);
sensitives[m_nam].push_back(pv);
@@ -158,20 +157,20 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
for (xml_coll_t li(x_det, _U(layer)); li; ++li) {
xml_comp_t x_layer(li);
- int l_id = x_layer.id();
- int mod_num = 1;
-
- xml_comp_t l_env = x_layer.child(_U(envelope));
- string layer_name = det_name + std::string("_layer") + std::to_string(l_id);
-
- std::string layer_vis = l_env.attr(_Unicode(vis));
- double layer_rmin_tolerance = l_env.attr(_Unicode(rmin_tolerance));
- double layer_rmax_tolerance = l_env.attr(_Unicode(rmax_tolerance));
- double layer_zmin_tolerance = l_env.attr(_Unicode(zmin_tolerance));
- double layer_zmax_tolerance = l_env.attr(_Unicode(zmax_tolerance));
- double layer_length = l_env.attr(_Unicode(length));
- double layer_zstart = l_env.attr(_Unicode(zstart));
- double layer_center_z = layer_zstart + layer_length / 2.0;
+ int l_id = x_layer.id();
+ int mod_num = 1;
+
+ xml_comp_t l_env = x_layer.child(_U(envelope));
+ string layer_name = det_name + std::string("_layer") + std::to_string(l_id);
+
+ std::string layer_vis = l_env.attr(_Unicode(vis));
+ double layer_rmin_tolerance = l_env.attr(_Unicode(rmin_tolerance));
+ double layer_rmax_tolerance = l_env.attr(_Unicode(rmax_tolerance));
+ double layer_zmin_tolerance = l_env.attr(_Unicode(zmin_tolerance));
+ double layer_zmax_tolerance = l_env.attr(_Unicode(zmax_tolerance));
+ double layer_length = l_env.attr(_Unicode(length));
+ double layer_zstart = l_env.attr(_Unicode(zstart));
+ double layer_center_z = layer_zstart + layer_length / 2.0;
// printout(INFO,"ROOTGDMLParse","+++ Read geometry from GDML file file:%s",input.c_str());
// std::cout << "SiTracker Endcap layer " << l_id << " zstart = " << layer_zstart/dd4hep::mm << "mm ( " <<
// layer_length/dd4hep::mm << " mm thick )\n";
@@ -184,22 +183,21 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
DetElement layer_element(sdet, layer_name, l_id);
layer_element.setPlacement(layer_pv);
- auto &layerParams =
- DD4hepDetectorHelper::ensureExtension(
- layer_element);
+ auto& layerParams =
+ DD4hepDetectorHelper::ensureExtension(layer_element);
for (xml_coll_t ri(x_layer, _U(ring)); ri; ++ri) {
- xml_comp_t x_ring = ri;
- double r = x_ring.r();
- double phi0 = x_ring.phi0(0);
- double zstart = x_ring.zstart();
- double dz = x_ring.dz(0);
- int nmodules = x_ring.nmodules();
- string m_nam = x_ring.moduleStr();
- Volume m_vol = modules[m_nam];
- double iphi = 2 * M_PI / nmodules;
- double dphi = dd4hep::getAttrOrDefault(x_ring, _Unicode(dphi), iphi);
- double phi = phi0;
+ xml_comp_t x_ring = ri;
+ double r = x_ring.r();
+ double phi0 = x_ring.phi0(0);
+ double zstart = x_ring.zstart();
+ double dz = x_ring.dz(0);
+ int nmodules = x_ring.nmodules();
+ string m_nam = x_ring.moduleStr();
+ Volume m_vol = modules[m_nam];
+ double iphi = 2 * M_PI / nmodules;
+ double dphi = dd4hep::getAttrOrDefault(x_ring, _Unicode(dphi), iphi);
+ double phi = phi0;
Placements& sensVols = sensitives[m_nam];
for (int k = 0; k < nmodules; ++k) {
@@ -209,15 +207,16 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
// if (!reflect) {
DetElement module(layer_element, m_base + "_pos", det_id);
- pv = layer_vol.placeVolume(
- m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, zstart + dz)));
+ pv = layer_vol.placeVolume(m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2),
+ Position(x, y, zstart + dz)));
pv.addPhysVolID("layer", l_id).addPhysVolID("module", mod_num);
module.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_elt(module, sens_pv.volume().name(), mod_num);
+ DetElement comp_elt(module, sens_pv.volume().name(), mod_num);
comp_elt.setPlacement(sens_pv);
- auto &comp_elt_params = DD4hepDetectorHelper::ensureExtension(comp_elt);
+ auto& comp_elt_params =
+ DD4hepDetectorHelper::ensureExtension(comp_elt);
comp_elt_params.set("axis_definitions", "XZY");
volSurfaceList(comp_elt)->push_back(volplane_surfaces[m_nam][ic]);
}
@@ -227,17 +226,19 @@ static Ref_t create_B0Tracker(Detector& description, xml_h e, SensitiveDetector
}
}
layer_vol->GetShape()->ComputeBBox();
- layerParams.set("envelope_r_min", layer_rmin_tolerance/dd4hep::mm);
- layerParams.set("envelope_r_max", layer_rmax_tolerance/dd4hep::mm);
- layerParams.set("envelope_z_min", layer_zmin_tolerance/dd4hep::mm);
- layerParams.set("envelope_z_max", layer_zmax_tolerance/dd4hep::mm);
+ layerParams.set("envelope_r_min", layer_rmin_tolerance / dd4hep::mm);
+ layerParams.set("envelope_r_max", layer_rmax_tolerance / dd4hep::mm);
+ layerParams.set("envelope_z_min", layer_zmin_tolerance / dd4hep::mm);
+ layerParams.set("envelope_z_max", layer_zmax_tolerance / dd4hep::mm);
for (xml_coll_t lmat(x_layer, _Unicode(layer_material)); lmat; ++lmat) {
xml_comp_t x_layer_material = lmat;
- DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams, "layer_material");
+ DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams,
+ "layer_material");
}
}
- Transform3D posAndRot(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
+ Transform3D posAndRot(RotationZYX(rot.z(), rot.y(), rot.x()),
+ Position(pos.x(), pos.y(), pos.z()));
pv = motherVol.placeVolume(assembly, posAndRot);
pv.addPhysVolID("system", det_id);
sdet.setPlacement(pv);
diff --git a/src/BackwardsBeamPipe_geo.cpp b/src/BackwardsBeamPipe_geo.cpp
index 54d12bfcb..127aa1c7d 100644
--- a/src/BackwardsBeamPipe_geo.cpp
+++ b/src/BackwardsBeamPipe_geo.cpp
@@ -20,26 +20,27 @@
using namespace std;
using namespace dd4hep;
-static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens */)
-{
+static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens */) {
using namespace ROOT::Math;
- xml_det_t x_det = e;
- string det_name = x_det.nameStr();
+ xml_det_t x_det = e;
+ string det_name = x_det.nameStr();
DetElement sdet(det_name, x_det.id());
- Assembly assembly(det_name + "_assembly");
- Material m_Al = det.material("Aluminum");
- Material m_Vacuum = det.material("Vacuum");
- string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis");
+ Assembly assembly(det_name + "_assembly");
+ Material m_Al = det.material("Aluminum");
+ Material m_Vacuum = det.material("Vacuum");
+ string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis");
xml::Component Pipe_c = x_det.child(_Unicode(Pipe));
// Get pipe dimensions from xml
double thickness = Pipe_c.attr(_Unicode(wall_thickness));
- double innerD1 = Pipe_c.hasAttr(_Unicode(innerD1)) ? Pipe_c.attr(_Unicode(innerD1))
- : Pipe_c.attr(_Unicode(outerD1)) - 2 * thickness;
- double innerD2 = Pipe_c.hasAttr(_Unicode(innerD2)) ? Pipe_c.attr(_Unicode(innerD2))
- : Pipe_c.attr(_Unicode(outerD2)) - 2 * thickness;
+ double innerD1 = Pipe_c.hasAttr(_Unicode(innerD1))
+ ? Pipe_c.attr(_Unicode(innerD1))
+ : Pipe_c.attr(_Unicode(outerD1)) - 2 * thickness;
+ double innerD2 = Pipe_c.hasAttr(_Unicode(innerD2))
+ ? Pipe_c.attr(_Unicode(innerD2))
+ : Pipe_c.attr(_Unicode(outerD2)) - 2 * thickness;
double end1z = Pipe_c.attr(_Unicode(end1z));
double end2z = Pipe_c.attr(_Unicode(end2z));
@@ -65,8 +66,8 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
// -----------------------------
// final placement
- auto pv_assembly =
- det.pickMotherVolume(sdet).placeVolume(assembly, Transform3D(RotationY(yrot), Position(end1x, 0.0, end1z)));
+ auto pv_assembly = det.pickMotherVolume(sdet).placeVolume(
+ assembly, Transform3D(RotationY(yrot), Position(end1x, 0.0, end1z)));
pv_assembly.addPhysVolID("system", sdet.id()).addPhysVolID("barrel", 1);
sdet.setPlacement(pv_assembly);
assembly->GetShape()->ComputeBBox();
diff --git a/src/BackwardsCollimator.cpp b/src/BackwardsCollimator.cpp
index d511e5cdc..d86a3aea0 100644
--- a/src/BackwardsCollimator.cpp
+++ b/src/BackwardsCollimator.cpp
@@ -31,30 +31,29 @@ using namespace dd4hep;
* \endcode
*
*/
-static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens */)
-{
+static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens */) {
using namespace ROOT::Math;
- xml_det_t x_det = e;
- string det_name = x_det.nameStr();
+ xml_det_t x_det = e;
+ string det_name = x_det.nameStr();
DetElement sdet(det_name, x_det.id());
- Assembly assembly(det_name + "_assembly");
- Material m_Steel = det.material("StainlessSteel");
- Material m_Vacuum = det.material("Vacuum");
- string vis_name = x_det.visStr();
+ Assembly assembly(det_name + "_assembly");
+ Material m_Steel = det.material("StainlessSteel");
+ Material m_Vacuum = det.material("Vacuum");
+ string vis_name = x_det.visStr();
xml::Component box_dim = x_det.child(_Unicode(dimensions));
- double height = box_dim.attr(_Unicode(height));
- double width = box_dim.attr(_Unicode(width));
- double depth = box_dim.attr(_Unicode(depth));
+ double height = box_dim.attr(_Unicode(height));
+ double width = box_dim.attr(_Unicode(width));
+ double depth = box_dim.attr(_Unicode(depth));
- xml::Component col_XS = x_det.child(_Unicode(collimator));
- double colHeight = col_XS.attr(_Unicode(height));
- double colWidth = col_XS.attr(_Unicode(width));
- double colXOff = col_XS.attr(_Unicode(xOff));
+ xml::Component col_XS = x_det.child(_Unicode(collimator));
+ double colHeight = col_XS.attr(_Unicode(height));
+ double colWidth = col_XS.attr(_Unicode(width));
+ double colXOff = col_XS.attr(_Unicode(xOff));
xml::Component box_place = x_det.child(_Unicode(placement));
- double zOff = box_place.attr(_Unicode(z));
+ double zOff = box_place.attr(_Unicode(z));
Box box_steel(width, height, depth);
Box box_vacuum(colWidth, colHeight, depth);
diff --git a/src/BackwardsLumiVac_geo.cpp b/src/BackwardsLumiVac_geo.cpp
index e5d4974ff..fd89fa2fd 100644
--- a/src/BackwardsLumiVac_geo.cpp
+++ b/src/BackwardsLumiVac_geo.cpp
@@ -9,8 +9,7 @@
using namespace std;
using namespace dd4hep;
-static Ref_t createDetector(Detector& lccdd, xml_h e, SensitiveDetector /*sens*/)
-{
+static Ref_t createDetector(Detector& lccdd, xml_h e, SensitiveDetector /*sens*/) {
xml_det_t x_det = e;
@@ -74,7 +73,7 @@ static Ref_t createDetector(Detector& lccdd, xml_h e, SensitiveDetector /*sens*/
DetElement det(x_det.nameStr(), x_det.id());
- Transform3D pos(RotationZYX(0, 0, 0), Position(0, 0, zcen));
+ Transform3D pos(RotationZYX(0, 0, 0), Position(0, 0, zcen));
PlacedVolume pv = lccdd.pickMotherVolume(det).placeVolume(vol, pos);
det.setPlacement(pv);
diff --git a/src/BarrelBarDetectorWithSideFrame_geo.cpp b/src/BarrelBarDetectorWithSideFrame_geo.cpp
index aaf60b42a..61c3c634e 100644
--- a/src/BarrelBarDetectorWithSideFrame_geo.cpp
+++ b/src/BarrelBarDetectorWithSideFrame_geo.cpp
@@ -32,24 +32,24 @@ using namespace dd4hep;
* for e.g. the DIRC
*
*/
-static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h e, SensitiveDetector sens)
-{
- typedef vector Placements;
- xml_det_t x_det = e;
- Material air = description.air();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- DetElement sdet(det_name, det_id);
- map volumes;
- map sensitives;
+static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h e,
+ SensitiveDetector sens) {
+ typedef vector Placements;
+ xml_det_t x_det = e;
+ Material air = description.air();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ DetElement sdet(det_name, det_id);
+ map volumes;
+ map sensitives;
map> volplane_surfaces;
- PlacedVolume pv;
- dd4hep::xml::Dimension dimensions(x_det.dimensions());
- xml_dim_t dirc_pos = x_det.position();
+ PlacedVolume pv;
+ dd4hep::xml::Dimension dimensions(x_det.dimensions());
+ xml_dim_t dirc_pos = x_det.position();
map> module_thicknesses;
- Tube topVolumeShape(dimensions.rmin(), dimensions.rmax(), dimensions.length() * 0.5);
+ Tube topVolumeShape(dimensions.rmin(), dimensions.rmax(), dimensions.length() * 0.5);
Volume assembly(det_name, topVolumeShape, air);
sens.setType("tracker");
@@ -57,7 +57,7 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
// loop over the modules
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
xml_comp_t x_mod = mi;
- string m_nam = x_mod.nameStr();
+ string m_nam = x_mod.nameStr();
if (volumes.find(m_nam) != volumes.end()) {
printout(ERROR, "BarrelBarDetectorWithSideFrame",
@@ -65,7 +65,7 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
throw runtime_error("Logics error in building modules.");
}
- int ncomponents = 0;
+ int ncomponents = 0;
double total_thickness = 0;
// Compute module total thickness from components
@@ -98,12 +98,12 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
double max_component_width = 0;
for (xml_coll_t mci(x_mod, _U(module_component)); mci; ++mci, ++ncomponents) {
xml_comp_t x_comp = mci;
- string c_nam = _toString(ncomponents, "component%d");
+ string c_nam = _toString(ncomponents, "component%d");
double box_width = x_comp.width() - 2 * frame_width;
max_component_width = fmax(max_component_width, box_width);
- Box c_box{box_width / 2, x_comp.length() / 2, x_comp.thickness() / 2};
+ Box c_box{box_width / 2, x_comp.length() / 2, x_comp.thickness() / 2};
Volume c_vol{c_nam, c_box, description.material(x_comp.materialStr())};
pv = m_vol.placeVolume(c_vol, Position(0, 0, thickness_sum + x_comp.thickness() / 2.0));
@@ -136,8 +136,8 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
}
// Now add-on the frame
if (x_mod.hasChild(_U(frame))) {
- xml_comp_t m_frame = x_mod.child(_U(frame));
- double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
+ xml_comp_t m_frame = x_mod.child(_U(frame));
+ double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
Box lframe_box{m_frame.width() / 2., m_frame.length() / 2., frame_thickness / 2.};
Box rframe_box{m_frame.width() / 2., m_frame.length() / 2., frame_thickness / 2.};
@@ -162,17 +162,17 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
xml_comp_t x_barrel = x_layer.child(_U(barrel_envelope));
xml_comp_t x_layout = x_layer.child(_U(rphi_layout));
xml_comp_t z_layout = x_layer.child(_U(z_layout)); // Get the element.
- int lay_id = x_layer.id();
- string m_nam = x_layer.moduleStr();
- string lay_nam = _toString(x_layer.id(), "layer%d");
- Tube lay_tub(x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.z_length() / 2.0);
- Volume lay_vol(lay_nam, lay_tub, air); // Create the layer envelope volume.
+ int lay_id = x_layer.id();
+ string m_nam = x_layer.moduleStr();
+ string lay_nam = _toString(x_layer.id(), "layer%d");
+ Tube lay_tub(x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.z_length() / 2.0);
+ Volume lay_vol(lay_nam, lay_tub, air); // Create the layer envelope volume.
lay_vol.setVisAttributes(description, x_layer.visStr());
double phi0 = x_layout.phi0(); // Starting phi of first module.
double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a module.
double rc = x_layout.rc(); // Radius of the module center.
- int nphi = x_layout.nphi(); // Number of modules in phi.
+ int nphi = x_layout.nphi(); // Number of modules in phi.
double rphi_dr = x_layout.dr(); // The delta radius of every other module.
double phi_incr = (M_PI * 2) / nphi; // Phi increment for one module.
double phic = phi0; // Phi of the module center.
@@ -180,8 +180,8 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
double nz = z_layout.nz(); // Number of modules to place in z.
double z_dr = z_layout.dr(); // Radial displacement parameter, of every other module.
- Volume module_env = volumes[m_nam];
- DetElement lay_elt(sdet, _toString(x_layer.id(), "layer%d"), lay_id);
+ Volume module_env = volumes[m_nam];
+ DetElement lay_elt(sdet, _toString(x_layer.id(), "layer%d"), lay_id);
Placements& sensVols = sensitives[m_nam];
// Z increment for module placement along Z axis.
@@ -190,7 +190,7 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
// Starting z for module placement along Z axis.
double module_z = -z0;
- int module = 1;
+ int module = 1;
// Loop over the number of modules in phi.
for (int ii = 0; ii < nphi; ii++) {
@@ -201,10 +201,11 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
// Loop over the number of modules in z.
for (int j = 0; j < nz; j++) {
- string module_name = _toString(module, "module%d");
+ string module_name = _toString(module, "module%d");
DetElement mod_elt(lay_elt, module_name, module);
- Transform3D tr(RotationZYX(0, ((M_PI / 2) - phic - phi_tilt), -M_PI / 2), Position(x, y, module_z));
+ Transform3D tr(RotationZYX(0, ((M_PI / 2) - phic - phi_tilt), -M_PI / 2),
+ Position(x, y, module_z));
pv = lay_vol.placeVolume(module_env, tr);
pv.addPhysVolID("module", module);
@@ -212,7 +213,7 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
mod_elt.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
+ DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
comp_de.setPlacement(sens_pv);
rec::volSurfaceList(comp_de)->push_back(volplane_surfaces[m_nam][ic]);
}
@@ -236,7 +237,8 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h
// Create the PhysicalVolume for the layer.
pv = assembly.placeVolume(lay_vol); // Place layer in mother
pv.addPhysVolID("layer", lay_id); // Set the layer ID.
- lay_elt.setAttributes(description, lay_vol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
+ lay_elt.setAttributes(description, lay_vol, x_layer.regionStr(), x_layer.limitsStr(),
+ x_layer.visStr());
lay_elt.setPlacement(pv);
}
sdet.setAttributes(description, assembly, x_det.regionStr(), x_det.limitsStr(), x_det.visStr());
diff --git a/src/BarrelCalorimeterImaging_geo.cpp b/src/BarrelCalorimeterImaging_geo.cpp
index 190c14eb5..93bb7c737 100644
--- a/src/BarrelCalorimeterImaging_geo.cpp
+++ b/src/BarrelCalorimeterImaging_geo.cpp
@@ -33,25 +33,25 @@ static void buildSupport(Detector& desc, Volume& mother, xml_comp_t x_support,
const std::tuple& dimensions);
// barrel ecal layers contained in an assembly
-static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
-{
- xml_det_t x_detector = e;
- int detector_id = x_detector.id();
+static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) {
+ xml_det_t x_detector = e;
+ int detector_id = x_detector.id();
std::string detector_name = x_detector.nameStr();
- double offset = x_detector.attr(_Unicode(offset));
- xml_comp_t x_dimensions = x_detector.dimensions();
- int nsides = x_dimensions.numsides();
- double inner_r = x_dimensions.rmin();
- double dphi = (2 * M_PI / nsides);
- double half_dphi = dphi / 2;
+ double offset = x_detector.attr(_Unicode(offset));
+ xml_comp_t x_dimensions = x_detector.dimensions();
+ int nsides = x_dimensions.numsides();
+ double inner_r = x_dimensions.rmin();
+ double dphi = (2 * M_PI / nsides);
+ double half_dphi = dphi / 2;
DetElement sdet(detector_name, detector_id);
- Volume mother_volume = desc.pickMotherVolume(sdet);
+ Volume mother_volume = desc.pickMotherVolume(sdet);
Assembly detector_volume(detector_name);
- detector_volume.setAttributes(desc, x_detector.regionStr(), x_detector.limitsStr(), x_detector.visStr());
+ detector_volume.setAttributes(desc, x_detector.regionStr(), x_detector.limitsStr(),
+ x_detector.visStr());
- Transform3D detector_tr = Translation3D(0, 0, offset) * RotationZ(half_dphi);
+ Transform3D detector_tr = Translation3D(0, 0, offset) * RotationZ(half_dphi);
PlacedVolume detector_physvol = mother_volume.placeVolume(detector_volume, detector_tr);
sens.setType("calorimeter");
@@ -60,7 +60,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// build a single sector
DetElement sector_element("sector0", detector_id);
- Assembly sector_volume("sector");
+ Assembly sector_volume("sector");
if (x_detector.hasChild(_Unicode(sectors))) {
xml_comp_t x_sectors = x_detector.child(_Unicode(sectors));
sector_volume.setVisAttributes(desc.visAttributes(x_sectors.visStr()));
@@ -75,21 +75,22 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Loop over the modules
using dd4hep::rec::VolPlane;
- std::map volumes;
+ std::map volumes;
std::map> sensitives;
- std::map> volplane_surfaces;
- std::map> module_thicknesses;
+ std::map> volplane_surfaces;
+ std::map> module_thicknesses;
for (xml_coll_t i_module(x_detector, _U(module)); i_module; ++i_module) {
- xml_comp_t x_module = i_module;
+ xml_comp_t x_module = i_module;
std::string module_name = x_module.nameStr();
if (volumes.find(module_name) != volumes.end()) {
- printout(ERROR, "BarrelCalorimeterImaging", "Module with name %s already exists", module_name.c_str());
+ printout(ERROR, "BarrelCalorimeterImaging", "Module with name %s already exists",
+ module_name.c_str());
throw std::runtime_error("Logics error in building modules.");
}
// Compute module total thickness from components
- double total_thickness = 0;
+ double total_thickness = 0;
xml_coll_t ci(x_module, _U(module_component));
for (ci.reset(), total_thickness = 0.0; ci; ++ci) {
total_thickness += xml_comp_t(ci).thickness();
@@ -101,35 +102,40 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
module_volume.setVisAttributes(desc.visAttributes(x_module.visStr()));
// Add components
- int sensor_number = 1;
- int ncomponents = 0;
+ int sensor_number = 1;
+ int ncomponents = 0;
double thickness_so_far = 0.0;
double thickness_sum = -total_thickness / 2.0;
- for (xml_coll_t i_component(x_module, _U(module_component)); i_component; ++i_component, ++ncomponents) {
- xml_comp_t x_component = i_component;
- xml_comp_t x_component_pos = x_component.position(false);
- xml_comp_t x_component_rot = x_component.rotation(false);
- const std::string component_name = _toString(ncomponents, "component%d");
- Box component_box(x_component.width() / 2, x_component.length() / 2, x_component.thickness() / 2);
- Volume component_volume(component_name, component_box, desc.material(x_component.materialStr()));
- component_volume.setAttributes(desc, x_component.regionStr(), x_component.limitsStr(), x_component.visStr());
+ for (xml_coll_t i_component(x_module, _U(module_component)); i_component;
+ ++i_component, ++ncomponents) {
+ xml_comp_t x_component = i_component;
+ xml_comp_t x_component_pos = x_component.position(false);
+ xml_comp_t x_component_rot = x_component.rotation(false);
+ const std::string component_name = _toString(ncomponents, "component%d");
+ Box component_box(x_component.width() / 2, x_component.length() / 2,
+ x_component.thickness() / 2);
+ Volume component_volume(component_name, component_box,
+ desc.material(x_component.materialStr()));
+ component_volume.setAttributes(desc, x_component.regionStr(), x_component.limitsStr(),
+ x_component.visStr());
// Loop over the slices for this component
- int slice_num = 1;
+ int slice_num = 1;
double slice_pos_z = -x_component.thickness() / 2;
for (xml_coll_t i_slice(x_component, _U(slice)); i_slice; ++i_slice) {
- xml_comp_t x_slice = i_slice;
- std::string slice_name = Form("slice%d", slice_num);
- double slice_dim_x = x_component.width() / 2;
- double slice_dim_y = x_component.length() / 2;
- double slice_dim_z = x_slice.thickness() / 2;
- Box slice_shape(slice_dim_x, slice_dim_y, slice_dim_z);
- Volume slice_volume(slice_name, slice_shape, desc.material(x_slice.materialStr()));
- slice_volume.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
+ xml_comp_t x_slice = i_slice;
+ std::string slice_name = Form("slice%d", slice_num);
+ double slice_dim_x = x_component.width() / 2;
+ double slice_dim_y = x_component.length() / 2;
+ double slice_dim_z = x_slice.thickness() / 2;
+ Box slice_shape(slice_dim_x, slice_dim_y, slice_dim_z);
+ Volume slice_volume(slice_name, slice_shape, desc.material(x_slice.materialStr()));
+ slice_volume.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(),
+ x_slice.visStr());
// Place slice
- PlacedVolume slice_physvol =
- component_volume.placeVolume(slice_volume, Position(0, 0, slice_pos_z + x_slice.thickness() / 2));
+ PlacedVolume slice_physvol = component_volume.placeVolume(
+ slice_volume, Position(0, 0, slice_pos_z + x_slice.thickness() / 2));
// Set sensitive
if (x_slice.isSensitive()) {
@@ -147,15 +153,19 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
const double zoff = thickness_sum + x_component.thickness() / 2.0;
PlacedVolume component_physvol;
if (x_component_pos && x_component_rot) {
- Position component_pos(x_component_pos.x(0), x_component_pos.y(0), x_component_pos.z(0) + zoff);
+ Position component_pos(x_component_pos.x(0), x_component_pos.y(0),
+ x_component_pos.z(0) + zoff);
RotationZYX component_rot(x_component_rot.z(0), x_component_rot.y(0), x_component_rot.x(0));
- component_physvol = module_volume.placeVolume(component_volume, Transform3D(component_rot, component_pos));
+ component_physvol =
+ module_volume.placeVolume(component_volume, Transform3D(component_rot, component_pos));
} else if (x_component_rot) {
- Position component_pos(0, 0, zoff);
+ Position component_pos(0, 0, zoff);
RotationZYX component_rot(x_component_rot.z(0), x_component_rot.y(0), x_component_rot.x(0));
- component_physvol = module_volume.placeVolume(component_volume, Transform3D(component_rot, component_pos));
+ component_physvol =
+ module_volume.placeVolume(component_volume, Transform3D(component_rot, component_pos));
} else if (x_component_pos) {
- Position component_pos(x_component_pos.x(0), x_component_pos.y(0), x_component_pos.z(0) + zoff);
+ Position component_pos(x_component_pos.x(0), x_component_pos.y(0),
+ x_component_pos.z(0) + zoff);
component_physvol = module_volume.placeVolume(component_volume, component_pos);
} else {
Position component_pos(0, 0, zoff);
@@ -167,7 +177,8 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
component_volume.setSensitiveDetector(sens);
sensitives[module_name].push_back(component_physvol);
module_thicknesses[module_name] = {thickness_so_far + x_component.thickness() / 2.0,
- total_thickness - thickness_so_far - x_component.thickness() / 2.0};
+ total_thickness - thickness_so_far -
+ x_component.thickness() / 2.0};
}
thickness_sum += x_component.thickness();
@@ -181,35 +192,36 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
}
}
if (x_detector.hasChild(_Unicode(support))) {
- buildSupport(desc, sector_volume, x_detector.child(_Unicode(support)), {inner_r, layer_pos_z, x_dimensions.z(), half_dphi});
+ buildSupport(desc, sector_volume, x_detector.child(_Unicode(support)),
+ {inner_r, layer_pos_z, x_dimensions.z(), half_dphi});
}
//Loop over the sets of layer elements in the detector.
int layer_num = 1;
for (xml_coll_t i_layer(x_detector, _U(layer)); i_layer; ++i_layer) {
- xml_comp_t x_layer = i_layer;
- int layer_repeat = x_layer.repeat();
- double layer_thickness = x_layer.thickness();
- bool layer_has_frame = x_layer.hasChild(_Unicode(frame));
- double layer_space_between = getAttrOrDefault(x_layer, _Unicode(space_between), 0.);
- double layer_space_before = getAttrOrDefault(x_layer, _Unicode(space_before), 0.);
+ xml_comp_t x_layer = i_layer;
+ int layer_repeat = x_layer.repeat();
+ double layer_thickness = x_layer.thickness();
+ bool layer_has_frame = x_layer.hasChild(_Unicode(frame));
+ double layer_space_between = getAttrOrDefault(x_layer, _Unicode(space_between), 0.);
+ double layer_space_before = getAttrOrDefault(x_layer, _Unicode(space_before), 0.);
layer_pos_z += layer_space_before;
// Loop over number of repeats for this layer.
for (int layer_j = 0; layer_j < layer_repeat; layer_j++) {
// Make an envelope for this layer
- std::string layer_name = Form("layer%d", layer_num);
- double layer_dim_x = tan_half_dphi * layer_pos_z;
- auto layer_mat = desc.air();
-
- Position layer_pos(0, 0, layer_pos_z + layer_thickness / 2.);
- double layer_trd_x1 = layer_dim_x;
- double layer_trd_x2 = layer_dim_x + layer_thickness * tan_half_dphi;
- double layer_trd_y1 = layer_dim_y;
- double layer_trd_y2 = layer_trd_y1;
- double layer_trd_z = layer_thickness / 2; // account for frame
- Trapezoid layer_shape(layer_trd_x1, layer_trd_x2, layer_trd_y1, layer_trd_y2, layer_trd_z);
- Volume layer_volume(layer_name, layer_shape, layer_mat);
+ std::string layer_name = Form("layer%d", layer_num);
+ double layer_dim_x = tan_half_dphi * layer_pos_z;
+ auto layer_mat = desc.air();
+
+ Position layer_pos(0, 0, layer_pos_z + layer_thickness / 2.);
+ double layer_trd_x1 = layer_dim_x;
+ double layer_trd_x2 = layer_dim_x + layer_thickness * tan_half_dphi;
+ double layer_trd_y1 = layer_dim_y;
+ double layer_trd_y2 = layer_trd_y1;
+ double layer_trd_z = layer_thickness / 2; // account for frame
+ Trapezoid layer_shape(layer_trd_x1, layer_trd_x2, layer_trd_y1, layer_trd_y2, layer_trd_z);
+ Volume layer_volume(layer_name, layer_shape, layer_mat);
DetElement layer_element(sector_element, layer_name, detector_id);
// Set region, limitset, and vis of layer.
@@ -218,25 +230,26 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Loop over the staves for this layer.
int stave_num = 1;
for (xml_coll_t i_stave(x_layer, _U(stave)); i_stave; ++i_stave) {
- xml_comp_t x_stave = i_stave;
- int stave_repeat = x_stave.repeat();
- double stave_thick = x_stave.thickness();
- double stave_dim_x = x_stave.width() / 2.0;
- double stave_dim_y = x_stave.length() / 2.0;
- double stave_dim_z = stave_thick / 2.0;
- double stave_rot_y = getAttrOrDefault(x_stave, _Unicode(angle), 0.);
- double stave_off_z = getAttrOrDefault(x_stave, _Unicode(offset), 0.);
+ xml_comp_t x_stave = i_stave;
+ int stave_repeat = x_stave.repeat();
+ double stave_thick = x_stave.thickness();
+ double stave_dim_x = x_stave.width() / 2.0;
+ double stave_dim_y = x_stave.length() / 2.0;
+ double stave_dim_z = stave_thick / 2.0;
+ double stave_rot_y = getAttrOrDefault(x_stave, _Unicode(angle), 0.);
+ double stave_off_z = getAttrOrDefault(x_stave, _Unicode(offset), 0.);
// Arrange staves symmetrically around center of layer
double stave_pos_x = -layer_dim_x + stave_dim_x;
double stave_pitch = -2.0 * stave_pos_x / (stave_repeat - 1);
// Make one stave
- std::string stave_name = Form("stave%d", stave_num);
- auto stave_material = desc.air();
- Box stave_shape(stave_dim_x, stave_dim_y, stave_dim_z);
- Volume stave_volume(stave_name, stave_shape, stave_material);
- stave_volume.setAttributes(desc, x_stave.regionStr(), x_stave.limitsStr(), x_stave.visStr());
+ std::string stave_name = Form("stave%d", stave_num);
+ auto stave_material = desc.air();
+ Box stave_shape(stave_dim_x, stave_dim_y, stave_dim_z);
+ Volume stave_volume(stave_name, stave_shape, stave_material);
+ stave_volume.setAttributes(desc, x_stave.regionStr(), x_stave.limitsStr(),
+ x_stave.visStr());
DetElement stave_element(layer_element, stave_name, detector_id);
// Loop over the slices for this stave
@@ -244,26 +257,26 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Place in xy_layout
if (x_stave.hasChild(_Unicode(xy_layout))) {
- auto module_str = x_stave.moduleStr();
+ auto module_str = x_stave.moduleStr();
auto& module_volume = volumes[module_str];
auto& module_sensitives = sensitives[module_str];
// Get layout grid pitch
xml_comp_t x_xy_layout = x_stave.child(_Unicode(xy_layout));
- auto dx = x_xy_layout.attr(_Unicode(dx));
- auto dy = x_xy_layout.attr(_Unicode(dy));
+ auto dx = x_xy_layout.attr(_Unicode(dx));
+ auto dy = x_xy_layout.attr(_Unicode(dy));
// Default to filling
auto nx = getAttrOrDefault(x_xy_layout, _Unicode(nx), floor(2. * stave_dim_x / dx));
auto ny = getAttrOrDefault(x_xy_layout, _Unicode(ny), floor(2. * stave_dim_y / dy));
- printout(DEBUG, "BarrelCalorimeterImaging", "Stave %s layout with %d by %d modules", stave_name.c_str(), nx,
- ny);
+ printout(DEBUG, "BarrelCalorimeterImaging", "Stave %s layout with %d by %d modules",
+ stave_name.c_str(), nx, ny);
// Default to centered
auto x0 = getAttrOrDefault(x_xy_layout, _Unicode(x0), -(nx - 1) * dx / 2.);
auto y0 = getAttrOrDefault(x_xy_layout, _Unicode(x0), -(ny - 1) * dy / 2.);
- printout(DEBUG, "BarrelCalorimeterImaging", "Stave %s modules starting at x=%f, y=%f", stave_name.c_str(), x0,
- y0);
+ printout(DEBUG, "BarrelCalorimeterImaging", "Stave %s modules starting at x=%f, y=%f",
+ stave_name.c_str(), x0, y0);
// Place modules
int i_module = 0;
@@ -272,23 +285,25 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Create module
std::string module_name = _toString(i_module, "module%d");
- DetElement module_element(stave_element, module_name, i_module);
+ DetElement module_element(stave_element, module_name, i_module);
// Place module
- auto x = x0 + i_x * dx;
- auto y = y0 + i_y * dy;
- Position module_pos(x, y, 0);
+ auto x = x0 + i_x * dx;
+ auto y = y0 + i_y * dy;
+ Position module_pos(x, y, 0);
PlacedVolume module_physvol = stave_volume.placeVolume(module_volume, module_pos);
module_physvol.addPhysVolID("module", i_module);
module_element.setPlacement(module_physvol);
// Add sensitive volumes
for (auto& sensitive_physvol : module_sensitives) {
- DetElement sensitive_element(module_element, sensitive_physvol.volume().name(), i_module);
+ DetElement sensitive_element(module_element, sensitive_physvol.volume().name(),
+ i_module);
sensitive_element.setPlacement(sensitive_physvol);
auto& sensitive_element_params =
- DD4hepDetectorHelper::ensureExtension(sensitive_element);
+ DD4hepDetectorHelper::ensureExtension(
+ sensitive_element);
sensitive_element_params.set("axis_definitions", "XYZ");
}
@@ -301,15 +316,16 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Loop over the slices for this stave
int slice_num = 1;
for (xml_coll_t i_slice(x_stave, _U(slice)); i_slice; ++i_slice) {
- xml_comp_t x_slice = i_slice;
- std::string slice_name = Form("slice%d", slice_num);
- double slice_thick = x_slice.thickness();
- double slice_dim_x = stave_dim_x;
- double slice_dim_y = stave_dim_y;
- double slice_dim_z = slice_thick / 2.;
- Box slice_shape(slice_dim_x, slice_dim_y, slice_dim_z);
- Volume slice_volume(slice_name, slice_shape, desc.material(x_slice.materialStr()));
- slice_volume.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
+ xml_comp_t x_slice = i_slice;
+ std::string slice_name = Form("slice%d", slice_num);
+ double slice_thick = x_slice.thickness();
+ double slice_dim_x = stave_dim_x;
+ double slice_dim_y = stave_dim_y;
+ double slice_dim_z = slice_thick / 2.;
+ Box slice_shape(slice_dim_x, slice_dim_y, slice_dim_z);
+ Volume slice_volume(slice_name, slice_shape, desc.material(x_slice.materialStr()));
+ slice_volume.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(),
+ x_slice.visStr());
DetElement slice_element(stave_element, slice_name, detector_id);
// Set sensitive
@@ -332,9 +348,9 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
for (int stave_j = 0; stave_j < stave_repeat; stave_j++) {
// Stave placement
- Position stave_pos(stave_pos_x, 0, layer_j % 2 == 0 ? +stave_off_z : -stave_off_z);
- RotationY stave_rot(layer_j % 2 == 0 ? +stave_rot_y : -stave_rot_y);
- Transform3D stave_tr(stave_rot, stave_pos);
+ Position stave_pos(stave_pos_x, 0, layer_j % 2 == 0 ? +stave_off_z : -stave_off_z);
+ RotationY stave_rot(layer_j % 2 == 0 ? +stave_rot_y : -stave_rot_y);
+ Transform3D stave_tr(stave_rot, stave_pos);
PlacedVolume stave_physvol = layer_volume.placeVolume(stave_volume, stave_tr);
stave_physvol.addPhysVolID("stave", stave_num);
stave_element.setPlacement(stave_physvol);
@@ -347,32 +363,40 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Place frame
if (layer_has_frame) {
- xml_comp_t x_frame = x_layer.child(_Unicode(frame));
- double frame_height = x_frame.height();
- double frame_thickness = x_frame.thickness();
- auto frame_material = desc.material(x_frame.materialStr());
-
- std::string frame1_name = Form("frame_inner%d", layer_num);
- double frame1_thick = frame_thickness;
- double frame1_trd_x1 = layer_dim_x + (layer_thickness / 2 - frame_height / 2) * tan_half_dphi;
- double frame1_trd_x2 = layer_dim_x + (layer_thickness / 2 - frame_height / 2 + frame1_thick) * tan_half_dphi;
- double frame1_trd_y1 = layer_trd_y1;
- double frame1_trd_y2 = frame1_trd_y1;
- double frame1_trd_z = frame1_thick / 2.;
- Trapezoid frame1_shape(frame1_trd_x1, frame1_trd_x2, frame1_trd_y1, frame1_trd_y2, frame1_trd_z);
- Volume frame1_volume(frame1_name, frame1_shape, frame_material);
- layer_volume.placeVolume(frame1_volume, Position(0, 0, -frame_height / 2.0 + frame_thickness / 2.0));
-
- std::string frame2_name = Form("frame_outer%d", layer_num);
- double frame2_thick = frame_thickness;
- double frame2_trd_x1 = layer_dim_x + (layer_thickness / 2 - frame_height / 2) * tan_half_dphi;
- double frame2_trd_x2 = layer_dim_x + (layer_thickness / 2 - frame_height / 2 + frame2_thick) * tan_half_dphi;
- double frame2_trd_y1 = layer_trd_y1;
- double frame2_trd_y2 = frame2_trd_y1;
- double frame2_trd_z = frame2_thick / 2.;
- Trapezoid frame2_shape(frame2_trd_x1, frame2_trd_x2, frame2_trd_y1, frame2_trd_y2, frame2_trd_z);
- Volume frame2_volume(frame2_name, frame2_shape, frame_material);
- layer_volume.placeVolume(frame2_volume, Position(0, 0, +frame_height / 2.0 - frame_thickness / 2.0));
+ xml_comp_t x_frame = x_layer.child(_Unicode(frame));
+ double frame_height = x_frame.height();
+ double frame_thickness = x_frame.thickness();
+ auto frame_material = desc.material(x_frame.materialStr());
+
+ std::string frame1_name = Form("frame_inner%d", layer_num);
+ double frame1_thick = frame_thickness;
+ double frame1_trd_x1 =
+ layer_dim_x + (layer_thickness / 2 - frame_height / 2) * tan_half_dphi;
+ double frame1_trd_x2 =
+ layer_dim_x + (layer_thickness / 2 - frame_height / 2 + frame1_thick) * tan_half_dphi;
+ double frame1_trd_y1 = layer_trd_y1;
+ double frame1_trd_y2 = frame1_trd_y1;
+ double frame1_trd_z = frame1_thick / 2.;
+ Trapezoid frame1_shape(frame1_trd_x1, frame1_trd_x2, frame1_trd_y1, frame1_trd_y2,
+ frame1_trd_z);
+ Volume frame1_volume(frame1_name, frame1_shape, frame_material);
+ layer_volume.placeVolume(frame1_volume,
+ Position(0, 0, -frame_height / 2.0 + frame_thickness / 2.0));
+
+ std::string frame2_name = Form("frame_outer%d", layer_num);
+ double frame2_thick = frame_thickness;
+ double frame2_trd_x1 =
+ layer_dim_x + (layer_thickness / 2 - frame_height / 2) * tan_half_dphi;
+ double frame2_trd_x2 =
+ layer_dim_x + (layer_thickness / 2 - frame_height / 2 + frame2_thick) * tan_half_dphi;
+ double frame2_trd_y1 = layer_trd_y1;
+ double frame2_trd_y2 = frame2_trd_y1;
+ double frame2_trd_z = frame2_thick / 2.;
+ Trapezoid frame2_shape(frame2_trd_x1, frame2_trd_x2, frame2_trd_y1, frame2_trd_y2,
+ frame2_trd_z);
+ Volume frame2_volume(frame2_name, frame2_shape, frame_material);
+ layer_volume.placeVolume(frame2_volume,
+ Position(0, 0, +frame_height / 2.0 - frame_thickness / 2.0));
}
// Place layer into sector
@@ -394,7 +418,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Create nsides sectors.
for (int i = 0; i < nsides; i++, phi -= dphi) { // i is sector number
// Compute the sector position
- Transform3D tr(RotationZYX(0, phi, M_PI * 0.5), Translation3D(0, 0, 0));
+ Transform3D tr(RotationZYX(0, phi, M_PI * 0.5), Translation3D(0, 0, 0));
PlacedVolume sector_physvol = detector_volume.placeVolume(sector_volume, tr);
sector_physvol.addPhysVolID("sector", i + 1);
DetElement sd = (i == 0) ? sector_element : sector_element.clone(Form("sector%d", i));
@@ -408,17 +432,16 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// simple aluminum sheet cover
// dimensions: (inner r, position in z, length, phi)
static void buildSupport(Detector& desc, Volume& sector_volume, xml_comp_t x_support,
- const std::tuple& dimensions)
-{
+ const std::tuple& dimensions) {
auto [inner_r, pos_z, sector_length, hphi] = dimensions;
- double support_thickness = getAttrOrDefault(x_support, _Unicode(thickness), 0.5 * cm);
- auto material = desc.material(x_support.materialStr());
- double trd_y = sector_length / 2.;
- double trd_x1_support = std::tan(hphi) * pos_z;
- double trd_x2_support = std::tan(hphi) * (pos_z + support_thickness);
+ double support_thickness = getAttrOrDefault(x_support, _Unicode(thickness), 0.5 * cm);
+ auto material = desc.material(x_support.materialStr());
+ double trd_y = sector_length / 2.;
+ double trd_x1_support = std::tan(hphi) * pos_z;
+ double trd_x2_support = std::tan(hphi) * (pos_z + support_thickness);
Trapezoid s_shape(trd_x1_support, trd_x2_support, trd_y, trd_y, support_thickness / 2.);
- Volume s_vol("support_layer", s_shape, material);
+ Volume s_vol("support_layer", s_shape, material);
s_vol.setVisAttributes(desc.visAttributes(x_support.visStr()));
sector_volume.placeVolume(s_vol, Position(0.0, 0.0, pos_z + support_thickness / 2.));
}
diff --git a/src/BarrelCalorimeterScFi_geo.cpp b/src/BarrelCalorimeterScFi_geo.cpp
index 18de3be83..9c6c337a5 100644
--- a/src/BarrelCalorimeterScFi_geo.cpp
+++ b/src/BarrelCalorimeterScFi_geo.cpp
@@ -25,14 +25,13 @@ using namespace dd4hep;
typedef ROOT::Math::XYPoint Point;
// fiber placement helpers, defined below
struct FiberGrid {
- int ix = 0, iy = 0;
+ int ix = 0, iy = 0;
std::vector points;
- Point mean_centroid = Point(0., 0.);
- Assembly* assembly_ptr = nullptr;
+ Point mean_centroid = Point(0., 0.);
+ Assembly* assembly_ptr = nullptr;
// initialize with grid id and points
- FiberGrid(int i, int j, const std::vector& pts) : ix(i), iy(j), points(pts)
- {
+ FiberGrid(int i, int j, const std::vector& pts) : ix(i), iy(j), points(pts) {
if (pts.empty()) {
return;
}
@@ -48,37 +47,36 @@ struct FiberGrid {
};
};
-std::vector fiberPositions(double r, double sx, double sz, double trx, double trz, double phi,
- bool shift_first = false, double stol = 1e-2);
+std::vector fiberPositions(double r, double sx, double sz, double trx, double trz,
+ double phi, bool shift_first = false, double stol = 1e-2);
std::vector gridPoints(int div_n_phi, double div_dr, double x, double z, double phi);
// geometry helpers
-void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& mother, int layer_nunber, xml_comp_t x_fiber,
- const std::tuple& dimensions);
+void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& mother, int layer_nunber,
+ xml_comp_t x_fiber, const std::tuple& dimensions);
void buildSupport(Detector& desc, Volume& mother, xml_comp_t x_support,
const std::tuple& dimensions);
// barrel ecal layers contained in an assembly
-static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
-{
- Layering layering(e);
- xml_det_t x_det = e;
- Material air = desc.air();
- int det_id = x_det.id();
- double offset = x_det.attr(_Unicode(offset));
- xml_comp_t x_dim = x_det.dimensions();
- int nsides = x_dim.numsides();
- double inner_r = x_dim.rmin();
- double dphi = (2 * M_PI / nsides);
- double hphi = dphi / 2;
+static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) {
+ Layering layering(e);
+ xml_det_t x_det = e;
+ Material air = desc.air();
+ int det_id = x_det.id();
+ double offset = x_det.attr(_Unicode(offset));
+ xml_comp_t x_dim = x_det.dimensions();
+ int nsides = x_dim.numsides();
+ double inner_r = x_dim.rmin();
+ double dphi = (2 * M_PI / nsides);
+ double hphi = dphi / 2;
std::string det_name = x_det.nameStr();
DetElement sdet(det_name, det_id);
- Volume motherVol = desc.pickMotherVolume(sdet);
+ Volume motherVol = desc.pickMotherVolume(sdet);
- Assembly envelope(det_name);
- Transform3D tr_global = Translation3D(0, 0, offset) * RotationZ(hphi);
- PlacedVolume env_phv = motherVol.placeVolume(envelope, tr_global);
+ Assembly envelope(det_name);
+ Transform3D tr_global = Translation3D(0, 0, offset) * RotationZ(hphi);
+ PlacedVolume env_phv = motherVol.placeVolume(envelope, tr_global);
sens.setType("calorimeter");
env_phv.addPhysVolID("system", det_id);
@@ -86,7 +84,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// build a single sector
DetElement sector_det("sector0", det_id);
- Assembly mod_vol("sector");
+ Assembly mod_vol("sector");
// keep tracking of the total thickness
double l_pos_z = inner_r;
@@ -98,47 +96,48 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Loop over the sets of layer elements in the detector.
int l_num = 1;
for (xml_coll_t li(x_det, _U(layer)); li; ++li) {
- xml_comp_t x_layer = li;
- int repeat = x_layer.repeat();
- double l_space_between = getAttrOrDefault(x_layer, _Unicode(space_between), 0.);
- double l_space_before = getAttrOrDefault(x_layer, _Unicode(space_before), 0.);
+ xml_comp_t x_layer = li;
+ int repeat = x_layer.repeat();
+ double l_space_between = getAttrOrDefault(x_layer, _Unicode(space_between), 0.);
+ double l_space_before = getAttrOrDefault(x_layer, _Unicode(space_before), 0.);
l_pos_z += l_space_before;
// Loop over number of repeats for this layer.
for (int j = 0; j < repeat; j++) {
- std::string l_name = Form("layer%d", l_num);
- double l_thickness = layering.layer(l_num - 1)->thickness(); // Layer's thickness.
- double l_dim_x = tan_hphi * l_pos_z;
+ std::string l_name = Form("layer%d", l_num);
+ double l_thickness = layering.layer(l_num - 1)->thickness(); // Layer's thickness.
+ double l_dim_x = tan_hphi * l_pos_z;
l_pos_z += l_thickness;
- Position l_pos(0, 0, l_pos_z - l_thickness / 2.); // Position of the layer.
- double l_trd_x1 = l_dim_x;
- double l_trd_x2 = l_dim_x + l_thickness * tan_hphi;
- double l_trd_y1 = l_dim_y;
- double l_trd_y2 = l_trd_y1;
- double l_trd_z = l_thickness / 2;
- Trapezoid l_shape(l_trd_x1, l_trd_x2, l_trd_y1, l_trd_y2, l_trd_z);
- Volume l_vol(l_name, l_shape, air);
+ Position l_pos(0, 0, l_pos_z - l_thickness / 2.); // Position of the layer.
+ double l_trd_x1 = l_dim_x;
+ double l_trd_x2 = l_dim_x + l_thickness * tan_hphi;
+ double l_trd_y1 = l_dim_y;
+ double l_trd_y2 = l_trd_y1;
+ double l_trd_z = l_thickness / 2;
+ Trapezoid l_shape(l_trd_x1, l_trd_x2, l_trd_y1, l_trd_y2, l_trd_z);
+ Volume l_vol(l_name, l_shape, air);
DetElement layer(sector_det, l_name, det_id);
// Loop over the sublayers or slices for this layer.
- int s_num = 1;
+ int s_num = 1;
double s_pos_z = -(l_thickness / 2.);
for (xml_coll_t si(x_layer, _U(slice)); si; ++si) {
- xml_comp_t x_slice = si;
- std::string s_name = Form("slice%d", s_num);
- double s_thick = x_slice.thickness();
- double s_trd_x1 = l_dim_x + (s_pos_z + l_thickness / 2) * tan_hphi;
- double s_trd_x2 = l_dim_x + (s_pos_z + l_thickness / 2 + s_thick) * tan_hphi;
- double s_trd_y1 = l_trd_y1;
- double s_trd_y2 = s_trd_y1;
- double s_trd_z = s_thick / 2.;
- Trapezoid s_shape(s_trd_x1, s_trd_x2, s_trd_y1, s_trd_y2, s_trd_z);
- Volume s_vol(s_name, s_shape, desc.material(x_slice.materialStr()));
- DetElement slice(layer, s_name, det_id);
+ xml_comp_t x_slice = si;
+ std::string s_name = Form("slice%d", s_num);
+ double s_thick = x_slice.thickness();
+ double s_trd_x1 = l_dim_x + (s_pos_z + l_thickness / 2) * tan_hphi;
+ double s_trd_x2 = l_dim_x + (s_pos_z + l_thickness / 2 + s_thick) * tan_hphi;
+ double s_trd_y1 = l_trd_y1;
+ double s_trd_y2 = s_trd_y1;
+ double s_trd_z = s_thick / 2.;
+ Trapezoid s_shape(s_trd_x1, s_trd_x2, s_trd_y1, s_trd_y2, s_trd_z);
+ Volume s_vol(s_name, s_shape, desc.material(x_slice.materialStr()));
+ DetElement slice(layer, s_name, det_id);
// build fibers
if (x_slice.hasChild(_Unicode(fiber))) {
- buildFibers(desc, sens, s_vol, l_num, x_slice.child(_Unicode(fiber)), {s_trd_x1, s_thick, l_dim_y, hphi});
+ buildFibers(desc, sens, s_vol, l_num, x_slice.child(_Unicode(fiber)),
+ {s_trd_x1, s_thick, l_dim_y, hphi});
}
if (x_slice.isSensitive()) {
@@ -174,7 +173,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
// Create nsides sectors.
for (int i = 0; i < nsides; i++, phi -= dphi) { // i is module number
// Compute the sector position
- Transform3D tr(RotationZYX(0, phi, M_PI * 0.5), Translation3D(0, 0, 0));
+ Transform3D tr(RotationZYX(0, phi, M_PI * 0.5), Translation3D(0, 0, 0));
PlacedVolume pv = envelope.placeVolume(mod_vol, tr);
pv.addPhysVolID("sector", i + 1);
DetElement sd = (i == 0) ? sector_det : sector_det.clone(Form("sector%d", i));
@@ -196,18 +195,18 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
return sdet;
}
-void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int layer_number, xml_comp_t x_fiber,
- const std::tuple& dimensions)
-{
+void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int layer_number,
+ xml_comp_t x_fiber, const std::tuple& dimensions) {
auto [s_trd_x1, s_thick, s_length, hphi] = dimensions;
- double f_radius = getAttrOrDefault(x_fiber, _U(radius), 0.1 * cm);
- double f_cladding_thickness = getAttrOrDefault(x_fiber, _Unicode(cladding_thickness), 0.0 * cm);
- double f_spacing_x = getAttrOrDefault(x_fiber, _Unicode(spacing_x), 0.122 * cm);
- double f_spacing_z = getAttrOrDefault(x_fiber, _Unicode(spacing_z), 0.134 * cm);
- int grid_n_phi = getAttrOrDefault(x_fiber, _Unicode(grid_n_phi), 5);
- double grid_dr = getAttrOrDefault(x_fiber, _Unicode(grid_dr), 2.0 * cm);
- std::string f_id_grid = getAttrOrDefault(x_fiber, _Unicode(identifier_grid), "grid");
- std::string f_id_fiber = getAttrOrDefault(x_fiber, _Unicode(identifier_fiber), "fiber");
+ double f_radius = getAttrOrDefault(x_fiber, _U(radius), 0.1 * cm);
+ double f_cladding_thickness = getAttrOrDefault(x_fiber, _Unicode(cladding_thickness), 0.0 * cm);
+ double f_spacing_x = getAttrOrDefault(x_fiber, _Unicode(spacing_x), 0.122 * cm);
+ double f_spacing_z = getAttrOrDefault(x_fiber, _Unicode(spacing_z), 0.134 * cm);
+ int grid_n_phi = getAttrOrDefault(x_fiber, _Unicode(grid_n_phi), 5);
+ double grid_dr = getAttrOrDefault(x_fiber, _Unicode(grid_dr), 2.0 * cm);
+ std::string f_id_grid = getAttrOrDefault(x_fiber, _Unicode(identifier_grid), "grid");
+ std::string f_id_fiber =
+ getAttrOrDefault(x_fiber, _Unicode(identifier_fiber), "fiber");
// Set up the readout grid for the fiber layers
// Trapezoid is divided into segments with equal dz and equal number of divisions in x
@@ -218,9 +217,9 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int lay
// fiber and its cladding
double f_radius_core = f_radius - f_cladding_thickness;
- Tube f_tube_clad(0, f_radius, s_length);
+ Tube f_tube_clad(0, f_radius, s_length);
Volume f_vol_clad("fiber_vol", f_tube_clad, desc.material(x_fiber.materialStr()));
- Tube f_tube_core(0, f_radius_core, s_length);
+ Tube f_tube_core(0, f_radius_core, s_length);
Volume f_vol_core("fiber_core_vol", f_tube_core, desc.material(x_fiber.materialStr()));
if (x_fiber.isSensitive()) {
f_vol_core.setSensitiveDetector(sens);
@@ -229,15 +228,16 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int lay
f_vol_clad.placeVolume(f_vol_core);
// calculate polygonal grid coordinates (vertices)
- auto grids = gridPoints(grid_n_phi, grid_dr, s_trd_x1, s_thick, hphi);
+ auto grids = gridPoints(grid_n_phi, grid_dr, s_trd_x1, s_thick, hphi);
std::vector f_id_count(grids.size(), 0);
// use layer_number % 2 to add correct shifts for the adjacent fibers at layer boundary
- auto f_pos = fiberPositions(f_radius, f_spacing_x, f_spacing_z, s_trd_x1, s_thick, hphi, (layer_number % 2 == 0));
+ auto f_pos = fiberPositions(f_radius, f_spacing_x, f_spacing_z, s_trd_x1, s_thick, hphi,
+ (layer_number % 2 == 0));
// a helper struct to speed up searching
struct Fiber {
Point pos;
- bool assigned = false;
- Fiber(const Point& p) : pos(p){};
+ bool assigned = false;
+ Fiber(const Point& p) : pos(p) {};
};
std::vector fibers(f_pos.begin(), f_pos.end());
@@ -253,7 +253,7 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int lay
}
// use TGeoPolygon to help check if fiber is inside a grid
- TGeoPolygon poly(gr.points.size());
+ TGeoPolygon poly(gr.points.size());
std::vector vx, vy;
std::transform(gr.points.begin(), gr.points.end(), back_inserter(vx), std::mem_fn(&Point::x));
std::transform(gr.points.begin(), gr.points.end(), back_inserter(vy), std::mem_fn(&Point::y));
@@ -276,8 +276,9 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int lay
// only add this if this grid has fibers
if (f_id > 1) {
// fiber is along y-axis of the layer volume, so grids are arranged on X-Z plane
- Transform3D gr_tr(RotationZYX(0., 0., M_PI * 0.5), Position(gr.mean_centroid.x(), 0., gr.mean_centroid.y()));
- auto grid_phv = s_vol.placeVolume(grid_vol, gr_tr);
+ Transform3D gr_tr(RotationZYX(0., 0., M_PI * 0.5),
+ Position(gr.mean_centroid.x(), 0., gr.mean_centroid.y()));
+ auto grid_phv = s_vol.placeVolume(grid_vol, gr_tr);
grid_phv.addPhysVolID(f_id_grid, gr.ix + gr.iy * grid_n_phi + 1);
grid_vol.ptr()->Voxelize("");
}
@@ -299,25 +300,23 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, int lay
// simple aluminum sheet cover
// dimensions: (inner r, position in z, length, phi)
void buildSupport(Detector& desc, Volume& mod_vol, xml_comp_t x_support,
- const std::tuple& dimensions)
-{
+ const std::tuple& dimensions) {
auto [inner_r, pos_z, sector_length, hphi] = dimensions;
- double support_thickness = getAttrOrDefault(x_support, _Unicode(thickness), 3. * cm);
- auto material = desc.material(x_support.materialStr());
- double trd_y = sector_length / 2.;
- double trd_x1_support = std::tan(hphi) * pos_z;
- double trd_x2_support = std::tan(hphi) * (pos_z + support_thickness);
+ double support_thickness = getAttrOrDefault(x_support, _Unicode(thickness), 3. * cm);
+ auto material = desc.material(x_support.materialStr());
+ double trd_y = sector_length / 2.;
+ double trd_x1_support = std::tan(hphi) * pos_z;
+ double trd_x2_support = std::tan(hphi) * (pos_z + support_thickness);
Trapezoid s_shape(trd_x1_support, trd_x2_support, trd_y, trd_y, support_thickness / 2.);
- Volume s_vol("support_layer", s_shape, material);
+ Volume s_vol("support_layer", s_shape, material);
s_vol.setVisAttributes(desc.visAttributes(x_support.visStr()));
mod_vol.placeVolume(s_vol, Position(0.0, 0.0, pos_z + support_thickness / 2.));
}
// Fill fiber lattice into trapezoid starting from position (0,0) in x-z coordinate system
-std::vector fiberPositions(double r, double sx, double sz, double trx, double trz, double phi, bool shift,
- double stol)
-{
+std::vector fiberPositions(double r, double sx, double sz, double trx, double trz,
+ double phi, bool shift, double stol) {
// r - fiber radius
// sx, sz - spacing between fibers in x, z
// trx - half-length of the shorter (bottom) base of the trapezoid
@@ -326,10 +325,10 @@ std::vector fiberPositions(double r, double sx, double sz, double trx, do
// stol - spacing tolerance
std::vector positions;
- int z_layers = floor((trz / 2 - r - stol) / sz); // number of layers that fits in half trapezoid-z
+ int z_layers = floor((trz / 2 - r - stol) / sz); // number of layers that fits in half trapezoid-z
double px = 0., pz = 0.;
- int start_line = shift ? 1 : 0;
+ int start_line = shift ? 1 : 0;
for (int l = -z_layers; l < z_layers + 1; l++) {
std::vector xline;
@@ -345,7 +344,8 @@ std::vector fiberPositions(double r, double sx, double sz, double trx, do
}
// Sort fiber IDs for a better organization
- sort(xline.begin(), xline.end(), [](const Point& p1, const Point& p2) { return p1.x() < p2.x(); });
+ sort(xline.begin(), xline.end(),
+ [](const Point& p1, const Point& p2) { return p1.x() < p2.x(); });
positions.insert(positions.end(), xline.begin(), xline.end());
}
return positions;
@@ -353,8 +353,8 @@ std::vector fiberPositions(double r, double sx, double sz, double trx, do
// Determine the number of divisions for the readout grid for the fiber layers
// Calculate dimensions of the polygonal grid
-std::vector gridPoints(int div_n_phi, double div_dr, double trd_x1, double height, double phi)
-{
+std::vector gridPoints(int div_n_phi, double div_dr, double trd_x1, double height,
+ double phi) {
/*
// TODO: move this test to xml file
double SiPMsize = 13.0 * mm;
@@ -377,7 +377,7 @@ std::vector gridPoints(int div_n_phi, double div_dr, double trd_x1, d
// grid vertices
std::vector results;
- double dr = height / nr;
+ double dr = height / nr;
for (int ir = 0; ir <= nr; ir++) {
for (int iph = 0; iph <= nph; iph++) {
diff --git a/src/BarrelFluxReturn_geo.cpp b/src/BarrelFluxReturn_geo.cpp
new file mode 100644
index 000000000..9b4f644d1
--- /dev/null
+++ b/src/BarrelFluxReturn_geo.cpp
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Copyright (C) 2024 Wouter Deconinck
+
+#include "DD4hep/DetFactoryHelper.h"
+#include "DD4hep/Printout.h"
+#include "XML/Utilities.h"
+
+using namespace dd4hep;
+
+static dd4hep::Ref_t create_detector(dd4hep::Detector& description, xml_h e,
+ [[maybe_unused]] dd4hep::SensitiveDetector sens) {
+ xml_det_t x_det = e;
+ xml_comp_t x_dim = x_det.dimensions();
+
+ // Create element
+ dd4hep::DetElement sdet(x_det.nameStr(), x_det.id());
+
+ // Create envelope
+ dd4hep::Material air = description.air();
+ Tube env_solid(x_dim.rmin(), x_dim.rmax(), x_dim.z() / 2.0);
+ Volume env_vol(x_det.nameStr() + "_env", env_solid, air);
+ env_vol.setVisAttributes(description.visAttributes(x_det.visStr()));
+
+ // Create volume map
+ std::map volumes_by_name;
+ for (xml_coll_t shape(e, _U(shape)); shape; ++shape) {
+ xml_comp_t x_shape = shape;
+ Solid solid = xml::createShape(description, x_shape.typeStr(), shape);
+ Material mat = description.material(x_shape.materialStr());
+ volumes_by_name[x_shape.nameStr()] =
+ Volume(x_shape.nameStr(), solid, mat)
+ .setVisAttributes(description.visAttributes(x_shape.visStr()));
+ }
+
+ // Replicate volumes
+ for (xml_coll_t repl(e, _U(replicate)); repl; ++repl) {
+ xml_comp_t x_repl = repl;
+ Volume& vol = volumes_by_name[x_repl.attr(_U(shape))];
+ Transform3D tf = xml::createTransformation(x_repl);
+ for (int i = 0; i < x_repl.count(); ++i) {
+ double phi = x_repl.phi0() + i * x_repl.attr(_Unicode(dphi));
+ env_vol.placeVolume(vol, Transform3D(RotationZ(phi)) * tf);
+ }
+ }
+
+ // Get position and place volume
+ PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(env_vol);
+ sdet.setPlacement(pv);
+ return sdet;
+}
+
+DECLARE_DETELEMENT(epic_BarrelFluxReturn, create_detector)
diff --git a/src/BarrelHCalCalorimeter_geo.cpp b/src/BarrelHCalCalorimeter_geo.cpp
index 3f53b5374..499080494 100644
--- a/src/BarrelHCalCalorimeter_geo.cpp
+++ b/src/BarrelHCalCalorimeter_geo.cpp
@@ -29,18 +29,17 @@ using namespace std;
using namespace dd4hep;
using namespace dd4hep::detail;
-static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens)
-{
+static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) {
// printout(WARNING, "BarrelHCalCalorimeter", "called create_detector ");
- xml_det_t x_det = e;
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- Material air = description.air();
+ xml_det_t x_det = e;
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ Material air = description.air();
DetElement sdet(det_name, det_id);
- Volume motherVol = description.pickMotherVolume(sdet);
+ Volume motherVol = description.pickMotherVolume(sdet);
// Create envelope to hold HCAL barrel
@@ -52,12 +51,16 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// 5mm buffer on inner radius to acount for comb angle/tilt
// (allows the combs to be added in later)
- std::vector rmins = {rmin2-0.5*cm, rmin2-0.5*cm, rmin1-1.5*cm, rmin1-1.5*cm, rmin2-0.5*cm, rmin2-0.5*cm};
+ std::vector rmins = {rmin2 - 0.5 * cm, rmin2 - 0.5 * cm, rmin1 - 1.5 * cm,
+ rmin1 - 1.5 * cm, rmin2 - 0.5 * cm, rmin2 - 0.5 * cm};
// 1cm buffer on outer radius to acount for comb angle/tilt
// (allows the combs to be added in later)
- std::vector rmaxs = {rmax+1.0*cm, rmax+1.0*cm, rmax+1.0*cm, rmax+1.0*cm, rmax+1.0*cm, rmax+1.0*cm};
+ std::vector rmaxs = {rmax + 1.0 * cm, rmax + 1.0 * cm, rmax + 1.0 * cm,
+ rmax + 1.0 * cm, rmax + 1.0 * cm, rmax + 1.0 * cm};
// leave room for dogbones at the ends (not part of det table)
- std::vector zs = {-length2 / 2. - 8.2*cm, -length1 / 2., -length1 / 2., length1 / 2., length1 / 2., length2 / 2. + 8.2*cm};
+ std::vector zs = {
+ -length2 / 2. - 8.2 * cm, -length1 / 2., -length1 / 2., length1 / 2., length1 / 2.,
+ length2 / 2. + 8.2 * cm};
// printout(WARNING, "BarrelHCalCalorimeter", "%f %f %f %f %f", rmin1, rmin2, rmax, length1/2., length2/2.);
@@ -72,40 +75,51 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Pick up the constants
- double tilePlaneRotate = 0.0;
- double tile_tolerance = 0.2; // Tile tolerance in mm to avoid overlaps
+ double tilePlaneRotate = 0.0;
+ double tile_tolerance = 0.2; // Tile tolerance in mm to avoid overlaps
// Sector steel tessellated shape gdml file info
xml_comp_t x_det_sec_gdmlfile = x_det.child("sec_gdmlfile");
- std::string sec_gdml_file = getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(file), " ");;
- std::string sec_gdml_material = getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(material), " ");
+ std::string sec_gdml_file =
+ getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(file), " ");
+ ;
+ std::string sec_gdml_material =
+ getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(material), " ");
std::string sec_gdml_url = getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(url), " ");
- std::string sec_gdml_cache = getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(cache), " ");
+ std::string sec_gdml_cache =
+ getAttrOrDefault(x_det_sec_gdmlfile, _Unicode(cache), " ");
xml_comp_t x_det_csec_gdmlfile = x_det.child("csec_gdmlfile");
- std::string csec_gdml_file = getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(file), " ");;
- std::string csec_gdml_material = getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(material), " ");
- std::string csec_gdml_url = getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(url), " ");
- std::string csec_gdml_cache = getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(cache), " ");
+ std::string csec_gdml_file =
+ getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(file), " ");
+ ;
+ std::string csec_gdml_material =
+ getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(material), " ");
+ std::string csec_gdml_url =
+ getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(url), " ");
+ std::string csec_gdml_cache =
+ getAttrOrDefault(x_det_csec_gdmlfile, _Unicode(cache), " ");
xml_comp_t x_det_er_gdmlfile = x_det.child("er_gdmlfile");
- std::string er_gdml_file = getAttrOrDefault(x_det_er_gdmlfile, _Unicode(file), " ");;
- std::string er_gdml_material = getAttrOrDefault(x_det_er_gdmlfile, _Unicode(material), " ");
+ std::string er_gdml_file = getAttrOrDefault(x_det_er_gdmlfile, _Unicode(file), " ");
+ ;
+ std::string er_gdml_material =
+ getAttrOrDefault(x_det_er_gdmlfile, _Unicode(material), " ");
std::string er_gdml_url = getAttrOrDefault(x_det_er_gdmlfile, _Unicode(url), " ");
- std::string er_gdml_cache = getAttrOrDefault(x_det_er_gdmlfile, _Unicode(cache), " ");
+ std::string er_gdml_cache =
+ getAttrOrDefault(x_det_er_gdmlfile, _Unicode(cache), " ");
// Loop over the defines section and pick up the tile offsets, ref location and angles
for (xml_coll_t i(det_define, _Unicode(constant)); i; ++i) {
xml_comp_t x_const = i;
- std::string const_name = getAttrOrDefault(x_const, _Unicode(name), " ");
+ std::string const_name = getAttrOrDefault(x_const, _Unicode(name), " ");
- if (const_name == "tilePlaneRotate"){
+ if (const_name == "tilePlaneRotate") {
std::string const_value = getAttrOrDefault(x_const, _Unicode(value), " ");
- tilePlaneRotate = atof(const_value.c_str());
- }
- else
+ tilePlaneRotate = atof(const_value.c_str());
+ } else
printout(WARNING, "BarrelHCalCalorimeter", "unrecognized data!");
}
@@ -150,7 +164,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
}
std::string delimiter = " ";
- size_t pos = 0;
+ size_t pos = 0;
std::string token;
while ((pos = mtrx_values.find(delimiter)) != std::string::npos) {
token = mtrx_values.substr(0, pos);
@@ -169,12 +183,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
EnsureFileFromURLExists(sec_gdml_url, sec_gdml_file, sec_gdml_cache);
if (!fs::exists(fs::path(sec_gdml_file))) {
printout(ERROR, "BarrelHCalCalorimeter_geo", "file " + sec_gdml_file + " does not exist");
- printout(ERROR, "BarrelHCalCalorimeter_geo", "use a FileLoader plugin before the field element");
+ printout(ERROR, "BarrelHCalCalorimeter_geo",
+ "use a FileLoader plugin before the field element");
std::_Exit(EXIT_FAILURE);
}
Volume barrel_sector_vol = parser.GDMLReadFile(sec_gdml_file.c_str());
- if(!barrel_sector_vol.isValid()){
+ if (!barrel_sector_vol.isValid()) {
printout(WARNING, "BarrelHCalCalorimeter", "%s", sec_gdml_file.c_str());
printout(WARNING, "BarrelHCalCalorimeter", "barrel_sector_vol invalid, GDML parser failed!");
std::_Exit(EXIT_FAILURE);
@@ -190,12 +205,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
EnsureFileFromURLExists(csec_gdml_url, csec_gdml_file, csec_gdml_cache);
if (!fs::exists(fs::path(csec_gdml_file))) {
printout(ERROR, "BarrelHCalCalorimeter_geo", "file " + csec_gdml_file + " does not exist");
- printout(ERROR, "BarrelHCalCalorimeter_geo", "use a FileLoader plugin before the field element");
+ printout(ERROR, "BarrelHCalCalorimeter_geo",
+ "use a FileLoader plugin before the field element");
std::_Exit(EXIT_FAILURE);
}
Volume barrel_csector_vol = parser.GDMLReadFile(csec_gdml_file.c_str());
- if(!barrel_csector_vol.isValid()){
+ if (!barrel_csector_vol.isValid()) {
printout(WARNING, "BarrelHCalCalorimeter", "%s", csec_gdml_file.c_str());
printout(WARNING, "BarrelHCalCalorimeter", "barrel_csector_vol invalid, GDML parser failed!");
std::_Exit(EXIT_FAILURE);
@@ -211,12 +227,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
EnsureFileFromURLExists(er_gdml_url, er_gdml_file, er_gdml_cache);
if (!fs::exists(fs::path(er_gdml_file))) {
printout(ERROR, "BarrelHCalCalorimeter_geo", "file " + er_gdml_file + " does not exist");
- printout(ERROR, "BarrelHCalCalorimeter_geo", "use a FileLoader plugin before the field element");
+ printout(ERROR, "BarrelHCalCalorimeter_geo",
+ "use a FileLoader plugin before the field element");
std::_Exit(EXIT_FAILURE);
}
Volume barrel_er_vol = parser.GDMLReadFile(er_gdml_file.c_str());
- if(!barrel_er_vol.isValid()){
+ if (!barrel_er_vol.isValid()) {
printout(WARNING, "BarrelHCalCalorimeter", "%s", er_gdml_file.c_str());
printout(WARNING, "BarrelHCalCalorimeter", "barrel_er_vol invalid, GDML parser failed!");
std::_Exit(EXIT_FAILURE);
@@ -230,61 +247,74 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Place steel in envelope
- double sec_rot_angle = 360.0/32.0;
+ double sec_rot_angle = 360.0 / 32.0;
- for(int k=0; k<29; k++){
- BarrelHCAL.placeVolume(barrel_sector_vol, k, Transform3D(RotationZ(-k*sec_rot_angle*dd4hep::deg)*RotationY(180.0* dd4hep::deg),Translation3D(0, 0, 0)));
+ for (int k = 0; k < 29; k++) {
+ BarrelHCAL.placeVolume(
+ barrel_sector_vol, k,
+ Transform3D(RotationZ(-k * sec_rot_angle * dd4hep::deg) * RotationY(180.0 * dd4hep::deg),
+ Translation3D(0, 0, 0)));
}
- BarrelHCAL.placeVolume(barrel_csector_vol, 0, Transform3D(RotationZ(sec_rot_angle*dd4hep::deg)*RotationY(180.0* dd4hep::deg),Translation3D(0, 0, 0)));
- BarrelHCAL.placeVolume(barrel_csector_vol, 1, Transform3D(RotationY(180.0* dd4hep::deg),Translation3D(0, 0, 0)));
- BarrelHCAL.placeVolume(barrel_csector_vol, 2, Transform3D(RotationZ(-sec_rot_angle*dd4hep::deg)*RotationY(180.0* dd4hep::deg),Translation3D(0, 0, 0)));
- BarrelHCAL.placeVolume(barrel_er_vol, 0, Transform3D(RotationY(180.0* dd4hep::deg),Translation3D(0, 0, 0)));
- BarrelHCAL.placeVolume(barrel_er_vol, 1, Transform3D(RotationY(0.0* dd4hep::deg),Translation3D(0, 0, 0)));
+ BarrelHCAL.placeVolume(
+ barrel_csector_vol, 0,
+ Transform3D(RotationZ(sec_rot_angle * dd4hep::deg) * RotationY(180.0 * dd4hep::deg),
+ Translation3D(0, 0, 0)));
+ BarrelHCAL.placeVolume(barrel_csector_vol, 1,
+ Transform3D(RotationY(180.0 * dd4hep::deg), Translation3D(0, 0, 0)));
+ BarrelHCAL.placeVolume(
+ barrel_csector_vol, 2,
+ Transform3D(RotationZ(-sec_rot_angle * dd4hep::deg) * RotationY(180.0 * dd4hep::deg),
+ Translation3D(0, 0, 0)));
+ BarrelHCAL.placeVolume(barrel_er_vol, 0,
+ Transform3D(RotationY(180.0 * dd4hep::deg), Translation3D(0, 0, 0)));
+ BarrelHCAL.placeVolume(barrel_er_vol, 1,
+ Transform3D(RotationY(0.0 * dd4hep::deg), Translation3D(0, 0, 0)));
// Loop over the tile solids, create them and add them to the detector volume
Volume Tile[12];
Volume ChimneyTile[4];
- for(int j=1; j<17; j++){
+ for (int j = 1; j < 17; j++) {
std::string gdmlname;
std::string solid_name;
- if(j<13){
+ if (j < 13) {
// standard tiles
- gdmlname = _toString(j,"tile%d_gdmlfile");
- solid_name = _toString(j,"OuterHCalTile%02d");
+ gdmlname = _toString(j, "tile%d_gdmlfile");
+ solid_name = _toString(j, "OuterHCalTile%02d");
- }
- else{
+ } else {
// chimney tiles
- gdmlname = _toString(j-4,"ctile%d_gdmlfile");
- solid_name = _toString(j-4,"OuterHCalChimneyTile%02d");
-
+ gdmlname = _toString(j - 4, "ctile%d_gdmlfile");
+ solid_name = _toString(j - 4, "OuterHCalChimneyTile%02d");
}
// tile shape gdml file info
xml_comp_t x_det_tgdmlfile = x_det.child(gdmlname);
- std::string tgdml_file = getAttrOrDefault(x_det_tgdmlfile, _Unicode(file), " ");;
- std::string tgdml_material = getAttrOrDefault(x_det_tgdmlfile, _Unicode(material), " ");
- std::string tgdml_url = getAttrOrDefault(x_det_tgdmlfile, _Unicode(url), " ");
+ std::string tgdml_file = getAttrOrDefault(x_det_tgdmlfile, _Unicode(file), " ");
+ ;
+ std::string tgdml_material =
+ getAttrOrDefault(x_det_tgdmlfile, _Unicode(material), " ");
+ std::string tgdml_url = getAttrOrDefault(x_det_tgdmlfile, _Unicode(url), " ");
std::string tgdml_cache = getAttrOrDefault(x_det_tgdmlfile, _Unicode(cache), " ");
EnsureFileFromURLExists(tgdml_url, tgdml_file, tgdml_cache);
if (!fs::exists(fs::path(tgdml_file))) {
printout(ERROR, "BarrelHCalCalorimeter_geo", "file " + tgdml_file + " does not exist");
- printout(ERROR, "BarrelHCalCalorimeter_geo", "use a FileLoader plugin before the field element");
+ printout(ERROR, "BarrelHCalCalorimeter_geo",
+ "use a FileLoader plugin before the field element");
std::_Exit(EXIT_FAILURE);
}
Volume solidVolume = parser.GDMLReadFile(tgdml_file.c_str());
- if(!solidVolume.isValid()){
+ if (!solidVolume.isValid()) {
printout(WARNING, "BarrelHCalCalorimeter_geo", "%s", tgdml_file.c_str());
printout(WARNING, "BarrelHCalCalorimeter_geo", "solidVolume invalid, GDML parser failed!");
std::_Exit(EXIT_FAILURE);
@@ -308,19 +338,17 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
if (type == "OuterHCalTile" || type == "OuterHCalChimneyTile") {
std::string stnum = solid_name.substr(solid_name.size() - 2, solid_name.size());
- int tnum = atoi(stnum.c_str()) - 1;
+ int tnum = atoi(stnum.c_str()) - 1;
// Tile numbers are indexed by the center (eta=0) out, we want them starting zero at one end.
if (type == "OuterHCalTile") {
- Tile[11-tnum] = solidVolume;
-
- }
- else if ((tnum > 7) && (type == "OuterHCalChimneyTile")) {
+ Tile[11 - tnum] = solidVolume;
- ChimneyTile[11-tnum] = solidVolume;
+ } else if ((tnum > 7) && (type == "OuterHCalChimneyTile")) {
+ ChimneyTile[11 - tnum] = solidVolume;
}
} else
@@ -332,13 +360,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// Place the tiles into the calorimeter volume
- double increment_angle = (360.0/320.0)*dd4hep::deg;
- double increment_offset = -10.01*increment_angle;
+ double increment_angle = (360.0 / 320.0) * dd4hep::deg;
+ double increment_offset = -10.01 * increment_angle;
DetElement tile_det("eta0 phi0", det_id);
sens.setType("calorimeter");
- for (int i_eta = 0; i_eta < 12; i_eta++) { // eta ring
+ for (int i_eta = 0; i_eta < 12; i_eta++) { // eta ring
int tnum = 11 - i_eta;
@@ -349,117 +377,126 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
// ordinary sector tiles
PlacedVolume phv1 = BarrelHCAL.placeVolume(
- Tile[i_eta], i_phi + i_eta * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Transform3D(RotationY(180.0 * dd4hep::deg),
- Translation3D(-(xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposTile[tnum] * dd4hep::mm, -zposTile[tnum] * dd4hep::mm)));
-
- phv1.addPhysVolID("eta",i_eta).addPhysVolID("phi",i_phi);
- DetElement sd1 = tile_det.clone(_toString(i_eta, "eta%d ")+_toString(i_phi, "phi%d"));
+ Tile[i_eta], i_phi + i_eta * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Transform3D(
+ RotationY(180.0 * dd4hep::deg),
+ Translation3D(-(xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
+ yposTile[tnum] * dd4hep::mm, -zposTile[tnum] * dd4hep::mm)));
+
+ phv1.addPhysVolID("eta", i_eta).addPhysVolID("phi", i_phi);
+ DetElement sd1 = tile_det.clone(_toString(i_eta, "eta%d ") + _toString(i_phi, "phi%d"));
sd1.setPlacement(phv1);
sdet.add(sd1);
PlacedVolume phv0 = BarrelHCAL.placeVolume(
- Tile[i_eta], i_phi + (12 + tnum) * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
-
- phv0.addPhysVolID("eta",(12+tnum)).addPhysVolID("phi", i_phi);
- DetElement sd0 = tile_det.clone(_toString((12+tnum), "eta%d ")+_toString(i_phi, "phi%d"));
+ Tile[i_eta], i_phi + (12 + tnum) * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
+ yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
+
+ phv0.addPhysVolID("eta", (12 + tnum)).addPhysVolID("phi", i_phi);
+ DetElement sd0 =
+ tile_det.clone(_toString((12 + tnum), "eta%d ") + _toString(i_phi, "phi%d"));
sd0.setPlacement(phv0);
sdet.add(sd0);
-
} else {
// first three sectors are chimney sectors
- if(i_phi>29){
+ if (i_phi > 29) {
// ordinary sector tiles
PlacedVolume phv1 = BarrelHCAL.placeVolume(
- Tile[i_eta], i_phi + i_eta * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
+ Tile[i_eta], i_phi + i_eta * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
+ yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
phv1.addPhysVolID("eta", i_eta).addPhysVolID("phi", i_phi);
- DetElement sd1 = tile_det.clone(_toString(i_eta, "eta%d ")+_toString(i_phi, "phi%d"));
+ DetElement sd1 = tile_det.clone(_toString(i_eta, "eta%d ") + _toString(i_phi, "phi%d"));
sd1.setPlacement(phv1);
sdet.add(sd1);
PlacedVolume phv0 = BarrelHCAL.placeVolume(
- Tile[i_eta], i_phi + (12 + tnum) * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Transform3D(RotationY(180.0 * dd4hep::deg),
- Translation3D(-(xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposTile[tnum] * dd4hep::mm, -zposTile[tnum] * dd4hep::mm)));
+ Tile[i_eta], i_phi + (12 + tnum) * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Transform3D(
+ RotationY(180.0 * dd4hep::deg),
+ Translation3D(-(xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
+ yposTile[tnum] * dd4hep::mm, -zposTile[tnum] * dd4hep::mm)));
phv0.addPhysVolID("eta", (12 + tnum)).addPhysVolID("phi", i_phi);
- DetElement sd0 = tile_det.clone(_toString((12+tnum), "eta%d ")+_toString(i_phi, "phi%d"));
+ DetElement sd0 =
+ tile_det.clone(_toString((12 + tnum), "eta%d ") + _toString(i_phi, "phi%d"));
sd0.setPlacement(phv0);
sdet.add(sd0);
- }
- else{
+ } else {
// chimney sector tile
PlacedVolume phv1 = BarrelHCAL.placeVolume(
- ChimneyTile[i_eta], i_phi + (12 + tnum) * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Translation3D((xposChimneyTileS[tnum-8] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposChimneyTileS[tnum-8] * dd4hep::mm, zposChimneyTileS[tnum-8] * dd4hep::mm));
-
+ ChimneyTile[i_eta], i_phi + (12 + tnum) * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Translation3D((xposChimneyTileS[tnum - 8] + (tnum + 1) * tile_tolerance) *
+ dd4hep::mm,
+ yposChimneyTileS[tnum - 8] * dd4hep::mm,
+ zposChimneyTileS[tnum - 8] * dd4hep::mm));
phv1.addPhysVolID("eta", (12 + tnum)).addPhysVolID("phi", i_phi);
- DetElement sd1 = tile_det.clone(_toString((12+tnum), "eta%d ")+_toString(i_phi, "phi%d"));
+ DetElement sd1 =
+ tile_det.clone(_toString((12 + tnum), "eta%d ") + _toString(i_phi, "phi%d"));
sd1.setPlacement(phv1);
sdet.add(sd1);
PlacedVolume phv0 = BarrelHCAL.placeVolume(
- Tile[i_eta], i_phi + i_eta * 320,
- RotationZ(i_phi * increment_angle + increment_offset) *
- Transform3D(RotationY(90.0 * dd4hep::deg),
- Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
- RotationX(-tilePlaneRotate * dd4hep::deg) *
- Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
- yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
+ Tile[i_eta], i_phi + i_eta * 320,
+ RotationZ(i_phi * increment_angle + increment_offset) *
+ Transform3D(
+ RotationY(90.0 * dd4hep::deg),
+ Translation3D(xposOuter[0] * dd4hep::mm, yposOuter[0] * dd4hep::mm, 0.0)) *
+ RotationX(-tilePlaneRotate * dd4hep::deg) *
+ Translation3D((xposTile[tnum] + (tnum + 1) * tile_tolerance) * dd4hep::mm,
+ yposTile[tnum] * dd4hep::mm, zposTile[tnum] * dd4hep::mm));
phv0.addPhysVolID("eta", i_eta).addPhysVolID("phi", i_phi);
- DetElement sd0 = tile_det.clone(_toString(i_eta, "eta%d ")+_toString(i_phi, "phi%d"));
+ DetElement sd0 = tile_det.clone(_toString(i_eta, "eta%d ") + _toString(i_phi, "phi%d"));
sd0.setPlacement(phv0);
sdet.add(sd0);
-
}
-
}
}
}
// Place the detector into the envelope
- envelope.placeVolume(BarrelHCAL, 0, Transform3D(RotationZ(0.0),Translation3D(0, 0, 0)));
+ envelope.placeVolume(BarrelHCAL, 0, Transform3D(RotationZ(0.0), Translation3D(0, 0, 0)));
- std::string env_vis = getAttrOrDefault(x_det, _Unicode(env_vis), "HcalBarrelEnvelopeVis");
+ std::string env_vis =
+ getAttrOrDefault(x_det, _Unicode(env_vis), "HcalBarrelEnvelopeVis");
envelope.setAttributes(description, x_det.regionStr(), x_det.limitsStr(), env_vis);
return sdet;
}
diff --git a/src/BarrelPlanarMPGDTracker_geo.cpp b/src/BarrelPlanarMPGDTracker_geo.cpp
index 02f75c7a8..23231b8cb 100644
--- a/src/BarrelPlanarMPGDTracker_geo.cpp
+++ b/src/BarrelPlanarMPGDTracker_geo.cpp
@@ -37,21 +37,21 @@ using namespace dd4hep::rec;
* - Detector is setup as a "tracker" so we can use the hits
*
*/
-static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e, SensitiveDetector sens)
-{
+static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
+ SensitiveDetector sens) {
typedef vector Placements;
- xml_det_t x_det = e;
+ xml_det_t x_det = e;
// Material air = description.air();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- DetElement sdet(det_name, det_id);
- map volumes;
- map sensitives;
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ DetElement sdet(det_name, det_id);
+ map volumes;
+ map sensitives;
map> volplane_surfaces;
- PlacedVolume pv;
- dd4hep::xml::Dimension dimensions(x_det.dimensions());
- xml_dim_t mpgd_pos = x_det.position();
- Assembly assembly(det_name);
+ PlacedVolume pv;
+ dd4hep::xml::Dimension dimensions(x_det.dimensions());
+ xml_dim_t mpgd_pos = x_det.position();
+ Assembly assembly(det_name);
// Set detector type flag
dd4hep::xml::setDetectorTypeFlag(x_det, sdet);
@@ -60,7 +60,8 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
// Add the volume boundary material if configured
for (xml_coll_t bmat(x_det, _Unicode(boundary_material)); bmat; ++bmat) {
xml_comp_t x_boundary_material = bmat;
- DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, params, "boundary_material");
+ DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, params,
+ "boundary_material");
}
map> module_thicknesses;
@@ -69,7 +70,7 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
// loop over the modules
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
xml_comp_t x_mod = mi;
- string m_nam = x_mod.nameStr();
+ string m_nam = x_mod.nameStr();
if (volumes.find(m_nam) != volumes.end()) {
printout(ERROR, "BarrelPlanarMPGDTracker_geo",
@@ -77,8 +78,8 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
throw runtime_error("Logics error in building modules.");
}
- int ncomponents = 0;
- int sensor_number = 1;
+ int ncomponents = 0;
+ int sensor_number = 1;
double total_thickness = 0;
// Compute module total thickness from components
@@ -113,13 +114,13 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
double max_component_length = 0;
double gas_thickness = 0.0;
for (xml_coll_t mci(x_mod, _U(module_component)); mci; ++mci, ++ncomponents) {
- xml_comp_t x_comp = mci;
- string c_nam = _toString(ncomponents, "component%d");
- string comp_name = x_comp.nameStr();
+ xml_comp_t x_comp = mci;
+ string c_nam = _toString(ncomponents, "component%d");
+ string comp_name = x_comp.nameStr();
double box_width = x_comp.width();
double box_length = x_comp.length();
- Box c_box;
+ Box c_box;
// Since MPGD frames are layed over the MPGD foils, the foil material is pressent under the frame as well.
// The gas volumes are not present under the frames, so our frames must eat only the gas module areas
//
@@ -149,7 +150,8 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "Not gas: %s", comp_name.c_str());
printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "box_comp_width: %f", x_comp.width());
printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "box_comp_length: %f", x_comp.length());
- printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "box_comp_thickness: %f", x_comp.thickness());
+ printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "box_comp_thickness: %f",
+ x_comp.thickness());
}
Volume c_vol{c_nam, c_box, description.material(x_comp.materialStr())};
@@ -185,8 +187,8 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
}
// Now add-on the frame
if (x_mod.hasChild(_U(frame))) {
- xml_comp_t m_frame = x_mod.child(_U(frame));
- double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
+ xml_comp_t m_frame = x_mod.child(_U(frame));
+ double frame_thickness = getAttrOrDefault(m_frame, _U(thickness), total_thickness);
Box lframe_box{m_frame.width() / 2.0, (max_component_length + 2.0 * m_frame.width()) / 2.0,
frame_thickness / 2.0};
@@ -209,16 +211,21 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "frame_thickness: %f", frame_thickness);
printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "total_thickness: %f", total_thickness);
- printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "frame_thickness + total_thickness: %f", frame_thickness + total_thickness);
+ printout(DEBUG, "BarrelPlanarMPGDTracker_geo", "frame_thickness + total_thickness: %f",
+ frame_thickness + total_thickness);
m_vol.placeVolume(lframe_vol, Position(frame_width / 2.0 + max_component_width / 2, 0.0,
- frame_thickness / 2.0 - total_thickness / 2.0 - gas_thickness / 2.0));
+ frame_thickness / 2.0 - total_thickness / 2.0 -
+ gas_thickness / 2.0));
m_vol.placeVolume(rframe_vol, Position(-frame_width / 2.0 - max_component_width / 2.0, 0.0,
- frame_thickness / 2.0 - total_thickness / 2.0 - gas_thickness / 2.0));
+ frame_thickness / 2.0 - total_thickness / 2.0 -
+ gas_thickness / 2.0));
m_vol.placeVolume(tframe_vol, Position(0.0, frame_width / 2.0 + max_component_length / 2,
- frame_thickness / 2.0 - total_thickness / 2.0 - gas_thickness / 2.0));
+ frame_thickness / 2.0 - total_thickness / 2.0 -
+ gas_thickness / 2.0));
m_vol.placeVolume(bframe_vol, Position(0.0, -frame_width / 2.0 - max_component_length / 2.0,
- frame_thickness / 2.0 - total_thickness / 2.0 - gas_thickness / 2.0));
+ frame_thickness / 2.0 - total_thickness / 2.0 -
+ gas_thickness / 2.0));
}
}
@@ -227,14 +234,14 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
xml_comp_t x_layer = li;
xml_comp_t x_layout = x_layer.child(_U(rphi_layout));
xml_comp_t z_layout = x_layer.child(_U(z_layout));
- int lay_id = x_layer.id();
- string m_nam = x_layer.moduleStr();
- string lay_nam = det_name + _toString(x_layer.id(), "_layer%d");
+ int lay_id = x_layer.id();
+ string m_nam = x_layer.moduleStr();
+ string lay_nam = det_name + _toString(x_layer.id(), "_layer%d");
xml_comp_t envelope_tolerance = x_layer.child(_Unicode(envelope_tolerance), false);
- double envelope_r_min = 0;
- double envelope_r_max = 0;
- double envelope_z_min = 0;
- double envelope_z_max = 0;
+ double envelope_r_min = 0;
+ double envelope_r_max = 0;
+ double envelope_z_min = 0;
+ double envelope_z_max = 0;
if (envelope_tolerance) {
envelope_r_min = getAttrOrDefault(envelope_tolerance, _Unicode(r_min), 0);
envelope_r_max = getAttrOrDefault(envelope_tolerance, _Unicode(r_max), 0);
@@ -245,7 +252,7 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
double phi0 = x_layout.phi0(); // starting phi of first module
double phi_tilt = x_layout.phi_tilt(); // Phi tilit of module
double rc = x_layout.rc(); // Radius of the module
- int nphi = x_layout.nphi(); // Number of modules in phi
+ int nphi = x_layout.nphi(); // Number of modules in phi
double rphi_dr = x_layout.dr(); // The delta radius of every other module
double phi_incr = (2 * M_PI) / nphi; // Phi increment for one module
double phic = phi0; // Phi of the module
@@ -253,11 +260,12 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
double z_dr = z_layout.dr(); // Radial offest of modules in z
double z0 = z_layout.z0(); // Sets how much overlap in z the nz modules have
- Assembly layer_assembly(lay_nam);
- Volume module_env = volumes[m_nam];
- DetElement lay_elt(sdet, lay_nam, lay_id);
- Placements& sensVols = sensitives[m_nam];
- auto& layerParams = DD4hepDetectorHelper::ensureExtension(lay_elt);
+ Assembly layer_assembly(lay_nam);
+ Volume module_env = volumes[m_nam];
+ DetElement lay_elt(sdet, lay_nam, lay_id);
+ Placements& sensVols = sensitives[m_nam];
+ auto& layerParams =
+ DD4hepDetectorHelper::ensureExtension(lay_elt);
pv = assembly.placeVolume(layer_assembly);
pv.addPhysVolID("layer", lay_id);
@@ -272,12 +280,14 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
double dy = z_dr * std::sin(phic + phi_tilt); // Deta y of module position
// loop over the modules in z
for (int j = 0; j < nz; j++) {
- string module_name = _toString(module, "module%d");
+ string module_name = _toString(module, "module%d");
DetElement mod_elt(lay_elt, module_name, module);
- double mod_z = 0.5 * dimensions.length();
- double z_placement = mod_z - j * nz * mod_z; // z location for module placement
- double z_offset =
- z_placement > 0 ? -z0 / 2.0 : z0 / 2.0; // determine the amount of overlap in z the z nz modules have
+ double mod_z = 0.5 * dimensions.length();
+ double z_placement = mod_z - j * nz * mod_z; // z location for module placement
+ double z_offset =
+ z_placement > 0
+ ? -z0 / 2.0
+ : z0 / 2.0; // determine the amount of overlap in z the z nz modules have
Transform3D tr(RotationZYX(0.0, ((M_PI / 2) - phic - phi_tilt), -M_PI / 2),
Position(xc, yc, mpgd_pos.z() + z_placement + z_offset)); // in x-y plane,
@@ -286,7 +296,7 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
mod_elt.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
+ DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
comp_de.setPlacement(sens_pv);
}
// increas module counter
@@ -307,7 +317,8 @@ static Ref_t create_BarrelPlanarMPGDTracker_geo(Detector& description, xml_h e,
for (xml_coll_t lmat(x_layer, _Unicode(layer_material)); lmat; ++lmat) {
xml_comp_t x_layer_material = lmat;
- DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams, "layer_material");
+ DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams,
+ "layer_material");
}
}
sdet.setAttributes(description, assembly, x_det.regionStr(), x_det.limitsStr(), x_det.visStr());
diff --git a/src/BarrelTrackerWithFrame_geo.cpp b/src/BarrelTrackerWithFrame_geo.cpp
index c0d58bae5..e8fa910c0 100644
--- a/src/BarrelTrackerWithFrame_geo.cpp
+++ b/src/BarrelTrackerWithFrame_geo.cpp
@@ -44,17 +44,16 @@ using namespace dd4hep::detail;
*
* @author Whitney Armstrong
*/
-static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, SensitiveDetector sens)
-{
+static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, SensitiveDetector sens) {
typedef vector Placements;
- xml_det_t x_det = e;
- Material air = description.air();
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- DetElement sdet(det_name, det_id);
-
- map volumes;
- map sensitives;
+ xml_det_t x_det = e;
+ Material air = description.air();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ DetElement sdet(det_name, det_id);
+
+ map volumes;
+ map sensitives;
map> volplane_surfaces;
map> module_thicknesses;
@@ -62,14 +61,13 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
// Set detector type flag
dd4hep::xml::setDetectorTypeFlag(x_det, sdet);
- auto ¶ms = DD4hepDetectorHelper::ensureExtension(
- sdet);
+ auto& params = DD4hepDetectorHelper::ensureExtension(sdet);
// Add the volume boundary material if configured
for (xml_coll_t bmat(x_det, _Unicode(boundary_material)); bmat; ++bmat) {
xml_comp_t x_boundary_material = bmat;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, params,
- "boundary_material");
+ "boundary_material");
}
// dd4hep::xml::Dimension dimensions(x_det.dimensions());
@@ -81,27 +79,29 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
// Loop over the suports
for (xml_coll_t su(x_det, _U(support)); su; ++su) {
- xml_comp_t x_support = su;
- double support_thickness = getAttrOrDefault(x_support, _U(thickness), 2.0 * mm);
- double support_length = getAttrOrDefault(x_support, _U(length), 2.0 * mm);
- double support_rmin = getAttrOrDefault(x_support, _U(rmin), 2.0 * mm);
- double support_zstart = getAttrOrDefault(x_support, _U(zstart), 2.0 * mm);
- std::string support_name = getAttrOrDefault(x_support, _Unicode(name), "support_tube");
- std::string support_vis = getAttrOrDefault(x_support, _Unicode(vis), "AnlRed");
- xml_dim_t pos(x_support.child(_U(position), false));
- xml_dim_t rot(x_support.child(_U(rotation), false));
- Solid support_solid;
+ xml_comp_t x_support = su;
+ double support_thickness = getAttrOrDefault(x_support, _U(thickness), 2.0 * mm);
+ double support_length = getAttrOrDefault(x_support, _U(length), 2.0 * mm);
+ double support_rmin = getAttrOrDefault(x_support, _U(rmin), 2.0 * mm);
+ double support_zstart = getAttrOrDefault(x_support, _U(zstart), 2.0 * mm);
+ std::string support_name =
+ getAttrOrDefault(x_support, _Unicode(name), "support_tube");
+ std::string support_vis = getAttrOrDefault(x_support, _Unicode(vis), "AnlRed");
+ xml_dim_t pos(x_support.child(_U(position), false));
+ xml_dim_t rot(x_support.child(_U(rotation), false));
+ Solid support_solid;
if (x_support.hasChild(_U(shape))) {
xml_comp_t shape(x_support.child(_U(shape)));
- string shape_type = shape.typeStr();
- support_solid = xml::createShape(description, shape_type, shape);
+ string shape_type = shape.typeStr();
+ support_solid = xml::createShape(description, shape_type, shape);
} else {
support_solid = Tube(support_rmin, support_rmin + support_thickness, support_length / 2);
}
- Transform3D tr = Transform3D(Rotation3D(), Position(0, 0, (support_zstart + support_length / 2)));
+ Transform3D tr =
+ Transform3D(Rotation3D(), Position(0, 0, (support_zstart + support_length / 2)));
if (pos.ptr() && rot.ptr()) {
Rotation3D rot3D(RotationZYX(rot.z(0), rot.y(0), rot.x(0)));
- Position pos3D(pos.x(0), pos.y(0), pos.z(0));
+ Position pos3D(pos.x(0), pos.y(0), pos.z(0));
tr = Transform3D(rot3D, pos3D);
} else if (pos.ptr()) {
tr = Transform3D(Rotation3D(), Position(pos.x(0), pos.y(0), pos.z(0)));
@@ -110,7 +110,7 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
tr = Transform3D(rot3D, Position());
}
Material support_mat = description.material(x_support.materialStr());
- Volume support_vol(support_name, support_solid, support_mat);
+ Volume support_vol(support_name, support_solid, support_mat);
support_vol.setVisAttributes(description.visAttributes(support_vis));
pv = assembly.placeVolume(support_vol, tr);
// pv = assembly.placeVolume(support_vol, Position(0, 0, support_zstart + support_length / 2));
@@ -119,7 +119,7 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
// loop over the modules
for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
xml_comp_t x_mod = mi;
- string m_nam = x_mod.nameStr();
+ string m_nam = x_mod.nameStr();
if (volumes.find(m_nam) != volumes.end()) {
printout(ERROR, "BarrelTrackerWithFrame",
@@ -127,8 +127,8 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
throw runtime_error("Logics error in building modules.");
}
- int ncomponents = 0;
- int sensor_number = 1;
+ int ncomponents = 0;
+ int sensor_number = 1;
double total_thickness = 0;
// Compute module total thickness from components
@@ -154,33 +154,38 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
double frame_width2 = 2.0 * frame_height2 / tanth;
Trd1 moduleframe_part1(frame_width / 2, 0.001 * mm, m_frame.length() / 2, frame_height / 2);
- Trd1 moduleframe_part2(frame_width2 / 2, 0.001 * mm, m_frame.length() / 2 + 0.01 * mm, frame_height2 / 2);
+ Trd1 moduleframe_part2(frame_width2 / 2, 0.001 * mm, m_frame.length() / 2 + 0.01 * mm,
+ frame_height2 / 2);
- SubtractionSolid moduleframe(moduleframe_part1, moduleframe_part2, Position(0.0, frame_thickness, 0.0));
- Volume v_moduleframe(m_nam + "_vol", moduleframe, description.material(m_frame.materialStr()));
+ SubtractionSolid moduleframe(moduleframe_part1, moduleframe_part2,
+ Position(0.0, frame_thickness, 0.0));
+ Volume v_moduleframe(m_nam + "_vol", moduleframe,
+ description.material(m_frame.materialStr()));
v_moduleframe.setVisAttributes(description, m_frame.visStr());
- m_vol.placeVolume(v_moduleframe, Position(0.0, 0.0, frame_height / 2 + total_thickness / 2.0));
+ m_vol.placeVolume(v_moduleframe,
+ Position(0.0, 0.0, frame_height / 2 + total_thickness / 2.0));
}
double thickness_so_far = 0.0;
double thickness_sum = -total_thickness / 2.0;
for (xml_coll_t mci(x_mod, _U(module_component)); mci; ++mci, ++ncomponents) {
- xml_comp_t x_comp = mci;
- xml_comp_t x_pos = x_comp.position(false);
- xml_comp_t x_rot = x_comp.rotation(false);
- const string c_nam = _toString(ncomponents, "component%d");
- Box c_box(x_comp.width() / 2, x_comp.length() / 2, x_comp.thickness() / 2);
- Volume c_vol(c_nam, c_box, description.material(x_comp.materialStr()));
+ xml_comp_t x_comp = mci;
+ xml_comp_t x_pos = x_comp.position(false);
+ xml_comp_t x_rot = x_comp.rotation(false);
+ const string c_nam = _toString(ncomponents, "component%d");
+ Box c_box(x_comp.width() / 2, x_comp.length() / 2, x_comp.thickness() / 2);
+ Volume c_vol(c_nam, c_box, description.material(x_comp.materialStr()));
// Utility variable for the relative z-offset based off the previous components
const double zoff = thickness_sum + x_comp.thickness() / 2.0;
if (x_pos && x_rot) {
- Position c_pos(x_pos.x(0), x_pos.y(0), x_pos.z(0) + zoff);
+ Position c_pos(x_pos.x(0), x_pos.y(0), x_pos.z(0) + zoff);
RotationZYX c_rot(x_rot.z(0), x_rot.y(0), x_rot.x(0));
pv = m_vol.placeVolume(c_vol, Transform3D(c_rot, c_pos));
} else if (x_rot) {
Position c_pos(0, 0, zoff);
- pv = m_vol.placeVolume(c_vol, Transform3D(RotationZYX(x_rot.z(0), x_rot.y(0), x_rot.x(0)), c_pos));
+ pv = m_vol.placeVolume(c_vol,
+ Transform3D(RotationZYX(x_rot.z(0), x_rot.y(0), x_rot.x(0)), c_pos));
} else if (x_pos) {
pv = m_vol.placeVolume(c_vol, Position(x_pos.x(0), x_pos.y(0), x_pos.z(0) + zoff));
} else {
@@ -233,18 +238,18 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
xml_comp_t x_barrel = x_layer.child(_U(barrel_envelope));
xml_comp_t x_layout = x_layer.child(_U(rphi_layout));
xml_comp_t z_layout = x_layer.child(_U(z_layout)); // Get the element.
- int lay_id = x_layer.id();
- string m_nam = x_layer.moduleStr();
- string lay_nam = det_name + _toString(x_layer.id(), "_layer%d");
- Tube lay_tub(x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.z_length() / 2.0);
- Volume lay_vol(lay_nam, lay_tub, air); // Create the layer envelope volume.
- Position lay_pos(0, 0, getAttrOrDefault(x_barrel, _U(z0), 0.));
+ int lay_id = x_layer.id();
+ string m_nam = x_layer.moduleStr();
+ string lay_nam = det_name + _toString(x_layer.id(), "_layer%d");
+ Tube lay_tub(x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.z_length() / 2.0);
+ Volume lay_vol(lay_nam, lay_tub, air); // Create the layer envelope volume.
+ Position lay_pos(0, 0, getAttrOrDefault(x_barrel, _U(z0), 0.));
lay_vol.setVisAttributes(description.visAttributes(x_layer.visStr()));
double phi0 = x_layout.phi0(); // Starting phi of first module.
double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a module.
double rc = x_layout.rc(); // Radius of the module center.
- int nphi = x_layout.nphi(); // Number of modules in phi.
+ int nphi = x_layout.nphi(); // Number of modules in phi.
double rphi_dr = x_layout.dr(); // The delta radius of every other module.
double phi_incr = (M_PI * 2) / nphi; // Phi increment for one module.
double phic = phi0; // Phi of the module center.
@@ -252,19 +257,19 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
double nz = z_layout.nz(); // Number of modules to place in z.
double z_dr = z_layout.dr(); // Radial displacement parameter, of every other module.
- Volume module_env = volumes[m_nam];
- DetElement lay_elt(sdet, lay_nam, lay_id);
+ Volume module_env = volumes[m_nam];
+ DetElement lay_elt(sdet, lay_nam, lay_id);
Placements& sensVols = sensitives[m_nam];
// the local coordinate systems of modules in dd4hep and acts differ
// see http://acts.web.cern.ch/ACTS/latest/doc/group__DD4hepPlugins.html
- auto &layerParams =
- DD4hepDetectorHelper::ensureExtension(
- lay_elt);
+ auto& layerParams =
+ DD4hepDetectorHelper::ensureExtension(lay_elt);
for (xml_coll_t lmat(x_layer, _Unicode(layer_material)); lmat; ++lmat) {
xml_comp_t x_layer_material = lmat;
- DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams, "layer_material");
+ DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams,
+ "layer_material");
}
// Z increment for module placement along Z axis.
@@ -273,7 +278,7 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
// Starting z for module placement along Z axis.
double module_z = -z0;
- int module = 1;
+ int module = 1;
// Loop over the number of modules in phi.
for (int ii = 0; ii < nphi; ii++) {
@@ -284,20 +289,22 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
// Loop over the number of modules in z.
for (int j = 0; j < nz; j++) {
- string module_name = _toString(module, "module%d");
+ string module_name = _toString(module, "module%d");
DetElement mod_elt(lay_elt, module_name, module);
- Transform3D tr(RotationZYX(0, ((M_PI / 2) - phic - phi_tilt), -M_PI / 2), Position(x, y, module_z));
+ Transform3D tr(RotationZYX(0, ((M_PI / 2) - phic - phi_tilt), -M_PI / 2),
+ Position(x, y, module_z));
pv = lay_vol.placeVolume(module_env, tr);
pv.addPhysVolID("module", module);
mod_elt.setPlacement(pv);
for (size_t ic = 0; ic < sensVols.size(); ++ic) {
PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
+ DetElement comp_de(mod_elt, std::string("de_") + sens_pv.volume().name(), module);
comp_de.setPlacement(sens_pv);
- auto &comp_de_params = DD4hepDetectorHelper::ensureExtension(comp_de);
+ auto& comp_de_params =
+ DD4hepDetectorHelper::ensureExtension(comp_de);
comp_de_params.set("axis_definitions", "XYZ");
// comp_de.setAttributes(description, sens_pv.volume(), x_layer.regionStr(), x_layer.limitsStr(),
// xml_det_t(xmleles[m_nam]).visStr());
@@ -325,7 +332,8 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi
// Create the PhysicalVolume for the layer.
pv = assembly.placeVolume(lay_vol, lay_pos); // Place layer in mother
pv.addPhysVolID("layer", lay_id); // Set the layer ID.
- lay_elt.setAttributes(description, lay_vol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
+ lay_elt.setAttributes(description, lay_vol, x_layer.regionStr(), x_layer.limitsStr(),
+ x_layer.visStr());
lay_elt.setPlacement(pv);
}
sdet.setAttributes(description, assembly, x_det.regionStr(), x_det.limitsStr(), x_det.visStr());
diff --git a/src/CompositeTracker_geo.cpp b/src/CompositeTracker_geo.cpp
index a9d8d75ab..6e9dafe54 100644
--- a/src/CompositeTracker_geo.cpp
+++ b/src/CompositeTracker_geo.cpp
@@ -18,26 +18,24 @@
using namespace dd4hep;
using namespace dd4hep::detail;
-static Ref_t create_element(Detector& description, xml_h e, Ref_t)
-{
- xml_det_t x_det(e);
+static Ref_t create_element(Detector& description, xml_h e, Ref_t) {
+ xml_det_t x_det(e);
const std::string det_name = x_det.nameStr();
- DetElement sdet(det_name, x_det.id());
- Volume vol;
- Position pos;
+ DetElement sdet(det_name, x_det.id());
+ Volume vol;
+ Position pos;
const bool usePos = x_det.hasChild(_U(position));
// Set detector type flag
dd4hep::xml::setDetectorTypeFlag(x_det, sdet);
- auto ¶ms = DD4hepDetectorHelper::ensureExtension(
- sdet);
+ auto& params = DD4hepDetectorHelper::ensureExtension(sdet);
// Add the volume boundary material if configured
for (xml_coll_t bmat(x_det, _Unicode(boundary_material)); bmat; ++bmat) {
xml_comp_t x_boundary_material = bmat;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, params,
- "boundary_material");
+ "boundary_material");
}
if (usePos) {
@@ -46,7 +44,7 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t)
vol = Assembly(det_name);
vol.setAttributes(description, x_det.regionStr(), x_det.limitsStr(), x_det.visStr());
- Volume mother = description.pickMotherVolume(sdet);
+ Volume mother = description.pickMotherVolume(sdet);
PlacedVolume pv;
if (usePos) {
pv = mother.placeVolume(vol, pos);
@@ -55,8 +53,8 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t)
}
sdet.setPlacement(pv);
for (xml_coll_t c(x_det, _U(composite)); c; ++c) {
- xml_dim_t component = c;
- const std::string nam = component.nameStr();
+ xml_dim_t component = c;
+ const std::string nam = component.nameStr();
description.declareParent(nam, sdet);
}
return sdet;
diff --git a/src/CylindricalDipoleMagnet_geo.cpp b/src/CylindricalDipoleMagnet_geo.cpp
index b8ea34dfc..33f931884 100644
--- a/src/CylindricalDipoleMagnet_geo.cpp
+++ b/src/CylindricalDipoleMagnet_geo.cpp
@@ -14,43 +14,41 @@ using namespace dd4hep;
using namespace dd4hep::rec;
using namespace ROOT::Math;
-static Ref_t build_magnet(Detector& dtor, xml_h e, SensitiveDetector /* sens */)
-{
+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();
+ 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(_U(theta));
+ double pos_x = pos.x();
+ double pos_y = pos.y();
+ double pos_z = pos.z();
+ double pos_theta = pos.attr(_U(theta));
xml_dim_t dims = x_det.dimensions();
- double dim_r = dims.r();
- double dim_z = dims.z();
+ double dim_r = dims.r();
+ double dim_z = dims.z();
xml_dim_t apperture = x_det.child(_Unicode(apperture));
- double app_r = apperture.r();
- Material iron = dtor.material("Iron");
-
+ double app_r = apperture.r();
+ Material iron = dtor.material("Iron");
DetElement sdet(det_name, det_id);
- Assembly assembly(det_name + "_assembly");
+ Assembly assembly(det_name + "_assembly");
const string module_name = "Quad_magnet";
- const string yoke_vis = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "FFMagnetVis");
+ const string yoke_vis =
+ dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "FFMagnetVis");
sdet.setAttributes(dtor, assembly, x_det.regionStr(), x_det.limitsStr(), yoke_vis);
// -- yoke
- Tube yoke_tube(app_r, dim_r, 0.5 * dim_z);
+ Tube yoke_tube(app_r, dim_r, 0.5 * dim_z);
Volume yoke_vol("yoke_vol", yoke_tube, iron);
- auto yoke_pv = assembly.placeVolume(yoke_vol);
+ 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);
-
// -- 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);
diff --git a/src/CylindricalMagnetChain_geo.cpp b/src/CylindricalMagnetChain_geo.cpp
index 57395b79a..607a575f9 100644
--- a/src/CylindricalMagnetChain_geo.cpp
+++ b/src/CylindricalMagnetChain_geo.cpp
@@ -20,41 +20,39 @@ using namespace dd4hep;
using namespace dd4hep::rec;
using namespace ROOT::Math;
-static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* sens */)
-{
- xml_det_t x_det = e;
- string det_name = x_det.nameStr();
+static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* sens */) {
+ xml_det_t x_det = e;
+ string det_name = x_det.nameStr();
DetElement sdet(det_name, x_det.id());
- Assembly assembly(det_name + "_assembly");
- Material m_Iron = description.material("Iron");
- string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "FFMagnetVis");
+ Assembly assembly(det_name + "_assembly");
+ Material m_Iron = description.material("Iron");
+ string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "FFMagnetVis");
+ for (xml_coll_t magnet_coll(x_det, _Unicode(magnet)); magnet_coll; magnet_coll++) { // magnets
- for( xml_coll_t magnet_coll(x_det, _Unicode(magnet)); magnet_coll; magnet_coll++ ) { // magnets
+ xml_comp_t magnet(magnet_coll);
- xml_comp_t magnet( magnet_coll );
-
- string name = getAttrOrDefault(magnet, _Unicode(name), "");
- double x = getAttrOrDefault(magnet, _Unicode(x), 0);
- double y = getAttrOrDefault(magnet, _Unicode(y), 0);
- double z = getAttrOrDefault(magnet, _Unicode(z), 0);
- double theta = getAttrOrDefault(magnet, _Unicode(theta), 0);
+ string name = getAttrOrDefault(magnet, _Unicode(name), "");
+ double x = getAttrOrDefault(magnet, _Unicode(x), 0);
+ double y = getAttrOrDefault(magnet, _Unicode(y), 0);
+ double z = getAttrOrDefault(magnet, _Unicode(z), 0);
+ double theta = getAttrOrDefault(magnet, _Unicode(theta), 0);
double length = getAttrOrDefault(magnet, _Unicode(length), 0);
- double rin = getAttrOrDefault(magnet, _Unicode(rin), 0);
- double rout = getAttrOrDefault